--- old/src/share/vm/ci/ciInstanceKlass.cpp 2016-12-02 14:22:05.699886110 +0100 +++ new/src/share/vm/ci/ciInstanceKlass.cpp 2016-12-02 14:22:05.515886104 +0100 @@ -59,7 +59,8 @@ _has_nonstatic_fields = ik->has_nonstatic_fields(); _has_default_methods = ik->has_default_methods(); _is_anonymous = ik->is_anonymous(); - _nonstatic_fields = NULL; // initialized lazily by compute_nonstatic_fields: + _nonstatic_fields = NULL; // initialized lazily by compute_nonstatic_fields + _nof_declared_nonstatic_fields = -1; // initialized lazily by compute_nonstatic_fields _has_injected_fields = -1; _implementor = NULL; // we will fill these lazily @@ -100,7 +101,8 @@ _init_state = (InstanceKlass::ClassState)0; _nonstatic_field_size = -1; _has_nonstatic_fields = false; - _nonstatic_fields = NULL; + _nonstatic_fields = NULL; // initialized lazily by compute_nonstatic_fields + _nof_declared_nonstatic_fields = -1; // initialized lazily by compute_nonstatic_fields _has_injected_fields = -1; _is_anonymous = false; _loader = loader; @@ -450,6 +452,7 @@ if (!has_nonstatic_fields()) { Arena* arena = CURRENT_ENV->arena(); _nonstatic_fields = new (arena) GrowableArray(arena, 0, 0, NULL); + _nof_declared_nonstatic_fields = 0; return 0; } assert(!is_java_lang_Object(), "bootstrap OK"); @@ -467,6 +470,7 @@ // See if I am no larger than my super; if so, I can use his fields. if (fsize == super_fsize) { _nonstatic_fields = super_fields; + _nof_declared_nonstatic_fields = super->nof_declared_nonstatic_fields(); return super_fields->length(); } } @@ -480,8 +484,10 @@ // This can happen if this class (java.lang.Class) has invisible fields. if (super_fields != NULL) { _nonstatic_fields = super_fields; + _nof_declared_nonstatic_fields = super->nof_declared_nonstatic_fields(); return super_fields->length(); } else { + _nof_declared_nonstatic_fields = 0; return 0; } } @@ -510,11 +516,15 @@ // allocate the array: if (flen == 0) { + _nof_declared_nonstatic_fields = flen; return NULL; // return nothing if none are locally declared } + if (super_fields != NULL) { flen += super_fields->length(); } + _nof_declared_nonstatic_fields = flen; + fields = new (arena) GrowableArray(arena, flen, 0, NULL); if (super_fields != NULL) { fields->appendAll(super_fields);