File tree Expand file tree Collapse file tree 6 files changed +28
-2
lines changed Expand file tree Collapse file tree 6 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ under the licensing terms detailed in LICENSE:
17
17
18
18
19
19
* Stephen Paul Weber <
[email protected] >
20
+
20
21
21
22
Portions of this software are derived from third-party works licensed under
22
23
the following terms:
Original file line number Diff line number Diff line change @@ -324,6 +324,7 @@ export class Flow {
324
324
case NativeType . F32 : { temps = parentFunction . tempF32s ; break ; }
325
325
case NativeType . F64 : { temps = parentFunction . tempF64s ; break ; }
326
326
case NativeType . V128 : { temps = parentFunction . tempV128s ; break ; }
327
+ case NativeType . Anyref : { temps = parentFunction . tempAnyrefs ; break ; }
327
328
default : throw new Error ( "concrete type expected" ) ;
328
329
}
329
330
var local : Local ;
@@ -395,6 +396,10 @@ export class Flow {
395
396
temps = parentFunction . tempV128s || ( parentFunction . tempV128s = [ ] ) ;
396
397
break ;
397
398
}
399
+ case NativeType . Anyref : {
400
+ temps = parentFunction . tempAnyrefs || ( parentFunction . tempAnyrefs = [ ] ) ;
401
+ break ;
402
+ }
398
403
default : throw new Error ( "concrete type expected" ) ;
399
404
}
400
405
assert ( local . index >= 0 ) ;
Original file line number Diff line number Diff line change @@ -1423,6 +1423,10 @@ export class Module {
1423
1423
// TODO
1424
1424
return 0 ;
1425
1425
}
1426
+ // Not possible to clone an anyref as it is opaque
1427
+ case NativeType . Anyref : {
1428
+ return 0 ;
1429
+ }
1426
1430
default : {
1427
1431
throw new Error ( "concrete type expected" ) ;
1428
1432
}
Original file line number Diff line number Diff line change @@ -2900,6 +2900,7 @@ export class Function extends TypedElement {
2900
2900
tempF32s : Local [ ] | null = null ;
2901
2901
tempF64s : Local [ ] | null = null ;
2902
2902
tempV128s : Local [ ] | null = null ;
2903
+ tempAnyrefs : Local [ ] | null = null ;
2903
2904
2904
2905
// used by flows to keep track of break labels
2905
2906
nextBreakId : i32 = 0 ;
Original file line number Diff line number Diff line change 3
3
export declare function external ( a : anyref ) : anyref ;
4
4
5
5
export function internal ( a : anyref ) : anyref {
6
- return a ;
6
+ const b = external ( a ) ;
7
+ let c = external ( b ) ;
8
+ var d = external ( c ) ;
9
+ return d ;
7
10
}
8
11
9
12
// can use reflection to work with anyref values
Original file line number Diff line number Diff line change 30
30
if
31
31
i32.const 0
32
32
i32.const 24
33
- i32.const 16
33
+ i32.const 19
34
34
i32.const 0
35
35
call $~lib/builtins/abort
36
36
unreachable
45
45
call $~lib/bindings/console/log
46
46
)
47
47
(func $features/reference-types/internal (; 6 ;) (type $FUNCSIG$aa ) (param $0 anyref ) (result anyref )
48
+ (local $1 anyref )
49
+ (local $2 anyref )
50
+ (local $3 anyref )
48
51
local.get $0
52
+ call $features/reference-types/external
53
+ local.set $1
54
+ local.get $1
55
+ call $features/reference-types/external
56
+ local.set $2
57
+ local.get $2
58
+ call $features/reference-types/external
59
+ local.set $3
60
+ local.get $3
49
61
)
50
62
(func $start (; 7 ;) (type $FUNCSIG$v )
51
63
call $start:features/reference-types
You can’t perform that action at this time.
0 commit comments