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

Method compileOps

source/emulation/cpu/jit/jitCodeGen.cpp:603–658  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

601}
602
603bool JitCodeGen::compileOps(DecodedOp* op) {
604 DecodedOp* nextOp = op;
605 this->emulatedLen = 0;
606 this->blockOpCount = 0;
607
608 while (nextOp) {
609 if (nextOp->flags & OP_FLAG_NO_JIT) {
610 return false;
611 }
612
613#ifndef __TEST
614#ifdef _DEBUG
615 //callHostFunction(common_log, false, 2, 0, JitCallParamType::CPU, false, (DYN_PTR_SIZE)nextOp, JitCallParamType::CONST_PTR, false);
616#endif
617#endif
618 preCompile(nextOp);
619 // enable this if you want to see the current eip while debugging the generated asm
620 // movValue(JitWidth::b32, getTmpReg(), this->currentEip);
621
622 // this is a nice way to figure out what jit instruction is bugged
623 // assuming the normal, non jit code works. If there is a bug in the jit,
624 // we can emulate instructions using the normal core for certain ranges of instructions
625 // until we find the jit instruction that is causing the bug
626 //
627 // this is currently setup to start debugging with SSE emulated
628 //
629 // 911 = AddpsXmm
630 // 1282 = ShufpdXmmE128
631 //if (nextOp->inst >= 911 && nextOp->inst <= 1282) {
632 // emulateSingleOp();
633 //} else {
634 compile(nextOp);
635 //}
636
637 if (skipToOp) {
638 nextOp = skipToOp;
639 skipToOp = nullptr;
640 }
641 postCompile(nextOp);
642 if (this->currentEip > this->lastOpEip) {
643 break;
644 } else {
645 if (nextOp->next && nextOp->next->inst == Done) {
646 if (!nextOp->isBranch()) { // f16 needs this
647 writeCurrentEip(0);
648 }
649 RegPtr eip = getTmpReg();
650 movValue(JitWidth::b32, eip, currentEip - cpu->seg[CS].address);
651 jumpEip(eip);
652 break;
653 }
654 nextOp = nextOp->next;
655 }
656 }
657 return true;
658}
659
660void JitCodeGen::doJIT(U32 address, DecodedOp* op) {

Callers

nothing calls this directly

Calls 1

isBranchMethod · 0.80

Tested by

no test coverage detected