On Wed, 22 Jul 2026 20:00:22 GMT, John R Rose <[email protected]> wrote:

> We could keep the originally designed permissiveness by adding a Java wrapper 
> that handles the any corner cases refused by the intrinsic. That’s where 
> hacks like unsafe unaligned loads and masking would go, in the wrapper. And 
> the wrapper would do ALL the work, if the intrinsic is disabled for some 
> reason – it can return ~N, saying "please do it all, Java". That should go in 
> one place. Do we find ourselves replicating such defensive logic today?

The answer is 'yes'. The defensive logic is replicated several times.

I'm not suggesting that we change the contract of the intrinsic stub. I totally 
agree that work that can be done effectively in Java should be done in Java, 
not in assembly. But, right now it seems that the contract of the intrinsic 
contract is exposed _directly_ to clients, which then have to replicate the 
fixup logic in case the intrinsic returns ~N.

The point I'm trying to make (and Chen as well I think), is that we should do 
the additional fixup in the Java code immediately enclosing the intrinsic stub, 
instead of 'exporting' that as an internal API.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/31802#issuecomment-5071154262

Reply via email to