Merge pull request #10904 from aschackmull/java/joinorders

Java: Fix some join-orders.
This commit is contained in:
Anders Schack-Mulligen
2022-11-04 09:24:31 +01:00
committed by GitHub
12 changed files with 14 additions and 0 deletions

View File

@@ -400,6 +400,7 @@ private module ControlFlowGraphImpl {
/** /**
* Gets a statement that always throws an exception or calls `exit`. * Gets a statement that always throws an exception or calls `exit`.
*/ */
pragma[assume_small_delta]
private Stmt nonReturningStmt() { private Stmt nonReturningStmt() {
result instanceof ThrowStmt result instanceof ThrowStmt
or or
@@ -421,6 +422,7 @@ private module ControlFlowGraphImpl {
/** /**
* Gets an expression that always throws an exception or calls `exit`. * Gets an expression that always throws an exception or calls `exit`.
*/ */
pragma[assume_small_delta]
private Expr nonReturningExpr() { private Expr nonReturningExpr() {
result = nonReturningMethodAccess() result = nonReturningMethodAccess()
or or

View File

@@ -2026,6 +2026,7 @@ class TypeAccess extends Expr, Annotatable, @typeaccess {
override CompilationUnit getCompilationUnit() { result = Expr.super.getCompilationUnit() } override CompilationUnit getCompilationUnit() { result = Expr.super.getCompilationUnit() }
/** Gets a printable representation of this expression. */ /** Gets a printable representation of this expression. */
pragma[assume_small_delta]
override string toString() { override string toString() {
result = this.getQualifier().toString() + "." + this.getType().toString() result = this.getQualifier().toString() + "." + this.getType().toString()
or or

View File

@@ -682,6 +682,7 @@ class FieldDeclaration extends ExprParent, @fielddecl, Annotatable {
/** Gets the number of fields declared in this declaration. */ /** Gets the number of fields declared in this declaration. */
int getNumField() { result = max(int idx | fieldDeclaredIn(_, this, idx) | idx) + 1 } int getNumField() { result = max(int idx | fieldDeclaredIn(_, this, idx) | idx) + 1 }
pragma[assume_small_delta]
override string toString() { override string toString() {
if this.getNumField() = 1 if this.getNumField() = 1
then result = this.getTypeAccess() + " " + this.getField(0) + ";" then result = this.getTypeAccess() + " " + this.getField(0) + ";"

View File

@@ -304,6 +304,7 @@ private predicate hasSubtypeStar1(RefType t, RefType sub) {
/** /**
* Holds if `hasSubtype*(t, sub)`, but manual-magic'ed with `getAWildcardLowerBound(sub)`. * Holds if `hasSubtype*(t, sub)`, but manual-magic'ed with `getAWildcardLowerBound(sub)`.
*/ */
pragma[assume_small_delta]
pragma[nomagic] pragma[nomagic]
private predicate hasSubtypeStar2(RefType t, RefType sub) { private predicate hasSubtypeStar2(RefType t, RefType sub) {
sub = t and getAWildcardLowerBound(sub) sub = t and getAWildcardLowerBound(sub)

View File

@@ -42,6 +42,7 @@ EqualityTest varEqualityTestExpr(SsaVariable v1, SsaVariable v2, boolean isEqual
} }
/** Gets an expression that is provably not `null`. */ /** Gets an expression that is provably not `null`. */
pragma[assume_small_delta]
Expr clearlyNotNullExpr(Expr reason) { Expr clearlyNotNullExpr(Expr reason) {
result instanceof ClassInstanceExpr and reason = result result instanceof ClassInstanceExpr and reason = result
or or
@@ -236,6 +237,7 @@ Expr directNullGuard(SsaVariable v, boolean branch, boolean isnull) {
* If `result` evaluates to `branch`, then `v` is guaranteed to be null if `isnull` * If `result` evaluates to `branch`, then `v` is guaranteed to be null if `isnull`
* is true, and non-null if `isnull` is false. * is true, and non-null if `isnull` is false.
*/ */
pragma[assume_small_delta]
Guard nullGuard(SsaVariable v, boolean branch, boolean isnull) { Guard nullGuard(SsaVariable v, boolean branch, boolean isnull) {
result = directNullGuard(v, branch, isnull) or result = directNullGuard(v, branch, isnull) or
exists(boolean branch0 | implies_v3(result, branch, nullGuard(v, branch0, isnull), branch0)) exists(boolean branch0 | implies_v3(result, branch, nullGuard(v, branch0, isnull), branch0))

View File

@@ -61,6 +61,7 @@ class SsaSourceVariable extends TSsaSourceVariable {
* accessed from nested callables are therefore associated with several * accessed from nested callables are therefore associated with several
* `SsaSourceVariable`s. * `SsaSourceVariable`s.
*/ */
pragma[assume_small_delta]
cached cached
VarAccess getAnAccess() { VarAccess getAnAccess() {
exists(LocalScopeVariable v, Callable c | exists(LocalScopeVariable v, Callable c |

View File

@@ -313,6 +313,7 @@ private module ForAll<RankedEdge Edge, TypePropagation T> {
* Holds if `t` is a candidate bound for `n` that is also valid for data coming * Holds if `t` is a candidate bound for `n` that is also valid for data coming
* through the edges into `n` ranked from `1` to `r`. * through the edges into `n` ranked from `1` to `r`.
*/ */
pragma[assume_small_delta]
private predicate flowJoin(int r, TypeFlowNode n, T::Typ t) { private predicate flowJoin(int r, TypeFlowNode n, T::Typ t) {
( (
r = 1 and candJoinType(n, t) r = 1 and candJoinType(n, t)

View File

@@ -615,6 +615,7 @@ private MethodAccess callReturningSameType(Expr ref) {
result.getMethod().getReturnType() = ref.getType() result.getMethod().getReturnType() = ref.getType()
} }
pragma[assume_small_delta]
private SrcRefType entrypointType() { private SrcRefType entrypointType() {
exists(RemoteFlowSource s, RefType t | exists(RemoteFlowSource s, RefType t |
s instanceof DataFlow::ExplicitParameterNode and s instanceof DataFlow::ExplicitParameterNode and

View File

@@ -29,6 +29,7 @@ private Callable dispatchCand(Call c) {
/** /**
* Holds if `t` and all its enclosing types are public. * Holds if `t` and all its enclosing types are public.
*/ */
pragma[assume_small_delta]
private predicate veryPublic(RefType t) { private predicate veryPublic(RefType t) {
t.isPublic() and t.isPublic() and
( (

View File

@@ -206,6 +206,7 @@ private predicate relevantNodeBack(ObjNode n) {
exists(ObjNode mid | objStep(n, mid) and relevantNodeBack(mid)) exists(ObjNode mid | objStep(n, mid) and relevantNodeBack(mid))
} }
pragma[assume_small_delta]
private predicate relevantNode(ObjNode n) { private predicate relevantNode(ObjNode n) {
source(_, n) and relevantNodeBack(n) source(_, n) and relevantNodeBack(n)
or or

View File

@@ -11,6 +11,7 @@ class RemoteCallableMethod extends Method {
RemoteCallableMethod() { remoteCallableMethod(this) } RemoteCallableMethod() { remoteCallableMethod(this) }
} }
pragma[assume_small_delta]
private predicate remoteCallableMethod(Method method) { private predicate remoteCallableMethod(Method method) {
method.getDeclaringType().getASupertype() instanceof TypeRemote method.getDeclaringType().getASupertype() instanceof TypeRemote
or or

View File

@@ -152,6 +152,7 @@ class JacksonSerializableField extends SerializableField {
/** A field that may be deserialized using the Jackson JSON framework. */ /** A field that may be deserialized using the Jackson JSON framework. */
class JacksonDeserializableField extends DeserializableField { class JacksonDeserializableField extends DeserializableField {
pragma[assume_small_delta]
JacksonDeserializableField() { JacksonDeserializableField() {
exists(JacksonDeserializableType superType | exists(JacksonDeserializableType superType |
superType = this.getDeclaringType().getAnAncestor() and superType = this.getDeclaringType().getAnAncestor() and