Skip to content

Commit 44c19e5

Browse files
committed
Fix all use of HostedUniverse.createDeoptTarget
1 parent ca67706 commit 44c19e5

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/CompileQueue.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import java.util.concurrent.ConcurrentHashMap;
4242
import java.util.concurrent.ConcurrentMap;
4343
import java.util.concurrent.ForkJoinPool;
44+
import java.util.stream.Collectors;
4445

4546
import com.oracle.graal.pointsto.api.PointstoOptions;
4647
import com.oracle.svm.hosted.phases.StrengthenStampsPhase;
@@ -634,18 +635,20 @@ private void parseDeoptimizationTargetMethods() {
634635
* Deoptimization target code for all methods that were manually marked as deoptimization
635636
* targets.
636637
*/
637-
universe.getMethods().stream()
638+
List<HostedMethod> deoptTargetMethods = universe.getMethods().stream()
638639
.filter(method -> CompilationInfoSupport.singleton().isDeoptTarget(method))
639-
.forEach(method -> ensureParsed(universe.createDeoptTarget(method), null, new EntryPointReason()));
640+
.collect(Collectors.toList());
641+
deoptTargetMethods.forEach(method -> ensureParsed(universe.createDeoptTarget(method), null, new EntryPointReason()));
640642

641643
/*
642644
* Deoptimization target code for deoptimization testing: all methods that are not
643645
* blacklisted are possible deoptimization targets. The methods are also flagged so that all
644646
* possible deoptimization entry points are emitted.
645647
*/
646-
universe.getMethods().stream()
648+
List<HostedMethod> deoptTargetForTestingMethods = universe.getMethods().stream()
647649
.filter(method -> method.getWrapped().isImplementationInvoked() && canDeoptForTesting(method))
648-
.forEach(this::ensureParsedForDeoptTesting);
650+
.collect(Collectors.toList());
651+
deoptTargetForTestingMethods.forEach(this::ensureParsedForDeoptTesting);
649652

650653
}
651654

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/meta/HostedUniverse.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -311,14 +311,15 @@ public HostedInstanceClass getObjectClass() {
311311
return result;
312312
}
313313

314-
public synchronized HostedMethod createDeoptTarget(HostedMethod method) {
315-
if (method.compilationInfo.getDeoptTargetMethod() == null) {
316-
HostedMethod deoptTarget = HostedMethod.create(this, method.getWrapped(), method.getDeclaringClass(),
317-
method.getSignature(), method.getConstantPool(), method.getExceptionHandlers(), method);
318-
assert method.staticAnalysisResults != null;
319-
deoptTarget.staticAnalysisResults = method.staticAnalysisResults;
314+
public synchronized HostedMethod createDeoptTarget(HostedMethod deoptOrigin) {
315+
assert !deoptOrigin.isDeoptTarget();
316+
if (deoptOrigin.compilationInfo.getDeoptTargetMethod() == null) {
317+
HostedMethod deoptTarget = HostedMethod.create(this, deoptOrigin.getWrapped(), deoptOrigin.getDeclaringClass(),
318+
deoptOrigin.getSignature(), deoptOrigin.getConstantPool(), deoptOrigin.getExceptionHandlers(), deoptOrigin);
319+
assert deoptOrigin.staticAnalysisResults != null;
320+
deoptTarget.staticAnalysisResults = deoptOrigin.staticAnalysisResults;
320321
}
321-
return method.compilationInfo.getDeoptTargetMethod();
322+
return deoptOrigin.compilationInfo.getDeoptTargetMethod();
322323
}
323324

324325
public boolean contains(JavaType type) {

0 commit comments

Comments
 (0)