diff options
| author | Roy Frostig <[email protected]> | 2010-08-26 14:44:03 -0700 |
|---|---|---|
| committer | Roy Frostig <[email protected]> | 2010-08-26 14:44:11 -0700 |
| commit | 8559a85ccacf70c51d93759b47a3880ae818b247 (patch) | |
| tree | a876043c326e22a467f644c4bdd3994aaa8fb083 /src/boot | |
| parent | Add check to catch bug underlying issue #152. Fix will take longer. (diff) | |
| download | rust-8559a85ccacf70c51d93759b47a3880ae818b247.tar.xz rust-8559a85ccacf70c51d93759b47a3880ae818b247.zip | |
When copying function values, null out the destination's binding iff the source's binding is null.
Diffstat (limited to 'src/boot')
| -rw-r--r-- | src/boot/me/trans.ml | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/boot/me/trans.ml b/src/boot/me/trans.ml index 8deda627..d83f6c52 100644 --- a/src/boot/me/trans.ml +++ b/src/boot/me/trans.ml @@ -2933,12 +2933,18 @@ let trans_visitor : unit = drop_ty (get_ty_params_of_current_frame()) cell ty None + (* Returns a mark for a jmp that must be patched to the continuation of + * the null case (i.e. fall-through means not null). + *) and null_check (cell:Il.cell) : quad_idx = emit (Il.cmp (Il.Cell cell) zero); let j = mark() in emit (Il.jmp Il.JE Il.CodeNone); j + (* Returns a mark for a jmp that must be patched to the continuation of + * the non-zero refcount case (i.e. fall-through means zero refcount). + *) and drop_refcount_and_cmp (boxed:Il.cell) : quad_idx = iflog (fun _ -> annotate "drop refcount and maybe free"); let rc = box_rc_cell boxed in @@ -3268,7 +3274,14 @@ let trans_visitor dst_binding (Ast.TY_box Ast.TY_int) src_binding (Ast.TY_box Ast.TY_int) curr_iso; - patch null_jmp + let end_jmp = mark() in + emit (Il.jmp Il.JMP Il.CodeNone); + patch null_jmp; + (* The src had a null binding, so make sure the dst + * does now too. + *) + mov dst_binding zero; + patch end_jmp end | _ -> |