diff --git a/src/java.base/share/classes/java/lang/foreign/FunctionDescriptor.java b/src/java.base/share/classes/java/lang/foreign/FunctionDescriptor.java index dd1ec8e1660e6..8ed63108e8b6b 100644 --- a/src/java.base/share/classes/java/lang/foreign/FunctionDescriptor.java +++ b/src/java.base/share/classes/java/lang/foreign/FunctionDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,13 +25,13 @@ package java.lang.foreign; +import jdk.internal.foreign.FunctionDescriptorImpl; + import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodType; +import java.util.List; import java.util.Objects; import java.util.Optional; -import java.util.List; - -import jdk.internal.foreign.FunctionDescriptorImpl; /** * A function descriptor models the signature of a foreign function. A function diff --git a/src/java.base/share/classes/java/lang/foreign/Linker.java b/src/java.base/share/classes/java/lang/foreign/Linker.java index 2f7013803143b..b712cd847c9e4 100644 --- a/src/java.base/share/classes/java/lang/foreign/Linker.java +++ b/src/java.base/share/classes/java/lang/foreign/Linker.java @@ -26,8 +26,8 @@ package java.lang.foreign; import jdk.internal.foreign.abi.AbstractLinker; -import jdk.internal.foreign.abi.LinkerOptions; import jdk.internal.foreign.abi.CapturableState; +import jdk.internal.foreign.abi.LinkerOptions; import jdk.internal.foreign.abi.SharedUtils; import jdk.internal.javac.Restricted; import jdk.internal.reflect.CallerSensitive; diff --git a/src/java.base/share/classes/java/lang/foreign/MemoryLayout.java b/src/java.base/share/classes/java/lang/foreign/MemoryLayout.java index 2cf0a5e4443cb..7b0f361b8235a 100644 --- a/src/java.base/share/classes/java/lang/foreign/MemoryLayout.java +++ b/src/java.base/share/classes/java/lang/foreign/MemoryLayout.java @@ -25,12 +25,6 @@ package java.lang.foreign; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.VarHandle; -import java.util.Objects; -import java.util.Optional; -import java.util.stream.Stream; - import jdk.internal.foreign.LayoutPath; import jdk.internal.foreign.Utils; import jdk.internal.foreign.layout.MemoryLayoutUtil; @@ -39,6 +33,12 @@ import jdk.internal.foreign.layout.StructLayoutImpl; import jdk.internal.foreign.layout.UnionLayoutImpl; +import java.lang.invoke.MethodHandle; +import java.lang.invoke.VarHandle; +import java.util.Objects; +import java.util.Optional; +import java.util.stream.Stream; + /** * A memory layout describes the contents of a memory segment. *
diff --git a/src/java.base/share/classes/java/lang/foreign/MemorySegment.java b/src/java.base/share/classes/java/lang/foreign/MemorySegment.java index 024dfacb71b7e..3e60bc1948f8d 100644 --- a/src/java.base/share/classes/java/lang/foreign/MemorySegment.java +++ b/src/java.base/share/classes/java/lang/foreign/MemorySegment.java @@ -25,6 +25,14 @@ package java.lang.foreign; +import jdk.internal.foreign.AbstractMemorySegmentImpl; +import jdk.internal.foreign.MemorySessionImpl; +import jdk.internal.foreign.SegmentBulkOperations; +import jdk.internal.foreign.SegmentFactories; +import jdk.internal.javac.Restricted; +import jdk.internal.reflect.CallerSensitive; +import jdk.internal.vm.annotation.ForceInline; + import java.io.UncheckedIOException; import java.lang.foreign.ValueLayout.OfInt; import java.nio.Buffer; @@ -41,13 +49,6 @@ import java.util.Spliterator; import java.util.function.Consumer; import java.util.stream.Stream; -import jdk.internal.foreign.AbstractMemorySegmentImpl; -import jdk.internal.foreign.MemorySessionImpl; -import jdk.internal.foreign.SegmentBulkOperations; -import jdk.internal.foreign.SegmentFactories; -import jdk.internal.javac.Restricted; -import jdk.internal.reflect.CallerSensitive; -import jdk.internal.vm.annotation.ForceInline; /** * A memory segment provides access to a contiguous region of memory. diff --git a/src/java.base/share/classes/java/lang/foreign/SegmentAllocator.java b/src/java.base/share/classes/java/lang/foreign/SegmentAllocator.java index 6e8cd789a36e2..225cce8e255fc 100644 --- a/src/java.base/share/classes/java/lang/foreign/SegmentAllocator.java +++ b/src/java.base/share/classes/java/lang/foreign/SegmentAllocator.java @@ -25,17 +25,16 @@ package java.lang.foreign; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.util.Objects; - import jdk.internal.foreign.AbstractMemorySegmentImpl; import jdk.internal.foreign.ArenaImpl; import jdk.internal.foreign.SlicingAllocator; import jdk.internal.foreign.StringSupport; -import jdk.internal.foreign.Utils; import jdk.internal.vm.annotation.ForceInline; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.util.Objects; + /** * An object that may be used to allocate {@linkplain MemorySegment memory segments}. * Clients implementing this interface must implement the {@link #allocate(long, long)} diff --git a/src/java.base/share/classes/java/lang/foreign/ValueLayout.java b/src/java.base/share/classes/java/lang/foreign/ValueLayout.java index d4e396534911e..ea201f6ae5f29 100644 --- a/src/java.base/share/classes/java/lang/foreign/ValueLayout.java +++ b/src/java.base/share/classes/java/lang/foreign/ValueLayout.java @@ -25,9 +25,10 @@ package java.lang.foreign; +import jdk.internal.foreign.layout.ValueLayouts; + import java.lang.invoke.VarHandle; import java.nio.ByteOrder; -import jdk.internal.foreign.layout.ValueLayouts; /** * A layout that models values of basic data types. Examples of values modeled by diff --git a/src/java.base/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java b/src/java.base/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java index a52881b047b18..6eb2a8bcd8029 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java +++ b/src/java.base/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java @@ -25,13 +25,32 @@ package jdk.internal.foreign; -import java.lang.foreign.*; +import jdk.internal.access.JavaNioAccess; +import jdk.internal.access.SharedSecrets; +import jdk.internal.access.foreign.UnmapperProxy; +import jdk.internal.misc.ScopedMemoryAccess; +import jdk.internal.reflect.CallerSensitive; +import jdk.internal.reflect.Reflection; +import jdk.internal.util.ArraysSupport; +import jdk.internal.util.Preconditions; +import jdk.internal.vm.annotation.ForceInline; +import sun.nio.ch.DirectBuffer; + +import java.lang.foreign.AddressLayout; +import java.lang.foreign.Arena; +import java.lang.foreign.MemoryLayout; +import java.lang.foreign.MemorySegment; +import java.lang.foreign.SegmentAllocator; +import java.lang.foreign.ValueLayout; import java.lang.reflect.Array; import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.charset.Charset; -import java.util.*; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.Spliterator; import java.util.function.BiFunction; import java.util.function.Consumer; import java.util.function.Function; @@ -39,17 +58,6 @@ import java.util.stream.Stream; import java.util.stream.StreamSupport; -import jdk.internal.access.JavaNioAccess; -import jdk.internal.access.SharedSecrets; -import jdk.internal.access.foreign.UnmapperProxy; -import jdk.internal.misc.ScopedMemoryAccess; -import jdk.internal.reflect.CallerSensitive; -import jdk.internal.reflect.Reflection; -import jdk.internal.util.ArraysSupport; -import jdk.internal.util.Preconditions; -import jdk.internal.vm.annotation.ForceInline; -import sun.nio.ch.DirectBuffer; - /** * This abstract class provides an immutable implementation for the {@code MemorySegment} interface. This class contains information * about the segment's spatial and temporal bounds; each memory segment implementation is associated with an owner thread which is set at creation time. diff --git a/src/java.base/share/classes/jdk/internal/foreign/ArenaImpl.java b/src/java.base/share/classes/jdk/internal/foreign/ArenaImpl.java index 948cc7c2acf68..0bf0580126aee 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/ArenaImpl.java +++ b/src/java.base/share/classes/jdk/internal/foreign/ArenaImpl.java @@ -26,10 +26,7 @@ package jdk.internal.foreign; import java.lang.foreign.Arena; -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; import java.lang.foreign.MemorySegment.Scope; -import java.util.Objects; public final class ArenaImpl implements Arena { diff --git a/src/java.base/share/classes/jdk/internal/foreign/CABI.java b/src/java.base/share/classes/jdk/internal/foreign/CABI.java index 216a9fd874c2f..92774837e8d3b 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/CABI.java +++ b/src/java.base/share/classes/jdk/internal/foreign/CABI.java @@ -27,9 +27,9 @@ package jdk.internal.foreign; import jdk.internal.foreign.abi.fallback.FallbackLinker; -import jdk.internal.vm.ForeignLinkerSupport; import jdk.internal.util.OperatingSystem; import jdk.internal.util.StaticProperty; +import jdk.internal.vm.ForeignLinkerSupport; import static java.lang.foreign.ValueLayout.ADDRESS; diff --git a/src/java.base/share/classes/jdk/internal/foreign/ConfinedSession.java b/src/java.base/share/classes/jdk/internal/foreign/ConfinedSession.java index 9b98bf82b5eee..661abd03224cb 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/ConfinedSession.java +++ b/src/java.base/share/classes/jdk/internal/foreign/ConfinedSession.java @@ -25,12 +25,12 @@ package jdk.internal.foreign; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.VarHandle; - import jdk.internal.invoke.MhUtil; import jdk.internal.vm.annotation.ForceInline; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + /** * A confined session, which features an owner thread. The liveness check features an additional * confinement check - that is, calling any operation on this session from a thread other than the diff --git a/src/java.base/share/classes/jdk/internal/foreign/GlobalSession.java b/src/java.base/share/classes/jdk/internal/foreign/GlobalSession.java index 9f57b2a36ddab..6bad98a0704db 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/GlobalSession.java +++ b/src/java.base/share/classes/jdk/internal/foreign/GlobalSession.java @@ -25,12 +25,8 @@ package jdk.internal.foreign; -import jdk.internal.access.JavaNioAccess; -import jdk.internal.access.SharedSecrets; import jdk.internal.vm.annotation.ForceInline; -import sun.nio.ch.DirectBuffer; -import java.nio.Buffer; import java.util.Objects; /** diff --git a/src/java.base/share/classes/jdk/internal/foreign/HeapMemorySegmentImpl.java b/src/java.base/share/classes/jdk/internal/foreign/HeapMemorySegmentImpl.java index 2512b9e54a47d..744e1e0aea9f5 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/HeapMemorySegmentImpl.java +++ b/src/java.base/share/classes/jdk/internal/foreign/HeapMemorySegmentImpl.java @@ -26,15 +26,15 @@ package jdk.internal.foreign; +import jdk.internal.access.JavaNioAccess; +import jdk.internal.access.SharedSecrets; +import jdk.internal.vm.annotation.ForceInline; + import java.lang.foreign.ValueLayout; import java.nio.ByteBuffer; import java.util.Objects; import java.util.Optional; -import jdk.internal.access.JavaNioAccess; -import jdk.internal.access.SharedSecrets; -import jdk.internal.vm.annotation.ForceInline; - /** * Implementation for heap memory segments. A heap memory segment is composed by an offset and * a base object (typically an array). To enhance performances, the access to the base object needs to feature diff --git a/src/java.base/share/classes/jdk/internal/foreign/LayoutPath.java b/src/java.base/share/classes/jdk/internal/foreign/LayoutPath.java index dc995589472b1..f01c002420278 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/LayoutPath.java +++ b/src/java.base/share/classes/jdk/internal/foreign/LayoutPath.java @@ -39,7 +39,6 @@ import java.lang.invoke.MethodType; import java.lang.invoke.VarHandle; import java.util.Arrays; -import java.util.List; import java.util.Objects; import java.util.function.UnaryOperator; import java.util.stream.IntStream; diff --git a/src/java.base/share/classes/jdk/internal/foreign/MappedMemorySegmentImpl.java b/src/java.base/share/classes/jdk/internal/foreign/MappedMemorySegmentImpl.java index f0ae76829ffbd..2977d52f899e1 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/MappedMemorySegmentImpl.java +++ b/src/java.base/share/classes/jdk/internal/foreign/MappedMemorySegmentImpl.java @@ -25,10 +25,11 @@ package jdk.internal.foreign; -import java.nio.ByteBuffer; import jdk.internal.access.foreign.UnmapperProxy; import jdk.internal.misc.ScopedMemoryAccess; +import java.nio.ByteBuffer; + /** * Implementation for a mapped memory segments. A mapped memory segment is a native memory segment, which * additionally features an {@link UnmapperProxy} object. This object provides detailed information about the diff --git a/src/java.base/share/classes/jdk/internal/foreign/MemorySessionImpl.java b/src/java.base/share/classes/jdk/internal/foreign/MemorySessionImpl.java index 8f576625500c1..0219f659f8060 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/MemorySessionImpl.java +++ b/src/java.base/share/classes/jdk/internal/foreign/MemorySessionImpl.java @@ -26,20 +26,20 @@ package jdk.internal.foreign; -import java.lang.foreign.MemorySegment; +import jdk.internal.foreign.GlobalSession.HeapSession; +import jdk.internal.invoke.MhUtil; +import jdk.internal.misc.ScopedMemoryAccess; +import jdk.internal.vm.annotation.ForceInline; +import jdk.internal.vm.annotation.Stable; + import java.lang.foreign.Arena; +import java.lang.foreign.MemorySegment; import java.lang.foreign.MemorySegment.Scope; import java.lang.invoke.MethodHandles; import java.lang.invoke.VarHandle; import java.lang.ref.Cleaner; import java.util.Objects; -import jdk.internal.foreign.GlobalSession.HeapSession; -import jdk.internal.misc.ScopedMemoryAccess; -import jdk.internal.invoke.MhUtil; -import jdk.internal.vm.annotation.ForceInline; -import jdk.internal.vm.annotation.Stable; - /** * This class manages the temporal bounds associated with a memory segment as well * as thread confinement. A session has a liveness bit, which is updated when the session is closed diff --git a/src/java.base/share/classes/jdk/internal/foreign/NativeMemorySegmentImpl.java b/src/java.base/share/classes/jdk/internal/foreign/NativeMemorySegmentImpl.java index 1c726acd2e10a..2fb11338eec90 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/NativeMemorySegmentImpl.java +++ b/src/java.base/share/classes/jdk/internal/foreign/NativeMemorySegmentImpl.java @@ -26,12 +26,12 @@ package jdk.internal.foreign; -import java.nio.ByteBuffer; -import java.util.Optional; - import jdk.internal.misc.Unsafe; import jdk.internal.vm.annotation.ForceInline; +import java.nio.ByteBuffer; +import java.util.Optional; + /** * Implementation for native memory segments. A native memory segment is essentially a wrapper around * a native long address. diff --git a/src/java.base/share/classes/jdk/internal/foreign/SharedSession.java b/src/java.base/share/classes/jdk/internal/foreign/SharedSession.java index b4415ad49590f..30994201a1d05 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/SharedSession.java +++ b/src/java.base/share/classes/jdk/internal/foreign/SharedSession.java @@ -25,12 +25,13 @@ package jdk.internal.foreign; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.VarHandle; -import jdk.internal.misc.ScopedMemoryAccess; import jdk.internal.invoke.MhUtil; +import jdk.internal.misc.ScopedMemoryAccess; import jdk.internal.vm.annotation.ForceInline; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.VarHandle; + /** * A shared session, which can be shared across multiple threads. Closing a shared session has to ensure that * (i) only one thread can successfully close a session (e.g. in a close vs. close race) and that 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 8adf51ef6fda0..ea4535a42625d 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/SystemLookup.java +++ b/src/java.base/share/classes/jdk/internal/foreign/SystemLookup.java @@ -25,17 +25,21 @@ package jdk.internal.foreign; -import java.lang.foreign.*; +import jdk.internal.loader.NativeLibrary; +import jdk.internal.loader.RawNativeLibraries; +import jdk.internal.util.OperatingSystem; +import jdk.internal.util.StaticProperty; + +import java.lang.foreign.MemoryLayout; +import java.lang.foreign.MemorySegment; +import java.lang.foreign.SequenceLayout; +import java.lang.foreign.SymbolLookup; import java.lang.invoke.MethodHandles; import java.nio.file.Files; import java.nio.file.Path; import java.util.Objects; import java.util.Optional; import java.util.function.Function; -import jdk.internal.loader.NativeLibrary; -import jdk.internal.loader.RawNativeLibraries; -import jdk.internal.util.OperatingSystem; -import jdk.internal.util.StaticProperty; import static java.lang.foreign.ValueLayout.ADDRESS; diff --git a/src/java.base/share/classes/jdk/internal/foreign/Utils.java b/src/java.base/share/classes/jdk/internal/foreign/Utils.java index 3d252dcf233ae..0e5111eb1267e 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/Utils.java +++ b/src/java.base/share/classes/jdk/internal/foreign/Utils.java @@ -26,6 +26,12 @@ package jdk.internal.foreign; +import jdk.internal.access.SharedSecrets; +import jdk.internal.foreign.abi.SharedUtils; +import jdk.internal.misc.Unsafe; +import jdk.internal.vm.annotation.ForceInline; +import sun.invoke.util.Wrapper; + import java.lang.foreign.AddressLayout; import java.lang.foreign.MemoryLayout; import java.lang.foreign.MemoryLayout.PathElement; @@ -42,12 +48,6 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.function.Supplier; -import jdk.internal.access.SharedSecrets; -import jdk.internal.foreign.abi.SharedUtils; -import jdk.internal.misc.Unsafe; -import jdk.internal.vm.annotation.ForceInline; -import sun.invoke.util.Wrapper; - /** * This class contains misc helper functions to support creation of memory segments. */ diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/AbstractLinker.java b/src/java.base/share/classes/jdk/internal/foreign/abi/AbstractLinker.java index 5b40ac1775007..2f33202450ff5 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/AbstractLinker.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/AbstractLinker.java @@ -42,11 +42,11 @@ import jdk.internal.reflect.Reflection; import java.lang.foreign.AddressLayout; -import java.lang.foreign.GroupLayout; -import java.lang.foreign.MemoryLayout; import java.lang.foreign.Arena; import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.GroupLayout; import java.lang.foreign.Linker; +import java.lang.foreign.MemoryLayout; import java.lang.foreign.MemorySegment; import java.lang.foreign.PaddingLayout; import java.lang.foreign.SequenceLayout; diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/Binding.java b/src/java.base/share/classes/jdk/internal/foreign/abi/Binding.java index 1f7f3327fe566..52a9de75677cd 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/Binding.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/Binding.java @@ -29,7 +29,10 @@ import jdk.internal.foreign.abi.BindingInterpreter.LoadFunc; import jdk.internal.foreign.abi.BindingInterpreter.StoreFunc; -import java.lang.foreign.*; +import java.lang.foreign.Arena; +import java.lang.foreign.MemoryLayout; +import java.lang.foreign.MemorySegment; +import java.lang.foreign.SegmentAllocator; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; @@ -37,9 +40,7 @@ import java.util.Deque; import java.util.List; -import static java.lang.foreign.ValueLayout.JAVA_BYTE; -import static java.lang.foreign.ValueLayout.JAVA_INT_UNALIGNED; -import static java.lang.foreign.ValueLayout.JAVA_SHORT_UNALIGNED; +import static java.lang.foreign.ValueLayout.*; /** * The binding operators defined in the Binding class can be combined into argument and return value processing 'recipes'. diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/BindingSpecializer.java b/src/java.base/share/classes/jdk/internal/foreign/abi/BindingSpecializer.java index 144af9dac793d..43760ac4c5fc8 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/BindingSpecializer.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/BindingSpecializer.java @@ -25,13 +25,6 @@ package jdk.internal.foreign.abi; -import java.lang.classfile.Annotation; -import java.lang.classfile.ClassFile; -import java.lang.classfile.CodeBuilder; -import java.lang.classfile.Label; -import java.lang.classfile.Opcode; -import java.lang.classfile.TypeKind; - import jdk.internal.foreign.AbstractMemorySegmentImpl; import jdk.internal.foreign.MemorySessionImpl; import jdk.internal.foreign.Utils; @@ -51,12 +44,23 @@ import jdk.internal.vm.annotation.ForceInline; import java.io.IOException; +import java.lang.classfile.Annotation; +import java.lang.classfile.ClassFile; +import java.lang.classfile.CodeBuilder; +import java.lang.classfile.Label; +import java.lang.classfile.Opcode; +import java.lang.classfile.TypeKind; import java.lang.classfile.attribute.RuntimeVisibleAnnotationsAttribute; import java.lang.constant.ClassDesc; import java.lang.constant.ConstantDesc; import java.lang.constant.DynamicConstantDesc; import java.lang.constant.MethodTypeDesc; -import java.lang.foreign.*; +import java.lang.foreign.AddressLayout; +import java.lang.foreign.Arena; +import java.lang.foreign.MemoryLayout; +import java.lang.foreign.MemorySegment; +import java.lang.foreign.SegmentAllocator; +import java.lang.foreign.ValueLayout; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; @@ -69,9 +73,10 @@ import java.util.Deque; import java.util.List; -import static java.lang.constant.ConstantDescs.*; import static java.lang.classfile.ClassFile.*; -import static java.lang.classfile.TypeKind.*; +import static java.lang.classfile.TypeKind.LONG; +import static java.lang.classfile.TypeKind.REFERENCE; +import static java.lang.constant.ConstantDescs.*; import static jdk.internal.constant.ConstantUtils.*; public class BindingSpecializer { diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/CallingSequence.java b/src/java.base/share/classes/jdk/internal/foreign/abi/CallingSequence.java index 5aad4ccc890dc..24fb5a10491c7 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/CallingSequence.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/CallingSequence.java @@ -25,7 +25,6 @@ package jdk.internal.foreign.abi; import java.lang.foreign.FunctionDescriptor; - import java.lang.invoke.MethodType; import java.util.List; import java.util.stream.Stream; diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/CallingSequenceBuilder.java b/src/java.base/share/classes/jdk/internal/foreign/abi/CallingSequenceBuilder.java index a03c20d317349..7363d6c2aa85c 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/CallingSequenceBuilder.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/CallingSequenceBuilder.java @@ -26,7 +26,7 @@ package jdk.internal.foreign.abi; import jdk.internal.foreign.Utils; -import jdk.internal.foreign.abi.Binding.*; +import jdk.internal.foreign.abi.Binding.Allocate; import jdk.internal.foreign.abi.Binding.BoxAddress; import jdk.internal.foreign.abi.Binding.BufferLoad; import jdk.internal.foreign.abi.Binding.BufferStore; diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/DowncallLinker.java b/src/java.base/share/classes/jdk/internal/foreign/abi/DowncallLinker.java index 2df30edb32626..e533147c3fba3 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/DowncallLinker.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/DowncallLinker.java @@ -27,6 +27,8 @@ import jdk.internal.access.JavaLangInvokeAccess; import jdk.internal.access.SharedSecrets; +import jdk.internal.foreign.AbstractMemorySegmentImpl; +import jdk.internal.foreign.MemorySessionImpl; import jdk.internal.invoke.MhUtil; import java.lang.foreign.AddressLayout; @@ -41,13 +43,7 @@ import java.util.List; import java.util.stream.Stream; -import jdk.internal.foreign.AbstractMemorySegmentImpl; -import jdk.internal.foreign.MemorySessionImpl; - -import static java.lang.invoke.MethodHandles.collectArguments; -import static java.lang.invoke.MethodHandles.foldArguments; -import static java.lang.invoke.MethodHandles.identity; -import static java.lang.invoke.MethodHandles.insertArguments; +import static java.lang.invoke.MethodHandles.*; import static java.lang.invoke.MethodType.methodType; public class DowncallLinker { 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 83698398edaa0..0c9a14cb6295a 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 @@ -44,9 +44,9 @@ import java.lang.foreign.AddressLayout; import java.lang.foreign.Arena; -import java.lang.foreign.Linker; import java.lang.foreign.FunctionDescriptor; import java.lang.foreign.GroupLayout; +import java.lang.foreign.Linker; import java.lang.foreign.MemoryLayout; import java.lang.foreign.MemorySegment; import java.lang.foreign.MemorySegment.Scope; diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/UpcallLinker.java b/src/java.base/share/classes/jdk/internal/foreign/abi/UpcallLinker.java index 486ee8b57c53a..f099666c79577 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/UpcallLinker.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/UpcallLinker.java @@ -38,9 +38,7 @@ import java.util.function.UnaryOperator; import java.util.stream.Stream; -import static java.lang.invoke.MethodHandles.exactInvoker; -import static java.lang.invoke.MethodHandles.insertArguments; -import static java.lang.invoke.MethodHandles.lookup; +import static java.lang.invoke.MethodHandles.*; import static java.lang.invoke.MethodType.methodType; public class UpcallLinker { diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/UpcallStubs.java b/src/java.base/share/classes/jdk/internal/foreign/abi/UpcallStubs.java index 2d4ccfe39bcdf..1fcc343f4346f 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/UpcallStubs.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/UpcallStubs.java @@ -24,12 +24,12 @@ */ package jdk.internal.foreign.abi; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.Arena; - import jdk.internal.foreign.MemorySessionImpl; import jdk.internal.foreign.Utils; +import java.lang.foreign.Arena; +import java.lang.foreign.MemorySegment; + public final class UpcallStubs { private UpcallStubs() { 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 9eb4910e5805a..5bfdbff80dfd4 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2019, 2022, Arm Limited. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -25,11 +25,7 @@ */ package jdk.internal.foreign.abi.aarch64; -import java.lang.foreign.AddressLayout; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.GroupLayout; -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; +import jdk.internal.foreign.Utils; import jdk.internal.foreign.abi.ABIDescriptor; import jdk.internal.foreign.abi.AbstractLinker.UpcallStubFactory; import jdk.internal.foreign.abi.Binding; @@ -42,16 +38,21 @@ import jdk.internal.foreign.abi.aarch64.linux.LinuxAArch64CallArranger; import jdk.internal.foreign.abi.aarch64.macos.MacOsAArch64CallArranger; import jdk.internal.foreign.abi.aarch64.windows.WindowsAArch64CallArranger; -import jdk.internal.foreign.Utils; +import java.lang.foreign.AddressLayout; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.GroupLayout; +import java.lang.foreign.MemoryLayout; +import java.lang.foreign.MemorySegment; import java.lang.foreign.ValueLayout; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodType; import java.util.List; import java.util.Optional; -import static jdk.internal.foreign.abi.aarch64.AArch64Architecture.*; import static jdk.internal.foreign.abi.aarch64.AArch64Architecture.Regs.*; +import static jdk.internal.foreign.abi.aarch64.AArch64Architecture.StorageType; +import static jdk.internal.foreign.abi.aarch64.AArch64Architecture.abiFor; /** * For the AArch64 C ABI specifically, this class uses CallingSequenceBuilder diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/TypeClass.java b/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/TypeClass.java index 4c655de4b2035..7aa3c2f2c00be 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/TypeClass.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/TypeClass.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2021, Arm Limited. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -30,8 +30,8 @@ import java.lang.foreign.MemorySegment; import java.lang.foreign.SequenceLayout; import java.lang.foreign.ValueLayout; -import java.util.List; import java.util.ArrayList; +import java.util.List; public enum TypeClass { STRUCT_REGISTER, diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/linux/LinuxAArch64CallArranger.java b/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/linux/LinuxAArch64CallArranger.java index d79b3337f6e00..129f576fa0eb5 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/linux/LinuxAArch64CallArranger.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/linux/LinuxAArch64CallArranger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, Arm Limited. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -25,8 +25,8 @@ */ package jdk.internal.foreign.abi.aarch64.linux; -import jdk.internal.foreign.abi.aarch64.CallArranger; import jdk.internal.foreign.abi.ABIDescriptor; +import jdk.internal.foreign.abi.aarch64.CallArranger; /** * AArch64 CallArranger specialized for Linux ABI. diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/linux/LinuxAArch64Linker.java b/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/linux/LinuxAArch64Linker.java index 4ffd15aefa0ad..410a4ee7872c7 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/linux/LinuxAArch64Linker.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/linux/LinuxAArch64Linker.java @@ -35,7 +35,6 @@ import java.lang.foreign.ValueLayout; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodType; -import java.nio.ByteOrder; import java.util.Map; /** diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/macos/MacOsAArch64CallArranger.java b/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/macos/MacOsAArch64CallArranger.java index e099d8cd93f89..071daddff9a81 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/macos/MacOsAArch64CallArranger.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/macos/MacOsAArch64CallArranger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, Arm Limited. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -25,8 +25,8 @@ */ package jdk.internal.foreign.abi.aarch64.macos; -import jdk.internal.foreign.abi.aarch64.CallArranger; import jdk.internal.foreign.abi.ABIDescriptor; +import jdk.internal.foreign.abi.aarch64.CallArranger; /** * AArch64 CallArranger specialized for macOS ABI. diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/macos/MacOsAArch64Linker.java b/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/macos/MacOsAArch64Linker.java index c60f01524df42..a57012f1f2ed0 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/macos/MacOsAArch64Linker.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/macos/MacOsAArch64Linker.java @@ -35,7 +35,6 @@ import java.lang.foreign.ValueLayout; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodType; -import java.nio.ByteOrder; import java.util.Map; /** diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/windows/WindowsAArch64CallArranger.java b/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/windows/WindowsAArch64CallArranger.java index 18df73870758a..e80107e8e716b 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/windows/WindowsAArch64CallArranger.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/windows/WindowsAArch64CallArranger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, Arm Limited. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -25,15 +25,15 @@ */ package jdk.internal.foreign.abi.aarch64.windows; -import jdk.internal.foreign.abi.aarch64.CallArranger; -import jdk.internal.foreign.abi.aarch64.TypeClass; import jdk.internal.foreign.abi.ABIDescriptor; import jdk.internal.foreign.abi.VMStorage; +import jdk.internal.foreign.abi.aarch64.CallArranger; +import jdk.internal.foreign.abi.aarch64.TypeClass; import java.lang.foreign.MemoryLayout; -import static jdk.internal.foreign.abi.aarch64.AArch64Architecture.*; import static jdk.internal.foreign.abi.aarch64.AArch64Architecture.Regs.*; +import static jdk.internal.foreign.abi.aarch64.AArch64Architecture.abiFor; /** * AArch64 CallArranger specialized for Windows ABI. diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/windows/WindowsAArch64Linker.java b/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/windows/WindowsAArch64Linker.java index 23fb046aeb1da..91aaab2c9a38b 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/windows/WindowsAArch64Linker.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/windows/WindowsAArch64Linker.java @@ -36,7 +36,6 @@ import java.lang.foreign.ValueLayout; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodType; -import java.nio.ByteOrder; import java.util.Map; /** diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/fallback/FFIType.java b/src/java.base/share/classes/jdk/internal/foreign/abi/fallback/FFIType.java index c8fa729711abf..0a7af4b04f6b6 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/fallback/FFIType.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/fallback/FFIType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,11 +42,7 @@ import java.util.Objects; import java.util.function.Predicate; -import static java.lang.foreign.ValueLayout.ADDRESS; -import static java.lang.foreign.ValueLayout.JAVA_BYTE; -import static java.lang.foreign.ValueLayout.JAVA_INT; -import static java.lang.foreign.ValueLayout.JAVA_LONG; -import static java.lang.foreign.ValueLayout.JAVA_SHORT; +import static java.lang.foreign.ValueLayout.*; /** * typedef struct _ffi_type diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/fallback/FallbackLinker.java b/src/java.base/share/classes/jdk/internal/foreign/abi/fallback/FallbackLinker.java index 54906d9fef2ed..75a0a2ed4b50c 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/fallback/FallbackLinker.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/fallback/FallbackLinker.java @@ -24,6 +24,13 @@ */ package jdk.internal.foreign.abi.fallback; +import jdk.internal.foreign.AbstractMemorySegmentImpl; +import jdk.internal.foreign.MemorySessionImpl; +import jdk.internal.foreign.abi.AbstractLinker; +import jdk.internal.foreign.abi.CapturableState; +import jdk.internal.foreign.abi.LinkerOptions; +import jdk.internal.foreign.abi.SharedUtils; + import java.lang.foreign.AddressLayout; import java.lang.foreign.Arena; import java.lang.foreign.FunctionDescriptor; @@ -33,29 +40,16 @@ import java.lang.foreign.SegmentAllocator; import java.lang.foreign.SequenceLayout; import java.lang.foreign.ValueLayout; -import static java.lang.foreign.ValueLayout.ADDRESS; -import static java.lang.foreign.ValueLayout.JAVA_BOOLEAN; -import static java.lang.foreign.ValueLayout.JAVA_BYTE; -import static java.lang.foreign.ValueLayout.JAVA_CHAR; -import static java.lang.foreign.ValueLayout.JAVA_DOUBLE; -import static java.lang.foreign.ValueLayout.JAVA_FLOAT; -import static java.lang.foreign.ValueLayout.JAVA_INT; -import static java.lang.foreign.ValueLayout.JAVA_LONG; -import static java.lang.foreign.ValueLayout.JAVA_SHORT; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; -import static java.lang.invoke.MethodHandles.foldArguments; import java.lang.invoke.MethodType; import java.lang.ref.Reference; import java.util.ArrayList; import java.util.List; import java.util.Map; -import jdk.internal.foreign.AbstractMemorySegmentImpl; -import jdk.internal.foreign.MemorySessionImpl; -import jdk.internal.foreign.abi.AbstractLinker; -import jdk.internal.foreign.abi.CapturableState; -import jdk.internal.foreign.abi.LinkerOptions; -import jdk.internal.foreign.abi.SharedUtils; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.invoke.MethodHandles.foldArguments; public final class FallbackLinker extends AbstractLinker { diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/CallArranger.java b/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/CallArranger.java index d07cd79e54813..5d7b027ba2b3d 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/CallArranger.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/CallArranger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2023 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -50,8 +50,9 @@ import java.util.List; import java.util.Optional; -import static jdk.internal.foreign.abi.ppc64.PPC64Architecture.*; import static jdk.internal.foreign.abi.ppc64.PPC64Architecture.Regs.*; +import static jdk.internal.foreign.abi.ppc64.PPC64Architecture.StorageType; +import static jdk.internal.foreign.abi.ppc64.PPC64Architecture.abiFor; /** * For the PPC64 C ABI specifically, this class uses CallingSequenceBuilder 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 b04d4abf8a4bb..c433fb851f4da 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2023 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -30,8 +30,8 @@ import java.lang.foreign.MemorySegment; import java.lang.foreign.SequenceLayout; import java.lang.foreign.ValueLayout; -import java.util.List; import java.util.ArrayList; +import java.util.List; public enum TypeClass { STRUCT_REGISTER, diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/linux/LinuxPPC64Linker.java b/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/linux/LinuxPPC64Linker.java index a9f5bb4d60045..88f4934a7c12d 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/linux/LinuxPPC64Linker.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/linux/LinuxPPC64Linker.java @@ -35,7 +35,6 @@ import java.lang.foreign.ValueLayout; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodType; -import java.nio.ByteOrder; import java.util.Map; public final class LinuxPPC64Linker extends AbstractLinker { diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/linux/LinuxPPC64leLinker.java b/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/linux/LinuxPPC64leLinker.java index e8305669ba035..e4d04ceb1600a 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/linux/LinuxPPC64leLinker.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/linux/LinuxPPC64leLinker.java @@ -35,7 +35,6 @@ import java.lang.foreign.ValueLayout; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodType; -import java.nio.ByteOrder; import java.util.Map; public final class LinuxPPC64leLinker extends AbstractLinker { diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/riscv64/linux/LinuxRISCV64CallArranger.java b/src/java.base/share/classes/jdk/internal/foreign/abi/riscv64/linux/LinuxRISCV64CallArranger.java index e8ac33054d20e..af6e9ba8dcb2c 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/riscv64/linux/LinuxRISCV64CallArranger.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/riscv64/linux/LinuxRISCV64CallArranger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2023, Institute of Software, Chinese Academy of Sciences. * All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,11 +28,7 @@ package jdk.internal.foreign.abi.riscv64.linux; -import java.lang.foreign.AddressLayout; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.GroupLayout; -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; +import jdk.internal.foreign.Utils; import jdk.internal.foreign.abi.ABIDescriptor; import jdk.internal.foreign.abi.AbstractLinker.UpcallStubFactory; import jdk.internal.foreign.abi.Binding; @@ -42,17 +38,21 @@ import jdk.internal.foreign.abi.LinkerOptions; import jdk.internal.foreign.abi.SharedUtils; import jdk.internal.foreign.abi.VMStorage; -import jdk.internal.foreign.Utils; +import java.lang.foreign.AddressLayout; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.GroupLayout; +import java.lang.foreign.MemoryLayout; +import java.lang.foreign.MemorySegment; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodType; import java.util.List; import java.util.Map; import java.util.Optional; -import static jdk.internal.foreign.abi.riscv64.linux.TypeClass.*; -import static jdk.internal.foreign.abi.riscv64.RISCV64Architecture.*; import static jdk.internal.foreign.abi.riscv64.RISCV64Architecture.Regs.*; +import static jdk.internal.foreign.abi.riscv64.RISCV64Architecture.*; +import static jdk.internal.foreign.abi.riscv64.linux.TypeClass.*; /** * For the RISCV64 C ABI specifically, this class uses CallingSequenceBuilder diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/riscv64/linux/LinuxRISCV64Linker.java b/src/java.base/share/classes/jdk/internal/foreign/abi/riscv64/linux/LinuxRISCV64Linker.java index 706fdacf60875..62137ebb70dd3 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/riscv64/linux/LinuxRISCV64Linker.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/riscv64/linux/LinuxRISCV64Linker.java @@ -37,7 +37,6 @@ import java.lang.foreign.ValueLayout; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodType; -import java.nio.ByteOrder; import java.util.Map; public final class LinuxRISCV64Linker extends AbstractLinker { diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/s390/linux/LinuxS390CallArranger.java b/src/java.base/share/classes/jdk/internal/foreign/abi/s390/linux/LinuxS390CallArranger.java index 7e6c254079ac7..dd83ad0f3fe1d 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/s390/linux/LinuxS390CallArranger.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/s390/linux/LinuxS390CallArranger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2023 IBM Corp. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -25,11 +25,7 @@ */ package jdk.internal.foreign.abi.s390.linux; -import java.lang.foreign.AddressLayout; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.GroupLayout; -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; +import jdk.internal.foreign.Utils; import jdk.internal.foreign.abi.ABIDescriptor; import jdk.internal.foreign.abi.AbstractLinker.UpcallStubFactory; import jdk.internal.foreign.abi.Binding; @@ -39,8 +35,12 @@ import jdk.internal.foreign.abi.LinkerOptions; import jdk.internal.foreign.abi.SharedUtils; import jdk.internal.foreign.abi.VMStorage; -import jdk.internal.foreign.Utils; +import java.lang.foreign.AddressLayout; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.GroupLayout; +import java.lang.foreign.MemoryLayout; +import java.lang.foreign.MemorySegment; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodType; import java.util.List; diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/s390/linux/LinuxS390Linker.java b/src/java.base/share/classes/jdk/internal/foreign/abi/s390/linux/LinuxS390Linker.java index 9810fbf169579..44b72e4c79791 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/s390/linux/LinuxS390Linker.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/s390/linux/LinuxS390Linker.java @@ -34,7 +34,6 @@ import java.lang.foreign.ValueLayout; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodType; -import java.nio.ByteOrder; import java.util.Map; public final class LinuxS390Linker extends AbstractLinker { diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/s390/linux/TypeClass.java b/src/java.base/share/classes/jdk/internal/foreign/abi/s390/linux/TypeClass.java index 1f96fa4bf79df..68247befe58f9 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/s390/linux/TypeClass.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/s390/linux/TypeClass.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2023 IBM Corp. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -30,8 +30,8 @@ import java.lang.foreign.MemorySegment; import java.lang.foreign.SequenceLayout; import java.lang.foreign.ValueLayout; -import java.util.List; import java.util.ArrayList; +import java.util.List; public enum TypeClass { STRUCT_REGISTER, 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 78db1ca89e676..7cee084d1f702 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,8 +50,8 @@ import java.util.Optional; import static jdk.internal.foreign.abi.Binding.vmStore; -import static jdk.internal.foreign.abi.x64.X86_64Architecture.*; import static jdk.internal.foreign.abi.x64.X86_64Architecture.Regs.*; +import static jdk.internal.foreign.abi.x64.X86_64Architecture.StorageType; /** * For the SysV x64 C ABI specifically, this class uses namely CallingSequenceBuilder diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/x64/sysv/SysVx64Linker.java b/src/java.base/share/classes/jdk/internal/foreign/abi/x64/sysv/SysVx64Linker.java index b1fce35af8375..9e0a2f8bdf7df 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/x64/sysv/SysVx64Linker.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/x64/sysv/SysVx64Linker.java @@ -34,7 +34,6 @@ import java.lang.foreign.ValueLayout; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodType; -import java.nio.ByteOrder; import java.util.Map; /** diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/x64/sysv/TypeClass.java b/src/java.base/share/classes/jdk/internal/foreign/abi/x64/sysv/TypeClass.java index 429b29e7fd1d4..166f47479e448 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/x64/sysv/TypeClass.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/x64/sysv/TypeClass.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,8 @@ */ package jdk.internal.foreign.abi.x64.sysv; +import jdk.internal.foreign.Utils; + import java.lang.foreign.GroupLayout; import java.lang.foreign.MemoryLayout; import java.lang.foreign.MemorySegment; @@ -31,8 +33,6 @@ import java.lang.foreign.SequenceLayout; import java.lang.foreign.StructLayout; import java.lang.foreign.ValueLayout; -import jdk.internal.foreign.Utils; - import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; 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 cc69e79a09210..3261e9cd4cda6 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,8 +46,9 @@ import java.util.List; import java.util.Optional; -import static jdk.internal.foreign.abi.x64.X86_64Architecture.*; +import static jdk.internal.foreign.abi.x64.X86_64Architecture.INSTANCE; import static jdk.internal.foreign.abi.x64.X86_64Architecture.Regs.*; +import static jdk.internal.foreign.abi.x64.X86_64Architecture.StorageType; /** * For the Windowx x64 C ABI specifically, this class uses CallingSequenceBuilder diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/x64/windows/Windowsx64Linker.java b/src/java.base/share/classes/jdk/internal/foreign/abi/x64/windows/Windowsx64Linker.java index 30e4a5bdaf495..232e3bf048c39 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/x64/windows/Windowsx64Linker.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/x64/windows/Windowsx64Linker.java @@ -33,7 +33,6 @@ import java.lang.foreign.ValueLayout; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodType; -import java.nio.ByteOrder; import java.util.Map; /**