I was about to write a blog post explaining why i don't like the way
VarHandle are currently implemented when it occurs to me that providing
another implementation may be a more efficient to discuss about
So my implementation is here,
the API is typesafe, the implementation is runtime safe and i get mostly
the same assembly code using unsafe or this VarHandle API.
The idea is that there is no need to add more polymorphic signature
methods, a good old Java method is enough if it using a method handle
under the hood.
All the logic is described using method handles and the only logic
written in Java is
1) when to create such method handle (the first time a method is called),
it works like invokedynamic but the method handles are stable
instead of being constant.
2) how to link all things together to do nullcheck, atomic operation and
post operation (like fence or sum).
mlvm-dev mailing list