--- old/make/mapfiles/libjava/mapfile-vers 2015-11-13 17:36:59.361164537 +0300 +++ new/make/mapfiles/libjava/mapfile-vers 2015-11-13 17:36:58.889164526 +0300 @@ -251,12 +251,15 @@ Java_sun_reflect_ConstantPool_getFieldAtIfLoaded0; Java_sun_reflect_ConstantPool_getFloatAt0; Java_sun_reflect_ConstantPool_getIntAt0; + Java_sun_reflect_ConstantPool_getInvokedynamicRefInfoAt0; Java_sun_reflect_ConstantPool_getLongAt0; Java_sun_reflect_ConstantPool_getMemberRefInfoAt0; Java_sun_reflect_ConstantPool_getMethodAt0; Java_sun_reflect_ConstantPool_getMethodAtIfLoaded0; + Java_sun_reflect_ConstantPool_getNameAndTypeRefInfoAt0; Java_sun_reflect_ConstantPool_getSize0; Java_sun_reflect_ConstantPool_getStringAt0; + Java_sun_reflect_ConstantPool_getTagAt0; Java_sun_reflect_ConstantPool_getUTF8At0; Java_java_io_Console_istty; Java_java_io_Console_encoding; --- old/src/java.base/share/classes/sun/reflect/ConstantPool.java 2015-11-13 17:36:59.973164552 +0300 +++ new/src/java.base/share/classes/sun/reflect/ConstantPool.java 2015-11-13 17:36:59.749164546 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -45,13 +45,74 @@ // Fetches the class name, member (field, method or interface // method) name, and type descriptor as an array of three Strings public String[] getMemberRefInfoAt (int index) { return getMemberRefInfoAt0 (constantPoolOop, index); } + // Fetches the name and type from name_and_type index as an array of two Strings + public String[] getNameAndTypeRefInfoAt + (int index) { return getNameAndTypeRefInfoAt0 (constantPoolOop, index); } + // Fetches the invokedynamic name and type descriptor as an array of two Strings + public String[] getInvokedynamicRefInfoAt + (int index) { return getInvokedynamicRefInfoAt0 (constantPoolOop, index); } public int getIntAt (int index) { return getIntAt0 (constantPoolOop, index); } public long getLongAt (int index) { return getLongAt0 (constantPoolOop, index); } public float getFloatAt (int index) { return getFloatAt0 (constantPoolOop, index); } public double getDoubleAt (int index) { return getDoubleAt0 (constantPoolOop, index); } public String getStringAt (int index) { return getStringAt0 (constantPoolOop, index); } public String getUTF8At (int index) { return getUTF8At0 (constantPoolOop, index); } + public Tag getTagAt (int index) { return Tag.valueOf( + getTagAt0 (constantPoolOop, index));} + public static enum Tag { + UTF8, + INTEGER, + FLOAT, + LONG, + DOUBLE, + CLASS, + STRING, + FIELDREF, + METHODREF, + INTERFACEMETHODREF, + NAMEANDTYPE, + METHODHANDLE, + METHODTYPE, + INVOKEDYNAMIC, + INVALID, + UNRESOLVED_CLASS, + CLASS_INDEX, + STRING_INDEX, + UNRESOLVED_CLASS_IN_ERROR, + METHODHANDLE_IN_ERROR, + METHODTYPE_IN_ERROR; + + private static Tag valueOf(byte v) { + switch (v) { + case 0: return INVALID; + case 1: return UTF8; + case 3: return INTEGER; + case 4: return FLOAT; + case 5: return LONG; + case 6: return DOUBLE; + case 7: return CLASS; + case 8: return STRING; + case 9: return FIELDREF; + case 10: return METHODREF; + case 11: return INTERFACEMETHODREF; + case 12: return NAMEANDTYPE; + case 15: return METHODHANDLE; + case 16: return METHODTYPE; + case 18: return INVOKEDYNAMIC; + // The tags 100 - 105 are hotspot specific ones + // (not from JVM spec) used in constantTag.hpp + case 100: return UNRESOLVED_CLASS; + case 101: return CLASS_INDEX; + case 102: return STRING_INDEX; + case 103: return UNRESOLVED_CLASS_IN_ERROR; + case 104: return METHODHANDLE_IN_ERROR; + case 105: return METHODTYPE_IN_ERROR; + default: + throw new IllegalArgumentException("Unknown constant pool tag " + v); + } + } + } //--------------------------------------------------------------------------- // Internals only below this point // @@ -71,10 +132,15 @@ private native Field getFieldAt0 (Object constantPoolOop, int index); private native Field getFieldAtIfLoaded0 (Object constantPoolOop, int index); private native String[] getMemberRefInfoAt0 (Object constantPoolOop, int index); + private native String[] getNameAndTypeRefInfoAt0 + (Object constantPoolOop, int index); + private native String[] getInvokedynamicRefInfoAt0 + (Object constantPoolOop, int index); private native int getIntAt0 (Object constantPoolOop, int index); private native long getLongAt0 (Object constantPoolOop, int index); private native float getFloatAt0 (Object constantPoolOop, int index); private native double getDoubleAt0 (Object constantPoolOop, int index); private native String getStringAt0 (Object constantPoolOop, int index); private native String getUTF8At0 (Object constantPoolOop, int index); + private native byte getTagAt0 (Object constantPoolOop, int index); } --- old/src/java.base/share/native/include/jvm.h 2015-11-13 17:37:00.549164565 +0300 +++ new/src/java.base/share/native/include/jvm.h 2015-11-13 17:37:00.345164560 +0300 @@ -63,7 +63,7 @@ * class. */ -#define JVM_INTERFACE_VERSION 4 +#define JVM_INTERFACE_VERSION 5 JNIEXPORT jint JNICALL JVM_GetInterfaceVersion(void); @@ -483,6 +483,12 @@ JNIEXPORT jobjectArray JNICALL JVM_ConstantPoolGetMemberRefInfoAt (JNIEnv *env, jobject unused, jobject jcpool, jint index); +JNIEXPORT jobjectArray JNICALL JVM_ConstantPoolGetNameAndTypeRefInfoAt +(JNIEnv *env, jobject obj, jobject unused, jint index); + +JNIEXPORT jobjectArray JNICALL JVM_ConstantPoolGetInvokedynamicRefInfoAt +(JNIEnv *env, jobject obj, jobject unused, jint index); + JNIEXPORT jint JNICALL JVM_ConstantPoolGetIntAt (JNIEnv *env, jobject unused, jobject jcpool, jint index); @@ -501,6 +507,9 @@ JNIEXPORT jstring JNICALL JVM_ConstantPoolGetUTF8At (JNIEnv *env, jobject unused, jobject jcpool, jint index); +JNIEXPORT jbyte JNICALL JVM_ConstantPoolGetTagAt +(JNIEnv *env, jobject unused, jobject jcpool, jint index); + /* * Parameter reflection */ --- old/src/java.base/share/native/libjava/ConstantPool.c 2015-11-13 17:37:01.129164579 +0300 +++ new/src/java.base/share/native/libjava/ConstantPool.c 2015-11-13 17:37:00.909164574 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, 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 @@ -74,6 +74,18 @@ return JVM_ConstantPoolGetMemberRefInfoAt(env, unused, jcpool, index); } +JNIEXPORT jobjectArray JNICALL Java_sun_reflect_ConstantPool_getNameAndTypeRefInfoAt0 +(JNIEnv *env, jobject unused, jobject jcpool, jint index) +{ + return JVM_ConstantPoolGetNameAndTypeRefInfoAt(env, unused, jcpool, index); +} + +JNIEXPORT jobjectArray JNICALL Java_sun_reflect_ConstantPool_getInvokedynamicRefInfoAt0 +(JNIEnv *env, jobject unused, jobject jcpool, jint index) +{ + return JVM_ConstantPoolGetInvokedynamicRefInfoAt(env, unused, jcpool, index); +} + JNIEXPORT jint JNICALL Java_sun_reflect_ConstantPool_getIntAt0 (JNIEnv *env, jobject unused, jobject jcpool, jint index) { @@ -109,3 +121,10 @@ { return JVM_ConstantPoolGetUTF8At(env, unused, jcpool, index); } + +JNIEXPORT jbyte JNICALL Java_sun_reflect_ConstantPool_getTagAt0 +(JNIEnv *env, jobject unused, jobject jcpool, jint index) +{ + return JVM_ConstantPoolGetTagAt(env, unused, jcpool, index); +} +