MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / doJIT

Method doJIT

source/emulation/cpu/jit/jitCodeGen.cpp:660–716  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

658}
659
660void JitCodeGen::doJIT(U32 address, DecodedOp* op) {
661 BOXEDWINE_CRITICAL_SECTION_WITH_MUTEX(cpu->memory->mutex);
662 if (!cpu->thread->process->startJITOp) {
663 JitCodeGen* jit = startNewJIT(cpu);
664 cpu->thread->process->syncToHost = jit->createSyncToHost();
665 delete jit;
666 jit = startNewJIT(cpu);
667 cpu->thread->process->syncFromHost = jit->createSyncFromHost();
668 delete jit;
669 jit = startNewJIT(cpu);
670 cpu->thread->process->blockExit = jit->createBlockExit();
671 delete jit;
672 jit = startNewJIT(cpu);
673 cpu->thread->process->emulateSingleOp = jit->createEmulateSingleOp();
674 delete jit;
675 jit = startNewJIT(cpu);
676 cpu->thread->process->startJITOp = (OpCallback)jit->createStartJITCode();
677 delete jit;
678#if defined(BOXEDWINE_POSIX) && defined(BOXEDWINE_HOST_EXCEPTIONS)
679 jit = startNewJIT(cpu);
680 cpu->thread->process->signalHandler = jit->createSignalHandler();
681 delete jit;
682#endif
683 createHelpers();
684 for (U32 i = 0; i < FLAGS_NULL; i++) {
685 jit = startNewJIT(cpu);
686 jit->disableTmps = true; // the functions created should not call getTmp since the caller won't know what tmps are in use
687 cpu->thread->process->calculateCF[i] = jit->createCalculationCF((LazyFlagType)i);
688 delete jit;
689 }
690 }
691 if (!cpu->calculateCF[0]) {
692 if (!cpu->thread->process->calculateCF[0]) {
693 kpanic("JitCodeGen::doJIT");
694 }
695 memcpy(cpu->calculateCF, cpu->thread->process->calculateCF, sizeof(cpu->thread->process->calculateCF));
696 }
697 // did another thread beat us to JITing this block?
698 if (op->flags & OP_FLAG_JIT) {
699 // this will get triggered a few times, especially during shutdown
700 // I have see this in firefight installer at the end and opentdd start up
701 return;
702 }
703 this->currentEip = address;
704 this->startingEip = address;
705
706 initDynamicOps();
707
708 if (!calculateLongestBlock(op)) {
709 return;
710 }
711 if (!compileOps(op)) {
712 return;
713 }
714 onBlockPreCommit(op);
715 commitJIT(op);
716}
717

Callers 2

startNewJITFunction · 0.80
startNewJITFunction · 0.80

Calls 11

kpanicFunction · 0.85
memcpyFunction · 0.85
initDynamicOpsFunction · 0.85
createEmulateSingleOpMethod · 0.80
createSignalHandlerMethod · 0.80
createCalculationCFMethod · 0.80
startNewJITFunction · 0.50
createSyncToHostMethod · 0.45
createSyncFromHostMethod · 0.45
createBlockExitMethod · 0.45
createStartJITCodeMethod · 0.45

Tested by

no test coverage detected