@@ -2134,11 +2134,7 @@ and vec_sty (word_bits:Il.bits) : Il.scalar_ty =
2134
2134
let ptr = Il. ScalarTy (Il. AddrTy Il. OpaqueTy ) in
2135
2135
Il. AddrTy (Il. StructTy [| word; word; word; ptr |])
2136
2136
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 =
2142
2138
let s t = Il. ScalarTy t in
2143
2139
let v b = Il. ValTy b in
2144
2140
let p t = Il. AddrTy t in
@@ -2153,7 +2149,12 @@ and referent_type
2153
2149
let tag ttag =
2154
2150
let n = get_n_tag_tups cx ttag in
2155
2151
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
2157
2158
let tup ttup = Il. StructTy (Array. map rty ttup) in
2158
2159
Array. init n (fun i -> tup (get_nth_tag_tup cx ttag i))
2159
2160
in
@@ -2193,13 +2194,7 @@ and referent_type
2193
2194
| Ast. TY_fn _ -> fn_rty cx false
2194
2195
| Ast. TY_obj _ -> obj_rty word_bits
2195
2196
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
2203
2198
2204
2199
| Ast. TY_chan _
2205
2200
| Ast. TY_port _
@@ -2210,15 +2205,14 @@ and referent_type
2210
2205
| Ast. TY_native _ -> ptr
2211
2206
2212
2207
| 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 |])
2215
2209
2216
- | Ast. TY_mutable t -> referent_type ?parent_tag:parent_tag cx t
2210
+ | Ast. TY_mutable t -> referent_type cx t
2217
2211
2218
2212
| Ast. TY_param (i , _ ) -> Il. ParamTy i
2219
2213
2220
2214
| 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
2222
2216
2223
2217
and slot_referent_type (cx :ctxt ) (sl :Ast.slot ) : Il.referent_ty =
2224
2218
let s t = Il. ScalarTy t in
0 commit comments