Skip to content

Commit f74c38f

Browse files
Temporary fix to speed up canAvoidInstr (#1699)
* check if env instruction is necessary * Add test cases * Implement helper functions * Fix format * Cache isEnvDependent results * Delete unnecessary comments * Speed up env dependent checking, approach 2 * merge * Address my comments --------- Co-authored-by: Richard Dominick <34370238+RichDom2185@users.noreply.github.com>
1 parent adb44c8 commit f74c38f

File tree

7 files changed

+221
-27
lines changed

7 files changed

+221
-27
lines changed

src/cse-machine/__tests__/__snapshots__/cse-machine-heap.ts.snap

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ EnvTree {
162162
],
163163
"callee": Node {
164164
"end": 90,
165+
"isEnvDependent": true,
165166
"loc": SourceLocation {
166167
"end": Position {
167168
"column": 1,
@@ -177,6 +178,7 @@ EnvTree {
177178
"type": "Identifier",
178179
},
179180
"end": 101,
181+
"isEnvDependent": true,
180182
"loc": SourceLocation {
181183
"end": Position {
182184
"column": 12,
@@ -783,6 +785,7 @@ EnvTree {
783785
],
784786
"callee": Node {
785787
"end": 90,
788+
"isEnvDependent": true,
786789
"loc": SourceLocation {
787790
"end": Position {
788791
"column": 1,
@@ -798,6 +801,7 @@ EnvTree {
798801
"type": "Identifier",
799802
},
800803
"end": 101,
804+
"isEnvDependent": true,
801805
"loc": SourceLocation {
802806
"end": Position {
803807
"column": 12,
@@ -1428,6 +1432,7 @@ EnvTree {
14281432
],
14291433
"callee": Node {
14301434
"end": 90,
1435+
"isEnvDependent": true,
14311436
"loc": SourceLocation {
14321437
"end": Position {
14331438
"column": 1,
@@ -1443,6 +1448,7 @@ EnvTree {
14431448
"type": "Identifier",
14441449
},
14451450
"end": 101,
1451+
"isEnvDependent": true,
14461452
"loc": SourceLocation {
14471453
"end": Position {
14481454
"column": 12,
@@ -2094,6 +2100,7 @@ EnvTree {
20942100
],
20952101
"callee": Node {
20962102
"end": 90,
2103+
"isEnvDependent": true,
20972104
"loc": SourceLocation {
20982105
"end": Position {
20992106
"column": 1,
@@ -2109,6 +2116,7 @@ EnvTree {
21092116
"type": "Identifier",
21102117
},
21112118
"end": 101,
2119+
"isEnvDependent": true,
21122120
"loc": SourceLocation {
21132121
"end": Position {
21142122
"column": 12,
@@ -2485,6 +2493,7 @@ EnvTree {
24852493
],
24862494
"callee": Node {
24872495
"end": 90,
2496+
"isEnvDependent": true,
24882497
"loc": SourceLocation {
24892498
"end": Position {
24902499
"column": 1,
@@ -2500,6 +2509,7 @@ EnvTree {
25002509
"type": "Identifier",
25012510
},
25022511
"end": 101,
2512+
"isEnvDependent": true,
25032513
"loc": SourceLocation {
25042514
"end": Position {
25052515
"column": 12,
@@ -2663,6 +2673,7 @@ EnvTree {
26632673
],
26642674
"callee": Node {
26652675
"end": 90,
2676+
"isEnvDependent": true,
26662677
"loc": SourceLocation {
26672678
"end": Position {
26682679
"column": 1,
@@ -2678,6 +2689,7 @@ EnvTree {
26782689
"type": "Identifier",
26792690
},
26802691
"end": 101,
2692+
"isEnvDependent": true,
26812693
"loc": SourceLocation {
26822694
"end": Position {
26832695
"column": 12,
@@ -5600,6 +5612,7 @@ EnvTree {
56005612
],
56015613
"callee": Node {
56025614
"end": 24,
5615+
"isEnvDependent": true,
56035616
"loc": SourceLocation {
56045617
"end": Position {
56055618
"column": 1,
@@ -5615,6 +5628,7 @@ EnvTree {
56155628
"type": "Identifier",
56165629
},
56175630
"end": 33,
5631+
"isEnvDependent": true,
56185632
"loc": SourceLocation {
56195633
"end": Position {
56205634
"column": 10,
@@ -6058,6 +6072,7 @@ EnvTree {
60586072
],
60596073
"callee": Node {
60606074
"end": 24,
6075+
"isEnvDependent": true,
60616076
"loc": SourceLocation {
60626077
"end": Position {
60636078
"column": 1,
@@ -6073,6 +6088,7 @@ EnvTree {
60736088
"type": "Identifier",
60746089
},
60756090
"end": 33,
6091+
"isEnvDependent": true,
60766092
"loc": SourceLocation {
60776093
"end": Position {
60786094
"column": 10,
@@ -6525,6 +6541,7 @@ EnvTree {
65256541
],
65266542
"callee": Node {
65276543
"end": 24,
6544+
"isEnvDependent": true,
65286545
"loc": SourceLocation {
65296546
"end": Position {
65306547
"column": 1,
@@ -6540,6 +6557,7 @@ EnvTree {
65406557
"type": "Identifier",
65416558
},
65426559
"end": 33,
6560+
"isEnvDependent": true,
65436561
"loc": SourceLocation {
65446562
"end": Position {
65456563
"column": 10,
@@ -6891,6 +6909,7 @@ EnvTree {
68916909
],
68926910
"callee": Node {
68936911
"end": 24,
6912+
"isEnvDependent": true,
68946913
"loc": SourceLocation {
68956914
"end": Position {
68966915
"column": 1,
@@ -6906,6 +6925,7 @@ EnvTree {
69066925
"type": "Identifier",
69076926
},
69086927
"end": 33,
6928+
"isEnvDependent": true,
69096929
"loc": SourceLocation {
69106930
"end": Position {
69116931
"column": 10,
@@ -7060,6 +7080,7 @@ EnvTree {
70607080
],
70617081
"callee": Node {
70627082
"end": 24,
7083+
"isEnvDependent": true,
70637084
"loc": SourceLocation {
70647085
"end": Position {
70657086
"column": 1,
@@ -7075,6 +7096,7 @@ EnvTree {
70757096
"type": "Identifier",
70767097
},
70777098
"end": 33,
7099+
"isEnvDependent": true,
70787100
"loc": SourceLocation {
70797101
"end": Position {
70807102
"column": 10,
@@ -7431,6 +7453,7 @@ EnvTree {
74317453
},
74327454
],
74337455
"callee": Object {
7456+
"isEnvDependent": false,
74347457
"loc": SourceLocation {
74357458
"end": Position {
74367459
"column": 1,
@@ -7444,6 +7467,7 @@ EnvTree {
74447467
"type": "Literal",
74457468
"value": [Function],
74467469
},
7470+
"isEnvDependent": true,
74477471
"loc": undefined,
74487472
"optional": false,
74497473
"type": "CallExpression",
@@ -8275,6 +8299,7 @@ EnvTree {
82758299
},
82768300
],
82778301
"callee": Object {
8302+
"isEnvDependent": false,
82788303
"loc": SourceLocation {
82798304
"end": Position {
82808305
"column": 1,
@@ -8288,6 +8313,7 @@ EnvTree {
82888313
"type": "Literal",
82898314
"value": [Function],
82908315
},
8316+
"isEnvDependent": true,
82918317
"loc": undefined,
82928318
"optional": false,
82938319
"type": "CallExpression",
@@ -9218,6 +9244,7 @@ EnvTree {
92189244
},
92199245
],
92209246
"callee": Object {
9247+
"isEnvDependent": false,
92219248
"loc": SourceLocation {
92229249
"end": Position {
92239250
"column": 1,
@@ -9231,6 +9258,7 @@ EnvTree {
92319258
"type": "Literal",
92329259
"value": [Function],
92339260
},
9261+
"isEnvDependent": true,
92349262
"loc": undefined,
92359263
"optional": false,
92369264
"type": "CallExpression",
@@ -10180,6 +10208,7 @@ EnvTree {
1018010208
},
1018110209
],
1018210210
"callee": Object {
10211+
"isEnvDependent": false,
1018310212
"loc": SourceLocation {
1018410213
"end": Position {
1018510214
"column": 1,
@@ -10193,6 +10222,7 @@ EnvTree {
1019310222
"type": "Literal",
1019410223
"value": [Function],
1019510224
},
10225+
"isEnvDependent": true,
1019610226
"loc": undefined,
1019710227
"optional": false,
1019810228
"type": "CallExpression",
@@ -10932,6 +10962,7 @@ EnvTree {
1093210962
},
1093310963
],
1093410964
"callee": Object {
10965+
"isEnvDependent": false,
1093510966
"loc": SourceLocation {
1093610967
"end": Position {
1093710968
"column": 1,
@@ -10945,6 +10976,7 @@ EnvTree {
1094510976
"type": "Literal",
1094610977
"value": [Function],
1094710978
},
10979+
"isEnvDependent": true,
1094810980
"loc": undefined,
1094910981
"optional": false,
1095010982
"type": "CallExpression",
@@ -11183,6 +11215,7 @@ EnvTree {
1118311215
},
1118411216
],
1118511217
"callee": Object {
11218+
"isEnvDependent": false,
1118611219
"loc": SourceLocation {
1118711220
"end": Position {
1118811221
"column": 1,
@@ -11196,6 +11229,7 @@ EnvTree {
1119611229
"type": "Literal",
1119711230
"value": [Function],
1119811231
},
11232+
"isEnvDependent": true,
1119911233
"loc": undefined,
1120011234
"optional": false,
1120111235
"type": "CallExpression",

0 commit comments

Comments
 (0)