An earlier version of this patch was reviewed [1] but I didn't get back to explore the other approach. I rebase the patch and take out the hotspot change which will be covered by JDK-8229375:
http://cr.openjdk.java.net/~mchung/jdk14//8193325/webrev.01 David - can you re-review it? thanks Mandy[1] https://mail.openjdk.java.net/pipermail/core-libs-dev/2017-December/050590.html