@@ -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.
@@ -779,19 +782,24 @@ enum : long int {
779782CPPINTEROP_API std::vector<long int > GetDimensions (TCppType_t type);
780783
781784// / Allocates memory for a given class.
782- CPPINTEROP_API TCppObject_t Allocate (TCppScope_t scope);
785+ // / \c count is used to indicate the number of objects to allocate for.
786+ CPPINTEROP_API TCppObject_t Allocate (TCppScope_t scope,
787+ TCppIndex_t count = 1UL );
783788
784789// / Deallocates memory for a given class.
785- CPPINTEROP_API void Deallocate (TCppScope_t scope, TCppObject_t address);
790+ CPPINTEROP_API void Deallocate (TCppScope_t scope, TCppObject_t address,
791+ TCppIndex_t count = 1UL );
786792
787793// / Creates an object of class \c scope and calls its default constructor. If
788794// / \c arena is set it uses placement new.
789- CPPINTEROP_API TCppObject_t Construct (TCppScope_t scope, void * arena = nullptr );
795+ // / \c count is used to indicate the number of objects to construct.
796+ CPPINTEROP_API TCppObject_t Construct (TCppScope_t scope, void * arena = nullptr ,
797+ TCppIndex_t count = 1UL );
790798
791799// / Calls the destructor of object of type \c type. When withFree is true it
792800// / calls operator delete/free.
793801CPPINTEROP_API void Destruct (TCppObject_t This, TCppScope_t type,
794- bool withFree = true );
802+ bool withFree = true , TCppIndex_t count = 0UL );
795803
796804// / @name Stream Redirection
797805// /
0 commit comments