MCPcopy Create free account
hub / github.com/HaxeFoundation/hxcpp / compile

Method compile

src/hx/cppia/CppiaFunction.cpp:638–681  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

636
637
638void 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 ----

Callers

nothing calls this directly

Calls 10

moveMethod · 0.80
asMethod · 0.80
callNativeMethod · 0.80
setOnReturnMethod · 0.80
setLineOffsetMethod · 0.80
beginGenerationMethod · 0.80
finishGenerationMethod · 0.80
starMethod · 0.45
addMethod · 0.45
genCodeMethod · 0.45

Tested by

no test coverage detected