Skip to content

Commit

Permalink
Temporary fix to speed up canAvoidInstr (#1699)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
DiligentPenguinn and RichDom2185 authored Apr 29, 2024
1 parent adb44c8 commit f74c38f
Show file tree
Hide file tree
Showing 7 changed files with 221 additions and 27 deletions.
34 changes: 34 additions & 0 deletions src/cse-machine/__tests__/__snapshots__/cse-machine-heap.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ EnvTree {
],
"callee": Node {
"end": 90,
"isEnvDependent": true,
"loc": SourceLocation {
"end": Position {
"column": 1,
Expand All @@ -177,6 +178,7 @@ EnvTree {
"type": "Identifier",
},
"end": 101,
"isEnvDependent": true,
"loc": SourceLocation {
"end": Position {
"column": 12,
Expand Down Expand Up @@ -783,6 +785,7 @@ EnvTree {
],
"callee": Node {
"end": 90,
"isEnvDependent": true,
"loc": SourceLocation {
"end": Position {
"column": 1,
Expand All @@ -798,6 +801,7 @@ EnvTree {
"type": "Identifier",
},
"end": 101,
"isEnvDependent": true,
"loc": SourceLocation {
"end": Position {
"column": 12,
Expand Down Expand Up @@ -1428,6 +1432,7 @@ EnvTree {
],
"callee": Node {
"end": 90,
"isEnvDependent": true,
"loc": SourceLocation {
"end": Position {
"column": 1,
Expand All @@ -1443,6 +1448,7 @@ EnvTree {
"type": "Identifier",
},
"end": 101,
"isEnvDependent": true,
"loc": SourceLocation {
"end": Position {
"column": 12,
Expand Down Expand Up @@ -2094,6 +2100,7 @@ EnvTree {
],
"callee": Node {
"end": 90,
"isEnvDependent": true,
"loc": SourceLocation {
"end": Position {
"column": 1,
Expand All @@ -2109,6 +2116,7 @@ EnvTree {
"type": "Identifier",
},
"end": 101,
"isEnvDependent": true,
"loc": SourceLocation {
"end": Position {
"column": 12,
Expand Down Expand Up @@ -2485,6 +2493,7 @@ EnvTree {
],
"callee": Node {
"end": 90,
"isEnvDependent": true,
"loc": SourceLocation {
"end": Position {
"column": 1,
Expand All @@ -2500,6 +2509,7 @@ EnvTree {
"type": "Identifier",
},
"end": 101,
"isEnvDependent": true,
"loc": SourceLocation {
"end": Position {
"column": 12,
Expand Down Expand Up @@ -2663,6 +2673,7 @@ EnvTree {
],
"callee": Node {
"end": 90,
"isEnvDependent": true,
"loc": SourceLocation {
"end": Position {
"column": 1,
Expand All @@ -2678,6 +2689,7 @@ EnvTree {
"type": "Identifier",
},
"end": 101,
"isEnvDependent": true,
"loc": SourceLocation {
"end": Position {
"column": 12,
Expand Down Expand Up @@ -5600,6 +5612,7 @@ EnvTree {
],
"callee": Node {
"end": 24,
"isEnvDependent": true,
"loc": SourceLocation {
"end": Position {
"column": 1,
Expand All @@ -5615,6 +5628,7 @@ EnvTree {
"type": "Identifier",
},
"end": 33,
"isEnvDependent": true,
"loc": SourceLocation {
"end": Position {
"column": 10,
Expand Down Expand Up @@ -6058,6 +6072,7 @@ EnvTree {
],
"callee": Node {
"end": 24,
"isEnvDependent": true,
"loc": SourceLocation {
"end": Position {
"column": 1,
Expand All @@ -6073,6 +6088,7 @@ EnvTree {
"type": "Identifier",
},
"end": 33,
"isEnvDependent": true,
"loc": SourceLocation {
"end": Position {
"column": 10,
Expand Down Expand Up @@ -6525,6 +6541,7 @@ EnvTree {
],
"callee": Node {
"end": 24,
"isEnvDependent": true,
"loc": SourceLocation {
"end": Position {
"column": 1,
Expand All @@ -6540,6 +6557,7 @@ EnvTree {
"type": "Identifier",
},
"end": 33,
"isEnvDependent": true,
"loc": SourceLocation {
"end": Position {
"column": 10,
Expand Down Expand Up @@ -6891,6 +6909,7 @@ EnvTree {
],
"callee": Node {
"end": 24,
"isEnvDependent": true,
"loc": SourceLocation {
"end": Position {
"column": 1,
Expand All @@ -6906,6 +6925,7 @@ EnvTree {
"type": "Identifier",
},
"end": 33,
"isEnvDependent": true,
"loc": SourceLocation {
"end": Position {
"column": 10,
Expand Down Expand Up @@ -7060,6 +7080,7 @@ EnvTree {
],
"callee": Node {
"end": 24,
"isEnvDependent": true,
"loc": SourceLocation {
"end": Position {
"column": 1,
Expand All @@ -7075,6 +7096,7 @@ EnvTree {
"type": "Identifier",
},
"end": 33,
"isEnvDependent": true,
"loc": SourceLocation {
"end": Position {
"column": 10,
Expand Down Expand Up @@ -7431,6 +7453,7 @@ EnvTree {
},
],
"callee": Object {
"isEnvDependent": false,
"loc": SourceLocation {
"end": Position {
"column": 1,
Expand All @@ -7444,6 +7467,7 @@ EnvTree {
"type": "Literal",
"value": [Function],
},
"isEnvDependent": true,
"loc": undefined,
"optional": false,
"type": "CallExpression",
Expand Down Expand Up @@ -8275,6 +8299,7 @@ EnvTree {
},
],
"callee": Object {
"isEnvDependent": false,
"loc": SourceLocation {
"end": Position {
"column": 1,
Expand All @@ -8288,6 +8313,7 @@ EnvTree {
"type": "Literal",
"value": [Function],
},
"isEnvDependent": true,
"loc": undefined,
"optional": false,
"type": "CallExpression",
Expand Down Expand Up @@ -9218,6 +9244,7 @@ EnvTree {
},
],
"callee": Object {
"isEnvDependent": false,
"loc": SourceLocation {
"end": Position {
"column": 1,
Expand All @@ -9231,6 +9258,7 @@ EnvTree {
"type": "Literal",
"value": [Function],
},
"isEnvDependent": true,
"loc": undefined,
"optional": false,
"type": "CallExpression",
Expand Down Expand Up @@ -10180,6 +10208,7 @@ EnvTree {
},
],
"callee": Object {
"isEnvDependent": false,
"loc": SourceLocation {
"end": Position {
"column": 1,
Expand All @@ -10193,6 +10222,7 @@ EnvTree {
"type": "Literal",
"value": [Function],
},
"isEnvDependent": true,
"loc": undefined,
"optional": false,
"type": "CallExpression",
Expand Down Expand Up @@ -10932,6 +10962,7 @@ EnvTree {
},
],
"callee": Object {
"isEnvDependent": false,
"loc": SourceLocation {
"end": Position {
"column": 1,
Expand All @@ -10945,6 +10976,7 @@ EnvTree {
"type": "Literal",
"value": [Function],
},
"isEnvDependent": true,
"loc": undefined,
"optional": false,
"type": "CallExpression",
Expand Down Expand Up @@ -11183,6 +11215,7 @@ EnvTree {
},
],
"callee": Object {
"isEnvDependent": false,
"loc": SourceLocation {
"end": Position {
"column": 1,
Expand All @@ -11196,6 +11229,7 @@ EnvTree {
"type": "Literal",
"value": [Function],
},
"isEnvDependent": true,
"loc": undefined,
"optional": false,
"type": "CallExpression",
Expand Down
Loading

0 comments on commit f74c38f

Please sign in to comment.