diff --git a/hercules_cg/src/rt.rs b/hercules_cg/src/rt.rs index 0449c92b41ef8bc17eff1a1134b24b49c70655a2..ac0d0fd41ffb92c1b96fb917b32dcfece9c72a21 100644 --- a/hercules_cg/src/rt.rs +++ b/hercules_cg/src/rt.rs @@ -505,12 +505,7 @@ impl<'a> RTContext<'a> { " let mut write_offset_obj = unsafe {{ {}.__clone() }};\n", self.get_value(collect) )?; - write!( - block, - " unsafe {{ write_offset_obj.__offset({}, {}) }};\n", - offset, data_size, - )?; - write!(block, " let write_offset_ptr = unsafe {{ write_offset_obj.__cpu_ptr_mut() }};\n")?; + write!(block, " let write_offset_ptr = unsafe {{ write_offset_obj.__cpu_ptr_mut().byte_add({}) }};\n", offset)?; if self.module.types[self.typing[data.idx()].idx()].is_primitive() { write!( block, @@ -527,13 +522,8 @@ impl<'a> RTContext<'a> { } write!( block, - " unsafe {{ write_offset_obj.__forget() }};\n", - )?; - write!( - block, - " {} = unsafe {{ {}.__clone() }};\n", + " {} = write_offset_obj;\n", self.get_value(id), - self.get_value(collect) )?; } _ => panic!(