< prev index next >

src/hotspot/share/ci/ciInstanceKlass.cpp

Print this page

        

@@ -63,10 +63,11 @@
   _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,10 +121,11 @@
   _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;

@@ -552,10 +554,23 @@
   // 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) {
< prev index next >