mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 09:29:38 +01:00
8317818: Combinatorial explosion during 'this' escape analysis
Backport-of: 17535c34bc
This commit is contained in:
committed by
Vitaly Provodin
parent
8f07717a0d
commit
ad721336d6
@@ -167,7 +167,7 @@ class ThisEscapeAnalyzer extends TreeScanner {
|
||||
|
||||
/** Used to terminate recursion in {@link #invokeInvokable invokeInvokable()}.
|
||||
*/
|
||||
private final Set<Pair<JCTree, RefSet<Ref>>> invocations = new HashSet<>();
|
||||
private final Set<Pair<JCMethodDecl, RefSet<Ref>>> invocations = new HashSet<>();
|
||||
|
||||
/** Snapshot of {@link #callStack} where a possible 'this' escape occurs.
|
||||
* If non-null, a 'this' escape warning has been found in the current
|
||||
@@ -590,7 +590,7 @@ class ThisEscapeAnalyzer extends TreeScanner {
|
||||
return;
|
||||
|
||||
// Stop infinite recursion here
|
||||
Pair<JCTree, RefSet<Ref>> invocation = Pair.of(site, refs.clone());
|
||||
Pair<JCMethodDecl, RefSet<Ref>> invocation = Pair.of(methodInfo.declaration, refs.clone());
|
||||
if (!invocations.add(invocation))
|
||||
return;
|
||||
|
||||
|
||||
@@ -617,4 +617,34 @@ public class ThisEscape {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
// Verify no infinite recursion loop occurs (JDK-8317818)
|
||||
public static class ThisEscapeRecursionExplosion {
|
||||
private Object obj;
|
||||
public ThisEscapeRecursionExplosion() {
|
||||
getObject();
|
||||
}
|
||||
private Object getObject() {
|
||||
if (this.obj == null) {
|
||||
this.obj = new Object();
|
||||
getObject().hashCode();
|
||||
getObject().hashCode();
|
||||
getObject().hashCode();
|
||||
getObject().hashCode();
|
||||
getObject().hashCode();
|
||||
getObject().hashCode();
|
||||
getObject().hashCode();
|
||||
getObject().hashCode();
|
||||
getObject().hashCode();
|
||||
getObject().hashCode();
|
||||
getObject().hashCode();
|
||||
getObject().hashCode();
|
||||
getObject().hashCode();
|
||||
getObject().hashCode();
|
||||
getObject().hashCode();
|
||||
getObject().hashCode();
|
||||
}
|
||||
return this.obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user