Closed ChengJin01 closed 1 year ago
According to the description of the failing test at https://github.com/ibmruntimes/openj9-openjdk-jdk20/blob/openj9/test/jdk/java/foreign/normalize/TestNormalize.java#L109
// The idea of this test is that we pass a 'dirty' int value down to native code, and then receive it back
// as the argument to an upcall, as well as the result of the downcall, but with a sub-int type (boolean, byte, short, char).
// When we do either of those, argument normalization should take place, so that the resulting value is sane (1).
// After that we convert the value back to int again, the JVM can/will skip value normalization here.
// We then check the high order bits of the resulting int. If argument normalization took place at (1), they should all be 0.
It seems there might be missing code in handling the normalization for the return value in downcall and the passed-in argument in upcall. Will need to double-check the code involved to see how to deal with these cases.
With my fix in the upcall dispatcher at https://github.com/ChengJin01/openj9/commit/f320201f54076eff4d2c1958b68ee4947a4ecbec (we already addressed the return value in the existing code in downcall), the failing tests passed as expected:
----------System.out:(12/757)----------
test TestNormalize.testBool(2, true): success
test TestNormalize.testBool(256, false): success
test TestNormalize.testNormalize(z8, 1, -2, MethodHandle(boolean)int, java.lang.invoke.DirectMethodHandle@c2f41c4b): success
test TestNormalize.testNormalize(b8, 42, -256, MethodHandle(byte)int, MethodHandle(byte,int[])void): success
test TestNormalize.testNormalize(s16, 42, -65536, MethodHandle(short)int, MethodHandle(short,int[])void): success
test TestNormalize.testNormalize(c16, 97, -65536, MethodHandle(char)int, MethodHandle(char,int[])void): success
===============================================
test/jdk/java/foreign/normalize/TestNormalize.java
Total tests run: 6, Passes: 6, Failures: 0, Skips: 0
===============================================
Will need to run personal builds & verify on all supported platforms to see how it goes.
A couple of
AssertionError
were captured in this failing test suiteTestNormalize
at https://github.com/ibmruntimes/openj9-openjdk-jdk20/blob/openj9/test/jdk/java/foreign/normalize/TestNormalize.java as follows:FYI: @tajila, @pshipton