From 7fa5db1c1d16aad6f7a4ce9267b9b9f69965b925 Mon Sep 17 00:00:00 2001 From: ChengJin01 Date: Wed, 18 Jan 2023 12:32:16 -0500 Subject: [PATCH] [FFI] Disable FFI related code in OpenJDK for JDK20 The change is to disable all downcall & upcall code specific to FFI in OpenJDK for the moment to ensure it gets compiled in JDK20 as we have been working on the changes in OpenJDK & OpenJ9 to deal with the latest APIs intended for JEP434. Signed-off-by: ChengJin01 --- .../jdk/internal/foreign/SystemLookup.java | 4 +- .../jdk/internal/foreign/abi/SharedUtils.java | 14 ++-- .../foreign/abi/aarch64/CallArranger.java | 15 ++-- .../internal/foreign/abi/ppc64/TypeClass.java | 8 +- .../foreign/abi/ppc64/aix/AixPPC64Linker.java | 20 ++--- .../foreign/abi/ppc64/aix/AixPPC64VaList.java | 48 +++++------- .../foreign/abi/ppc64/aix/CallArranger.java | 17 ++-- .../foreign/abi/ppc64/sysv/CallArranger.java | 17 ++-- .../abi/ppc64/sysv/SysVPPC64leLinker.java | 22 +++--- .../abi/ppc64/sysv/SysVPPC64leVaList.java | 48 +++++------- .../foreign/abi/s390x/sysv/CallArranger.java | 17 ++-- .../abi/s390x/sysv/SysVS390xLinker.java | 22 +++--- .../abi/s390x/sysv/SysVS390xVaList.java | 77 ++++++++----------- .../foreign/abi/s390x/sysv/TypeClass.java | 9 +-- .../foreign/abi/x64/sysv/CallArranger.java | 12 +-- .../foreign/abi/x64/windows/CallArranger.java | 12 +-- 16 files changed, 177 insertions(+), 185 deletions(-) diff --git a/src/java.base/share/classes/jdk/internal/foreign/SystemLookup.java b/src/java.base/share/classes/jdk/internal/foreign/SystemLookup.java index ae3584ce8ee..ca872cd9f53 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/SystemLookup.java +++ b/src/java.base/share/classes/jdk/internal/foreign/SystemLookup.java @@ -25,7 +25,7 @@ /* * =========================================================================== - * (c) Copyright IBM Corp. 2022, 2022 All Rights Reserved + * (c) Copyright IBM Corp. 2022, 2023 All Rights Reserved * =========================================================================== */ @@ -89,7 +89,7 @@ private static SymbolLookup makeAixLookup() { long addr = lib.lookup(name); return (addr == 0) ? Optional.empty() : - Optional.of(MemorySegment.ofAddress(MemoryAddress.ofLong(addr), 0, MemorySession.global())); + Optional.of(MemorySegment.ofAddress(addr, 0, SegmentScope.global())); } catch (NoSuchMethodException e) { return Optional.empty(); } diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/SharedUtils.java b/src/java.base/share/classes/jdk/internal/foreign/abi/SharedUtils.java index 24e05c3dca1..3fa5a1b015c 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/SharedUtils.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/SharedUtils.java @@ -25,7 +25,7 @@ /* * =========================================================================== - * (c) Copyright IBM Corp. 2022, 2022 All Rights Reserved + * (c) Copyright IBM Corp. 2022, 2023 All Rights Reserved * =========================================================================== */ @@ -307,9 +307,9 @@ public static VaList newVaList(Consumer actions, SegmentScope sc case SYS_V -> SysVx64Linker.newVaList(actions, scope); case LINUX_AARCH_64 -> LinuxAArch64Linker.newVaList(actions, scope); case MAC_OS_AARCH_64 -> MacOsAArch64Linker.newVaList(actions, scope); - case SysVPPC64le -> SysVPPC64leLinker.newVaList(actions, session); - case SysVS390x -> SysVS390xLinker.newVaList(actions, session); - case AIX -> AixPPC64Linker.newVaList(actions, session); + case SysVPPC64le -> SysVPPC64leLinker.newVaList(actions, scope); + case SysVS390x -> SysVS390xLinker.newVaList(actions, scope); + case AIX -> AixPPC64Linker.newVaList(actions, scope); }; } @@ -319,9 +319,9 @@ public static VaList newVaListOfAddress(long address, SegmentScope scope) { case SYS_V -> SysVx64Linker.newVaListOfAddress(address, scope); case LINUX_AARCH_64 -> LinuxAArch64Linker.newVaListOfAddress(address, scope); case MAC_OS_AARCH_64 -> MacOsAArch64Linker.newVaListOfAddress(address, scope); - case SysVPPC64le -> SysVPPC64leLinker.newVaListOfAddress(ma, session); - case SysVS390x -> SysVS390xLinker.newVaListOfAddress(ma, session); - case AIX -> AixPPC64Linker.newVaListOfAddress(ma, session); + case SysVPPC64le -> SysVPPC64leLinker.newVaListOfAddress(address, scope); + case SysVS390x -> SysVS390xLinker.newVaListOfAddress(address, scope); + case AIX -> AixPPC64Linker.newVaListOfAddress(address, scope); }; } diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/CallArranger.java b/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/CallArranger.java index 0c629a7b183..fd75d2abda7 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/CallArranger.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/CallArranger.java @@ -26,7 +26,7 @@ /* * =========================================================================== - * (c) Copyright IBM Corp. 2022, 2022 All Rights Reserved + * (c) Copyright IBM Corp. 2022, 2023 All Rights Reserved * =========================================================================== */ @@ -154,15 +154,16 @@ public Bindings getBindings(MethodType mt, FunctionDescriptor cDesc, boolean for } /* Replace DowncallLinker in OpenJDK with the implementation of DowncallLinker specific to OpenJ9 */ - public MethodHandle arrangeDowncall(MethodType mt, FunctionDescriptor cDesc, LinkerOptions options) { - MethodHandle handle = DowncallLinker.getBoundMethodHandle(mt, cDesc); - return handle; + public static MethodHandle arrangeDowncall(MethodType mt, FunctionDescriptor cDesc, LinkerOptions options) { + // MethodHandle handle = DowncallLinker.getBoundMethodHandle(mt, cDesc, options); + // return handle; + return null; } /* Replace UpcallLinker in OpenJDK with the implementation of UpcallLinker specific to OpenJ9 */ - public MemorySegment arrangeUpcall(MethodHandle target, MethodType mt, FunctionDescriptor cDesc, SegmentScope session) { - MethodHandle handle = DowncallLinker.getBoundMethodHandle(mt, cDesc); - return handle; + public static MemorySegment arrangeUpcall(MethodHandle target, MethodType mt, FunctionDescriptor cDesc, SegmentScope session) { + // return UpcallLinker.make(target, mt, cDesc, session); + return null; } private static boolean isInMemoryReturn(Optional returnLayout) { diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/TypeClass.java b/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/TypeClass.java index e45c11a24c4..29d0d2e4f92 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/TypeClass.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/TypeClass.java @@ -26,14 +26,14 @@ /* * =========================================================================== - * (c) Copyright IBM Corp. 2022, 2022 All Rights Reserved + * (c) Copyright IBM Corp. 2022, 2023 All Rights Reserved * =========================================================================== */ package jdk.internal.foreign.abi.ppc64; import java.lang.foreign.GroupLayout; -import java.lang.foreign.MemoryAddress; +import java.lang.foreign.MemorySegment; import java.lang.foreign.MemoryLayout; import java.lang.foreign.ValueLayout; import static java.lang.foreign.ValueLayout.*; @@ -66,7 +66,7 @@ public static VarHandle classifyVarHandle(ValueLayout layout) { argHandle = JAVA_DOUBLE.varHandle(); } else if ((carrier == long.class) || (carrier == double.class) - || (carrier == MemoryAddress.class) + || (carrier == MemorySegment.class) ) { argHandle = layout.varHandle(); } else { @@ -104,7 +104,7 @@ private static TypeClass classifyValueType(ValueLayout layout) { || (carrier == double.class) ) { layoutType = PRIMITIVE; - } else if (carrier == MemoryAddress.class) { + } else if (carrier == MemorySegment.class) { layoutType = POINTER; } else { throw new IllegalStateException("Unspported carrier: " + carrier.getName()); diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/aix/AixPPC64Linker.java b/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/aix/AixPPC64Linker.java index 52b4eaa7c35..25cc2b1be1b 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/aix/AixPPC64Linker.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/aix/AixPPC64Linker.java @@ -25,16 +25,18 @@ /* * =========================================================================== - * (c) Copyright IBM Corp. 2022, 2022 All Rights Reserved + * (c) Copyright IBM Corp. 2022, 2023 All Rights Reserved * =========================================================================== */ package jdk.internal.foreign.abi.ppc64.aix; import jdk.internal.foreign.abi.AbstractLinker; +import jdk.internal.foreign.abi.LinkerOptions; import java.lang.foreign.FunctionDescriptor; import java.lang.foreign.MemorySegment; +import java.lang.foreign.SegmentScope; import java.lang.foreign.VaList; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodType; @@ -57,23 +59,23 @@ public static AixPPC64Linker getInstance() { } @Override - protected MethodHandle arrangeDowncall(MethodType inferredMethodType, FunctionDescriptor function) { - return CallArranger.arrangeDowncall(inferredMethodType, function); + protected MethodHandle arrangeDowncall(MethodType inferredMethodType, FunctionDescriptor function, LinkerOptions options) { + return CallArranger.arrangeDowncall(inferredMethodType, function, options); } @Override - protected MemorySegment arrangeUpcall(MethodHandle target, MethodType targetType, FunctionDescriptor function, MemorySession session) { - return CallArranger.arrangeUpcall(target, targetType, function, session); + protected MemorySegment arrangeUpcall(MethodHandle target, MethodType targetType, FunctionDescriptor function, SegmentScope scope) { + return CallArranger.arrangeUpcall(target, targetType, function, scope); } - public static VaList newVaList(Consumer actions, MemorySession session) { - AixPPC64VaList.Builder builder = AixPPC64VaList.builder(session); + public static VaList newVaList(Consumer actions, SegmentScope scope) { + AixPPC64VaList.Builder builder = AixPPC64VaList.builder(scope); actions.accept(builder); return builder.build(); } - public static VaList newVaListOfAddress(MemoryAddress ma, MemorySession session) { - return AixPPC64VaList.ofAddress(ma, session); + public static VaList newVaListOfAddress(long addr, SegmentScope scope) { + return AixPPC64VaList.ofAddress(addr, scope); } public static VaList emptyVaList() { diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/aix/AixPPC64VaList.java b/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/aix/AixPPC64VaList.java index 72b1dc99c49..ecbe7ed0976 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/aix/AixPPC64VaList.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/aix/AixPPC64VaList.java @@ -26,7 +26,7 @@ /* * =========================================================================== - * (c) Copyright IBM Corp. 2022, 2022 All Rights Reserved + * (c) Copyright IBM Corp. 2022, 2023 All Rights Reserved * =========================================================================== */ @@ -43,7 +43,6 @@ import jdk.internal.foreign.abi.SharedUtils; import jdk.internal.foreign.abi.SharedUtils.SimpleVaArg; import jdk.internal.foreign.MemorySessionImpl; -import jdk.internal.foreign.Scoped; import static jdk.internal.foreign.PlatformLayouts.AIX; /** @@ -58,19 +57,18 @@ * with all supportted types of arugments, including struct (passed by value), pointer and * primitive types, which are aligned with 8 bytes. */ -public non-sealed class AixPPC64VaList implements VaList, Scoped { - public static final Class CARRIER = MemoryAddress.class; +public non-sealed class AixPPC64VaList implements VaList { /* Every primitive/pointer occupies 8 bytes and structs are aligned * with 8 bytes in the total size when stacking the va_list buffer. */ private static final long VA_LIST_SLOT_BYTES = 8; - private static final VaList EMPTY = new SharedUtils.EmptyVaList(MemoryAddress.NULL); + private static final VaList EMPTY = new SharedUtils.EmptyVaList(MemorySegment.NULL); private MemorySegment segment; - private final MemorySession session; + private final SegmentScope session; - private AixPPC64VaList(MemorySegment segment, MemorySession session) { + private AixPPC64VaList(MemorySegment segment, SegmentScope session) { this.segment = segment; this.session = session; } @@ -95,8 +93,8 @@ public double nextVarg(ValueLayout.OfDouble layout) { } @Override - public MemoryAddress nextVarg(ValueLayout.OfAddress layout) { - return (MemoryAddress)readArg(layout); + public MemorySegment nextVarg(ValueLayout.OfAddress layout) { + return (MemorySegment)readArg(layout); } @Override @@ -167,7 +165,7 @@ private static long getSmallerStructArgSize(MemorySegment structSegment, MemoryL @Override public void skip(MemoryLayout... layouts) { Objects.requireNonNull(layouts); - sessionImpl().checkValidState(); + ((MemorySessionImpl)session).checkValidState(); for (MemoryLayout layout : layouts) { Objects.requireNonNull(layout); @@ -178,42 +176,38 @@ public void skip(MemoryLayout... layouts) { } } - public static VaList ofAddress(MemoryAddress addr, MemorySession session) { + public static VaList ofAddress(long addr, SegmentScope session) { MemorySegment segment = MemorySegment.ofAddress(addr, Long.MAX_VALUE, session); return new AixPPC64VaList(segment, session); } - @Override - public MemorySession session() { - return session; - } - @Override public VaList copy() { - sessionImpl().checkValidState(); + ((MemorySessionImpl)session).checkValidState(); return new AixPPC64VaList(segment, session); } @Override - public MemoryAddress address() { - return segment.address(); + public MemorySegment segment() { + /* The returned segment cannot be accessed. */ + return segment.asSlice(0, 0); } @Override public String toString() { - return "AixPPC64VaList{" + segment.address() + '}'; + return "AixPPC64VaList{" + segment.asSlice(0, 0) + '}'; } - static Builder builder(MemorySession session) { + static Builder builder(SegmentScope session) { return new Builder(session); } public static non-sealed class Builder implements VaList.Builder { - private final MemorySession session; + private final SegmentScope session; private final List stackArgs = new ArrayList<>(); - public Builder(MemorySession session) { - MemorySessionImpl.toSessionImpl(session).checkValidState(); + public Builder(SegmentScope session) { + ((MemorySessionImpl)session).checkValidState(); this.session = session; } @@ -240,8 +234,8 @@ public Builder addVarg(ValueLayout.OfDouble layout, double value) { } @Override - public Builder addVarg(ValueLayout.OfAddress layout, Addressable value) { - return setArg(layout, value.address()); + public Builder addVarg(ValueLayout.OfAddress layout, MemorySegment value) { + return setArg(layout, value); } @Override @@ -261,7 +255,7 @@ public VaList build() { */ long totalArgsSize = stackArgs.stream().reduce(0L, (accum, arg) -> accum + getAlignedArgSize(arg.layout), Long::sum); - SegmentAllocator allocator = SegmentAllocator.newNativeArena(session); + SegmentAllocator allocator = SegmentAllocator.nativeAllocator(session); MemorySegment segment = allocator.allocate(totalArgsSize); MemorySegment cursorSegment = segment; diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/aix/CallArranger.java b/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/aix/CallArranger.java index fc36870e603..3630f819f8f 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/aix/CallArranger.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/aix/CallArranger.java @@ -26,7 +26,7 @@ /* * =========================================================================== - * (c) Copyright IBM Corp. 2022, 2022 All Rights Reserved + * (c) Copyright IBM Corp. 2022, 2023 All Rights Reserved * =========================================================================== */ @@ -36,11 +36,12 @@ import java.lang.invoke.MethodType; import jdk.internal.foreign.abi.DowncallLinker; +import jdk.internal.foreign.abi.LinkerOptions; import jdk.internal.foreign.abi.UpcallLinker; import java.lang.foreign.FunctionDescriptor; import java.lang.foreign.MemorySegment; -import java.lang.foreign.MemorySession; +import java.lang.foreign.SegmentScope; /** * PPC64 CallArranger specialized for AIX C ABI @@ -48,13 +49,15 @@ public class CallArranger { /* Replace DowncallLinker in OpenJDK with the implementation of DowncallLinker specific to OpenJ9 */ - public static MethodHandle arrangeDowncall(MethodType mt, FunctionDescriptor cDesc) { - MethodHandle handle = DowncallLinker.getBoundMethodHandle(mt, cDesc); - return handle; + public static MethodHandle arrangeDowncall(MethodType mt, FunctionDescriptor cDesc, LinkerOptions options) { + // MethodHandle handle = DowncallLinker.getBoundMethodHandle(mt, cDesc, options); + // return handle; + return null; } /* Replace UpcallLinker in OpenJDK with the implementation of UpcallLinker specific to OpenJ9 */ - public static MemorySegment arrangeUpcall(MethodHandle target, MethodType mt, FunctionDescriptor cDesc, MemorySession session) { - return UpcallLinker.make(target, mt, cDesc, session); + public static MemorySegment arrangeUpcall(MethodHandle target, MethodType mt, FunctionDescriptor cDesc, SegmentScope session) { + // return UpcallLinker.make(target, mt, cDesc, session); + return null; } } diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/sysv/CallArranger.java b/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/sysv/CallArranger.java index 3e4db604b3e..14a5b35e813 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/sysv/CallArranger.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/sysv/CallArranger.java @@ -26,7 +26,7 @@ /* * =========================================================================== - * (c) Copyright IBM Corp. 2022, 2022 All Rights Reserved + * (c) Copyright IBM Corp. 2022, 2023 All Rights Reserved * =========================================================================== */ @@ -36,11 +36,12 @@ import java.lang.invoke.MethodType; import jdk.internal.foreign.abi.DowncallLinker; +import jdk.internal.foreign.abi.LinkerOptions; import jdk.internal.foreign.abi.UpcallLinker; import java.lang.foreign.FunctionDescriptor; import java.lang.foreign.MemorySegment; -import java.lang.foreign.MemorySession; +import java.lang.foreign.SegmentScope; /** * PPC64LE CallArranger specialized for SysV C ABI @@ -48,13 +49,15 @@ public class CallArranger { /* Replace DowncallLinker in OpenJDK with the implementation of DowncallLinker specific to OpenJ9 */ - public static MethodHandle arrangeDowncall(MethodType mt, FunctionDescriptor cDesc) { - MethodHandle handle = DowncallLinker.getBoundMethodHandle(mt, cDesc); - return handle; + public static MethodHandle arrangeDowncall(MethodType mt, FunctionDescriptor cDesc, LinkerOptions options) { + // MethodHandle handle = DowncallLinker.getBoundMethodHandle(mt, cDesc, options); + // return handle; + return null; } /* Replace UpcallLinker in OpenJDK with the implementation of UpcallLinker specific to OpenJ9 */ - public static MemorySegment arrangeUpcall(MethodHandle target, MethodType mt, FunctionDescriptor cDesc, MemorySession session) { - return UpcallLinker.make(target, mt, cDesc, session); + public static MemorySegment arrangeUpcall(MethodHandle target, MethodType mt, FunctionDescriptor cDesc, SegmentScope session) { + // return UpcallLinker.make(target, mt, cDesc, session); + return null; } } diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/sysv/SysVPPC64leLinker.java b/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/sysv/SysVPPC64leLinker.java index 988ca6252e8..6fb8d4dbbe2 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/sysv/SysVPPC64leLinker.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/sysv/SysVPPC64leLinker.java @@ -25,18 +25,18 @@ /* * =========================================================================== - * (c) Copyright IBM Corp. 2022, 2022 All Rights Reserved + * (c) Copyright IBM Corp. 2022, 2023 All Rights Reserved * =========================================================================== */ package jdk.internal.foreign.abi.ppc64.sysv; import jdk.internal.foreign.abi.AbstractLinker; +import jdk.internal.foreign.abi.LinkerOptions; import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.MemoryAddress; import java.lang.foreign.MemorySegment; -import java.lang.foreign.MemorySession; +import java.lang.foreign.SegmentScope; import java.lang.foreign.VaList; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodType; @@ -59,23 +59,23 @@ public static SysVPPC64leLinker getInstance() { } @Override - protected MethodHandle arrangeDowncall(MethodType inferredMethodType, FunctionDescriptor function) { - return CallArranger.arrangeDowncall(inferredMethodType, function); + protected MethodHandle arrangeDowncall(MethodType inferredMethodType, FunctionDescriptor function, LinkerOptions options) { + return CallArranger.arrangeDowncall(inferredMethodType, function, options); } @Override - protected MemorySegment arrangeUpcall(MethodHandle target, MethodType targetType, FunctionDescriptor function, MemorySession session) { - return CallArranger.arrangeUpcall(target, targetType, function, session); + protected MemorySegment arrangeUpcall(MethodHandle target, MethodType targetType, FunctionDescriptor function, SegmentScope scope) { + return CallArranger.arrangeUpcall(target, targetType, function, scope); } - public static VaList newVaList(Consumer actions, MemorySession session) { - SysVPPC64leVaList.Builder builder = SysVPPC64leVaList.builder(session); + public static VaList newVaList(Consumer actions, SegmentScope scope) { + SysVPPC64leVaList.Builder builder = SysVPPC64leVaList.builder(scope); actions.accept(builder); return builder.build(); } - public static VaList newVaListOfAddress(MemoryAddress ma, MemorySession session) { - return SysVPPC64leVaList.ofAddress(ma, session); + public static VaList newVaListOfAddress(long addr, SegmentScope scope) { + return SysVPPC64leVaList.ofAddress(addr, scope); } public static VaList emptyVaList() { diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/sysv/SysVPPC64leVaList.java b/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/sysv/SysVPPC64leVaList.java index 0cac4a386bb..4ef881cd5a4 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/sysv/SysVPPC64leVaList.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/sysv/SysVPPC64leVaList.java @@ -26,7 +26,7 @@ /* * =========================================================================== - * (c) Copyright IBM Corp. 2022, 2022 All Rights Reserved + * (c) Copyright IBM Corp. 2022, 2023 All Rights Reserved * =========================================================================== */ @@ -43,7 +43,6 @@ import jdk.internal.foreign.abi.SharedUtils; import jdk.internal.foreign.abi.SharedUtils.SimpleVaArg; import jdk.internal.foreign.MemorySessionImpl; -import jdk.internal.foreign.Scoped; import static jdk.internal.foreign.PlatformLayouts.SysVPPC64le; /** @@ -58,19 +57,18 @@ * with all supportted types of arugments, including struct (passed by value), pointer and * primitive types, which are aligned with 8 bytes. */ -public non-sealed class SysVPPC64leVaList implements VaList, Scoped { - public static final Class CARRIER = MemoryAddress.class; +public non-sealed class SysVPPC64leVaList implements VaList { /* Every primitive/pointer occupies 8 bytes and structs are aligned * with 8 bytes in the total size when stacking the va_list buffer. */ private static final long VA_LIST_SLOT_BYTES = 8; - private static final VaList EMPTY = new SharedUtils.EmptyVaList(MemoryAddress.NULL); + private static final VaList EMPTY = new SharedUtils.EmptyVaList(MemorySegment.NULL); private MemorySegment segment; - private final MemorySession session; + private final SegmentScope session; - private SysVPPC64leVaList(MemorySegment segment, MemorySession session) { + private SysVPPC64leVaList(MemorySegment segment, SegmentScope session) { this.segment = segment; this.session = session; } @@ -95,8 +93,8 @@ public double nextVarg(ValueLayout.OfDouble layout) { } @Override - public MemoryAddress nextVarg(ValueLayout.OfAddress layout) { - return (MemoryAddress)readArg(layout); + public MemorySegment nextVarg(ValueLayout.OfAddress layout) { + return (MemorySegment)readArg(layout); } @Override @@ -167,7 +165,7 @@ private static long getSmallerStructArgSize(MemorySegment structSegment, MemoryL @Override public void skip(MemoryLayout... layouts) { Objects.requireNonNull(layouts); - sessionImpl().checkValidState(); + ((MemorySessionImpl)session).checkValidState(); for (MemoryLayout layout : layouts) { Objects.requireNonNull(layout); @@ -178,42 +176,38 @@ public void skip(MemoryLayout... layouts) { } } - public static VaList ofAddress(MemoryAddress addr, MemorySession session) { + public static VaList ofAddress(long addr, SegmentScope session) { MemorySegment segment = MemorySegment.ofAddress(addr, Long.MAX_VALUE, session); return new SysVPPC64leVaList(segment, session); } - @Override - public MemorySession session() { - return session; - } - @Override public VaList copy() { - sessionImpl().checkValidState(); + ((MemorySessionImpl)session).checkValidState(); return new SysVPPC64leVaList(segment, session); } @Override - public MemoryAddress address() { - return segment.address(); + public MemorySegment segment() { + /* The returned segment cannot be accessed. */ + return segment.asSlice(0, 0); } @Override public String toString() { - return "SysVPPC64leVaList{" + segment.address() + '}'; + return "SysVPPC64leVaList{" + segment.asSlice(0, 0) + '}'; } - static Builder builder(MemorySession session) { + static Builder builder(SegmentScope session) { return new Builder(session); } public static non-sealed class Builder implements VaList.Builder { - private final MemorySession session; + private final SegmentScope session; private final List stackArgs = new ArrayList<>(); - public Builder(MemorySession session) { - MemorySessionImpl.toSessionImpl(session).checkValidState(); + public Builder(SegmentScope session) { + ((MemorySessionImpl)session).checkValidState(); this.session = session; } @@ -240,8 +234,8 @@ public Builder addVarg(ValueLayout.OfDouble layout, double value) { } @Override - public Builder addVarg(ValueLayout.OfAddress layout, Addressable value) { - return setArg(layout, value.address()); + public Builder addVarg(ValueLayout.OfAddress layout, MemorySegment value) { + return setArg(layout, value); } @Override @@ -261,7 +255,7 @@ public VaList build() { */ long totalArgsSize = stackArgs.stream().reduce(0L, (accum, arg) -> accum + getAlignedArgSize(arg.layout), Long::sum); - SegmentAllocator allocator = SegmentAllocator.newNativeArena(session); + SegmentAllocator allocator = SegmentAllocator.nativeAllocator(session); MemorySegment segment = allocator.allocate(totalArgsSize); MemorySegment cursorSegment = segment; diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/s390x/sysv/CallArranger.java b/src/java.base/share/classes/jdk/internal/foreign/abi/s390x/sysv/CallArranger.java index 2aa3e4d281e..8a92de0ce78 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/s390x/sysv/CallArranger.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/s390x/sysv/CallArranger.java @@ -26,7 +26,7 @@ /* * =========================================================================== - * (c) Copyright IBM Corp. 2022, 2022 All Rights Reserved + * (c) Copyright IBM Corp. 2022, 2023 All Rights Reserved * =========================================================================== */ @@ -36,11 +36,12 @@ import java.lang.invoke.MethodType; import jdk.internal.foreign.abi.DowncallLinker; +import jdk.internal.foreign.abi.LinkerOptions; import jdk.internal.foreign.abi.UpcallLinker; import java.lang.foreign.FunctionDescriptor; import java.lang.foreign.MemorySegment; -import java.lang.foreign.MemorySession; +import java.lang.foreign.SegmentScope; /** * S390x CallArranger specialized for SysV C ABI @@ -48,13 +49,15 @@ public class CallArranger { /* Replace DowncallLinker in OpenJDK with the implementation of DowncallLinker specific to OpenJ9 */ - public static MethodHandle arrangeDowncall(MethodType mt, FunctionDescriptor cDesc) { - MethodHandle handle = DowncallLinker.getBoundMethodHandle(mt, cDesc); - return handle; + public static MethodHandle arrangeDowncall(MethodType mt, FunctionDescriptor cDesc, LinkerOptions options) { + // MethodHandle handle = DowncallLinker.getBoundMethodHandle(mt, cDesc, options); + // return handle; + return null; } /* Replace UpcallLinker in OpenJDK with the implementation of UpcallLinker specific to OpenJ9 */ - public static MemorySegment arrangeUpcall(MethodHandle target, MethodType mt, FunctionDescriptor cDesc, MemorySession session) { - return UpcallLinker.make(target, mt, cDesc, session); + public static MemorySegment arrangeUpcall(MethodHandle target, MethodType mt, FunctionDescriptor cDesc, SegmentScope session) { + // return UpcallLinker.make(target, mt, cDesc, session); + return null; } } diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/s390x/sysv/SysVS390xLinker.java b/src/java.base/share/classes/jdk/internal/foreign/abi/s390x/sysv/SysVS390xLinker.java index 7f673a8736b..c0a0de841c8 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/s390x/sysv/SysVS390xLinker.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/s390x/sysv/SysVS390xLinker.java @@ -25,18 +25,18 @@ /* * =========================================================================== - * (c) Copyright IBM Corp. 2022, 2022 All Rights Reserved + * (c) Copyright IBM Corp. 2022, 2023 All Rights Reserved * =========================================================================== */ package jdk.internal.foreign.abi.s390x.sysv; import jdk.internal.foreign.abi.AbstractLinker; +import jdk.internal.foreign.abi.LinkerOptions; import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.MemoryAddress; import java.lang.foreign.MemorySegment; -import java.lang.foreign.MemorySession; +import java.lang.foreign.SegmentScope; import java.lang.foreign.VaList; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodType; @@ -59,23 +59,23 @@ public static SysVS390xLinker getInstance() { } @Override - protected MethodHandle arrangeDowncall(MethodType inferredMethodType, FunctionDescriptor function) { - return CallArranger.arrangeDowncall(inferredMethodType, function); + protected MethodHandle arrangeDowncall(MethodType inferredMethodType, FunctionDescriptor function, LinkerOptions options) { + return CallArranger.arrangeDowncall(inferredMethodType, function, options); } @Override - protected MemorySegment arrangeUpcall(MethodHandle target, MethodType targetType, FunctionDescriptor function, MemorySession session) { - return CallArranger.arrangeUpcall(target, targetType, function, session); + protected MemorySegment arrangeUpcall(MethodHandle target, MethodType targetType, FunctionDescriptor function, SegmentScope scope) { + return CallArranger.arrangeUpcall(target, targetType, function, scope); } - public static VaList newVaList(Consumer actions, MemorySession session) { - SysVS390xVaList.Builder builder = SysVS390xVaList.builder(session); + public static VaList newVaList(Consumer actions, SegmentScope scope) { + SysVS390xVaList.Builder builder = SysVS390xVaList.builder(scope); actions.accept(builder); return builder.build(); } - public static VaList newVaListOfAddress(MemoryAddress ma, MemorySession session) { - return SysVS390xVaList.ofAddress(ma, session); + public static VaList newVaListOfAddress(long addr, SegmentScope scope) { + return SysVS390xVaList.ofAddress(addr, scope); } public static VaList emptyVaList() { diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/s390x/sysv/SysVS390xVaList.java b/src/java.base/share/classes/jdk/internal/foreign/abi/s390x/sysv/SysVS390xVaList.java index 6f99b899c89..b4e444d3fa4 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/s390x/sysv/SysVS390xVaList.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/s390x/sysv/SysVS390xVaList.java @@ -26,7 +26,7 @@ /* * =========================================================================== - * (c) Copyright IBM Corp. 2022, 2022 All Rights Reserved + * (c) Copyright IBM Corp. 2022, 2023 All Rights Reserved * =========================================================================== */ @@ -39,9 +39,9 @@ import java.util.Objects; import jdk.internal.foreign.MemorySessionImpl; -import jdk.internal.foreign.Scoped; import jdk.internal.foreign.Utils; import jdk.internal.foreign.abi.SharedUtils; +import jdk.internal.foreign.MemorySessionImpl; import jdk.internal.misc.Unsafe; import static java.lang.foreign.MemoryLayout.PathElement.groupElement; @@ -75,7 +75,7 @@ * of all argument registers, with the general registers(r2-r6) starting at offset 16 and the * floating-point registers(f0, f2, f4, and f6) starting at offset 128. */ -public non-sealed class SysVS390xVaList implements VaList, Scoped { +public non-sealed class SysVS390xVaList implements VaList { private static final Unsafe unsafe = Unsafe.getUnsafe(); private static final GroupLayout LAYOUT_VA_LIST = MemoryLayout.structLayout( @@ -169,23 +169,19 @@ private SysVS390xVaList(MemorySegment segment, MemorySegment gpRegSaveArea, Memo this.gpRegSaveArea = gpRegSaveArea; this.fpRegSaveArea = fpRegSaveArea; this.overflowAreaCursor = overflowArgArea; - this.regSaveAreaOfVaList = MemorySegment.ofAddress((MemoryAddress)VH_REG_SAVE_AREA.get(segment), - LAYOUT_REG_SAVE_AREA.byteSize(), segment.session()); - this.overflowArgAreaOfVaList = MemorySegment.ofAddress((MemoryAddress)VH_OVERFLOW_ARG_AREA.get(segment), - Long.MAX_VALUE, segment.session()); + this.regSaveAreaOfVaList = MemorySegment.ofAddress(((MemorySegment)VH_REG_SAVE_AREA.get(segment)).address(), + LAYOUT_REG_SAVE_AREA.byteSize(), segment.scope()); + this.overflowArgAreaOfVaList = MemorySegment.ofAddress(((MemorySegment)VH_OVERFLOW_ARG_AREA.get(segment)).address(), + Long.MAX_VALUE, segment.scope()); } - private static MemoryAddress emptyListAddress() { - long vaListPtr = unsafe.allocateMemory(LAYOUT_VA_LIST.byteSize()); - MemorySession session = MemorySession.openImplicit(); - session.addCloseAction(() -> unsafe.freeMemory(vaListPtr)); - MemorySegment vaListSegment = MemorySegment.ofAddress(MemoryAddress.ofLong(vaListPtr), - LAYOUT_VA_LIST.byteSize(), session); + private static MemorySegment emptyListAddress() { + MemorySegment vaListSegment = MemorySegment.allocateNative(LAYOUT_VA_LIST, SegmentScope.global()); VH_GPR_NO.set(vaListSegment, 0); VH_FPR_NO.set(vaListSegment, 0); - VH_OVERFLOW_ARG_AREA.set(vaListSegment, MemoryAddress.NULL); - VH_REG_SAVE_AREA.set(vaListSegment, MemoryAddress.NULL); - return vaListSegment.address(); + VH_OVERFLOW_ARG_AREA.set(vaListSegment, MemorySegment.NULL); + VH_REG_SAVE_AREA.set(vaListSegment, MemorySegment.NULL); + return vaListSegment.asSlice(0, 0); } public static VaList empty() { @@ -208,8 +204,8 @@ public double nextVarg(ValueLayout.OfDouble layout) { } @Override - public MemoryAddress nextVarg(ValueLayout.OfAddress layout) { - return (MemoryAddress)readArg(layout); + public MemorySegment nextVarg(ValueLayout.OfAddress layout) { + return (MemorySegment)readArg(layout); } @Override @@ -220,7 +216,7 @@ public MemorySegment nextVarg(GroupLayout layout, SegmentAllocator allocator) { @Override public void skip(MemoryLayout... layouts) { Objects.requireNonNull(layouts); - sessionImpl().checkValidState(); + ((MemorySessionImpl)segment.scope()).checkValidState(); for (MemoryLayout layout : layouts) { readArg(layout, THROWING_ALLOCATOR, false); } @@ -321,8 +317,8 @@ private Object getArgFromMemoryArea(MemoryLayout layout, MemorySegment argAreaSe GroupLayout struLayout = (GroupLayout)layout; if (isStruAddrRequired(struLayout)) { long struArgSize = getAlignedStructSize(struLayout); - MemoryAddress struAddr = (MemoryAddress)argHandle.get(argAreaSegment); - MemorySegment struArgSegment = MemorySegment.ofAddress(struAddr, struArgSize, argAreaSegment.session()); + MemorySegment struAddr = (MemorySegment)argHandle.get(argAreaSegment); + MemorySegment struArgSegment = MemorySegment.ofAddress(struAddr.address(), struArgSize, argAreaSegment.scope()); argument = allocator.allocate(struArgSize).copyFrom(struArgSegment); } else { long struArgSize = struLayout.byteSize(); @@ -396,11 +392,11 @@ private void moveToNextArgOfFprArea(long nextFprNo) { fpRegSaveArea = fpRegSaveArea.asSlice(VA_LIST_SLOT_BYTES); } - public static VaList ofAddress(MemoryAddress addr, MemorySession session) { + public static VaList ofAddress(long addr, SegmentScope session) { MemorySegment segment = MemorySegment.ofAddress(addr, LAYOUT_VA_LIST.byteSize(), session); - MemorySegment regSaveAreaOfVaList = MemorySegment.ofAddress((MemoryAddress)VH_REG_SAVE_AREA.get(segment), + MemorySegment regSaveAreaOfVaList = MemorySegment.ofAddress(((MemorySegment)VH_REG_SAVE_AREA.get(segment)).address(), LAYOUT_REG_SAVE_AREA.byteSize(), session); - MemorySegment overflowArgAreaOfVaList = MemorySegment.ofAddress((MemoryAddress)VH_OVERFLOW_ARG_AREA.get(segment), + MemorySegment overflowArgAreaOfVaList = MemorySegment.ofAddress(((MemorySegment)VH_OVERFLOW_ARG_AREA.get(segment)).address(), Long.MAX_VALUE, session); long initGprNo = (long)VH_GPR_NO.get(segment); @@ -416,20 +412,16 @@ public static VaList ofAddress(MemoryAddress addr, MemorySession session) { return new SysVS390xVaList(segment, gpRegSaveArea, fpRegSaveArea, overflowArgAreaOfVaList); } - @Override - public MemorySession session() { - return segment.session(); - } - @Override public VaList copy() { - MemorySegment copySegment = MemorySegment.allocateNative(LAYOUT_VA_LIST, segment.session()).copyFrom(segment); + MemorySegment copySegment = MemorySegment.allocateNative(LAYOUT_VA_LIST, segment.scope()).copyFrom(segment); return new SysVS390xVaList(copySegment, gpRegSaveArea, fpRegSaveArea, overflowAreaCursor); } @Override - public MemoryAddress address() { - return segment.address(); + public MemorySegment segment() { + /* The returned segment cannot be accessed. */ + return segment.asSlice(0, 0); } @Override @@ -442,18 +434,18 @@ public String toString() { + '}'; } - static SysVS390xVaList.Builder builder(MemorySession session) { + static SysVS390xVaList.Builder builder(SegmentScope session) { return new SysVS390xVaList.Builder(session); } public static non-sealed class Builder implements VaList.Builder { - private final MemorySession session; + private final SegmentScope session; private final List gprArgs = new ArrayList<>(); private final List fprArgs = new ArrayList<>(); private final List overflowArgs = new ArrayList<>(); - public Builder(MemorySession session) { - MemorySessionImpl.toSessionImpl(session).checkValidState(); + public Builder(SegmentScope session) { + ((MemorySessionImpl)session).checkValidState(); this.session = session; } @@ -473,8 +465,8 @@ public Builder addVarg(ValueLayout.OfDouble layout, double value) { } @Override - public Builder addVarg(ValueLayout.OfAddress layout, Addressable value) { - return setArg(layout, value.address()); + public Builder addVarg(ValueLayout.OfAddress layout, MemorySegment value) { + return setArg(layout, value); } @Override @@ -541,7 +533,7 @@ private void storeArgToMemoryArea(List vaListArgs, MemorySegment ar * on the left when the struct's size is 1, 2, 4, 8 bytes. */ if (isStruAddrRequired((GroupLayout)layout)) { - argHandle.set(argAreaCursor, struArgValue.address()); + argHandle.set(argAreaCursor, struArgValue.asSlice(0, 0)); } else { argAreaCursor.asSlice(VA_LIST_SLOT_BYTES - struArgSize, struArgSize).copyFrom(struArgValue); } @@ -565,10 +557,9 @@ public VaList build() { long regSaveAreaSize = LAYOUT_REG_SAVE_AREA.byteSize(); long overflowAreaSize = overflowArgs.size() * VA_LIST_SLOT_BYTES; - SegmentAllocator allocator = SegmentAllocator.newNativeArena(session); + SegmentAllocator allocator = SegmentAllocator.nativeAllocator(session); MemorySegment vaListSegment = allocator.allocate(LAYOUT_VA_LIST); MemorySegment vaArgArea = allocator.allocate(regSaveAreaSize + overflowAreaSize); - MemoryAddress vaArgAreaAddr = vaArgArea.address(); MemorySegment regSaveArea = vaArgArea.asSlice(0, regSaveAreaSize); MemorySegment gpRegSaveArea = regSaveArea.asSlice(GPR_OFFSET, gprArgs.size() * VA_LIST_SLOT_BYTES); @@ -583,8 +574,8 @@ public VaList build() { /* Set va_list with all required information so as to ensure va_list is correctly accessed in native */ VH_GPR_NO.set(vaListSegment, 0); VH_FPR_NO.set(vaListSegment, 0); - VH_OVERFLOW_ARG_AREA.set(vaListSegment, overflowArgArea.address()); - VH_REG_SAVE_AREA.set(vaListSegment, regSaveArea.address()); + VH_OVERFLOW_ARG_AREA.set(vaListSegment, overflowArgArea.asSlice(0, 0)); + VH_REG_SAVE_AREA.set(vaListSegment, regSaveArea.asSlice(0, 0)); return new SysVS390xVaList(vaListSegment, gpRegSaveArea, fpRegSaveArea, overflowArgArea); } diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/s390x/sysv/TypeClass.java b/src/java.base/share/classes/jdk/internal/foreign/abi/s390x/sysv/TypeClass.java index e66ba0955f9..5cec1dc800d 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/s390x/sysv/TypeClass.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/s390x/sysv/TypeClass.java @@ -26,7 +26,7 @@ /* * =========================================================================== - * (c) Copyright IBM Corp. 2022, 2022 All Rights Reserved + * (c) Copyright IBM Corp. 2022, 2023 All Rights Reserved * =========================================================================== */ @@ -36,7 +36,6 @@ import java.util.List; import java.lang.foreign.GroupLayout; -import java.lang.foreign.MemoryAddress; import java.lang.foreign.MemoryLayout; import java.lang.foreign.MemorySegment; import java.lang.foreign.ValueLayout; @@ -103,9 +102,7 @@ static VarHandle classifyVarHandle(MemoryLayout layout) { ) { argHandle = JAVA_DOUBLE.varHandle(); /* VarHandle stores the address of struct which is greater than 8 bytes in size as per the ABI document */ - } else if ((carrier == MemoryAddress.class) - || (carrier == MemorySegment.class) - ) { + } else if (carrier == MemorySegment.class) { argHandle = ADDRESS.varHandle(); } else { throw new IllegalStateException("Unspported carrier: " + carrier.getName()); @@ -148,7 +145,7 @@ private static TypeClass classifyValueType(ValueLayout layout) { || (carrier == double.class) ) { layoutType = FLOAT; - } else if (carrier == MemoryAddress.class) { + } else if (carrier == MemorySegment.class) { layoutType = POINTER; } else { throw new IllegalStateException("Unspported carrier: " + carrier.getName()); diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/x64/sysv/CallArranger.java b/src/java.base/share/classes/jdk/internal/foreign/abi/x64/sysv/CallArranger.java index 76ec9659274..d08e24fa1a4 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/x64/sysv/CallArranger.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/x64/sysv/CallArranger.java @@ -26,7 +26,7 @@ /* * =========================================================================== - * (c) Copyright IBM Corp. 2022, 2022 All Rights Reserved + * (c) Copyright IBM Corp. 2022, 2023 All Rights Reserved * =========================================================================== */ @@ -128,13 +128,15 @@ public static Bindings getBindings(MethodType mt, FunctionDescriptor cDesc, bool /* Replace DowncallLinker in OpenJDK with the implementation of DowncallLinker specific to OpenJ9 */ public static MethodHandle arrangeDowncall(MethodType mt, FunctionDescriptor cDesc, LinkerOptions options) { - MethodHandle handle = DowncallLinker.getBoundMethodHandle(mt, cDesc); - return handle; + // MethodHandle handle = DowncallLinker.getBoundMethodHandle(mt, cDesc, options); + // return handle; + return null; } /* Replace UpcallLinker in OpenJDK with the implementation of UpcallLinker specific to OpenJ9 */ - public static MemorySegment arrangeUpcall(MethodHandle target, MethodType mt, FunctionDescriptor cDesc, SegmentScope scope) { - return UpcallLinker.make(target, mt, cDesc, session); + public static MemorySegment arrangeUpcall(MethodHandle target, MethodType mt, FunctionDescriptor cDesc, SegmentScope session) { + // return UpcallLinker.make(target, mt, cDesc, session); + return null; } private static boolean isInMemoryReturn(Optional returnLayout) { diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/x64/windows/CallArranger.java b/src/java.base/share/classes/jdk/internal/foreign/abi/x64/windows/CallArranger.java index 8d2911699f7..44db601f844 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/x64/windows/CallArranger.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/x64/windows/CallArranger.java @@ -25,7 +25,7 @@ /* * =========================================================================== - * (c) Copyright IBM Corp. 2022, 2022 All Rights Reserved + * (c) Copyright IBM Corp. 2022, 2023 All Rights Reserved * =========================================================================== */ @@ -128,13 +128,15 @@ void setReturnBindings(Class carrier, MemoryLayout layout) { /* Replace DowncallLinker in OpenJDK with the implementation of DowncallLinker specific to OpenJ9 */ public static MethodHandle arrangeDowncall(MethodType mt, FunctionDescriptor cDesc, LinkerOptions options) { - MethodHandle handle = DowncallLinker.getBoundMethodHandle(mt, cDesc); - return handle; + // MethodHandle handle = DowncallLinker.getBoundMethodHandle(mt, cDesc, options); + // return handle; + return null; } /* Replace UpcallLinker in OpenJDK with the implementation of UpcallLinker specific to OpenJ9 */ - public static MemorySegment arrangeUpcall(MethodHandle target, MethodType mt, FunctionDescriptor cDesc, SegmentScope scope) { - return UpcallLinker.make(target, mt, cDesc, session); + public static MemorySegment arrangeUpcall(MethodHandle target, MethodType mt, FunctionDescriptor cDesc, SegmentScope session) { + // return UpcallLinker.make(target, mt, cDesc, session); + return null; } private static boolean isInMemoryReturn(Optional returnLayout) {