RFR: 8175318: Performance issue regarding local JNI references

Kim Barrett kim.barrett at oracle.com
Fri Jul 21 20:29:33 UTC 2017

> On Jul 21, 2017, at 2:52 AM, Aleksey Shipilev <shade at redhat.com> wrote:
> On 07/20/2017 11:09 PM, Kim Barrett wrote:
>> I decided not to bother with is_clear() right now.  There would just be the couple of
>> uses in the vicinity of this change, plus a !is_clear() in print_statistics.  If anything,
>> I’d be inclined to remove the unused clear() function. I looked at the places where
>> we zero _top, and I don’t think any of them are particularly improved by calling clear().
> IMO, clear() and is_clear() capture the intent of _top manipulation better, thus
> improving long-term maintainability. Our descendants would not have to read all
> the uses of _top to verify "_top = 0" indeed serves as clear(). But, your call.
> -Aleksey

Thanks for reviewing.

The term "clear" in this context (as opposed to clearing a referent)
is presently only used in that bit of code being changed in
allocate_handle.  This suggests stronger semantics for "clear" than
just "_top == 0".  Perhaps clear() is the place where the followers
should be cleared too, rather than allocate_handle (after adding some
calls to clear(), of course!).  And perhaps is_clear() should, when
true, additionally assert any follower is also clear.  I'd rather not
explore down that path today, since I know there is other work in
progress in this file.

More information about the hotspot-runtime-dev mailing list