6817525: turn on method handle functionality by default for JSR 292

Thu, 31 Mar 2011 02:31:57 -0700

author
twisti
date
Thu, 31 Mar 2011 02:31:57 -0700
changeset 2698
38fea01eb669
parent 2697
09f96c3ff1ad
child 2699
cb162b348743
child 2700
352622fd140a

6817525: turn on method handle functionality by default for JSR 292
Summary: After appropriate testing, we need to turn on EnableMethodHandles and EnableInvokeDynamic by default.
Reviewed-by: never, kvn, jrose, phh

src/cpu/sparc/vm/cppInterpreter_sparc.cpp file | annotate | diff | comparison | revisions
src/cpu/sparc/vm/interp_masm_sparc.cpp file | annotate | diff | comparison | revisions
src/cpu/sparc/vm/interpreter_sparc.cpp file | annotate | diff | comparison | revisions
src/cpu/sparc/vm/templateTable_sparc.cpp file | annotate | diff | comparison | revisions
src/cpu/x86/vm/interp_masm_x86_32.cpp file | annotate | diff | comparison | revisions
src/cpu/x86/vm/interp_masm_x86_64.cpp file | annotate | diff | comparison | revisions
src/cpu/x86/vm/interpreter_x86_32.cpp file | annotate | diff | comparison | revisions
src/cpu/x86/vm/interpreter_x86_64.cpp file | annotate | diff | comparison | revisions
src/cpu/x86/vm/templateInterpreter_x86_32.cpp file | annotate | diff | comparison | revisions
src/cpu/x86/vm/templateInterpreter_x86_64.cpp file | annotate | diff | comparison | revisions
src/cpu/x86/vm/templateTable_x86_32.cpp file | annotate | diff | comparison | revisions
src/cpu/x86/vm/templateTable_x86_64.cpp file | annotate | diff | comparison | revisions
src/share/vm/classfile/classFileParser.cpp file | annotate | diff | comparison | revisions
src/share/vm/classfile/classFileParser.hpp file | annotate | diff | comparison | revisions
src/share/vm/classfile/javaClasses.cpp file | annotate | diff | comparison | revisions
src/share/vm/classfile/systemDictionary.cpp file | annotate | diff | comparison | revisions
src/share/vm/classfile/systemDictionary.hpp file | annotate | diff | comparison | revisions
src/share/vm/interpreter/linkResolver.cpp file | annotate | diff | comparison | revisions
src/share/vm/oops/constantPoolKlass.cpp file | annotate | diff | comparison | revisions
src/share/vm/oops/constantPoolOop.hpp file | annotate | diff | comparison | revisions
src/share/vm/oops/instanceKlass.hpp file | annotate | diff | comparison | revisions
src/share/vm/oops/klass.cpp file | annotate | diff | comparison | revisions
src/share/vm/oops/methodOop.hpp file | annotate | diff | comparison | revisions
src/share/vm/prims/methodHandles.cpp file | annotate | diff | comparison | revisions
src/share/vm/prims/unsafe.cpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/arguments.cpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/globals.hpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/sharedRuntime.cpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/thread.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/cpu/sparc/vm/cppInterpreter_sparc.cpp	Thu Mar 31 00:27:08 2011 -0700
     1.2 +++ b/src/cpu/sparc/vm/cppInterpreter_sparc.cpp	Thu Mar 31 02:31:57 2011 -0700
     1.3 @@ -1188,8 +1188,8 @@
     1.4    __ st_ptr(O2, XXX_STATE(_stack));                // PREPUSH
     1.5  
     1.6    __ lduh(max_stack, O3);                      // Full size expression stack
     1.7 -  guarantee(!EnableMethodHandles, "no support yet for java.lang.invoke.MethodHandle"); //6815692
     1.8 -  //6815692//if (EnableMethodHandles)
     1.9 +  guarantee(!EnableInvokeDynamic, "no support yet for java.lang.invoke.MethodHandle"); //6815692
    1.10 +  //6815692//if (EnableInvokeDynamic)
    1.11    //6815692//  __ inc(O3, methodOopDesc::extra_stack_entries());
    1.12    __ sll(O3, LogBytesPerWord, O3);
    1.13    __ sub(O2, O3, O3);
     2.1 --- a/src/cpu/sparc/vm/interp_masm_sparc.cpp	Thu Mar 31 00:27:08 2011 -0700
     2.2 +++ b/src/cpu/sparc/vm/interp_masm_sparc.cpp	Thu Mar 31 02:31:57 2011 -0700
     2.3 @@ -743,12 +743,12 @@
     2.4    if (index_size == sizeof(u2)) {
     2.5      get_2_byte_integer_at_bcp(bcp_offset, cache, tmp, Unsigned);
     2.6    } else if (index_size == sizeof(u4)) {
     2.7 -    assert(EnableInvokeDynamic, "giant index used only for EnableInvokeDynamic");
     2.8 +    assert(EnableInvokeDynamic, "giant index used only for JSR 292");
     2.9      get_4_byte_integer_at_bcp(bcp_offset, cache, tmp);
    2.10      assert(constantPoolCacheOopDesc::decode_secondary_index(~123) == 123, "else change next line");
    2.11      xor3(tmp, -1, tmp);  // convert to plain index
    2.12    } else if (index_size == sizeof(u1)) {
    2.13 -    assert(EnableMethodHandles, "tiny index used only for EnableMethodHandles");
    2.14 +    assert(EnableInvokeDynamic, "tiny index used only for JSR 292");
    2.15      ldub(Lbcp, bcp_offset, tmp);
    2.16    } else {
    2.17      ShouldNotReachHere();
     3.1 --- a/src/cpu/sparc/vm/interpreter_sparc.cpp	Thu Mar 31 00:27:08 2011 -0700
     3.2 +++ b/src/cpu/sparc/vm/interpreter_sparc.cpp	Thu Mar 31 02:31:57 2011 -0700
     3.3 @@ -262,7 +262,7 @@
     3.4  // Method handle invoker
     3.5  // Dispatch a method of the form java.lang.invoke.MethodHandles::invoke(...)
     3.6  address InterpreterGenerator::generate_method_handle_entry(void) {
     3.7 -  if (!EnableMethodHandles) {
     3.8 +  if (!EnableInvokeDynamic) {
     3.9      return generate_abstract_entry();
    3.10    }
    3.11  
     4.1 --- a/src/cpu/sparc/vm/templateTable_sparc.cpp	Thu Mar 31 00:27:08 2011 -0700
     4.2 +++ b/src/cpu/sparc/vm/templateTable_sparc.cpp	Thu Mar 31 02:31:57 2011 -0700
     4.3 @@ -334,8 +334,8 @@
     4.4  void TemplateTable::fast_aldc(bool wide) {
     4.5    transition(vtos, atos);
     4.6  
     4.7 -  if (!EnableMethodHandles) {
     4.8 -    // We should not encounter this bytecode if !EnableMethodHandles.
     4.9 +  if (!EnableInvokeDynamic) {
    4.10 +    // We should not encounter this bytecode if !EnableInvokeDynamic.
    4.11      // The verifier will stop it.  However, if we get past the verifier,
    4.12      // this will stop the thread in a reasonable way, without crashing the JVM.
    4.13      __ call_VM(noreg, CAST_FROM_FN_PTR(address,
     5.1 --- a/src/cpu/x86/vm/interp_masm_x86_32.cpp	Thu Mar 31 00:27:08 2011 -0700
     5.2 +++ b/src/cpu/x86/vm/interp_masm_x86_32.cpp	Thu Mar 31 02:31:57 2011 -0700
     5.3 @@ -215,7 +215,7 @@
     5.4    if (index_size == sizeof(u2)) {
     5.5      load_unsigned_short(reg, Address(rsi, bcp_offset));
     5.6    } else if (index_size == sizeof(u4)) {
     5.7 -    assert(EnableInvokeDynamic, "giant index used only for EnableInvokeDynamic");
     5.8 +    assert(EnableInvokeDynamic, "giant index used only for JSR 292");
     5.9      movl(reg, Address(rsi, bcp_offset));
    5.10      // Check if the secondary index definition is still ~x, otherwise
    5.11      // we have to change the following assembler code to calculate the
    5.12 @@ -223,7 +223,7 @@
    5.13      assert(constantPoolCacheOopDesc::decode_secondary_index(~123) == 123, "else change next line");
    5.14      notl(reg);  // convert to plain index
    5.15    } else if (index_size == sizeof(u1)) {
    5.16 -    assert(EnableMethodHandles, "tiny index used only for EnableMethodHandles");
    5.17 +    assert(EnableInvokeDynamic, "tiny index used only for JSR 292");
    5.18      load_unsigned_byte(reg, Address(rsi, bcp_offset));
    5.19    } else {
    5.20      ShouldNotReachHere();
     6.1 --- a/src/cpu/x86/vm/interp_masm_x86_64.cpp	Thu Mar 31 00:27:08 2011 -0700
     6.2 +++ b/src/cpu/x86/vm/interp_masm_x86_64.cpp	Thu Mar 31 02:31:57 2011 -0700
     6.3 @@ -213,7 +213,7 @@
     6.4    if (index_size == sizeof(u2)) {
     6.5      load_unsigned_short(index, Address(r13, bcp_offset));
     6.6    } else if (index_size == sizeof(u4)) {
     6.7 -    assert(EnableInvokeDynamic, "giant index used only for EnableInvokeDynamic");
     6.8 +    assert(EnableInvokeDynamic, "giant index used only for JSR 292");
     6.9      movl(index, Address(r13, bcp_offset));
    6.10      // Check if the secondary index definition is still ~x, otherwise
    6.11      // we have to change the following assembler code to calculate the
    6.12 @@ -221,7 +221,7 @@
    6.13      assert(constantPoolCacheOopDesc::decode_secondary_index(~123) == 123, "else change next line");
    6.14      notl(index);  // convert to plain index
    6.15    } else if (index_size == sizeof(u1)) {
    6.16 -    assert(EnableMethodHandles, "tiny index used only for EnableMethodHandles");
    6.17 +    assert(EnableInvokeDynamic, "tiny index used only for JSR 292");
    6.18      load_unsigned_byte(index, Address(r13, bcp_offset));
    6.19    } else {
    6.20      ShouldNotReachHere();
     7.1 --- a/src/cpu/x86/vm/interpreter_x86_32.cpp	Thu Mar 31 00:27:08 2011 -0700
     7.2 +++ b/src/cpu/x86/vm/interpreter_x86_32.cpp	Thu Mar 31 02:31:57 2011 -0700
     7.3 @@ -233,7 +233,7 @@
     7.4  // Method handle invoker
     7.5  // Dispatch a method of the form java.lang.invoke.MethodHandles::invoke(...)
     7.6  address InterpreterGenerator::generate_method_handle_entry(void) {
     7.7 -  if (!EnableMethodHandles) {
     7.8 +  if (!EnableInvokeDynamic) {
     7.9      return generate_abstract_entry();
    7.10    }
    7.11  
     8.1 --- a/src/cpu/x86/vm/interpreter_x86_64.cpp	Thu Mar 31 00:27:08 2011 -0700
     8.2 +++ b/src/cpu/x86/vm/interpreter_x86_64.cpp	Thu Mar 31 02:31:57 2011 -0700
     8.3 @@ -320,7 +320,7 @@
     8.4  // Method handle invoker
     8.5  // Dispatch a method of the form java.lang.invoke.MethodHandles::invoke(...)
     8.6  address InterpreterGenerator::generate_method_handle_entry(void) {
     8.7 -  if (!EnableMethodHandles) {
     8.8 +  if (!EnableInvokeDynamic) {
     8.9      return generate_abstract_entry();
    8.10    }
    8.11  
     9.1 --- a/src/cpu/x86/vm/templateInterpreter_x86_32.cpp	Thu Mar 31 00:27:08 2011 -0700
     9.2 +++ b/src/cpu/x86/vm/templateInterpreter_x86_32.cpp	Thu Mar 31 02:31:57 2011 -0700
     9.3 @@ -1527,7 +1527,7 @@
     9.4  
     9.5    if (interpreter_frame != NULL) {
     9.6  #ifdef ASSERT
     9.7 -    if (!EnableMethodHandles)
     9.8 +    if (!EnableInvokeDynamic)
     9.9        // @@@ FIXME: Should we correct interpreter_frame_sender_sp in the calling sequences?
    9.10        // Probably, since deoptimization doesn't work yet.
    9.11        assert(caller->unextended_sp() == interpreter_frame->interpreter_frame_sender_sp(), "Frame not properly walkable");
    10.1 --- a/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Thu Mar 31 00:27:08 2011 -0700
    10.2 +++ b/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Thu Mar 31 02:31:57 2011 -0700
    10.3 @@ -1541,7 +1541,7 @@
    10.4           tempcount* Interpreter::stackElementWords + popframe_extra_args;
    10.5    if (interpreter_frame != NULL) {
    10.6  #ifdef ASSERT
    10.7 -    if (!EnableMethodHandles)
    10.8 +    if (!EnableInvokeDynamic)
    10.9        // @@@ FIXME: Should we correct interpreter_frame_sender_sp in the calling sequences?
   10.10        // Probably, since deoptimization doesn't work yet.
   10.11        assert(caller->unextended_sp() == interpreter_frame->interpreter_frame_sender_sp(), "Frame not properly walkable");
    11.1 --- a/src/cpu/x86/vm/templateTable_x86_32.cpp	Thu Mar 31 00:27:08 2011 -0700
    11.2 +++ b/src/cpu/x86/vm/templateTable_x86_32.cpp	Thu Mar 31 02:31:57 2011 -0700
    11.3 @@ -392,8 +392,8 @@
    11.4  void TemplateTable::fast_aldc(bool wide) {
    11.5    transition(vtos, atos);
    11.6  
    11.7 -  if (!EnableMethodHandles) {
    11.8 -    // We should not encounter this bytecode if !EnableMethodHandles.
    11.9 +  if (!EnableInvokeDynamic) {
   11.10 +    // We should not encounter this bytecode if !EnableInvokeDynamic.
   11.11      // The verifier will stop it.  However, if we get past the verifier,
   11.12      // this will stop the thread in a reasonable way, without crashing the JVM.
   11.13      __ call_VM(noreg, CAST_FROM_FN_PTR(address,
    12.1 --- a/src/cpu/x86/vm/templateTable_x86_64.cpp	Thu Mar 31 00:27:08 2011 -0700
    12.2 +++ b/src/cpu/x86/vm/templateTable_x86_64.cpp	Thu Mar 31 02:31:57 2011 -0700
    12.3 @@ -405,8 +405,8 @@
    12.4  void TemplateTable::fast_aldc(bool wide) {
    12.5    transition(vtos, atos);
    12.6  
    12.7 -  if (!EnableMethodHandles) {
    12.8 -    // We should not encounter this bytecode if !EnableMethodHandles.
    12.9 +  if (!EnableInvokeDynamic) {
   12.10 +    // We should not encounter this bytecode if !EnableInvokeDynamic.
   12.11      // The verifier will stop it.  However, if we get past the verifier,
   12.12      // this will stop the thread in a reasonable way, without crashing the JVM.
   12.13      __ call_VM(noreg, CAST_FROM_FN_PTR(address,
    13.1 --- a/src/share/vm/classfile/classFileParser.cpp	Thu Mar 31 00:27:08 2011 -0700
    13.2 +++ b/src/share/vm/classfile/classFileParser.cpp	Thu Mar 31 02:31:57 2011 -0700
    13.3 @@ -152,7 +152,7 @@
    13.4              "Class file version does not support constant tag %u in class file %s",
    13.5              tag, CHECK);
    13.6          }
    13.7 -        if (!EnableMethodHandles) {
    13.8 +        if (!EnableInvokeDynamic) {
    13.9            classfile_parse_error(
   13.10              "This JVM does not support constant tag %u in class file %s",
   13.11              tag, CHECK);
   13.12 @@ -260,7 +260,7 @@
   13.13              verify_legal_utf8((unsigned char*)utf8_buffer, utf8_length, CHECK);
   13.14            }
   13.15  
   13.16 -          if (AnonymousClasses && has_cp_patch_at(index)) {
   13.17 +          if (EnableInvokeDynamic && has_cp_patch_at(index)) {
   13.18              Handle patch = clear_cp_patch_at(index);
   13.19              guarantee_property(java_lang_String::is_instance(patch()),
   13.20                                 "Illegal utf8 patch at %d in class file %s",
   13.21 @@ -443,7 +443,7 @@
   13.22            int ref_index = cp->method_handle_index_at(index);
   13.23            check_property(
   13.24              valid_cp_range(ref_index, length) &&
   13.25 -                EnableMethodHandles,
   13.26 +                EnableInvokeDynamic,
   13.27                "Invalid constant pool index %u in class file %s",
   13.28                ref_index, CHECK_(nullHandle));
   13.29            constantTag tag = cp->tag_at(ref_index);
   13.30 @@ -487,7 +487,7 @@
   13.31            check_property(
   13.32              valid_cp_range(ref_index, length) &&
   13.33                  cp->tag_at(ref_index).is_utf8() &&
   13.34 -                EnableMethodHandles,
   13.35 +                EnableInvokeDynamic,
   13.36                "Invalid constant pool index %u in class file %s",
   13.37                ref_index, CHECK_(nullHandle));
   13.38          }
   13.39 @@ -522,7 +522,7 @@
   13.40  
   13.41    if (_cp_patches != NULL) {
   13.42      // need to treat this_class specially...
   13.43 -    assert(AnonymousClasses, "");
   13.44 +    assert(EnableInvokeDynamic, "");
   13.45      int this_class_index;
   13.46      {
   13.47        cfs->guarantee_more(8, CHECK_(nullHandle));  // flags, this_class, super_class, infs_len
   13.48 @@ -677,7 +677,7 @@
   13.49  
   13.50  
   13.51  void ClassFileParser::patch_constant_pool(constantPoolHandle cp, int index, Handle patch, TRAPS) {
   13.52 -  assert(AnonymousClasses, "");
   13.53 +  assert(EnableInvokeDynamic, "");
   13.54    BasicType patch_type = T_VOID;
   13.55    switch (cp->tag_at(index).value()) {
   13.56  
   13.57 @@ -2103,7 +2103,7 @@
   13.58      _has_vanilla_constructor = true;
   13.59    }
   13.60  
   13.61 -  if (EnableMethodHandles && (m->is_method_handle_invoke() ||
   13.62 +  if (EnableInvokeDynamic && (m->is_method_handle_invoke() ||
   13.63                                m->is_method_handle_adapter())) {
   13.64      THROW_MSG_(vmSymbols::java_lang_VirtualMachineError(),
   13.65                 "Method handle invokers must be defined internally to the VM", nullHandle);
   13.66 @@ -2771,7 +2771,7 @@
   13.67    // This is not particularly nice, but since there is no way to express
   13.68    // a native wordSize field in Java, we must do it at this level.
   13.69  
   13.70 -  if (!EnableMethodHandles)  return;
   13.71 +  if (!EnableInvokeDynamic)  return;
   13.72  
   13.73    int word_sig_index = 0;
   13.74    const int cp_size = cp->length();
   13.75 @@ -3191,15 +3191,15 @@
   13.76      next_nonstatic_field_offset = first_nonstatic_field_offset;
   13.77  
   13.78      // adjust the vmentry field declaration in java.lang.invoke.MethodHandle
   13.79 -    if (EnableMethodHandles && class_name == vmSymbols::java_lang_invoke_MethodHandle() && class_loader.is_null()) {
   13.80 +    if (EnableInvokeDynamic && class_name == vmSymbols::java_lang_invoke_MethodHandle() && class_loader.is_null()) {
   13.81        java_lang_invoke_MethodHandle_fix_pre(cp, fields, &fac, CHECK_(nullHandle));
   13.82      }
   13.83      if (AllowTransitionalJSR292 &&
   13.84 -        EnableMethodHandles && class_name == vmSymbols::java_dyn_MethodHandle() && class_loader.is_null()) {
   13.85 +        EnableInvokeDynamic && class_name == vmSymbols::java_dyn_MethodHandle() && class_loader.is_null()) {
   13.86        java_lang_invoke_MethodHandle_fix_pre(cp, fields, &fac, CHECK_(nullHandle));
   13.87      }
   13.88      if (AllowTransitionalJSR292 &&
   13.89 -        EnableMethodHandles && class_name == vmSymbols::sun_dyn_MethodHandleImpl() && class_loader.is_null()) {
   13.90 +        EnableInvokeDynamic && class_name == vmSymbols::sun_dyn_MethodHandleImpl() && class_loader.is_null()) {
   13.91        // allow vmentry field in MethodHandleImpl also
   13.92        java_lang_invoke_MethodHandle_fix_pre(cp, fields, &fac, CHECK_(nullHandle));
   13.93      }
    14.1 --- a/src/share/vm/classfile/classFileParser.hpp	Thu Mar 31 00:27:08 2011 -0700
    14.2 +++ b/src/share/vm/classfile/classFileParser.hpp	Thu Mar 31 02:31:57 2011 -0700
    14.3 @@ -231,11 +231,11 @@
    14.4    char* skip_over_field_signature(char* signature, bool void_ok, unsigned int length, TRAPS);
    14.5  
    14.6    bool is_anonymous() {
    14.7 -    assert(AnonymousClasses || _host_klass.is_null(), "");
    14.8 +    assert(EnableInvokeDynamic || _host_klass.is_null(), "");
    14.9      return _host_klass.not_null();
   14.10    }
   14.11    bool has_cp_patch_at(int index) {
   14.12 -    assert(AnonymousClasses, "");
   14.13 +    assert(EnableInvokeDynamic, "");
   14.14      assert(index >= 0, "oob");
   14.15      return (_cp_patches != NULL
   14.16              && index < _cp_patches->length()
   14.17 @@ -258,7 +258,7 @@
   14.18    // constant pool construction, but in later versions they can.
   14.19    // %%% Let's phase out the old is_klass_reference.
   14.20    bool is_klass_reference(constantPoolHandle cp, int index) {
   14.21 -    return ((LinkWellKnownClasses || AnonymousClasses)
   14.22 +    return ((LinkWellKnownClasses || EnableInvokeDynamic)
   14.23              ? cp->tag_at(index).is_klass_or_reference()
   14.24              : cp->tag_at(index).is_klass_reference());
   14.25    }
    15.1 --- a/src/share/vm/classfile/javaClasses.cpp	Thu Mar 31 00:27:08 2011 -0700
    15.2 +++ b/src/share/vm/classfile/javaClasses.cpp	Thu Mar 31 02:31:57 2011 -0700
    15.3 @@ -2322,7 +2322,7 @@
    15.4  
    15.5  void java_lang_invoke_MethodHandle::compute_offsets() {
    15.6    klassOop k = SystemDictionary::MethodHandle_klass();
    15.7 -  if (k != NULL && EnableMethodHandles) {
    15.8 +  if (k != NULL && EnableInvokeDynamic) {
    15.9      bool allow_super = false;
   15.10      if (AllowTransitionalJSR292)  allow_super = true;  // temporary, to access java.dyn.MethodHandleImpl
   15.11      compute_offset(_type_offset,      k, vmSymbols::type_name(),      vmSymbols::java_lang_invoke_MethodType_signature(), allow_super);
   15.12 @@ -2337,7 +2337,7 @@
   15.13  
   15.14  void java_lang_invoke_MemberName::compute_offsets() {
   15.15    klassOop k = SystemDictionary::MemberName_klass();
   15.16 -  if (k != NULL && EnableMethodHandles) {
   15.17 +  if (k != NULL && EnableInvokeDynamic) {
   15.18      compute_offset(_clazz_offset,     k, vmSymbols::clazz_name(),     vmSymbols::class_signature());
   15.19      compute_offset(_name_offset,      k, vmSymbols::name_name(),      vmSymbols::string_signature());
   15.20      compute_offset(_type_offset,      k, vmSymbols::type_name(),      vmSymbols::object_signature());
   15.21 @@ -2349,14 +2349,14 @@
   15.22  
   15.23  void java_lang_invoke_DirectMethodHandle::compute_offsets() {
   15.24    klassOop k = SystemDictionary::DirectMethodHandle_klass();
   15.25 -  if (k != NULL && EnableMethodHandles) {
   15.26 +  if (k != NULL && EnableInvokeDynamic) {
   15.27      compute_offset(_vmindex_offset,   k, vmSymbols::vmindex_name(),   vmSymbols::int_signature(),    true);
   15.28    }
   15.29  }
   15.30  
   15.31  void java_lang_invoke_BoundMethodHandle::compute_offsets() {
   15.32    klassOop k = SystemDictionary::BoundMethodHandle_klass();
   15.33 -  if (k != NULL && EnableMethodHandles) {
   15.34 +  if (k != NULL && EnableInvokeDynamic) {
   15.35      compute_offset(_vmargslot_offset, k, vmSymbols::vmargslot_name(), vmSymbols::int_signature(),    true);
   15.36      compute_offset(_argument_offset,  k, vmSymbols::argument_name(),  vmSymbols::object_signature(), true);
   15.37    }
   15.38 @@ -2364,7 +2364,7 @@
   15.39  
   15.40  void java_lang_invoke_AdapterMethodHandle::compute_offsets() {
   15.41    klassOop k = SystemDictionary::AdapterMethodHandle_klass();
   15.42 -  if (k != NULL && EnableMethodHandles) {
   15.43 +  if (k != NULL && EnableInvokeDynamic) {
   15.44      compute_offset(_conversion_offset, k, vmSymbols::conversion_name(), vmSymbols::int_signature(), true);
   15.45    }
   15.46  }
   15.47 @@ -2982,7 +2982,7 @@
   15.48    java_lang_Class::compute_offsets();
   15.49    java_lang_Thread::compute_offsets();
   15.50    java_lang_ThreadGroup::compute_offsets();
   15.51 -  if (EnableMethodHandles) {
   15.52 +  if (EnableInvokeDynamic) {
   15.53      java_lang_invoke_MethodHandle::compute_offsets();
   15.54      java_lang_invoke_MemberName::compute_offsets();
   15.55      java_lang_invoke_DirectMethodHandle::compute_offsets();
   15.56 @@ -2990,8 +2990,6 @@
   15.57      java_lang_invoke_AdapterMethodHandle::compute_offsets();
   15.58      java_lang_invoke_MethodType::compute_offsets();
   15.59      java_lang_invoke_MethodTypeForm::compute_offsets();
   15.60 -  }
   15.61 -  if (EnableInvokeDynamic) {
   15.62      java_lang_invoke_CallSite::compute_offsets();
   15.63    }
   15.64    java_security_AccessControlContext::compute_offsets();
    16.1 --- a/src/share/vm/classfile/systemDictionary.cpp	Thu Mar 31 00:27:08 2011 -0700
    16.2 +++ b/src/share/vm/classfile/systemDictionary.cpp	Thu Mar 31 02:31:57 2011 -0700
    16.3 @@ -1017,7 +1017,7 @@
    16.4    }
    16.5  
    16.6    if (host_klass.not_null() && k.not_null()) {
    16.7 -    assert(AnonymousClasses, "");
    16.8 +    assert(EnableInvokeDynamic, "");
    16.9      // If it's anonymous, initialize it now, since nobody else will.
   16.10      k->set_host_klass(host_klass());
   16.11  
   16.12 @@ -1940,7 +1940,7 @@
   16.13    }
   16.14    Symbol* backup_symbol = NULL;  // symbol to try if the current symbol fails
   16.15    if (init_opt == SystemDictionary::Pre_JSR292) {
   16.16 -    if (!EnableMethodHandles)  try_load = false;  // do not bother to load such classes
   16.17 +    if (!EnableInvokeDynamic)  try_load = false;  // do not bother to load such classes
   16.18      if (AllowTransitionalJSR292) {
   16.19        backup_symbol = find_backup_class_name(symbol);
   16.20        if (try_load && PreferTransitionalJSR292) {
   16.21 @@ -2038,25 +2038,15 @@
   16.22    instanceKlass::cast(WK_KLASS(FinalReference_klass))->set_reference_type(REF_FINAL);
   16.23    instanceKlass::cast(WK_KLASS(PhantomReference_klass))->set_reference_type(REF_PHANTOM);
   16.24  
   16.25 -  WKID meth_group_start = WK_KLASS_ENUM_NAME(MethodHandle_klass);
   16.26 -  WKID meth_group_end   = WK_KLASS_ENUM_NAME(WrongMethodTypeException_klass);
   16.27 -  initialize_wk_klasses_until(meth_group_start, scan, CHECK);
   16.28 -  if (EnableMethodHandles) {
   16.29 -    initialize_wk_klasses_through(meth_group_end, scan, CHECK);
   16.30 -  }
   16.31 -  if (_well_known_klasses[meth_group_start] == NULL) {
   16.32 -    // Skip the rest of the method handle classes, if MethodHandle is not loaded.
   16.33 -    scan = WKID(meth_group_end+1);
   16.34 -  }
   16.35 -  WKID indy_group_start = WK_KLASS_ENUM_NAME(Linkage_klass);
   16.36 -  WKID indy_group_end   = WK_KLASS_ENUM_NAME(CallSite_klass);
   16.37 -  initialize_wk_klasses_until(indy_group_start, scan, CHECK);
   16.38 +  // JSR 292 classes
   16.39 +  WKID jsr292_group_start = WK_KLASS_ENUM_NAME(MethodHandle_klass);
   16.40 +  WKID jsr292_group_end   = WK_KLASS_ENUM_NAME(CallSite_klass);
   16.41 +  initialize_wk_klasses_until(jsr292_group_start, scan, CHECK);
   16.42    if (EnableInvokeDynamic) {
   16.43 -    initialize_wk_klasses_through(indy_group_end, scan, CHECK);
   16.44 -  }
   16.45 -  if (_well_known_klasses[indy_group_start] == NULL) {
   16.46 -    // Skip the rest of the dynamic typing classes, if Linkage is not loaded.
   16.47 -    scan = WKID(indy_group_end+1);
   16.48 +    initialize_wk_klasses_through(jsr292_group_end, scan, CHECK);
   16.49 +  } else {
   16.50 +    // Skip the JSR 292 classes, if not enabled.
   16.51 +    scan = WKID(jsr292_group_end + 1);
   16.52    }
   16.53  
   16.54    initialize_wk_klasses_until(WKID_LIMIT, scan, CHECK);
   16.55 @@ -2407,7 +2397,7 @@
   16.56                                                        Symbol* signature,
   16.57                                                        KlassHandle accessing_klass,
   16.58                                                        TRAPS) {
   16.59 -  if (!EnableMethodHandles)  return NULL;
   16.60 +  if (!EnableInvokeDynamic)  return NULL;
   16.61    vmSymbols::SID name_id = vmSymbols::find_sid(name);
   16.62    assert(name_id != vmSymbols::NO_SID, "must be a known name");
   16.63    unsigned int hash  = invoke_method_table()->compute_hash(signature, name_id);
    17.1 --- a/src/share/vm/classfile/systemDictionary.hpp	Thu Mar 31 00:27:08 2011 -0700
    17.2 +++ b/src/share/vm/classfile/systemDictionary.hpp	Thu Mar 31 02:31:57 2011 -0700
    17.3 @@ -207,7 +207,7 @@
    17.4  
    17.5    enum InitOption {
    17.6      Pre,                        // preloaded; error if not present
    17.7 -    Pre_JSR292,                 // preloaded if EnableMethodHandles
    17.8 +    Pre_JSR292,                 // preloaded if EnableInvokeDynamic
    17.9  
   17.10      // Order is significant.  Options before this point require resolve_or_fail.
   17.11      // Options after this point will use resolve_or_null instead.
    18.1 --- a/src/share/vm/interpreter/linkResolver.cpp	Thu Mar 31 00:27:08 2011 -0700
    18.2 +++ b/src/share/vm/interpreter/linkResolver.cpp	Thu Mar 31 02:31:57 2011 -0700
    18.3 @@ -176,7 +176,7 @@
    18.4  
    18.5  void LinkResolver::lookup_method_in_klasses(methodHandle& result, KlassHandle klass, Symbol* name, Symbol* signature, TRAPS) {
    18.6    methodOop result_oop = klass->uncached_lookup_method(name, signature);
    18.7 -  if (EnableMethodHandles && result_oop != NULL) {
    18.8 +  if (EnableInvokeDynamic && result_oop != NULL) {
    18.9      switch (result_oop->intrinsic_id()) {
   18.10      case vmIntrinsics::_invokeExact:
   18.11      case vmIntrinsics::_invokeGeneric:
   18.12 @@ -214,7 +214,7 @@
   18.13                                            KlassHandle klass, Symbol* name, Symbol* signature,
   18.14                                            KlassHandle current_klass,
   18.15                                            TRAPS) {
   18.16 -  if (EnableMethodHandles &&
   18.17 +  if (EnableInvokeDynamic &&
   18.18        klass() == SystemDictionary::MethodHandle_klass() &&
   18.19        methodOopDesc::is_method_handle_invoke_name(name)) {
   18.20      if (!THREAD->is_Compiler_thread() && !MethodHandles::enabled()) {
    19.1 --- a/src/share/vm/oops/constantPoolKlass.cpp	Thu Mar 31 00:27:08 2011 -0700
    19.2 +++ b/src/share/vm/oops/constantPoolKlass.cpp	Thu Mar 31 02:31:57 2011 -0700
    19.3 @@ -286,7 +286,7 @@
    19.4    assert(obj->is_constantPool(), "should be constant pool");
    19.5    constantPoolOop cp = (constantPoolOop) obj;
    19.6    if (cp->tags() != NULL &&
    19.7 -      (!JavaObjectsInPerm || (AnonymousClasses && cp->has_pseudo_string()))) {
    19.8 +      (!JavaObjectsInPerm || (EnableInvokeDynamic && cp->has_pseudo_string()))) {
    19.9      for (int i = 1; i < cp->length(); ++i) {
   19.10        if (cp->tag_at(i).is_string()) {
   19.11          oop* base = cp->obj_at_addr_raw(i);
    20.1 --- a/src/share/vm/oops/constantPoolOop.hpp	Thu Mar 31 00:27:08 2011 -0700
    20.2 +++ b/src/share/vm/oops/constantPoolOop.hpp	Thu Mar 31 02:31:57 2011 -0700
    20.3 @@ -1,5 +1,5 @@
    20.4  /*
    20.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    20.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    20.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    20.8   *
    20.9   * This code is free software; you can redistribute it and/or modify it
   20.10 @@ -429,7 +429,7 @@
   20.11  
   20.12    // A "pseudo-string" is an non-string oop that has found is way into
   20.13    // a String entry.
   20.14 -  // Under AnonymousClasses this can happen if the user patches a live
   20.15 +  // Under EnableInvokeDynamic this can happen if the user patches a live
   20.16    // object into a CONSTANT_String entry of an anonymous class.
   20.17    // Method oops internally created for method handles may also
   20.18    // use pseudo-strings to link themselves to related metaobjects.
   20.19 @@ -442,7 +442,7 @@
   20.20    }
   20.21  
   20.22    void pseudo_string_at_put(int which, oop x) {
   20.23 -    assert(AnonymousClasses, "");
   20.24 +    assert(EnableInvokeDynamic, "");
   20.25      set_pseudo_string();        // mark header
   20.26      assert(tag_at(which).is_string() || tag_at(which).is_unresolved_string(), "Corrupted constant pool");
   20.27      string_at_put(which, x);    // this works just fine
    21.1 --- a/src/share/vm/oops/instanceKlass.hpp	Thu Mar 31 00:27:08 2011 -0700
    21.2 +++ b/src/share/vm/oops/instanceKlass.hpp	Thu Mar 31 02:31:57 2011 -0700
    21.3 @@ -182,7 +182,7 @@
    21.4    // Protection domain.
    21.5    oop             _protection_domain;
    21.6    // Host class, which grants its access privileges to this class also.
    21.7 -  // This is only non-null for an anonymous class (AnonymousClasses enabled).
    21.8 +  // This is only non-null for an anonymous class (JSR 292 enabled).
    21.9    // The host class is either named, or a previously loaded anonymous class.
   21.10    klassOop        _host_klass;
   21.11    // Class signers.
    22.1 --- a/src/share/vm/oops/klass.cpp	Thu Mar 31 00:27:08 2011 -0700
    22.2 +++ b/src/share/vm/oops/klass.cpp	Thu Mar 31 02:31:57 2011 -0700
    22.3 @@ -500,7 +500,7 @@
    22.4    if (oop_is_instance()) {
    22.5      instanceKlass* ik = (instanceKlass*) this;
    22.6      if (ik->is_anonymous()) {
    22.7 -      assert(AnonymousClasses, "");
    22.8 +      assert(EnableInvokeDynamic, "");
    22.9        intptr_t hash = ik->java_mirror()->identity_hash();
   22.10        char     hash_buf[40];
   22.11        sprintf(hash_buf, "/" UINTX_FORMAT, (uintx)hash);
    23.1 --- a/src/share/vm/oops/methodOop.hpp	Thu Mar 31 00:27:08 2011 -0700
    23.2 +++ b/src/share/vm/oops/methodOop.hpp	Thu Mar 31 02:31:57 2011 -0700
    23.3 @@ -607,7 +607,7 @@
    23.4    // method handles want to be able to push a few extra values (e.g., a bound receiver), and
    23.5    // invokedynamic sometimes needs to push a bootstrap method, call site, and arglist,
    23.6    // all without checking for a stack overflow
    23.7 -  static int extra_stack_entries() { return (EnableMethodHandles ? (int)MethodHandlePushLimit : 0) + (EnableInvokeDynamic ? 3 : 0); }
    23.8 +  static int extra_stack_entries() { return EnableInvokeDynamic ? (int) MethodHandlePushLimit + 3 : 0; }
    23.9    static int extra_stack_words();  // = extra_stack_entries() * Interpreter::stackElementSize()
   23.10  
   23.11    // RedefineClasses() support:
    24.1 --- a/src/share/vm/prims/methodHandles.cpp	Thu Mar 31 00:27:08 2011 -0700
    24.2 +++ b/src/share/vm/prims/methodHandles.cpp	Thu Mar 31 02:31:57 2011 -0700
    24.3 @@ -112,7 +112,7 @@
    24.4  // MethodHandles::generate_adapters
    24.5  //
    24.6  void MethodHandles::generate_adapters() {
    24.7 -  if (!EnableMethodHandles || SystemDictionary::MethodHandle_klass() == NULL)  return;
    24.8 +  if (!EnableInvokeDynamic || SystemDictionary::MethodHandle_klass() == NULL)  return;
    24.9  
   24.10    assert(_adapter_code == NULL, "generate only once");
   24.11  
   24.12 @@ -143,7 +143,7 @@
   24.13  
   24.14  void MethodHandles::set_enabled(bool z) {
   24.15    if (_enabled != z) {
   24.16 -    guarantee(z && EnableMethodHandles, "can only enable once, and only if -XX:+EnableMethodHandles");
   24.17 +    guarantee(z && EnableInvokeDynamic, "can only enable once, and only if -XX:+EnableInvokeDynamic");
   24.18      _enabled = z;
   24.19    }
   24.20  }
   24.21 @@ -2579,7 +2579,6 @@
   24.22    {CC"getMembers",              CC"("CLS""STRG""STRG"I"CLS"I["MEM")I",  FN_PTR(MHN_getMembers)}
   24.23  };
   24.24  
   24.25 -// More entry points specifically for EnableInvokeDynamic.
   24.26  // FIXME: Remove methods2 after AllowTransitionalJSR292 is removed.
   24.27  static JNINativeMethod methods2[] = {
   24.28    {CC"registerBootstrap",       CC"("CLS MH")V",                FN_PTR(MHN_registerBootstrap)},
   24.29 @@ -2618,10 +2617,8 @@
   24.30  JVM_ENTRY(void, JVM_RegisterMethodHandleMethods(JNIEnv *env, jclass MHN_class)) {
   24.31    assert(MethodHandles::spot_check_entry_names(), "entry enum is OK");
   24.32  
   24.33 -  // note: this explicit warning-producing stuff will be replaced by auto-detection of the JSR 292 classes
   24.34 -
   24.35 -  if (!EnableMethodHandles) {
   24.36 -    warning("JSR 292 method handles are disabled in this JVM.  Use -XX:+UnlockExperimentalVMOptions -XX:+EnableMethodHandles to enable.");
   24.37 +  if (!EnableInvokeDynamic) {
   24.38 +    warning("JSR 292 is disabled in this JVM.  Use -XX:+UnlockDiagnosticVMOptions -XX:+EnableInvokeDynamic to enable.");
   24.39      return;  // bind nothing
   24.40    }
   24.41  
   24.42 @@ -2702,11 +2699,6 @@
   24.43      MethodHandles::set_enabled(true);
   24.44    }
   24.45  
   24.46 -  if (!EnableInvokeDynamic) {
   24.47 -    warning("JSR 292 invokedynamic is disabled in this JVM.  Use -XX:+UnlockExperimentalVMOptions -XX:+EnableInvokeDynamic to enable.");
   24.48 -    return;  // bind nothing
   24.49 -  }
   24.50 -
   24.51    if (AllowTransitionalJSR292) {
   24.52      ThreadToNativeFromVM ttnfv(thread);
   24.53  
    25.1 --- a/src/share/vm/prims/unsafe.cpp	Thu Mar 31 00:27:08 2011 -0700
    25.2 +++ b/src/share/vm/prims/unsafe.cpp	Thu Mar 31 02:31:57 2011 -0700
    25.3 @@ -1560,7 +1560,7 @@
    25.4          }
    25.5        }
    25.6      }
    25.7 -    if (AnonymousClasses) {
    25.8 +    if (EnableInvokeDynamic) {
    25.9        env->RegisterNatives(unsafecls, anonk_methods, sizeof(anonk_methods)/sizeof(JNINativeMethod));
   25.10        if (env->ExceptionOccurred()) {
   25.11          if (PrintMiscellaneous && (Verbose || WizardMode)) {
    26.1 --- a/src/share/vm/runtime/arguments.cpp	Thu Mar 31 00:27:08 2011 -0700
    26.2 +++ b/src/share/vm/runtime/arguments.cpp	Thu Mar 31 02:31:57 2011 -0700
    26.3 @@ -2974,21 +2974,28 @@
    26.4    }
    26.5  #endif // PRODUCT
    26.6  
    26.7 -  if (EnableInvokeDynamic && !EnableMethodHandles) {
    26.8 -    if (!FLAG_IS_DEFAULT(EnableMethodHandles)) {
    26.9 -      warning("forcing EnableMethodHandles true because EnableInvokeDynamic is true");
   26.10 +  // Transitional
   26.11 +  if (EnableMethodHandles || AnonymousClasses) {
   26.12 +    if (!EnableInvokeDynamic && !FLAG_IS_DEFAULT(EnableInvokeDynamic)) {
   26.13 +      warning("EnableMethodHandles and AnonymousClasses are obsolete.  Keeping EnableInvokeDynamic disabled.");
   26.14 +    } else {
   26.15 +      EnableInvokeDynamic = true;
   26.16      }
   26.17 -    EnableMethodHandles = true;
   26.18    }
   26.19 -  if (EnableMethodHandles && !AnonymousClasses) {
   26.20 -    if (!FLAG_IS_DEFAULT(AnonymousClasses)) {
   26.21 -      warning("forcing AnonymousClasses true because EnableMethodHandles is true");
   26.22 +
   26.23 +  // JSR 292 is not supported before 1.7
   26.24 +  if (!JDK_Version::is_gte_jdk17x_version()) {
   26.25 +    if (EnableInvokeDynamic) {
   26.26 +      if (!FLAG_IS_DEFAULT(EnableInvokeDynamic)) {
   26.27 +        warning("JSR 292 is not supported before 1.7.  Disabling support.");
   26.28 +      }
   26.29 +      EnableInvokeDynamic = false;
   26.30      }
   26.31 -    AnonymousClasses = true;
   26.32    }
   26.33 -  if ((EnableMethodHandles || AnonymousClasses) && ScavengeRootsInCode == 0) {
   26.34 +
   26.35 +  if (EnableInvokeDynamic && ScavengeRootsInCode == 0) {
   26.36      if (!FLAG_IS_DEFAULT(ScavengeRootsInCode)) {
   26.37 -      warning("forcing ScavengeRootsInCode non-zero because EnableMethodHandles or AnonymousClasses is true");
   26.38 +      warning("forcing ScavengeRootsInCode non-zero because EnableInvokeDynamic is true");
   26.39      }
   26.40      ScavengeRootsInCode = 1;
   26.41    }
    27.1 --- a/src/share/vm/runtime/globals.hpp	Thu Mar 31 00:27:08 2011 -0700
    27.2 +++ b/src/share/vm/runtime/globals.hpp	Thu Mar 31 02:31:57 2011 -0700
    27.3 @@ -3693,11 +3693,15 @@
    27.4            "Skip assert() and verify() which page-in unwanted shared "       \
    27.5            "objects. ")                                                      \
    27.6                                                                              \
    27.7 +  diagnostic(bool, EnableInvokeDynamic, true,                               \
    27.8 +          "support JSR 292 (method handles, invokedynamic, "                \
    27.9 +          "anonymous classes")                                              \
   27.10 +                                                                            \
   27.11    product(bool, AnonymousClasses, false,                                    \
   27.12 -          "support sun.misc.Unsafe.defineAnonymousClass")                   \
   27.13 +          "support sun.misc.Unsafe.defineAnonymousClass (deprecated)")      \
   27.14                                                                              \
   27.15    experimental(bool, EnableMethodHandles, false,                            \
   27.16 -          "support method handles (true by default under JSR 292)")         \
   27.17 +          "support method handles (deprecated)")                            \
   27.18                                                                              \
   27.19    diagnostic(intx, MethodHandlePushLimit, 3,                                \
   27.20            "number of additional stack slots a method handle may push")      \
   27.21 @@ -3714,9 +3718,6 @@
   27.22    experimental(bool, TrustFinalNonStaticFields, false,                      \
   27.23            "trust final non-static declarations for constant folding")       \
   27.24                                                                              \
   27.25 -  experimental(bool, EnableInvokeDynamic, false,                            \
   27.26 -          "recognize the invokedynamic instruction")                        \
   27.27 -                                                                            \
   27.28    experimental(bool, AllowTransitionalJSR292, true,                         \
   27.29            "recognize pre-PFD formats of invokedynamic")                     \
   27.30                                                                              \
    28.1 --- a/src/share/vm/runtime/sharedRuntime.cpp	Thu Mar 31 00:27:08 2011 -0700
    28.2 +++ b/src/share/vm/runtime/sharedRuntime.cpp	Thu Mar 31 02:31:57 2011 -0700
    28.3 @@ -1682,7 +1682,7 @@
    28.4      tty->print_cr("WrongMethodType thread="PTR_FORMAT" req="PTR_FORMAT" act="PTR_FORMAT"",
    28.5                    thread, required, actual);
    28.6    }
    28.7 -  assert(EnableMethodHandles, "");
    28.8 +  assert(EnableInvokeDynamic, "");
    28.9    oop singleKlass = wrong_method_type_is_for_single_argument(thread, required);
   28.10    char* message = NULL;
   28.11    if (singleKlass != NULL) {
    29.1 --- a/src/share/vm/runtime/thread.cpp	Thu Mar 31 00:27:08 2011 -0700
    29.2 +++ b/src/share/vm/runtime/thread.cpp	Thu Mar 31 02:31:57 2011 -0700
    29.3 @@ -3229,7 +3229,7 @@
    29.4        warning("java.lang.ArithmeticException has not been initialized");
    29.5        warning("java.lang.StackOverflowError has not been initialized");
    29.6      }
    29.7 -    }
    29.8 +  }
    29.9  
   29.10    // See        : bugid 4211085.
   29.11    // Background : the static initializer of java.lang.Compiler tries to read

mercurial