1 6981791: remove experimental code for JSR 292
4 grep -n AllowTransitionalJSR292 $(hg loc -I src) \
5 && echo "*** ERROR: There is still code for transitional modes! "
7 diff --git a/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java b/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java
8 --- a/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java
9 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java
11 if (Assert.ASSERTS_ENABLED) {
12 Assert.that(getTagAt(i).isInvokeDynamic(), "Corrupted constant pool");
14 - if (getTagAt(i).value() == JVM_CONSTANT_InvokeDynamicTrans)
16 int bsmSpec = extractLowShortFromInt(this.getIntAt(i));
17 TypeArray operands = getOperands();
18 if (operands == null) return null; // safety first
20 case JVM_CONSTANT_MethodHandle: return "JVM_CONSTANT_MethodHandle";
21 case JVM_CONSTANT_MethodType: return "JVM_CONSTANT_MethodType";
22 case JVM_CONSTANT_InvokeDynamic: return "JVM_CONSTANT_InvokeDynamic";
23 - case JVM_CONSTANT_InvokeDynamicTrans: return "JVM_CONSTANT_InvokeDynamic/transitional";
24 case JVM_CONSTANT_Invalid: return "JVM_CONSTANT_Invalid";
25 case JVM_CONSTANT_UnresolvedClass: return "JVM_CONSTANT_UnresolvedClass";
26 case JVM_CONSTANT_UnresolvedClassInError: return "JVM_CONSTANT_UnresolvedClassInError";
28 case JVM_CONSTANT_MethodHandle:
29 case JVM_CONSTANT_MethodType:
30 case JVM_CONSTANT_InvokeDynamic:
31 - case JVM_CONSTANT_InvokeDynamicTrans:
32 visitor.doInt(new IntField(new NamedFieldIdentifier(nameForTag(ctag)), indexOffset(index), true), true);
39 - case JVM_CONSTANT_InvokeDynamicTrans:
40 case JVM_CONSTANT_InvokeDynamic: {
41 dos.writeByte(cpConstType);
42 int value = getIntAt(ci);
43 diff --git a/agent/src/share/classes/sun/jvm/hotspot/runtime/ClassConstants.java b/agent/src/share/classes/sun/jvm/hotspot/runtime/ClassConstants.java
44 --- a/agent/src/share/classes/sun/jvm/hotspot/runtime/ClassConstants.java
45 +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/ClassConstants.java
47 public static final int JVM_CONSTANT_NameAndType = 12;
48 public static final int JVM_CONSTANT_MethodHandle = 15;
49 public static final int JVM_CONSTANT_MethodType = 16;
50 - public static final int JVM_CONSTANT_InvokeDynamicTrans = 17; // only occurs in old class files
51 + // static final int JVM_CONSTANT_(unused) = 17;
52 public static final int JVM_CONSTANT_InvokeDynamic = 18;
54 // JVM_CONSTANT_MethodHandle subtypes
55 diff --git a/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java b/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java
56 --- a/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java
57 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java
62 - case JVM_CONSTANT_InvokeDynamicTrans:
63 case JVM_CONSTANT_InvokeDynamic: {
64 dos.writeByte(cpConstType);
65 int value = cpool.getIntAt(ci);
66 diff --git a/agent/src/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java b/agent/src/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java
67 --- a/agent/src/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java
68 +++ b/agent/src/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java
70 buf.cell(Integer.toString(cpool.getIntAt(index)));
73 - case JVM_CONSTANT_InvokeDynamicTrans:
74 case JVM_CONSTANT_InvokeDynamic:
75 buf.cell("JVM_CONSTANT_InvokeDynamic");
76 buf.cell(genLowHighShort(cpool.getIntAt(index)) +
77 diff --git a/agent/src/share/classes/sun/jvm/hotspot/utilities/ConstantTag.java b/agent/src/share/classes/sun/jvm/hotspot/utilities/ConstantTag.java
78 --- a/agent/src/share/classes/sun/jvm/hotspot/utilities/ConstantTag.java
79 +++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/ConstantTag.java
81 private static int JVM_CONSTANT_NameAndType = 12;
82 private static int JVM_CONSTANT_MethodHandle = 15; // JSR 292
83 private static int JVM_CONSTANT_MethodType = 16; // JSR 292
84 - private static int JVM_CONSTANT_InvokeDynamicTrans = 17; // JSR 292, only occurs in old class files
85 + // static int JVM_CONSTANT_(unused) = 17; // JSR 292 early drafts only
86 private static int JVM_CONSTANT_InvokeDynamic = 18; // JSR 292
87 private static int JVM_CONSTANT_Invalid = 0; // For bad value initialization
88 private static int JVM_CONSTANT_UnresolvedClass = 100; // Temporary tag until actual use
90 public boolean isMethodHandle() { return tag == JVM_CONSTANT_MethodHandle; }
91 public boolean isMethodType() { return tag == JVM_CONSTANT_MethodType; }
92 public boolean isInvokeDynamic() { return tag == JVM_CONSTANT_InvokeDynamic; }
93 - public boolean isInvokeDynamicTrans() { return tag == JVM_CONSTANT_InvokeDynamicTrans; }
95 public boolean isInvalid() { return tag == JVM_CONSTANT_Invalid; }
97 diff --git a/src/share/vm/classfile/classFileParser.cpp b/src/share/vm/classfile/classFileParser.cpp
98 --- a/src/share/vm/classfile/classFileParser.cpp
99 +++ b/src/share/vm/classfile/classFileParser.cpp
101 ShouldNotReachHere();
104 - case JVM_CONSTANT_InvokeDynamicTrans : // this tag appears only in old classfiles
105 case JVM_CONSTANT_InvokeDynamic :
107 if (_major_version < Verifier::INVOKEDYNAMIC_MAJOR_VERSION) {
109 cfs->guarantee_more(5, CHECK); // bsm_index, nt, tag/access_flags
110 u2 bootstrap_specifier_index = cfs->get_u2_fast();
111 u2 name_and_type_index = cfs->get_u2_fast();
112 - if (tag == JVM_CONSTANT_InvokeDynamicTrans) {
113 - if (!AllowTransitionalJSR292)
114 - classfile_parse_error(
115 - "This JVM does not support transitional InvokeDynamic tag %u in class file %s",
117 - cp->invoke_dynamic_trans_at_put(index, bootstrap_specifier_index, name_and_type_index);
120 if (_max_bootstrap_specifier_index < (int) bootstrap_specifier_index)
121 _max_bootstrap_specifier_index = (int) bootstrap_specifier_index; // collect for later
122 cp->invoke_dynamic_at_put(index, bootstrap_specifier_index, name_and_type_index);
124 ref_index, CHECK_(nullHandle));
127 - case JVM_CONSTANT_InvokeDynamicTrans :
128 case JVM_CONSTANT_InvokeDynamic :
130 int name_and_type_ref_index = cp->invoke_dynamic_name_and_type_ref_index_at(index);
132 "Invalid constant pool index %u in class file %s",
133 name_and_type_ref_index,
135 - if (tag == JVM_CONSTANT_InvokeDynamicTrans) {
136 - int bootstrap_method_ref_index = cp->invoke_dynamic_bootstrap_method_ref_index_at(index);
137 - check_property(valid_cp_range(bootstrap_method_ref_index, length) &&
138 - cp->tag_at(bootstrap_method_ref_index).is_method_handle(),
139 - "Invalid constant pool index %u in class file %s",
140 - bootstrap_method_ref_index,
141 - CHECK_(nullHandle));
143 // bootstrap specifier index must be checked later, when BootstrapMethods attr is available
146 @@ -2822,7 +2804,6 @@
150 - if (AllowTransitionalJSR292 && word_sig_index == 0) return;
151 if (word_sig_index == 0)
152 THROW_MSG(vmSymbols::java_lang_VirtualMachineError(),
153 "missing I or J signature (for vmentry) in java.lang.invoke.MethodHandle");
154 @@ -2862,7 +2843,6 @@
158 - if (AllowTransitionalJSR292 && !found_vmentry) return;
160 THROW_MSG(vmSymbols::java_lang_VirtualMachineError(),
161 "missing vmentry byte field in java.lang.invoke.MethodHandle");
162 @@ -3234,15 +3214,6 @@
163 if (EnableInvokeDynamic && class_name == vmSymbols::java_lang_invoke_MethodHandle() && class_loader.is_null()) {
164 java_lang_invoke_MethodHandle_fix_pre(cp, fields, &fac, CHECK_(nullHandle));
166 - if (AllowTransitionalJSR292 &&
167 - EnableInvokeDynamic && class_name == vmSymbols::java_dyn_MethodHandle() && class_loader.is_null()) {
168 - java_lang_invoke_MethodHandle_fix_pre(cp, fields, &fac, CHECK_(nullHandle));
170 - if (AllowTransitionalJSR292 &&
171 - EnableInvokeDynamic && class_name == vmSymbols::sun_dyn_MethodHandleImpl() && class_loader.is_null()) {
172 - // allow vmentry field in MethodHandleImpl also
173 - java_lang_invoke_MethodHandle_fix_pre(cp, fields, &fac, CHECK_(nullHandle));
176 // Add a fake "discovered" field if it is not present
177 // for compatibility with earlier jdk's.
178 diff --git a/src/share/vm/classfile/javaClasses.cpp b/src/share/vm/classfile/javaClasses.cpp
179 --- a/src/share/vm/classfile/javaClasses.cpp
180 +++ b/src/share/vm/classfile/javaClasses.cpp
182 return ik->find_local_field(name_symbol, signature_symbol, fd);
185 -static bool find_hacked_field(instanceKlass* ik,
186 - Symbol* name_symbol, Symbol* signature_symbol,
187 - fieldDescriptor* fd,
188 - bool allow_super = false) {
189 - bool found = find_field(ik, name_symbol, signature_symbol, fd, allow_super);
190 - if (!found && AllowTransitionalJSR292) {
191 - Symbol* backup_sig = SystemDictionary::find_backup_signature(signature_symbol);
192 - if (backup_sig != NULL) {
193 - found = find_field(ik, name_symbol, backup_sig, fd, allow_super);
194 - if (TraceMethodHandles) {
196 - tty->print_cr("MethodHandles: %s.%s: backup for %s => %s%s",
197 - ik->name()->as_C_string(), name_symbol->as_C_string(),
198 - signature_symbol->as_C_string(), backup_sig->as_C_string(),
199 - (found ? "" : " (NOT FOUND)"));
205 -#define find_field find_hacked_field /* remove after AllowTransitionalJSR292 */
207 // Helpful routine for computing field offsets at run time rather than hardcoding them
209 compute_offset(int &dest_offset,
210 @@ -2226,7 +2204,6 @@
211 klassOop k = SystemDictionary::MethodHandle_klass();
212 if (k != NULL && EnableInvokeDynamic) {
213 bool allow_super = false;
214 - if (AllowTransitionalJSR292) allow_super = true; // temporary, to access java.dyn.MethodHandleImpl
215 compute_offset(_type_offset, k, vmSymbols::type_name(), vmSymbols::java_lang_invoke_MethodType_signature(), allow_super);
216 compute_offset(_vmtarget_offset, k, vmSymbols::vmtarget_name(), vmSymbols::object_signature(), allow_super);
217 compute_offset(_vmentry_offset, k, vmSymbols::vmentry_name(), vmSymbols::machine_word_signature(), allow_super);
218 diff --git a/src/share/vm/classfile/systemDictionary.cpp b/src/share/vm/classfile/systemDictionary.cpp
219 --- a/src/share/vm/classfile/systemDictionary.cpp
220 +++ b/src/share/vm/classfile/systemDictionary.cpp
221 @@ -1887,99 +1887,27 @@
225 -Symbol* SystemDictionary::find_backup_symbol(Symbol* symbol,
226 - const char* from_prefix,
227 - const char* to_prefix) {
228 - assert(AllowTransitionalJSR292, ""); // delete this subroutine
229 - Symbol* backup_symbol = NULL;
230 - size_t from_len = strlen(from_prefix);
231 - if (strncmp((const char*) symbol->base(), from_prefix, from_len) != 0)
234 - size_t to_len = strlen(to_prefix);
235 - size_t tail_len = symbol->utf8_length() - from_len;
236 - size_t new_len = to_len + tail_len;
237 - guarantee(new_len < sizeof(buf), "buf too small");
238 - memcpy(buf, to_prefix, to_len);
239 - memcpy(buf + to_len, symbol->base() + from_len, tail_len);
240 - buf[new_len] = '\0';
241 - vmSymbols::SID backup_sid = vmSymbols::find_sid(buf);
242 - if (backup_sid != vmSymbols::NO_SID) {
243 - backup_symbol = vmSymbols::symbol_at(backup_sid);
245 - return backup_symbol;
248 -Symbol* SystemDictionary::find_backup_class_name(Symbol* symbol) {
249 - assert(AllowTransitionalJSR292, ""); // delete this subroutine
250 - if (symbol == NULL) return NULL;
251 - Symbol* backup_symbol = find_backup_symbol(symbol, "java/lang/invoke/", "java/dyn/"); // AllowTransitionalJSR292 ONLY
252 - if (backup_symbol == NULL)
253 - backup_symbol = find_backup_symbol(symbol, "java/dyn/", "sun/dyn/"); // AllowTransitionalJSR292 ONLY
254 - return backup_symbol;
257 -Symbol* SystemDictionary::find_backup_signature(Symbol* symbol) {
258 - assert(AllowTransitionalJSR292, ""); // delete this subroutine
259 - if (symbol == NULL) return NULL;
260 - return find_backup_symbol(symbol, "Ljava/lang/invoke/", "Ljava/dyn/");
263 bool SystemDictionary::initialize_wk_klass(WKID id, int init_opt, TRAPS) {
264 assert(id >= (int)FIRST_WKID && id < (int)WKID_LIMIT, "oob");
265 int info = wk_init_info[id - FIRST_WKID];
266 int sid = (info >> CEIL_LG_OPTION_LIMIT);
267 Symbol* symbol = vmSymbols::symbol_at((vmSymbols::SID)sid);
268 klassOop* klassp = &_well_known_klasses[id];
269 - bool pre_load = (init_opt < SystemDictionary::Opt);
270 - bool try_load = true;
271 + bool must_load = (init_opt < SystemDictionary::Opt);
272 + bool try_load = true;
273 if (init_opt == SystemDictionary::Opt_Kernel) {
278 - Symbol* backup_symbol = NULL; // symbol to try if the current symbol fails
279 - if (init_opt == SystemDictionary::Pre_JSR292) {
280 - if (!EnableInvokeDynamic) try_load = false; // do not bother to load such classes
281 - if (AllowTransitionalJSR292) {
282 - backup_symbol = find_backup_class_name(symbol);
283 - if (try_load && PreferTransitionalJSR292) {
284 - while (backup_symbol != NULL) {
285 - (*klassp) = resolve_or_null(backup_symbol, CHECK_0); // try backup early
286 - if (TraceMethodHandles) {
288 - tty->print_cr("MethodHandles: try backup first for %s => %s (%s)",
289 - symbol->as_C_string(), backup_symbol->as_C_string(),
290 - ((*klassp) == NULL) ? "no such class" : "backup load succeeded");
292 - if ((*klassp) != NULL) return true;
293 - backup_symbol = find_backup_class_name(backup_symbol); // find next backup
298 - if ((*klassp) != NULL) return true;
299 - if (!try_load) return false;
300 - while (symbol != NULL) {
301 - bool must_load = (pre_load && (backup_symbol == NULL));
302 + if ((*klassp) == NULL && try_load) {
304 (*klassp) = resolve_or_fail(symbol, true, CHECK_0); // load required class
306 (*klassp) = resolve_or_null(symbol, CHECK_0); // load optional klass
308 - if ((*klassp) != NULL) return true;
309 - // Go around again. Example of long backup sequence:
310 - // java.lang.invoke.MemberName, java.dyn.MemberName, sun.dyn.MemberName, ONLY if AllowTransitionalJSR292
311 - if (TraceMethodHandles && (backup_symbol != NULL)) {
313 - tty->print_cr("MethodHandles: backup for %s => %s",
314 - symbol->as_C_string(), backup_symbol->as_C_string());
316 - symbol = backup_symbol;
317 - if (AllowTransitionalJSR292)
318 - backup_symbol = find_backup_class_name(symbol);
321 + return ((*klassp) != NULL);
324 void SystemDictionary::initialize_wk_klasses_until(WKID limit_id, WKID &start_id, TRAPS) {
325 @@ -2409,9 +2337,7 @@
326 // Must create lots of stuff here, but outside of the SystemDictionary lock.
327 if (THREAD->is_Compiler_thread())
328 return NULL; // do not attempt from within compiler
329 - bool for_invokeGeneric = (name_id == vmSymbols::VM_SYMBOL_ENUM_NAME(invokeGeneric_name));
330 - if (AllowInvokeForInvokeGeneric && name_id == vmSymbols::VM_SYMBOL_ENUM_NAME(invoke_name))
331 - for_invokeGeneric = true;
332 + bool for_invokeGeneric = (name_id != vmSymbols::VM_SYMBOL_ENUM_NAME(invokeExact_name));
333 bool found_on_bcp = false;
334 Handle mt = find_method_handle_type(signature, accessing_klass,
336 @@ -2498,14 +2424,10 @@
337 JavaCallArguments args(Handle(THREAD, rt()));
338 args.push_oop(pts());
339 JavaValue result(T_OBJECT);
340 - Symbol* findMethodHandleType_signature = vmSymbols::findMethodHandleType_signature();
341 - if (AllowTransitionalJSR292 && SystemDictionaryHandles::MethodType_klass()->name() == vmSymbols::java_dyn_MethodType()) {
342 - findMethodHandleType_signature = vmSymbols::findMethodHandleType_TRANS_signature();
344 JavaCalls::call_static(&result,
345 SystemDictionary::MethodHandleNatives_klass(),
346 vmSymbols::findMethodHandleType_name(),
347 - findMethodHandleType_signature,
348 + vmSymbols::findMethodHandleType_signature(),
349 &args, CHECK_(empty));
350 Handle method_type(THREAD, (oop) result.get_jobject());
352 @@ -2513,14 +2435,10 @@
353 // call java.lang.invoke.MethodHandleNatives::notifyGenericMethodType(MethodType) -> void
354 JavaCallArguments args(Handle(THREAD, method_type()));
355 JavaValue no_result(T_VOID);
356 - Symbol* notifyGenericMethodType_signature = vmSymbols::notifyGenericMethodType_signature();
357 - if (AllowTransitionalJSR292 && SystemDictionaryHandles::MethodType_klass()->name() == vmSymbols::java_dyn_MethodType()) {
358 - notifyGenericMethodType_signature = vmSymbols::notifyGenericMethodType_TRANS_signature();
360 JavaCalls::call_static(&no_result,
361 SystemDictionary::MethodHandleNatives_klass(),
362 vmSymbols::notifyGenericMethodType_name(),
363 - notifyGenericMethodType_signature,
364 + vmSymbols::notifyGenericMethodType_signature(),
366 if (HAS_PENDING_EXCEPTION) {
367 // If the notification fails, just kill it.
368 @@ -2569,14 +2487,10 @@
369 args.push_oop(name());
370 args.push_oop(type());
371 JavaValue result(T_OBJECT);
372 - Symbol* linkMethodHandleConstant_signature = vmSymbols::linkMethodHandleConstant_signature();
373 - if (AllowTransitionalJSR292 && SystemDictionaryHandles::MethodHandle_klass()->name() == vmSymbols::java_dyn_MethodHandle()) {
374 - linkMethodHandleConstant_signature = vmSymbols::linkMethodHandleConstant_TRANS_signature();
376 JavaCalls::call_static(&result,
377 SystemDictionary::MethodHandleNatives_klass(),
378 vmSymbols::linkMethodHandleConstant_name(),
379 - linkMethodHandleConstant_signature,
380 + vmSymbols::linkMethodHandleConstant_signature(),
381 &args, CHECK_(empty));
382 return Handle(THREAD, (oop) result.get_jobject());
384 @@ -2607,17 +2521,10 @@
385 args.push_oop(caller_mname());
386 args.push_int(caller_bci);
387 JavaValue result(T_OBJECT);
388 - Symbol* makeDynamicCallSite_signature = vmSymbols::makeDynamicCallSite_signature();
389 - if (AllowTransitionalJSR292 && SystemDictionaryHandles::MethodHandleNatives_klass()->name() == vmSymbols::sun_dyn_MethodHandleNatives()) {
390 - makeDynamicCallSite_signature = vmSymbols::makeDynamicCallSite_TRANS_signature();
392 - if (AllowTransitionalJSR292 && SystemDictionaryHandles::MethodHandleNatives_klass()->name() == vmSymbols::java_dyn_MethodHandleNatives()) {
393 - makeDynamicCallSite_signature = vmSymbols::makeDynamicCallSite_TRANS2_signature();
395 JavaCalls::call_static(&result,
396 SystemDictionary::MethodHandleNatives_klass(),
397 vmSymbols::makeDynamicCallSite_name(),
398 - makeDynamicCallSite_signature,
399 + vmSymbols::makeDynamicCallSite_signature(),
400 &args, CHECK_(empty));
401 oop call_site_oop = (oop) result.get_jobject();
402 assert(call_site_oop->is_oop()
403 @@ -2698,28 +2605,10 @@
404 argument_info_result = argument_info; // return argument_info to caller
407 - // else null BSM; fall through
408 - } else if (tag.is_name_and_type()) {
409 - // JSR 292 EDR does not have JVM_CONSTANT_InvokeDynamic
410 - // a bare name&type defaults its BSM to null, so fall through...
412 ShouldNotReachHere(); // verifier does not allow this
415 - // Fall through to pick up the per-class bootstrap method.
416 - // This mechanism may go away in the PFD.
417 - assert(AllowTransitionalJSR292, "else the verifier should have stopped us already");
418 - argument_info_result = empty; // return no argument_info to caller
419 - oop bsm_oop = instanceKlass::cast(caller_method->method_holder())->bootstrap_method();
420 - if (bsm_oop != NULL) {
421 - if (TraceMethodHandles) {
422 - tty->print_cr("bootstrap method for "PTR_FORMAT" registered as "PTR_FORMAT":",
423 - (intptr_t) caller_method(), (intptr_t) bsm_oop);
425 - assert(bsm_oop->is_oop(), "must be sane");
426 - return Handle(THREAD, bsm_oop);
432 diff --git a/src/share/vm/classfile/systemDictionary.hpp b/src/share/vm/classfile/systemDictionary.hpp
433 --- a/src/share/vm/classfile/systemDictionary.hpp
434 +++ b/src/share/vm/classfile/systemDictionary.hpp
436 /* support for dynamic typing; it's OK if these are NULL in earlier JDKs */ \
437 template(MethodHandle_klass, java_lang_invoke_MethodHandle, Pre_JSR292) \
438 template(MemberName_klass, java_lang_invoke_MemberName, Pre_JSR292) \
439 - template(MethodHandleImpl_klass, sun_dyn_MethodHandleImpl, Opt) /* AllowTransitionalJSR292 ONLY */ \
440 template(MethodHandleNatives_klass, java_lang_invoke_MethodHandleNatives, Pre_JSR292) \
441 template(AdapterMethodHandle_klass, java_lang_invoke_AdapterMethodHandle, Pre_JSR292) \
442 template(BoundMethodHandle_klass, java_lang_invoke_BoundMethodHandle, Pre_JSR292) \
444 template(MethodType_klass, java_lang_invoke_MethodType, Pre_JSR292) \
445 template(MethodTypeForm_klass, java_lang_invoke_MethodTypeForm, Pre_JSR292) \
446 template(WrongMethodTypeException_klass, java_lang_invoke_WrongMethodTypeException, Pre_JSR292) \
447 - template(Linkage_klass, java_lang_invoke_Linkage, Opt) /* AllowTransitionalJSR292 ONLY */ \
448 template(CallSite_klass, java_lang_invoke_CallSite, Pre_JSR292) \
449 /* Note: MethodHandle must be first, and CallSite last in group */ \
452 initialize_wk_klasses_until((WKID) limit, start_id, THREAD);
455 - static Symbol* find_backup_symbol(Symbol* symbol, const char* from_prefix, const char* to_prefix);
458 #define WK_KLASS_DECLARE(name, ignore_symbol, option) \
459 static klassOop name() { return check_klass_##option(_well_known_klasses[WK_KLASS_ENUM_NAME(name)]); }
462 static void load_abstract_ownable_synchronizer_klass(TRAPS);
464 - static Symbol* find_backup_class_name(Symbol* class_name_symbol);
465 - static Symbol* find_backup_signature(Symbol* signature_symbol);
468 // Tells whether ClassLoader.loadClassInternal is present
469 static bool has_loadClassInternal() { return _has_loadClassInternal; }
470 diff --git a/src/share/vm/classfile/verifier.cpp b/src/share/vm/classfile/verifier.cpp
471 --- a/src/share/vm/classfile/verifier.cpp
472 +++ b/src/share/vm/classfile/verifier.cpp
473 @@ -1671,19 +1671,13 @@
474 VerificationType::long_type(),
475 VerificationType::long2_type(), CHECK_VERIFY(this));
476 } else if (tag.is_method_handle()) {
477 - Symbol* methodHandle_name = vmSymbols::java_lang_invoke_MethodHandle();
478 - if (AllowTransitionalJSR292 && !Universe::is_bootstrapping())
479 - methodHandle_name = SystemDictionaryHandles::MethodHandle_klass()->name();
480 current_frame->push_stack(
481 VerificationType::reference_type(
482 - methodHandle_name), CHECK_VERIFY(this));
483 + vmSymbols::java_lang_invoke_MethodHandle()), CHECK_VERIFY(this));
484 } else if (tag.is_method_type()) {
485 - Symbol* methodType_name = vmSymbols::java_lang_invoke_MethodType();
486 - if (AllowTransitionalJSR292 && !Universe::is_bootstrapping())
487 - methodType_name = SystemDictionaryHandles::MethodType_klass()->name();
488 current_frame->push_stack(
489 VerificationType::reference_type(
490 - methodType_name), CHECK_VERIFY(this));
491 + vmSymbols::java_lang_invoke_MethodType()), CHECK_VERIFY(this));
493 verify_error(bci, "Invalid index in ldc");
495 @@ -1950,8 +1944,7 @@
496 unsigned int types = (opcode == Bytecodes::_invokeinterface
497 ? 1 << JVM_CONSTANT_InterfaceMethodref
498 : opcode == Bytecodes::_invokedynamic
499 - ? ((AllowTransitionalJSR292 ? 1 << JVM_CONSTANT_NameAndType : 0)
500 - |1 << JVM_CONSTANT_InvokeDynamic)
501 + ? 1 << JVM_CONSTANT_InvokeDynamic
502 : 1 << JVM_CONSTANT_Methodref);
503 verify_cp_type(index, cp, types, CHECK_VERIFY(this));
505 diff --git a/src/share/vm/classfile/vmSymbols.hpp b/src/share/vm/classfile/vmSymbols.hpp
506 --- a/src/share/vm/classfile/vmSymbols.hpp
507 +++ b/src/share/vm/classfile/vmSymbols.hpp
508 @@ -245,44 +245,15 @@
509 template(java_lang_invoke_AdapterMethodHandle, "java/lang/invoke/AdapterMethodHandle") \
510 template(java_lang_invoke_BoundMethodHandle, "java/lang/invoke/BoundMethodHandle") \
511 template(java_lang_invoke_DirectMethodHandle, "java/lang/invoke/DirectMethodHandle") \
512 - /* temporary transitional public names from 6839872: */ \
513 - template(java_dyn_InvokeDynamic, "java/dyn/InvokeDynamic") /* AllowTransitionalJSR292 ONLY */ \
514 - template(java_dyn_Linkage, "java/dyn/Linkage") /* AllowTransitionalJSR292 ONLY */ \
515 - template(java_dyn_CallSite, "java/dyn/CallSite") /* AllowTransitionalJSR292 ONLY */ \
516 - template(java_dyn_MethodHandle, "java/dyn/MethodHandle") /* AllowTransitionalJSR292 ONLY */ \
517 - template(java_dyn_MethodType, "java/dyn/MethodType") /* AllowTransitionalJSR292 ONLY */ \
518 - template(java_dyn_WrongMethodTypeException, "java/dyn/WrongMethodTypeException") /* AllowTransitionalJSR292 ONLY */ \
519 - template(java_dyn_MethodType_signature, "Ljava/dyn/MethodType;") /* AllowTransitionalJSR292 ONLY */ \
520 - template(java_dyn_MethodHandle_signature, "Ljava/dyn/MethodHandle;") /* AllowTransitionalJSR292 ONLY */ \
521 - /* temporary transitional internal names from 6839872: */ \
522 - template(java_dyn_MethodTypeForm, "java/dyn/MethodTypeForm") /* AllowTransitionalJSR292 ONLY */ \
523 - template(java_dyn_MethodTypeForm_signature, "Ljava/dyn/MethodTypeForm;") /* AllowTransitionalJSR292 ONLY */ \
524 - template(java_dyn_MemberName, "java/dyn/MemberName") /* AllowTransitionalJSR292 ONLY */ \
525 - template(java_dyn_MethodHandleNatives, "java/dyn/MethodHandleNatives") /* AllowTransitionalJSR292 ONLY */ \
526 - template(java_dyn_AdapterMethodHandle, "java/dyn/AdapterMethodHandle") /* AllowTransitionalJSR292 ONLY */ \
527 - template(java_dyn_BoundMethodHandle, "java/dyn/BoundMethodHandle") /* AllowTransitionalJSR292 ONLY */ \
528 - template(java_dyn_DirectMethodHandle, "java/dyn/DirectMethodHandle") /* AllowTransitionalJSR292 ONLY */ \
529 - /* temporary transitional internal names from EDR: */ \
530 - template(sun_dyn_MemberName, "sun/dyn/MemberName") /* AllowTransitionalJSR292 ONLY */ \
531 - template(sun_dyn_MethodHandleImpl, "sun/dyn/MethodHandleImpl") /* AllowTransitionalJSR292 ONLY */ \
532 - template(sun_dyn_MethodHandleNatives, "sun/dyn/MethodHandleNatives") /* AllowTransitionalJSR292 ONLY */ \
533 - template(sun_dyn_AdapterMethodHandle, "sun/dyn/AdapterMethodHandle") /* AllowTransitionalJSR292 ONLY */ \
534 - template(sun_dyn_BoundMethodHandle, "sun/dyn/BoundMethodHandle") /* AllowTransitionalJSR292 ONLY */ \
535 - template(sun_dyn_DirectMethodHandle, "sun/dyn/DirectMethodHandle") /* AllowTransitionalJSR292 ONLY */ \
536 /* internal up-calls made only by the JVM, via class sun.invoke.MethodHandleNatives: */ \
537 template(findMethodHandleType_name, "findMethodHandleType") \
538 template(findMethodHandleType_signature, "(Ljava/lang/Class;[Ljava/lang/Class;)Ljava/lang/invoke/MethodType;") \
539 - template(findMethodHandleType_TRANS_signature, "(Ljava/lang/Class;[Ljava/lang/Class;)Ljava/dyn/MethodType;") /* AllowTransitionalJSR292 ONLY */ \
540 template(notifyGenericMethodType_name, "notifyGenericMethodType") \
541 template(notifyGenericMethodType_signature, "(Ljava/lang/invoke/MethodType;)V") \
542 - template(notifyGenericMethodType_TRANS_signature, "(Ljava/dyn/MethodType;)V") /* AllowTransitionalJSR292 ONLY */ \
543 template(linkMethodHandleConstant_name, "linkMethodHandleConstant") \
544 template(linkMethodHandleConstant_signature, "(Ljava/lang/Class;ILjava/lang/Class;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/invoke/MethodHandle;") \
545 - template(linkMethodHandleConstant_TRANS_signature, "(Ljava/lang/Class;ILjava/lang/Class;Ljava/lang/String;Ljava/lang/Object;)Ljava/dyn/MethodHandle;") /* AllowTransitionalJSR292 ONLY */ \
546 template(makeDynamicCallSite_name, "makeDynamicCallSite") \
547 template(makeDynamicCallSite_signature, "(Ljava/lang/invoke/MethodHandle;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/Object;Ljava/lang/invoke/MemberName;I)Ljava/lang/invoke/CallSite;") \
548 - template(makeDynamicCallSite_TRANS_signature, "(Ljava/dyn/MethodHandle;Ljava/lang/String;Ljava/dyn/MethodType;Ljava/lang/Object;Lsun/dyn/MemberName;I)Ljava/dyn/CallSite;") /* AllowTransitionalJSR292 ONLY */ \
549 - template(makeDynamicCallSite_TRANS2_signature, "(Ljava/dyn/MethodHandle;Ljava/lang/String;Ljava/dyn/MethodType;Ljava/lang/Object;Ljava/dyn/MemberName;I)Ljava/dyn/CallSite;") /* AllowTransitionalJSR292 ONLY */ \
550 NOT_LP64( do_alias(machine_word_signature, int_signature) ) \
551 LP64_ONLY( do_alias(machine_word_signature, long_signature) ) \
554 do_intrinsic(_invoke, java_lang_reflect_Method, invoke_name, object_object_array_object_signature, F_R) \
555 /* (symbols invoke_name and invoke_signature defined above) */ \
556 do_intrinsic(_checkSpreadArgument, java_lang_invoke_MethodHandleNatives, checkSpreadArgument_name, checkSpreadArgument_signature, F_S) \
557 - do_intrinsic(_checkSpreadArgument_TRANS,sun_dyn_MethodHandleImpl, checkSpreadArgument_name, checkSpreadArgument_signature, F_S) /* AllowTransitionalJSR292 ONLY */ \
558 - do_intrinsic(_checkSpreadArgument_TRANS2,java_dyn_MethodHandleNatives, checkSpreadArgument_name, checkSpreadArgument_signature, F_S) /* AllowTransitionalJSR292 ONLY */ \
559 do_name( checkSpreadArgument_name, "checkSpreadArgument") \
560 do_name( checkSpreadArgument_signature, "(Ljava/lang/Object;I)V") \
561 do_intrinsic(_invokeExact, java_lang_invoke_MethodHandle, invokeExact_name, object_array_object_signature, F_RN) \
562 diff --git a/src/share/vm/interpreter/bytecodeTracer.cpp b/src/share/vm/interpreter/bytecodeTracer.cpp
563 --- a/src/share/vm/interpreter/bytecodeTracer.cpp
564 +++ b/src/share/vm/interpreter/bytecodeTracer.cpp
567 case JVM_CONSTANT_NameAndType:
568 case JVM_CONSTANT_InvokeDynamic:
569 - case JVM_CONSTANT_InvokeDynamicTrans:
573 diff --git a/src/share/vm/interpreter/interpreterRuntime.cpp b/src/share/vm/interpreter/interpreterRuntime.cpp
574 --- a/src/share/vm/interpreter/interpreterRuntime.cpp
575 +++ b/src/share/vm/interpreter/interpreterRuntime.cpp
580 - Symbol* java_lang_invoke_WrongMethodTypeException = vmSymbols::java_lang_invoke_WrongMethodTypeException();
581 - if (AllowTransitionalJSR292)
582 - java_lang_invoke_WrongMethodTypeException = SystemDictionaryHandles::WrongMethodTypeException_klass()->name();
583 - THROW_MSG(java_lang_invoke_WrongMethodTypeException, message);
584 + THROW_MSG(vmSymbols::java_lang_invoke_WrongMethodTypeException(), message);
588 diff --git a/src/share/vm/interpreter/linkResolver.cpp b/src/share/vm/interpreter/linkResolver.cpp
589 --- a/src/share/vm/interpreter/linkResolver.cpp
590 +++ b/src/share/vm/interpreter/linkResolver.cpp
592 // Make sure the Java part of the runtime has been booted up.
593 klassOop natives = SystemDictionary::MethodHandleNatives_klass();
594 if (natives == NULL || instanceKlass::cast(natives)->is_not_initialized()) {
595 - Symbol* natives_name = vmSymbols::java_lang_invoke_MethodHandleNatives();
596 - if (natives != NULL && AllowTransitionalJSR292) natives_name = Klass::cast(natives)->name();
597 - SystemDictionary::resolve_or_fail(natives_name,
598 + SystemDictionary::resolve_or_fail(vmSymbols::java_lang_invoke_MethodHandleNatives(),
602 diff --git a/src/share/vm/interpreter/rewriter.cpp b/src/share/vm/interpreter/rewriter.cpp
603 --- a/src/share/vm/interpreter/rewriter.cpp
604 +++ b/src/share/vm/interpreter/rewriter.cpp
606 case JVM_CONSTANT_MethodHandle : // fall through
607 case JVM_CONSTANT_MethodType : // fall through
608 case JVM_CONSTANT_InvokeDynamic : // fall through
609 - case JVM_CONSTANT_InvokeDynamicTrans: // fall through
610 add_cp_cache_entry(i);
614 "all cp cache indexes fit in a u2");
616 _have_invoke_dynamic = ((tag_mask & (1 << JVM_CONSTANT_InvokeDynamic)) != 0);
617 - _have_invoke_dynamic |= ((tag_mask & (1 << JVM_CONSTANT_InvokeDynamicTrans)) != 0);
622 if (pool_index >= 0 &&
623 _pool->tag_at(pool_index).is_invoke_dynamic()) {
624 int bsm_index = _pool->invoke_dynamic_bootstrap_method_ref_index_at(pool_index);
625 - if (bsm_index != 0) {
626 - assert(_pool->tag_at(bsm_index).is_method_handle(), "must be a MH constant");
627 - // There is a CP cache entry holding the BSM for these calls.
628 - int bsm_cache_index = cp_entry_to_cp_cache(bsm_index);
629 - cache->entry_at(i)->initialize_bootstrap_method_index_in_cache(bsm_cache_index);
631 - // There is no CP cache entry holding the BSM for these calls.
632 - // We will need to look for a class-global BSM, later.
633 - guarantee(AllowTransitionalJSR292, "");
635 + assert(_pool->tag_at(bsm_index).is_method_handle(), "must be a MH constant");
636 + // There is a CP cache entry holding the BSM for these calls.
637 + int bsm_cache_index = cp_entry_to_cp_cache(bsm_index);
638 + cache->entry_at(i)->initialize_bootstrap_method_index_in_cache(bsm_cache_index);
642 diff --git a/src/share/vm/oops/constantPoolKlass.cpp b/src/share/vm/oops/constantPoolKlass.cpp
643 --- a/src/share/vm/oops/constantPoolKlass.cpp
644 +++ b/src/share/vm/oops/constantPoolKlass.cpp
646 case JVM_CONSTANT_MethodType :
647 st->print("signature_index=%d", cp->method_type_index_at(index));
649 - case JVM_CONSTANT_InvokeDynamicTrans :
650 case JVM_CONSTANT_InvokeDynamic :
652 st->print("bootstrap_method_index=%d", cp->invoke_dynamic_bootstrap_method_ref_index_at(index));
653 diff --git a/src/share/vm/oops/constantPoolOop.cpp b/src/share/vm/oops/constantPoolOop.cpp
654 --- a/src/share/vm/oops/constantPoolOop.cpp
655 +++ b/src/share/vm/oops/constantPoolOop.cpp
656 @@ -284,17 +284,13 @@
657 if (constantPoolCacheOopDesc::is_secondary_index(which)) {
658 // Invokedynamic index.
659 int pool_index = cache()->main_entry_at(which)->constant_pool_index();
660 - if (!AllowTransitionalJSR292 || tag_at(pool_index).is_invoke_dynamic())
661 - pool_index = invoke_dynamic_name_and_type_ref_index_at(pool_index);
662 + pool_index = invoke_dynamic_name_and_type_ref_index_at(pool_index);
663 assert(tag_at(pool_index).is_name_and_type(), "");
666 // change byte-ordering and go via cache
667 i = remap_instruction_operand_from_cache(which);
669 - if (AllowTransitionalJSR292 && tag_at(which).is_name_and_type())
670 - // invokedynamic index is a simple name-and-type
672 if (tag_at(which).is_invoke_dynamic()) {
673 int pool_index = invoke_dynamic_name_and_type_ref_index_at(which);
674 assert(tag_at(pool_index).is_name_and_type(), "");
678 case JVM_CONSTANT_InvokeDynamic:
679 - case JVM_CONSTANT_InvokeDynamicTrans:
681 int k1 = invoke_dynamic_bootstrap_method_ref_index_at(index1);
682 int k2 = cp2->invoke_dynamic_bootstrap_method_ref_index_at(index2);
683 @@ -1214,13 +1209,6 @@
684 to_cp->method_handle_index_at_put(to_i, k1, k2);
687 - case JVM_CONSTANT_InvokeDynamicTrans:
689 - int k1 = from_cp->invoke_dynamic_bootstrap_method_ref_index_at(from_i);
690 - int k2 = from_cp->invoke_dynamic_name_and_type_ref_index_at(from_i);
691 - to_cp->invoke_dynamic_trans_at_put(to_i, k1, k2);
694 case JVM_CONSTANT_InvokeDynamic:
696 int k1 = from_cp->invoke_dynamic_bootstrap_specifier_index(from_i);
697 @@ -1446,7 +1434,6 @@
700 case JVM_CONSTANT_InvokeDynamic:
701 - case JVM_CONSTANT_InvokeDynamicTrans:
702 // u1 tag, u2 bsm, u2 nt
705 @@ -1661,7 +1648,6 @@
706 DBG(printf("JVM_CONSTANT_MethodType: %hd", idx1));
709 - case JVM_CONSTANT_InvokeDynamicTrans:
710 case JVM_CONSTANT_InvokeDynamic: {
712 idx1 = extract_low_short_from_int(*int_at_addr(idx));
713 diff --git a/src/share/vm/oops/constantPoolOop.hpp b/src/share/vm/oops/constantPoolOop.hpp
714 --- a/src/share/vm/oops/constantPoolOop.hpp
715 +++ b/src/share/vm/oops/constantPoolOop.hpp
717 *int_at_addr(which) = ((jint) name_and_type_index<<16) | bootstrap_specifier_index;
720 - void invoke_dynamic_trans_at_put(int which, int bootstrap_method_index, int name_and_type_index) {
721 - tag_at_put(which, JVM_CONSTANT_InvokeDynamicTrans);
722 - *int_at_addr(which) = ((jint) name_and_type_index<<16) | bootstrap_method_index;
723 - assert(AllowTransitionalJSR292, "");
726 // Temporary until actual use
727 void unresolved_string_at_put(int which, Symbol* s) {
728 release_tag_at_put(which, JVM_CONSTANT_UnresolvedString);
729 @@ -570,15 +564,11 @@
731 int invoke_dynamic_bootstrap_method_ref_index_at(int which) {
732 assert(tag_at(which).is_invoke_dynamic(), "Corrupted constant pool");
733 - if (tag_at(which).value() == JVM_CONSTANT_InvokeDynamicTrans)
734 - return extract_low_short_from_int(*int_at_addr(which));
735 int op_base = invoke_dynamic_operand_base(which);
736 return operands()->short_at(op_base + _indy_bsm_offset);
738 int invoke_dynamic_argument_count_at(int which) {
739 assert(tag_at(which).is_invoke_dynamic(), "Corrupted constant pool");
740 - if (tag_at(which).value() == JVM_CONSTANT_InvokeDynamicTrans)
742 int op_base = invoke_dynamic_operand_base(which);
743 int argc = operands()->short_at(op_base + _indy_argc_offset);
744 DEBUG_ONLY(int end_offset = op_base + _indy_argv_offset + argc;
745 diff --git a/src/share/vm/oops/cpCacheOop.cpp b/src/share/vm/oops/cpCacheOop.cpp
746 --- a/src/share/vm/oops/cpCacheOop.cpp
747 +++ b/src/share/vm/oops/cpCacheOop.cpp
751 assert(method->can_be_statically_bound(), "must be a MH invoker method");
752 - assert(AllowTransitionalJSR292 || _f2 >= constantPoolOopDesc::CPCACHE_INDEX_TAG, "BSM index initialized");
753 + assert(_f2 >= constantPoolOopDesc::CPCACHE_INDEX_TAG, "BSM index initialized");
754 // SystemDictionary::find_method_handle_invoke only caches
755 // methods which signature classes are on the boot classpath,
756 // otherwise the newly created method is returned. To avoid
757 diff --git a/src/share/vm/oops/instanceKlass.hpp b/src/share/vm/oops/instanceKlass.hpp
758 --- a/src/share/vm/oops/instanceKlass.hpp
759 +++ b/src/share/vm/oops/instanceKlass.hpp
761 typeArrayOop _inner_classes;
762 // Implementors of this interface (not valid if it overflows)
763 klassOop _implementors[implementors_limit];
764 - // invokedynamic bootstrap method (a java.lang.invoke.MethodHandle)
765 - oop _bootstrap_method; // AllowTransitionalJSR292 ONLY
766 // Annotations for this class, or null if none.
767 typeArrayOop _class_annotations;
768 // Annotation objects (byte arrays) for fields, or null if no annotations.
770 u2 method_index) { _enclosing_method_class_index = class_index;
771 _enclosing_method_method_index = method_index; }
774 - oop bootstrap_method() const { return _bootstrap_method; } // AllowTransitionalJSR292 ONLY
775 - void set_bootstrap_method(oop mh) { oop_store(&_bootstrap_method, mh); }
778 static jmethodID get_jmethod_id(instanceKlassHandle ik_h,
779 methodHandle method_h);
781 oop* adr_signers() const { return (oop*)&this->_signers;}
782 oop* adr_inner_classes() const { return (oop*)&this->_inner_classes;}
783 oop* adr_implementors() const { return (oop*)&this->_implementors[0];}
784 - oop* adr_bootstrap_method() const { return (oop*)&this->_bootstrap_method;} // AllowTransitionalJSR292 ONLY
785 oop* adr_methods_jmethod_ids() const { return (oop*)&this->_methods_jmethod_ids;}
786 oop* adr_methods_cached_itable_indices() const { return (oop*)&this->_methods_cached_itable_indices;}
787 oop* adr_class_annotations() const { return (oop*)&this->_class_annotations;}
788 diff --git a/src/share/vm/oops/instanceKlassKlass.cpp b/src/share/vm/oops/instanceKlassKlass.cpp
789 --- a/src/share/vm/oops/instanceKlassKlass.cpp
790 +++ b/src/share/vm/oops/instanceKlassKlass.cpp
792 MarkSweep::mark_and_push(ik->adr_protection_domain());
793 MarkSweep::mark_and_push(ik->adr_host_klass());
794 MarkSweep::mark_and_push(ik->adr_signers());
795 - MarkSweep::mark_and_push(ik->adr_bootstrap_method());
796 MarkSweep::mark_and_push(ik->adr_class_annotations());
797 MarkSweep::mark_and_push(ik->adr_fields_annotations());
798 MarkSweep::mark_and_push(ik->adr_methods_annotations());
800 PSParallelCompact::mark_and_push(cm, ik->adr_protection_domain());
801 PSParallelCompact::mark_and_push(cm, ik->adr_host_klass());
802 PSParallelCompact::mark_and_push(cm, ik->adr_signers());
803 - PSParallelCompact::mark_and_push(cm, ik->adr_bootstrap_method());
804 PSParallelCompact::mark_and_push(cm, ik->adr_class_annotations());
805 PSParallelCompact::mark_and_push(cm, ik->adr_fields_annotations());
806 PSParallelCompact::mark_and_push(cm, ik->adr_methods_annotations());
808 for (int i = 0; i < instanceKlass::implementors_limit; i++) {
809 blk->do_oop(&ik->adr_implementors()[i]);
811 - blk->do_oop(ik->adr_bootstrap_method());
812 blk->do_oop(ik->adr_class_annotations());
813 blk->do_oop(ik->adr_fields_annotations());
814 blk->do_oop(ik->adr_methods_annotations());
816 for (int i = 0; i < instanceKlass::implementors_limit; i++) {
817 if (mr.contains(&adr[i])) blk->do_oop(&adr[i]);
819 - adr = ik->adr_bootstrap_method();
820 - if (mr.contains(adr)) blk->do_oop(adr);
821 adr = ik->adr_class_annotations();
822 if (mr.contains(adr)) blk->do_oop(adr);
823 adr = ik->adr_fields_annotations();
825 for (int i = 0; i < instanceKlass::implementors_limit; i++) {
826 MarkSweep::adjust_pointer(&ik->adr_implementors()[i]);
828 - MarkSweep::adjust_pointer(ik->adr_bootstrap_method());
829 MarkSweep::adjust_pointer(ik->adr_class_annotations());
830 MarkSweep::adjust_pointer(ik->adr_fields_annotations());
831 MarkSweep::adjust_pointer(ik->adr_methods_annotations());
833 pm->claim_or_forward_depth(sg_addr);
836 - oop* bsm_addr = ik->adr_bootstrap_method();
837 - if (PSScavenge::should_scavenge(bsm_addr)) {
838 - pm->claim_or_forward_depth(bsm_addr);
841 klassKlass::oop_push_contents(pm, obj);
845 ik->set_breakpoints(NULL);
846 ik->init_previous_versions();
847 ik->set_generic_signature(NULL);
848 - ik->set_bootstrap_method(NULL);
849 ik->release_set_methods_jmethod_ids(NULL);
850 ik->release_set_methods_cached_itable_indices(NULL);
851 ik->set_class_annotations(NULL);
853 } // pvw is cleaned up
854 } // rm is cleaned up
856 - if (ik->bootstrap_method() != NULL) {
857 - st->print(BULLET"bootstrap method: ");
858 - ik->bootstrap_method()->print_value_on(st);
861 if (ik->generic_signature() != NULL) {
862 st->print(BULLET"generic signature: ");
863 ik->generic_signature()->print_value_on(st);
864 diff --git a/src/share/vm/oops/methodOop.cpp b/src/share/vm/oops/methodOop.cpp
865 --- a/src/share/vm/oops/methodOop.cpp
866 +++ b/src/share/vm/oops/methodOop.cpp
867 @@ -839,11 +839,11 @@
868 bool methodOopDesc::is_method_handle_invoke_name(vmSymbols::SID name_sid) {
870 case vmSymbols::VM_SYMBOL_ENUM_NAME(invokeExact_name):
871 - case vmSymbols::VM_SYMBOL_ENUM_NAME(invokeGeneric_name):
872 + case vmSymbols::VM_SYMBOL_ENUM_NAME(invoke_name):
875 - if ((AllowTransitionalJSR292 || AllowInvokeForInvokeGeneric)
876 - && name_sid == vmSymbols::VM_SYMBOL_ENUM_NAME(invoke_name))
877 + if (AllowInvokeGeneric
878 + && name_sid == vmSymbols::VM_SYMBOL_ENUM_NAME(invokeGeneric_name))
882 @@ -1079,7 +1079,6 @@
883 if (name_id == vmSymbols::NO_SID) return;
884 vmSymbols::SID sig_id = vmSymbols::find_sid(signature());
885 if (klass_id != vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_MethodHandle)
886 - && !(klass_id == vmSymbols::VM_SYMBOL_ENUM_NAME(java_dyn_MethodHandle) && AllowTransitionalJSR292)
887 && sig_id == vmSymbols::NO_SID) return;
888 jshort flags = access_flags().as_short();
890 @@ -1105,20 +1104,17 @@
893 // Signature-polymorphic methods: MethodHandle.invoke*, InvokeDynamic.*.
894 - case vmSymbols::VM_SYMBOL_ENUM_NAME(java_dyn_MethodHandle): // AllowTransitionalJSR292 ONLY
895 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_MethodHandle):
896 if (is_static() || !is_native()) break;
898 case vmSymbols::VM_SYMBOL_ENUM_NAME(invokeGeneric_name):
899 + if (!AllowInvokeGeneric) break;
900 + case vmSymbols::VM_SYMBOL_ENUM_NAME(invoke_name):
901 id = vmIntrinsics::_invokeGeneric;
903 case vmSymbols::VM_SYMBOL_ENUM_NAME(invokeExact_name):
904 id = vmIntrinsics::_invokeExact;
906 - case vmSymbols::VM_SYMBOL_ENUM_NAME(invoke_name):
907 - if (AllowInvokeForInvokeGeneric) id = vmIntrinsics::_invokeGeneric;
908 - else if (AllowTransitionalJSR292) id = vmIntrinsics::_invokeExact;
912 case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_InvokeDynamic):
913 diff --git a/src/share/vm/prims/jvm.h b/src/share/vm/prims/jvm.h
914 --- a/src/share/vm/prims/jvm.h
915 +++ b/src/share/vm/prims/jvm.h
916 @@ -1065,7 +1065,7 @@
917 JVM_CONSTANT_NameAndType,
918 JVM_CONSTANT_MethodHandle = 15, // JSR 292
919 JVM_CONSTANT_MethodType = 16, // JSR 292
920 - JVM_CONSTANT_InvokeDynamicTrans = 17, // JSR 292, only occurs in old class files
921 + //JVM_CONSTANT_(unused) = 17, // JSR 292 early drafts only
922 JVM_CONSTANT_InvokeDynamic = 18, // JSR 292
923 JVM_CONSTANT_ExternalMax = 18 // Last tag found in classfiles
925 diff --git a/src/share/vm/prims/methodHandleWalk.cpp b/src/share/vm/prims/methodHandleWalk.cpp
926 --- a/src/share/vm/prims/methodHandleWalk.cpp
927 +++ b/src/share/vm/prims/methodHandleWalk.cpp
930 // Get the intrinsic methodOop.
931 m = vmIntrinsics::method_for(iid);
932 - if (m == NULL && iid == vmIntrinsics::_checkSpreadArgument && AllowTransitionalJSR292) {
933 - m = vmIntrinsics::method_for(vmIntrinsics::_checkSpreadArgument_TRANS);
935 - // sun.dyn.MethodHandleImpl not found, look for java.dyn.MethodHandleNatives:
936 - m = vmIntrinsics::method_for(vmIntrinsics::_checkSpreadArgument_TRANS2);
940 lose(vmIntrinsics::name_at(iid), CHECK_(zero));
941 diff --git a/src/share/vm/prims/methodHandles.cpp b/src/share/vm/prims/methodHandles.cpp
942 --- a/src/share/vm/prims/methodHandles.cpp
943 +++ b/src/share/vm/prims/methodHandles.cpp
944 @@ -2488,74 +2488,21 @@
948 -JVM_ENTRY(void, MHN_registerBootstrap(JNIEnv *env, jobject igcls, jclass caller_jh, jobject bsm_jh)) {
949 - instanceKlassHandle ik = MethodHandles::resolve_instance_klass(caller_jh, THREAD);
950 - if (!AllowTransitionalJSR292) {
951 - THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
952 - "registerBootstrapMethod is only supported in JSR 292 EDR");
954 - ik->link_class(CHECK);
955 - if (!java_lang_invoke_MethodHandle::is_instance(JNIHandles::resolve(bsm_jh))) {
956 - THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "method handle");
958 - const char* err = NULL;
959 - if (ik->is_initialized() || ik->is_in_error_state()) {
960 - err = "too late: class is already initialized";
962 - ObjectLocker ol(ik, THREAD); // note: this should be a recursive lock
963 - if (ik->is_not_initialized() ||
964 - (ik->is_being_initialized() && ik->is_reentrant_initialization(THREAD))) {
965 - if (ik->bootstrap_method() != NULL) {
966 - err = "class is already equipped with a bootstrap method";
968 - ik->set_bootstrap_method(JNIHandles::resolve_non_null(bsm_jh));
972 - err = "class is already initialized";
973 - if (ik->is_being_initialized())
974 - err = "class is already being initialized in a different thread";
978 - THROW_MSG(vmSymbols::java_lang_IllegalStateException(), err);
983 -JVM_ENTRY(jobject, MHN_getBootstrap(JNIEnv *env, jobject igcls, jclass caller_jh)) {
984 - if (!AllowTransitionalJSR292)
985 - THROW_MSG_NULL(vmSymbols::java_lang_IllegalArgumentException(), "getBootstrap: transitional only");
986 - instanceKlassHandle ik = MethodHandles::resolve_instance_klass(caller_jh, THREAD);
987 - return JNIHandles::make_local(THREAD, ik->bootstrap_method());
991 -JVM_ENTRY(void, MHN_setCallSiteTarget(JNIEnv *env, jobject igcls, jobject site_jh, jobject target_jh)) {
992 - if (!AllowTransitionalJSR292)
993 - THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "setCallSite: transitional only");
998 /// JVM_RegisterMethodHandleMethods
1000 #define LANG "Ljava/lang/"
1001 -#define JLINV "Ljava/lang/invoke/" /* standard package */
1002 -#define JDYN "Ljava/dyn/" /* alternative package to JLINV if AllowTransitionalJSR292 */
1003 -#define IDYN "Lsun/dyn/" /* alternative package to JDYN if AllowTransitionalJSR292 */
1004 -// FIXME: After AllowTransitionalJSR292 is removed, replace JDYN and IDYN by JLINV.
1005 +#define JLINV "Ljava/lang/invoke/"
1007 #define OBJ LANG"Object;"
1008 #define CLS LANG"Class;"
1009 #define STRG LANG"String;"
1010 -#define CST JDYN"CallSite;"
1011 -#define MT JDYN"MethodType;"
1012 -#define MH JDYN"MethodHandle;"
1013 -#define MEM IDYN"MemberName;"
1014 -#define AMH IDYN"AdapterMethodHandle;"
1015 -#define BMH IDYN"BoundMethodHandle;"
1016 -#define DMH IDYN"DirectMethodHandle;"
1017 +#define MT JLINV"MethodType;"
1018 +#define MH JLINV"MethodHandle;"
1019 +#define MEM JLINV"MemberName;"
1020 +#define AMH JLINV"AdapterMethodHandle;"
1021 +#define BMH JLINV"BoundMethodHandle;"
1022 +#define DMH JLINV"DirectMethodHandle;"
1024 #define CC (char*) /*cast a literal from (const char*)*/
1025 #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &f)
1026 @@ -2579,39 +2526,6 @@
1027 {CC"getMembers", CC"("CLS""STRG""STRG"I"CLS"I["MEM")I", FN_PTR(MHN_getMembers)}
1030 -// FIXME: Remove methods2 after AllowTransitionalJSR292 is removed.
1031 -static JNINativeMethod methods2[] = {
1032 - {CC"registerBootstrap", CC"("CLS MH")V", FN_PTR(MHN_registerBootstrap)},
1033 - {CC"getBootstrap", CC"("CLS")"MH, FN_PTR(MHN_getBootstrap)},
1034 - {CC"setCallSiteTarget", CC"("CST MH")V", FN_PTR(MHN_setCallSiteTarget)}
1037 -static void hack_signatures(JNINativeMethod* methods, jint num_methods, const char* from_sig, const char* to_sig) {
1038 - for (int i = 0; i < num_methods; i++) {
1039 - const char* sig = methods[i].signature;
1040 - if (!strstr(sig, from_sig)) continue;
1041 - size_t buflen = strlen(sig) + 100;
1042 - char* buf = NEW_C_HEAP_ARRAY(char, buflen);
1044 - const char* sigp = sig;
1045 - size_t from_len = strlen(from_sig), to_len = strlen(to_sig);
1046 - while (*sigp != '\0') {
1047 - assert(bufp < buf + buflen - to_len - 1, "oob");
1048 - if (strncmp(sigp, from_sig, from_len) != 0) {
1049 - *bufp++ = *sigp++;
1051 - strcpy(bufp, to_sig);
1057 - methods[i].signature = buf; // replace with new signature
1058 - if (TraceMethodHandles)
1059 - tty->print_cr("MethodHandleNatives: %s: change signature %s => %s", methods[i].name, sig, buf);
1063 // This one function is exported, used by NativeLookup.
1065 JVM_ENTRY(void, JVM_RegisterMethodHandleMethods(JNIEnv *env, jclass MHN_class)) {
1066 @@ -2622,92 +2536,41 @@
1067 return; // bind nothing
1070 - if (SystemDictionary::MethodHandleNatives_klass() != NULL &&
1071 - SystemDictionary::MethodHandleNatives_klass() != java_lang_Class::as_klassOop(JNIHandles::resolve(MHN_class))) {
1072 - warning("multiple versions of MethodHandleNatives in boot classpath; consider using -XX:+PreferTransitionalJSR292");
1073 - THROW_MSG(vmSymbols::java_lang_InternalError(), "multiple versions of MethodHandleNatives in boot classpath; consider using -XX:+PreferTransitionalJSR292");
1076 bool enable_MH = true;
1078 - // Loop control. FIXME: Replace by dead reckoning after AllowTransitionalJSR292 is removed.
1079 - bool registered_natives = false;
1080 - bool try_plain = true, try_JDYN = true, try_IDYN = true;
1083 ThreadToNativeFromVM ttnfv(thread);
1085 - if (try_plain) { try_plain = false; }
1086 - else if (try_JDYN) { try_JDYN = false; hack_signatures(methods, sizeof(methods)/sizeof(JNINativeMethod), IDYN, JDYN); }
1087 - else if (try_IDYN) { try_IDYN = false; hack_signatures(methods, sizeof(methods)/sizeof(JNINativeMethod), JDYN, JLINV); }
1089 int status = env->RegisterNatives(MHN_class, methods, sizeof(methods)/sizeof(JNINativeMethod));
1090 if (env->ExceptionOccurred()) {
1091 + MethodHandles::set_enabled(false);
1092 + warning("JSR 292 method handle code is mismatched to this JVM. Disabling support.");
1093 + enable_MH = false;
1094 env->ExceptionClear();
1095 - // and try again...
1097 - registered_natives = true;
1101 - if (!registered_natives) {
1102 - MethodHandles::set_enabled(false);
1103 - warning("JSR 292 method handle code is mismatched to this JVM. Disabling support.");
1104 - enable_MH = false;
1108 - bool found_raise_exception = false;
1109 KlassHandle MHN_klass = SystemDictionaryHandles::MethodHandleNatives_klass();
1110 - KlassHandle MHI_klass = SystemDictionaryHandles::MethodHandleImpl_klass();
1111 - // Loop control. FIXME: Replace by dead reckoning after AllowTransitionalJSR292 is removed.
1112 - bool try_MHN = true, try_MHI = AllowTransitionalJSR292;
1114 - KlassHandle try_klass;
1115 - if (try_MHN) { try_MHN = false; try_klass = MHN_klass; }
1116 - else if (try_MHI) { try_MHI = false; try_klass = MHI_klass; }
1118 - if (try_klass.is_null()) continue;
1119 + if (MHN_klass.not_null()) {
1120 TempNewSymbol raiseException_name = SymbolTable::new_symbol("raiseException", CHECK);
1121 TempNewSymbol raiseException_sig = SymbolTable::new_symbol("(ILjava/lang/Object;Ljava/lang/Object;)V", CHECK);
1122 - methodOop raiseException_method = instanceKlass::cast(try_klass->as_klassOop())
1123 + methodOop raiseException_method = instanceKlass::cast(MHN_klass->as_klassOop())
1124 ->find_method(raiseException_name, raiseException_sig);
1125 if (raiseException_method != NULL && raiseException_method->is_static()) {
1126 MethodHandles::set_raise_exception_method(raiseException_method);
1127 - found_raise_exception = true;
1130 + warning("JSR 292 method handle code is mismatched to this JVM. Disabling support.");
1131 + enable_MH = false;
1134 - if (!found_raise_exception) {
1135 - warning("JSR 292 method handle code is mismatched to this JVM. Disabling support.");
1142 - if (AllowTransitionalJSR292) {
1143 - // We need to link the MethodHandleImpl klass before we generate
1144 - // the method handle adapters as the _raise_exception adapter uses
1145 - // one of its methods (and its c2i-adapter).
1146 - klassOop k = SystemDictionary::MethodHandleImpl_klass();
1148 - instanceKlass* ik = instanceKlass::cast(k);
1149 - ik->link_class(CHECK);
1153 MethodHandles::generate_adapters();
1154 MethodHandles::set_enabled(true);
1157 - if (AllowTransitionalJSR292) {
1158 - ThreadToNativeFromVM ttnfv(thread);
1160 - int status = env->RegisterNatives(MHN_class, methods2, sizeof(methods2)/sizeof(JNINativeMethod));
1161 - if (env->ExceptionOccurred()) {
1162 - // Don't do this, since it's too late:
1163 - // MethodHandles::set_enabled(false)
1164 - env->ExceptionClear();
1169 diff --git a/src/share/vm/prims/nativeLookup.cpp b/src/share/vm/prims/nativeLookup.cpp
1170 --- a/src/share/vm/prims/nativeLookup.cpp
1171 +++ b/src/share/vm/prims/nativeLookup.cpp
1174 { CC"Java_sun_misc_Unsafe_registerNatives", NULL, FN_PTR(JVM_RegisterUnsafeMethods) },
1175 { CC"Java_java_lang_invoke_MethodHandleNatives_registerNatives", NULL, FN_PTR(JVM_RegisterMethodHandleMethods) },
1176 - { CC"Java_sun_dyn_MethodHandleNatives_registerNatives", NULL, FN_PTR(JVM_RegisterMethodHandleMethods) }, // AllowTransitionalJSR292
1177 - { CC"Java_java_dyn_MethodHandleNatives_registerNatives", NULL, FN_PTR(JVM_RegisterMethodHandleMethods) }, // AllowTransitionalJSR292
1178 { CC"Java_sun_misc_Perf_registerNatives", NULL, FN_PTR(JVM_RegisterPerfMethods) }
1181 diff --git a/src/share/vm/runtime/globals.cpp b/src/share/vm/runtime/globals.cpp
1182 --- a/src/share/vm/runtime/globals.cpp
1183 +++ b/src/share/vm/runtime/globals.cpp
1186 bool Flag::is_unlocked() const {
1187 if (strcmp(kind, "{diagnostic}") == 0) {
1188 + if (strcmp(name, "EnableInvokeDynamic") == 0 && UnlockExperimentalVMOptions && !UnlockDiagnosticVMOptions) {
1189 + // transitional logic to allow tests to run until they are changed
1190 + static int warned;
1191 + if (++warned == 1) warning("Use -XX:+UnlockDiagnosticVMOptions before EnableInvokeDynamic flag");
1194 return UnlockDiagnosticVMOptions;
1195 } else if (strcmp(kind, "{experimental}") == 0 ||
1196 strcmp(kind, "{C2 experimental}") == 0) {
1197 diff --git a/src/share/vm/runtime/globals.hpp b/src/share/vm/runtime/globals.hpp
1198 --- a/src/share/vm/runtime/globals.hpp
1199 +++ b/src/share/vm/runtime/globals.hpp
1200 @@ -3735,13 +3735,7 @@
1201 experimental(bool, TrustFinalNonStaticFields, false, \
1202 "trust final non-static declarations for constant folding") \
1204 - experimental(bool, AllowTransitionalJSR292, true, \
1205 - "recognize pre-PFD formats of invokedynamic") \
1207 - experimental(bool, PreferTransitionalJSR292, false, \
1208 - "prefer pre-PFD APIs on boot class path, if they exist") \
1210 - experimental(bool, AllowInvokeForInvokeGeneric, false, \
1211 + experimental(bool, AllowInvokeGeneric, true, \
1212 "accept MethodHandle.invoke and MethodHandle.invokeGeneric " \
1213 "as equivalent methods") \
1215 diff --git a/src/share/vm/utilities/constantTag.cpp b/src/share/vm/utilities/constantTag.cpp
1216 --- a/src/share/vm/utilities/constantTag.cpp
1217 +++ b/src/share/vm/utilities/constantTag.cpp
1219 return "MethodType";
1220 case JVM_CONSTANT_InvokeDynamic :
1221 return "InvokeDynamic";
1222 - case JVM_CONSTANT_InvokeDynamicTrans :
1223 - return "InvokeDynamic/transitional";
1224 case JVM_CONSTANT_Object :
1226 case JVM_CONSTANT_Utf8 :
1227 diff --git a/src/share/vm/utilities/constantTag.hpp b/src/share/vm/utilities/constantTag.hpp
1228 --- a/src/share/vm/utilities/constantTag.hpp
1229 +++ b/src/share/vm/utilities/constantTag.hpp
1232 bool is_method_type() const { return _tag == JVM_CONSTANT_MethodType; }
1233 bool is_method_handle() const { return _tag == JVM_CONSTANT_MethodHandle; }
1234 - bool is_invoke_dynamic() const { return (_tag == JVM_CONSTANT_InvokeDynamic ||
1235 - _tag == JVM_CONSTANT_InvokeDynamicTrans); }
1236 + bool is_invoke_dynamic() const { return _tag == JVM_CONSTANT_InvokeDynamic; }
1238 bool is_loadable_constant() const {
1239 return ((_tag >= JVM_CONSTANT_Integer && _tag <= JVM_CONSTANT_String) ||
1240 diff --git a/src/share/vm/runtime/arguments.cpp b/src/share/vm/runtime/arguments.cpp
1241 --- a/src/share/vm/runtime/arguments.cpp
1242 +++ b/src/share/vm/runtime/arguments.cpp
1244 { "MaxLiveObjectEvacuationRatio",
1245 JDK_Version::jdk_update(6,24), JDK_Version::jdk(8) },
1246 { "ForceSharedSpaces", JDK_Version::jdk_update(6,25), JDK_Version::jdk(8) },
1247 + { "AllowTransitionalJSR292", JDK_Version::jdk(7), JDK_Version::jdk(8) },
1248 { NULL, JDK_Version(0), JDK_Version(0) }