Skip to content

Commit

Permalink
Merge pull request #3197 from JasonFengJ9/jdk11condy
Browse files Browse the repository at this point in the history
Add Java11 JPP tag to ConstantDynamic methods
  • Loading branch information
DanHeidinga authored Oct 10, 2018
2 parents 72257ff + 94245ea commit 62af654
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions jcl/src/java.base/share/classes/java/lang/invoke/MethodHandle.java
Original file line number Diff line number Diff line change
Expand Up @@ -812,11 +812,6 @@ private static final Class<?> fromFieldDescriptorString(String fieldDescriptor,
*/
private static final native MethodHandle getCPMethodHandleAt(Object internalRamClass, int index);

/*
* sun.reflect.ConstantPool doesn't have a getConstantDynamicAt method. This is the
* equivalent for ConstantDynamic.
*/
private static final native Object getCPConstantDynamicAt(Object internalRamClass, int index);

/**
* Get the class name from a constant pool class element, which is located
Expand All @@ -840,6 +835,13 @@ private static final Class<?> fromFieldDescriptorString(String fieldDescriptor,
private static final int BSM_NAME_ARGUMENT_INDEX = 1;
private static final int BSM_TYPE_ARGUMENT_INDEX = 2;
private static final int BSM_OPTIONAL_ARGUMENTS_START_INDEX = 3;

/*[IF Java11]*/
/*
* sun.reflect.ConstantPool doesn't have a getConstantDynamicAt method. This is the
* equivalent for ConstantDynamic.
*/
private static final native Object getCPConstantDynamicAt(Object internalRamClass, int index);

@SuppressWarnings("unused")
private static final Object resolveConstantDynamic(long j9class, String name, String fieldDescriptor, long bsmData) throws Throwable {
Expand Down Expand Up @@ -1000,6 +1002,7 @@ private static final Object resolveConstantDynamic(long j9class, String name, St

return result;
}
/*[ENDIF] Java11*/

@SuppressWarnings("unused")
private static final MethodHandle resolveInvokeDynamic(long j9class, String name, String methodDescriptor, long bsmData) throws Throwable {
Expand Down Expand Up @@ -1108,9 +1111,11 @@ private static final MethodHandle resolveInvokeDynamic(long j9class, String name
case 14:
cpEntry = getCPMethodHandleAt(internalRamClass, index);
break;
/*[IF Java11]*/
case 17:
cpEntry = getCPConstantDynamicAt(internalRamClass, index);
break;
/*[ENDIF] Java11*/
default:
// Do nothing. The null check below will throw the appropriate exception.
}
Expand Down

0 comments on commit 62af654

Please sign in to comment.