Skip to content

Commit 18beb7a

Browse files
committed
Increment ref counts of objects sent along channels.
1 parent 8ac15c6 commit 18beb7a

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/boot/me/trans.ml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2258,8 +2258,17 @@ let trans_visitor
22582258
trans_void_upcall "upcall_join" [| trans_atom (Ast.ATOM_lval task) |]
22592259

22602260
and trans_send (chan:Ast.lval) (src:Ast.lval) : unit =
2261-
let (srccell, _) = trans_lval src in
2262-
aliasing false srccell
2261+
let (src_cell, src_ty) = trans_lval src in
2262+
begin
2263+
match (ty_mem_ctrl src_ty) with
2264+
| MEM_rc_opaque
2265+
| MEM_rc_struct
2266+
| MEM_gc ->
2267+
iflog (fun _ -> annotate "incr_refcount of src obj");
2268+
incr_refcount src_cell;
2269+
| _ -> ()
2270+
end;
2271+
aliasing false src_cell
22632272
begin
22642273
fun src_alias ->
22652274
trans_void_upcall "upcall_send"

0 commit comments

Comments
 (0)