RFR: JDK-8222537: Avoid fetching _klass twice in TypeArrayOop::size()

Per Liden per.liden at oracle.com
Thu Apr 18 13:02:24 UTC 2019


As far as I understand, this would also not be needed if you just never 
did this on from-space objects, is that correct? I really don't think 
you want to go down that path, cause you're opening yourself up for 
future problems and bugs. I would suggest you have a much more strict 
to-space invariant to make sure, by design, that this can never happen.

cheers,
Per

On 4/16/19 10:45 PM, Roman Kennke wrote:
> Currently, when calling TypeArrayOop::size(), we end up calling klass()
> twice: once before calling into size_given_klass() and then again before
> calling TypeArrayOop::object_size().
> 
> This is currently only a minor performance nuisance.
> 
> With upcoming Shenandoah's elimination of forwarding pointer, loading
> klass like this is not safe anymore, and therefore we only call
> size_given_klass(), and must avoid calling naked klass() altogether.
> 
> Bug:
> https://bugs.openjdk.java.net/browse/JDK-8222537
> Webrev:
> http://cr.openjdk.java.net/~rkennke/JDK-8222537/webrev.00/
> Testing:
> hotspot_gc_shenandoah with and without the prototype, hotspot/tier1
> 
> Can I please get reviews?
> 
> Thanks,
> Roman
> 



More information about the hotspot-gc-dev mailing list