@@ -88,13 +88,17 @@ namespace Cpp {
8888
8989 enum OperatorArity { kUnary = 1 , kBinary , kBoth };
9090
91+ // enum CtorCallType : short
92+ // { kArena = 0, kArray = 2
93+ // };
94+
9195 // / A class modeling function calls for functions produced by the interpreter
9296 // / in compiled code. It provides an information if we are calling a standard
9397 // / function, constructor or destructor.
9498 class JitCall {
9599 public:
96100 friend CPPINTEROP_API JitCall
97- MakeFunctionCallable (TInterp_t I, TCppConstFunction_t func);
101+ MakeFunctionCallable (TInterp_t I, TCppConstFunction_t func, bool is_arena, bool is_array );
98102 enum Kind : char {
99103 kUnknown = 0 ,
100104 kGenericCall ,
@@ -111,7 +115,8 @@ namespace Cpp {
111115 // FIXME: Figure out how to unify the wrapper signatures.
112116 // FIXME: Hide these implementation details by moving wrapper generation in
113117 // this class.
114- using GenericCall = void (*)(void *, int , void **, void *);
118+ // (self, nargs, args, result, n_objs)
119+ using GenericCall = void (*)(void *, int , void **, void *, unsigned long );
115120 using DestructorCall = void (*)(void *, unsigned long , int );
116121 private:
117122 union {
@@ -156,7 +161,7 @@ namespace Cpp {
156161 // self can go in the end and be nullptr by default; result can be a nullptr
157162 // by default. These changes should be synchronized with the wrapper if we
158163 // decide to directly.
159- void Invoke (void * result, ArgList args = {}, void * self = nullptr ) const {
164+ void Invoke (void * result, ArgList args = {}, void * self = nullptr , size_t n_objs = 0UL ) const {
160165 // Forward if we intended to call a dtor with only 1 parameter.
161166 if (m_Kind == kDestructorCall && result && !args.m_Args )
162167 return InvokeDestructor (result, /* nary=*/ 0UL , /* withFree=*/ true );
@@ -165,7 +170,7 @@ namespace Cpp {
165170 assert (AreArgumentsValid (result, args, self) && " Invalid args!" );
166171 ReportInvokeStart (result, args, self);
167172#endif // NDEBUG
168- m_GenericCall (self, args.m_ArgSize , args.m_Args , result);
173+ m_GenericCall (self, args.m_ArgSize , args.m_Args , result, n_objs );
169174 }
170175 // / Makes a call to a destructor.
171176 // /\param[in] object - the pointer of the object whose destructor we call.
@@ -566,10 +571,10 @@ namespace Cpp {
566571
567572 // / Creates a trampoline function by using the interpreter and returns a
568573 // / uniform interface to call it from compiled code.
569- CPPINTEROP_API JitCall MakeFunctionCallable (TCppConstFunction_t func);
574+ CPPINTEROP_API JitCall MakeFunctionCallable (TCppConstFunction_t func, bool is_arena = false , bool is_array = false );
570575
571576 CPPINTEROP_API JitCall MakeFunctionCallable (TInterp_t I,
572- TCppConstFunction_t func);
577+ TCppConstFunction_t func, bool is_arena = false , bool is_array = false );
573578
574579 // / Checks if a function declared is of const type or not.
575580 CPPINTEROP_API bool IsConstMethod (TCppFunction_t method);
@@ -757,15 +762,15 @@ namespace Cpp {
757762 CPPINTEROP_API std::vector<long int > GetDimensions (TCppType_t type);
758763
759764 // / Allocates memory for a given class.
760- CPPINTEROP_API TCppObject_t Allocate (TCppScope_t scope);
765+ CPPINTEROP_API TCppObject_t Allocate (TCppScope_t scope, int n = 1 );
761766
762767 // / Deallocates memory for a given class.
763768 CPPINTEROP_API void Deallocate (TCppScope_t scope, TCppObject_t address);
764769
765770 // / Creates an object of class \c scope and calls its default constructor. If
766771 // / \c arena is set it uses placement new.
767772 CPPINTEROP_API TCppObject_t Construct (TCppScope_t scope,
768- void * arena = nullptr );
773+ void * arena = nullptr , unsigned long n_objs = 0UL );
769774
770775 // / Calls the destructor of object of type \c type. When withFree is true it
771776 // / calls operator delete/free.
0 commit comments