Closed ChengJin01 closed 3 months ago
The PR (verified on AIX) has the same changes as https://github.com/ibmruntimes/openj9-openjdk-jdk21/pull/159.
Reviewer: @tajila FYI: @keithc-ca, @pshipton
Jenkins test sanity aix,alinux jdknext
Caused by: java.util.NoSuchElementException: Symbol not found: funcs_addr
at java.base/java.lang.foreign.SymbolLookup.findOrThrow(SymbolLookup.java:179)
at java.base/jdk.internal.foreign.SystemLookup.getInlinedFunctListAddr(SystemLookup.java:98)
at java.base/jdk.internal.foreign.SystemLookup.<clinit>(SystemLookup.java:65)
... 34 more
-----------------------------------
Jep454Tests_testLinkerFfi_DownCall_0_FAILED
indicates we should do nothing in getInlinedFunctListAddr()
on other platforms give funcs_addr
is specific to AIX & z/OS. So I suggest to add a piece of code to simply return null for non-AIX/zOS platforms in the static method as follows:
private static MemorySegment getInlinedFunctListAddr() {
if (!OperatingSystem.isAix() || !OperatingSystem.isZOS()) {
return null;
}
....
}
or
private static final MemorySegment funcs = (OperatingSystem.isAix() || OperatingSystem.isZOS()) ? getInlinedFunctListAddr() : null;
simply return null for non-AIX/zOS platforms
I suggest that should happen within getInlinedFunctListAddr()
as it already checks for AIX; so moving the definition of funcsLayout
to the beginning addresses the problem:
SequenceLayout funcsLayout;
if (OperatingSystem.isAix()) {
funcsLayout = AixFuncSymbols.LAYOUT;
} else if (OperatingSystem.isZOS()) {
funcsLayout = ZosFuncSymbols.LAYOUT;
} else {
return null;
}
simply return null for non-AIX/zOS platforms
I suggest that should happen within
getInlinedFunctListAddr()
as it already checks for AIX; so moving the definition offuncsLayout
to the beginning addresses the problem:SequenceLayout funcsLayout; if (OperatingSystem.isAix()) { funcsLayout = AixFuncSymbols.LAYOUT; } else if (OperatingSystem.isZOS()) { funcsLayout = ZosFuncSymbols.LAYOUT; } else { return null; }
Updated the code against the suggestion above.
Jenkins test sanity aix,alinux jdknext
The changes follow the same way of accessing the default libraries on AIX with the inlined functions in a list to address the issue with the default libraries during the FFI downcall on z/OS.
Related: Internal 441
Signed-off-by: ChengJin01 jincheng@ca.ibm.com