mirror of
https://github.com/fluencelabs/wasmer
synced 2025-04-25 10:22:19 +00:00
Use RCX instead of R10 as temp register in sysv call location.
This commit is contained in:
parent
d23a3f3d1c
commit
b2ecf8a06c
@ -1942,7 +1942,10 @@ impl X64FunctionCode {
|
|||||||
|
|
||||||
/// Emits a System V call sequence.
|
/// Emits a System V call sequence.
|
||||||
///
|
///
|
||||||
/// This function must not use RAX before `cb` is called.
|
/// This function will not use RAX before `cb` is called.
|
||||||
|
///
|
||||||
|
/// The caller MUST NOT hold any temporary registers allocated by `acquire_temp_gpr` when calling
|
||||||
|
/// this function.
|
||||||
fn emit_call_sysv<I: Iterator<Item = Location>, F: FnOnce(&mut Assembler)>(
|
fn emit_call_sysv<I: Iterator<Item = Location>, F: FnOnce(&mut Assembler)>(
|
||||||
a: &mut Assembler,
|
a: &mut Assembler,
|
||||||
m: &mut Machine,
|
m: &mut Machine,
|
||||||
@ -2063,14 +2066,17 @@ impl X64FunctionCode {
|
|||||||
// Dummy value slot to be filled with `mov`.
|
// Dummy value slot to be filled with `mov`.
|
||||||
a.emit_push(Size::S64, Location::GPR(GPR::RAX));
|
a.emit_push(Size::S64, Location::GPR(GPR::RAX));
|
||||||
|
|
||||||
// Use R10 as the temporary register here, since it is callee-saved and not
|
// Use RCX as the temporary register here, since:
|
||||||
// used by the callback `cb`.
|
// - It is a temporary register that is not used for any persistent value.
|
||||||
a.emit_mov(Size::S64, *param, Location::GPR(GPR::R10));
|
// - This register as an argument location is only written to after `sort_call_movs`.'
|
||||||
|
m.reserve_unused_temp_gpr(GPR::RCX);
|
||||||
|
a.emit_mov(Size::S64, *param, Location::GPR(GPR::RCX));
|
||||||
a.emit_mov(
|
a.emit_mov(
|
||||||
Size::S64,
|
Size::S64,
|
||||||
Location::GPR(GPR::R10),
|
Location::GPR(GPR::RCX),
|
||||||
Location::Memory(GPR::RSP, 0),
|
Location::Memory(GPR::RSP, 0),
|
||||||
);
|
);
|
||||||
|
m.release_temp_gpr(GPR::RCX);
|
||||||
}
|
}
|
||||||
Location::XMM(_) => {
|
Location::XMM(_) => {
|
||||||
// Dummy value slot to be filled with `mov`.
|
// Dummy value slot to be filled with `mov`.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user