ciObjectFactory.cpp revision 1472:c18cbe5936b8
1/* 2 * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25#include "incls/_precompiled.incl" 26#include "incls/_ciObjectFactory.cpp.incl" 27 28// ciObjectFactory 29// 30// This class handles requests for the creation of new instances 31// of ciObject and its subclasses. It contains a caching mechanism 32// which ensures that for each oop, at most one ciObject is created. 33// This invariant allows more efficient implementation of ciObject. 34// 35// Implementation note: the oop->ciObject mapping is represented as 36// a table stored in an array. Even though objects are moved 37// by the garbage collector, the compactor preserves their relative 38// order; address comparison of oops (in perm space) is safe so long 39// as we prohibit GC during our comparisons. We currently use binary 40// search to find the oop in the table, and inserting a new oop 41// into the table may be costly. If this cost ends up being 42// problematic the underlying data structure can be switched to some 43// sort of balanced binary tree. 44 45GrowableArray<ciObject*>* ciObjectFactory::_shared_ci_objects = NULL; 46ciSymbol* ciObjectFactory::_shared_ci_symbols[vmSymbols::SID_LIMIT]; 47int ciObjectFactory::_shared_ident_limit = 0; 48volatile bool ciObjectFactory::_initialized = false; 49 50 51// ------------------------------------------------------------------ 52// ciObjectFactory::ciObjectFactory 53ciObjectFactory::ciObjectFactory(Arena* arena, 54 int expected_size) { 55 56 for (int i = 0; i < NON_PERM_BUCKETS; i++) { 57 _non_perm_bucket[i] = NULL; 58 } 59 _non_perm_count = 0; 60 61 _next_ident = _shared_ident_limit; 62 _arena = arena; 63 _ci_objects = new (arena) GrowableArray<ciObject*>(arena, expected_size, 0, NULL); 64 65 // If the shared ci objects exist append them to this factory's objects 66 67 if (_shared_ci_objects != NULL) { 68 _ci_objects->appendAll(_shared_ci_objects); 69 } 70 71 _unloaded_methods = new (arena) GrowableArray<ciMethod*>(arena, 4, 0, NULL); 72 _unloaded_klasses = new (arena) GrowableArray<ciKlass*>(arena, 8, 0, NULL); 73 _return_addresses = 74 new (arena) GrowableArray<ciReturnAddress*>(arena, 8, 0, NULL); 75} 76 77// ------------------------------------------------------------------ 78// ciObjectFactory::ciObjectFactory 79void ciObjectFactory::initialize() { 80 ASSERT_IN_VM; 81 JavaThread* thread = JavaThread::current(); 82 HandleMark handle_mark(thread); 83 84 // This Arena is long lived and exists in the resource mark of the 85 // compiler thread that initializes the initial ciObjectFactory which 86 // creates the shared ciObjects that all later ciObjectFactories use. 87 Arena* arena = new Arena(); 88 ciEnv initial(arena); 89 ciEnv* env = ciEnv::current(); 90 env->_factory->init_shared_objects(); 91 92 _initialized = true; 93 94} 95 96void ciObjectFactory::init_shared_objects() { 97 98 _next_ident = 1; // start numbering CI objects at 1 99 100 { 101 // Create the shared symbols, but not in _shared_ci_objects. 102 int i; 103 for (i = vmSymbols::FIRST_SID; i < vmSymbols::SID_LIMIT; i++) { 104 symbolHandle sym_handle = vmSymbolHandles::symbol_handle_at((vmSymbols::SID) i); 105 assert(vmSymbols::find_sid(sym_handle()) == i, "1-1 mapping"); 106 ciSymbol* sym = new (_arena) ciSymbol(sym_handle, (vmSymbols::SID) i); 107 init_ident_of(sym); 108 _shared_ci_symbols[i] = sym; 109 } 110#ifdef ASSERT 111 for (i = vmSymbols::FIRST_SID; i < vmSymbols::SID_LIMIT; i++) { 112 symbolHandle sym_handle = vmSymbolHandles::symbol_handle_at((vmSymbols::SID) i); 113 ciSymbol* sym = vm_symbol_at((vmSymbols::SID) i); 114 assert(sym->get_oop() == sym_handle(), "oop must match"); 115 } 116 assert(ciSymbol::void_class_signature()->get_oop() == vmSymbols::void_class_signature(), "spot check"); 117#endif 118 } 119 120 _ci_objects = new (_arena) GrowableArray<ciObject*>(_arena, 64, 0, NULL); 121 122 for (int i = T_BOOLEAN; i <= T_CONFLICT; i++) { 123 BasicType t = (BasicType)i; 124 if (type2name(t) != NULL && t != T_OBJECT && t != T_ARRAY && t != T_NARROWOOP) { 125 ciType::_basic_types[t] = new (_arena) ciType(t); 126 init_ident_of(ciType::_basic_types[t]); 127 } 128 } 129 130 ciEnv::_null_object_instance = new (_arena) ciNullObject(); 131 init_ident_of(ciEnv::_null_object_instance); 132 ciEnv::_method_klass_instance = 133 get(Universe::methodKlassObj())->as_method_klass(); 134 ciEnv::_symbol_klass_instance = 135 get(Universe::symbolKlassObj())->as_symbol_klass(); 136 ciEnv::_klass_klass_instance = 137 get(Universe::klassKlassObj())->as_klass_klass(); 138 ciEnv::_instance_klass_klass_instance = 139 get(Universe::instanceKlassKlassObj()) 140 ->as_instance_klass_klass(); 141 ciEnv::_type_array_klass_klass_instance = 142 get(Universe::typeArrayKlassKlassObj()) 143 ->as_type_array_klass_klass(); 144 ciEnv::_obj_array_klass_klass_instance = 145 get(Universe::objArrayKlassKlassObj()) 146 ->as_obj_array_klass_klass(); 147 148#define WK_KLASS_DEFN(name, ignore_s, opt) \ 149 if (SystemDictionary::name() != NULL) \ 150 ciEnv::_##name = get(SystemDictionary::name())->as_instance_klass(); 151 152 WK_KLASSES_DO(WK_KLASS_DEFN) 153#undef WK_KLASS_DEFN 154 155 for (int len = -1; len != _ci_objects->length(); ) { 156 len = _ci_objects->length(); 157 for (int i2 = 0; i2 < len; i2++) { 158 ciObject* obj = _ci_objects->at(i2); 159 if (obj->is_loaded() && obj->is_instance_klass()) { 160 obj->as_instance_klass()->compute_nonstatic_fields(); 161 } 162 } 163 } 164 165 ciEnv::_unloaded_cisymbol = (ciSymbol*) ciObjectFactory::get(vmSymbols::dummy_symbol_oop()); 166 // Create dummy instanceKlass and objArrayKlass object and assign them idents 167 ciEnv::_unloaded_ciinstance_klass = new (_arena) ciInstanceKlass(ciEnv::_unloaded_cisymbol, NULL, NULL); 168 init_ident_of(ciEnv::_unloaded_ciinstance_klass); 169 ciEnv::_unloaded_ciobjarrayklass = new (_arena) ciObjArrayKlass(ciEnv::_unloaded_cisymbol, ciEnv::_unloaded_ciinstance_klass, 1); 170 init_ident_of(ciEnv::_unloaded_ciobjarrayklass); 171 assert(ciEnv::_unloaded_ciobjarrayklass->is_obj_array_klass(), "just checking"); 172 173 get(Universe::boolArrayKlassObj()); 174 get(Universe::charArrayKlassObj()); 175 get(Universe::singleArrayKlassObj()); 176 get(Universe::doubleArrayKlassObj()); 177 get(Universe::byteArrayKlassObj()); 178 get(Universe::shortArrayKlassObj()); 179 get(Universe::intArrayKlassObj()); 180 get(Universe::longArrayKlassObj()); 181 182 183 184 assert(_non_perm_count == 0, "no shared non-perm objects"); 185 186 // The shared_ident_limit is the first ident number that will 187 // be used for non-shared objects. That is, numbers less than 188 // this limit are permanently assigned to shared CI objects, 189 // while the higher numbers are recycled afresh by each new ciEnv. 190 191 _shared_ident_limit = _next_ident; 192 _shared_ci_objects = _ci_objects; 193} 194 195// ------------------------------------------------------------------ 196// ciObjectFactory::get 197// 198// Get the ciObject corresponding to some oop. If the ciObject has 199// already been created, it is returned. Otherwise, a new ciObject 200// is created. 201ciObject* ciObjectFactory::get(oop key) { 202 ASSERT_IN_VM; 203 204#ifdef ASSERT 205 if (CIObjectFactoryVerify) { 206 oop last = NULL; 207 for (int j = 0; j< _ci_objects->length(); j++) { 208 oop o = _ci_objects->at(j)->get_oop(); 209 assert(last < o, "out of order"); 210 last = o; 211 } 212 } 213#endif // ASSERT 214 int len = _ci_objects->length(); 215 int index = find(key, _ci_objects); 216#ifdef ASSERT 217 if (CIObjectFactoryVerify) { 218 for (int i=0; i<_ci_objects->length(); i++) { 219 if (_ci_objects->at(i)->get_oop() == key) { 220 assert(index == i, " bad lookup"); 221 } 222 } 223 } 224#endif 225 if (!is_found_at(index, key, _ci_objects)) { 226 // Check in the non-perm area before putting it in the list. 227 NonPermObject* &bucket = find_non_perm(key); 228 if (bucket != NULL) { 229 return bucket->object(); 230 } 231 232 // Check in the shared symbol area before putting it in the list. 233 if (key->is_symbol()) { 234 vmSymbols::SID sid = vmSymbols::find_sid((symbolOop)key); 235 if (sid != vmSymbols::NO_SID) { 236 // do not pollute the main cache with it 237 return vm_symbol_at(sid); 238 } 239 } 240 241 // The ciObject does not yet exist. Create it and insert it 242 // into the cache. 243 Handle keyHandle(key); 244 ciObject* new_object = create_new_object(keyHandle()); 245 assert(keyHandle() == new_object->get_oop(), "must be properly recorded"); 246 init_ident_of(new_object); 247 if (!new_object->is_perm()) { 248 // Not a perm-space object. 249 insert_non_perm(bucket, keyHandle(), new_object); 250 return new_object; 251 } 252 if (len != _ci_objects->length()) { 253 // creating the new object has recursively entered new objects 254 // into the table. We need to recompute our index. 255 index = find(keyHandle(), _ci_objects); 256 } 257 assert(!is_found_at(index, keyHandle(), _ci_objects), "no double insert"); 258 insert(index, new_object, _ci_objects); 259 return new_object; 260 } 261 return _ci_objects->at(index); 262} 263 264// ------------------------------------------------------------------ 265// ciObjectFactory::create_new_object 266// 267// Create a new ciObject from an oop. 268// 269// Implementation note: this functionality could be virtual behavior 270// of the oop itself. For now, we explicitly marshal the object. 271ciObject* ciObjectFactory::create_new_object(oop o) { 272 EXCEPTION_CONTEXT; 273 274 if (o->is_symbol()) { 275 symbolHandle h_o(THREAD, (symbolOop)o); 276 assert(vmSymbols::find_sid(h_o()) == vmSymbols::NO_SID, ""); 277 return new (arena()) ciSymbol(h_o, vmSymbols::NO_SID); 278 } else if (o->is_klass()) { 279 KlassHandle h_k(THREAD, (klassOop)o); 280 Klass* k = ((klassOop)o)->klass_part(); 281 if (k->oop_is_instance()) { 282 return new (arena()) ciInstanceKlass(h_k); 283 } else if (k->oop_is_objArray()) { 284 return new (arena()) ciObjArrayKlass(h_k); 285 } else if (k->oop_is_typeArray()) { 286 return new (arena()) ciTypeArrayKlass(h_k); 287 } else if (k->oop_is_method()) { 288 return new (arena()) ciMethodKlass(h_k); 289 } else if (k->oop_is_symbol()) { 290 return new (arena()) ciSymbolKlass(h_k); 291 } else if (k->oop_is_klass()) { 292 if (k->oop_is_objArrayKlass()) { 293 return new (arena()) ciObjArrayKlassKlass(h_k); 294 } else if (k->oop_is_typeArrayKlass()) { 295 return new (arena()) ciTypeArrayKlassKlass(h_k); 296 } else if (k->oop_is_instanceKlass()) { 297 return new (arena()) ciInstanceKlassKlass(h_k); 298 } else { 299 assert(o == Universe::klassKlassObj(), "bad klassKlass"); 300 return new (arena()) ciKlassKlass(h_k); 301 } 302 } 303 } else if (o->is_method()) { 304 methodHandle h_m(THREAD, (methodOop)o); 305 return new (arena()) ciMethod(h_m); 306 } else if (o->is_methodData()) { 307 methodDataHandle h_md(THREAD, (methodDataOop)o); 308 return new (arena()) ciMethodData(h_md); 309 } else if (o->is_instance()) { 310 instanceHandle h_i(THREAD, (instanceOop)o); 311 if (java_dyn_CallSite::is_instance(o)) 312 return new (arena()) ciCallSite(h_i); 313 else if (java_dyn_MethodHandle::is_instance(o)) 314 return new (arena()) ciMethodHandle(h_i); 315 else 316 return new (arena()) ciInstance(h_i); 317 } else if (o->is_objArray()) { 318 objArrayHandle h_oa(THREAD, (objArrayOop)o); 319 return new (arena()) ciObjArray(h_oa); 320 } else if (o->is_typeArray()) { 321 typeArrayHandle h_ta(THREAD, (typeArrayOop)o); 322 return new (arena()) ciTypeArray(h_ta); 323 } else if (o->is_constantPoolCache()) { 324 constantPoolCacheHandle h_cpc(THREAD, (constantPoolCacheOop) o); 325 return new (arena()) ciCPCache(h_cpc); 326 } 327 328 // The oop is of some type not supported by the compiler interface. 329 ShouldNotReachHere(); 330 return NULL; 331} 332 333//------------------------------------------------------------------ 334// ciObjectFactory::get_unloaded_method 335// 336// Get the ciMethod representing an unloaded/unfound method. 337// 338// Implementation note: unloaded methods are currently stored in 339// an unordered array, requiring a linear-time lookup for each 340// unloaded method. This may need to change. 341ciMethod* ciObjectFactory::get_unloaded_method(ciInstanceKlass* holder, 342 ciSymbol* name, 343 ciSymbol* signature) { 344 for (int i=0; i<_unloaded_methods->length(); i++) { 345 ciMethod* entry = _unloaded_methods->at(i); 346 if (entry->holder()->equals(holder) && 347 entry->name()->equals(name) && 348 entry->signature()->as_symbol()->equals(signature)) { 349 // We've found a match. 350 return entry; 351 } 352 } 353 354 // This is a new unloaded method. Create it and stick it in 355 // the cache. 356 ciMethod* new_method = new (arena()) ciMethod(holder, name, signature); 357 358 init_ident_of(new_method); 359 _unloaded_methods->append(new_method); 360 361 return new_method; 362} 363 364//------------------------------------------------------------------ 365// ciObjectFactory::get_unloaded_klass 366// 367// Get a ciKlass representing an unloaded klass. 368// 369// Implementation note: unloaded klasses are currently stored in 370// an unordered array, requiring a linear-time lookup for each 371// unloaded klass. This may need to change. 372ciKlass* ciObjectFactory::get_unloaded_klass(ciKlass* accessing_klass, 373 ciSymbol* name, 374 bool create_if_not_found) { 375 EXCEPTION_CONTEXT; 376 oop loader = NULL; 377 oop domain = NULL; 378 if (accessing_klass != NULL) { 379 loader = accessing_klass->loader(); 380 domain = accessing_klass->protection_domain(); 381 } 382 for (int i=0; i<_unloaded_klasses->length(); i++) { 383 ciKlass* entry = _unloaded_klasses->at(i); 384 if (entry->name()->equals(name) && 385 entry->loader() == loader && 386 entry->protection_domain() == domain) { 387 // We've found a match. 388 return entry; 389 } 390 } 391 392 if (!create_if_not_found) 393 return NULL; 394 395 // This is a new unloaded klass. Create it and stick it in 396 // the cache. 397 ciKlass* new_klass = NULL; 398 399 // Two cases: this is an unloaded objArrayKlass or an 400 // unloaded instanceKlass. Deal with both. 401 if (name->byte_at(0) == '[') { 402 // Decompose the name.' 403 jint dimension = 0; 404 symbolOop element_name = NULL; 405 BasicType element_type= FieldType::get_array_info(name->get_symbolOop(), 406 &dimension, 407 &element_name, 408 THREAD); 409 if (HAS_PENDING_EXCEPTION) { 410 CLEAR_PENDING_EXCEPTION; 411 CURRENT_THREAD_ENV->record_out_of_memory_failure(); 412 return ciEnv::_unloaded_ciobjarrayklass; 413 } 414 assert(element_type != T_ARRAY, "unsuccessful decomposition"); 415 ciKlass* element_klass = NULL; 416 if (element_type == T_OBJECT) { 417 ciEnv *env = CURRENT_THREAD_ENV; 418 ciSymbol* ci_name = env->get_object(element_name)->as_symbol(); 419 element_klass = 420 env->get_klass_by_name(accessing_klass, ci_name, false)->as_instance_klass(); 421 } else { 422 assert(dimension > 1, "one dimensional type arrays are always loaded."); 423 424 // The type array itself takes care of one of the dimensions. 425 dimension--; 426 427 // The element klass is a typeArrayKlass. 428 element_klass = ciTypeArrayKlass::make(element_type); 429 } 430 new_klass = new (arena()) ciObjArrayKlass(name, element_klass, dimension); 431 } else { 432 jobject loader_handle = NULL; 433 jobject domain_handle = NULL; 434 if (accessing_klass != NULL) { 435 loader_handle = accessing_klass->loader_handle(); 436 domain_handle = accessing_klass->protection_domain_handle(); 437 } 438 new_klass = new (arena()) ciInstanceKlass(name, loader_handle, domain_handle); 439 } 440 init_ident_of(new_klass); 441 _unloaded_klasses->append(new_klass); 442 443 return new_klass; 444} 445 446//------------------------------------------------------------------ 447// ciObjectFactory::get_empty_methodData 448// 449// Get the ciMethodData representing the methodData for a method with 450// none. 451ciMethodData* ciObjectFactory::get_empty_methodData() { 452 ciMethodData* new_methodData = new (arena()) ciMethodData(); 453 init_ident_of(new_methodData); 454 return new_methodData; 455} 456 457//------------------------------------------------------------------ 458// ciObjectFactory::get_return_address 459// 460// Get a ciReturnAddress for a specified bci. 461ciReturnAddress* ciObjectFactory::get_return_address(int bci) { 462 for (int i=0; i<_return_addresses->length(); i++) { 463 ciReturnAddress* entry = _return_addresses->at(i); 464 if (entry->bci() == bci) { 465 // We've found a match. 466 return entry; 467 } 468 } 469 470 ciReturnAddress* new_ret_addr = new (arena()) ciReturnAddress(bci); 471 init_ident_of(new_ret_addr); 472 _return_addresses->append(new_ret_addr); 473 return new_ret_addr; 474} 475 476// ------------------------------------------------------------------ 477// ciObjectFactory::init_ident_of 478void ciObjectFactory::init_ident_of(ciObject* obj) { 479 obj->set_ident(_next_ident++); 480} 481 482 483// ------------------------------------------------------------------ 484// ciObjectFactory::find 485// 486// Use binary search to find the position of this oop in the cache. 487// If there is no entry in the cache corresponding to this oop, return 488// the position at which the oop should be inserted. 489int ciObjectFactory::find(oop key, GrowableArray<ciObject*>* objects) { 490 int min = 0; 491 int max = objects->length()-1; 492 493 // print_contents(); 494 495 while (max >= min) { 496 int mid = (max + min) / 2; 497 oop value = objects->at(mid)->get_oop(); 498 if (value < key) { 499 min = mid + 1; 500 } else if (value > key) { 501 max = mid - 1; 502 } else { 503 return mid; 504 } 505 } 506 return min; 507} 508 509// ------------------------------------------------------------------ 510// ciObjectFactory::is_found_at 511// 512// Verify that the binary seach found the given key. 513bool ciObjectFactory::is_found_at(int index, oop key, GrowableArray<ciObject*>* objects) { 514 return (index < objects->length() && 515 objects->at(index)->get_oop() == key); 516} 517 518 519// ------------------------------------------------------------------ 520// ciObjectFactory::insert 521// 522// Insert a ciObject into the table at some index. 523void ciObjectFactory::insert(int index, ciObject* obj, GrowableArray<ciObject*>* objects) { 524 int len = objects->length(); 525 if (len == index) { 526 objects->append(obj); 527 } else { 528 objects->append(objects->at(len-1)); 529 int pos; 530 for (pos = len-2; pos >= index; pos--) { 531 objects->at_put(pos+1,objects->at(pos)); 532 } 533 objects->at_put(index, obj); 534 } 535#ifdef ASSERT 536 if (CIObjectFactoryVerify) { 537 oop last = NULL; 538 for (int j = 0; j< objects->length(); j++) { 539 oop o = objects->at(j)->get_oop(); 540 assert(last < o, "out of order"); 541 last = o; 542 } 543 } 544#endif // ASSERT 545} 546 547static ciObjectFactory::NonPermObject* emptyBucket = NULL; 548 549// ------------------------------------------------------------------ 550// ciObjectFactory::find_non_perm 551// 552// Use a small hash table, hashed on the klass of the key. 553// If there is no entry in the cache corresponding to this oop, return 554// the null tail of the bucket into which the oop should be inserted. 555ciObjectFactory::NonPermObject* &ciObjectFactory::find_non_perm(oop key) { 556 // Be careful: is_perm might change from false to true. 557 // Thus, there might be a matching perm object in the table. 558 // If there is, this probe must find it. 559 if (key->is_perm() && _non_perm_count == 0) { 560 return emptyBucket; 561 } else if (key->is_instance()) { 562 if (key->klass() == SystemDictionary::Class_klass()) { 563 // class mirror instances are always perm 564 return emptyBucket; 565 } 566 // fall through to probe 567 } else if (key->is_array()) { 568 // fall through to probe 569 } else { 570 // not an array or instance 571 return emptyBucket; 572 } 573 574 ciObject* klass = get(key->klass()); 575 NonPermObject* *bp = &_non_perm_bucket[(unsigned) klass->hash() % NON_PERM_BUCKETS]; 576 for (NonPermObject* p; (p = (*bp)) != NULL; bp = &p->next()) { 577 if (is_equal(p, key)) break; 578 } 579 return (*bp); 580} 581 582 583 584// ------------------------------------------------------------------ 585// Code for for NonPermObject 586// 587inline ciObjectFactory::NonPermObject::NonPermObject(ciObjectFactory::NonPermObject* &bucket, oop key, ciObject* object) { 588 assert(ciObjectFactory::is_initialized(), ""); 589 _object = object; 590 _next = bucket; 591 bucket = this; 592} 593 594 595 596// ------------------------------------------------------------------ 597// ciObjectFactory::insert_non_perm 598// 599// Insert a ciObject into the non-perm table. 600void ciObjectFactory::insert_non_perm(ciObjectFactory::NonPermObject* &where, oop key, ciObject* obj) { 601 assert(&where != &emptyBucket, "must not try to fill empty bucket"); 602 NonPermObject* p = new (arena()) NonPermObject(where, key, obj); 603 assert(where == p && is_equal(p, key) && p->object() == obj, "entry must match"); 604 assert(find_non_perm(key) == p, "must find the same spot"); 605 ++_non_perm_count; 606} 607 608// ------------------------------------------------------------------ 609// ciObjectFactory::vm_symbol_at 610// Get the ciSymbol corresponding to some index in vmSymbols. 611ciSymbol* ciObjectFactory::vm_symbol_at(int index) { 612 assert(index >= vmSymbols::FIRST_SID && index < vmSymbols::SID_LIMIT, "oob"); 613 return _shared_ci_symbols[index]; 614} 615 616// ------------------------------------------------------------------ 617// ciObjectFactory::print_contents_impl 618void ciObjectFactory::print_contents_impl() { 619 int len = _ci_objects->length(); 620 tty->print_cr("ciObjectFactory (%d) oop contents:", len); 621 for (int i=0; i<len; i++) { 622 _ci_objects->at(i)->print(); 623 tty->cr(); 624 } 625} 626 627// ------------------------------------------------------------------ 628// ciObjectFactory::print_contents 629void ciObjectFactory::print_contents() { 630 print(); 631 tty->cr(); 632 GUARDED_VM_ENTRY(print_contents_impl();) 633} 634 635// ------------------------------------------------------------------ 636// ciObjectFactory::print 637// 638// Print debugging information about the object factory 639void ciObjectFactory::print() { 640 tty->print("<ciObjectFactory oops=%d unloaded_methods=%d unloaded_klasses=%d>", 641 _ci_objects->length(), _unloaded_methods->length(), 642 _unloaded_klasses->length()); 643} 644