Skip to content

Commit c8107d2

Browse files
committed
---
yaml --- r: 657 b: refs/heads/master c: a9e2327 h: refs/heads/master i: 655: 1902748 v: v3
1 parent 23f295a commit c8107d2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1157
-1455
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: c877f31730b3cf156d0b36355ebc99d2e85e455b
2+
refs/heads/master: a9e2327a18e782df524c14dc42910d61a4785324

trunk/src/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,11 @@ self: $(CFG_COMPILER)
376376
# Testing
377377
######################################################################
378378

379+
# Temporarily xfail tests broken by the nominal-tags change.
380+
381+
NOMINAL_TAG_XFAILS := test/run-pass/mlist.rs
382+
383+
379384
# Temporarily xfail some of the task tests, while debugging the
380385
# overhauled inter-domain messaging system.
381386

@@ -390,6 +395,7 @@ TASK_XFAILS := test/run-pass/task-comm-8.rs \
390395
test/run-pass/many.rs
391396

392397
TEST_XFAILS_X86 := $(TASK_XFAILS) \
398+
$(NOMINAL_TAG_XFAILS) \
393399
test/run-pass/child-outlives-parent.rs \
394400
test/run-pass/clone-with-exterior.rs \
395401
test/run-pass/constrained-type.rs \
@@ -414,6 +420,7 @@ TEST_XFAILS_X86 := $(TASK_XFAILS) \
414420
test/compile-fail/writing-through-read-alias.rs
415421

