Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions cranelift/codegen/src/isa/aarch64/inst/emit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2942,14 +2942,11 @@ impl MachInstEmit for Inst {
let offset = sink.cur_offset();
sink.push_user_stack_map(state, offset, s);
}
sink.add_call_site();

// Add exception info, if any, at this point (which will
// be the return address on stack).
if let Some(try_call) = info.try_call_info.as_ref() {
for &(tag, label) in &try_call.exception_dests {
sink.add_exception_handler(tag, label);
}
sink.add_call_site(&try_call.exception_dests);
} else {
sink.add_call_site(&[]);
}

if info.callee_pop_size > 0 {
Expand Down Expand Up @@ -2989,14 +2986,11 @@ impl MachInstEmit for Inst {
let offset = sink.cur_offset();
sink.push_user_stack_map(state, offset, s);
}
sink.add_call_site();

// Add exception info, if any, at this point (which will
// be the return address on stack).
if let Some(try_call) = info.try_call_info.as_ref() {
for &(tag, label) in &try_call.exception_dests {
sink.add_exception_handler(tag, label);
}
sink.add_call_site(&try_call.exception_dests);
} else {
sink.add_call_site(&[]);
}

if info.callee_pop_size > 0 {
Expand Down Expand Up @@ -3035,7 +3029,7 @@ impl MachInstEmit for Inst {
// for the target, but rather a function relocation.
sink.add_reloc(Reloc::Arm64Call, &info.dest, 0);
sink.put4(enc_jump26(0b000101, 0));
sink.add_call_site();
sink.add_call_site(&[]);

// `emit_return_call_common_sequence` emits an island if
// necessary, so we can safely disable the worst-case-size check
Expand All @@ -3050,7 +3044,7 @@ impl MachInstEmit for Inst {
targets: vec![],
}
.emit(sink, emit_info, state);
sink.add_call_site();
sink.add_call_site(&[]);

// `emit_return_call_common_sequence` emits an island if
// necessary, so we can safely disable the worst-case-size check
Expand Down
21 changes: 7 additions & 14 deletions cranelift/codegen/src/isa/pulley_shared/inst/emit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,11 @@ fn pulley_emit<P>(
let offset = sink.cur_offset();
sink.push_user_stack_map(state, offset, s);
}
sink.add_call_site();

// Add exception info, if any, at this point (which will
// be the return address on stack).
if let Some(try_call) = info.try_call_info.as_ref() {
for &(tag, label) in &try_call.exception_dests {
sink.add_exception_handler(tag, label);
}
sink.add_call_site(&try_call.exception_dests);
} else {
sink.add_call_site(&[]);
}

let adjust = -i32::try_from(info.callee_pop_size).unwrap();
Expand Down Expand Up @@ -226,14 +223,10 @@ fn pulley_emit<P>(
sink.push_user_stack_map(state, offset, s);
}

sink.add_call_site();

// Add exception info, if any, at this point (which will
// be the return address on stack).
if let Some(try_call) = info.try_call_info.as_ref() {
for &(tag, label) in &try_call.exception_dests {
sink.add_exception_handler(tag, label);
}
sink.add_call_site(&try_call.exception_dests);
} else {
sink.add_call_site(&[]);
}

let adjust = -i32::try_from(info.callee_pop_size).unwrap();
Expand Down Expand Up @@ -295,7 +288,7 @@ fn pulley_emit<P>(
let offset = sink.cur_offset();
sink.push_user_stack_map(state, offset, s);
}
sink.add_call_site();
sink.add_call_site(&[]);

// If a callee pop is happening here that means that something has
// messed up, these are expected to be "very simple" signatures.
Expand Down
21 changes: 7 additions & 14 deletions cranelift/codegen/src/isa/riscv64/inst/emit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1123,7 +1123,6 @@ impl Inst {
}

&Inst::Call { ref info } => {
sink.add_call_site();
sink.add_reloc(Reloc::RiscvCallPlt, &info.dest, 0);

Inst::construct_auipc_and_jalr(Some(writable_link_reg()), writable_link_reg(), 0)
Expand All @@ -1135,12 +1134,10 @@ impl Inst {
sink.push_user_stack_map(state, offset, s);
}

// Add exception info, if any, at this point (which will
// be the return address on stack).
if let Some(try_call) = info.try_call_info.as_ref() {
for &(tag, label) in &try_call.exception_dests {
sink.add_exception_handler(tag, label);
}
sink.add_call_site(&try_call.exception_dests);
} else {
sink.add_call_site(&[]);
}

let callee_pop_size = i32::try_from(info.callee_pop_size).unwrap();
Expand Down Expand Up @@ -1181,14 +1178,10 @@ impl Inst {
sink.push_user_stack_map(state, offset, s);
}

sink.add_call_site();

// Add exception info, if any, at this point (which will
// be the return address on stack).
if let Some(try_call) = info.try_call_info.as_ref() {
for &(tag, label) in &try_call.exception_dests {
sink.add_exception_handler(tag, label);
}
sink.add_call_site(&try_call.exception_dests);
} else {
sink.add_call_site(&[]);
}

let callee_pop_size = i32::try_from(info.callee_pop_size).unwrap();
Expand Down Expand Up @@ -1220,7 +1213,7 @@ impl Inst {
&Inst::ReturnCall { ref info } => {
emit_return_call_common_sequence(sink, emit_info, state, info);

sink.add_call_site();
sink.add_call_site(&[]);
sink.add_reloc(Reloc::RiscvCallPlt, &info.dest, 0);
Inst::construct_auipc_and_jalr(None, writable_spilltmp_reg(), 0)
.into_iter()
Expand Down
13 changes: 5 additions & 8 deletions cranelift/codegen/src/isa/s390x/inst/emit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3216,14 +3216,11 @@ impl Inst {
sink.push_user_stack_map(state, offset, s);
}
put(sink, enc);
sink.add_call_site();

// Add exception info, if any, at this point (which will
// be the return address on stack).
if let Some(try_call) = info.try_call_info.as_ref() {
for &(tag, label) in &try_call.exception_dests {
sink.add_exception_handler(tag, label);
}
sink.add_call_site(&try_call.exception_dests);
} else {
sink.add_call_site(&[]);
}

state.nominal_sp_offset -= info.callee_pop_size;
Expand Down Expand Up @@ -3264,7 +3261,7 @@ impl Inst {
}
};
put(sink, enc);
sink.add_call_site();
sink.add_call_site(&[]);
}
&Inst::ElfTlsGetOffset { ref symbol, .. } => {
let opcode = 0xc05; // BRASL
Expand All @@ -3281,7 +3278,7 @@ impl Inst {
}

put(sink, &enc_ril_b(opcode, gpr(14), 0));
sink.add_call_site();
sink.add_call_site(&[]);
}
&Inst::Args { .. } => {}
&Inst::Rets { .. } => {}
Expand Down
23 changes: 8 additions & 15 deletions cranelift/codegen/src/isa/x64/inst/emit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1611,14 +1611,11 @@ pub(crate) fn emit(
// beginning of the immediate field.
emit_reloc(sink, Reloc::X86CallPCRel4, &call_info.dest, -4);
sink.put4(0);
sink.add_call_site();

// Add exception info, if any, at this point (which will
// be the return address on stack).
if let Some(try_call) = call_info.try_call_info.as_ref() {
for &(tag, label) in &try_call.exception_dests {
sink.add_exception_handler(tag, label);
}
sink.add_call_site(&try_call.exception_dests);
} else {
sink.add_call_site(&[]);
}

// Reclaim the outgoing argument area that was released by the callee, to ensure that
Expand Down Expand Up @@ -1663,7 +1660,7 @@ pub(crate) fn emit(
// beginning of the immediate field.
emit_reloc(sink, Reloc::X86CallPCRel4, &call_info.dest, -4);
sink.put4(0);
sink.add_call_site();
sink.add_call_site(&[]);
}

Inst::ReturnCallUnknown { info: call_info } => {
Expand All @@ -1675,7 +1672,7 @@ pub(crate) fn emit(
target: RegMem::reg(callee),
}
.emit(sink, info, state);
sink.add_call_site();
sink.add_call_site(&[]);
}

Inst::CallUnknown {
Expand Down Expand Up @@ -1717,14 +1714,10 @@ pub(crate) fn emit(
sink.push_user_stack_map(state, offset, s);
}

sink.add_call_site();

// Add exception info, if any, at this point (which will
// be the return address on stack).
if let Some(try_call) = call_info.try_call_info.as_ref() {
for &(tag, label) in &try_call.exception_dests {
sink.add_exception_handler(tag, label);
}
sink.add_call_site(&try_call.exception_dests);
} else {
sink.add_call_site(&[]);
}

// Reclaim the outgoing argument area that was released by the callee, to ensure that
Expand Down
Loading
Loading