| 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 |
no test coverage detected