backend_x64: Remove dispatch loop in Jit::Run
This commit is contained in:
parent
1b37420459
commit
a5bb81a97c
3 changed files with 10 additions and 10 deletions
|
@ -3397,9 +3397,9 @@ void EmitX64::EmitTerminal(IR::Term::LinkBlock terminal, IR::LocationDescriptor
|
||||||
|
|
||||||
patch_information[terminal.next.UniqueHash()].jg.emplace_back(code->getCurr());
|
patch_information[terminal.next.UniqueHash()].jg.emplace_back(code->getCurr());
|
||||||
if (auto next_bb = GetBasicBlock(terminal.next)) {
|
if (auto next_bb = GetBasicBlock(terminal.next)) {
|
||||||
EmitPatchJg(next_bb->entrypoint);
|
EmitPatchJg(terminal.next, next_bb->entrypoint);
|
||||||
} else {
|
} else {
|
||||||
EmitPatchJg();
|
EmitPatchJg(terminal.next);
|
||||||
}
|
}
|
||||||
|
|
||||||
code->mov(MJitStateReg(Arm::Reg::PC), terminal.next.PC());
|
code->mov(MJitStateReg(Arm::Reg::PC), terminal.next.PC());
|
||||||
|
@ -3474,7 +3474,7 @@ void EmitX64::Patch(const IR::LocationDescriptor& desc, CodePtr bb) {
|
||||||
|
|
||||||
for (CodePtr location : patch_info.jg) {
|
for (CodePtr location : patch_info.jg) {
|
||||||
code->SetCodePtr(location);
|
code->SetCodePtr(location);
|
||||||
EmitPatchJg(bb);
|
EmitPatchJg(desc, bb);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (CodePtr location : patch_info.jmp) {
|
for (CodePtr location : patch_info.jmp) {
|
||||||
|
@ -3494,12 +3494,15 @@ void EmitX64::Unpatch(const IR::LocationDescriptor& desc) {
|
||||||
Patch(desc, nullptr);
|
Patch(desc, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmitX64::EmitPatchJg(CodePtr target_code_ptr) {
|
void EmitX64::EmitPatchJg(const IR::LocationDescriptor& target_desc, CodePtr target_code_ptr) {
|
||||||
const CodePtr patch_location = code->getCurr();
|
const CodePtr patch_location = code->getCurr();
|
||||||
if (target_code_ptr) {
|
if (target_code_ptr) {
|
||||||
code->jg(target_code_ptr);
|
code->jg(target_code_ptr);
|
||||||
|
} else {
|
||||||
|
code->mov(MJitStateReg(Arm::Reg::PC), target_desc.PC());
|
||||||
|
code->jg(code->GetReturnFromRunCodeAddress());
|
||||||
}
|
}
|
||||||
code->EnsurePatchLocationSize(patch_location, 6);
|
code->EnsurePatchLocationSize(patch_location, 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmitX64::EmitPatchJmp(const IR::LocationDescriptor& target_desc, CodePtr target_code_ptr) {
|
void EmitX64::EmitPatchJmp(const IR::LocationDescriptor& target_desc, CodePtr target_code_ptr) {
|
||||||
|
|
|
@ -91,7 +91,7 @@ private:
|
||||||
};
|
};
|
||||||
void Patch(const IR::LocationDescriptor& target_desc, CodePtr target_code_ptr);
|
void Patch(const IR::LocationDescriptor& target_desc, CodePtr target_code_ptr);
|
||||||
void Unpatch(const IR::LocationDescriptor& target_desc);
|
void Unpatch(const IR::LocationDescriptor& target_desc);
|
||||||
void EmitPatchJg(CodePtr target_code_ptr = nullptr);
|
void EmitPatchJg(const IR::LocationDescriptor& target_desc, CodePtr target_code_ptr = nullptr);
|
||||||
void EmitPatchJmp(const IR::LocationDescriptor& target_desc, CodePtr target_code_ptr = nullptr);
|
void EmitPatchJmp(const IR::LocationDescriptor& target_desc, CodePtr target_code_ptr = nullptr);
|
||||||
void EmitPatchMovRcx(CodePtr target_code_ptr = nullptr);
|
void EmitPatchMovRcx(CodePtr target_code_ptr = nullptr);
|
||||||
|
|
||||||
|
|
|
@ -152,10 +152,7 @@ size_t Jit::Run(size_t cycle_count) {
|
||||||
|
|
||||||
impl->jit_state.halt_requested = false;
|
impl->jit_state.halt_requested = false;
|
||||||
|
|
||||||
size_t cycles_executed = 0;
|
size_t cycles_executed = impl->Execute(cycle_count);
|
||||||
while (cycles_executed < cycle_count && !impl->jit_state.halt_requested) {
|
|
||||||
cycles_executed += impl->Execute(cycle_count - cycles_executed);
|
|
||||||
}
|
|
||||||
|
|
||||||
impl->PerformCacheInvalidation();
|
impl->PerformCacheInvalidation();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue