Change 'stratum' to the friendlier term 'layer'.

This commit is contained in:
Graydon Hoare 2010-12-03 12:15:32 -08:00
parent 7bdb93266d
commit a98b2ebb4a
14 changed files with 105 additions and 105 deletions

View file

@ -265,7 +265,7 @@ BE_MLS := $(addprefix boot/be/, x86.ml ra.ml pe.ml elf.ml \
macho.ml) macho.ml)
IL_MLS := $(addprefix boot/be/, asm.ml il.ml abi.ml) IL_MLS := $(addprefix boot/be/, asm.ml il.ml abi.ml)
ME_MLS := $(addprefix boot/me/, walk.ml semant.ml resolve.ml alias.ml \ ME_MLS := $(addprefix boot/me/, walk.ml semant.ml resolve.ml alias.ml \
simplify.ml type.ml dead.ml stratum.ml effect.ml typestate.ml \ simplify.ml type.ml dead.ml layer.ml effect.ml typestate.ml \
loop.ml layout.ml transutil.ml trans.ml dwarf.ml) loop.ml layout.ml transutil.ml trans.ml dwarf.ml)
FE_MLS := $(addprefix boot/fe/, ast.ml token.ml lexer.ml parser.ml \ FE_MLS := $(addprefix boot/fe/, ast.ml token.ml lexer.ml parser.ml \
extfmt.ml pexp.ml item.ml cexp.ml fuzz.ml) extfmt.ml pexp.ml item.ml cexp.ml fuzz.ml)

View file

@ -18,7 +18,7 @@ let alt_pipeline sess sem_cx crate =
Simplify.process_crate; Simplify.process_crate;
Type.process_crate; Type.process_crate;
Typestate.process_crate; Typestate.process_crate;
Stratum.process_crate; Layer.process_crate;
Effect.process_crate; Effect.process_crate;
Loop.process_crate; Loop.process_crate;
Alias.process_crate; Alias.process_crate;

View file

@ -38,7 +38,7 @@ let (sess:Session.sess) =
Session.sess_log_resolve = false; Session.sess_log_resolve = false;
Session.sess_log_type = false; Session.sess_log_type = false;
Session.sess_log_simplify = false; Session.sess_log_simplify = false;
Session.sess_log_stratum = false; Session.sess_log_layer = false;
Session.sess_log_effect = false; Session.sess_log_effect = false;
Session.sess_log_typestate = false; Session.sess_log_typestate = false;
Session.sess_log_loop = false; Session.sess_log_loop = false;
@ -180,8 +180,8 @@ let argspecs =
"-ltype" "log type checking"); "-ltype" "log type checking");
(flag (fun _ -> sess.Session.sess_log_simplify <- true) (flag (fun _ -> sess.Session.sess_log_simplify <- true)
"-lsimplify" "log simplification"); "-lsimplify" "log simplification");
(flag (fun _ -> sess.Session.sess_log_stratum <- true) (flag (fun _ -> sess.Session.sess_log_layer <- true)
"-lstratum" "log stratum checking"); "-llayer" "log layer checking");
(flag (fun _ -> sess.Session.sess_log_effect <- true) (flag (fun _ -> sess.Session.sess_log_effect <- true)
"-leffect" "log effect checking"); "-leffect" "log effect checking");
(flag (fun _ -> sess.Session.sess_log_typestate <- true) (flag (fun _ -> sess.Session.sess_log_typestate <- true)
@ -396,7 +396,7 @@ let main_pipeline _ =
Simplify.process_crate; Simplify.process_crate;
Type.process_crate; Type.process_crate;
Typestate.process_crate; Typestate.process_crate;
Stratum.process_crate; Layer.process_crate;
Effect.process_crate; Effect.process_crate;
Loop.process_crate; Loop.process_crate;
Alias.process_crate; Alias.process_crate;

View file

@ -24,7 +24,7 @@ type sess =
mutable sess_log_resolve: bool; mutable sess_log_resolve: bool;
mutable sess_log_type: bool; mutable sess_log_type: bool;
mutable sess_log_simplify: bool; mutable sess_log_simplify: bool;
mutable sess_log_stratum: bool; mutable sess_log_layer: bool;
mutable sess_log_effect: bool; mutable sess_log_effect: bool;
mutable sess_log_typestate: bool; mutable sess_log_typestate: bool;
mutable sess_log_dead: bool; mutable sess_log_dead: bool;

View file

@ -34,10 +34,10 @@ type effect =
| EFF_unsafe | EFF_unsafe
;; ;;
type stratum = type layer =
STRAT_value LAYER_value
| STRAT_state | LAYER_state
| STRAT_gc | LAYER_gc
;; ;;
type opacity = type opacity =
@ -94,7 +94,7 @@ and ty =
| TY_task | TY_task
| TY_native of opaque_id | TY_native of opaque_id
| TY_param of (ty_param_idx * stratum) | TY_param of (ty_param_idx * layer)
| TY_named of name | TY_named of name
| TY_type | TY_type
@ -181,7 +181,7 @@ and ty_fn = (ty_sig * ty_fn_aux)
and ty_obj_header = (slot array * constrs) and ty_obj_header = (slot array * constrs)
and ty_obj = (stratum * ((ident,ty_fn) Hashtbl.t)) and ty_obj = (layer * ((ident,ty_fn) Hashtbl.t))
and check_calls = (lval * (atom array)) array and check_calls = (lval * (atom array)) array
@ -434,7 +434,7 @@ and fn =
and obj = and obj =
{ {
obj_state: header_slots; obj_state: header_slots;
obj_stratum: stratum; obj_layer: layer;
obj_constrs: constrs; obj_constrs: constrs;
obj_fns: (ident,fn identified) Hashtbl.t; obj_fns: (ident,fn identified) Hashtbl.t;
obj_drop: block option; obj_drop: block option;
@ -449,10 +449,10 @@ and obj =
* even if it's a type that's bound by a quantifier in its environment. * even if it's a type that's bound by a quantifier in its environment.
*) *)
and ty_param = ident * (ty_param_idx * stratum) and ty_param = ident * (ty_param_idx * layer)
and mod_item' = and mod_item' =
MOD_ITEM_type of (stratum * ty) MOD_ITEM_type of (layer * ty)
| MOD_ITEM_tag of (header_slots * opaque_id * int) | MOD_ITEM_tag of (header_slots * opaque_id * int)
| MOD_ITEM_mod of (mod_view * mod_items) | MOD_ITEM_mod of (mod_view * mod_items)
| MOD_ITEM_fn of fn | MOD_ITEM_fn of fn
@ -723,21 +723,21 @@ and fmt_effect_qual
fmt_effect ff e; fmt_effect ff e;
if e <> EFF_pure then fmt ff " "; if e <> EFF_pure then fmt ff " ";
and fmt_stratum and fmt_layer
(ff:Format.formatter) (ff:Format.formatter)
(strat:stratum) (la:layer)
: unit = : unit =
match strat with match la with
STRAT_value -> () LAYER_value -> ()
| STRAT_state -> fmt ff "state" | LAYER_state -> fmt ff "state"
| STRAT_gc -> fmt ff "gc" | LAYER_gc -> fmt ff "gc"
and fmt_stratum_qual and fmt_layer_qual
(ff:Format.formatter) (ff:Format.formatter)
(s:stratum) (s:layer)
: unit = : unit =
fmt_stratum ff s; fmt_layer ff s;
if s <> STRAT_value then fmt ff " "; if s <> LAYER_value then fmt ff " ";
and fmt_opacity and fmt_opacity
(ff:Format.formatter) (ff:Format.formatter)
@ -810,7 +810,7 @@ and fmt_ty (ff:Format.formatter) (t:ty) : unit =
fmt_ident_tys ff entries; fmt_ident_tys ff entries;
fmt ff "@]" fmt ff "@]"
| TY_param (i, s) -> (fmt_stratum_qual ff s; | TY_param (i, s) -> (fmt_layer_qual ff s;
fmt ff "<p#%d>" i) fmt ff "<p#%d>" i)
| TY_native oid -> fmt ff "<native#%d>" (int_of_opaque oid) | TY_native oid -> fmt ff "<native#%d>" (int_of_opaque oid)
| TY_named n -> fmt_name ff n | TY_named n -> fmt_name ff n
@ -833,9 +833,9 @@ and fmt_ty (ff:Format.formatter) (t:ty) : unit =
| TY_constrained ctrd -> fmt_constrained ff ctrd | TY_constrained ctrd -> fmt_constrained ff ctrd
| TY_obj (stratum, fns) -> | TY_obj (layer, fns) ->
fmt_obox ff; fmt_obox ff;
fmt_stratum_qual ff stratum; fmt_layer_qual ff layer;
fmt ff "obj "; fmt ff "obj ";
fmt_obr ff; fmt_obr ff;
Hashtbl.iter Hashtbl.iter
@ -1629,7 +1629,7 @@ and fmt_slice (ff:Format.formatter) (slice:slice) : unit =
and fmt_decl_param (ff:Format.formatter) (param:ty_param) : unit = and fmt_decl_param (ff:Format.formatter) (param:ty_param) : unit =
let (ident, (i, s)) = param in let (ident, (i, s)) = param in
fmt_stratum_qual ff s; fmt_layer_qual ff s;
fmt_ident ff ident; fmt_ident ff ident;
fmt ff "=<p#%d>" i fmt ff "=<p#%d>" i
@ -1683,7 +1683,7 @@ and fmt_obj
(obj:obj) (obj:obj)
: unit = : unit =
fmt_obox ff; fmt_obox ff;
fmt_stratum_qual ff obj.obj_stratum; fmt_layer_qual ff obj.obj_layer;
fmt ff "obj "; fmt ff "obj ";
fmt_ident_and_params ff id params; fmt_ident_and_params ff id params;
fmt_header_slots ff obj.obj_state; fmt_header_slots ff obj.obj_state;
@ -1720,7 +1720,7 @@ and fmt_mod_item (ff:Format.formatter) (id:ident) (item:mod_item) : unit =
begin begin
match item.node.decl_item with match item.node.decl_item with
MOD_ITEM_type (s, ty) -> MOD_ITEM_type (s, ty) ->
fmt_stratum_qual ff s; fmt_layer_qual ff s;
fmt ff "type "; fmt ff "type ";
fmt_ident_and_params ff id params; fmt_ident_and_params ff id params;
fmt ff " = "; fmt ff " = ";

View file

@ -104,7 +104,7 @@ let rec generate_mod_item (mis:mod_items) (cx:ctxt) : unit =
match Random.int 2 with match Random.int 2 with
0 -> 0 ->
let ty = generate_ty cx in let ty = generate_ty cx in
let st = Ast.STRAT_value in let st = Ast.LAYER_value in
decl (MOD_ITEM_type (st, ty)) decl (MOD_ITEM_type (st, ty))
| _ -> | _ ->
let mis' = Hashtbl.create 0 in let mis' = Hashtbl.create 0 in

View file

@ -692,7 +692,7 @@ and parse_stmts_including_none (ps:pstate) : Ast.stmt array =
and parse_ty_param (iref:int ref) (ps:pstate) : Ast.ty_param identified = and parse_ty_param (iref:int ref) (ps:pstate) : Ast.ty_param identified =
let apos = lexpos ps in let apos = lexpos ps in
let _ = Pexp.parse_opacity ps in let _ = Pexp.parse_opacity ps in
let s = Pexp.parse_stratum ps in let s = Pexp.parse_layer ps in
let ident = Pexp.parse_ident ps in let ident = Pexp.parse_ident ps in
let i = !iref in let i = !iref in
let bpos = lexpos ps in let bpos = lexpos ps in
@ -842,7 +842,7 @@ and parse_optional_meta_pat (ps:pstate) (ident:Ast.ident) : Ast.meta_pat =
and parse_obj_item and parse_obj_item
(ps:pstate) (ps:pstate)
(apos:pos) (apos:pos)
(stratum:Ast.stratum) (layer:Ast.layer)
: (Ast.ident * Ast.mod_item) = : (Ast.ident * Ast.mod_item) =
expect ps OBJ; expect ps OBJ;
let (ident, params) = parse_ident_and_params ps "obj" in let (ident, params) = parse_ident_and_params ps "obj" in
@ -871,7 +871,7 @@ and parse_obj_item
expect ps RBRACE; expect ps RBRACE;
let bpos = lexpos ps in let bpos = lexpos ps in
let obj = { Ast.obj_state = state; let obj = { Ast.obj_state = state;
Ast.obj_stratum = stratum; Ast.obj_layer = layer;
Ast.obj_constrs = constrs; Ast.obj_constrs = constrs;
Ast.obj_fns = fns; Ast.obj_fns = fns;
Ast.obj_drop = !drop } Ast.obj_drop = !drop }
@ -883,7 +883,7 @@ and parse_obj_item
and parse_tag_item and parse_tag_item
(ps:pstate) (ps:pstate)
(apos:pos) (apos:pos)
(stratum:Ast.stratum) (layer:Ast.layer)
: (Ast.ident * Ast.mod_item) array = : (Ast.ident * Ast.mod_item) array =
expect ps TAG; expect ps TAG;
let (ident, params) = parse_ident_and_params ps "tag" in let (ident, params) = parse_ident_and_params ps "tag" in
@ -945,14 +945,14 @@ and parse_tag_item
let ty_item = let ty_item =
(ident, (ident,
span ps apos bpos span ps apos bpos
(decl params (Ast.MOD_ITEM_type (stratum, ty)))) (decl params (Ast.MOD_ITEM_type (layer, ty))))
in in
Array.append [| ty_item |] constructors Array.append [| ty_item |] constructors
and parse_type_item and parse_type_item
(ps:pstate) (ps:pstate)
(apos:pos) (apos:pos)
(stratum:Ast.stratum) (layer:Ast.layer)
: (Ast.ident * Ast.mod_item) = : (Ast.ident * Ast.mod_item) =
expect ps TYPE; expect ps TYPE;
let (ident, params) = parse_ident_and_params ps "type" in let (ident, params) = parse_ident_and_params ps "type" in
@ -960,7 +960,7 @@ and parse_type_item
let ty = ctxt "mod type item: ty" Pexp.parse_ty ps in let ty = ctxt "mod type item: ty" Pexp.parse_ty ps in
let _ = expect ps SEMI in let _ = expect ps SEMI in
let bpos = lexpos ps in let bpos = lexpos ps in
let item = Ast.MOD_ITEM_type (stratum, ty) in let item = Ast.MOD_ITEM_type (layer, ty) in
(ident, span ps apos bpos (decl params item)) (ident, span ps apos bpos (decl params item))
and parse_mod_item (ps:pstate) and parse_mod_item (ps:pstate)
@ -992,25 +992,25 @@ and parse_mod_item (ps:pstate)
STATE | GC | IMPURE | UNSAFE | ABS STATE | GC | IMPURE | UNSAFE | ABS
| TYPE | OBJ | TAG | FN | ITER -> | TYPE | OBJ | TAG | FN | ITER ->
let _ = Pexp.parse_opacity ps in let _ = Pexp.parse_opacity ps in
let stratum = Pexp.parse_stratum ps in let layer = Pexp.parse_layer ps in
let effect = Pexp.parse_effect ps in let effect = Pexp.parse_effect ps in
begin begin
match peek ps with match peek ps with
OBJ -> OBJ ->
if effect <> Ast.EFF_pure if effect <> Ast.EFF_pure
then raise (err "effect specified for obj" ps); then raise (err "effect specified for obj" ps);
[| parse_obj_item ps apos stratum |] [| parse_obj_item ps apos layer |]
| TAG -> | TAG ->
if effect <> Ast.EFF_pure if effect <> Ast.EFF_pure
then raise (err "effect specified for tag" ps); then raise (err "effect specified for tag" ps);
parse_tag_item ps apos stratum parse_tag_item ps apos layer
| TYPE -> | TYPE ->
if effect <> Ast.EFF_pure if effect <> Ast.EFF_pure
then raise (err "effect specified for type" ps); then raise (err "effect specified for type" ps);
[| parse_type_item ps apos stratum |] [| parse_type_item ps apos layer |]
| _ -> | _ ->
if stratum <> Ast.STRAT_value if layer <> Ast.LAYER_value
then raise (err "stratum specified for fn or iter" ps); then raise (err "layer specified for fn or iter" ps);
let is_iter = (peek ps) = ITER in let is_iter = (peek ps) = ITER in
bump ps; bump ps;
let (ident, params) = parse_ident_and_params ps "fn" in let (ident, params) = parse_ident_and_params ps "fn" in
@ -1159,7 +1159,7 @@ and parse_native_mod_item_from_signature (ps:pstate)
expect ps SEMI; expect ps SEMI;
let bpos = lexpos ps in let bpos = lexpos ps in
[| (ident, span ps apos bpos [| (ident, span ps apos bpos
(decl params (Ast.MOD_ITEM_type (Ast.STRAT_value, t)))) |] (decl params (Ast.MOD_ITEM_type (Ast.LAYER_value, t)))) |]
| _ -> raise (unexpected ps) | _ -> raise (unexpected ps)

View file

@ -145,11 +145,11 @@ and parse_opacity (ps:pstate) : Ast.opacity =
ABS -> bump ps; Ast.OPA_abstract ABS -> bump ps; Ast.OPA_abstract
| _ -> Ast.OPA_transparent | _ -> Ast.OPA_transparent
and parse_stratum (ps:pstate) : Ast.stratum = and parse_layer (ps:pstate) : Ast.layer =
match peek ps with match peek ps with
STATE -> bump ps; Ast.STRAT_state STATE -> bump ps; Ast.LAYER_state
| GC -> bump ps; Ast.STRAT_gc | GC -> bump ps; Ast.LAYER_gc
| _ -> Ast.STRAT_value | _ -> Ast.LAYER_value
and parse_effect (ps:pstate) : Ast.effect = and parse_effect (ps:pstate) : Ast.effect =
match peek ps with match peek ps with
@ -274,7 +274,7 @@ and parse_atomic_ty (ps:pstate) : Ast.ty =
Ast.TY_mach m Ast.TY_mach m
| STATE | GC | IMPURE | UNSAFE | OBJ | FN | ITER -> | STATE | GC | IMPURE | UNSAFE | OBJ | FN | ITER ->
let stratum = parse_stratum ps in let layer = parse_layer ps in
let effect = parse_effect ps in let effect = parse_effect ps in
begin begin
match peek ps with match peek ps with
@ -295,11 +295,11 @@ and parse_atomic_ty (ps:pstate) : Ast.ty =
in in
ignore (bracketed_zero_or_more LBRACE RBRACE ignore (bracketed_zero_or_more LBRACE RBRACE
None parse_method ps); None parse_method ps);
Ast.TY_obj (stratum, methods) Ast.TY_obj (layer, methods)
| FN | ITER -> | FN | ITER ->
if stratum <> Ast.STRAT_value if layer <> Ast.LAYER_value
then raise (err "stratum specified for fn or iter" ps); then raise (err "layer specified for fn or iter" ps);
Ast.TY_fn (fst (parse_ty_fn effect ps)) Ast.TY_fn (fst (parse_ty_fn effect ps))
| _ -> raise (unexpected ps) | _ -> raise (unexpected ps)
end end

View file

@ -83,7 +83,7 @@ type token =
(* Opacity keywords *) (* Opacity keywords *)
| ABS | ABS
(* Stratum keywords *) (* Layer keywords *)
| STATE | STATE
| GC | GC
@ -246,7 +246,7 @@ let rec string_of_tok t =
(* Opacity keywords *) (* Opacity keywords *)
| ABS -> "abs" | ABS -> "abs"
(* Stratum keywords *) (* Layer keywords *)
| STATE -> "state" | STATE -> "state"
| GC -> "gc" | GC -> "gc"

View file

@ -1539,13 +1539,13 @@ let dwarf_visitor
|] |]
in in
let encode_stratum eff = let encode_layer eff =
(* Note: weird encoding: mutable+pure = gc. *) (* Note: weird encoding: mutable+pure = gc. *)
let mut_byte, pure_byte = let mut_byte, pure_byte =
match eff with match eff with
Ast.STRAT_value -> (0,1) Ast.LAYER_value -> (0,1)
| Ast.STRAT_state -> (1,0) | Ast.LAYER_state -> (1,0)
| Ast.STRAT_gc -> (1,1) | Ast.LAYER_gc -> (1,1)
in in
SEQ [| SEQ [|
(* DW_AT_mutable: DW_FORM_flag *) (* DW_AT_mutable: DW_FORM_flag *)
@ -1557,7 +1557,7 @@ let dwarf_visitor
(* Type-param DIEs. *) (* Type-param DIEs. *)
let type_param_die (p:(ty_param_idx * Ast.stratum)) = let type_param_die (p:(ty_param_idx * Ast.layer)) =
let (idx, s) = p in let (idx, s) = p in
SEQ [| SEQ [|
uleb (get_abbrev_code abbrev_rust_type_param); uleb (get_abbrev_code abbrev_rust_type_param);
@ -1565,7 +1565,7 @@ let dwarf_visitor
BYTE (dw_rust_type_to_int DW_RUST_type_param); BYTE (dw_rust_type_to_int DW_RUST_type_param);
(* DW_AT_rust_type_param_index: DW_FORM_data4 *) (* DW_AT_rust_type_param_index: DW_FORM_data4 *)
WORD (word_ty_mach, IMM (Int64.of_int idx)); WORD (word_ty_mach, IMM (Int64.of_int idx));
encode_stratum s; encode_layer s;
|] |]
in in
@ -1817,7 +1817,7 @@ let dwarf_visitor
emit_die die emit_die die
in in
let rust_type_param (p:(ty_param_idx * Ast.stratum)) = let rust_type_param (p:(ty_param_idx * Ast.layer)) =
let die = DEF (fix, type_param_die p) in let die = DEF (fix, type_param_die p) in
emit_die die emit_die die
in in
@ -1892,7 +1892,7 @@ let dwarf_visitor
let die = let die =
DEF (fix, SEQ [| DEF (fix, SEQ [|
uleb (get_abbrev_code abbrev_obj_type); uleb (get_abbrev_code abbrev_obj_type);
encode_stratum str; encode_layer str;
|]) |])
in in
emit_die die; emit_die die;
@ -2255,7 +2255,7 @@ let dwarf_visitor
curr_cu_line := [] curr_cu_line := []
in in
let type_param_decl_die (p:(Ast.ident * (ty_param_idx * Ast.stratum))) = let type_param_decl_die (p:(Ast.ident * (ty_param_idx * Ast.layer))) =
let (ident, (idx, str)) = p in let (ident, (idx, str)) = p in
SEQ [| SEQ [|
uleb (get_abbrev_code abbrev_rust_type_param_decl); uleb (get_abbrev_code abbrev_rust_type_param_decl);
@ -2265,7 +2265,7 @@ let dwarf_visitor
ZSTRING (Filename.basename ident); ZSTRING (Filename.basename ident);
(* DW_AT_rust_type_param_index: DW_FORM_data4 *) (* DW_AT_rust_type_param_index: DW_FORM_data4 *)
WORD (word_ty_mach, IMM (Int64.of_int idx)); WORD (word_ty_mach, IMM (Int64.of_int idx));
encode_stratum str; encode_layer str;
|] |]
in in
@ -2360,7 +2360,7 @@ let dwarf_visitor
let emit_typedef_die let emit_typedef_die
(id:Ast.ident) (id:Ast.ident)
(s:Ast.stratum) (s:Ast.layer)
(ty:Ast.ty) (ty:Ast.ty)
: unit = : unit =
let abbrev_code = get_abbrev_code abbrev_typedef in let abbrev_code = get_abbrev_code abbrev_typedef in
@ -2369,7 +2369,7 @@ let dwarf_visitor
uleb abbrev_code; uleb abbrev_code;
(* DW_AT_name: DW_FORM_string *) (* DW_AT_name: DW_FORM_string *)
ZSTRING id; ZSTRING id;
encode_stratum s; encode_layer s;
(* DW_AT_type: DW_FORM_ref_addr *) (* DW_AT_type: DW_FORM_ref_addr *)
(ref_type_die ty); (ref_type_die ty);
|]) |])
@ -2909,12 +2909,12 @@ let rec extract_mod_items
| _ -> failwith "bad effect encoding" | _ -> failwith "bad effect encoding"
in in
let get_stratum die = let get_layer die =
match (get_flag die DW_AT_mutable, get_flag die DW_AT_pure) with match (get_flag die DW_AT_mutable, get_flag die DW_AT_pure) with
(* Note: weird encoding: mutable+pure = gc. *) (* Note: weird encoding: mutable+pure = gc. *)
| (false, true) -> Ast.STRAT_value | (false, true) -> Ast.LAYER_value
| (true, false) -> Ast.STRAT_state | (true, false) -> Ast.LAYER_state
| (true, true) -> Ast.STRAT_gc | (true, true) -> Ast.LAYER_gc
| _ -> failwith "bad statum encoding" | _ -> failwith "bad statum encoding"
in in
@ -2922,7 +2922,7 @@ let rec extract_mod_items
let get_type_param die = let get_type_param die =
let idx = get_num die DW_AT_rust_type_param_index in let idx = get_num die DW_AT_rust_type_param_index in
let s = get_stratum die in let s = get_layer die in
(idx, s) (idx, s)
in in
@ -3071,7 +3071,7 @@ let rec extract_mod_items
end end
| DW_TAG_interface_type -> | DW_TAG_interface_type ->
let str = get_stratum die in let str = get_layer die in
let fns = Hashtbl.create 0 in let fns = Hashtbl.create 0 in
Array.iter Array.iter
begin begin
@ -3187,10 +3187,10 @@ let rec extract_mod_items
let die = Hashtbl.find dies i in let die = Hashtbl.find dies i in
match die.die_tag with match die.die_tag with
DW_TAG_typedef -> DW_TAG_typedef ->
let stratum = get_stratum die in let layer = get_layer die in
let ident = get_name die in let ident = get_name die in
let ty = get_referenced_ty die in let ty = get_referenced_ty die in
let tyi = Ast.MOD_ITEM_type (stratum, ty) in let tyi = Ast.MOD_ITEM_type (layer, ty) in
let (params, islots) = get_formals die in let (params, islots) = get_formals die in
assert ((Array.length islots) = 0); assert ((Array.length islots) = 0);
htab_put mis ident (decl params tyi) htab_put mis ident (decl params tyi)

View file

@ -1,19 +1,19 @@
open Semant;; open Semant;;
open Common;; open Common;;
let log cx = Session.log "stratum" let log cx = Session.log "layer"
(should_log cx cx.ctxt_sess.Session.sess_log_stratum) (should_log cx cx.ctxt_sess.Session.sess_log_layer)
cx.ctxt_sess.Session.sess_log_out cx.ctxt_sess.Session.sess_log_out
;; ;;
let iflog cx thunk = let iflog cx thunk =
if (should_log cx cx.ctxt_sess.Session.sess_log_stratum) if (should_log cx cx.ctxt_sess.Session.sess_log_layer)
then thunk () then thunk ()
else () else ()
;; ;;
let state_stratum_checking_visitor let state_layer_checking_visitor
(cx:ctxt) (cx:ctxt)
(inner:Walk.visitor) (inner:Walk.visitor)
: Walk.visitor = : Walk.visitor =
@ -90,12 +90,12 @@ let process_crate
: unit = : unit =
let passes = let passes =
[| [|
(state_stratum_checking_visitor cx (state_layer_checking_visitor cx
Walk.empty_visitor); Walk.empty_visitor);
|] |]
in in
run_passes cx "stratum" passes run_passes cx "layer" passes
cx.ctxt_sess.Session.sess_log_stratum log crate cx.ctxt_sess.Session.sess_log_layer log crate
;; ;;
(* (*

View file

@ -192,7 +192,7 @@ type ctxt =
ctxt_rty_cache: (Ast.ty,Il.referent_ty) Hashtbl.t; ctxt_rty_cache: (Ast.ty,Il.referent_ty) Hashtbl.t;
ctxt_type_stratum_cache: (Ast.ty,Ast.stratum) Hashtbl.t; ctxt_type_layer_cache: (Ast.ty,Ast.layer) Hashtbl.t;
ctxt_type_points_to_heap_cache: (Ast.ty,bool) Hashtbl.t; ctxt_type_points_to_heap_cache: (Ast.ty,bool) Hashtbl.t;
ctxt_type_is_structured_cache: (Ast.ty,bool) Hashtbl.t; ctxt_type_is_structured_cache: (Ast.ty,bool) Hashtbl.t;
ctxt_type_contains_chan_cache: (Ast.ty,bool) Hashtbl.t; ctxt_type_contains_chan_cache: (Ast.ty,bool) Hashtbl.t;
@ -298,7 +298,7 @@ let new_ctxt sess abi crate =
ctxt_curr_path = Stack.create (); ctxt_curr_path = Stack.create ();
ctxt_rty_cache = Hashtbl.create 0; ctxt_rty_cache = Hashtbl.create 0;
ctxt_type_stratum_cache = Hashtbl.create 0; ctxt_type_layer_cache = Hashtbl.create 0;
ctxt_type_points_to_heap_cache = Hashtbl.create 0; ctxt_type_points_to_heap_cache = Hashtbl.create 0;
ctxt_type_is_structured_cache = Hashtbl.create 0; ctxt_type_is_structured_cache = Hashtbl.create 0;
ctxt_type_contains_chan_cache = Hashtbl.create 0; ctxt_type_contains_chan_cache = Hashtbl.create 0;
@ -731,7 +731,7 @@ type ('ty, 'tys, 'slot, 'slots, 'tag) ty_fold =
ty_fold_vec : 'ty -> 'ty; ty_fold_vec : 'ty -> 'ty;
ty_fold_rec : (Ast.ident * 'ty) array -> 'ty; ty_fold_rec : (Ast.ident * 'ty) array -> 'ty;
ty_fold_fn : (('slots * Ast.constrs * 'slot) * Ast.ty_fn_aux) -> 'ty; ty_fold_fn : (('slots * Ast.constrs * 'slot) * Ast.ty_fn_aux) -> 'ty;
ty_fold_obj : (Ast.stratum ty_fold_obj : (Ast.layer
* (Ast.ident, (('slots * Ast.constrs * 'slot) * * (Ast.ident, (('slots * Ast.constrs * 'slot) *
Ast.ty_fn_aux)) Hashtbl.t) -> 'ty; Ast.ty_fn_aux)) Hashtbl.t) -> 'ty;
ty_fold_chan : 'ty -> 'ty; ty_fold_chan : 'ty -> 'ty;
@ -739,7 +739,7 @@ type ('ty, 'tys, 'slot, 'slots, 'tag) ty_fold =
ty_fold_task : unit -> 'ty; ty_fold_task : unit -> 'ty;
ty_fold_native : opaque_id -> 'ty; ty_fold_native : opaque_id -> 'ty;
ty_fold_tag : 'tag -> 'ty; ty_fold_tag : 'tag -> 'ty;
ty_fold_param : (int * Ast.stratum) -> 'ty; ty_fold_param : (int * Ast.layer) -> 'ty;
ty_fold_named : Ast.name -> 'ty; ty_fold_named : Ast.name -> 'ty;
ty_fold_type : unit -> 'ty; ty_fold_type : unit -> 'ty;
ty_fold_box : 'ty -> 'ty; ty_fold_box : 'ty -> 'ty;
@ -1253,30 +1253,30 @@ let lower_effect_of x y =
if effect_le x y then x else y if effect_le x y then x else y
;; ;;
let stratum_le x y = let layer_le x y =
match (x,y) with match (x,y) with
(Ast.STRAT_gc, _) -> true (Ast.LAYER_gc, _) -> true
| (Ast.STRAT_state, Ast.STRAT_value) -> true | (Ast.LAYER_state, Ast.LAYER_value) -> true
| (Ast.STRAT_state, Ast.STRAT_state) -> true | (Ast.LAYER_state, Ast.LAYER_state) -> true
| (Ast.STRAT_value, Ast.STRAT_value) -> true | (Ast.LAYER_value, Ast.LAYER_value) -> true
| _ -> false | _ -> false
;; ;;
let lower_stratum_of x y = let lower_layer_of x y =
if stratum_le x y then x else y if layer_le x y then x else y
;; ;;
let type_stratum (cx:ctxt) (t:Ast.ty) : Ast.stratum = let type_layer (cx:ctxt) (t:Ast.ty) : Ast.layer =
let fold_mutable _ = Ast.STRAT_state in let fold_mutable _ = Ast.LAYER_state in
let fold = associative_binary_op_ty_fold Ast.STRAT_value lower_stratum_of in let fold = associative_binary_op_ty_fold Ast.LAYER_value lower_layer_of in
let fold = { fold with ty_fold_mutable = fold_mutable } in let fold = { fold with ty_fold_mutable = fold_mutable } in
htab_search_or_add cx.ctxt_type_stratum_cache t htab_search_or_add cx.ctxt_type_layer_cache t
(fun _ -> fold_ty cx fold t) (fun _ -> fold_ty cx fold t)
;; ;;
let type_has_state (cx:ctxt) (t:Ast.ty) : bool = let type_has_state (cx:ctxt) (t:Ast.ty) : bool =
stratum_le (type_stratum cx t) Ast.STRAT_state layer_le (type_layer cx t) Ast.LAYER_state
;; ;;
@ -1640,7 +1640,7 @@ let ty_fn_of_fn (fn:Ast.fn) : Ast.ty_fn =
;; ;;
let ty_obj_of_obj (obj:Ast.obj) : Ast.ty_obj = let ty_obj_of_obj (obj:Ast.obj) : Ast.ty_obj =
(obj.Ast.obj_stratum, (obj.Ast.obj_layer,
htab_map obj.Ast.obj_fns (fun i f -> (i, ty_fn_of_fn f.node))) htab_map obj.Ast.obj_fns (fun i f -> (i, ty_fn_of_fn f.node)))
;; ;;

View file

@ -92,7 +92,7 @@ tag token {
/* Opacity keywords */ /* Opacity keywords */
ABS; ABS;
/* Stratum keywords */ /* Layer keywords */
STATE; STATE;
GC; GC;
@ -258,7 +258,7 @@ fn to_str(token t) -> str {
/* Opacity keywords */ /* Opacity keywords */
case (ABS) { ret "abs"; } case (ABS) { ret "abs"; }
/* Stratum keywords */ /* Layer keywords */
case (STATE) { ret "state"; } case (STATE) { ret "state"; }
case (GC) { ret "gc"; } case (GC) { ret "gc"; }

View file

@ -730,7 +730,7 @@ fn drop_ty(@block_ctxt cx,
fn hit_zero(@block_ctxt cx, ValueRef v, fn hit_zero(@block_ctxt cx, ValueRef v,
@typeck.ty t) -> result { @typeck.ty t) -> result {
auto res = iter_sequence(cx, v, t, bind drop_ty(_,_,_)); auto res = iter_sequence(cx, v, t, bind drop_ty(_,_,_));
// FIXME: switch gc/non-gc on stratum of the type. // FIXME: switch gc/non-gc on layer of the type.
ret trans_non_gc_free(res.bcx, v); ret trans_non_gc_free(res.bcx, v);
} }
ret decr_refcnt_and_if_zero(cx, v, ret decr_refcnt_and_if_zero(cx, v,
@ -747,7 +747,7 @@ fn drop_ty(@block_ctxt cx,
C_int(abi.box_rc_field_body))); C_int(abi.box_rc_field_body)));
auto res = drop_ty(cx, body, body_ty); auto res = drop_ty(cx, body, body_ty);
// FIXME: switch gc/non-gc on stratum of the type. // FIXME: switch gc/non-gc on layer of the type.
ret trans_non_gc_free(res.bcx, v); ret trans_non_gc_free(res.bcx, v);
} }
ret decr_refcnt_and_if_zero(cx, v, ret decr_refcnt_and_if_zero(cx, v,