Skip to content

Commit

Permalink
rt: Add method for emitting epilog constants
Browse files Browse the repository at this point in the history
  • Loading branch information
dinfuehr committed Jan 5, 2025
1 parent cd9fde0 commit f8ebd9f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
11 changes: 7 additions & 4 deletions dora-runtime/src/masm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,12 @@ impl MacroAssembler {
self.constpool.add_addr(ptr)
}

pub fn emit_epilog_const(&mut self, value: EpilogConstant) -> Label {
let label = self.create_label();
self.epilog_constants.push((label, value));
label
}

pub fn pos(&self) -> usize {
self.asm.position()
}
Expand Down Expand Up @@ -328,10 +334,7 @@ impl MacroAssembler {

pub fn emit_jump_table(&mut self, targets: Vec<Label>) -> Label {
assert!(!targets.is_empty());
let label = self.create_label();
self.epilog_constants
.push((label, EpilogConstant::JumpTable(targets)));
label
self.emit_epilog_const(EpilogConstant::JumpTable(targets))
}
}

Expand Down
3 changes: 1 addition & 2 deletions dora-runtime/src/masm/arm64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -884,8 +884,7 @@ impl MacroAssembler {
MachineMode::Float64 => EpilogConstant::Float64(imm),
_ => unreachable!(),
};
let label = self.asm.create_label();
self.epilog_constants.push((label, const_value));
let label = self.emit_epilog_const(const_value);

let scratch = self.get_scratch();
self.asm.adr_label((*scratch).into(), label);
Expand Down
3 changes: 1 addition & 2 deletions dora-runtime/src/masm/x64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1279,8 +1279,7 @@ impl MacroAssembler {
MachineMode::Float64 => EpilogConstant::Float64(imm),
_ => unreachable!(),
};
let label = self.asm.create_label();
self.epilog_constants.push((label, const_value));
let label = self.emit_epilog_const(const_value);

if has_avx2() {
match mode {
Expand Down

0 comments on commit f8ebd9f

Please sign in to comment.