mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 23:04:49 +00:00
Lowlevels: replace RefCountGetPtr with the more general GetPtrAsInt.
This commit is contained in:
parent
a1d883600c
commit
e847c924dd
7 changed files with 104 additions and 44 deletions
|
@ -964,11 +964,13 @@ impl<
|
|||
}
|
||||
}
|
||||
|
||||
fn build_refcount_getptr(&mut self, dst: &Symbol, src: &Symbol) {
|
||||
fn build_ptr_cast(&mut self, dst: &Symbol, src: &Symbol) {
|
||||
// We may not strictly need an instruction here.
|
||||
// What's important is to load the value, and for src and dest to have different Layouts.
|
||||
// This is used for pointer math in refcounting and for pointer equality
|
||||
let dst_reg = self.claim_general_reg(dst);
|
||||
let src_reg = self.load_to_general_reg(src);
|
||||
// The refcount pointer is the value before the pointer.
|
||||
ASM::sub_reg64_reg64_imm32(&mut self.buf, dst_reg, src_reg, PTR_SIZE as i32);
|
||||
ASM::mov_reg64_reg64(&mut self.buf, dst_reg, src_reg);
|
||||
}
|
||||
|
||||
fn create_struct(&mut self, sym: &Symbol, layout: &Layout<'a>, fields: &'a [Symbol]) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue