@@ -115,8 +115,10 @@ class JitCall {
115115 // FIXME: Figure out how to unify the wrapper signatures.
116116 // FIXME: Hide these implementation details by moving wrapper generation in
117117 // this class.
118- using GenericCall = void (*)(void *, size_t , void **, void *);
119- using DestructorCall = void (*)(void *, unsigned long , int );
118+ // (self, nargs, args, result, nary)
119+ using GenericCall = void (*)(void *, size_t , void **, void *, size_t );
120+ // (self, nary, withFree)
121+ using DestructorCall = void (*)(void *, size_t , int );
120122
121123private:
122124 union {
@@ -162,19 +164,20 @@ class JitCall {
162164 // self can go in the end and be nullptr by default; result can be a nullptr
163165 // by default. These changes should be synchronized with the wrapper if we
164166 // decide to directly.
165- void Invoke (void * result, ArgList args = {}, void * self = nullptr ) const {
167+ void Invoke (void * result, ArgList args = {}, void * self = nullptr ,
168+ size_t nary = 0UL ) const {
166169 // NOLINTBEGIN(*-type-union-access)
167170 // Forward if we intended to call a dtor with only 1 parameter.
168171 if (m_Kind == kDestructorCall && result && !args.m_Args ) {
169- InvokeDestructor (result, /* nary= */ 0UL , /* withFree=*/ true );
172+ InvokeDestructor (result, nary, /* withFree=*/ true );
170173 return ;
171174 }
172175
173176#ifndef NDEBUG
174177 assert (AreArgumentsValid (result, args, self) && " Invalid args!" );
175178 ReportInvokeStart (result, args, self);
176179#endif // NDEBUG
177- m_GenericCall (self, args.m_ArgSize , args.m_Args , result);
180+ m_GenericCall (self, args.m_ArgSize , args.m_Args , result, nary );
178181 // NOLINTEND(*-type-union-access)
179182 }
180183 // / Makes a call to a destructor.
@@ -778,20 +781,33 @@ enum : long int {
778781// / Gets the size/dimensions of a multi-dimension array.
779782CPPINTEROP_API std::vector<long int > GetDimensions (TCppType_t type);
780783
781- // / Allocates memory for a given class.
782- CPPINTEROP_API TCppObject_t Allocate (TCppScope_t scope);
784+ // / Allocates memory required by an object of a given class
785+ // / \c scope Given class for which to allocate memory for
786+ // / \c count is used to indicate the number of objects to allocate for.
787+ CPPINTEROP_API TCppObject_t Allocate (TCppScope_t scope,
788+ TCppIndex_t count = 1UL );
783789
784790// / Deallocates memory for a given class.
785- CPPINTEROP_API void Deallocate (TCppScope_t scope, TCppObject_t address);
786-
787- // / Creates an object of class \c scope and calls its default constructor. If
788- // / \c arena is set it uses placement new.
789- CPPINTEROP_API TCppObject_t Construct (TCppScope_t scope, void * arena = nullptr );
790-
791- // / Calls the destructor of object of type \c type. When withFree is true it
792- // / calls operator delete/free.
791+ // / \c scope Class to indicate size of memory to deallocate
792+ // / \c count is used to indicate the number of objects to dallocate for
793+ CPPINTEROP_API void Deallocate (TCppScope_t scope, TCppObject_t address,
794+ TCppIndex_t count = 1UL );
795+
796+ // / Creates one or more objects of class \c scope by calling its default
797+ // / constructor.
798+ // / \c arena If set, this API uses placement new to construct at this address.
799+ // / \c count is used to indicate the number of objects to construct.
800+ CPPINTEROP_API TCppObject_t Construct (TCppScope_t scope, void * arena = nullptr ,
801+ TCppIndex_t count = 1UL );
802+
803+ // / Destroys one or more objects of a class
804+ // / \c This this pointer of the object to destruct. Can also be the starting
805+ // / address of an array of objects
806+ // / \c withFree if true, we call operator delete/free, else just the destructor
807+ // / \c count indicate the number of objects to destruct, if \c This points to
808+ // / an array of objects
793809CPPINTEROP_API void Destruct (TCppObject_t This, TCppScope_t type,
794- bool withFree = true );
810+ bool withFree = true , TCppIndex_t count = 0UL );
795811
796812// / @name Stream Redirection
797813// /
0 commit comments