aboutsummaryrefslogtreecommitdiff
path: root/src/boot/me
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2010-06-24 13:32:59 -0700
committerGraydon Hoare <[email protected]>2010-06-24 13:32:59 -0700
commitaf44ec2856603b8a978a1f2582c285c7c0065403 (patch)
tree7cc4d0ad4765a2b320580355242a15027eb97062 /src/boot/me
parentRemove redundant copy of comment. (diff)
downloadrust-af44ec2856603b8a978a1f2582c285c7c0065403.tar.xz
rust-af44ec2856603b8a978a1f2582c285c7c0065403.zip
Issue 24, drop output slot when not initializing. Un-XFAIL generic-tag.rs. Add test for output slot modes with several broken cases.
Diffstat (limited to 'src/boot/me')
-rw-r--r--src/boot/me/trans.ml16
1 files changed, 10 insertions, 6 deletions
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