Skip to content

Commit b017c57

Browse files
committed
---
yaml --- r: 703 b: refs/heads/master c: 264c765 h: refs/heads/master i: 701: af332ad 699: bf0d6ca 695: 64b9beb 687: 187c175 671: bb43bf5 639: d9e1cf5 v: v3
1 parent 7463a05 commit b017c57

File tree

3 files changed

+13
-19
lines changed

3 files changed

+13
-19
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 751a47cc5ac3223c3b592659937b485c56ab2644
2+
refs/heads/master: 264c7659318cdd9213fc499810ffca107e10ffb8

trunk/src/boot/me/semant.ml

+11-17
Original file line numberDiff line numberDiff line change
@@ -2134,11 +2134,7 @@ and vec_sty (word_bits:Il.bits) : Il.scalar_ty =
21342134
let ptr = Il.ScalarTy (Il.AddrTy Il.OpaqueTy) in
21352135
Il.AddrTy (Il.StructTy [| word; word; word; ptr |])
21362136

2137-
and referent_type
2138-
?parent_tag:parent_tag
2139-
(cx:ctxt)
2140-
(t:Ast.ty)
2141-
: Il.referent_ty =
2137+
and referent_type (cx:ctxt) (t:Ast.ty) : Il.referent_ty =
21422138
let s t = Il.ScalarTy t in
21432139
let v b = Il.ValTy b in
21442140
let p t = Il.AddrTy t in
@@ -2153,7 +2149,12 @@ and referent_type
21532149
let tag ttag =
21542150
let n = get_n_tag_tups cx ttag in
21552151
let union =
2156-
let rty t = referent_type ~parent_tag:ttag cx t in
2152+
let rty t =
2153+
match t with
2154+
Ast.TY_box (Ast.TY_tag dst_tag) when is_back_edge ttag dst_tag ->
2155+
sp (Il.StructTy [| word; Il.OpaqueTy |])
2156+
| _ -> referent_type cx t
2157+
in
21572158
let tup ttup = Il.StructTy (Array.map rty ttup) in
21582159
Array.init n (fun i -> tup (get_nth_tag_tup cx ttag i))
21592160
in
@@ -2193,13 +2194,7 @@ and referent_type
21932194
| Ast.TY_fn _ -> fn_rty cx false
21942195
| Ast.TY_obj _ -> obj_rty word_bits
21952196

2196-
| Ast.TY_tag ttag ->
2197-
begin
2198-
match parent_tag with
2199-
Some parent_tag when is_back_edge ttag parent_tag ->
2200-
Il.OpaqueTy
2201-
| _ -> tag ttag
2202-
end
2197+
| Ast.TY_tag ttag -> tag ttag
22032198

22042199
| Ast.TY_chan _
22052200
| Ast.TY_port _
@@ -2210,15 +2205,14 @@ and referent_type
22102205
| Ast.TY_native _ -> ptr
22112206

22122207
| Ast.TY_box t ->
2213-
sp (Il.StructTy
2214-
[| word; referent_type ?parent_tag:parent_tag cx t |])
2208+
sp (Il.StructTy [| word; referent_type cx t |])
22152209

2216-
| Ast.TY_mutable t -> referent_type ?parent_tag:parent_tag cx t
2210+
| Ast.TY_mutable t -> referent_type cx t
22172211

22182212
| Ast.TY_param (i, _) -> Il.ParamTy i
22192213

22202214
| Ast.TY_named _ -> bug () "named type in referent_type"
2221-
| Ast.TY_constrained (t, _) -> referent_type ?parent_tag:parent_tag cx t
2215+
| Ast.TY_constrained (t, _) -> referent_type cx t
22222216

22232217
and slot_referent_type (cx:ctxt) (sl:Ast.slot) : Il.referent_ty =
22242218
let s t = Il.ScalarTy t in

trunk/src/boot/me/type.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ let populate_tag_graph_node (cx:Semant.ctxt) (id:Common.opaque_id) (n:int) =
10101010
| Ast.TY_rec ty_rec ->
10111011
Array.iter (fun (_, ty) -> add_ty ty) ty_rec
10121012
| Ast.TY_fn ty_fn -> add_ty_fn ty_fn
1013-
| Ast.TY_chan ty | Ast.TY_port ty | Ast.TY_mutable ty
1013+
| Ast.TY_vec ty | Ast.TY_chan ty | Ast.TY_port ty | Ast.TY_mutable ty
10141014
| Ast.TY_constrained (ty, _) -> add_ty ty
10151015
| Ast.TY_obj (_, ty_fns) ->
10161016
Hashtbl.iter (fun _ ty_fn -> add_ty_fn ty_fn) ty_fns

0 commit comments

Comments
 (0)