Skip to content

Commit 0d453fb

Browse files
committed
[GR-66722] [GR-66723] Open world analysis fixes.
PullRequest: graal/21323
2 parents 68afcd3 + 1d9b076 commit 0d453fb

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/results/StrengthenGraphs.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,8 @@ private void handleInvoke(Invoke invoke, SimplifierTool tool) {
739739
}
740740
}
741741

742-
if (allowOptimizeReturnParameter) {
742+
if (allowOptimizeReturnParameter && (isClosedTypeWorld || callTarget.invokeKind().isDirect() || targetMethod.canBeStaticallyBound())) {
743+
/* Can only optimize returned parameter when all possible callees are visible. */
743744
optimizeReturnedParameter(callees, arguments, node, tool);
744745
}
745746

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

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@
2626

2727
import com.oracle.graal.pointsto.meta.AnalysisType;
2828

29-
import jdk.vm.ci.meta.Assumptions.AssumptionResult;
3029
import jdk.vm.ci.meta.JavaKind;
3130
import jdk.vm.ci.meta.ResolvedJavaField;
32-
import jdk.vm.ci.meta.ResolvedJavaMethod;
3331

3432
public class HostedInstanceClass extends HostedClass {
3533

@@ -141,16 +139,4 @@ public void setIdentityHashOffset(int offset) {
141139
assert offset >= 0;
142140
this.identityHashOffset = offset;
143141
}
144-
145-
@Override
146-
public AssumptionResult<ResolvedJavaMethod> findUniqueConcreteMethod(ResolvedJavaMethod m) {
147-
if (m.canBeStaticallyBound() || universe.hostVM().isClosedTypeWorld()) {
148-
return super.findUniqueConcreteMethod(m);
149-
}
150-
/*
151-
* With an open type world analysis we cannot make assumptions for methods that cannot be
152-
* trivially statically bound.
153-
*/
154-
return null;
155-
}
156142
}

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,4 +562,16 @@ public ResolvedJavaType unwrapTowardsOriginalType() {
562562
public Class<?> getJavaClass() {
563563
return OriginalClassProvider.getJavaClass(this);
564564
}
565+
566+
@Override
567+
public AssumptionResult<ResolvedJavaMethod> findUniqueConcreteMethod(ResolvedJavaMethod m) {
568+
if (m.canBeStaticallyBound() || universe.hostVM().isClosedTypeWorld()) {
569+
return SharedType.super.findUniqueConcreteMethod(m);
570+
}
571+
/*
572+
* With an open type world analysis we cannot make assumptions for methods that cannot be
573+
* trivially statically bound.
574+
*/
575+
return null;
576+
}
565577
}

0 commit comments

Comments
 (0)