From 026cdf97474402f206a8627a533809c4751abe8b Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Fri, 2 Jul 2010 16:16:57 -0700 Subject: [PATCH] Fix bug in clone logic; was ignoring the mutability-strip step in later rule. --- src/boot/me/trans.ml | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/src/boot/me/trans.ml b/src/boot/me/trans.ml index d86c754ee76..abeff66e131 100644 --- a/src/boot/me/trans.ml +++ b/src/boot/me/trans.ml @@ -2586,27 +2586,28 @@ let trans_visitor (ty:Ast.ty) (curr_iso:Ast.ty_iso option) : unit = - match strip_mutable_or_constrained_ty ty with - Ast.TY_chan _ -> - trans_upcall "upcall_clone_chan" dst - [| (Il.Cell clone_task); (Il.Cell src) |] - | Ast.TY_task - | Ast.TY_port _ - | _ when type_has_state ty - -> bug () "cloning mutable type" - | _ when i64_le (ty_sz abi ty) word_sz - -> mov dst (Il.Cell src) - | Ast.TY_fn _ - | Ast.TY_obj _ -> () - | Ast.TY_box ty -> - let glue_fix = get_clone_glue ty curr_iso in - trans_call_static_glue - (code_fixup_to_ptr_operand glue_fix) - (Some dst) - [| alias ty_params; src; clone_task |] - | _ -> - iter_ty_parts_full ty_params dst src ty - (clone_ty ty_params clone_task) curr_iso + let ty = strip_mutable_or_constrained_ty ty in + match ty with + Ast.TY_chan _ -> + trans_upcall "upcall_clone_chan" dst + [| (Il.Cell clone_task); (Il.Cell src) |] + | Ast.TY_task + | Ast.TY_port _ + | _ when type_has_state ty + -> bug () "cloning state type" + | _ when i64_le (ty_sz abi ty) word_sz + -> mov dst (Il.Cell src) + | Ast.TY_fn _ + | Ast.TY_obj _ -> () + | Ast.TY_box ty -> + let glue_fix = get_clone_glue ty curr_iso in + trans_call_static_glue + (code_fixup_to_ptr_operand glue_fix) + (Some dst) + [| alias ty_params; src; clone_task |] + | _ -> + iter_ty_parts_full ty_params dst src ty + (clone_ty ty_params clone_task) curr_iso and free_ty (is_gc:bool)