Skip to content

Commit 87a1133

Browse files
committed
UnboundList: Cache encode
1 parent b0bbca9 commit 87a1133

3 files changed

Lines changed: 6 additions & 1 deletion

File tree

‎rust/ql/lib/codeql/rust/internal/typeinference/DerefChain.qll‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ private module UnboundListInput implements UnboundListImpl::InputSig<Location> {
6060

6161
class Element = DerefImplItemNode;
6262

63-
int getId(Element e) { idOfRaw(Synth::convertAstNodeToRaw(e), result) }
63+
int getId(Element e) {
64+
CachedStage::ref() and
65+
idOfRaw(Synth::convertAstNodeToRaw(e), result)
66+
}
6467

6568
string getElementString(Element e) { result = e.resolveSelfTy().getName() }
6669

‎rust/ql/lib/codeql/rust/internal/typeinference/TypeInference.qll‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ private module Input1 implements InputSig1<Location> {
3636
class TypeAbstraction = TA::TypeAbstraction;
3737

3838
int getTypeParameterId(TypeParameter tp) {
39+
CachedStage::ref() and
3940
tp =
4041
rank[result](TypeParameter tp0, int kind, int id1, int id2 |
4142
kind = 1 and

‎shared/util/codeql/util/UnboundList.qll‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ module Make<LocationSig Location, InputSig<Location> Input> {
5252
/** Gets the rank of element `e`, which is used internally in the string encoding. */
5353
int getRank(Element e) { e = DenseRank<DenseRankInput>::denseRank(result) }
5454

55+
cached
5556
private string encode(Element e) { result = getRank(e).toString() }
5657

5758
bindingset[s]

0 commit comments

Comments
 (0)