Skip to content

Commit d3fca0a

Browse files
erik-kroghasgerf
andauthored
Apply suggestions from code review
Co-authored-by: Asger F <[email protected]>
1 parent 25ef3ed commit d3fca0a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

javascript/ql/src/semmle/javascript/ExtendedStaging.qll

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
/**
22
* INTERNAL: Do not use.
33
*
4-
* The purpose of this file is to reduce the number of stages computed by the runtime,
5-
* thereby speeding up the evaluation without affecting any results.
4+
* The purpose of this file is to control which cached predicates belong to the same stage.
65
*
7-
* Computing less stages can improve performance as each stages is less likely to recompute non-cached predicates.
6+
* Combining stages can improve performance as we are more likely to reuse shared, non-cached predicates.
87
*
98
* A number of stages are grouped into an extended stage.
109
* An extended stage contains a number of substages - corrosponding to to how the stages would be grouped if this file didn't exist.
1110
* Each extended stage is identified by a `cached module` in the `ExtendedStaging` module.
1211
*
13-
* The number of stages are reduced by using how the compiler groups predicates into stages.
14-
* The compiler will group mutually recursive cached predicates, or cached predicates within the same `cached module`, into the same stage.
15-
* This file uses the latter by creating a `cached module` with two predicates for each extended stage.
16-
* The first predicate is referenced from all the `cached` predicates we want in the same extended stage,
17-
* and the second predicate has references to all the `cached` predicates we want in the same extended stage.
12+
* To make a predicate `p` belong to a stage `A`:
13+
* - make `p` depend on `A::ref()`, and
14+
* - make `A::backref()` depend on `p`.
15+
*
16+
* Since `A` is a cached module, `ref` and `backref` must be in the same stage, and the dependency
17+
* chain above thus forces `p` to be in that stage as well.
1818
*
1919
* With these two predicates in a `cached module` we ensure that all substages will be in a single stage at runtime.
2020
*

0 commit comments

Comments
 (0)