From af44ec2856603b8a978a1f2582c285c7c0065403 Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Thu, 24 Jun 2010 13:32:59 -0700 Subject: Issue 24, drop output slot when not initializing. Un-XFAIL generic-tag.rs. Add test for output slot modes with several broken cases. --- src/boot/me/trans.ml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/boot') diff --git a/src/boot/me/trans.ml b/src/boot/me/trans.ml index fe4a542f..cb492561 100644 --- a/src/boot/me/trans.ml +++ b/src/boot/me/trans.ml @@ -3708,7 +3708,7 @@ let trans_visitor and trans_prepare_call - ((*initializing*)_:bool) + (initializing:bool) (logname:(unit -> string)) (call:call) : Il.operand = @@ -3718,11 +3718,15 @@ let trans_visitor (Printf.sprintf "copy args for call to %s" (logname ()))); copy_fn_args false CLONE_none call; iflog (fun _ -> annotate (Printf.sprintf "call %s" (logname ()))); - (* FIXME (issue #24): we need to actually handle writing to an - * already-initialised slot. Currently we blindly assume we're - * initializing, overwrite the slot; this is ok if we're writing - * to an interior output slot, but we'll leak any exteriors as we - * do that. *) + if not initializing + then + begin + match call.call_callee_ty with + Ast.TY_fn (tsig, _) -> + drop_slot (get_ty_params_of_current_frame()) call.call_output + tsig.Ast.sig_output_slot None; + | _ -> bug () "calling non-fn" + end; callee_fptr and callee_drop_slot -- cgit v1.2.3