hotspot/src/share/vm/oops/constantPool.cpp
changeset 33625 18e7896ca9fe
parent 33232 75e0112d3eb5
parent 33611 9abd65805e19
child 34229 892795cc82fe
equal deleted inserted replaced
33373:4a0312f2894b 33625:18e7896ca9fe
   176   int i = reference_map()->find(cp_index);
   176   int i = reference_map()->find(cp_index);
   177   // We might not find the index for jsr292 call.
   177   // We might not find the index for jsr292 call.
   178   return (i < 0) ? _no_index_sentinel : i;
   178   return (i < 0) ? _no_index_sentinel : i;
   179 }
   179 }
   180 
   180 
   181 void ConstantPool::trace_class_resolution(constantPoolHandle this_cp, KlassHandle k) {
   181 void ConstantPool::trace_class_resolution(const constantPoolHandle& this_cp, KlassHandle k) {
   182   ResourceMark rm;
   182   ResourceMark rm;
   183   int line_number = -1;
   183   int line_number = -1;
   184   const char * source_file = NULL;
   184   const char * source_file = NULL;
   185   if (JavaThread::current()->has_last_Java_frame()) {
   185   if (JavaThread::current()->has_last_Java_frame()) {
   186     // try to identify the method which called this function.
   186     // try to identify the method which called this function.
   196   if (k() != this_cp->pool_holder()) {
   196   if (k() != this_cp->pool_holder()) {
   197     // only print something if the classes are different
   197     // only print something if the classes are different
   198     if (source_file != NULL) {
   198     if (source_file != NULL) {
   199       tty->print("RESOLVE %s %s %s:%d\n",
   199       tty->print("RESOLVE %s %s %s:%d\n",
   200                  this_cp->pool_holder()->external_name(),
   200                  this_cp->pool_holder()->external_name(),
   201                  InstanceKlass::cast(k())->external_name(), source_file, line_number);
   201                  k->external_name(), source_file, line_number);
   202     } else {
   202     } else {
   203       tty->print("RESOLVE %s %s\n",
   203       tty->print("RESOLVE %s %s\n",
   204                  this_cp->pool_holder()->external_name(),
   204                  this_cp->pool_holder()->external_name(),
   205                  InstanceKlass::cast(k())->external_name());
   205                  k->external_name());
   206     }
   206     }
   207   }
   207   }
   208 }
   208 }
   209 
   209 
   210 Klass* ConstantPool::klass_at_impl(constantPoolHandle this_cp, int which,
   210 Klass* ConstantPool::klass_at_impl(const constantPoolHandle& this_cp, int which,
   211                                    bool save_resolution_error, TRAPS) {
   211                                    bool save_resolution_error, TRAPS) {
   212   assert(THREAD->is_Java_thread(), "must be a Java thread");
   212   assert(THREAD->is_Java_thread(), "must be a Java thread");
   213 
   213 
   214   // A resolved constantPool entry will contain a Klass*, otherwise a Symbol*.
   214   // A resolved constantPool entry will contain a Klass*, otherwise a Symbol*.
   215   // It is not safe to rely on the tag bit's here, since we don't have a lock, and
   215   // It is not safe to rely on the tag bit's here, since we don't have a lock, and
   267 
   267 
   268   // Make this class loader depend upon the class loader owning the class reference
   268   // Make this class loader depend upon the class loader owning the class reference
   269   ClassLoaderData* this_key = this_cp->pool_holder()->class_loader_data();
   269   ClassLoaderData* this_key = this_cp->pool_holder()->class_loader_data();
   270   this_key->record_dependency(k(), CHECK_NULL); // Can throw OOM
   270   this_key->record_dependency(k(), CHECK_NULL); // Can throw OOM
   271 
   271 
   272   if (TraceClassResolution && !k->oop_is_array()) {
   272   if (TraceClassResolution && !k->is_array_klass()) {
   273     // skip resolving the constant pool so that this code gets
   273     // skip resolving the constant pool so that this code gets
   274     // called the next time some bytecodes refer to this class.
   274     // called the next time some bytecodes refer to this class.
   275     trace_class_resolution(this_cp, k);
   275     trace_class_resolution(this_cp, k);
   276     return k();
   276     return k();
   277   } else {
   277   } else {
   286 
   286 
   287 // Does not update ConstantPool* - to avoid any exception throwing. Used
   287 // Does not update ConstantPool* - to avoid any exception throwing. Used
   288 // by compiler and exception handling.  Also used to avoid classloads for
   288 // by compiler and exception handling.  Also used to avoid classloads for
   289 // instanceof operations. Returns NULL if the class has not been loaded or
   289 // instanceof operations. Returns NULL if the class has not been loaded or
   290 // if the verification of constant pool failed
   290 // if the verification of constant pool failed
   291 Klass* ConstantPool::klass_at_if_loaded(constantPoolHandle this_cp, int which) {
   291 Klass* ConstantPool::klass_at_if_loaded(const constantPoolHandle& this_cp, int which) {
   292   CPSlot entry = this_cp->slot_at(which);
   292   CPSlot entry = this_cp->slot_at(which);
   293   if (entry.is_resolved()) {
   293   if (entry.is_resolved()) {
   294     assert(entry.get_klass()->is_klass(), "must be");
   294     assert(entry.get_klass()->is_klass(), "must be");
   295     return entry.get_klass();
   295     return entry.get_klass();
   296   } else {
   296   } else {
   319     }
   319     }
   320   }
   320   }
   321 }
   321 }
   322 
   322 
   323 
   323 
   324 Klass* ConstantPool::klass_ref_at_if_loaded(constantPoolHandle this_cp, int which) {
   324 Klass* ConstantPool::klass_ref_at_if_loaded(const constantPoolHandle& this_cp, int which) {
   325   return klass_at_if_loaded(this_cp, this_cp->klass_ref_index_at(which));
   325   return klass_at_if_loaded(this_cp, this_cp->klass_ref_index_at(which));
   326 }
   326 }
   327 
   327 
   328 
   328 
   329 Method* ConstantPool::method_at_if_loaded(constantPoolHandle cpool,
   329 Method* ConstantPool::method_at_if_loaded(const constantPoolHandle& cpool,
   330                                                    int which) {
   330                                                    int which) {
   331   if (cpool->cache() == NULL)  return NULL;  // nothing to load yet
   331   if (cpool->cache() == NULL)  return NULL;  // nothing to load yet
   332   int cache_index = decode_cpcache_index(which, true);
   332   int cache_index = decode_cpcache_index(which, true);
   333   if (!(cache_index >= 0 && cache_index < cpool->cache()->length())) {
   333   if (!(cache_index >= 0 && cache_index < cpool->cache()->length())) {
   334     // FIXME: should be an assert
   334     // FIXME: should be an assert
   340   ConstantPoolCacheEntry* e = cpool->cache()->entry_at(cache_index);
   340   ConstantPoolCacheEntry* e = cpool->cache()->entry_at(cache_index);
   341   return e->method_if_resolved(cpool);
   341   return e->method_if_resolved(cpool);
   342 }
   342 }
   343 
   343 
   344 
   344 
   345 bool ConstantPool::has_appendix_at_if_loaded(constantPoolHandle cpool, int which) {
   345 bool ConstantPool::has_appendix_at_if_loaded(const constantPoolHandle& cpool, int which) {
   346   if (cpool->cache() == NULL)  return false;  // nothing to load yet
   346   if (cpool->cache() == NULL)  return false;  // nothing to load yet
   347   int cache_index = decode_cpcache_index(which, true);
   347   int cache_index = decode_cpcache_index(which, true);
   348   ConstantPoolCacheEntry* e = cpool->cache()->entry_at(cache_index);
   348   ConstantPoolCacheEntry* e = cpool->cache()->entry_at(cache_index);
   349   return e->has_appendix();
   349   return e->has_appendix();
   350 }
   350 }
   351 
   351 
   352 oop ConstantPool::appendix_at_if_loaded(constantPoolHandle cpool, int which) {
   352 oop ConstantPool::appendix_at_if_loaded(const constantPoolHandle& cpool, int which) {
   353   if (cpool->cache() == NULL)  return NULL;  // nothing to load yet
   353   if (cpool->cache() == NULL)  return NULL;  // nothing to load yet
   354   int cache_index = decode_cpcache_index(which, true);
   354   int cache_index = decode_cpcache_index(which, true);
   355   ConstantPoolCacheEntry* e = cpool->cache()->entry_at(cache_index);
   355   ConstantPoolCacheEntry* e = cpool->cache()->entry_at(cache_index);
   356   return e->appendix_if_resolved(cpool);
   356   return e->appendix_if_resolved(cpool);
   357 }
   357 }
   358 
   358 
   359 
   359 
   360 bool ConstantPool::has_method_type_at_if_loaded(constantPoolHandle cpool, int which) {
   360 bool ConstantPool::has_method_type_at_if_loaded(const constantPoolHandle& cpool, int which) {
   361   if (cpool->cache() == NULL)  return false;  // nothing to load yet
   361   if (cpool->cache() == NULL)  return false;  // nothing to load yet
   362   int cache_index = decode_cpcache_index(which, true);
   362   int cache_index = decode_cpcache_index(which, true);
   363   ConstantPoolCacheEntry* e = cpool->cache()->entry_at(cache_index);
   363   ConstantPoolCacheEntry* e = cpool->cache()->entry_at(cache_index);
   364   return e->has_method_type();
   364   return e->has_method_type();
   365 }
   365 }
   366 
   366 
   367 oop ConstantPool::method_type_at_if_loaded(constantPoolHandle cpool, int which) {
   367 oop ConstantPool::method_type_at_if_loaded(const constantPoolHandle& cpool, int which) {
   368   if (cpool->cache() == NULL)  return NULL;  // nothing to load yet
   368   if (cpool->cache() == NULL)  return NULL;  // nothing to load yet
   369   int cache_index = decode_cpcache_index(which, true);
   369   int cache_index = decode_cpcache_index(which, true);
   370   ConstantPoolCacheEntry* e = cpool->cache()->entry_at(cache_index);
   370   ConstantPoolCacheEntry* e = cpool->cache()->entry_at(cache_index);
   371   return e->method_type_if_resolved(cpool);
   371   return e->method_type_if_resolved(cpool);
   372 }
   372 }
   432   int member_index = cache()->entry_at(cpc_index)->constant_pool_index();
   432   int member_index = cache()->entry_at(cpc_index)->constant_pool_index();
   433   return member_index;
   433   return member_index;
   434 }
   434 }
   435 
   435 
   436 
   436 
   437 void ConstantPool::verify_constant_pool_resolve(constantPoolHandle this_cp, KlassHandle k, TRAPS) {
   437 void ConstantPool::verify_constant_pool_resolve(const constantPoolHandle& this_cp, KlassHandle k, TRAPS) {
   438  if (k->oop_is_instance() || k->oop_is_objArray()) {
   438  if (k->is_instance_klass() || k->is_objArray_klass()) {
   439     instanceKlassHandle holder (THREAD, this_cp->pool_holder());
   439     instanceKlassHandle holder (THREAD, this_cp->pool_holder());
   440     Klass* elem = k->oop_is_instance() ? k() : ObjArrayKlass::cast(k())->bottom_klass();
   440     Klass* elem = k->is_instance_klass() ? k() : ObjArrayKlass::cast(k())->bottom_klass();
   441     KlassHandle element (THREAD, elem);
   441     KlassHandle element (THREAD, elem);
   442 
   442 
   443     // The element type could be a typeArray - we only need the access check if it is
   443     // The element type could be a typeArray - we only need the access check if it is
   444     // an reference to another class
   444     // an reference to another class
   445     if (element->oop_is_instance()) {
   445     if (element->is_instance_klass()) {
   446       LinkResolver::check_klass_accessability(holder, element, CHECK);
   446       LinkResolver::check_klass_accessability(holder, element, CHECK);
   447     }
   447     }
   448   }
   448   }
   449 }
   449 }
   450 
   450 
   500 BasicType ConstantPool::basic_type_for_signature_at(int which) {
   500 BasicType ConstantPool::basic_type_for_signature_at(int which) {
   501   return FieldType::basic_type(symbol_at(which));
   501   return FieldType::basic_type(symbol_at(which));
   502 }
   502 }
   503 
   503 
   504 
   504 
   505 void ConstantPool::resolve_string_constants_impl(constantPoolHandle this_cp, TRAPS) {
   505 void ConstantPool::resolve_string_constants_impl(const constantPoolHandle& this_cp, TRAPS) {
   506   for (int index = 1; index < this_cp->length(); index++) { // Index 0 is unused
   506   for (int index = 1; index < this_cp->length(); index++) { // Index 0 is unused
   507     if (this_cp->tag_at(index).is_string()) {
   507     if (this_cp->tag_at(index).is_string()) {
   508       this_cp->string_at(index, CHECK);
   508       this_cp->string_at(index, CHECK);
   509     }
   509     }
   510   }
   510   }
   524   }
   524   }
   525   // set_preresolution(); or some bit for future use
   525   // set_preresolution(); or some bit for future use
   526   return true;
   526   return true;
   527 }
   527 }
   528 
   528 
   529 Symbol* ConstantPool::exception_message(constantPoolHandle this_cp, int which, constantTag tag, oop pending_exception) {
   529 Symbol* ConstantPool::exception_message(const constantPoolHandle& this_cp, int which, constantTag tag, oop pending_exception) {
   530   // Dig out the detailed message to reuse if possible
   530   // Dig out the detailed message to reuse if possible
   531   Symbol* message = java_lang_Throwable::detail_message(pending_exception);
   531   Symbol* message = java_lang_Throwable::detail_message(pending_exception);
   532   if (message != NULL) {
   532   if (message != NULL) {
   533     return message;
   533     return message;
   534   }
   534   }
   552   }
   552   }
   553 
   553 
   554   return message;
   554   return message;
   555 }
   555 }
   556 
   556 
   557 void ConstantPool::throw_resolution_error(constantPoolHandle this_cp, int which, TRAPS) {
   557 void ConstantPool::throw_resolution_error(const constantPoolHandle& this_cp, int which, TRAPS) {
   558   Symbol* message = NULL;
   558   Symbol* message = NULL;
   559   Symbol* error = SystemDictionary::find_resolution_error(this_cp, which, &message);
   559   Symbol* error = SystemDictionary::find_resolution_error(this_cp, which, &message);
   560   assert(error != NULL && message != NULL, "checking");
   560   assert(error != NULL && message != NULL, "checking");
   561   CLEAR_PENDING_EXCEPTION;
   561   CLEAR_PENDING_EXCEPTION;
   562   ResourceMark rm;
   562   ResourceMark rm;
   563   THROW_MSG(error, message->as_C_string());
   563   THROW_MSG(error, message->as_C_string());
   564 }
   564 }
   565 
   565 
   566 // If resolution for Class, MethodHandle or MethodType fails, save the exception
   566 // If resolution for Class, MethodHandle or MethodType fails, save the exception
   567 // in the resolution error table, so that the same exception is thrown again.
   567 // in the resolution error table, so that the same exception is thrown again.
   568 void ConstantPool::save_and_throw_exception(constantPoolHandle this_cp, int which,
   568 void ConstantPool::save_and_throw_exception(const constantPoolHandle& this_cp, int which,
   569                                             constantTag tag, TRAPS) {
   569                                             constantTag tag, TRAPS) {
   570   Symbol* error = PENDING_EXCEPTION->klass()->name();
   570   Symbol* error = PENDING_EXCEPTION->klass()->name();
   571 
   571 
   572   int error_tag = tag.error_value();
   572   int error_tag = tag.error_value();
   573 
   573 
   601 }
   601 }
   602 
   602 
   603 // Called to resolve constants in the constant pool and return an oop.
   603 // Called to resolve constants in the constant pool and return an oop.
   604 // Some constant pool entries cache their resolved oop. This is also
   604 // Some constant pool entries cache their resolved oop. This is also
   605 // called to create oops from constants to use in arguments for invokedynamic
   605 // called to create oops from constants to use in arguments for invokedynamic
   606 oop ConstantPool::resolve_constant_at_impl(constantPoolHandle this_cp, int index, int cache_index, TRAPS) {
   606 oop ConstantPool::resolve_constant_at_impl(const constantPoolHandle& this_cp, int index, int cache_index, TRAPS) {
   607   oop result_oop = NULL;
   607   oop result_oop = NULL;
   608   Handle throw_exception;
   608   Handle throw_exception;
   609 
   609 
   610   if (cache_index == _possible_index_sentinel) {
   610   if (cache_index == _possible_index_sentinel) {
   611     // It is possible that this constant is one which is cached in the objects.
   611     // It is possible that this constant is one which is cached in the objects.
   754   assert(java_lang_String::is_instance(str), "must be string");
   754   assert(java_lang_String::is_instance(str), "must be string");
   755   return str;
   755   return str;
   756 }
   756 }
   757 
   757 
   758 
   758 
   759 oop ConstantPool::resolve_bootstrap_specifier_at_impl(constantPoolHandle this_cp, int index, TRAPS) {
   759 oop ConstantPool::resolve_bootstrap_specifier_at_impl(const constantPoolHandle& this_cp, int index, TRAPS) {
   760   assert(this_cp->tag_at(index).is_invoke_dynamic(), "Corrupted constant pool");
   760   assert(this_cp->tag_at(index).is_invoke_dynamic(), "Corrupted constant pool");
   761 
   761 
   762   Handle bsm;
   762   Handle bsm;
   763   int argc;
   763   int argc;
   764   {
   764   {
   792   }
   792   }
   793 
   793 
   794   return info();
   794   return info();
   795 }
   795 }
   796 
   796 
   797 oop ConstantPool::string_at_impl(constantPoolHandle this_cp, int which, int obj_index, TRAPS) {
   797 oop ConstantPool::string_at_impl(const constantPoolHandle& this_cp, int which, int obj_index, TRAPS) {
   798   // If the string has already been interned, this entry will be non-null
   798   // If the string has already been interned, this entry will be non-null
   799   oop str = this_cp->resolved_references()->obj_at(obj_index);
   799   oop str = this_cp->resolved_references()->obj_at(obj_index);
   800   if (str != NULL) return str;
   800   if (str != NULL) return str;
   801   Symbol* sym = this_cp->unresolved_string_at(which);
   801   Symbol* sym = this_cp->unresolved_string_at(which);
   802   str = StringTable::intern(sym, CHECK_(NULL));
   802   str = StringTable::intern(sym, CHECK_(NULL));
   828 }
   828 }
   829 
   829 
   830 
   830 
   831 // Compare this constant pool's entry at index1 to the constant pool
   831 // Compare this constant pool's entry at index1 to the constant pool
   832 // cp2's entry at index2.
   832 // cp2's entry at index2.
   833 bool ConstantPool::compare_entry_to(int index1, constantPoolHandle cp2,
   833 bool ConstantPool::compare_entry_to(int index1, const constantPoolHandle& cp2,
   834        int index2, TRAPS) {
   834        int index2, TRAPS) {
   835 
   835 
   836   // The error tags are equivalent to non-error tags when comparing
   836   // The error tags are equivalent to non-error tags when comparing
   837   jbyte t1 = tag_at(index1).non_error_value();
   837   jbyte t1 = tag_at(index1).non_error_value();
   838   jbyte t2 = cp2->tag_at(index2).non_error_value();
   838   jbyte t2 = cp2->tag_at(index2).non_error_value();
  1054 } // end resize_operands()
  1054 } // end resize_operands()
  1055 
  1055 
  1056 
  1056 
  1057 // Extend the operands array with the length and size of the ext_cp operands.
  1057 // Extend the operands array with the length and size of the ext_cp operands.
  1058 // Used in RedefineClasses for CP merge.
  1058 // Used in RedefineClasses for CP merge.
  1059 void ConstantPool::extend_operands(constantPoolHandle ext_cp, TRAPS) {
  1059 void ConstantPool::extend_operands(const constantPoolHandle& ext_cp, TRAPS) {
  1060   int delta_len = operand_array_length(ext_cp->operands());
  1060   int delta_len = operand_array_length(ext_cp->operands());
  1061   if (delta_len == 0) {
  1061   if (delta_len == 0) {
  1062     return; // nothing to do
  1062     return; // nothing to do
  1063   }
  1063   }
  1064   int delta_size = ext_cp->operands()->length();
  1064   int delta_size = ext_cp->operands()->length();
  1094   resize_operands(delta_len, delta_size, CHECK);
  1094   resize_operands(delta_len, delta_size, CHECK);
  1095 
  1095 
  1096 } // end shrink_operands()
  1096 } // end shrink_operands()
  1097 
  1097 
  1098 
  1098 
  1099 void ConstantPool::copy_operands(constantPoolHandle from_cp,
  1099 void ConstantPool::copy_operands(const constantPoolHandle& from_cp,
  1100                                  constantPoolHandle to_cp,
  1100                                  const constantPoolHandle& to_cp,
  1101                                  TRAPS) {
  1101                                  TRAPS) {
  1102 
  1102 
  1103   int from_oplen = operand_array_length(from_cp->operands());
  1103   int from_oplen = operand_array_length(from_cp->operands());
  1104   int old_oplen  = operand_array_length(to_cp->operands());
  1104   int old_oplen  = operand_array_length(to_cp->operands());
  1105   if (from_oplen != 0) {
  1105   if (from_oplen != 0) {
  1158 
  1158 
  1159 
  1159 
  1160 // Copy this constant pool's entries at start_i to end_i (inclusive)
  1160 // Copy this constant pool's entries at start_i to end_i (inclusive)
  1161 // to the constant pool to_cp's entries starting at to_i. A total of
  1161 // to the constant pool to_cp's entries starting at to_i. A total of
  1162 // (end_i - start_i) + 1 entries are copied.
  1162 // (end_i - start_i) + 1 entries are copied.
  1163 void ConstantPool::copy_cp_to_impl(constantPoolHandle from_cp, int start_i, int end_i,
  1163 void ConstantPool::copy_cp_to_impl(const constantPoolHandle& from_cp, int start_i, int end_i,
  1164        constantPoolHandle to_cp, int to_i, TRAPS) {
  1164        const constantPoolHandle& to_cp, int to_i, TRAPS) {
  1165 
  1165 
  1166 
  1166 
  1167   int dest_i = to_i;  // leave original alone for debug purposes
  1167   int dest_i = to_i;  // leave original alone for debug purposes
  1168 
  1168 
  1169   for (int src_i = start_i; src_i <= end_i; /* see loop bottom */ ) {
  1169   for (int src_i = start_i; src_i <= end_i; /* see loop bottom */ ) {
  1189 } // end copy_cp_to_impl()
  1189 } // end copy_cp_to_impl()
  1190 
  1190 
  1191 
  1191 
  1192 // Copy this constant pool's entry at from_i to the constant pool
  1192 // Copy this constant pool's entry at from_i to the constant pool
  1193 // to_cp's entry at to_i.
  1193 // to_cp's entry at to_i.
  1194 void ConstantPool::copy_entry_to(constantPoolHandle from_cp, int from_i,
  1194 void ConstantPool::copy_entry_to(const constantPoolHandle& from_cp, int from_i,
  1195                                         constantPoolHandle to_cp, int to_i,
  1195                                         const constantPoolHandle& to_cp, int to_i,
  1196                                         TRAPS) {
  1196                                         TRAPS) {
  1197 
  1197 
  1198   int tag = from_cp->tag_at(from_i).value();
  1198   int tag = from_cp->tag_at(from_i).value();
  1199   switch (tag) {
  1199   switch (tag) {
  1200   case JVM_CONSTANT_Class:
  1200   case JVM_CONSTANT_Class:
  1337 
  1337 
  1338 // Search constant pool search_cp for an entry that matches this
  1338 // Search constant pool search_cp for an entry that matches this
  1339 // constant pool's entry at pattern_i. Returns the index of a
  1339 // constant pool's entry at pattern_i. Returns the index of a
  1340 // matching entry or zero (0) if there is no matching entry.
  1340 // matching entry or zero (0) if there is no matching entry.
  1341 int ConstantPool::find_matching_entry(int pattern_i,
  1341 int ConstantPool::find_matching_entry(int pattern_i,
  1342       constantPoolHandle search_cp, TRAPS) {
  1342       const constantPoolHandle& search_cp, TRAPS) {
  1343 
  1343 
  1344   // index zero (0) is not used
  1344   // index zero (0) is not used
  1345   for (int i = 1; i < search_cp->length(); i++) {
  1345   for (int i = 1; i < search_cp->length(); i++) {
  1346     bool found = compare_entry_to(pattern_i, search_cp, i, CHECK_0);
  1346     bool found = compare_entry_to(pattern_i, search_cp, i, CHECK_0);
  1347     if (found) {
  1347     if (found) {
  1353 } // end find_matching_entry()
  1353 } // end find_matching_entry()
  1354 
  1354 
  1355 
  1355 
  1356 // Compare this constant pool's bootstrap specifier at idx1 to the constant pool
  1356 // Compare this constant pool's bootstrap specifier at idx1 to the constant pool
  1357 // cp2's bootstrap specifier at idx2.
  1357 // cp2's bootstrap specifier at idx2.
  1358 bool ConstantPool::compare_operand_to(int idx1, constantPoolHandle cp2, int idx2, TRAPS) {
  1358 bool ConstantPool::compare_operand_to(int idx1, const constantPoolHandle& cp2, int idx2, TRAPS) {
  1359   int k1 = operand_bootstrap_method_ref_index_at(idx1);
  1359   int k1 = operand_bootstrap_method_ref_index_at(idx1);
  1360   int k2 = cp2->operand_bootstrap_method_ref_index_at(idx2);
  1360   int k2 = cp2->operand_bootstrap_method_ref_index_at(idx2);
  1361   bool match = compare_entry_to(k1, cp2, k2, CHECK_false);
  1361   bool match = compare_entry_to(k1, cp2, k2, CHECK_false);
  1362 
  1362 
  1363   if (!match) {
  1363   if (!match) {
  1380 
  1380 
  1381 // Search constant pool search_cp for a bootstrap specifier that matches
  1381 // Search constant pool search_cp for a bootstrap specifier that matches
  1382 // this constant pool's bootstrap specifier at pattern_i index.
  1382 // this constant pool's bootstrap specifier at pattern_i index.
  1383 // Return the index of a matching bootstrap specifier or (-1) if there is no match.
  1383 // Return the index of a matching bootstrap specifier or (-1) if there is no match.
  1384 int ConstantPool::find_matching_operand(int pattern_i,
  1384 int ConstantPool::find_matching_operand(int pattern_i,
  1385                     constantPoolHandle search_cp, int search_len, TRAPS) {
  1385                     const constantPoolHandle& search_cp, int search_len, TRAPS) {
  1386   for (int i = 0; i < search_len; i++) {
  1386   for (int i = 0; i < search_len; i++) {
  1387     bool found = compare_operand_to(pattern_i, search_cp, i, CHECK_(-1));
  1387     bool found = compare_operand_to(pattern_i, search_cp, i, CHECK_(-1));
  1388     if (found) {
  1388     if (found) {
  1389       return i;
  1389       return i;
  1390     }
  1390     }
  1841 
  1841 
  1842   for (int i = 0; i< cp->length();  i++) {
  1842   for (int i = 0; i< cp->length();  i++) {
  1843     if (cp->tag_at(i).is_unresolved_klass()) {
  1843     if (cp->tag_at(i).is_unresolved_klass()) {
  1844       // This will force loading of the class
  1844       // This will force loading of the class
  1845       Klass* klass = cp->klass_at(i, CHECK);
  1845       Klass* klass = cp->klass_at(i, CHECK);
  1846       if (klass->oop_is_instance()) {
  1846       if (klass->is_instance_klass()) {
  1847         // Force initialization of class
  1847         // Force initialization of class
  1848         InstanceKlass::cast(klass)->initialize(CHECK);
  1848         InstanceKlass::cast(klass)->initialize(CHECK);
  1849       }
  1849       }
  1850     }
  1850     }
  1851   }
  1851   }