Print this page
rev 1082 : [mq]: indy.compiler.patch

Split Close
Expand all
Collapse all
          --- old/src/share/vm/ci/ciEnv.cpp
          +++ new/src/share/vm/ci/ciEnv.cpp
↓ open down ↓ 33 lines elided ↑ open up ↑
  34   34  ciMethodKlass*         ciEnv::_method_klass_instance;
  35   35  ciSymbolKlass*         ciEnv::_symbol_klass_instance;
  36   36  ciKlassKlass*          ciEnv::_klass_klass_instance;
  37   37  ciInstanceKlassKlass*  ciEnv::_instance_klass_klass_instance;
  38   38  ciTypeArrayKlassKlass* ciEnv::_type_array_klass_klass_instance;
  39   39  ciObjArrayKlassKlass*  ciEnv::_obj_array_klass_klass_instance;
  40   40  
  41   41  ciInstanceKlass* ciEnv::_ArrayStoreException;
  42   42  ciInstanceKlass* ciEnv::_Class;
  43   43  ciInstanceKlass* ciEnv::_ClassCastException;
       44 +ciInstanceKlass* ciEnv::_InvokeDynamic;
  44   45  ciInstanceKlass* ciEnv::_Object;
  45   46  ciInstanceKlass* ciEnv::_Throwable;
  46   47  ciInstanceKlass* ciEnv::_Thread;
  47   48  ciInstanceKlass* ciEnv::_OutOfMemoryError;
  48   49  ciInstanceKlass* ciEnv::_String;
  49   50  ciInstanceKlass* ciEnv::_StringBuffer;
  50   51  ciInstanceKlass* ciEnv::_StringBuilder;
  51   52  ciInstanceKlass* ciEnv::_Integer;
  52   53  
  53   54  ciSymbol*        ciEnv::_unloaded_cisymbol = NULL;
↓ open down ↓ 675 lines elided ↑ open up ↑
 729  730    // not be found.  Create a dummy ciMethod to represent the failed
 730  731    // lookup.
 731  732  
 732  733    return get_unloaded_method(declared_holder,
 733  734                               get_object(name_sym)->as_symbol(),
 734  735                               get_object(sig_sym)->as_symbol());
 735  736  }
 736  737  
 737  738  
 738  739  // ------------------------------------------------------------------
      740 +// ciEnv::get_fake_invokedynamic_method_impl
      741 +ciMethod* ciEnv::get_fake_invokedynamic_method_impl(ciInstanceKlass* accessor,
      742 +                                                    int index, Bytecodes::Code bc) {
      743 +  assert(bc == Bytecodes::_invokedynamic, "must be invokedynamic");
      744 +  assert(accessor->get_instanceKlass()->is_linked(), "must be linked before accessing constant pool");
      745 +  constantPoolHandle cpool = accessor->get_instanceKlass()->constants();
      746 +
      747 +  // Get the CallSite from the constant pool cache.
      748 +  ConstantPoolCacheEntry* cpc_entry = cpool->cache()->secondary_entry_at(index);
      749 +  assert(cpc_entry != NULL && cpc_entry->is_secondary_entry(), "sanity");
      750 +  Handle call_site = cpc_entry->f1();
      751 +
      752 +  // Call site might not be linked yet.
      753 +  if (call_site.is_null()) {
      754 +    ciInstanceKlass* mh_klass = get_object(SystemDictionary::MethodHandle_klass())->as_instance_klass();
      755 +    ciSymbol*       sig_sym   = get_object(cpool->signature_ref_at(index))->as_symbol();
      756 +    return get_unloaded_method(mh_klass, ciSymbol::invoke_name(), sig_sym);
      757 +  }
      758 +
      759 +  // Get the methodOop from the CallSite.
      760 +  methodOop method_oop = (methodOop) java_dyn_CallSite::vmmethod(call_site());
      761 +  assert(method_oop != NULL, "sanity");
      762 +  assert(method_oop->is_method_handle_invoke(), "consistent");
      763 +
      764 +  return get_object(method_oop)->as_method();
      765 +}
      766 +
      767 +
      768 +// ------------------------------------------------------------------
 739  769  // ciEnv::get_instance_klass_for_declared_method_holder
 740  770  ciInstanceKlass* ciEnv::get_instance_klass_for_declared_method_holder(ciKlass* method_holder) {
 741  771    // For the case of <array>.clone(), the method holder can be a ciArrayKlass
 742  772    // instead of a ciInstanceKlass.  For that case simply pretend that the
 743  773    // declared holder is Object.clone since that's where the call will bottom out.
 744  774    // A more correct fix would trickle out through many interfaces in CI,
 745  775    // requiring ciInstanceKlass* to become ciKlass* and many more places would
 746  776    // require checks to make sure the expected type was found.  Given that this
 747  777    // only occurs for clone() the more extensive fix seems like overkill so
 748  778    // instead we simply smear the array type into Object.
↓ open down ↓ 1 lines elided ↑ open up ↑
 750  780      return method_holder->as_instance_klass();
 751  781    } else if (method_holder->is_array_klass()) {
 752  782      return current()->Object_klass();
 753  783    } else {
 754  784      ShouldNotReachHere();
 755  785    }
 756  786    return NULL;
 757  787  }
 758  788  
 759  789  
 760      -
 761      -
 762  790  // ------------------------------------------------------------------
 763  791  // ciEnv::get_method_by_index
 764  792  ciMethod* ciEnv::get_method_by_index(ciInstanceKlass* accessor,
 765  793                                       int index, Bytecodes::Code bc) {
 766      -  GUARDED_VM_ENTRY(return get_method_by_index_impl(accessor, index, bc);)
      794 +  if (bc == Bytecodes::_invokedynamic) {
      795 +    GUARDED_VM_ENTRY(return get_fake_invokedynamic_method_impl(accessor, index, bc);)
      796 +  } else {
      797 +    GUARDED_VM_ENTRY(return get_method_by_index_impl(accessor, index, bc);)
      798 +  }
 767  799  }
 768  800  
      801 +
 769  802  // ------------------------------------------------------------------
 770  803  // ciEnv::name_buffer
 771  804  char *ciEnv::name_buffer(int req_len) {
 772  805    if (_name_buffer_len < req_len) {
 773  806      if (_name_buffer == NULL) {
 774  807        _name_buffer = (char*)arena()->Amalloc(sizeof(char)*req_len);
 775  808        _name_buffer_len = req_len;
 776  809      } else {
 777  810        _name_buffer =
 778  811          (char*)arena()->Arealloc(_name_buffer, _name_buffer_len, req_len);
↓ open down ↓ 303 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX