Add element to closure to hold captured tydesc (not body tydesc).
This commit is contained in:
parent
91d640f90f
commit
2c8ae5ca8d
@ -62,9 +62,10 @@ let obj_body_elt_fields = 1;;
|
||||
let fn_field_code = binding_field_dispatch;;
|
||||
let fn_field_box = binding_field_bound_data;;
|
||||
|
||||
let closure_body_elt_tydesc = 0;;
|
||||
let closure_body_elt_target = 1;;
|
||||
let closure_body_elt_bound_args = 2;;
|
||||
let closure_body_elt_bound_args_tydesc = 0;;
|
||||
let closure_body_elt_target_tydesc = 1;;
|
||||
let closure_body_elt_target = 2;;
|
||||
let closure_body_elt_bound_args = 3;;
|
||||
|
||||
let tag_elt_discriminant = 0;;
|
||||
let tag_elt_variant = 1;;
|
||||
|
@ -1905,8 +1905,6 @@ let obj_rty (word_bits:Il.bits) : Il.referent_ty =
|
||||
r [| obj_vtbl_ptr; obj_box_ptr |]
|
||||
;;
|
||||
|
||||
|
||||
|
||||
let rec closure_box_rty
|
||||
(word_bits:Il.bits)
|
||||
(bs:Ast.slot array)
|
||||
@ -1920,8 +1918,9 @@ let rec closure_box_rty
|
||||
let tydesc = sp (tydesc_rty word_bits) in
|
||||
let targ = fn_rty true word_bits in
|
||||
let bound_args = r (Array.map (slot_referent_type word_bits) bs) in
|
||||
|
||||
r [| rc; r [| tydesc; targ; bound_args |] |]
|
||||
(* First tydesc is the one describing bound_args; second tydesc is the one
|
||||
* to pass to targ when invoking it. *)
|
||||
r [| rc; r [| tydesc; tydesc; targ; bound_args |] |]
|
||||
|
||||
and fn_rty (opaque_box_body:bool) (word_bits:Il.bits) : Il.referent_ty =
|
||||
let s t = Il.ScalarTy t in
|
||||
|
@ -3619,7 +3619,9 @@ let trans_visitor
|
||||
let rc_cell = get_element_ptr closure_cell Abi.box_rc_field_refcnt in
|
||||
let body_cell = get_element_ptr closure_cell Abi.box_rc_field_body in
|
||||
let targ_cell = get_element_ptr body_cell Abi.closure_body_elt_target in
|
||||
let tydesc_cell = get_element_ptr body_cell Abi.closure_body_elt_tydesc in
|
||||
let bound_args_tydesc_cell =
|
||||
get_element_ptr body_cell Abi.closure_body_elt_bound_args_tydesc
|
||||
in
|
||||
let args_cell =
|
||||
get_element_ptr body_cell Abi.closure_body_elt_bound_args
|
||||
in
|
||||
@ -3627,8 +3629,8 @@ let trans_visitor
|
||||
iflog (fun _ -> annotate "init closure refcount");
|
||||
mov rc_cell one;
|
||||
|
||||
iflog (fun _ -> annotate "set closure tydesc ptr");
|
||||
mov tydesc_cell
|
||||
iflog (fun _ -> annotate "set closure bound-args tydesc ptr");
|
||||
mov bound_args_tydesc_cell
|
||||
(Il.Cell (get_tydesc None
|
||||
(Ast.TY_tup (Array.map slot_ty bound_arg_slots))));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user