Make clone_list more robust in crane build

This commit is contained in:
Richard Feldman 2020-03-25 00:32:56 -04:00
parent 5d28ae5fa6
commit f27f324c4c

View file

@ -1017,16 +1017,21 @@ fn clone_list<B: Backend>(
ptr_bytes * Builtin::LIST_WORDS, ptr_bytes * Builtin::LIST_WORDS,
)); ));
// Store the new pointer in slot 0 of the wrapper // Store the new pointer in the wrapper
builder builder.ins().stack_store(
.ins() new_elems_ptr,
.stack_store(new_elems_ptr, slot, Offset32::new(0)); slot,
Offset32::new((Builtin::WRAPPER_PTR * ptr_bytes) as i32),
);
// Store the length in slot 1 of the wrapper // Store the length in slot the wrapper
builder builder.ins().stack_store(
.ins() list_len,
.stack_store(list_len, slot, Offset32::new(ptr_bytes as i32)); slot,
Offset32::new((Builtin::WRAPPER_LEN * ptr_bytes) as i32),
);
// Return the wrapper struct
builder builder
.ins() .ins()
.stack_addr(cfg.pointer_type(), slot, Offset32::new(0)) .stack_addr(cfg.pointer_type(), slot, Offset32::new(0))