mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
setjmp/longjmp assembly gen
This commit is contained in:
parent
cdc90f8495
commit
f96c78b3a5
5 changed files with 284 additions and 1 deletions
|
@ -134,6 +134,9 @@ pub trait CallConv<GeneralReg: RegTrait, FloatReg: RegTrait, ASM: Assembler<Gene
|
|||
sym: &Symbol,
|
||||
layout: &InLayout<'a>,
|
||||
);
|
||||
|
||||
fn setjmp(buf: &mut Vec<'_, u8>, relocs: &mut Vec<'_, Relocation>);
|
||||
fn longjmp(buf: &mut Vec<'_, u8>, relocs: &mut Vec<'_, Relocation>);
|
||||
}
|
||||
|
||||
pub enum CompareOperation {
|
||||
|
@ -238,6 +241,13 @@ pub trait Assembler<GeneralReg: RegTrait, FloatReg: RegTrait>: Sized + Copy {
|
|||
dst: GeneralReg,
|
||||
);
|
||||
|
||||
fn data_pointer(
|
||||
buf: &mut Vec<'_, u8>,
|
||||
relocs: &mut Vec<'_, Relocation>,
|
||||
fn_name: String,
|
||||
dst: GeneralReg,
|
||||
);
|
||||
|
||||
/// Jumps by an offset of offset bytes unconditionally.
|
||||
/// It should always generate the same number of bytes to enable replacement if offset changes.
|
||||
/// It returns the base offset to calculate the jump from (generally the instruction after the jump).
|
||||
|
@ -887,6 +897,22 @@ impl<
|
|||
(out.into_bump_slice(), offset)
|
||||
}
|
||||
|
||||
fn build_roc_setjmp(&mut self) -> &'a [u8] {
|
||||
let mut out = bumpalo::vec![in self.env.arena];
|
||||
|
||||
CC::setjmp(&mut out, &mut self.relocs);
|
||||
|
||||
out.into_bump_slice()
|
||||
}
|
||||
|
||||
fn build_roc_longjmp(&mut self) -> &'a [u8] {
|
||||
let mut out = bumpalo::vec![in self.env.arena];
|
||||
|
||||
CC::longjmp(&mut out, &mut self.relocs);
|
||||
|
||||
out.into_bump_slice()
|
||||
}
|
||||
|
||||
fn build_fn_pointer(&mut self, dst: &Symbol, fn_name: String) {
|
||||
let reg = self.storage_manager.claim_general_reg(&mut self.buf, dst);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue