< prev index next >

src/hotspot/share/ci/ciInstanceKlass.cpp

Print this page

        

*** 34,43 **** --- 34,47 ---- #include "oops/oop.inline.hpp" #include "oops/fieldStreams.hpp" #include "runtime/fieldDescriptor.hpp" #include "runtime/handles.inline.hpp" #include "runtime/jniHandles.inline.hpp" + #include "utilities/macros.hpp" + #if INCLUDE_SHENANDOAHGC + #include "gc/shenandoah/shenandoahBrooksPointer.hpp" + #endif // ciInstanceKlass // // This class represents a Klass* in the HotSpot virtual machine // whose Klass part in an InstanceKlass.
*** 63,72 **** --- 67,77 ---- _has_nonstatic_fields = ik->has_nonstatic_fields(); _has_nonstatic_concrete_methods = ik->has_nonstatic_concrete_methods(); _is_anonymous = ik->is_anonymous(); _nonstatic_fields = NULL; // initialized lazily by compute_nonstatic_fields: _has_injected_fields = -1; + _has_object_fields = -1; _implementor = NULL; // we will fill these lazily // Ensure that the metadata wrapped by the ciMetadata is kept alive by GC. // This is primarily useful for metadata which is considered as weak roots // by the GC but need to be strong roots if reachable from a current compilation.
*** 120,129 **** --- 125,135 ---- _init_state = (InstanceKlass::ClassState)0; _nonstatic_field_size = -1; _has_nonstatic_fields = false; _nonstatic_fields = NULL; _has_injected_fields = -1; + _has_object_fields = -1; _is_anonymous = false; _loader = loader; _protection_domain = protection_domain; _is_shared = false; _super = NULL;
*** 197,212 **** // ------------------------------------------------------------------ // ciInstanceKlass::get_canonical_holder // ciInstanceKlass* ciInstanceKlass::get_canonical_holder(int offset) { #ifdef ASSERT ! if (!(offset >= 0 && offset < layout_helper())) { tty->print("*** get_canonical_holder(%d) on ", offset); this->print(); tty->print_cr(" ***"); ! }; ! assert(offset >= 0 && offset < layout_helper(), "offset must be tame"); #endif if (offset < instanceOopDesc::base_offset_in_bytes()) { // All header offsets belong properly to java/lang/Object. return CURRENT_ENV->Object_klass(); --- 203,218 ---- // ------------------------------------------------------------------ // ciInstanceKlass::get_canonical_holder // ciInstanceKlass* ciInstanceKlass::get_canonical_holder(int offset) { #ifdef ASSERT ! if (!((offset >= 0 && offset < layout_helper()) SHENANDOAHGC_ONLY(|| (UseShenandoahGC && offset == ShenandoahBrooksPointer::byte_offset())))) { tty->print("*** get_canonical_holder(%d) on ", offset); this->print(); tty->print_cr(" ***"); ! fatal("offset must be tame"); ! } #endif if (offset < instanceOopDesc::base_offset_in_bytes()) { // All header offsets belong properly to java/lang/Object. return CURRENT_ENV->Object_klass();
*** 552,561 **** --- 558,580 ---- // may be concurrently initialized for shared ciInstanceKlass objects assert(_has_injected_fields == -1 || _has_injected_fields == has_injected_fields, "broken concurrent initialization"); _has_injected_fields = has_injected_fields; } + void ciInstanceKlass::compute_object_fields() { + for (int i = 0; i < nof_nonstatic_fields(); i++) { + ciField* f = nonstatic_field_at(i); + if (f->layout_type() == T_OBJECT) { + assert(_has_object_fields == -1 || _has_object_fields == 1, "broken concurrent initialization"); + _has_object_fields = 1; + return; + } + } + assert(_has_object_fields == -1 || _has_object_fields == 0, "broken concurrent initialization"); + _has_object_fields = 0; + } + // ------------------------------------------------------------------ // ciInstanceKlass::find_method // // Find a method in this klass. ciMethod* ciInstanceKlass::find_method(ciSymbol* name, ciSymbol* signature) {
*** 734,738 **** --- 753,781 ---- // on their value for correct replay. StaticFinalFieldPrinter sffp(out, ik->name()->as_quoted_ascii()); ik->do_local_static_fields(&sffp); } } + + #ifdef ASSERT + bool ciInstanceKlass::debug_final_field_at(int offset) { + GUARDED_VM_ENTRY( + InstanceKlass* ik = get_instanceKlass(); + fieldDescriptor fd; + if (ik->find_field_from_offset(offset, false, &fd)) { + return fd.is_final(); + } + ); + return false; + } + + bool ciInstanceKlass::debug_stable_field_at(int offset) { + GUARDED_VM_ENTRY( + InstanceKlass* ik = get_instanceKlass(); + fieldDescriptor fd; + if (ik->find_field_from_offset(offset, false, &fd)) { + return fd.is_stable(); + } + ); + return false; + } + #endif
< prev index next >