@@ -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.
@@ -768,19 +771,24 @@ enum : long int {
768771CPPINTEROP_API std::vector<long int > GetDimensions (TCppType_t type);
769772
770773// / Allocates memory for a given class.
771- CPPINTEROP_API TCppObject_t Allocate (TCppScope_t scope);
774+ // / \c count is used to indicate the number of objects to allocate for.
775+ CPPINTEROP_API TCppObject_t Allocate (TCppScope_t scope,
776+ TCppIndex_t count = 1UL );
772777
773778// / Deallocates memory for a given class.
774- CPPINTEROP_API void Deallocate (TCppScope_t scope, TCppObject_t address);
779+ CPPINTEROP_API void Deallocate (TCppScope_t scope, TCppObject_t address,
780+ TCppIndex_t count = 1UL );
775781
776782// / Creates an object of class \c scope and calls its default constructor. If
777783// / \c arena is set it uses placement new.
778- CPPINTEROP_API TCppObject_t Construct (TCppScope_t scope, void * arena = nullptr );
784+ // / \c count is used to indicate the number of objects to construct.
785+ CPPINTEROP_API TCppObject_t Construct (TCppScope_t scope, void * arena = nullptr ,
786+ TCppIndex_t count = 1UL );
779787
780788// / Calls the destructor of object of type \c type. When withFree is true it
781789// / calls operator delete/free.
782790CPPINTEROP_API void Destruct (TCppObject_t This, TCppScope_t type,
783- bool withFree = true );
791+ bool withFree = true , TCppIndex_t count = 0UL );
784792
785793// / @name Stream Redirection
786794// /
0 commit comments