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

Function callOrFastcall

include/daScript/simulate/simulate.h:597–637  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

595 }
596
597 DAS_EVAL_ABI __forceinline vec4f callOrFastcall(const SimFunction * fn, vec4f * args, LineInfo * line) {
598 if ( fn->fastcall ) {
599 if ( fastCallDepth * sizeof(Prologue) > stack.free_size() ) { // this is to catch stack overflow
600 throw_error_at(line, "stack overflow, fast call depth limit exceeded while calling %s", fn->mangledName);
601 }
602 fastCallDepth ++;
603 auto aa = abiArg;
604 abiArg = args;
605 result = fn->code->eval(*this);
606 stopFlags = 0;
607 abiArg = aa;
608 fastCallDepth --;
609 return result;
610 } else {
611 // PUSH
612 char * EP, *SP;
613 if (!stack.push(fn->stackSize, EP, SP)) {
614 throw_error_at(line, "stack overflow while calling %s",fn->mangledName);
615 }
616 // fill prologue
617 auto aa = abiArg;
618 abiArg = args;
619#if DAS_SANITIZER
620 memset(stack.sp(), 0xcd, fn->stackSize);
621#endif
622#if DAS_ENABLE_STACK_WALK
623 Prologue * pp = (Prologue *)stack.sp();
624 pp->info = fn->debugInfo;
625 pp->arguments = args;
626 pp->cmres = nullptr;
627 pp->line = line;
628#endif
629 // CALL
630 fn->code->eval(*this);
631 stopFlags = 0;
632 // POP
633 abiArg = aa;
634 stack.pop(EP, SP);
635 return result;
636 }
637 }
638
639 DAS_EVAL_ABI __forceinline vec4f callWithCopyOnReturn(const SimFunction * fn, vec4f * args, void * cmres, LineInfo * line) {
640 // PUSH

Callers 2

runInitScriptMethod · 0.85
runShutdownScriptMethod · 0.85

Calls 5

free_sizeMethod · 0.80
evalMethod · 0.45
pushMethod · 0.45
spMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected