diff options
| author | Graydon Hoare <[email protected]> | 2010-06-30 22:45:54 -0700 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2010-06-30 22:45:54 -0700 |
| commit | 6a0b06e56287f1de7ff096ed79fbf86e1e527290 (patch) | |
| tree | 5596e1e36c3f59dc7f25c84730705aaf28128a0b /src/boot/me | |
| parent | No more "transplant" behavior in "let @x = y", gotta box explicitly. (diff) | |
| download | rust-6a0b06e56287f1de7ff096ed79fbf86e1e527290.tar.xz rust-6a0b06e56287f1de7ff096ed79fbf86e1e527290.zip | |
Rename 'exterior' to 'box' and 'interior' to 'local' (at least wrt. slots; keep MEM_interior for describing interior-parts-of-allocations)
Diffstat (limited to 'src/boot/me')
| -rw-r--r-- | src/boot/me/dwarf.ml | 25 | ||||
| -rw-r--r-- | src/boot/me/layout.ml | 4 | ||||
| -rw-r--r-- | src/boot/me/resolve.ml | 2 | ||||
| -rw-r--r-- | src/boot/me/semant.ml | 60 | ||||
| -rw-r--r-- | src/boot/me/trans.ml | 113 | ||||
| -rw-r--r-- | src/boot/me/transutil.ml | 8 | ||||
| -rw-r--r-- | src/boot/me/type.ml | 102 | ||||
| -rw-r--r-- | src/boot/me/walk.ml | 4 |
8 files changed, 158 insertions, 160 deletions
diff --git a/src/boot/me/dwarf.ml b/src/boot/me/dwarf.ml index 663ce9f5..f49f450a 100644 --- a/src/boot/me/dwarf.ml +++ b/src/boot/me/dwarf.ml @@ -1323,7 +1323,7 @@ let (abbrev_mutable_type:abbrev) = |]) ;; -let (abbrev_exterior_type:abbrev) = +let (abbrev_box_type:abbrev) = (DW_TAG_pointer_type, DW_CHILDREN_no, [| (DW_AT_type, DW_FORM_ref_addr); @@ -1551,7 +1551,7 @@ let dwarf_visitor in match slot.Ast.slot_mode with - | Ast.MODE_interior -> + | Ast.MODE_local -> ref_type_die (slot_ty slot) | Ast.MODE_alias -> @@ -2013,20 +2013,19 @@ let dwarf_visitor ref_addr_for_fix (Stack.top iso_stack).(i) in - let exterior_type t = - let fix = new_fixup "exterior DIE" in + let box_type t = + let fix = new_fixup "box DIE" in let body_off = - word_sz_int * Abi.exterior_rc_slot_field_body + word_sz_int * Abi.box_rc_slot_field_body in emit_die (DEF (fix, SEQ [| - uleb (get_abbrev_code abbrev_exterior_type); + uleb (get_abbrev_code abbrev_box_type); (* DW_AT_type: DW_FORM_ref_addr *) (ref_type_die t); (* DW_AT_data_location: DW_FORM_block1 *) - (* This is a DWARF expression for moving - from the address of an exterior - allocation to the address of its - body. *) + (* This is a DWARF expression for moving from the + address of a box allocation to the address of + its body. *) dw_form_block1 [| DW_OP_push_object_address; DW_OP_lit body_off; @@ -2078,7 +2077,7 @@ let dwarf_visitor | Ast.TY_param p -> rust_type_param p | Ast.TY_obj ob -> obj_type ob | Ast.TY_mutable t -> mutable_type t - | Ast.TY_exterior t -> exterior_type t + | Ast.TY_box t -> box_type t | _ -> bug () "unimplemented dwarf encoding for type %a" Ast.sprintf_ty ty @@ -2916,7 +2915,7 @@ let rec extract_mod_items Ast.TY_native (get_opaque_of (get_native_id die)) | DW_TAG_pointer_type -> - Ast.TY_exterior (get_referenced_ty die) + Ast.TY_box (get_referenced_ty die) | DW_TAG_const_type when ((get_num die DW_AT_mutable) = 1) -> @@ -3012,7 +3011,7 @@ let rec extract_mod_items Ast.slot_ty = Some ty } | _ -> let ty = get_ty die in - { Ast.slot_mode = Ast.MODE_interior; + { Ast.slot_mode = Ast.MODE_local; Ast.slot_ty = Some ty } and get_referenced_ty die = diff --git a/src/boot/me/layout.ml b/src/boot/me/layout.ml index 6c4567fd..208dc470 100644 --- a/src/boot/me/layout.ml +++ b/src/boot/me/layout.ml @@ -221,7 +221,7 @@ let layout_visitor let offset = let word_sz = cx.ctxt_abi.Abi.abi_word_sz in let word_n (n:int) = Int64.mul word_sz (Int64.of_int n) in - SIZE_fixed (word_n (Abi.exterior_rc_slot_field_body + SIZE_fixed (word_n (Abi.box_rc_slot_field_body + 1 (* the state tydesc. *))) in log cx "laying out object-state for node #%d at offset %s" @@ -262,7 +262,7 @@ let layout_visitor *) let glue_callsz = - let word = interior_slot Ast.TY_int in + let word = local_slot Ast.TY_int in let glue_fn = mk_simple_ty_fn (Array.init Abi.worst_case_glue_call_args (fun _ -> word)) diff --git a/src/boot/me/resolve.ml b/src/boot/me/resolve.ml index 2e422d1e..72558ae6 100644 --- a/src/boot/me/resolve.ml +++ b/src/boot/me/resolve.ml @@ -570,7 +570,7 @@ let type_resolving_visitor header_slots in let output_slot = - interior_slot (ty_iso_of cx recursive_tag_groups + local_slot (ty_iso_of cx recursive_tag_groups all_tags nid) in let ty = diff --git a/src/boot/me/semant.ml b/src/boot/me/semant.ml index 19ef774d..e70fd55f 100644 --- a/src/boot/me/semant.ml +++ b/src/boot/me/semant.ml @@ -21,10 +21,10 @@ type glue = | GLUE_exit_main_task | GLUE_exit_task | GLUE_copy of Ast.ty (* One-level copy. *) - | GLUE_drop of Ast.ty (* De-initialize interior memory. *) - | GLUE_free of Ast.ty (* Drop body + free() exterior ptr. *) - | GLUE_sever of Ast.ty (* Null all exterior state slots. *) - | GLUE_mark of Ast.ty (* Mark all exterior state slots. *) + | GLUE_drop of Ast.ty (* De-initialize local memory. *) + | GLUE_free of Ast.ty (* Drop body + free() box ptr. *) + | GLUE_sever of Ast.ty (* Null all box state slots. *) + | GLUE_mark of Ast.ty (* Mark all box state slots. *) | GLUE_clone of Ast.ty (* Deep copy. *) | GLUE_compare of Ast.ty | GLUE_hash of Ast.ty @@ -604,35 +604,35 @@ let expr_slots (cx:ctxt) (e:Ast.expr) : node_id array = (* Type extraction. *) -let interior_slot_full mut ty : Ast.slot = +let local_slot_full mut ty : Ast.slot = let ty = if mut then Ast.TY_mutable ty else ty in - { Ast.slot_mode = Ast.MODE_interior; + { Ast.slot_mode = Ast.MODE_local; Ast.slot_ty = Some ty } ;; -let exterior_slot_full mut ty : Ast.slot = +let box_slot_full mut ty : Ast.slot = let ty = match ty with - Ast.TY_exterior _ -> ty - | _ -> Ast.TY_exterior ty + Ast.TY_box _ -> ty + | _ -> Ast.TY_box ty in let ty = if mut then Ast.TY_mutable ty else ty in - { Ast.slot_mode = Ast.MODE_interior; + { Ast.slot_mode = Ast.MODE_local; Ast.slot_ty = Some ty } ;; -let interior_slot ty : Ast.slot = interior_slot_full false ty +let local_slot ty : Ast.slot = local_slot_full false ty ;; -let exterior_slot ty : Ast.slot = exterior_slot_full false ty +let box_slot ty : Ast.slot = box_slot_full false ty ;; @@ -640,7 +640,7 @@ let exterior_slot ty : Ast.slot = exterior_slot_full false ty type ('ty, 'tys, 'slot, 'slots, 'tag) ty_fold = { - (* Functions that correspond to interior nodes in Ast.ty. *) + (* Functions that correspond to local nodes in Ast.ty. *) ty_fold_slot : (Ast.mode * 'ty) -> 'slot; ty_fold_slots : ('slot array) -> 'slots; ty_fold_tys : ('ty array) -> 'tys; @@ -672,7 +672,7 @@ type ('ty, 'tys, 'slot, 'slots, 'tag) ty_fold = ty_fold_param : (int * Ast.effect) -> 'ty; ty_fold_named : Ast.name -> 'ty; ty_fold_type : unit -> 'ty; - ty_fold_exterior : 'ty -> 'ty; + ty_fold_box : 'ty -> 'ty; ty_fold_mutable : 'ty -> 'ty; ty_fold_constrained : ('ty * Ast.constrs) -> 'ty } ;; @@ -739,7 +739,7 @@ let rec fold_ty | Ast.TY_named n -> f.ty_fold_named n | Ast.TY_type -> f.ty_fold_type () - | Ast.TY_exterior t -> f.ty_fold_exterior (fold_ty f t) + | Ast.TY_box t -> f.ty_fold_box (fold_ty f t) | Ast.TY_mutable t -> f.ty_fold_mutable (fold_ty f t) | Ast.TY_constrained (t, constrs) -> @@ -778,7 +778,7 @@ let ty_fold_default (default:'a) : 'a simple_ty_fold = ty_fold_param = (fun _ -> default); ty_fold_named = (fun _ -> default); ty_fold_type = (fun _ -> default); - ty_fold_exterior = (fun _ -> default); + ty_fold_box = (fun _ -> default); ty_fold_mutable = (fun _ -> default); ty_fold_constrained = (fun _ -> default) } ;; @@ -824,7 +824,7 @@ let ty_fold_rebuild (id:Ast.ty -> Ast.ty) ty_fold_param = (fun (i, mut) -> id (Ast.TY_param (i, mut))); ty_fold_named = (fun n -> id (Ast.TY_named n)); ty_fold_type = (fun _ -> id (Ast.TY_type)); - ty_fold_exterior = (fun t -> id (Ast.TY_exterior t)); + ty_fold_box = (fun t -> id (Ast.TY_box t)); ty_fold_mutable = (fun t -> id (Ast.TY_mutable t)); ty_fold_constrained = (fun (t, constrs) -> id (Ast.TY_constrained (t, constrs))) } @@ -1069,7 +1069,7 @@ let check_concrete params thing = let rec simplified_ty (t:Ast.ty) : Ast.ty = match t with - Ast.TY_exterior t + Ast.TY_box t | Ast.TY_mutable t | Ast.TY_constrained (t, _) -> simplified_ty t | _ -> t @@ -1097,12 +1097,12 @@ let rec project_type | (Ast.TY_obj (_, fns), Ast.COMP_named (Ast.COMP_ident id)) -> (Ast.TY_fn (Hashtbl.find fns id)) - | (Ast.TY_exterior t, Ast.COMP_deref) -> t + | (Ast.TY_box t, Ast.COMP_deref) -> t - (* Exterior, mutable and constrained are transparent to the + (* Box, mutable and constrained are transparent to the * other lval-ext forms: x.y and x.(y). *) - | (Ast.TY_exterior t, _) + | (Ast.TY_box t, _) | (Ast.TY_mutable t, _) | (Ast.TY_constrained (t, _), _) -> project_type t comp @@ -1315,7 +1315,7 @@ let ty_of_mod_item ((*inside*)_:bool) (item:Ast.mod_item) : Ast.ty = let tobj = Ast.TY_obj (ty_obj_of_obj ob) in let tsig = { Ast.sig_input_slots = arg_slots ob.Ast.obj_state; Ast.sig_input_constrs = ob.Ast.obj_constrs; - Ast.sig_output_slot = interior_slot tobj } + Ast.sig_output_slot = local_slot tobj } in (Ast.TY_fn (tsig, taux)) @@ -1325,7 +1325,7 @@ let ty_of_mod_item ((*inside*)_:bool) (item:Ast.mod_item) : Ast.ty = in let tsig = { Ast.sig_input_slots = tup_slots htup; Ast.sig_input_constrs = [| |]; - Ast.sig_output_slot = interior_slot (Ast.TY_tag ttag) } + Ast.sig_output_slot = local_slot (Ast.TY_tag ttag) } in (Ast.TY_fn (tsig, taux)) ;; @@ -1867,7 +1867,7 @@ let rec referent_type (abi:Abi.abi) (t:Ast.ty) : Il.referent_ty = | Ast.TY_native _ -> ptr - | Ast.TY_exterior t -> + | Ast.TY_box t -> sp (Il.StructTy [| word; referent_type abi t |]) | Ast.TY_mutable t -> referent_type abi t @@ -1884,7 +1884,7 @@ and slot_referent_type (abi:Abi.abi) (sl:Ast.slot) : Il.referent_ty = let rty = referent_type abi (slot_ty sl) in match sl.Ast.slot_mode with - | Ast.MODE_interior _ -> rty + | Ast.MODE_local _ -> rty | Ast.MODE_alias _ -> sp rty ;; @@ -2000,7 +2000,7 @@ let slot_sz (abi:Abi.abi) (s:Ast.slot) : int64 = ;; let word_slot (abi:Abi.abi) : Ast.slot = - interior_slot (Ast.TY_mach abi.Abi.abi_word_ty) + local_slot (Ast.TY_mach abi.Abi.abi_word_ty) ;; let alias_slot (ty:Ast.ty) : Ast.slot = @@ -2045,7 +2045,7 @@ let mk_simple_ty_fn (arg_slots:Ast.slot array) : Ast.ty = (* In some cases we don't care what the output slot is. *) - let out_slot = interior_slot Ast.TY_nil in + let out_slot = local_slot Ast.TY_nil in mk_ty_fn out_slot arg_slots ;; @@ -2053,7 +2053,7 @@ let mk_simple_ty_iter (arg_slots:Ast.slot array) : Ast.ty = (* In some cases we don't care what the output slot is. *) - let out_slot = interior_slot Ast.TY_nil in + let out_slot = local_slot Ast.TY_nil in mk_ty_fn_or_iter out_slot arg_slots true ;; @@ -2073,7 +2073,7 @@ let ty_str (ty:Ast.ty) : string = let fold_slot (mode,ty) = (match mode with Ast.MODE_alias -> "a" - | Ast.MODE_interior -> "") + | Ast.MODE_local -> "") ^ ty in let num n = (string_of_int n) ^ "$" in @@ -2147,7 +2147,7 @@ let ty_str (ty:Ast.ty) : string = ty_fold_param = (fun _ -> "P"); ty_fold_type = (fun _ -> "Y"); ty_fold_mutable = (fun t -> "m" ^ t); - ty_fold_exterior = (fun t -> "e" ^ t); + ty_fold_box = (fun t -> "e" ^ t); (* FIXME (issue #78): encode obj types. *) (* FIXME (issue #78): encode opaque and param numbers. *) diff --git a/src/boot/me/trans.ml b/src/boot/me/trans.ml index 9be58826..4b6eb19b 100644 --- a/src/boot/me/trans.ml +++ b/src/boot/me/trans.ml @@ -1584,17 +1584,16 @@ let trans_visitor : fixup = let g = GLUE_free ty in let inner _ (args:Il.cell) = - (* - * Free-glue assumes it's called with a pointer to an - * exterior allocation with normal exterior layout. It's - * just a way to move drop+free out of leaf code. + (* Free-glue assumes it's called with a pointer to a box allocation with + * normal box layout. It's just a way to move drop+free out of leaf + * code. *) let ty_params = deref (get_element_ptr args 0) in let cell = get_element_ptr args 1 in let (body_mem, _) = need_mem_cell (get_element_ptr_dyn ty_params (deref cell) - Abi.exterior_rc_slot_field_body) + Abi.box_rc_slot_field_body) in let vr = next_vreg_cell Il.voidptr_t in lea vr body_mem; @@ -1608,7 +1607,7 @@ let trans_visitor "free-glue complete"; in let ty_params_ptr = ty_params_covering ty in - let fty = mk_simple_ty_fn [| ty_params_ptr; exterior_slot ty |] in + let fty = mk_simple_ty_fn [| ty_params_ptr; box_slot ty |] in get_typed_mem_glue g fty inner @@ -1657,7 +1656,7 @@ let trans_visitor let ty_params_ptr = ty_params_covering ty in let fty = mk_ty_fn - (interior_slot ty) (* dst *) + (local_slot ty) (* dst *) [| ty_params_ptr; alias_slot ty; (* src *) @@ -1681,7 +1680,7 @@ let trans_visitor let ty_params_ptr = ty_params_covering ty in let fty = mk_ty_fn - (interior_slot ty) + (local_slot ty) [| ty_params_ptr; alias_slot ty |] in get_typed_mem_glue g fty inner @@ -2120,7 +2119,7 @@ let trans_visitor trans_void_upcall "upcall_kill" [| Il.Cell task |] (* - * A vec is implicitly exterior: every slot vec[T] is 1 word and + * A vec is implicitly boxed: every slot vec[T] is 1 word and * points to a refcounted structure. That structure has 3 words with * defined meaning at the beginning; data follows the header. * @@ -2212,22 +2211,22 @@ let trans_visitor (ty_align abi ty)) (tydesc_rty abi)) - and exterior_ctrl_cell (cell:Il.cell) (off:int) : Il.cell = + and box_ctrl_cell (cell:Il.cell) (off:int) : Il.cell = let (mem, _) = need_mem_cell (deref_imm cell (word_n off)) in word_at mem - and exterior_rc_cell (cell:Il.cell) : Il.cell = - exterior_ctrl_cell cell Abi.exterior_rc_slot_field_refcnt + and box_rc_cell (cell:Il.cell) : Il.cell = + box_ctrl_cell cell Abi.box_rc_slot_field_refcnt - and exterior_allocation_size + and box_allocation_size (ty:Ast.ty) : Il.operand = let header_sz = match ty_mem_ctrl ty with MEM_gc | MEM_rc_opaque - | MEM_rc_struct -> word_n Abi.exterior_rc_header_size - | MEM_interior -> bug () "exterior_allocation_size of MEM_interior" + | MEM_rc_struct -> word_n Abi.box_rc_header_size + | MEM_interior -> bug () "box_allocation_size of MEM_interior" in let ty = simplified_ty ty in let refty_sz = @@ -2304,8 +2303,8 @@ let trans_visitor * vreg and so has to be aware of when it's iterating over 2 * sequences of cells or just 1. *) - check_exterior_rty src_cell; - check_exterior_rty dst_cell; + check_box_rty src_cell; + check_box_rty dst_cell; if dst_cell = src_cell then begin @@ -2413,9 +2412,9 @@ let trans_visitor (* Drop non-null bindings. *) (* FIXME (issue #58): this is completely wrong, Closures need to * carry tydescs like objs. For now this only works by accident, - * and will leak closures with exterior substructure. + * and will leak closures with box substructure. *) - drop_ty ty_params binding (Ast.TY_exterior Ast.TY_int) curr_iso; + drop_ty ty_params binding (Ast.TY_box Ast.TY_int) curr_iso; patch null_jmp | Ast.TY_obj _ -> @@ -2465,13 +2464,13 @@ let trans_visitor | MEM_rc_opaque | MEM_rc_struct -> - let _ = check_exterior_rty cell in + let _ = check_box_rty cell in let null_jmp = null_check cell in - let rc = exterior_rc_cell cell in + let rc = box_rc_cell cell in let j = drop_refcount_and_cmp rc in - (* FIXME (issue #25): check to see that the exterior has - * further exterior members; if it doesn't we can elide the + (* FIXME (issue #25): check to see that the box has + * further box members; if it doesn't we can elide the * call to the glue function. *) if mctrl = MEM_rc_opaque @@ -2491,7 +2490,7 @@ let trans_visitor | MEM_interior when type_is_structured ty -> (iflog (fun _ -> - annotate ("drop interior slot " ^ + annotate ("drop interior memory " ^ (Fmt.fmt_to_str Ast.fmt_ty ty)))); let (mem, _) = need_mem_cell cell in let vr = next_vreg_cell Il.voidptr_t in @@ -2516,9 +2515,9 @@ let trans_visitor match ty_mem_ctrl ty with MEM_gc -> - let _ = check_exterior_rty cell in + let _ = check_box_rty cell in let null_jmp = null_check cell in - let rc = exterior_rc_cell cell in + let rc = box_rc_cell cell in let _ = note_gc_step ty "severing GC slot" in emit (Il.binary Il.SUB rc (Il.Cell rc) one); mov cell zero; @@ -2551,7 +2550,7 @@ let trans_visitor -> mov dst (Il.Cell src) | Ast.TY_fn _ | Ast.TY_obj _ -> () - | Ast.TY_exterior ty -> + | Ast.TY_box ty -> let glue_fix = get_clone_glue ty curr_iso in trans_call_static_glue (code_fixup_to_ptr_operand glue_fix) @@ -2615,8 +2614,8 @@ let trans_visitor * this only works by accident. *) trans_copy_ty ty_params true - dst_binding (Ast.TY_exterior Ast.TY_int) - src_binding (Ast.TY_exterior Ast.TY_int) + dst_binding (Ast.TY_box Ast.TY_int) + src_binding (Ast.TY_box Ast.TY_int) curr_iso; patch null_jmp end @@ -2652,7 +2651,7 @@ let trans_visitor : Ast.ty = match (curr_iso, t) with (Some iso, Ast.TY_idx n) -> - Ast.TY_exterior (Ast.TY_iso { iso with Ast.iso_index = n }) + Ast.TY_box (Ast.TY_iso { iso with Ast.iso_index = n }) | (None, Ast.TY_idx _) -> bug () "TY_idx outside TY_iso" | _ -> t @@ -2687,11 +2686,11 @@ let trans_visitor let marked_jump = trans_compare Il.JE (Il.Cell tmp) zero; in - (* Iterate over exterior parts marking outgoing links. *) + (* Iterate over box parts marking outgoing links. *) let (body_mem, _) = need_mem_cell (get_element_ptr (deref cell) - Abi.exterior_gc_slot_field_body) + Abi.box_gc_slot_field_body) in let ty = maybe_iso curr_iso ty in let curr_iso = maybe_enter_iso ty curr_iso in @@ -2703,7 +2702,7 @@ let trans_visitor | MEM_interior when type_is_structured ty -> (iflog (fun _ -> - annotate ("mark interior slot " ^ + annotate ("mark interior memory " ^ (Fmt.fmt_to_str Ast.fmt_ty ty)))); let (mem, _) = need_mem_cell cell in let tmp = next_vreg_cell Il.voidptr_t in @@ -2716,13 +2715,13 @@ let trans_visitor | _ -> () - and check_exterior_rty cell = + and check_box_rty cell = match cell with Il.Reg (_, Il.AddrTy (Il.StructTy fields)) | Il.Mem (_, Il.ScalarTy (Il.AddrTy (Il.StructTy fields))) when (((Array.length fields) > 0) && (fields.(0) = word_rty)) -> () | _ -> bug () - "expected plausibly-exterior cell, got %s" + "expected plausibly-box cell, got %s" (Il.string_of_referent_ty (Il.cell_referent_ty cell)) and drop_slot_in_current_frame @@ -2755,7 +2754,7 @@ let trans_visitor match slot.Ast.slot_mode with Ast.MODE_alias (* Aliases are always free to drop. *) - | Ast.MODE_interior -> + | Ast.MODE_local -> drop_ty ty_params cell (slot_ty slot) curr_iso and note_drop_step ty step = @@ -2788,7 +2787,7 @@ let trans_visitor end (* Returns the offset of the slot-body in the initialized allocation. *) - and init_exterior (cell:Il.cell) (ty:Ast.ty) : unit = + and init_box (cell:Il.cell) (ty:Ast.ty) : unit = let mctrl = ty_mem_ctrl ty in match mctrl with MEM_gc @@ -2799,14 +2798,14 @@ let trans_visitor then Il.Cell (get_tydesc None ty) else zero in - iflog (fun _ -> annotate "init exterior: malloc"); - let sz = exterior_allocation_size ty in + iflog (fun _ -> annotate "init box: malloc"); + let sz = box_allocation_size ty in trans_malloc cell sz ctrl; - iflog (fun _ -> annotate "init exterior: load refcount"); - let rc = exterior_rc_cell cell in + iflog (fun _ -> annotate "init box: load refcount"); + let rc = box_rc_cell cell in mov rc one - | MEM_interior -> bug () "init_exterior of MEM_interior" + | MEM_interior -> bug () "init_box of MEM_interior" and deref_ty (initializing:bool) @@ -2819,14 +2818,14 @@ let trans_visitor | Ast.TY_constrained (ty, _) -> deref_ty initializing cell ty - | Ast.TY_exterior ty' -> - check_exterior_rty cell; + | Ast.TY_box ty' -> + check_box_rty cell; if initializing - then init_exterior cell ty; + then init_box cell ty; let cell = get_element_ptr_dyn_in_current_frame (deref cell) - (Abi.exterior_rc_slot_field_body) + (Abi.box_rc_slot_field_body) in (* Init recursively so @@@@T chain works. *) deref_ty initializing cell ty' @@ -2840,7 +2839,7 @@ let trans_visitor (slot:Ast.slot) : Il.cell = match slot.Ast.slot_mode with - Ast.MODE_interior -> + Ast.MODE_local -> cell | Ast.MODE_alias _ -> @@ -2892,7 +2891,7 @@ let trans_visitor | (MEM_rc_struct, MEM_rc_struct) -> (* Lightweight copy: twiddle refcounts, move pointer. *) anno "refcounted light"; - add_to (exterior_rc_cell src) one; + add_to (box_rc_cell src) one; if not initializing then drop_ty ty_params dst dst_ty None; @@ -2961,7 +2960,7 @@ let trans_visitor match t with Ast.TY_vec _ | Ast.TY_str -> true - | Ast.TY_exterior t when can_append t -> true + | Ast.TY_box t when can_append t -> true | _ -> false in match (dst_ty, src) with @@ -3129,7 +3128,7 @@ let trans_visitor (Ast.MODE_alias, CLONE_none) -> mov dst (Il.Cell (alias (Il.Mem (need_mem_cell src)))) - | (Ast.MODE_interior, CLONE_none) -> + | (Ast.MODE_local, CLONE_none) -> trans_copy_ty ty_params true dst dst_ty src src_ty None @@ -4402,9 +4401,9 @@ let trans_visitor in let obj_args_ty = Ast.TY_tup obj_args_tup in let state_ty = Ast.TY_tup [| Ast.TY_type; obj_args_ty |] in - let state_ptr_ty = Ast.TY_exterior state_ty in + let state_ptr_ty = Ast.TY_box state_ty in let state_ptr_rty = referent_type abi state_ptr_ty in - let state_malloc_sz = exterior_allocation_size state_ptr_ty in + let state_malloc_sz = box_allocation_size state_ptr_ty in let ctor_ty = Hashtbl.find cx.ctxt_all_item_types obj_id in let obj_ty = @@ -4684,8 +4683,8 @@ let trans_visitor else ignore (Stack.pop curr_file) in - let visit_local_mod_item_pre n _ i = - iflog (fun _ -> log cx "translating local item #%d = %s" + let visit_defined_mod_item_pre n _ i = + iflog (fun _ -> log cx "translating defined item #%d = %s" (int_of_node i.id) (path_name())); match i.node.Ast.decl_item with Ast.MOD_ITEM_fn f -> trans_fn i.id f.Ast.fn_body @@ -4730,7 +4729,7 @@ let trans_visitor inner.Walk.visit_obj_drop_pre obj b in - let visit_local_obj_fn_pre _ _ fn = + let visit_defined_obj_fn_pre _ _ fn = trans_fn fn.id fn.node.Ast.fn_body in @@ -4745,7 +4744,7 @@ let trans_visitor then visit_required_obj_fn_pre obj ident fn else - visit_local_obj_fn_pre obj ident fn; + visit_defined_obj_fn_pre obj ident fn; end; inner.Walk.visit_obj_fn_pre obj ident fn in @@ -4757,7 +4756,7 @@ let trans_visitor then visit_required_mod_item_pre n p i else - visit_local_mod_item_pre n p i + visit_defined_mod_item_pre n p i end; inner.Walk.visit_mod_item_pre n p i in diff --git a/src/boot/me/transutil.ml b/src/boot/me/transutil.ml index 8c6b8bc3..d7fbb566 100644 --- a/src/boot/me/transutil.ml +++ b/src/boot/me/transutil.ml @@ -7,7 +7,7 @@ open Semant;; * "simple" precise, mark-sweep, single-generation, per-task (thereby * preemptable and relatively quick) GC scheme on mutable memory. * - * - For the sake of this note, call any exterior of 'state' effect a gc_val. + * - For the sake of this note, call any box of 'state' effect a gc_val. * * - gc_vals come from the same malloc as all other values but undergo * different storage management. @@ -19,7 +19,7 @@ open Semant;; * * - A pointer to a gc_val, however, points to the third of these three * words. So a certain quantity of code can treat gc_vals the same way it - * would treat refcounted exterior vals. + * would treat refcounted box vals. * * - The first word at the head of a gc_val is used as a refcount, as in * non-gc allocations. @@ -122,7 +122,7 @@ let rec ty_mem_ctrl (ty:Ast.ty) : mem_ctrl = if type_has_state ty then MEM_gc else MEM_rc_opaque - | Ast.TY_exterior t -> + | Ast.TY_box t -> if type_has_state t then MEM_gc else @@ -139,7 +139,7 @@ let rec ty_mem_ctrl (ty:Ast.ty) : mem_ctrl = let slot_mem_ctrl (slot:Ast.slot) : mem_ctrl = match slot.Ast.slot_mode with Ast.MODE_alias -> MEM_interior - | Ast.MODE_interior -> + | Ast.MODE_local -> ty_mem_ctrl (slot_ty slot) ;; diff --git a/src/boot/me/type.ml b/src/boot/me/type.ml index edd750f5..36f5d3a3 100644 --- a/src/boot/me/type.ml +++ b/src/boot/me/type.ml @@ -5,7 +5,7 @@ type tyspec = TYSPEC_equiv of tyvar | TYSPEC_all | TYSPEC_resolved of (Ast.ty_param array) * Ast.ty - | TYSPEC_exterior of tyvar (* @ of some t *) + | TYSPEC_box of tyvar (* @ of some t *) | TYSPEC_mutable of tyvar (* something mutable *) | TYSPEC_callable of (tyvar * tyvar array) (* out, ins *) | TYSPEC_collection of tyvar (* vec or str *) @@ -107,7 +107,7 @@ let rec tyspec_to_str (ts:tyspec) : string = | TYSPEC_equiv tv -> fmt_tyspec ff (!tv) - | TYSPEC_exterior tv -> + | TYSPEC_box tv -> fmt ff "@@"; fmt_tyspec ff (!tv) @@ -173,31 +173,31 @@ let rec resolve_tyvar (tv:tyvar) : tyvar = type unify_ctxt = { mut_ok: bool; - ext_ok: bool } + box_ok: bool } ;; let arg_pass_ctx = - { ext_ok = false; + { box_ok = false; mut_ok = true } ;; let rval_ctx = - { ext_ok = true; + { box_ok = true; mut_ok = true } ;; let lval_ctx = - { ext_ok = false; + { box_ok = false; mut_ok = true } ;; let init_ctx = - { ext_ok = true; + { box_ok = true; mut_ok = true } ;; let strict_ctx = - { ext_ok = false; + { box_ok = false; mut_ok = false } ;; @@ -265,12 +265,12 @@ let process_crate (cx:ctxt) (crate:Ast.crate) : unit = iflog cx (fun _ -> log cx "%s> unifying types:" indent; - if ucx.ext_ok || ucx.mut_ok + if ucx.box_ok || ucx.mut_ok then log cx "%s> (w/ %s%s%s)" indent - (if ucx.ext_ok then "ext-ok" else "") - (if ucx.ext_ok && ucx.mut_ok then " " else "") + (if ucx.box_ok then "ext-ok" else "") + (if ucx.box_ok && ucx.mut_ok then " " else "") (if ucx.mut_ok then "mut-ok" else ""); log cx "%s> input tyvar A: %s" indent (tyspec_to_str !av); log cx "%s> input tyvar B: %s" indent (tyspec_to_str !bv)); @@ -341,8 +341,8 @@ let process_crate (cx:ctxt) (crate:Ast.crate) : unit = : Ast.ty = match ty_a, ty_b with a, b when a = b -> a - | Ast.TY_exterior a, b | b, Ast.TY_exterior a when ucx.ext_ok -> - Ast.TY_exterior (unify_resolved_types a b) + | Ast.TY_box a, b | b, Ast.TY_box a when ucx.box_ok -> + Ast.TY_box (unify_resolved_types a b) | Ast.TY_mutable a, b | b, Ast.TY_mutable a when ucx.mut_ok -> Ast.TY_mutable (unify_resolved_types a b) | Ast.TY_constrained (a, constrs), b @@ -366,15 +366,15 @@ let process_crate (cx:ctxt) (crate:Ast.crate) : unit = is_comparable_or_ordered comparable ty | Ast.TY_mutable ty -> ucx.mut_ok && is_comparable_or_ordered comparable ty - | Ast.TY_exterior ty -> - ucx.ext_ok && is_comparable_or_ordered comparable ty + | Ast.TY_box ty -> + ucx.box_ok && is_comparable_or_ordered comparable ty in let rec floating (ty:Ast.ty) : bool = match ty with Ast.TY_mach TY_f32 | Ast.TY_mach TY_f64 -> true | Ast.TY_mutable ty when ucx.mut_ok -> floating ty - | Ast.TY_exterior ty when ucx.ext_ok -> floating ty + | Ast.TY_box ty when ucx.box_ok -> floating ty | _ -> false in @@ -386,7 +386,7 @@ let process_crate (cx:ctxt) (crate:Ast.crate) : unit = | Ast.TY_mach TY_i64 -> true | Ast.TY_mutable ty when ucx.mut_ok -> integral ty - | Ast.TY_exterior ty when ucx.ext_ok -> integral ty + | Ast.TY_box ty when ucx.box_ok -> integral ty | _ -> false in @@ -397,7 +397,7 @@ let process_crate (cx:ctxt) (crate:Ast.crate) : unit = Ast.TY_str -> true | Ast.TY_vec _ -> true | Ast.TY_mutable ty when ucx.mut_ok -> plusable ty - | Ast.TY_exterior ty when ucx.ext_ok -> plusable ty + | Ast.TY_box ty when ucx.box_ok -> plusable ty | _ -> numeric ty in @@ -408,7 +408,7 @@ let process_crate (cx:ctxt) (crate:Ast.crate) : unit = | Ast.TY_mach TY_i8 | Ast.TY_mach TY_i16 | Ast.TY_mach TY_i32 -> true | Ast.TY_mutable ty when ucx.mut_ok -> loggable ty - | Ast.TY_exterior ty when ucx.ext_ok -> loggable ty + | Ast.TY_box ty when ucx.box_ok -> loggable ty | _ -> false in @@ -419,34 +419,34 @@ let process_crate (cx:ctxt) (crate:Ast.crate) : unit = | (TYSPEC_all, other) | (other, TYSPEC_all) -> other - (* exterior *) + (* box *) - | (TYSPEC_exterior a', TYSPEC_exterior b') -> + | (TYSPEC_box a', TYSPEC_box b') -> unify_tyvars ucx a' b'; !a - | (TYSPEC_exterior a', - TYSPEC_resolved (_, Ast.TY_exterior _)) -> + | (TYSPEC_box a', + TYSPEC_resolved (_, Ast.TY_box _)) -> unify_tyvars ucx a' b; !b - | (TYSPEC_resolved (_, Ast.TY_exterior _), - TYSPEC_exterior b') -> + | (TYSPEC_resolved (_, Ast.TY_box _), + TYSPEC_box b') -> unify_tyvars ucx a b'; !a - | (_, TYSPEC_resolved (params, Ast.TY_exterior ty)) - when ucx.ext_ok -> + | (_, TYSPEC_resolved (params, Ast.TY_box ty)) + when ucx.box_ok -> unify_ty_parametric ucx ty params a; !b - | (TYSPEC_resolved (params, Ast.TY_exterior ty), _) - when ucx.ext_ok -> + | (TYSPEC_resolved (params, Ast.TY_box ty), _) + when ucx.box_ok -> unify_ty_parametric ucx ty params b; !a - | (TYSPEC_exterior a', _) when ucx.ext_ok + | (TYSPEC_box a', _) when ucx.box_ok -> unify_tyvars ucx a' b; !a - | (_, TYSPEC_exterior b') when ucx.ext_ok + | (_, TYSPEC_box b') when ucx.box_ok -> unify_tyvars ucx a b'; !b - | (_, TYSPEC_exterior _) - | (TYSPEC_exterior _, _) -> fail() + | (_, TYSPEC_box _) + | (TYSPEC_box _, _) -> fail() (* mutable *) @@ -505,8 +505,8 @@ let process_crate (cx:ctxt) (crate:Ast.crate) : unit = unify_slot arg_pass_ctx out_slot None out_tv; Array.iteri unify_in_slot in_slots; ty - | Ast.TY_exterior ty when ucx.ext_ok - -> Ast.TY_exterior (unify ty) + | Ast.TY_box ty when ucx.box_ok + -> Ast.TY_box (unify ty) | Ast.TY_mutable ty when ucx.mut_ok -> Ast.TY_mutable (unify ty) | _ -> fail () @@ -520,8 +520,8 @@ let process_crate (cx:ctxt) (crate:Ast.crate) : unit = Ast.TY_vec ty' -> unify_ty ucx ty' tv; ty | Ast.TY_str -> unify_ty ucx (Ast.TY_mach TY_u8) tv; ty - | Ast.TY_exterior ty - when ucx.ext_ok -> Ast.TY_exterior (unify ty) + | Ast.TY_box ty + when ucx.box_ok -> Ast.TY_box (unify ty) | Ast.TY_mutable ty when ucx.mut_ok -> Ast.TY_mutable (unify ty) | _ -> fail () @@ -548,8 +548,8 @@ let process_crate (cx:ctxt) (crate:Ast.crate) : unit = | Ast.TY_obj (_, fns) -> unify_dict_with_obj_fns dct fns; ty - | Ast.TY_exterior ty - when ucx.ext_ok -> Ast.TY_exterior (unify ty) + | Ast.TY_box ty + when ucx.box_ok -> Ast.TY_box (unify ty) | Ast.TY_mutable ty when ucx.mut_ok -> Ast.TY_mutable (unify ty) | _ -> fail () @@ -591,8 +591,8 @@ let process_crate (cx:ctxt) (crate:Ast.crate) : unit = Ast.TY_rec fields -> unify_dict_with_record_fields dct fields; ty - | Ast.TY_exterior ty - when ucx.ext_ok -> Ast.TY_exterior (unify ty) + | Ast.TY_box ty + when ucx.box_ok -> Ast.TY_box (unify ty) | Ast.TY_mutable ty when ucx.mut_ok -> Ast.TY_mutable (unify ty) | _ -> fail () @@ -612,10 +612,10 @@ let process_crate (cx:ctxt) (crate:Ast.crate) : unit = in Array.iteri check_elem tvs; ty - | Ast.TY_exterior ty - when ucx.ext_ok -> Ast.TY_exterior (unify ty) + | Ast.TY_box ty + when ucx.box_ok -> Ast.TY_box (unify ty) | Ast.TY_mutable ty - when ucx.ext_ok -> Ast.TY_mutable (unify ty) + when ucx.box_ok -> Ast.TY_mutable (unify ty) | _ -> fail () in TYSPEC_resolved (params, unify ty) @@ -625,8 +625,8 @@ let process_crate (cx:ctxt) (crate:Ast.crate) : unit = let rec unify ty = match ty with Ast.TY_vec ty' -> unify_ty ucx ty' tv; ty - | Ast.TY_exterior ty when ucx.ext_ok -> - Ast.TY_exterior (unify ty) + | Ast.TY_box ty when ucx.box_ok -> + Ast.TY_box (unify ty) | Ast.TY_mutable ty when ucx.mut_ok -> Ast.TY_mutable (unify ty) | _ -> fail () @@ -1113,10 +1113,10 @@ let process_crate (cx:ctxt) (crate:Ast.crate) : unit = TYSPEC_collection tv | Ast.COMP_deref -> - TYSPEC_exterior tv + TYSPEC_box tv in let base_tv = ref base_ts in - unify_lval' { ucx with ext_ok = true } base base_tv; + unify_lval' { ucx with box_ok = true } base base_tv; match !(resolve_tyvar base_tv) with TYSPEC_resolved (_, ty) -> unify_ty ucx (project_type ty comp) tv @@ -1367,7 +1367,7 @@ let process_crate (cx:ctxt) (crate:Ast.crate) : unit = Ast.TY_fn (tsig, _) -> begin let vec_str = - interior_slot (Ast.TY_vec Ast.TY_str) + local_slot (Ast.TY_vec Ast.TY_str) in match tsig.Ast.sig_input_slots with [| |] -> () @@ -1532,8 +1532,8 @@ let process_crate (cx:ctxt) (crate:Ast.crate) : unit = let ts = !(resolve_tyvar tv) in match ts with TYSPEC_resolved ([||], ty) -> ty - | TYSPEC_exterior tv -> - Ast.TY_exterior (get_resolved_ty tv id) + | TYSPEC_box tv -> + Ast.TY_box (get_resolved_ty tv id) | TYSPEC_mutable tv -> Ast.TY_mutable (get_resolved_ty tv id) diff --git a/src/boot/me/walk.ml b/src/boot/me/walk.ml index 64c08724..af4a6216 100644 --- a/src/boot/me/walk.ml +++ b/src/boot/me/walk.ml @@ -301,7 +301,7 @@ and walk_ty | Ast.TY_nil -> () | Ast.TY_task -> () | Ast.TY_any -> () - | Ast.TY_exterior m -> walk_ty v m + | Ast.TY_box m -> walk_ty v m | Ast.TY_mutable m -> walk_ty v m in walk_bracketed @@ -471,7 +471,7 @@ and walk_stmt walk_option (walk_lval v) port; walk_lval v chan; - | Ast.STMT_init_exterior (dst, src) -> + | Ast.STMT_init_box (dst, src) -> walk_lval v dst; walk_atom v src |