8202698: Update Graal for JEP 181 - Nest-based access control

Reviewed-by: kvn
This commit is contained in:
Igor Veresov 2018-06-27 09:56:06 -07:00
parent 8e9f9e5583
commit 700a0427a1
2 changed files with 21 additions and 2 deletions

View File

@ -1661,6 +1661,8 @@ public class BytecodeParser implements GraphBuilderContext {
if (initialInvokeKind == InvokeKind.Special && !targetMethod.isConstructor()) {
emitCheckForInvokeSuperSpecial(args);
} else if (initialInvokeKind == InvokeKind.Interface && targetMethod.isPrivate()) {
emitCheckForDeclaringClassChange(targetMethod.getDeclaringClass(), args);
}
InlineInfo inlineInfo = null;
@ -1747,6 +1749,25 @@ public class BytecodeParser implements GraphBuilderContext {
return invoke;
}
/**
* Checks that the class of the receiver of an {@link Bytecodes#INVOKEINTERFACE} invocation of a
* private method is assignable to the interface that declared the method. If not, then
* deoptimize so that the interpreter can throw an {@link IllegalAccessError}.
*
* This is a check not performed by the verifier and so must be performed at runtime.
*
* @param declaringClass interface declaring the callee
* @param args arguments to an {@link Bytecodes#INVOKEINTERFACE} call to a private method
* declared in a interface
*/
private void emitCheckForDeclaringClassChange(ResolvedJavaType declaringClass, ValueNode[] args) {
ValueNode receiver = args[0];
TypeReference checkedType = TypeReference.createTrusted(graph.getAssumptions(), declaringClass);
LogicNode condition = genUnique(createInstanceOf(checkedType, receiver, null));
FixedGuardNode fixedGuard = append(new FixedGuardNode(condition, ClassCastException, None, false));
args[0] = append(PiNode.create(receiver, StampFactory.object(checkedType, true), fixedGuard));
}
/**
* Checks that the class of the receiver of an {@link Bytecodes#INVOKESPECIAL} in a method
* declared in an interface (i.e., a default method) is assignable to the interface. If not,

View File

@ -69,8 +69,6 @@ java/lang/ref/OOMEInReferenceHandler.java 8196611
java/lang/Runtime/exec/LotsOfOutput.java 8196611 generic-all
java/util/concurrent/ScheduledThreadPoolExecutor/BasicCancelTest.java 8196611 generic-all
java/lang/invoke/PrivateInterfaceCall.java 8202698 generic-all
# Next JFR tests fail with Graal. Assuming 8193210.
jdk/jfr/event/compiler/TestCodeSweeper.java 8193210 generic-all
jdk/jfr/event/compiler/TestCompilerInlining.java 8193210 generic-all