| 636 | |
| 637 | |
| 638 | void ScriptCallable::compile() |
| 639 | { |
| 640 | if (!compiled && body) |
| 641 | { |
| 642 | int size = stackSize; |
| 643 | #ifdef HXCPP_STACK_TRACE |
| 644 | size += sizeof(StackFrame); |
| 645 | #endif |
| 646 | CppiaCompiler *compiler = CppiaCompiler::create(size); |
| 647 | |
| 648 | // First pass calculates size... |
| 649 | genDefaults(compiler); |
| 650 | |
| 651 | #ifdef HXCPP_STACK_TRACE |
| 652 | compiler->move(sJitFrame.star(jtPointer)+(offsetof(StackFrame,position) + stackSize), (void *)&position ); |
| 653 | compiler->add(sJitArg1.as(jtPointer), sJitFrame.as(jtPointer), stackSize ); |
| 654 | compiler->callNative( (void *)pushFrame, sJitCtx.as(jtPointer), sJitArg1.as(jtPointer) ); |
| 655 | |
| 656 | compiler->setOnReturn( onReturn, stackSize ); |
| 657 | #ifdef HXCPP_STACK_LINE |
| 658 | compiler->setLineOffset( stackSize + offsetof(StackFrame,lineNumber) ); |
| 659 | #endif |
| 660 | #endif |
| 661 | |
| 662 | body->genCode(compiler); |
| 663 | |
| 664 | compiler->beginGeneration(1); |
| 665 | |
| 666 | // Second pass does the job |
| 667 | genDefaults(compiler); |
| 668 | |
| 669 | #ifdef HXCPP_STACK_TRACE |
| 670 | compiler->move(sJitFrame.star(jtPointer)+(offsetof(StackFrame,position) + stackSize), (void *)&position ); |
| 671 | compiler->add(sJitArg1.as(jtPointer), sJitFrame.as(jtPointer), stackSize ); |
| 672 | compiler->callNative( (void *)pushFrame, sJitCtx.as(jtPointer), sJitArg1.as(jtPointer) ); |
| 673 | #endif |
| 674 | |
| 675 | body->genCode(compiler); |
| 676 | |
| 677 | compiled = compiler->finishGeneration(); |
| 678 | |
| 679 | delete compiler; |
| 680 | } |
| 681 | } |
| 682 | #endif |
| 683 | |
| 684 | // --- CppiaClosure ---- |
nothing calls this directly
no test coverage detected