416422
TEST_XFAILS_LLVM := $(TASK_XFAILS) \
423+
$(NOMINAL_TAG_XFAILS) \
417424
$(addprefix test/run-pass/, \
418425
arith-1.rs \
419426
acyclic-unwind.rs \

trunk/src/boot/be/x86.ml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,11 @@ let unwind_glue
10281028

10291029

10301030
(* Puts result in eax; clobbers ecx, edx in the process. *)
1031-
let rec calculate_sz (e:Il.emitter) (size:size) (in_obj:bool) : unit =
1031+
let rec calculate_sz
1032+
(e:Il.emitter)
1033+
(size:size)
1034+
(in_obj:bool)
1035+
: unit =
10321036
let emit = Il.emit e in
10331037
let mov dst src = emit (Il.umov dst src) in
10341038
let push x = emit (Il.Push x) in
@@ -1060,9 +1064,11 @@ let rec calculate_sz (e:Il.emitter) (size:size) (in_obj:bool) : unit =
10601064
(* Note that we cheat here and pretend only to have i+1 tydescs (because
10611065
we GEP to the i'th while still in this function, so no one outside
10621066
finds out about the lie. *)
1063-
let tydesc_tys = Array.init (i + 1) (fun _ -> Ast.TY_type) in
1064-
let ty_params_ty = Ast.TY_tup tydesc_tys in
1065-
let ty_params_rty = Semant.referent_type word_bits ty_params_ty in
1067+
let tydesc_rtys =
1068+
Array.init (i + 1)
1069+
(fun _ -> (Il.ScalarTy (Il.AddrTy tydesc_rty)))
1070+
in
1071+
let ty_params_rty = Il.StructTy tydesc_rtys in
10661072

10671073
(* ... and fetch! *)
10681074

trunk/src/boot/fe/ast.ml

Lines changed: 19 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,8 @@ and ty =
7373
| TY_vec of ty
7474
| TY_rec of ty_rec
7575

76-
(*
77-
* Note that ty_idx is only valid inside a ty of a ty_iso group, not
78-
* in a general type term.
79-
*)
76+
(* NB: non-denotable. *)
8077
| TY_tag of ty_tag
81-
| TY_iso of ty_iso
82-
| TY_idx of int
8378

8479
| TY_fn of ty_fn
8580
| TY_chan of ty
@@ -113,6 +108,9 @@ and slot = { slot_mode: mode;
113108

114109
and ty_tup = ty array
115110

111+
and ty_tag = { tag_id: opaque_id;
112+
tag_args: ty array }
113+
116114
(* In closed type terms a constraint may refer to components of the term by
117115
* anchoring off the "formal symbol" '*', which represents "the term this
118116
* constraint is attached to".
@@ -156,21 +154,6 @@ and constrs = constr array
156154

157155
and ty_rec = (ident * ty) array
158156

159-
(* ty_tag is a sum type.
160-
*
161-
* a tag type expression either normalizes to a TY_tag or a TY_iso,
162-
* which (like in ocaml) is an indexed projection from an iso-recursive
163-
* group of TY_tags.
164-
*)
165-
166-
and ty_tag = (name, ty_tup) Hashtbl.t
167-
168-
and ty_iso =
169-
{
170-
iso_index: int;
171-
iso_group: ty_tag array
172-
}
173-
174157
and ty_sig =
175158
{
176159
sig_input_slots: slot array;
@@ -428,7 +411,7 @@ and ty_param = ident * (ty_param_idx * effect)
428411

429412
and mod_item' =
430413
MOD_ITEM_type of (effect * ty)
431-
| MOD_ITEM_tag of (header_tup * ty_tag * node_id)
414+
| MOD_ITEM_tag of (header_slots * opaque_id * int)
432415
| MOD_ITEM_mod of (mod_view * mod_items)
433416
| MOD_ITEM_fn of fn
434417
| MOD_ITEM_obj of obj
@@ -626,34 +609,6 @@ and fmt_ty_fn
626609
fmt ff " -> ";
627610
fmt_slot ff tsig.sig_output_slot;
628611

629-
and fmt_tag (ff:Format.formatter) (ttag:ty_tag) : unit =
630-
fmt ff "@[tag(@[";
631-
let first = ref true in
632-
Hashtbl.iter
633-
begin
634-
fun name ttup ->
635-
(if !first
636-
then first := false
637-
else fmt ff ",@ ");
638-
fmt_name ff name;
639-
fmt_tys ff ttup
640-
end
641-
ttag;
642-
fmt ff "@])@]"
643-
644-
and fmt_iso (ff:Format.formatter) (tiso:ty_iso) : unit =
645-
fmt ff "@[iso [@[";
646-
for i = 0 to (Array.length tiso.iso_group) - 1
647-
do
648-
if i != 0
649-
then fmt ff ",@ ";
650-
if i == tiso.iso_index
651-
then fmt ff "<%d>: " i
652-
else fmt ff "%d: " i;
653-
fmt_tag ff tiso.iso_group.(i);
654-
done;
655-
fmt ff "@]]@]"
656-
657612
and fmt_constrained ff (ty, constrs) : unit =
658613
fmt ff "@[";
659614
fmt_ty ff ty;
@@ -702,9 +657,11 @@ and fmt_ty (ff:Format.formatter) (t:ty) : unit =
702657

703658
| TY_fn tfn -> fmt_ty_fn ff None tfn
704659
| TY_task -> fmt ff "task"
705-
| TY_tag ttag -> fmt_tag ff ttag
706-
| TY_iso tiso -> fmt_iso ff tiso
707-
| TY_idx idx -> fmt ff "<idx#%d>" idx
660+
| TY_tag ttag ->
661+
fmt ff "<tag#%d" (int_of_opaque ttag.tag_id);
662+
fmt_arr_sep "," fmt_ty ff ttag.tag_args;
663+
fmt ff ">";
664+
708665
| TY_constrained ctrd -> fmt_constrained ff ctrd
709666

710667
| TY_obj (effect, fns) ->
@@ -1363,16 +1320,7 @@ and fmt_decl_params (ff:Format.formatter) (params:ty_param array) : unit =
13631320
if Array.length params = 0
13641321
then ()
13651322
else
1366-
begin
1367-
fmt ff "[";
1368-
for i = 0 to (Array.length params) - 1
1369-
do
1370-
if i <> 0
1371-
then fmt ff ", ";
1372-
fmt_decl_param ff params.(i)
1373-
done;
1374-
fmt ff "]"
1375-
end;
1323+
fmt_bracketed_arr_sep "[" "]" "," fmt_decl_param ff params
13761324

13771325
and fmt_header_slots (ff:Format.formatter) (hslots:header_slots) : unit =
13781326
fmt_slots ff
@@ -1462,13 +1410,17 @@ and fmt_mod_item (ff:Format.formatter) (id:ident) (item:mod_item) : unit =
14621410
fmt_ty ff ty;
14631411
fmt ff ";";
14641412

1465-
| MOD_ITEM_tag (hdr, ttag, _) ->
1413+
| MOD_ITEM_tag (hdr, tid, _) ->
14661414
fmt ff "fn ";
14671415
fmt_ident_and_params ff id params;
1468-
fmt_header_slots ff
1469-
(Array.mapi (fun i s -> (s,(Printf.sprintf "_%d" i))) hdr);
1416+
fmt_header_slots ff hdr;
14701417
fmt ff " -> ";
1471-
fmt_ty ff (TY_tag ttag);
1418+
fmt_ty ff (TY_tag
1419+
{ tag_id = tid;
1420+
tag_args =
1421+
Array.map
1422+
(fun (_,p) -> TY_param p)
1423+
params });
14721424
fmt ff ";";
14731425

14741426
| MOD_ITEM_mod (view,items) ->
@@ -1513,32 +1465,6 @@ and fmt_crate (ff:Format.formatter) (c:crate) : unit =
15131465
fmt_mod_items ff items
15141466
;;
15151467

1516-
let ty_children (ty:ty) : ty array =
1517-
let children_of_ty_tag ty_tag = Array.concat (htab_vals ty_tag) in
1518-
let children_of_ty_fn ty_fn =
1519-
let (ty_sig, _) = ty_fn in
1520-
let in_slots = ty_sig.sig_input_slots in
1521-
let slots = Array.append in_slots [| ty_sig.sig_output_slot |] in
1522-
arr_filter_some (Array.map (fun slot -> slot.slot_ty) slots)
1523-
in
1524-
match ty with
1525-
TY_tup tys -> tys
1526-
| TY_vec ty' | TY_chan ty' | TY_port ty' | TY_box ty' | TY_mutable ty'
1527-
| TY_constrained (ty', _) ->
1528-
[| ty' |]
1529-
| TY_rec fields -> Array.map snd fields
1530-
| TY_tag ty_tag -> children_of_ty_tag ty_tag
1531-
| TY_iso ty_iso ->
1532-
children_of_ty_tag (ty_iso.iso_group.(ty_iso.iso_index))
1533-
| TY_fn ty_fn -> children_of_ty_fn ty_fn
1534-
| TY_obj (_, methods) ->
1535-
Array.concat (List.map children_of_ty_fn (htab_vals methods))
1536-
| TY_any | TY_nil | TY_bool | TY_mach _ | TY_int | TY_uint | TY_char
1537-
| TY_str | TY_idx _ | TY_task | TY_native _ | TY_param _
1538-
| TY_named _ | TY_type ->
1539-
[| |]
1540-
;;
1541-
15421468
let sprintf_binop = sprintf_fmt fmt_binop;;
15431469
let sprintf_expr = sprintf_fmt fmt_expr;;
15441470
let sprintf_name = sprintf_fmt fmt_name;;
@@ -1549,7 +1475,6 @@ let sprintf_slot = sprintf_fmt fmt_slot;;
15491475
let sprintf_slot_key = sprintf_fmt fmt_slot_key;;
15501476
let sprintf_ty = sprintf_fmt fmt_ty;;
15511477
let sprintf_effect = sprintf_fmt fmt_effect;;
1552-
let sprintf_tag = sprintf_fmt fmt_tag;;
15531478
let sprintf_carg = sprintf_fmt fmt_carg;;
15541479
let sprintf_constr = sprintf_fmt fmt_constr;;
15551480
let sprintf_mod_item =

trunk/src/boot/fe/cexp.ml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,12 @@ and parse_cexp (ps:pstate) : cexp =
176176
let path = ctxt "native mod: path" parse_eq_pexp_opt ps in
177177
let items = Hashtbl.create 0 in
178178
let get_item ps =
179-
let (ident, item) = Item.parse_mod_item_from_signature ps in
180-
htab_put items ident item;
179+
Array.map
180+
begin
181+
fun (ident, item) ->
182+
htab_put items ident item
183+
end
184+
(Item.parse_mod_item_from_signature ps)
181185
in
182186
ignore (bracketed_zero_or_more
183187
LBRACE RBRACE None get_item ps);

0 commit comments

Comments
 (0)