public final class jdk.internal.foreign.Utils
minor version: 0
major version: 59
flags: flags: (0x0031) ACC_PUBLIC, ACC_FINAL, ACC_SUPER
this_class: jdk.internal.foreign.Utils
super_class: java.lang.Object
{
private static jdk.internal.misc.Unsafe unsafe;
descriptor: Ljdk/internal/misc/Unsafe;
flags: (0x000a) ACC_PRIVATE, ACC_STATIC
private static final long MAX_ALIGN;
descriptor: J
flags: (0x001a) ACC_PRIVATE, ACC_STATIC, ACC_FINAL
ConstantValue: 16
private static final jdk.internal.access.JavaNioAccess javaNioAccess;
descriptor: Ljdk/internal/access/JavaNioAccess;
flags: (0x001a) ACC_PRIVATE, ACC_STATIC, ACC_FINAL
private static final boolean skipZeroMemory;
descriptor: Z
flags: (0x001a) ACC_PRIVATE, ACC_STATIC, ACC_FINAL
static void <clinit>();
descriptor: ()V
flags: (0x0008) ACC_STATIC
Code:
stack=1, locals=0, args_size=0
0: invokestatic jdk.internal.misc.Unsafe.getUnsafe:()Ljdk/internal/misc/Unsafe;
putstatic jdk.internal.foreign.Utils.unsafe:Ljdk/internal/misc/Unsafe;
1: invokestatic jdk.internal.access.SharedSecrets.getJavaNioAccess:()Ljdk/internal/access/JavaNioAccess;
putstatic jdk.internal.foreign.Utils.javaNioAccess:Ljdk/internal/access/JavaNioAccess;
2: ldc "jdk.internal.foreign.skipZeroMemory"
invokestatic sun.security.action.GetBooleanAction.privilegedGetProperty:(Ljava/lang/String;)Z
putstatic jdk.internal.foreign.Utils.skipZeroMemory:Z
return
LocalVariableTable:
Start End Slot Name Signature
public void <init>();
descriptor: ()V
flags: (0x0001) ACC_PUBLIC
Code:
stack=1, locals=1, args_size=1
start local 0 0: aload 0
invokespecial java.lang.Object.<init>:()V
return
end local 0 LocalVariableTable:
Start End Slot Name Signature
0 1 0 this Ljdk/internal/foreign/Utils;
public static long alignUp(long, long);
descriptor: (JJ)J
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
Code:
stack=4, locals=4, args_size=2
start local 0 start local 2 0: lload 0
lload 2
ladd
lconst_1
lsub
lload 2
lneg
land
lreturn
end local 2 end local 0 LocalVariableTable:
Start End Slot Name Signature
0 1 0 n J
0 1 2 alignment J
MethodParameters:
Name Flags
n
alignment
public static long bitsToBytesOrThrow(long, java.util.function.Supplier<java.lang.RuntimeException>);
descriptor: (JLjava/util/function/Supplier;)J
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
Code:
stack=4, locals=3, args_size=2
start local 0 start local 2 0: lload 0
ldc 8
lrem
lconst_0
lcmp
ifne 2
1: lload 0
ldc 8
ldiv
lreturn
2: StackMap locals:
StackMap stack:
aload 2
invokeinterface java.util.function.Supplier.get:()Ljava/lang/Object;
checkcast java.lang.RuntimeException
athrow
end local 2 end local 0 LocalVariableTable:
Start End Slot Name Signature
0 3 0 bits J
0 3 2 exFactory Ljava/util/function/Supplier<Ljava/lang/RuntimeException;>;
Signature: (JLjava/util/function/Supplier<Ljava/lang/RuntimeException;>;)J
MethodParameters:
Name Flags
bits
exFactory
public static jdk.incubator.foreign.MemorySegment makeNativeSegment(long, long);
descriptor: (JJ)Ljdk/incubator/foreign/MemorySegment;
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
Code:
stack=10, locals=14, args_size=2
start local 0 start local 2 0: lload 0
lstore 4
start local 4 1: lload 2
ldc 16
lcmp
ifle 3
2: lload 0
lload 2
lconst_1
lsub
ladd
lstore 4
3: StackMap locals: long
StackMap stack:
getstatic jdk.internal.foreign.Utils.unsafe:Ljdk/internal/misc/Unsafe;
lload 4
invokevirtual jdk.internal.misc.Unsafe.allocateMemory:(J)J
lstore 6
start local 6 4: getstatic jdk.internal.foreign.Utils.skipZeroMemory:Z
ifne 6
5: getstatic jdk.internal.foreign.Utils.unsafe:Ljdk/internal/misc/Unsafe;
lload 6
lload 4
iconst_0
invokevirtual jdk.internal.misc.Unsafe.setMemory:(JJB)V
6: StackMap locals: long
StackMap stack:
lload 6
lload 2
invokestatic jdk.internal.foreign.Utils.alignUp:(JJ)J
lstore 8
start local 8 7: new jdk.internal.foreign.MemoryScope
dup
aconst_null
lload 6
invokedynamic run(J)Ljava/lang/Runnable;
Bootstrap: invokestatic java.lang.invoke.LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
Method arguments:
()V
jdk/internal/foreign/Utils.lambda$0(J)V (6)
()V
invokespecial jdk.internal.foreign.MemoryScope.<init>:(Ljava/lang/Object;Ljava/lang/Runnable;)V
astore 10
start local 10 8: new jdk.internal.foreign.MemorySegmentImpl
dup
lload 6
aconst_null
lload 4
iconst_0
invokestatic java.lang.Thread.currentThread:()Ljava/lang/Thread;
aload 10
invokespecial jdk.internal.foreign.MemorySegmentImpl.<init>:(JLjava/lang/Object;JILjava/lang/Thread;Ljdk/internal/foreign/MemoryScope;)V
astore 11
start local 11 9: lload 8
lload 6
lcmp
ifeq 12
10: lload 8
lload 6
lsub
lstore 12
start local 12 11: aload 11
lload 12
lload 0
invokeinterface jdk.incubator.foreign.MemorySegment.asSlice:(JJ)Ljdk/incubator/foreign/MemorySegment;
astore 11
end local 12 12: StackMap locals: long jdk.internal.foreign.MemoryScope jdk.incubator.foreign.MemorySegment
StackMap stack:
aload 11
areturn
end local 11 end local 10 end local 8 end local 6 end local 4 end local 2 end local 0 LocalVariableTable:
Start End Slot Name Signature
0 13 0 bytesSize J
0 13 2 alignmentBytes J
1 13 4 alignedSize J
4 13 6 buf J
7 13 8 alignedBuf J
8 13 10 scope Ljdk/internal/foreign/MemoryScope;
9 13 11 segment Ljdk/incubator/foreign/MemorySegment;
11 12 12 delta J
MethodParameters:
Name Flags
bytesSize
alignmentBytes
public static jdk.incubator.foreign.MemorySegment makeArraySegment(byte[]);
descriptor: ([B)Ljdk/incubator/foreign/MemorySegment;
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
Code:
stack=4, locals=1, args_size=1
start local 0 0: aload 0
aload 0
arraylength
getstatic jdk.internal.misc.Unsafe.ARRAY_BYTE_BASE_OFFSET:I
getstatic jdk.internal.misc.Unsafe.ARRAY_BYTE_INDEX_SCALE:I
invokestatic jdk.internal.foreign.Utils.makeArraySegment:(Ljava/lang/Object;III)Ljdk/incubator/foreign/MemorySegment;
areturn
end local 0 LocalVariableTable:
Start End Slot Name Signature
0 1 0 arr [B
MethodParameters:
Name Flags
arr
public static jdk.incubator.foreign.MemorySegment makeArraySegment(char[]);
descriptor: ([C)Ljdk/incubator/foreign/MemorySegment;
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
Code:
stack=4, locals=1, args_size=1
start local 0 0: aload 0
aload 0
arraylength
getstatic jdk.internal.misc.Unsafe.ARRAY_CHAR_BASE_OFFSET:I
getstatic jdk.internal.misc.Unsafe.ARRAY_CHAR_INDEX_SCALE:I
invokestatic jdk.internal.foreign.Utils.makeArraySegment:(Ljava/lang/Object;III)Ljdk/incubator/foreign/MemorySegment;
areturn
end local 0 LocalVariableTable:
Start End Slot Name Signature
0 1 0 arr [C
MethodParameters:
Name Flags
arr
public static jdk.incubator.foreign.MemorySegment makeArraySegment(short[]);
descriptor: ([S)Ljdk/incubator/foreign/MemorySegment;
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
Code:
stack=4, locals=1, args_size=1
start local 0 0: aload 0
aload 0
arraylength
getstatic jdk.internal.misc.Unsafe.ARRAY_SHORT_BASE_OFFSET:I
getstatic jdk.internal.misc.Unsafe.ARRAY_SHORT_INDEX_SCALE:I
invokestatic jdk.internal.foreign.Utils.makeArraySegment:(Ljava/lang/Object;III)Ljdk/incubator/foreign/MemorySegment;
areturn
end local 0 LocalVariableTable:
Start End Slot Name Signature
0 1 0 arr [S
MethodParameters:
Name Flags
arr
public static jdk.incubator.foreign.MemorySegment makeArraySegment(int[]);
descriptor: ([I)Ljdk/incubator/foreign/MemorySegment;
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
Code:
stack=4, locals=1, args_size=1
start local 0 0: aload 0
aload 0
arraylength
getstatic jdk.internal.misc.Unsafe.ARRAY_INT_BASE_OFFSET:I
getstatic jdk.internal.misc.Unsafe.ARRAY_INT_INDEX_SCALE:I
invokestatic jdk.internal.foreign.Utils.makeArraySegment:(Ljava/lang/Object;III)Ljdk/incubator/foreign/MemorySegment;
areturn
end local 0 LocalVariableTable:
Start End Slot Name Signature
0 1 0 arr [I
MethodParameters:
Name Flags
arr
public static jdk.incubator.foreign.MemorySegment makeArraySegment(float[]);
descriptor: ([F)Ljdk/incubator/foreign/MemorySegment;
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
Code:
stack=4, locals=1, args_size=1
start local 0 0: aload 0
aload 0
arraylength
getstatic jdk.internal.misc.Unsafe.ARRAY_FLOAT_BASE_OFFSET:I
getstatic jdk.internal.misc.Unsafe.ARRAY_FLOAT_INDEX_SCALE:I
invokestatic jdk.internal.foreign.Utils.makeArraySegment:(Ljava/lang/Object;III)Ljdk/incubator/foreign/MemorySegment;
areturn
end local 0 LocalVariableTable:
Start End Slot Name Signature
0 1 0 arr [F
MethodParameters:
Name Flags
arr
public static jdk.incubator.foreign.MemorySegment makeArraySegment(long[]);
descriptor: ([J)Ljdk/incubator/foreign/MemorySegment;
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
Code:
stack=4, locals=1, args_size=1
start local 0 0: aload 0
aload 0
arraylength
getstatic jdk.internal.misc.Unsafe.ARRAY_LONG_BASE_OFFSET:I
getstatic jdk.internal.misc.Unsafe.ARRAY_LONG_INDEX_SCALE:I
invokestatic jdk.internal.foreign.Utils.makeArraySegment:(Ljava/lang/Object;III)Ljdk/incubator/foreign/MemorySegment;
areturn
end local 0 LocalVariableTable:
Start End Slot Name Signature
0 1 0 arr [J
MethodParameters:
Name Flags
arr
public static jdk.incubator.foreign.MemorySegment makeArraySegment(double[]);
descriptor: ([D)Ljdk/incubator/foreign/MemorySegment;
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
Code:
stack=4, locals=1, args_size=1
start local 0 0: aload 0
aload 0
arraylength
getstatic jdk.internal.misc.Unsafe.ARRAY_DOUBLE_BASE_OFFSET:I
getstatic jdk.internal.misc.Unsafe.ARRAY_DOUBLE_INDEX_SCALE:I
invokestatic jdk.internal.foreign.Utils.makeArraySegment:(Ljava/lang/Object;III)Ljdk/incubator/foreign/MemorySegment;
areturn
end local 0 LocalVariableTable:
Start End Slot Name Signature
0 1 0 arr [D
MethodParameters:
Name Flags
arr
private static jdk.incubator.foreign.MemorySegment makeArraySegment(java.lang.Object, int, int, int);
descriptor: (Ljava/lang/Object;III)Ljdk/incubator/foreign/MemorySegment;
flags: (0x000a) ACC_PRIVATE, ACC_STATIC
Code:
stack=10, locals=5, args_size=4
start local 0 start local 1 start local 2 start local 3 0: new jdk.internal.foreign.MemoryScope
dup
aconst_null
aconst_null
invokespecial jdk.internal.foreign.MemoryScope.<init>:(Ljava/lang/Object;Ljava/lang/Runnable;)V
astore 4
start local 4 1: new jdk.internal.foreign.MemorySegmentImpl
dup
iload 2
i2l
aload 0
iload 1
iload 3
imul
i2l
iconst_0
invokestatic java.lang.Thread.currentThread:()Ljava/lang/Thread;
aload 4
invokespecial jdk.internal.foreign.MemorySegmentImpl.<init>:(JLjava/lang/Object;JILjava/lang/Thread;Ljdk/internal/foreign/MemoryScope;)V
areturn
end local 4 end local 3 end local 2 end local 1 end local 0 LocalVariableTable:
Start End Slot Name Signature
0 2 0 arr Ljava/lang/Object;
0 2 1 size I
0 2 2 base I
0 2 3 scale I
1 2 4 scope Ljdk/internal/foreign/MemoryScope;
MethodParameters:
Name Flags
arr
size
base
scale
public static jdk.incubator.foreign.MemorySegment makeBufferSegment(java.nio.ByteBuffer);
descriptor: (Ljava/nio/ByteBuffer;)Ljdk/incubator/foreign/MemorySegment;
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
Code:
stack=10, locals=7, args_size=1
start local 0 0: getstatic jdk.internal.foreign.Utils.javaNioAccess:Ljdk/internal/access/JavaNioAccess;
aload 0
invokeinterface jdk.internal.access.JavaNioAccess.getBufferAddress:(Ljava/nio/ByteBuffer;)J
lstore 1
start local 1 1: getstatic jdk.internal.foreign.Utils.javaNioAccess:Ljdk/internal/access/JavaNioAccess;
aload 0
invokeinterface jdk.internal.access.JavaNioAccess.getBufferBase:(Ljava/nio/ByteBuffer;)Ljava/lang/Object;
astore 3
start local 3 2: aload 0
invokevirtual java.nio.ByteBuffer.position:()I
istore 4
start local 4 3: aload 0
invokevirtual java.nio.ByteBuffer.limit:()I
istore 5
start local 5 4: new jdk.internal.foreign.MemoryScope
dup
aload 0
aconst_null
invokespecial jdk.internal.foreign.MemoryScope.<init>:(Ljava/lang/Object;Ljava/lang/Runnable;)V
astore 6
start local 6 5: new jdk.internal.foreign.MemorySegmentImpl
dup
lload 1
iload 4
i2l
ladd
aload 3
iload 5
iload 4
isub
i2l
iconst_0
invokestatic java.lang.Thread.currentThread:()Ljava/lang/Thread;
aload 6
invokespecial jdk.internal.foreign.MemorySegmentImpl.<init>:(JLjava/lang/Object;JILjava/lang/Thread;Ljdk/internal/foreign/MemoryScope;)V
areturn
end local 6 end local 5 end local 4 end local 3 end local 1 end local 0 LocalVariableTable:
Start End Slot Name Signature
0 6 0 bb Ljava/nio/ByteBuffer;
1 6 1 bbAddress J
2 6 3 base Ljava/lang/Object;
3 6 4 pos I
4 6 5 limit I
5 6 6 bufferScope Ljdk/internal/foreign/MemoryScope;
MethodParameters:
Name Flags
bb
public static jdk.incubator.foreign.MemorySegment makeMappedSegment(java.nio.file.Path, long, java.nio.channels.FileChannel$MapMode);
descriptor: (Ljava/nio/file/Path;JLjava/nio/channels/FileChannel$MapMode;)Ljdk/incubator/foreign/MemorySegment;
flags: (0x0009) ACC_PUBLIC, ACC_STATIC
Code:
stack=10, locals=9, args_size=3
start local 0 start local 1 start local 3 0: lload 1
lconst_0
lcmp
ifgt 1
new java.lang.IllegalArgumentException
dup
ldc "Requested bytes size must be > 0."
invokespecial java.lang.IllegalArgumentException.<init>:(Ljava/lang/String;)V
athrow
1: StackMap locals:
StackMap stack:
aconst_null
astore 4
aconst_null
astore 5
2: aload 0
aload 3
invokestatic jdk.internal.foreign.Utils.openOptions:(Ljava/nio/channels/FileChannel$MapMode;)[Ljava/nio/file/OpenOption;
invokestatic java.nio.channels.FileChannel.open:(Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljava/nio/channels/FileChannel;
checkcast sun.nio.ch.FileChannelImpl
astore 6
start local 6 3: aload 6
aload 3
lconst_0
lload 1
invokevirtual sun.nio.ch.FileChannelImpl.mapInternal:(Ljava/nio/channels/FileChannel$MapMode;JJ)Lsun/nio/ch/FileChannelImpl$Unmapper;
astore 7
start local 7 4: new jdk.internal.foreign.MemoryScope
dup
aconst_null
aload 7
dup
invokevirtual java.lang.Object.getClass:()Ljava/lang/Class;
pop
invokedynamic run(Ljdk/internal/access/foreign/UnmapperProxy;)Ljava/lang/Runnable;
Bootstrap: invokestatic java.lang.invoke.LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
Method arguments:
()V
jdk/internal/access/foreign/UnmapperProxy.unmap()V (9 itf)
()V
invokespecial jdk.internal.foreign.MemoryScope.<init>:(Ljava/lang/Object;Ljava/lang/Runnable;)V
astore 8
start local 8 5: new jdk.internal.foreign.MemorySegmentImpl
dup
aload 7
invokeinterface jdk.internal.access.foreign.UnmapperProxy.address:()J
aconst_null
lload 1
iconst_0
invokestatic java.lang.Thread.currentThread:()Ljava/lang/Thread;
aload 8
invokespecial jdk.internal.foreign.MemorySegmentImpl.<init>:(JLjava/lang/Object;JILjava/lang/Thread;Ljdk/internal/foreign/MemoryScope;)V
6: aload 6
ifnull 7
aload 6
invokevirtual sun.nio.ch.FileChannelImpl.close:()V
7: StackMap locals: java.nio.file.Path long java.nio.channels.FileChannel$MapMode java.lang.Throwable java.lang.Throwable sun.nio.ch.FileChannelImpl jdk.internal.access.foreign.UnmapperProxy jdk.internal.foreign.MemoryScope
StackMap stack: jdk.internal.foreign.MemorySegmentImpl
areturn
end local 8 end local 7 StackMap locals: java.nio.file.Path long java.nio.channels.FileChannel$MapMode java.lang.Throwable java.lang.Throwable sun.nio.ch.FileChannelImpl
StackMap stack: java.lang.Throwable
8: astore 4
9: aload 6
ifnull 10
aload 6
invokevirtual sun.nio.ch.FileChannelImpl.close:()V
end local 6 StackMap locals:
StackMap stack:
10: aload 4
athrow
StackMap locals:
StackMap stack: java.lang.Throwable
11: astore 5
aload 4
ifnonnull 12
aload 5
astore 4
goto 13
StackMap locals:
StackMap stack:
12: aload 4
aload 5
if_acmpeq 13
aload 4
aload 5
invokevirtual java.lang.Throwable.addSuppressed:(Ljava/lang/Throwable;)V
StackMap locals:
StackMap stack:
13: aload 4
athrow
end local 3 end local 1 end local 0 LocalVariableTable:
Start End Slot Name Signature
0 14 0 path Ljava/nio/file/Path;
0 14 1 bytesSize J
0 14 3 mapMode Ljava/nio/channels/FileChannel$MapMode;
3 10 6 channelImpl Lsun/nio/ch/FileChannelImpl;
4 8 7 unmapperProxy Ljdk/internal/access/foreign/UnmapperProxy;
5 8 8 scope Ljdk/internal/foreign/MemoryScope;
Exception table:
from to target type
3 6 8 any
2 7 11 any
8 11 11 any
Exceptions:
throws java.io.IOException
MethodParameters:
Name Flags
path
bytesSize
mapMode
private static java.nio.file.OpenOption[] openOptions(java.nio.channels.FileChannel$MapMode);
descriptor: (Ljava/nio/channels/FileChannel$MapMode;)[Ljava/nio/file/OpenOption;
flags: (0x000a) ACC_PRIVATE, ACC_STATIC
Code:
stack=5, locals=1, args_size=1
start local 0 0: aload 0
getstatic java.nio.channels.FileChannel$MapMode.READ_ONLY:Ljava/nio/channels/FileChannel$MapMode;
if_acmpne 2
1: iconst_1
anewarray java.nio.file.OpenOption
dup
iconst_0
getstatic java.nio.file.StandardOpenOption.READ:Ljava/nio/file/StandardOpenOption;
aastore
areturn
2: StackMap locals:
StackMap stack:
aload 0
getstatic java.nio.channels.FileChannel$MapMode.READ_WRITE:Ljava/nio/channels/FileChannel$MapMode;
if_acmpeq 3
aload 0
getstatic java.nio.channels.FileChannel$MapMode.PRIVATE:Ljava/nio/channels/FileChannel$MapMode;
if_acmpne 4
3: StackMap locals:
StackMap stack:
iconst_2
anewarray java.nio.file.OpenOption
dup
iconst_0
getstatic java.nio.file.StandardOpenOption.READ:Ljava/nio/file/StandardOpenOption;
aastore
dup
iconst_1
getstatic java.nio.file.StandardOpenOption.WRITE:Ljava/nio/file/StandardOpenOption;
aastore
areturn
4: StackMap locals:
StackMap stack:
new java.lang.UnsupportedOperationException
dup
new java.lang.StringBuilder
dup
ldc "Unsupported map mode: "
invokespecial java.lang.StringBuilder.<init>:(Ljava/lang/String;)V
aload 0
invokevirtual java.lang.StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
invokevirtual java.lang.StringBuilder.toString:()Ljava/lang/String;
invokespecial java.lang.UnsupportedOperationException.<init>:(Ljava/lang/String;)V
athrow
end local 0 LocalVariableTable:
Start End Slot Name Signature
0 5 0 mapMode Ljava/nio/channels/FileChannel$MapMode;
MethodParameters:
Name Flags
mapMode
private static void lambda$0(long);
descriptor: (J)V
flags: (0x100a) ACC_PRIVATE, ACC_STATIC, ACC_SYNTHETIC
Code:
stack=3, locals=2, args_size=1
0: getstatic jdk.internal.foreign.Utils.unsafe:Ljdk/internal/misc/Unsafe;
lload 0
invokevirtual jdk.internal.misc.Unsafe.freeMemory:(J)V
return
LocalVariableTable:
Start End Slot Name Signature
}
SourceFile: "Utils.java"
InnerClasses:
public final Lookup = java.lang.invoke.MethodHandles$Lookup of java.lang.invoke.MethodHandles
public MapMode = java.nio.channels.FileChannel$MapMode of java.nio.channels.FileChannel
private abstract Unmapper = sun.nio.ch.FileChannelImpl$Unmapper of sun.nio.ch.FileChannelImpl