MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / invokeEx

Method invokeEx

include/daScript/simulate/simulate.h:1219–1256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1217#endif
1218 template <typename Fn>
1219 DAS_EVAL_ABI vec4f Context::invokeEx(const Block &block, vec4f * args, void * cmres, Fn && when, LineInfo * line ) {
1220 char * EP, *SP;
1221 vec4f * TBA = nullptr;
1222 char * STB = stack.bottom();
1223#if DAS_ENABLE_STACK_WALK
1224 if (!stack.push_invoke(sizeof(Prologue), block.stackOffset, EP, SP)) {
1225 throw_error_at(line, "stack overflow during invokeEx");
1226 }
1227 Prologue * pp = (Prologue *)stack.ap();
1228 pp->block = (Block *)(intptr_t(&block) | 1);
1229 pp->arguments = args;
1230 pp->cmres = cmres;
1231 pp->line = line;
1232#else
1233 stack.invoke(block.stackOffset, EP, SP);
1234#endif
1235 BlockArguments * ba = nullptr;
1236 BlockArguments saveArguments;
1237 if ( block.argumentsOffset || cmres ) {
1238 ba = (BlockArguments *) ( STB + block.argumentsOffset );
1239 saveArguments = *ba;
1240 ba->arguments = args;
1241 ba->copyOrMoveResult = (char *) cmres;
1242 TBA = abiThisBlockArg;
1243 abiThisBlockArg = args;
1244 }
1245 vec4f * __restrict saveFunctionArguments = abiArg;
1246 abiArg = block.functionArguments;
1247 SimNode_ClosureBlock * cb = (SimNode_ClosureBlock *) block.body;
1248 when(cb->code0 ? cb->list[0] : block.body);
1249 abiArg = saveFunctionArguments;
1250 if ( ba ) {
1251 *ba = saveArguments;
1252 abiThisBlockArg = TBA;
1253 }
1254 stack.pop(EP, SP);
1255 return result;
1256 }
1257#ifdef _MSC_VER
1258#pragma warning(pop)
1259#endif

Callers 15

builtin_sort_any_cblockFunction · 0.80
forEachFunctionFunction · 0.80
forEachGenericFunctionFunction · 0.80
srtrMethod · 0.80
srtMethod · 0.80

Calls 5

bottomMethod · 0.80
push_invokeMethod · 0.80
apMethod · 0.80
invokeMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected