@@ -459,7 +459,7 @@ let trans_visitor
459
459
in
460
460
deref (ptr_cast
461
461
(get_element_ptr indirect_args Abi. indirect_args_elt_closure)
462
- (Il. ScalarTy (Il. AddrTy (obj_closure_rty word_bits))))
462
+ (Il. ScalarTy (Il. AddrTy (obj_box_rty word_bits))))
463
463
in
464
464
465
465
let fp_to_args (fp :Il.cell ) (args_rty :Il.referent_ty ): Il.cell =
@@ -1236,7 +1236,7 @@ let trans_visitor
1236
1236
let fty = Hashtbl. find (snd caller) ident in
1237
1237
let self_args_rty =
1238
1238
call_args_referent_type cx 0
1239
- (Ast. TY_fn fty) (Some (obj_closure_rty word_bits))
1239
+ (Ast. TY_fn fty) (Some (obj_box_rty word_bits))
1240
1240
in
1241
1241
let callsz = Il. referent_ty_size word_bits self_args_rty in
1242
1242
let spill = new_fixup " forwarding fn spill" in
@@ -1891,8 +1891,8 @@ let trans_visitor
1891
1891
begin
1892
1892
match ty with
1893
1893
Ast. TY_obj _ ->
1894
- let lhs_binding = get_element_ptr lhs Abi. obj_field_body_box in
1895
- let rhs_binding = get_element_ptr rhs Abi. obj_field_body_box in
1894
+ let lhs_binding = get_element_ptr lhs Abi. obj_field_box in
1895
+ let rhs_binding = get_element_ptr rhs Abi. obj_field_box in
1896
1896
let lhs_box, rhs_box = deref lhs_binding, deref rhs_binding in
1897
1897
let lhs_obj = get_element_ptr lhs_box Abi. box_rc_field_body in
1898
1898
let rhs_obj = get_element_ptr rhs_box Abi. box_rc_field_body in
@@ -2643,7 +2643,7 @@ let trans_visitor
2643
2643
2644
2644
| Ast. TY_obj _ ->
2645
2645
note_drop_step ty " drop_ty: obj path" ;
2646
- let binding = get_element_ptr cell Abi. obj_field_body_box in
2646
+ let binding = get_element_ptr cell Abi. obj_field_box in
2647
2647
let null_jmp = null_check binding in
2648
2648
let rc_jmp = drop_refcount_and_cmp binding in
2649
2649
let obj_box = deref binding in
@@ -4948,14 +4948,14 @@ let trans_visitor
4948
4948
all_args_cell Abi. calltup_elt_ty_params
4949
4949
in
4950
4950
4951
- let obj_args_tup =
4951
+ let obj_fields_tup =
4952
4952
Array. map (fun (sloti ,_ ) -> (slot_ty sloti.node)) header
4953
4953
in
4954
- let obj_args_ty = Ast. TY_tup obj_args_tup in
4955
- let state_ty = Ast. TY_tup [| Ast. TY_type ; obj_args_ty |] in
4956
- let state_ptr_ty = Ast. TY_box state_ty in
4957
- let state_ptr_rty = referent_type word_bits state_ptr_ty in
4958
- let state_malloc_sz = box_allocation_size state_ptr_ty in
4954
+ let obj_fields_ty = Ast. TY_tup obj_fields_tup in
4955
+ let obj_body_ty = Ast. TY_tup [| Ast. TY_type ; obj_fields_ty |] in
4956
+ let box_ptr_ty = Ast. TY_box obj_body_ty in
4957
+ let box_ptr_rty = referent_type word_bits box_ptr_ty in
4958
+ let box_malloc_sz = box_allocation_size box_ptr_ty in
4959
4959
4960
4960
let ctor_ty = Hashtbl. find cx.ctxt_all_item_types obj_id in
4961
4961
let obj_ty =
@@ -4973,48 +4973,48 @@ let trans_visitor
4973
4973
let dst_pair_item_cell =
4974
4974
get_element_ptr dst_pair_cell Abi. obj_field_vtbl
4975
4975
in
4976
- let dst_pair_state_cell =
4977
- get_element_ptr dst_pair_cell Abi. obj_field_body_box
4976
+ let dst_pair_box_cell =
4977
+ get_element_ptr dst_pair_cell Abi. obj_field_box
4978
4978
in
4979
4979
4980
4980
(* Load first cell of pair with vtbl ptr.*)
4981
4981
iflog (fun _ -> annotate " mov vtbl-ptr to obj.item cell" );
4982
4982
mov dst_pair_item_cell (Il. Cell vtbl_cell);
4983
4983
4984
- (* Load second cell of pair with pointer to fresh state tuple.*)
4985
- iflog (fun _ -> annotate " malloc state-tuple to obj.state cell" );
4986
- trans_malloc dst_pair_state_cell state_malloc_sz zero;
4984
+ (* Load second cell of pair with pointer to fresh body tuple.*)
4985
+ iflog (fun _ -> annotate " malloc state-tuple to obj.box-ptr cell" );
4986
+ trans_malloc dst_pair_box_cell box_malloc_sz zero;
4987
4987
4988
- (* Copy args into the state tuple . *)
4989
- let state_ptr = next_vreg_cell (need_scalar_ty state_ptr_rty ) in
4990
- iflog (fun _ -> annotate " load obj.state ptr to vreg" );
4991
- mov state_ptr (Il. Cell dst_pair_state_cell );
4992
- let state = deref state_ptr in
4988
+ (* Copy rc, tydesc, args into the obj . *)
4989
+ let box_ptr = next_vreg_cell (need_scalar_ty box_ptr_rty ) in
4990
+ iflog (fun _ -> annotate " load obj.box ptr to vreg" );
4991
+ mov box_ptr (Il. Cell dst_pair_box_cell );
4992
+ let box = deref box_ptr in
4993
4993
let refcnt =
4994
- get_element_ptr_dyn_in_current_frame state
4994
+ get_element_ptr_dyn_in_current_frame box
4995
4995
Abi. box_rc_field_refcnt
4996
4996
in
4997
4997
let body =
4998
- get_element_ptr_dyn_in_current_frame state
4998
+ get_element_ptr_dyn_in_current_frame box
4999
4999
Abi. box_rc_field_body
5000
5000
in
5001
5001
let obj_tydesc =
5002
5002
get_element_ptr_dyn_in_current_frame body Abi. obj_body_elt_tydesc
5003
5003
in
5004
- let obj_args =
5004
+ let obj_fields =
5005
5005
get_element_ptr_dyn_in_current_frame body Abi. obj_body_elt_fields
5006
5006
in
5007
- iflog (fun _ -> annotate " write refcnt=1 to obj state " );
5007
+ iflog (fun _ -> annotate " write refcnt=1 to obj box " );
5008
5008
mov refcnt one;
5009
- iflog (fun _ -> annotate " get args-tup tydesc" );
5009
+ iflog (fun _ -> annotate " write tydesc to obj body " );
5010
5010
mov obj_tydesc
5011
5011
(Il. Cell (get_tydesc
5012
5012
(Some obj_id)
5013
- (Ast. TY_tup obj_args_tup )));
5013
+ (Ast. TY_tup obj_fields_tup )));
5014
5014
iflog (fun _ -> annotate " copy ctor args to obj args" );
5015
5015
trans_copy_tup
5016
5016
frame_ty_params true
5017
- obj_args frame_args obj_args_tup ;
5017
+ obj_fields frame_args obj_fields_tup ;
5018
5018
(* We have to do something curious here: we can't drop the
5019
5019
* arg slots directly as in the normal frame-exit sequence,
5020
5020
* because the arg slot ids are actually given layout
0 commit comments