-
Notifications
You must be signed in to change notification settings - Fork 733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sign extend 32bit offsets in inlineIntrinsicInflate #20970
Sign extend 32bit offsets in inlineIntrinsicInflate #20970
Conversation
Without sign extending the 32bit offsets, it is possible for the upper 32bits of the offset registers to contain garbage bits that will cause the address calculations to produce incorrect (unaddressable) results.
@IBMJimmyk @zl-wang This fixes the problem that we talked about a few weeks back. My personal build (for all POWER platforms) passed. |
It looks good to me. |
Did you find out the specific situation where garbage upper 32bits made its way into register? |
In the failing case the caller of String.getChars() calculates the 1st parameter (srcBegin) to be the return from String.lastIndexOf() using a parameter string that is not contained in the 'this' String, then it adds one. Since lastIndexOf() returns -1 (0xffffffff), and then we add 1 we get (0x100000000) in the 64bit register. This value is passed to String.getChars() which needs to be 32bit sign extended to be a proper 64bit 0. Here is the test-case:
With the right inlining restrictions this test-case crashes in String.getChars(). |
ah .. i recalled it now: the original issue involved an int load-back (from stack) with lwz, right? |
Jenkins test sanity aix,plinux jdk8,jdk23 |
There was no load here. It was |
I am curious how the original 0xffffffff (without sign-extension) got into the register as the return value. |
I guess a function executing |
Found it... Here is how the value returned from
The JIT stored the return value on to the stack as a 32bit value (which is a bit odd??).. Then we use an |
odd indeed. as i expected, it was due to lwz. that is an obvious LHS (loadHitStore) too ... bad for performance. maybe gen a log to chase it further. |
Without sign extending the 32bit offsets, it is possible for the upper 32bits of the offset registers to contain garbage bits that will cause the address calculations to produce incorrect (unaddressable) results.