@@ -879,37 +879,46 @@ void release_args(Parameter* args, size_t nargs) {
879
879
// return (!is_direct && wrap->fFaceptr.fGeneric) || (is_direct && wrap->fFaceptr.fDirect);
880
880
// }
881
881
882
- static inline
883
- bool WrapperCall (Cppyy::TCppMethod_t method, size_t nargs, void * args_, void * self, void * result)
884
- {
885
- Parameter* args = (Parameter*)args_;
886
- bool is_direct = nargs & DIRECT_CALL;
887
- nargs = CALL_NARGS (nargs);
888
-
889
- // if (!is_ready(wrap, is_direct))
890
- // return false; // happens with compilation error
891
-
892
- if (Cpp::JitCall JC = Cpp::MakeFunctionCallable (method)) {
893
- bool runRelease = false ;
894
- // const auto& fgen = /* is_direct ? faceptr.fDirect : */ faceptr;
895
- if (nargs <= SMALL_ARGS_N) {
896
- void * smallbuf[SMALL_ARGS_N];
897
- if (nargs) runRelease = copy_args (args, nargs, smallbuf);
898
- // CLING_CATCH_UNCAUGHT_
899
- JC.Invoke (result, {smallbuf, nargs}, self);
900
- // _CLING_CATCH_UNCAUGHT
901
- } else {
902
- std::vector<void *> buf (nargs);
903
- runRelease = copy_args (args, nargs, buf.data ());
904
- // CLING_CATCH_UNCAUGHT_
905
- JC.Invoke (result, {buf.data (), nargs}, self);
906
- // _CLING_CATCH_UNCAUGHT
907
- }
908
- if (runRelease) release_args (args, nargs);
909
- return true ;
910
- }
882
+ static inline bool WrapperCall (Cppyy::TCppMethod_t method, size_t nargs,
883
+ void * args_, void * self, void * result) {
884
+ Parameter* args = (Parameter*)args_;
885
+ bool is_direct = nargs & DIRECT_CALL;
886
+ nargs = CALL_NARGS (nargs);
887
+
888
+ // if (!is_ready(wrap, is_direct))
889
+ // return false; // happens with compilation error
890
+
891
+ Cpp::JitCall JC = Cpp::MakeFunctionCallable (method);
911
892
893
+ if (!JC)
912
894
return false ;
895
+
896
+ bool runRelease = false ;
897
+ // const auto& fgen = /* is_direct ? faceptr.fDirect : */ faceptr;
898
+
899
+ auto invokeHelper = [&](auto invoker) {
900
+ if (nargs <= SMALL_ARGS_N) {
901
+ void * smallbuf[SMALL_ARGS_N];
902
+ if (nargs)
903
+ runRelease = copy_args (args, nargs, smallbuf);
904
+ // CLING_CATCH_UNCAUGHT_
905
+ invoker (smallbuf, nargs);
906
+ // _CLING_CATCH_UNCAUGHT
907
+ } else {
908
+ std::vector<void *> buf (nargs);
909
+ runRelease = copy_args (args, nargs, buf.data ());
910
+ // CLING_CATCH_UNCAUGHT_
911
+ invoker (buf.data (), nargs);
912
+ // _CLING_CATCH_UNCAUGHT
913
+ }
914
+ };
915
+
916
+ invokeHelper (
917
+ [&](void ** buf, size_t count) { JC.Invoke (result, {buf, count}, self); });
918
+
919
+ if (runRelease)
920
+ release_args (args, nargs);
921
+ return true ;
913
922
}
914
923
915
924
template <typename T>
0 commit comments