hotspot/src/share/vm/ci/ciEnv.cpp
changeset 4566 b363f6ef4068
parent 4450 6d700b859b3e
child 4567 7fc02fbe5c7a
equal deleted inserted replaced
4565:cbb3fed38514 4566:b363f6ef4068
    39 ciObjArrayKlassKlass*  ciEnv::_obj_array_klass_klass_instance;
    39 ciObjArrayKlassKlass*  ciEnv::_obj_array_klass_klass_instance;
    40 
    40 
    41 ciInstanceKlass* ciEnv::_ArrayStoreException;
    41 ciInstanceKlass* ciEnv::_ArrayStoreException;
    42 ciInstanceKlass* ciEnv::_Class;
    42 ciInstanceKlass* ciEnv::_Class;
    43 ciInstanceKlass* ciEnv::_ClassCastException;
    43 ciInstanceKlass* ciEnv::_ClassCastException;
       
    44 ciInstanceKlass* ciEnv::_InvokeDynamic;
    44 ciInstanceKlass* ciEnv::_Object;
    45 ciInstanceKlass* ciEnv::_Object;
    45 ciInstanceKlass* ciEnv::_Throwable;
    46 ciInstanceKlass* ciEnv::_Throwable;
    46 ciInstanceKlass* ciEnv::_Thread;
    47 ciInstanceKlass* ciEnv::_Thread;
    47 ciInstanceKlass* ciEnv::_OutOfMemoryError;
    48 ciInstanceKlass* ciEnv::_OutOfMemoryError;
    48 ciInstanceKlass* ciEnv::_String;
    49 ciInstanceKlass* ciEnv::_String;
   734                              get_object(sig_sym)->as_symbol());
   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 // ciEnv::get_instance_klass_for_declared_method_holder
   769 // ciEnv::get_instance_klass_for_declared_method_holder
   740 ciInstanceKlass* ciEnv::get_instance_klass_for_declared_method_holder(ciKlass* method_holder) {
   770 ciInstanceKlass* ciEnv::get_instance_klass_for_declared_method_holder(ciKlass* method_holder) {
   741   // For the case of <array>.clone(), the method holder can be a ciArrayKlass
   771   // For the case of <array>.clone(), the method holder can be a ciArrayKlass
   742   // instead of a ciInstanceKlass.  For that case simply pretend that the
   772   // instead of a ciInstanceKlass.  For that case simply pretend that the
   743   // declared holder is Object.clone since that's where the call will bottom out.
   773   // declared holder is Object.clone since that's where the call will bottom out.
   755   }
   785   }
   756   return NULL;
   786   return NULL;
   757 }
   787 }
   758 
   788 
   759 
   789 
   760 
       
   761 
       
   762 // ------------------------------------------------------------------
   790 // ------------------------------------------------------------------
   763 // ciEnv::get_method_by_index
   791 // ciEnv::get_method_by_index
   764 ciMethod* ciEnv::get_method_by_index(ciInstanceKlass* accessor,
   792 ciMethod* ciEnv::get_method_by_index(ciInstanceKlass* accessor,
   765                                      int index, Bytecodes::Code bc) {
   793                                      int index, Bytecodes::Code bc) {
   766   GUARDED_VM_ENTRY(return get_method_by_index_impl(accessor, index, bc);)
   794   if (bc == Bytecodes::_invokedynamic) {
   767 }
   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   }
       
   799 }
       
   800 
   768 
   801 
   769 // ------------------------------------------------------------------
   802 // ------------------------------------------------------------------
   770 // ciEnv::name_buffer
   803 // ciEnv::name_buffer
   771 char *ciEnv::name_buffer(int req_len) {
   804 char *ciEnv::name_buffer(int req_len) {
   772   if (_name_buffer_len < req_len) {
   805   if (_name_buffer_len < req_len) {