RFR: 8144908: Remove apply_to_weak_ref_discovered_field override for UpdateRSOopClosure

Kim Barrett kim.barrett at oracle.com
Tue Dec 8 21:16:52 UTC 2015

On Dec 8, 2015, at 3:34 PM, Jon Masamitsu <jon.masamitsu at oracle.com> wrote:
> Stefan,
> At line 41 in "share/vm/oops/instanceRefKlass.inline.hpp"
>    38  void InstanceRefKlass::oop_oop_iterate_ref_processing_specialized(oop obj, OopClosureType* closure,
> Contains& contains) {
>    39    T* disc_addr = (T*)java_lang_ref_Reference::discovered_addr(obj);
>    40    if (closure->apply_to_weak_ref_discovered_field()) {
>    41      Devirtualizer<nv>::do_oop(closure, disc_addr);
>    42    }
> you're saying that the "next" field of "obj" is
> non-null?  Did you try adding a guarantee to that
> effect and run your testing (without your change,
> of course)?

If next is NULL then, <em>for the specific closure in question</em>, discovered must also be NULL here.  There is no point in applying closure to the NULL-valued discovered field.  There are other closures for which that relationship between next and discovered doesn’t hold, but we think it will turn out that none of them have apply_to_weak_ref_discovered_field returning true.

Note that if next is non-NULL, then the closure will be applied to discovered in the normal path, and there is no need for this special case forced application (and is in fact duplicating work at present, which could be a bug on its own, except we think the special case is going away).

More information about the hotspot-gc-dev mailing list