@@ -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.
@@ -791,20 +794,33 @@ enum : long int {
791794// / Gets the size/dimensions of a multi-dimension array.
792795CPPINTEROP_API std::vector<long int > GetDimensions (TCppType_t type);
793796
794- // / Allocates memory for a given class.
795- CPPINTEROP_API TCppObject_t Allocate (TCppScope_t scope);
797+ // / Allocates memory required by an object of a given class
798+ // / \c scope Given class for which to allocate memory for
799+ // / \c count is used to indicate the number of objects to allocate for.
800+ CPPINTEROP_API TCppObject_t Allocate (TCppScope_t scope,
801+ TCppIndex_t count = 1UL );
796802
797803// / Deallocates memory for a given class.
798- CPPINTEROP_API void Deallocate (TCppScope_t scope, TCppObject_t address);
799-
800- // / Creates an object of class \c scope and calls its default constructor. If
801- // / \c arena is set it uses placement new.
802- CPPINTEROP_API TCppObject_t Construct (TCppScope_t scope, void * arena = nullptr );
803-
804- // / Calls the destructor of object of type \c type. When withFree is true it
805- // / calls operator delete/free.
804+ // / \c scope Class to indicate size of memory to deallocate
805+ // / \c count is used to indicate the number of objects to dallocate for
806+ CPPINTEROP_API void Deallocate (TCppScope_t scope, TCppObject_t address,
807+ TCppIndex_t count = 1UL );
808+
809+ // / Creates one or more objects of class \c scope by calling its default
810+ // / constructor.
811+ // / \c arena If set, this API uses placement new to construct at this address.
812+ // / \c count is used to indicate the number of objects to construct.
813+ CPPINTEROP_API TCppObject_t Construct (TCppScope_t scope, void * arena = nullptr ,
814+ TCppIndex_t count = 1UL );
815+
816+ // / Destroys one or more objects of a class
817+ // / \c This this pointer of the object to destruct. Can also be the starting
818+ // / address of an array of objects
819+ // / \c withFree if true, we call operator delete/free, else just the destructor
820+ // / \c count indicate the number of objects to destruct, if \c This points to
821+ // / an array of objects
806822CPPINTEROP_API void Destruct (TCppObject_t This, TCppScope_t type,
807- bool withFree = true );
823+ bool withFree = true , TCppIndex_t count = 0UL );
808824
809825// / @name Stream Redirection
810826// /
0 commit comments