-
Notifications
You must be signed in to change notification settings - Fork 180
Refactor - reduce usage of REGISTER_OTHER_SCRATCH
#596
Conversation
…NAL_FUNCTION_CALL_PROLOGUE.
…AL_FUNCTION_CALL_REG.
self.emit_ins(X86Instruction::store(OperandSize::S64, REGISTER_MAP[0], REGISTER_OTHER_SCRATCH, X86IndirectAccess::Offset(std::mem::size_of::<u64>() as i32))); // result.return_value = R0; | ||
self.emit_ins(X86Instruction::load_immediate(OperandSize::S64, REGISTER_MAP[0], 0)); | ||
if self.config.enable_instruction_meter { | ||
self.emit_ins(X86Instruction::alu(OperandSize::S64, 0x29, REGISTER_SCRATCH, REGISTER_INSTRUCTION_METER, 0, None)); // REGISTER_INSTRUCTION_METER -= pc; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This operation is re-emitted in ANCHOR_EXIT
, even though REGISTER_SCRATCH
is zero.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't checked the other PR for removing REGISTER_OTHER_SCRATCH
yet, so, please, ignore this comment if this is solved there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean the code for the instruction metering is redundant to that in ANCHOR_EPILOGUE
, which is on purpose. Because REGISTER_SCRATCH
is clobbered here and then zeroed out so that it is not double metered later.
Reduces the machinecode emitted for: