1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/vm/oops/klass.cpp Sat Dec 01 00:00:00 2007 +0000 1.3 @@ -0,0 +1,562 @@ 1.4 +/* 1.5 + * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 1.24 + * have any questions. 1.25 + * 1.26 + */ 1.27 + 1.28 +# include "incls/_precompiled.incl" 1.29 +# include "incls/_klass.cpp.incl" 1.30 + 1.31 + 1.32 +bool Klass::is_subclass_of(klassOop k) const { 1.33 + // Run up the super chain and check 1.34 + klassOop t = as_klassOop(); 1.35 + 1.36 + if (t == k) return true; 1.37 + t = Klass::cast(t)->super(); 1.38 + 1.39 + while (t != NULL) { 1.40 + if (t == k) return true; 1.41 + t = Klass::cast(t)->super(); 1.42 + } 1.43 + return false; 1.44 +} 1.45 + 1.46 +bool Klass::search_secondary_supers(klassOop k) const { 1.47 + // Put some extra logic here out-of-line, before the search proper. 1.48 + // This cuts down the size of the inline method. 1.49 + 1.50 + // This is necessary, since I am never in my own secondary_super list. 1.51 + if (this->as_klassOop() == k) 1.52 + return true; 1.53 + // Scan the array-of-objects for a match 1.54 + int cnt = secondary_supers()->length(); 1.55 + for (int i = 0; i < cnt; i++) { 1.56 + if (secondary_supers()->obj_at(i) == k) { 1.57 + ((Klass*)this)->set_secondary_super_cache(k); 1.58 + return true; 1.59 + } 1.60 + } 1.61 + return false; 1.62 +} 1.63 + 1.64 +// Return self, except for abstract classes with exactly 1 1.65 +// implementor. Then return the 1 concrete implementation. 1.66 +Klass *Klass::up_cast_abstract() { 1.67 + Klass *r = this; 1.68 + while( r->is_abstract() ) { // Receiver is abstract? 1.69 + Klass *s = r->subklass(); // Check for exactly 1 subklass 1.70 + if( !s || s->next_sibling() ) // Oops; wrong count; give up 1.71 + return this; // Return 'this' as a no-progress flag 1.72 + r = s; // Loop till find concrete class 1.73 + } 1.74 + return r; // Return the 1 concrete class 1.75 +} 1.76 + 1.77 +// Find LCA in class heirarchy 1.78 +Klass *Klass::LCA( Klass *k2 ) { 1.79 + Klass *k1 = this; 1.80 + while( 1 ) { 1.81 + if( k1->is_subtype_of(k2->as_klassOop()) ) return k2; 1.82 + if( k2->is_subtype_of(k1->as_klassOop()) ) return k1; 1.83 + k1 = k1->super()->klass_part(); 1.84 + k2 = k2->super()->klass_part(); 1.85 + } 1.86 +} 1.87 + 1.88 + 1.89 +void Klass::check_valid_for_instantiation(bool throwError, TRAPS) { 1.90 + ResourceMark rm(THREAD); 1.91 + THROW_MSG(throwError ? vmSymbols::java_lang_InstantiationError() 1.92 + : vmSymbols::java_lang_InstantiationException(), external_name()); 1.93 +} 1.94 + 1.95 + 1.96 +void Klass::copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS) { 1.97 + THROW(vmSymbols::java_lang_ArrayStoreException()); 1.98 +} 1.99 + 1.100 + 1.101 +void Klass::initialize(TRAPS) { 1.102 + ShouldNotReachHere(); 1.103 +} 1.104 + 1.105 +bool Klass::compute_is_subtype_of(klassOop k) { 1.106 + assert(k->is_klass(), "argument must be a class"); 1.107 + return is_subclass_of(k); 1.108 +} 1.109 + 1.110 + 1.111 +methodOop Klass::uncached_lookup_method(symbolOop name, symbolOop signature) const { 1.112 +#ifdef ASSERT 1.113 + tty->print_cr("Error: uncached_lookup_method called on a klass oop." 1.114 + " Likely error: reflection method does not correctly" 1.115 + " wrap return value in a mirror object."); 1.116 +#endif 1.117 + ShouldNotReachHere(); 1.118 + return NULL; 1.119 +} 1.120 + 1.121 +klassOop Klass::base_create_klass_oop(KlassHandle& klass, int size, 1.122 + const Klass_vtbl& vtbl, TRAPS) { 1.123 + size = align_object_size(size); 1.124 + // allocate and initialize vtable 1.125 + Klass* kl = (Klass*) vtbl.allocate_permanent(klass, size, CHECK_NULL); 1.126 + klassOop k = kl->as_klassOop(); 1.127 + 1.128 + { // Preinitialize supertype information. 1.129 + // A later call to initialize_supers() may update these settings: 1.130 + kl->set_super(NULL); 1.131 + for (juint i = 0; i < Klass::primary_super_limit(); i++) { 1.132 + kl->_primary_supers[i] = NULL; 1.133 + } 1.134 + kl->set_secondary_supers(NULL); 1.135 + oop_store_without_check((oop*) &kl->_primary_supers[0], k); 1.136 + kl->set_super_check_offset(primary_supers_offset_in_bytes() + sizeof(oopDesc)); 1.137 + } 1.138 + 1.139 + kl->set_java_mirror(NULL); 1.140 + kl->set_modifier_flags(0); 1.141 + kl->set_layout_helper(Klass::_lh_neutral_value); 1.142 + kl->set_name(NULL); 1.143 + AccessFlags af; 1.144 + af.set_flags(0); 1.145 + kl->set_access_flags(af); 1.146 + kl->set_subklass(NULL); 1.147 + kl->set_next_sibling(NULL); 1.148 + kl->set_alloc_count(0); 1.149 + kl->set_alloc_size(0); 1.150 + 1.151 + kl->set_prototype_header(markOopDesc::prototype()); 1.152 + kl->set_biased_lock_revocation_count(0); 1.153 + kl->set_last_biased_lock_bulk_revocation_time(0); 1.154 + 1.155 + return k; 1.156 +} 1.157 + 1.158 +KlassHandle Klass::base_create_klass(KlassHandle& klass, int size, 1.159 + const Klass_vtbl& vtbl, TRAPS) { 1.160 + klassOop ek = base_create_klass_oop(klass, size, vtbl, THREAD); 1.161 + return KlassHandle(THREAD, ek); 1.162 +} 1.163 + 1.164 +void Klass_vtbl::post_new_init_klass(KlassHandle& klass, 1.165 + klassOop new_klass, 1.166 + int size) const { 1.167 + assert(!new_klass->klass_part()->null_vtbl(), "Not a complete klass"); 1.168 + CollectedHeap::post_allocation_install_obj_klass(klass, new_klass, size); 1.169 +} 1.170 + 1.171 +void* Klass_vtbl::operator new(size_t ignored, KlassHandle& klass, 1.172 + int size, TRAPS) { 1.173 + // The vtable pointer is installed during the execution of 1.174 + // constructors in the call to permanent_obj_allocate(). Delay 1.175 + // the installation of the klass pointer into the new klass "k" 1.176 + // until after the vtable pointer has been installed (i.e., until 1.177 + // after the return of permanent_obj_allocate(). 1.178 + klassOop k = 1.179 + (klassOop) CollectedHeap::permanent_obj_allocate_no_klass_install(klass, 1.180 + size, CHECK_NULL); 1.181 + return k->klass_part(); 1.182 +} 1.183 + 1.184 +jint Klass::array_layout_helper(BasicType etype) { 1.185 + assert(etype >= T_BOOLEAN && etype <= T_OBJECT, "valid etype"); 1.186 + // Note that T_ARRAY is not allowed here. 1.187 + int hsize = arrayOopDesc::base_offset_in_bytes(etype); 1.188 + int esize = type2aelembytes[etype]; 1.189 + bool isobj = (etype == T_OBJECT); 1.190 + int tag = isobj ? _lh_array_tag_obj_value : _lh_array_tag_type_value; 1.191 + int lh = array_layout_helper(tag, hsize, etype, exact_log2(esize)); 1.192 + 1.193 + assert(lh < (int)_lh_neutral_value, "must look like an array layout"); 1.194 + assert(layout_helper_is_javaArray(lh), "correct kind"); 1.195 + assert(layout_helper_is_objArray(lh) == isobj, "correct kind"); 1.196 + assert(layout_helper_is_typeArray(lh) == !isobj, "correct kind"); 1.197 + assert(layout_helper_header_size(lh) == hsize, "correct decode"); 1.198 + assert(layout_helper_element_type(lh) == etype, "correct decode"); 1.199 + assert(1 << layout_helper_log2_element_size(lh) == esize, "correct decode"); 1.200 + 1.201 + return lh; 1.202 +} 1.203 + 1.204 +bool Klass::can_be_primary_super_slow() const { 1.205 + if (super() == NULL) 1.206 + return true; 1.207 + else if (super()->klass_part()->super_depth() >= primary_super_limit()-1) 1.208 + return false; 1.209 + else 1.210 + return true; 1.211 +} 1.212 + 1.213 +void Klass::initialize_supers(klassOop k, TRAPS) { 1.214 + if (FastSuperclassLimit == 0) { 1.215 + // None of the other machinery matters. 1.216 + set_super(k); 1.217 + return; 1.218 + } 1.219 + if (k == NULL) { 1.220 + set_super(NULL); 1.221 + oop_store_without_check((oop*) &_primary_supers[0], (oop) this->as_klassOop()); 1.222 + assert(super_depth() == 0, "Object must already be initialized properly"); 1.223 + } else if (k != super() || k == SystemDictionary::object_klass()) { 1.224 + assert(super() == NULL || super() == SystemDictionary::object_klass(), 1.225 + "initialize this only once to a non-trivial value"); 1.226 + set_super(k); 1.227 + Klass* sup = k->klass_part(); 1.228 + int sup_depth = sup->super_depth(); 1.229 + juint my_depth = MIN2(sup_depth + 1, (int)primary_super_limit()); 1.230 + if (!can_be_primary_super_slow()) 1.231 + my_depth = primary_super_limit(); 1.232 + for (juint i = 0; i < my_depth; i++) { 1.233 + oop_store_without_check((oop*) &_primary_supers[i], (oop) sup->_primary_supers[i]); 1.234 + } 1.235 + klassOop *super_check_cell; 1.236 + if (my_depth < primary_super_limit()) { 1.237 + oop_store_without_check((oop*) &_primary_supers[my_depth], (oop) this->as_klassOop()); 1.238 + super_check_cell = &_primary_supers[my_depth]; 1.239 + } else { 1.240 + // Overflow of the primary_supers array forces me to be secondary. 1.241 + super_check_cell = &_secondary_super_cache; 1.242 + } 1.243 + set_super_check_offset((address)super_check_cell - (address) this->as_klassOop()); 1.244 + 1.245 +#ifdef ASSERT 1.246 + { 1.247 + juint j = super_depth(); 1.248 + assert(j == my_depth, "computed accessor gets right answer"); 1.249 + klassOop t = as_klassOop(); 1.250 + while (!Klass::cast(t)->can_be_primary_super()) { 1.251 + t = Klass::cast(t)->super(); 1.252 + j = Klass::cast(t)->super_depth(); 1.253 + } 1.254 + for (juint j1 = j+1; j1 < primary_super_limit(); j1++) { 1.255 + assert(primary_super_of_depth(j1) == NULL, "super list padding"); 1.256 + } 1.257 + while (t != NULL) { 1.258 + assert(primary_super_of_depth(j) == t, "super list initialization"); 1.259 + t = Klass::cast(t)->super(); 1.260 + --j; 1.261 + } 1.262 + assert(j == (juint)-1, "correct depth count"); 1.263 + } 1.264 +#endif 1.265 + } 1.266 + 1.267 + if (secondary_supers() == NULL) { 1.268 + KlassHandle this_kh (THREAD, this); 1.269 + 1.270 + // Now compute the list of secondary supertypes. 1.271 + // Secondaries can occasionally be on the super chain, 1.272 + // if the inline "_primary_supers" array overflows. 1.273 + int extras = 0; 1.274 + klassOop p; 1.275 + for (p = super(); !(p == NULL || p->klass_part()->can_be_primary_super()); p = p->klass_part()->super()) { 1.276 + ++extras; 1.277 + } 1.278 + 1.279 + // Compute the "real" non-extra secondaries. 1.280 + objArrayOop secondary_oops = compute_secondary_supers(extras, CHECK); 1.281 + objArrayHandle secondaries (THREAD, secondary_oops); 1.282 + 1.283 + // Store the extra secondaries in the first array positions: 1.284 + int fillp = extras; 1.285 + for (p = this_kh->super(); !(p == NULL || p->klass_part()->can_be_primary_super()); p = p->klass_part()->super()) { 1.286 + int i; // Scan for overflow primaries being duplicates of 2nd'arys 1.287 + 1.288 + // This happens frequently for very deeply nested arrays: the 1.289 + // primary superclass chain overflows into the secondary. The 1.290 + // secondary list contains the element_klass's secondaries with 1.291 + // an extra array dimension added. If the element_klass's 1.292 + // secondary list already contains some primary overflows, they 1.293 + // (with the extra level of array-ness) will collide with the 1.294 + // normal primary superclass overflows. 1.295 + for( i = extras; i < secondaries->length(); i++ ) 1.296 + if( secondaries->obj_at(i) == p ) 1.297 + break; 1.298 + if( i < secondaries->length() ) 1.299 + continue; // It's a dup, don't put it in 1.300 + secondaries->obj_at_put(--fillp, p); 1.301 + } 1.302 + // See if we had some dup's, so the array has holes in it. 1.303 + if( fillp > 0 ) { 1.304 + // Pack the array. Drop the old secondaries array on the floor 1.305 + // and let GC reclaim it. 1.306 + objArrayOop s2 = oopFactory::new_system_objArray(secondaries->length() - fillp, CHECK); 1.307 + for( int i = 0; i < s2->length(); i++ ) 1.308 + s2->obj_at_put( i, secondaries->obj_at(i+fillp) ); 1.309 + secondaries = objArrayHandle(THREAD, s2); 1.310 + } 1.311 + 1.312 + #ifdef ASSERT 1.313 + if (secondaries() != Universe::the_array_interfaces_array()) { 1.314 + // We must not copy any NULL placeholders left over from bootstrap. 1.315 + for (int j = 0; j < secondaries->length(); j++) { 1.316 + assert(secondaries->obj_at(j) != NULL, "correct bootstrapping order"); 1.317 + } 1.318 + } 1.319 + #endif 1.320 + 1.321 + this_kh->set_secondary_supers(secondaries()); 1.322 + } 1.323 +} 1.324 + 1.325 +objArrayOop Klass::compute_secondary_supers(int num_extra_slots, TRAPS) { 1.326 + assert(num_extra_slots == 0, "override for complex klasses"); 1.327 + return Universe::the_empty_system_obj_array(); 1.328 +} 1.329 + 1.330 + 1.331 +Klass* Klass::subklass() const { 1.332 + return _subklass == NULL ? NULL : Klass::cast(_subklass); 1.333 +} 1.334 + 1.335 +instanceKlass* Klass::superklass() const { 1.336 + assert(super() == NULL || super()->klass_part()->oop_is_instance(), "must be instance klass"); 1.337 + return _super == NULL ? NULL : instanceKlass::cast(_super); 1.338 +} 1.339 + 1.340 +Klass* Klass::next_sibling() const { 1.341 + return _next_sibling == NULL ? NULL : Klass::cast(_next_sibling); 1.342 +} 1.343 + 1.344 +void Klass::set_subklass(klassOop s) { 1.345 + assert(s != as_klassOop(), "sanity check"); 1.346 + oop_store_without_check((oop*)&_subklass, s); 1.347 +} 1.348 + 1.349 +void Klass::set_next_sibling(klassOop s) { 1.350 + assert(s != as_klassOop(), "sanity check"); 1.351 + oop_store_without_check((oop*)&_next_sibling, s); 1.352 +} 1.353 + 1.354 +void Klass::append_to_sibling_list() { 1.355 + debug_only(if (!SharedSkipVerify) as_klassOop()->verify();) 1.356 + // add ourselves to superklass' subklass list 1.357 + instanceKlass* super = superklass(); 1.358 + if (super == NULL) return; // special case: class Object 1.359 + assert(SharedSkipVerify || 1.360 + (!super->is_interface() // interfaces cannot be supers 1.361 + && (super->superklass() == NULL || !is_interface())), 1.362 + "an interface can only be a subklass of Object"); 1.363 + klassOop prev_first_subklass = super->subklass_oop(); 1.364 + if (prev_first_subklass != NULL) { 1.365 + // set our sibling to be the superklass' previous first subklass 1.366 + set_next_sibling(prev_first_subklass); 1.367 + } 1.368 + // make ourselves the superklass' first subklass 1.369 + super->set_subklass(as_klassOop()); 1.370 + debug_only(if (!SharedSkipVerify) as_klassOop()->verify();) 1.371 +} 1.372 + 1.373 +void Klass::remove_from_sibling_list() { 1.374 + // remove receiver from sibling list 1.375 + instanceKlass* super = superklass(); 1.376 + assert(super != NULL || as_klassOop() == SystemDictionary::object_klass(), "should have super"); 1.377 + if (super == NULL) return; // special case: class Object 1.378 + if (super->subklass() == this) { 1.379 + // first subklass 1.380 + super->set_subklass(_next_sibling); 1.381 + } else { 1.382 + Klass* sib = super->subklass(); 1.383 + while (sib->next_sibling() != this) { 1.384 + sib = sib->next_sibling(); 1.385 + }; 1.386 + sib->set_next_sibling(_next_sibling); 1.387 + } 1.388 +} 1.389 + 1.390 +void Klass::follow_weak_klass_links( BoolObjectClosure* is_alive, OopClosure* keep_alive) { 1.391 + // This klass is alive but the subklass and siblings are not followed/updated. 1.392 + // We update the subklass link and the subklass' sibling links here. 1.393 + // Our own sibling link will be updated by our superclass (which must be alive 1.394 + // since we are). 1.395 + assert(is_alive->do_object_b(as_klassOop()), "just checking, this should be live"); 1.396 + if (ClassUnloading) { 1.397 + klassOop sub = subklass_oop(); 1.398 + if (sub != NULL && !is_alive->do_object_b(sub)) { 1.399 + // first subklass not alive, find first one alive 1.400 + do { 1.401 +#ifndef PRODUCT 1.402 + if (TraceClassUnloading && WizardMode) { 1.403 + ResourceMark rm; 1.404 + tty->print_cr("[Unlinking class (subclass) %s]", sub->klass_part()->external_name()); 1.405 + } 1.406 +#endif 1.407 + sub = sub->klass_part()->next_sibling_oop(); 1.408 + } while (sub != NULL && !is_alive->do_object_b(sub)); 1.409 + set_subklass(sub); 1.410 + } 1.411 + // now update the subklass' sibling list 1.412 + while (sub != NULL) { 1.413 + klassOop next = sub->klass_part()->next_sibling_oop(); 1.414 + if (next != NULL && !is_alive->do_object_b(next)) { 1.415 + // first sibling not alive, find first one alive 1.416 + do { 1.417 +#ifndef PRODUCT 1.418 + if (TraceClassUnloading && WizardMode) { 1.419 + ResourceMark rm; 1.420 + tty->print_cr("[Unlinking class (sibling) %s]", next->klass_part()->external_name()); 1.421 + } 1.422 +#endif 1.423 + next = next->klass_part()->next_sibling_oop(); 1.424 + } while (next != NULL && !is_alive->do_object_b(next)); 1.425 + sub->klass_part()->set_next_sibling(next); 1.426 + } 1.427 + sub = next; 1.428 + } 1.429 + } else { 1.430 + // Always follow subklass and sibling link. This will prevent any klasses from 1.431 + // being unloaded (all classes are transitively linked from java.lang.Object). 1.432 + keep_alive->do_oop(adr_subklass()); 1.433 + keep_alive->do_oop(adr_next_sibling()); 1.434 + } 1.435 +} 1.436 + 1.437 + 1.438 +void Klass::remove_unshareable_info() { 1.439 + if (oop_is_instance()) { 1.440 + instanceKlass* ik = (instanceKlass*)this; 1.441 + if (ik->is_linked()) { 1.442 + ik->unlink_class(); 1.443 + } 1.444 + } 1.445 + set_subklass(NULL); 1.446 + set_next_sibling(NULL); 1.447 +} 1.448 + 1.449 + 1.450 +klassOop Klass::array_klass_or_null(int rank) { 1.451 + EXCEPTION_MARK; 1.452 + // No exception can be thrown by array_klass_impl when called with or_null == true. 1.453 + // (In anycase, the execption mark will fail if it do so) 1.454 + return array_klass_impl(true, rank, THREAD); 1.455 +} 1.456 + 1.457 + 1.458 +klassOop Klass::array_klass_or_null() { 1.459 + EXCEPTION_MARK; 1.460 + // No exception can be thrown by array_klass_impl when called with or_null == true. 1.461 + // (In anycase, the execption mark will fail if it do so) 1.462 + return array_klass_impl(true, THREAD); 1.463 +} 1.464 + 1.465 + 1.466 +klassOop Klass::array_klass_impl(bool or_null, int rank, TRAPS) { 1.467 + fatal("array_klass should be dispatched to instanceKlass, objArrayKlass or typeArrayKlass"); 1.468 + return NULL; 1.469 +} 1.470 + 1.471 + 1.472 +klassOop Klass::array_klass_impl(bool or_null, TRAPS) { 1.473 + fatal("array_klass should be dispatched to instanceKlass, objArrayKlass or typeArrayKlass"); 1.474 + return NULL; 1.475 +} 1.476 + 1.477 + 1.478 +void Klass::with_array_klasses_do(void f(klassOop k)) { 1.479 + f(as_klassOop()); 1.480 +} 1.481 + 1.482 + 1.483 +const char* Klass::external_name() const { 1.484 + return name()->as_klass_external_name(); 1.485 +} 1.486 + 1.487 + 1.488 +char* Klass::signature_name() const { 1.489 + return name()->as_C_string(); 1.490 +} 1.491 + 1.492 +// Unless overridden, modifier_flags is 0. 1.493 +jint Klass::compute_modifier_flags(TRAPS) const { 1.494 + return 0; 1.495 +} 1.496 + 1.497 +int Klass::atomic_incr_biased_lock_revocation_count() { 1.498 + return (int) Atomic::add(1, &_biased_lock_revocation_count); 1.499 +} 1.500 + 1.501 +// Unless overridden, jvmti_class_status has no flags set. 1.502 +jint Klass::jvmti_class_status() const { 1.503 + return 0; 1.504 +} 1.505 + 1.506 +#ifndef PRODUCT 1.507 + 1.508 +// Printing 1.509 + 1.510 +void Klass::oop_print_on(oop obj, outputStream* st) { 1.511 + ResourceMark rm; 1.512 + // print title 1.513 + st->print_cr("%s ", internal_name()); 1.514 + obj->print_address_on(st); 1.515 + 1.516 + if (WizardMode) { 1.517 + // print header 1.518 + obj->mark()->print_on(st); 1.519 + } 1.520 + 1.521 + // print class 1.522 + st->print(" - klass: "); 1.523 + obj->klass()->print_value_on(st); 1.524 + st->cr(); 1.525 +} 1.526 + 1.527 + 1.528 +void Klass::oop_print_value_on(oop obj, outputStream* st) { 1.529 + // print title 1.530 + ResourceMark rm; // Cannot print in debug mode without this 1.531 + st->print("%s", internal_name()); 1.532 + obj->print_address_on(st); 1.533 +} 1.534 + 1.535 +#endif 1.536 + 1.537 +// Verification 1.538 + 1.539 +void Klass::oop_verify_on(oop obj, outputStream* st) { 1.540 + guarantee(obj->is_oop(), "should be oop"); 1.541 + guarantee(obj->klass()->is_perm(), "should be in permspace"); 1.542 + guarantee(obj->klass()->is_klass(), "klass field is not a klass"); 1.543 +} 1.544 + 1.545 + 1.546 +void Klass::oop_verify_old_oop(oop obj, oop* p, bool allow_dirty) { 1.547 + /* $$$ I think this functionality should be handled by verification of 1.548 + 1.549 + RememberedSet::verify_old_oop(obj, p, allow_dirty, false); 1.550 + 1.551 + the card table. */ 1.552 +} 1.553 + 1.554 +#ifndef PRODUCT 1.555 + 1.556 +void Klass::verify_vtable_index(int i) { 1.557 + assert(oop_is_instance() || oop_is_array(), "only instanceKlass and arrayKlass have vtables"); 1.558 + if (oop_is_instance()) { 1.559 + assert(i>=0 && i<((instanceKlass*)this)->vtable_length()/vtableEntry::size(), "index out of bounds"); 1.560 + } else { 1.561 + assert(i>=0 && i<((arrayKlass*)this)->vtable_length()/vtableEntry::size(), "index out of bounds"); 1.562 + } 1.563 +} 1.564 + 1.565 +#endif