RFR: JDK-8199801: Finer grained primitive arrays bulk access barriers (original) (raw)

Roman Kennke rkennke at redhat.com
Tue Mar 20 08:57:42 UTC 2018


Currently, for any bulk access on primitive arrays (e.g. *_at_addr() family of methods, arraycopy, and the like), we do Access::resolve() on the base arrayOop (via arrayOopDesc::base() ). This is safe and does the right thing, but it is overly broad. In a garbage collector like Shenandoah, Access::resolve() would have to do a write-barrier, which is a copy-on-write. This could lead to double-copying of potentially large arrays, i.e. resolving the src array would copy it from from-space to to-space, and then it needs to be copied again from src to dst. This adds unnecessary latency to Java threads. Most of the accesses via _at_addr() are read-accesses, and they could use a weaker read-barrier, which only chases the forwarding pointer.

This change splits Access<>::resolve() into resolve_for_read() and resolve_for_write(). This is then used in all the relevant places. In particular:

In my mind, base(T_CHAR) should be equivalent to get_char_at_addr(0), both return the address of the first element. I don't see the point. I can see why we are not going into possible latin1 inflation for length==0.

Tests: build fastdebug/release (with+w/o PCH), passes hotspot/tier1 tests (fastdebug+release)

Bug: https://bugs.openjdk.java.net/browse/JDK-8199801 Webrev: http://cr.openjdk.java.net/~rkennke/JDK-8199801/webrev.00/

What do you think? Can I please get reviews?

Thanks, Roman

-------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: OpenPGP digital signature URL: <https://mail.openjdk.org/pipermail/hotspot-gc-dev/attachments/20180320/e0ddab37/signature.asc>



More information about the hotspot-gc-dev mailing list