Java: Drop caching of deprecated predicates.

This commit is contained in:
Anders Schack-Mulligen
2025-10-27 12:50:11 +01:00
parent 5849d85f1f
commit 95ac61df42

View File

@@ -244,6 +244,53 @@ final class UncertainWriteDefinition = Impl::UncertainWriteDefinition;
final class PhiNode = Impl::PhiNode; final class PhiNode = Impl::PhiNode;
predicate ssaExplicitUpdate(SsaUpdate def, VariableUpdate upd) {
exists(SsaSourceVariable v, BasicBlock bb, int i |
def.definesAt(v, bb, i) and
certainVariableUpdate(v, upd.getControlFlowNode(), bb, i) and
getDestVar(upd) = def.getSourceVariable()
)
}
deprecated predicate ssaUncertainImplicitUpdate(SsaImplicitUpdate def) {
exists(SsaSourceVariable v, BasicBlock bb, int i |
def.definesAt(v, bb, i) and
uncertainVariableUpdate(v, _, bb, i)
)
}
predicate ssaImplicitInit(WriteDefinition def) {
exists(SsaSourceVariable v, BasicBlock bb, int i |
def.definesAt(v, bb, i) and
hasEntryDef(v, bb) and
i = -1
)
}
/**
* Holds if the SSA definition of `v` at `def` reaches `redef` without crossing another
* SSA definition of `v`.
*/
deprecated predicate ssaDefReachesUncertainDef(TrackedSsaDef def, SsaUncertainImplicitUpdate redef) {
Impl::uncertainWriteDefinitionInput(redef, def)
}
VarRead getAUse(Definition def) {
exists(SsaSourceVariable v, BasicBlock bb, int i |
Impl::ssaDefReachesRead(v, def, bb, i) and
result.getControlFlowNode() = bb.getNode(i) and
result = v.getAnAccess()
)
}
predicate ssaDefReachesEndOfBlock(BasicBlock bb, Definition def) {
Impl::ssaDefReachesEndOfBlock(bb, def, _)
}
deprecated predicate phiHasInputFromBlock(PhiNode phi, Definition inp, BasicBlock bb) {
Impl::phiHasInputFromBlock(phi, inp, bb)
}
cached cached
private module Cached { private module Cached {
/** Gets the destination variable of an update of a tracked variable. */ /** Gets the destination variable of an update of a tracked variable. */
@@ -258,15 +305,6 @@ private module Cached {
result.getAnAccess() = upd.(UnaryAssignExpr).getExpr() result.getAnAccess() = upd.(UnaryAssignExpr).getExpr()
} }
cached
predicate ssaExplicitUpdate(SsaUpdate def, VariableUpdate upd) {
exists(SsaSourceVariable v, BasicBlock bb, int i |
def.definesAt(v, bb, i) and
certainVariableUpdate(v, upd.getControlFlowNode(), bb, i) and
getDestVar(upd) = def.getSourceVariable()
)
}
/* /*
* The SSA construction for a field `f` relies on implicit update nodes at * The SSA construction for a field `f` relies on implicit update nodes at
* every call site that conceivably could reach an update of the field. * every call site that conceivably could reach an update of the field.
@@ -486,26 +524,9 @@ private module Cached {
overlay[global] overlay[global]
cached cached
predicate defUpdatesNamedField(SsaImplicitWrite def, TrackedField f, Callable setter) { predicate defUpdatesNamedField(SsaImplicitWrite calldef, TrackedField f, Callable setter) {
f = def.getSourceVariable() and f = calldef.getSourceVariable() and
updatesNamedField0(def.getControlFlowNode().asCall(), f, setter) updatesNamedField0(calldef.getControlFlowNode().asCall(), f, setter)
}
cached
deprecated predicate ssaUncertainImplicitUpdate(SsaImplicitUpdate def) {
exists(SsaSourceVariable v, BasicBlock bb, int i |
def.definesAt(v, bb, i) and
uncertainVariableUpdate(v, _, bb, i)
)
}
cached
predicate ssaImplicitInit(WriteDefinition def) {
exists(SsaSourceVariable v, BasicBlock bb, int i |
def.definesAt(v, bb, i) and
hasEntryDef(v, bb) and
i = -1
)
} }
/** Holds if `init` is a closure variable that captures the value of `capturedvar`. */ /** Holds if `init` is a closure variable that captures the value of `capturedvar`. */
@@ -517,15 +538,6 @@ private module Cached {
) )
} }
/**
* Holds if the SSA definition of `v` at `def` reaches `redef` without crossing another
* SSA definition of `v`.
*/
cached
deprecated predicate ssaDefReachesUncertainDef(TrackedSsaDef def, SsaUncertainImplicitUpdate redef) {
Impl::uncertainWriteDefinitionInput(redef, def)
}
/** /**
* Holds if the value defined at `def` can reach `use` without passing through * Holds if the value defined at `def` can reach `use` without passing through
* any other uses, but possibly through phi nodes and uncertain implicit updates. * any other uses, but possibly through phi nodes and uncertain implicit updates.
@@ -538,25 +550,6 @@ private module Cached {
) )
} }
cached
VarRead getAUse(Definition def) {
exists(SsaSourceVariable v, BasicBlock bb, int i |
Impl::ssaDefReachesRead(v, def, bb, i) and
result.getControlFlowNode() = bb.getNode(i) and
result = v.getAnAccess()
)
}
cached
predicate ssaDefReachesEndOfBlock(BasicBlock bb, Definition def) {
Impl::ssaDefReachesEndOfBlock(bb, def, _)
}
cached
predicate phiHasInputFromBlock(PhiNode phi, Definition inp, BasicBlock bb) {
Impl::phiHasInputFromBlock(phi, inp, bb)
}
cached cached
module DataFlowIntegration { module DataFlowIntegration {
import DataFlowIntegrationImpl import DataFlowIntegrationImpl
@@ -666,7 +659,7 @@ private module DataFlowIntegrationInput implements Impl::DataFlowIntegrationInpu
} }
} }
Expr getARead(Definition def) { result = getAUse(def) } Expr getARead(Definition def) { result = def.(SsaDefinition).getARead() }
predicate ssaDefHasSource(WriteDefinition def) { def instanceof SsaExplicitWrite } predicate ssaDefHasSource(WriteDefinition def) { def instanceof SsaExplicitWrite }