mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
an attempt at passing bigger values
This commit is contained in:
parent
529703d449
commit
3a8d4b853b
3 changed files with 60 additions and 15 deletions
|
@ -752,10 +752,34 @@ impl AArch64CallLoadArgs {
|
||||||
storage_manager.no_data(&sym);
|
storage_manager.no_data(&sym);
|
||||||
}
|
}
|
||||||
_ if stack_size > 16 => {
|
_ if stack_size > 16 => {
|
||||||
// TODO: Double check this.
|
match AArch64Call::GENERAL_PARAM_REGS.get(self.general_i) {
|
||||||
|
Some(ptr_reg) => {
|
||||||
|
// if there is a general purpose register available, use it to store a pointer to the value
|
||||||
|
let base_offset = storage_manager.claim_stack_area_layout(
|
||||||
|
layout_interner,
|
||||||
|
sym,
|
||||||
|
in_layout,
|
||||||
|
);
|
||||||
|
let tmp_reg = AArch64Call::GENERAL_RETURN_REGS[0];
|
||||||
|
|
||||||
|
super::x86_64::copy_to_base_offset::<_, _, AArch64Assembler>(
|
||||||
|
buf,
|
||||||
|
base_offset,
|
||||||
|
stack_size,
|
||||||
|
*ptr_reg,
|
||||||
|
tmp_reg,
|
||||||
|
0,
|
||||||
|
);
|
||||||
|
|
||||||
|
self.general_i += 1;
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
// else, pass the value implicitly by copying to the stack (of the new frame)
|
||||||
storage_manager.complex_stack_arg(&sym, self.argument_offset, stack_size);
|
storage_manager.complex_stack_arg(&sym, self.argument_offset, stack_size);
|
||||||
self.argument_offset += stack_size as i32;
|
self.argument_offset += stack_size as i32;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
LayoutRepr::LambdaSet(lambda_set) => self.load_arg(
|
LayoutRepr::LambdaSet(lambda_set) => self.load_arg(
|
||||||
buf,
|
buf,
|
||||||
storage_manager,
|
storage_manager,
|
||||||
|
@ -897,8 +921,17 @@ impl AArch64CallStoreArgs {
|
||||||
}
|
}
|
||||||
_ if layout_interner.stack_size(in_layout) == 0 => {}
|
_ if layout_interner.stack_size(in_layout) == 0 => {}
|
||||||
_ if layout_interner.stack_size(in_layout) > 16 => {
|
_ if layout_interner.stack_size(in_layout) > 16 => {
|
||||||
// TODO: Double check this.
|
match Self::GENERAL_PARAM_REGS.get(self.general_i) {
|
||||||
// Just copy onto the stack.
|
Some(reg) => {
|
||||||
|
// if there is a general purpose register available, use it to store a pointer to the value
|
||||||
|
let (base_offset, _size) = storage_manager.stack_offset_and_size(&sym);
|
||||||
|
|
||||||
|
ASM::add_reg64_reg64_imm32(buf, *reg, AArch64GeneralReg::FP, base_offset);
|
||||||
|
|
||||||
|
self.general_i += 1;
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
// else, pass the value implicitly by copying to the stack (of the new frame)
|
||||||
let stack_offset = self.tmp_stack_offset;
|
let stack_offset = self.tmp_stack_offset;
|
||||||
|
|
||||||
let size = copy_symbol_to_stack_offset::<CC>(
|
let size = copy_symbol_to_stack_offset::<CC>(
|
||||||
|
@ -911,6 +944,8 @@ impl AArch64CallStoreArgs {
|
||||||
|
|
||||||
self.tmp_stack_offset += size as i32;
|
self.tmp_stack_offset += size as i32;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
LayoutRepr::LambdaSet(lambda_set) => self.store_arg(
|
LayoutRepr::LambdaSet(lambda_set) => self.store_arg(
|
||||||
buf,
|
buf,
|
||||||
storage_manager,
|
storage_manager,
|
||||||
|
|
|
@ -601,7 +601,7 @@ where
|
||||||
size
|
size
|
||||||
}
|
}
|
||||||
|
|
||||||
fn copy_to_base_offset<GeneralReg, FloatReg, ASM>(
|
pub(crate) fn copy_to_base_offset<GeneralReg, FloatReg, ASM>(
|
||||||
buf: &mut Vec<'_, u8>,
|
buf: &mut Vec<'_, u8>,
|
||||||
dst_base_offset: i32,
|
dst_base_offset: i32,
|
||||||
stack_size: u32,
|
stack_size: u32,
|
||||||
|
|
|
@ -3332,6 +3332,16 @@ fn box_num() {
|
||||||
assert_evals_to!("Box.box 123u64", RocBox::new(123), RocBox<u64>)
|
assert_evals_to!("Box.box 123u64", RocBox::new(123), RocBox<u64>)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
|
||||||
|
fn box_record() {
|
||||||
|
assert_evals_to!(
|
||||||
|
"Box.box { x: 1u64, y: 2u64 }",
|
||||||
|
RocBox::new((1u64, 2u64)),
|
||||||
|
RocBox<(u64, u64)>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
|
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
|
||||||
fn box_str() {
|
fn box_str() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue