@@ -23,11 +23,12 @@ type blank = Satisfies<ProgramState, {
23
23
} >
24
24
25
25
type s <
26
- Update extends Partial < ProgramState >
26
+ Source extends ProgramState ,
27
+ Update extends Partial < ProgramState > ,
27
28
> = Satisfies < ProgramState ,
28
29
evaluate <
29
30
& Omit <
30
- blank ,
31
+ Source ,
31
32
keyof Update
32
33
>
33
34
& Required < Update >
@@ -36,10 +37,12 @@ type s<
36
37
37
38
// end-to-end test for garbage collection
38
39
39
- type actual1023 = Satisfies < ProgramState , s < {
40
- count : 1023 ;
40
+ type start1 = Satisfies < ProgramState , s < blank , {
41
+ count : 1 ;
42
+ stack : [ "10000000000000000000000000000000" , "00000000000000000000000000001111" ]
41
43
instructions : [
42
44
{ kind : 'Nop' , ziltoid : 'theOmniscient' } ,
45
+ { kind : 'Store' , subkind : 'I32Store8' } ,
43
46
{ kind : 'Nop' , ziltoid : 'theOmniscient' } ,
44
47
] ;
45
48
L1Cache : {
@@ -59,20 +62,42 @@ type actual1023 = Satisfies<ProgramState, s<{
59
62
garbageCollection : 1023 ;
60
63
} > >
61
64
62
- type actual1025 = executeInstruction < actual1023 , true , 1024 >
63
- type expected1025 = Satisfies < ProgramState , s < {
64
- count : 1024 ;
65
+ // no change to the garbage collection counter for regular instructions
66
+ type actual2 = executeInstruction < start1 , true , 2 >
67
+ type expected2 = Satisfies < ProgramState , s < start1 /* note: using `start1` here, not `blank` like the rest */ , {
68
+ count : 2 ;
65
69
instructions : [
70
+ { kind : 'Store' , subkind : 'I32Store8' } ,
66
71
{ kind : 'Nop' , ziltoid : 'theOmniscient' } ,
67
72
] ;
68
- L1Cache : { } ;
73
+ } > >
74
+ type test2 = Expect < Equal < actual2 , expected2 > >
75
+
76
+ type actual3 = executeInstruction < actual2 , true , 3 >
77
+ type expected3 = Satisfies < ProgramState , s < blank , {
78
+ count : 3 ;
79
+ instructions : [
80
+ { kind : 'Nop' , ziltoid : 'theOmniscient' } ,
81
+ ] ;
82
+ L1Cache : evaluate < start1 [ 'L1Cache' ] & {
83
+ "10000000000000000000000000000000" : "00001111" ; // from the I32Store8
84
+ } > ;
85
+ memory : start1 [ 'memory' ] ;
86
+ garbageCollection : 1024 ;
87
+ } > >
88
+ type test3 = Expect < Equal < actual3 , expected3 > >
89
+
90
+ type actual4 = executeInstruction < actual3 , true , 4 >
91
+ type expected4 = Satisfies < ProgramState , s < blank , {
92
+ count : 4 ;
69
93
memory : {
70
94
"00000000000000000000000000000000" : "00101110" ; // source and update match
71
95
//"00000000000000000000000000000001": "11111111"; // the update cleared this value
72
96
"00000000000000000000000000000100" : "01010101" ; // newly added by the update
73
97
"00000000000000000000000000000111" : "00000010" ; // modified by the update
74
98
"11111111111111111111111100000011" : "00000001" ; // the random other data only present in the source
99
+ "10000000000000000000000000000000" : "00001111" ; // from the I32Store8
75
100
}
76
101
garbageCollection : 0 ;
77
102
} > >
78
- type test1025 = Expect < Equal < actual1025 , expected1025 > >
103
+ type test4 = Expect < Equal < actual4 , expected4 > >
0 commit comments