Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
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
  • Loading branch information
dean-long committed Jul 30, 2020
1 parent 11a8c9c commit 6986d53af92b7ad788a450a1ac8ed3b1b32b8900
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 1 deletion.
@@ -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.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,9 @@

package org.graalvm.compiler.core.test;

import org.graalvm.compiler.api.directives.GraalDirectives;
import org.graalvm.compiler.nodes.CallTargetNode.InvokeKind;
import org.graalvm.compiler.phases.OptimisticOptimizations;
import org.junit.Test;

public class ConditionalNodeTest extends GraalCompilerTest {
@@ -126,4 +128,73 @@ public static int conditionalTest4(ConditionalNodeTest node, int a) {
node.a = 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());
}
}
@@ -549,6 +549,10 @@ private boolean conditionalNodeOptimization(SimplifierTool tool) {
return false;
}

if (falseSuccessor instanceof LoopExitNode && ((LoopExitNode) falseSuccessor).stateAfter != null) {
return false;
}

PhiNode phi = merge.phis().first();
ValueNode falseValue = phi.valueAt(falseEnd);
ValueNode trueValue = phi.valueAt(trueEnd);
@@ -868,6 +872,11 @@ private boolean removeOrMaterializeIf(SimplifierTool tool) {
AbstractEndNode trueEnd = (AbstractEndNode) trueSuccessor().next();
AbstractEndNode falseEnd = (AbstractEndNode) falseSuccessor().next();
AbstractMergeNode merge = trueEnd.merge();

if (falseSuccessor instanceof LoopExitNode && ((LoopExitNode) falseSuccessor).stateAfter != null) {
return false;
}

if (merge == falseEnd.merge() && trueSuccessor().anchored().isEmpty() && falseSuccessor().anchored().isEmpty()) {
PhiNode singlePhi = null;
int distinct = 0;
@@ -986,6 +995,11 @@ private ValueNode proxyReplacement(ValueNode replacement) {
}

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();
LogicNode conditionNode = condition();
graph().removeSplitPropagate(this, trueBegin);

0 comments on commit 6986d53

Please sign in to comment.