8248597: [Graal] api/java_security/SignatureSpi/DelegationTests.html fails with Method "javasoft.sqe.tests.api.java.security.SignatureSpi.JCKSignatureSpi.clear" doesn't exist

Reviewed-by: kvn
This commit is contained in:
Dean Long 2020-07-29 23:15:48 -07:00
parent 11a8c9c13e
commit 6986d53af9
2 changed files with 86 additions and 1 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,7 +24,9 @@
package org.graalvm.compiler.core.test; package org.graalvm.compiler.core.test;
import org.graalvm.compiler.api.directives.GraalDirectives;
import org.graalvm.compiler.nodes.CallTargetNode.InvokeKind; import org.graalvm.compiler.nodes.CallTargetNode.InvokeKind;
import org.graalvm.compiler.phases.OptimisticOptimizations;
import org.junit.Test; import org.junit.Test;
public class ConditionalNodeTest extends GraalCompilerTest { public class ConditionalNodeTest extends GraalCompilerTest {
@ -126,4 +128,73 @@ public class ConditionalNodeTest extends GraalCompilerTest {
node.a = a; node.a = a;
return a; return a;
} }
@SuppressWarnings("all")
static int lastIndexOf(char[] source, int sourceOffset, int sourceCount,
char[] target, int targetOffset, int targetCount,
int fromIndex) {
/*
* Check arguments; return immediately where possible. For consistency, don't check for null
* str.
*/
int rightIndex = sourceCount - targetCount;
if (fromIndex < 0) {
return -1;
}
if (fromIndex > rightIndex) {
fromIndex = rightIndex;
}
/* Empty string always matches. */
if (targetCount == 0) {
return fromIndex;
}
int strLastIndex = targetOffset + targetCount - 1;
char strLastChar = target[strLastIndex];
int min = sourceOffset + targetCount - 1;
int i = min + fromIndex;
startSearchForLastChar: while (true) {
while (i >= min && source[i] != strLastChar) {
i--;
}
if (i < min) {
return -1;
}
int j = i - 1;
int start = j - (targetCount - 1);
int k = strLastIndex - 1;
while (j > start) {
if (source[j--] != target[k--]) {
i--;
continue startSearchForLastChar;
}
}
return start - sourceOffset + 1;
}
}
public static String simple(String simpleName) {
char[] value = simpleName.toCharArray();
char[] target = ".".toCharArray();
int lastDotIndex = lastIndexOf(value, 0, value.length,
target, 0, target.length, value.length);
if (lastDotIndex < 0) {
return null;
}
GraalDirectives.deoptimize();
return simpleName.substring(0, lastDotIndex);
}
@Override
protected OptimisticOptimizations getOptimisticOptimizations() {
// Disable profile based optimizations
return OptimisticOptimizations.NONE;
}
@Test
public void testConditionalExit() {
test("simple", Object.class.getName());
}
} }

View File

@ -549,6 +549,10 @@ public final class IfNode extends ControlSplitNode implements Simplifiable, LIRL
return false; return false;
} }
if (falseSuccessor instanceof LoopExitNode && ((LoopExitNode) falseSuccessor).stateAfter != null) {
return false;
}
PhiNode phi = merge.phis().first(); PhiNode phi = merge.phis().first();
ValueNode falseValue = phi.valueAt(falseEnd); ValueNode falseValue = phi.valueAt(falseEnd);
ValueNode trueValue = phi.valueAt(trueEnd); ValueNode trueValue = phi.valueAt(trueEnd);
@ -868,6 +872,11 @@ public final class IfNode extends ControlSplitNode implements Simplifiable, LIRL
AbstractEndNode trueEnd = (AbstractEndNode) trueSuccessor().next(); AbstractEndNode trueEnd = (AbstractEndNode) trueSuccessor().next();
AbstractEndNode falseEnd = (AbstractEndNode) falseSuccessor().next(); AbstractEndNode falseEnd = (AbstractEndNode) falseSuccessor().next();
AbstractMergeNode merge = trueEnd.merge(); AbstractMergeNode merge = trueEnd.merge();
if (falseSuccessor instanceof LoopExitNode && ((LoopExitNode) falseSuccessor).stateAfter != null) {
return false;
}
if (merge == falseEnd.merge() && trueSuccessor().anchored().isEmpty() && falseSuccessor().anchored().isEmpty()) { if (merge == falseEnd.merge() && trueSuccessor().anchored().isEmpty() && falseSuccessor().anchored().isEmpty()) {
PhiNode singlePhi = null; PhiNode singlePhi = null;
int distinct = 0; int distinct = 0;
@ -986,6 +995,11 @@ public final class IfNode extends ControlSplitNode implements Simplifiable, LIRL
} }
protected void removeThroughFalseBranch(SimplifierTool tool, AbstractMergeNode merge) { protected void removeThroughFalseBranch(SimplifierTool tool, AbstractMergeNode merge) {
// If the LoopExitNode and the Merge still have states then it's incorrect to arbitrarily
// pick one side of the branch the represent the control flow. The state on the merge is the
// real after state but it would need to be adjusted to represent the effects of the
// conditional conversion.
assert !(falseSuccessor instanceof LoopExitNode) || ((LoopExitNode) falseSuccessor).stateAfter == null;
AbstractBeginNode trueBegin = trueSuccessor(); AbstractBeginNode trueBegin = trueSuccessor();
LogicNode conditionNode = condition(); LogicNode conditionNode = condition();
graph().removeSplitPropagate(this, trueBegin); graph().removeSplitPropagate(this, trueBegin);