JEP 254, HotSpot, and optimizations
aleksey.shipilev at oracle.com
Wed Mar 23 07:32:21 UTC 2016
On 03/22/2016 11:29 PM, Andrew Haley wrote:
> I'm looking at compact strings for AArch64. I know that they are
> intended to be implemented but HotSpot intrinsics, and the Java
> methods are placeholders, but I was tempted to investigate: could you
> write efficient implementations of the methods in pure Java?
We thought that originally too, and some methods were written with
Unsafe. But the sad realization that will come later is that using
anything except plain Java (+ intrinsics) in String code would lead to
surprising bootstrapping issues.
E.g. Unsafe is not really available when String, or any other primordial
class, bootstraps -- Unsafe uses Strings too, and moving Unsafe init
early before String init does introduce circularities. Not saying this
is unresolvable with careful reshuffling the VM bootstrap sequence and
peeling Unsafe, but intrinsics are safer this way.
More information about the hotspot-dev