src/hotspot/share/ci/ciStreams.cpp
changeset 59056 15936b142f86
parent 53746 bdccafc038a2
equal deleted inserted replaced
59055:57ad70bcf06c 59056:15936b142f86
   184 //
   184 //
   185 // If this bytecode is a new, newarray, multianewarray, instanceof,
   185 // If this bytecode is a new, newarray, multianewarray, instanceof,
   186 // or checkcast, get the referenced klass.
   186 // or checkcast, get the referenced klass.
   187 ciKlass* ciBytecodeStream::get_klass(bool& will_link) {
   187 ciKlass* ciBytecodeStream::get_klass(bool& will_link) {
   188   VM_ENTRY_MARK;
   188   VM_ENTRY_MARK;
   189   constantPoolHandle cpool(_method->get_Method()->constants());
   189   constantPoolHandle cpool(THREAD, _method->get_Method()->constants());
   190   return CURRENT_ENV->get_klass_by_index(cpool, get_klass_index(), will_link, _holder);
   190   return CURRENT_ENV->get_klass_by_index(cpool, get_klass_index(), will_link, _holder);
   191 }
   191 }
   192 
   192 
   193 // ------------------------------------------------------------------
   193 // ------------------------------------------------------------------
   194 // ciBytecodeStream::get_constant_raw_index
   194 // ciBytecodeStream::get_constant_raw_index
   215 int ciBytecodeStream::get_constant_pool_index() const {
   215 int ciBytecodeStream::get_constant_pool_index() const {
   216   // work-alike for Bytecode_loadconstant::pool_index()
   216   // work-alike for Bytecode_loadconstant::pool_index()
   217   int index = get_constant_raw_index();
   217   int index = get_constant_raw_index();
   218   if (has_cache_index()) {
   218   if (has_cache_index()) {
   219     VM_ENTRY_MARK;
   219     VM_ENTRY_MARK;
   220     constantPoolHandle cpool(_method->get_Method()->constants());
   220     constantPoolHandle cpool(THREAD, _method->get_Method()->constants());
   221     return cpool->object_to_cp_index(index);
   221     return cpool->object_to_cp_index(index);
   222   }
   222   }
   223   return index;
   223   return index;
   224 }
   224 }
   225 
   225 
   234   if (has_cache_index()) {
   234   if (has_cache_index()) {
   235     cache_index = pool_index;
   235     cache_index = pool_index;
   236     pool_index = -1;
   236     pool_index = -1;
   237   }
   237   }
   238   VM_ENTRY_MARK;
   238   VM_ENTRY_MARK;
   239   constantPoolHandle cpool(_method->get_Method()->constants());
   239   constantPoolHandle cpool(THREAD, _method->get_Method()->constants());
   240   return CURRENT_ENV->get_constant_by_index(cpool, pool_index, cache_index, _holder);
   240   return CURRENT_ENV->get_constant_by_index(cpool, pool_index, cache_index, _holder);
   241 }
   241 }
   242 
   242 
   243 // ------------------------------------------------------------------
   243 // ------------------------------------------------------------------
   244 // ciBytecodeStream::get_constant_pool_tag
   244 // ciBytecodeStream::get_constant_pool_tag
   287 //
   287 //
   288 // There is no "will_link" result passed back.  The user is responsible
   288 // There is no "will_link" result passed back.  The user is responsible
   289 // for checking linkability when retrieving the associated field.
   289 // for checking linkability when retrieving the associated field.
   290 ciInstanceKlass* ciBytecodeStream::get_declared_field_holder() {
   290 ciInstanceKlass* ciBytecodeStream::get_declared_field_holder() {
   291   VM_ENTRY_MARK;
   291   VM_ENTRY_MARK;
   292   constantPoolHandle cpool(_method->get_Method()->constants());
   292   constantPoolHandle cpool(THREAD, _method->get_Method()->constants());
   293   int holder_index = get_field_holder_index();
   293   int holder_index = get_field_holder_index();
   294   bool ignore;
   294   bool ignore;
   295   return CURRENT_ENV->get_klass_by_index(cpool, holder_index, ignore, _holder)
   295   return CURRENT_ENV->get_klass_by_index(cpool, holder_index, ignore, _holder)
   296       ->as_instance_klass();
   296       ->as_instance_klass();
   297 }
   297 }
   429 //
   429 //
   430 // Returns true if there is an appendix argument stored in the
   430 // Returns true if there is an appendix argument stored in the
   431 // constant pool cache at the current bci.
   431 // constant pool cache at the current bci.
   432 bool ciBytecodeStream::has_appendix() {
   432 bool ciBytecodeStream::has_appendix() {
   433   VM_ENTRY_MARK;
   433   VM_ENTRY_MARK;
   434   constantPoolHandle cpool(_method->get_Method()->constants());
   434   constantPoolHandle cpool(THREAD, _method->get_Method()->constants());
   435   return ConstantPool::has_appendix_at_if_loaded(cpool, get_method_index());
   435   return ConstantPool::has_appendix_at_if_loaded(cpool, get_method_index());
   436 }
   436 }
   437 
   437 
   438 // ------------------------------------------------------------------
   438 // ------------------------------------------------------------------
   439 // ciBytecodeStream::get_appendix
   439 // ciBytecodeStream::get_appendix
   440 //
   440 //
   441 // Return the appendix argument stored in the constant pool cache at
   441 // Return the appendix argument stored in the constant pool cache at
   442 // the current bci.
   442 // the current bci.
   443 ciObject* ciBytecodeStream::get_appendix() {
   443 ciObject* ciBytecodeStream::get_appendix() {
   444   VM_ENTRY_MARK;
   444   VM_ENTRY_MARK;
   445   constantPoolHandle cpool(_method->get_Method()->constants());
   445   constantPoolHandle cpool(THREAD, _method->get_Method()->constants());
   446   oop appendix_oop = ConstantPool::appendix_at_if_loaded(cpool, get_method_index());
   446   oop appendix_oop = ConstantPool::appendix_at_if_loaded(cpool, get_method_index());
   447   return CURRENT_ENV->get_object(appendix_oop);
   447   return CURRENT_ENV->get_object(appendix_oop);
   448 }
   448 }
   449 
   449 
   450 // ------------------------------------------------------------------
   450 // ------------------------------------------------------------------
   452 //
   452 //
   453 // Returns true if the method stored in the constant
   453 // Returns true if the method stored in the constant
   454 // pool cache at the current bci has a local signature.
   454 // pool cache at the current bci has a local signature.
   455 bool ciBytecodeStream::has_local_signature() {
   455 bool ciBytecodeStream::has_local_signature() {
   456   GUARDED_VM_ENTRY(
   456   GUARDED_VM_ENTRY(
   457     constantPoolHandle cpool(_method->get_Method()->constants());
   457     constantPoolHandle cpool(Thread::current(), _method->get_Method()->constants());
   458     return ConstantPool::has_local_signature_at_if_loaded(cpool, get_method_index());
   458     return ConstantPool::has_local_signature_at_if_loaded(cpool, get_method_index());
   459   )
   459   )
   460 }
   460 }
   461 
   461 
   462 // ------------------------------------------------------------------
   462 // ------------------------------------------------------------------
   470 //
   470 //
   471 // There is no "will_link" result passed back.  The user is responsible
   471 // There is no "will_link" result passed back.  The user is responsible
   472 // for checking linkability when retrieving the associated method.
   472 // for checking linkability when retrieving the associated method.
   473 ciKlass* ciBytecodeStream::get_declared_method_holder() {
   473 ciKlass* ciBytecodeStream::get_declared_method_holder() {
   474   VM_ENTRY_MARK;
   474   VM_ENTRY_MARK;
   475   constantPoolHandle cpool(_method->get_Method()->constants());
   475   constantPoolHandle cpool(THREAD, _method->get_Method()->constants());
   476   bool ignore;
   476   bool ignore;
   477   // report as MethodHandle for invokedynamic, which is syntactically classless
   477   // report as MethodHandle for invokedynamic, which is syntactically classless
   478   if (cur_bc() == Bytecodes::_invokedynamic)
   478   if (cur_bc() == Bytecodes::_invokedynamic)
   479     return CURRENT_ENV->get_klass_by_name(_holder, ciSymbol::java_lang_invoke_MethodHandle(), false);
   479     return CURRENT_ENV->get_klass_by_name(_holder, ciSymbol::java_lang_invoke_MethodHandle(), false);
   480   return CURRENT_ENV->get_klass_by_index(cpool, get_method_holder_index(), ignore, _holder);
   480   return CURRENT_ENV->get_klass_by_index(cpool, get_method_holder_index(), ignore, _holder);