--- old/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java 2015-04-13 13:03:00.000000000 +0200 +++ new/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java 2015-04-13 13:03:00.000000000 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 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 @@ -55,16 +55,6 @@ static native Object staticFieldBase(MemberName self); // e.g., returns clazz static native Object getMemberVMInfo(MemberName self); // returns {vmindex,vmtarget} - /// MethodHandle support - - /** Fetch MH-related JVM parameter. - * which=0 retrieves MethodHandlePushLimit - * which=1 retrieves stack slot push size (in address units) - */ - static native int getConstant(int which); - - static final boolean COUNT_GWT; - /// CallSite support /** Tell the JVM that we need to change the target of a CallSite. */ @@ -74,38 +64,36 @@ private static native void registerNatives(); static { registerNatives(); - COUNT_GWT = getConstant(Constants.GC_COUNT_GWT) != 0; // The JVM calls MethodHandleNatives.. Cascade the calls as needed: MethodHandleImpl.initStatics(); } - // All compile-time constants go here. - // There is an opportunity to check them against the JVM's idea of them. + /** + * Compile-time constants go here. This collection exists not only for + * reference from clients, but also for ensuring the VM and JDK agree on the + * values of these constants (see {@link #verifyConstants()}). + */ static class Constants { Constants() { } // static only - // MethodHandleImpl - static final int // for getConstant - GC_COUNT_GWT = 4, - GC_LAMBDA_SUPPORT = 5; - // MemberName + // The JVM uses values of -2 and above for vtable indexes. // Field values are simple positive offsets. // Ref: src/share/vm/oops/methodOop.hpp // This value is negative enough to avoid such numbers, // but not too negative. static final int - MN_IS_METHOD = 0x00010000, // method (not constructor) - MN_IS_CONSTRUCTOR = 0x00020000, // constructor - MN_IS_FIELD = 0x00040000, // field - MN_IS_TYPE = 0x00080000, // nested type - MN_CALLER_SENSITIVE = 0x00100000, // @CallerSensitive annotation detected - MN_REFERENCE_KIND_SHIFT = 24, // refKind - MN_REFERENCE_KIND_MASK = 0x0F000000 >> MN_REFERENCE_KIND_SHIFT, - // The SEARCH_* bits are not for MN.flags but for the matchFlags argument of MHN.getMembers: - MN_SEARCH_SUPERCLASSES = 0x00100000, - MN_SEARCH_INTERFACES = 0x00200000; + MN_IS_METHOD = 0x00010000, // method (not constructor) + MN_IS_CONSTRUCTOR = 0x00020000, // constructor + MN_IS_FIELD = 0x00040000, // field + MN_IS_TYPE = 0x00080000, // nested type + MN_CALLER_SENSITIVE = 0x00100000, // @CallerSensitive annotation detected + MN_REFERENCE_KIND_SHIFT = 24, // refKind + MN_REFERENCE_KIND_MASK = 0x0F000000 >> MN_REFERENCE_KIND_SHIFT, + // The SEARCH_* bits are not for MN.flags but for the matchFlags argument of MHN.getMembers: + MN_SEARCH_SUPERCLASSES = 0x00100000, + MN_SEARCH_INTERFACES = 0x00200000; /** * Basic types as encoded in the JVM. These code values are not @@ -170,7 +158,7 @@ ACC_SUPER = ACC_SYNCHRONIZED, ACC_BRIDGE = ACC_VOLATILE, ACC_VARARGS = ACC_TRANSIENT; - + /** * Constant pool reference-kind codes, as used by CONSTANT_MethodHandle CP entries. */ --- old/hotspot/src/share/vm/prims/methodHandles.cpp 2015-04-13 13:03:01.000000000 +0200 +++ new/hotspot/src/share/vm/prims/methodHandles.cpp 2015-04-13 13:03:01.000000000 +0200 @@ -994,22 +994,8 @@ // that intrinsic (non-JNI) native methods are defined in HotSpot. // -JVM_ENTRY(jint, MHN_getConstant(JNIEnv *env, jobject igcls, jint which)) { - switch (which) { - case MethodHandles::GC_COUNT_GWT: -#ifdef COMPILER2 - return true; -#else - return false; -#endif - } - return 0; -} -JVM_END - #ifndef PRODUCT #define EACH_NAMED_CON(template, requirement) \ - template(MethodHandles,GC_COUNT_GWT) \ template(java_lang_invoke_MemberName,MN_IS_METHOD) \ template(java_lang_invoke_MemberName,MN_IS_CONSTRUCTOR) \ template(java_lang_invoke_MemberName,MN_IS_FIELD) \ @@ -1019,7 +1005,6 @@ template(java_lang_invoke_MemberName,MN_SEARCH_INTERFACES) \ template(java_lang_invoke_MemberName,MN_REFERENCE_KIND_SHIFT) \ template(java_lang_invoke_MemberName,MN_REFERENCE_KIND_MASK) \ - template(MethodHandles,GC_LAMBDA_SUPPORT) \ /*end*/ #define IGNORE_REQ(req_expr) /* req_expr */ @@ -1313,7 +1298,6 @@ {CC"init", CC"("MEM""OBJ")V", FN_PTR(MHN_init_Mem)}, {CC"expand", CC"("MEM")V", FN_PTR(MHN_expand_Mem)}, {CC"resolve", CC"("MEM""CLS")"MEM, FN_PTR(MHN_resolve_Mem)}, - {CC"getConstant", CC"(I)I", FN_PTR(MHN_getConstant)}, // static native int getNamedCon(int which, Object[] name) {CC"getNamedCon", CC"(I["OBJ")I", FN_PTR(MHN_getNamedCon)}, // static native int getMembers(Class defc, String matchName, String matchSig, --- old/hotspot/src/share/vm/prims/methodHandles.hpp 2015-04-13 13:03:02.000000000 +0200 +++ new/hotspot/src/share/vm/prims/methodHandles.hpp 2015-04-13 13:03:02.000000000 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 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 @@ -125,11 +125,6 @@ return signature_polymorphic_name_id(klass, name) != vmIntrinsics::_none; } - enum { - // format of query to getConstant: - GC_COUNT_GWT = 4, - GC_LAMBDA_SUPPORT = 5 - }; static int get_named_constant(int which, Handle name_box, TRAPS); public: