When translating vec-append, delay destination string's null-byte-accounting length decrement until the destination string has already been resized. Closes #163.
This commit is contained in:
parent
7ab3b305e4
commit
3c3421e01d
1 changed files with 43 additions and 45 deletions
|
@ -4612,11 +4612,6 @@ let trans_visitor
|
|||
let src_cell = need_cell src_oper in
|
||||
let src_vec = deref src_cell in
|
||||
let src_fill = get_element_ptr src_vec Abi.vec_elt_fill in
|
||||
let dst_vec = deref dst_cell in
|
||||
let dst_fill = get_element_ptr dst_vec Abi.vec_elt_fill in
|
||||
|
||||
if trailing_null
|
||||
then sub_from dst_fill (imm 1L);
|
||||
|
||||
aliasing true dst_cell
|
||||
begin
|
||||
|
@ -4635,10 +4630,12 @@ let trans_visitor
|
|||
* to add to.
|
||||
*)
|
||||
|
||||
(* Reload dst vec, fill; might have changed. *)
|
||||
let dst_vec = deref dst_cell in
|
||||
let dst_fill = get_element_ptr dst_vec Abi.vec_elt_fill in
|
||||
|
||||
if trailing_null
|
||||
then sub_from dst_fill (imm 1L);
|
||||
|
||||
(* Copy loop: *)
|
||||
let eltp_rty = Il.AddrTy (referent_type cx elt_ty) in
|
||||
let dptr = next_vreg_cell eltp_rty in
|
||||
|
@ -4671,7 +4668,8 @@ let trans_visitor
|
|||
patch fwd_jmp;
|
||||
check_interrupt_flag ();
|
||||
let back_jmp =
|
||||
trans_compare_simple Il.JB (Il.Cell dptr) (Il.Cell dlim)
|
||||
trans_compare_simple
|
||||
Il.JB (Il.Cell dptr) (Il.Cell dlim)
|
||||
in
|
||||
List.iter
|
||||
(fun j -> patch_existing j back_jmp_targ) back_jmp;
|
||||
|
|
Loading…
Reference in a new issue