void do_object(oop obj) { // Mark String objects referenced by constant pool entries. if (obj->is_constantPool()) { constantPoolOop pool = constantPoolOop(obj); pool->shared_strings_iterate(&mark_objects); return; } }
void constantPoolKlass::oop_verify_on(oop obj, outputStream* st) { Klass::oop_verify_on(obj, st); guarantee(obj->is_constantPool(), "object must be constant pool"); constantPoolOop cp = constantPoolOop(obj); guarantee(cp->is_perm(), "should be in permspace"); if (!cp->partially_loaded()) { oop* base = (oop*)cp->base(); for (int i = 0; i< cp->length(); i++) { if (cp->tag_at(i).is_klass()) { guarantee((*base)->is_perm(), "should be in permspace"); guarantee((*base)->is_klass(), "should be klass"); } if (cp->tag_at(i).is_unresolved_klass()) { guarantee((*base)->is_perm(), "should be in permspace"); guarantee((*base)->is_symbol() || (*base)->is_klass(), "should be symbol or klass"); } if (cp->tag_at(i).is_symbol()) { guarantee((*base)->is_perm(), "should be in permspace"); guarantee((*base)->is_symbol(), "should be symbol"); } if (cp->tag_at(i).is_unresolved_string()) { guarantee((*base)->is_perm(), "should be in permspace"); guarantee((*base)->is_symbol() || (*base)->is_instance(), "should be symbol or instance"); } if (cp->tag_at(i).is_string()) { if (!cp->has_pseudo_string()) { guarantee((*base)->is_perm(), "should be in permspace"); guarantee((*base)->is_instance(), "should be instance"); } else { // can be non-perm, can be non-instance (array) } } base++; } guarantee(cp->tags()->is_perm(), "should be in permspace"); guarantee(cp->tags()->is_typeArray(), "should be type array"); if (cp->cache() != NULL) { // Note: cache() can be NULL before a class is completely setup or // in temporary constant pools used during constant pool merging guarantee(cp->cache()->is_perm(), "should be in permspace"); guarantee(cp->cache()->is_constantPoolCache(), "should be constant pool cache"); } if (cp->pool_holder() != NULL) { // Note: pool_holder() can be NULL in temporary constant pools // used during constant pool merging guarantee(cp->pool_holder()->is_perm(), "should be in permspace"); guarantee(cp->pool_holder()->is_klass(), "should be klass"); } } }
void do_object(oop obj) { // Mark symbols refered to by method objects. if (obj->is_method()) { methodOop m = methodOop(obj); mark_object(m->name()); mark_object(m->signature()); } // Mark symbols referenced by klass objects which are read-only. else if (obj->is_klass()) { if (obj->blueprint()->oop_is_instanceKlass()) { instanceKlass* ik = instanceKlass::cast((klassOop)obj); mark_object(ik->name()); mark_object(ik->generic_signature()); mark_object(ik->source_file_name()); mark_object(ik->source_debug_extension()); typeArrayOop inner_classes = ik->inner_classes(); if (inner_classes != NULL) { int length = inner_classes->length(); for (int i = 0; i < length; i += instanceKlass::inner_class_next_offset) { int ioff = i + instanceKlass::inner_class_inner_name_offset; int index = inner_classes->ushort_at(ioff); if (index != 0) { mark_object(ik->constants()->symbol_at(index)); } } } ik->field_names_and_sigs_iterate(&mark_all); } } // Mark symbols referenced by other constantpool entries. if (obj->is_constantPool()) { constantPoolOop(obj)->shared_symbols_iterate(&mark_all); } }
void do_object(oop obj) { // The METHODS() OBJARRAYS CANNOT BE MADE READ-ONLY, even though // it is never modified. Otherwise, they will be pre-marked; the // GC marking phase will skip them; and by skipping them will fail // to mark the methods objects referenced by the array. if (obj->is_klass()) { mark_object(obj); Klass* k = klassOop(obj)->klass_part(); mark_object(k->java_mirror()); if (obj->blueprint()->oop_is_instanceKlass()) { instanceKlass* ik = (instanceKlass*)k; mark_object(ik->methods()); mark_object(ik->constants()); } if (obj->blueprint()->oop_is_javaArray()) { arrayKlass* ak = (arrayKlass*)k; mark_object(ak->component_mirror()); } return; } // Mark constantPool tags and the constantPoolCache. else if (obj->is_constantPool()) { constantPoolOop pool = constantPoolOop(obj); mark_object(pool->cache()); pool->shared_tags_iterate(&mark_objects); return; } // Mark all method objects. if (obj->is_method()) { mark_object(obj); } }
int constantPoolKlass::oop_size(oop obj) const { assert(obj->is_constantPool(), "must be constantPool"); return constantPoolOop(obj)->object_size(); }
void constantPoolKlass::oop_set_partially_loaded(oop obj) { assert(obj->is_constantPool(), "object must be constant pool"); constantPoolOop cp = constantPoolOop(obj); assert(cp->pool_holder() == NULL, "just checking"); cp->set_pool_holder((klassOop) cp); // Temporarily set pool holder to point to self }
bool constantPoolKlass::oop_partially_loaded(oop obj) const { assert(obj->is_constantPool(), "object must be constant pool"); constantPoolOop cp = constantPoolOop(obj); return cp->tags() == NULL || cp->pool_holder() == (klassOop) cp; // Check whether pool holder points to self }
void constantPoolKlass::oop_print_on(oop obj, outputStream* st) { EXCEPTION_MARK; oop anObj; assert(obj->is_constantPool(), "must be constantPool"); Klass::oop_print_on(obj, st); constantPoolOop cp = constantPoolOop(obj); if (cp->flags() != 0) { st->print(" - flags : 0x%x", cp->flags()); if (cp->has_pseudo_string()) st->print(" has_pseudo_string"); if (cp->has_invokedynamic()) st->print(" has_invokedynamic"); st->cr(); } // Temp. remove cache so we can do lookups with original indicies. constantPoolCacheHandle cache (THREAD, cp->cache()); cp->set_cache(NULL); for (int index = 1; index < cp->length(); index++) { // Index 0 is unused st->print(" - %3d : ", index); cp->tag_at(index).print_on(st); st->print(" : "); switch (cp->tag_at(index).value()) { case JVM_CONSTANT_Class : { anObj = cp->klass_at(index, CATCH); anObj->print_value_on(st); st->print(" {0x%lx}", (address)anObj); } break; case JVM_CONSTANT_Fieldref : case JVM_CONSTANT_Methodref : case JVM_CONSTANT_InterfaceMethodref : st->print("klass_index=%d", cp->klass_ref_index_at(index)); st->print(" name_and_type_index=%d", cp->name_and_type_ref_index_at(index)); break; case JVM_CONSTANT_UnresolvedString : case JVM_CONSTANT_String : if (cp->is_pseudo_string_at(index)) { anObj = cp->pseudo_string_at(index); } else { anObj = cp->string_at(index, CATCH); } anObj->print_value_on(st); st->print(" {0x%lx}", (address)anObj); break; case JVM_CONSTANT_Integer : st->print("%d", cp->int_at(index)); break; case JVM_CONSTANT_Float : st->print("%f", cp->float_at(index)); break; case JVM_CONSTANT_Long : st->print_jlong(cp->long_at(index)); index++; // Skip entry following eigth-byte constant break; case JVM_CONSTANT_Double : st->print("%lf", cp->double_at(index)); index++; // Skip entry following eigth-byte constant break; case JVM_CONSTANT_NameAndType : st->print("name_index=%d", cp->name_ref_index_at(index)); st->print(" signature_index=%d", cp->signature_ref_index_at(index)); break; case JVM_CONSTANT_Utf8 : cp->symbol_at(index)->print_value_on(st); break; case JVM_CONSTANT_UnresolvedClass : // fall-through case JVM_CONSTANT_UnresolvedClassInError: { // unresolved_klass_at requires lock or safe world. oop entry = *cp->obj_at_addr(index); entry->print_value_on(st); } break; default: ShouldNotReachHere(); break; } st->cr(); } st->cr(); // Restore cache cp->set_cache(cache()); }
bool constantPoolKlass::oop_is_conc_safe(oop obj) const { assert(obj->is_constantPool(), "must be constantPool"); return constantPoolOop(obj)->is_conc_safe(); }