From c9094975b9e48f4e0c0a200a32e75028c31d3d19 Mon Sep 17 00:00:00 2001 From: docdenisdoc Date: Wed, 20 Nov 2024 12:19:35 +0300 Subject: [PATCH] =?UTF-8?q?-=20=D0=BD=D0=B5=20=D0=B4=D0=B5=D0=BB=D0=B0?= =?UTF-8?q?=D0=B5=D0=BC=20=D0=B0=D0=BB=D0=BB=D0=BE=D0=BA=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D0=B9=20=D0=BF=D1=80=D0=B8=20=D0=BF=D0=BE=D0=BB=D1=83=D1=87?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B8=20valuesIdx=20commit=5Fhash:6f19d55db0?= =?UTF-8?q?d3c32c2a374ce7c4d68f9c1a4b6c24?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- memory/generate.sc | 13 +- .../handle/MemoryHandle.generated.scala | 3086 ++++++++++++++++- .../memory/handle/MemoryPtr0.generated.scala | 2 +- .../memory/handle/MemoryPtr1.generated.scala | 2 +- .../memory/handle/MemoryPtr2.generated.scala | 2 +- .../memory/handle/MemoryPtr4.generated.scala | 2 +- .../memory/handle/MemoryPtr5.generated.scala | 2 +- .../memory/handle/MemoryPtr6.generated.scala | 2 +- .../memory/handle/MemoryPtr7.generated.scala | 2 +- .../memory/handle/MemoryPtr8.generated.scala | 2 +- .../memory/handle/MemoryPtr9.generated.scala | 2 +- 11 files changed, 2999 insertions(+), 118 deletions(-) diff --git a/memory/generate.sc b/memory/generate.sc index 4bef38f..22b9970 100644 --- a/memory/generate.sc +++ b/memory/generate.sc @@ -23,6 +23,12 @@ def setMethod( else s"def $name(mem: Memory[L, Global], value: $tpe ${ctArgs(i, argType)}): Unit" +def getMemorySegmentMethod(withRegion: Boolean)(argType: String)(name: String, i: Int, tpe: String): String = + if (withRegion) + s"def $name[R <: Global](mem: Memory[L, R] ${ctArgs(i, argType)}, size: Int)(implicit region: Region[R]): MemorySegment" + else + s"def $name(mem: Memory[L, Global] ${ctArgs(i, argType)}, size: Int): $tpe" + def generateOffsetCalculation(i: Int): String = { var result = "vh.offset0" for (j <- 1 to i) { @@ -50,9 +56,14 @@ def setMethodImpl(typ: String, i: Int): String = { s"mem.asJava.set(${typeLayout(typ)}, ${generateOffsetCalculation(i)}, value)" } +def getMemorySegmentMethodImpl(typ: String, i: Int): String = { + s"mem.asJava.asSlice(${generateOffsetCalculation(i)}, size * ${typeLayout(typ)}.byteSize())" +} + val methods = List( ("get", (getMethod(withRegion = true) _, getMethodImpl _)), ("set", (setMethod(withRegion = true) _, setMethodImpl _)), + ("getMemorySegment", (getMemorySegmentMethod(withRegion = true) _, getMemorySegmentMethodImpl _)) ) def ctParams(i: Int): String = @@ -125,7 +136,7 @@ def memoryHandle = import alien.memory.{Global, Layout, Memory, Region} import jdk.internal.vm.annotation.IntrinsicCandidate -import java.lang.foreign.ValueLayout +import java.lang.foreign.{MemorySegment, ValueLayout} object MemoryHandle { trait MemoryHandleSyntax { diff --git a/memory/src/main/scala/alien/memory/handle/MemoryHandle.generated.scala b/memory/src/main/scala/alien/memory/handle/MemoryHandle.generated.scala index ae455bd..d4679c6 100644 --- a/memory/src/main/scala/alien/memory/handle/MemoryHandle.generated.scala +++ b/memory/src/main/scala/alien/memory/handle/MemoryHandle.generated.scala @@ -3,7 +3,7 @@ package alien.memory.handle import alien.memory.{Global, Layout, Memory, Region} import jdk.internal.vm.annotation.IntrinsicCandidate -import java.lang.foreign.ValueLayout +import java.lang.foreign.{MemorySegment, ValueLayout} object MemoryHandle { @@ -269,6 +269,14 @@ object MemoryHandle { region: Region[R], ): Unit = mem.asJava.set(ValueLayout.JAVA_BYTE, vh.offset0, value) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global](mem: Memory[L, R], size: Int)( + implicit + region: Region[R], + ): MemorySegment = + mem.asJava.asSlice(vh.offset0, size * ValueLayout.JAVA_BYTE.byteSize()) + } implicit final class Byte1Ops[L <: Layout]( @@ -323,6 +331,32 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global](mem: Memory[L, R], x1: Long, size: Int)( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1, + size * ValueLayout.JAVA_BYTE.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global](mem: Memory[L, R], x1: Int, size: Int)( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1, + size * ValueLayout.JAVA_BYTE.byteSize(), + ) + } implicit final class Byte2Ops[L <: Layout]( @@ -383,6 +417,42 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh.offset2, + size * ValueLayout.JAVA_BYTE.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh.offset2, + size * ValueLayout.JAVA_BYTE.byteSize(), + ) + } implicit final class Byte3Ops[L <: Layout]( @@ -459,6 +529,46 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh + .offset1 + vh.step2 * x2 + vh.offset2 + vh.step3 * x3 + vh.offset3, + size * ValueLayout.JAVA_BYTE.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh + .offset1 + vh.step2 * x2 + vh.offset2 + vh.step3 * x3 + vh.offset3, + size * ValueLayout.JAVA_BYTE.byteSize(), + ) + } implicit final class Byte4Ops[L <: Layout]( @@ -543,6 +653,48 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh.offset4, + size * ValueLayout.JAVA_BYTE.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh.offset4, + size * ValueLayout.JAVA_BYTE.byteSize(), + ) + } implicit final class Byte5Ops[L <: Layout]( @@ -641,6 +793,52 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh + .step2 * x2 + vh.offset2 + vh.step3 * x3 + vh + .offset3 + vh.step4 * x4 + vh.offset4 + vh.step5 * x5 + vh.offset5, + size * ValueLayout.JAVA_BYTE.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh + .step2 * x2 + vh.offset2 + vh.step3 * x3 + vh + .offset3 + vh.step4 * x4 + vh.offset4 + vh.step5 * x5 + vh.offset5, + size * ValueLayout.JAVA_BYTE.byteSize(), + ) + } implicit final class Byte6Ops[L <: Layout]( @@ -743,6 +941,54 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + x6: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh + .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh.offset6, + size * ValueLayout.JAVA_BYTE.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + x6: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh + .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh.offset6, + size * ValueLayout.JAVA_BYTE.byteSize(), + ) + } implicit final class Byte7Ops[L <: Layout]( @@ -853,6 +1099,58 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + x6: Long, + x7: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh + .offset1 + vh.step2 * x2 + vh.offset2 + vh.step3 * x3 + vh + .offset3 + vh.step4 * x4 + vh.offset4 + vh.step5 * x5 + vh + .offset5 + vh.step6 * x6 + vh.offset6 + vh.step7 * x7 + vh.offset7, + size * ValueLayout.JAVA_BYTE.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + x6: Int, + x7: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh + .offset1 + vh.step2 * x2 + vh.offset2 + vh.step3 * x3 + vh + .offset3 + vh.step4 * x4 + vh.offset4 + vh.step5 * x5 + vh + .offset5 + vh.step6 * x6 + vh.offset6 + vh.step7 * x7 + vh.offset7, + size * ValueLayout.JAVA_BYTE.byteSize(), + ) + } implicit final class Byte8Ops[L <: Layout]( @@ -967,15 +1265,9 @@ object MemoryHandle { value, ) - } - - implicit final class Byte9Ops[L <: Layout]( - protected val vh: MemoryPtr9[L, Byte], - ) extends AnyVal { - @IntrinsicCandidate @inline - def get[R <: Global]( + def getMemorySegment[R <: Global]( mem: Memory[L, R], x1: Long, x2: Long, @@ -985,25 +1277,24 @@ object MemoryHandle { x6: Long, x7: Long, x8: Long, - x9: Long, + size: Int, )( implicit region: Region[R], - ): Byte = + ): MemorySegment = mem .asJava - .get( - ValueLayout.JAVA_BYTE, + .asSlice( vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh - .offset6 + vh.step7 * x7 + vh.offset7 + vh.step8 * x8 + vh - .offset8 + vh.step9 * x9 + vh.offset9, + .offset6 + vh.step7 * x7 + vh.offset7 + vh.step8 * x8 + vh.offset8, + size * ValueLayout.JAVA_BYTE.byteSize(), ) @IntrinsicCandidate @inline - def get[R <: Global]( + def getMemorySegment[R <: Global]( mem: Memory[L, R], x1: Int, x2: Int, @@ -1013,27 +1304,88 @@ object MemoryHandle { x6: Int, x7: Int, x8: Int, - x9: Int, + size: Int, )( implicit region: Region[R], - ): Byte = + ): MemorySegment = mem .asJava - .get( - ValueLayout.JAVA_BYTE, + .asSlice( vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh - .offset6 + vh.step7 * x7 + vh.offset7 + vh.step8 * x8 + vh - .offset8 + vh.step9 * x9 + vh.offset9, + .offset6 + vh.step7 * x7 + vh.offset7 + vh.step8 * x8 + vh.offset8, + size * ValueLayout.JAVA_BYTE.byteSize(), ) + } + + implicit final class Byte9Ops[L <: Layout]( + protected val vh: MemoryPtr9[L, Byte], + ) extends AnyVal { + @IntrinsicCandidate @inline - def set[R <: Global]( + def get[R <: Global]( mem: Memory[L, R], - value: Byte, + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + x6: Long, + x7: Long, + x8: Long, + x9: Long, + )( + implicit + region: Region[R], + ): Byte = + mem + .asJava + .get( + ValueLayout.JAVA_BYTE, + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh + .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh + .offset6 + vh.step7 * x7 + vh.offset7 + vh.step8 * x8 + vh + .offset8 + vh.step9 * x9 + vh.offset9, + ) + + @IntrinsicCandidate + @inline + def get[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + x6: Int, + x7: Int, + x8: Int, + x9: Int, + )( + implicit + region: Region[R], + ): Byte = + mem + .asJava + .get( + ValueLayout.JAVA_BYTE, + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh + .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh + .offset6 + vh.step7 * x7 + vh.offset7 + vh.step8 * x8 + vh + .offset8 + vh.step9 * x9 + vh.offset9, + ) + + @IntrinsicCandidate + @inline + def set[R <: Global]( + mem: Memory[L, R], + value: Byte, x1: Long, x2: Long, x3: Long, @@ -1089,6 +1441,64 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + x6: Long, + x7: Long, + x8: Long, + x9: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh + .step4 * x4 + vh.offset4 + vh.step5 * x5 + vh + .offset5 + vh.step6 * x6 + vh.offset6 + vh.step7 * x7 + vh + .offset7 + vh.step8 * x8 + vh.offset8 + vh.step9 * x9 + vh.offset9, + size * ValueLayout.JAVA_BYTE.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + x6: Int, + x7: Int, + x8: Int, + x9: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh + .step4 * x4 + vh.offset4 + vh.step5 * x5 + vh + .offset5 + vh.step6 * x6 + vh.offset6 + vh.step7 * x7 + vh + .offset7 + vh.step8 * x8 + vh.offset8 + vh.step9 * x9 + vh.offset9, + size * ValueLayout.JAVA_BYTE.byteSize(), + ) + } implicit final class Short0Ops[L <: Layout]( @@ -1109,6 +1519,14 @@ object MemoryHandle { region: Region[R], ): Unit = mem.asJava.set(ValueLayout.JAVA_SHORT, vh.offset0, value) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global](mem: Memory[L, R], size: Int)( + implicit + region: Region[R], + ): MemorySegment = + mem.asJava.asSlice(vh.offset0, size * ValueLayout.JAVA_SHORT.byteSize()) + } implicit final class Short1Ops[L <: Layout]( @@ -1163,6 +1581,32 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global](mem: Memory[L, R], x1: Long, size: Int)( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1, + size * ValueLayout.JAVA_SHORT.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global](mem: Memory[L, R], x1: Int, size: Int)( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1, + size * ValueLayout.JAVA_SHORT.byteSize(), + ) + } implicit final class Short2Ops[L <: Layout]( @@ -1223,6 +1667,42 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh.offset2, + size * ValueLayout.JAVA_SHORT.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh.offset2, + size * ValueLayout.JAVA_SHORT.byteSize(), + ) + } implicit final class Short3Ops[L <: Layout]( @@ -1299,6 +1779,46 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh + .offset1 + vh.step2 * x2 + vh.offset2 + vh.step3 * x3 + vh.offset3, + size * ValueLayout.JAVA_SHORT.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh + .offset1 + vh.step2 * x2 + vh.offset2 + vh.step3 * x3 + vh.offset3, + size * ValueLayout.JAVA_SHORT.byteSize(), + ) + } implicit final class Short4Ops[L <: Layout]( @@ -1383,6 +1903,48 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh.offset4, + size * ValueLayout.JAVA_SHORT.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh.offset4, + size * ValueLayout.JAVA_SHORT.byteSize(), + ) + } implicit final class Short5Ops[L <: Layout]( @@ -1481,6 +2043,52 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh + .step2 * x2 + vh.offset2 + vh.step3 * x3 + vh + .offset3 + vh.step4 * x4 + vh.offset4 + vh.step5 * x5 + vh.offset5, + size * ValueLayout.JAVA_SHORT.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh + .step2 * x2 + vh.offset2 + vh.step3 * x3 + vh + .offset3 + vh.step4 * x4 + vh.offset4 + vh.step5 * x5 + vh.offset5, + size * ValueLayout.JAVA_SHORT.byteSize(), + ) + } implicit final class Short6Ops[L <: Layout]( @@ -1583,6 +2191,54 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + x6: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh + .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh.offset6, + size * ValueLayout.JAVA_SHORT.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + x6: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh + .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh.offset6, + size * ValueLayout.JAVA_SHORT.byteSize(), + ) + } implicit final class Short7Ops[L <: Layout]( @@ -1693,6 +2349,58 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + x6: Long, + x7: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh + .offset1 + vh.step2 * x2 + vh.offset2 + vh.step3 * x3 + vh + .offset3 + vh.step4 * x4 + vh.offset4 + vh.step5 * x5 + vh + .offset5 + vh.step6 * x6 + vh.offset6 + vh.step7 * x7 + vh.offset7, + size * ValueLayout.JAVA_SHORT.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + x6: Int, + x7: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh + .offset1 + vh.step2 * x2 + vh.offset2 + vh.step3 * x3 + vh + .offset3 + vh.step4 * x4 + vh.offset4 + vh.step5 * x5 + vh + .offset5 + vh.step6 * x6 + vh.offset6 + vh.step7 * x7 + vh.offset7, + size * ValueLayout.JAVA_SHORT.byteSize(), + ) + } implicit final class Short8Ops[L <: Layout]( @@ -1743,19 +2451,74 @@ object MemoryHandle { ): Short = mem .asJava - .get( + .get( + ValueLayout.JAVA_SHORT, + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh + .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh + .offset6 + vh.step7 * x7 + vh.offset7 + vh.step8 * x8 + vh.offset8, + ) + + @IntrinsicCandidate + @inline + def set[R <: Global]( + mem: Memory[L, R], + value: Short, + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + x6: Long, + x7: Long, + x8: Long, + )( + implicit + region: Region[R], + ): Unit = + mem + .asJava + .set( + ValueLayout.JAVA_SHORT, + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh + .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh + .offset6 + vh.step7 * x7 + vh.offset7 + vh.step8 * x8 + vh.offset8, + value, + ) + + @IntrinsicCandidate + @inline + def set[R <: Global]( + mem: Memory[L, R], + value: Short, + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + x6: Int, + x7: Int, + x8: Int, + )( + implicit + region: Region[R], + ): Unit = + mem + .asJava + .set( ValueLayout.JAVA_SHORT, vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh .offset6 + vh.step7 * x7 + vh.offset7 + vh.step8 * x8 + vh.offset8, + value, ) @IntrinsicCandidate @inline - def set[R <: Global]( + def getMemorySegment[R <: Global]( mem: Memory[L, R], - value: Short, x1: Long, x2: Long, x3: Long, @@ -1764,26 +2527,25 @@ object MemoryHandle { x6: Long, x7: Long, x8: Long, + size: Int, )( implicit region: Region[R], - ): Unit = + ): MemorySegment = mem .asJava - .set( - ValueLayout.JAVA_SHORT, + .asSlice( vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh .offset6 + vh.step7 * x7 + vh.offset7 + vh.step8 * x8 + vh.offset8, - value, + size * ValueLayout.JAVA_SHORT.byteSize(), ) @IntrinsicCandidate @inline - def set[R <: Global]( + def getMemorySegment[R <: Global]( mem: Memory[L, R], - value: Short, x1: Int, x2: Int, x3: Int, @@ -1792,19 +2554,19 @@ object MemoryHandle { x6: Int, x7: Int, x8: Int, + size: Int, )( implicit region: Region[R], - ): Unit = + ): MemorySegment = mem .asJava - .set( - ValueLayout.JAVA_SHORT, + .asSlice( vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh .offset6 + vh.step7 * x7 + vh.offset7 + vh.step8 * x8 + vh.offset8, - value, + size * ValueLayout.JAVA_SHORT.byteSize(), ) } @@ -1929,6 +2691,64 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + x6: Long, + x7: Long, + x8: Long, + x9: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh + .step4 * x4 + vh.offset4 + vh.step5 * x5 + vh + .offset5 + vh.step6 * x6 + vh.offset6 + vh.step7 * x7 + vh + .offset7 + vh.step8 * x8 + vh.offset8 + vh.step9 * x9 + vh.offset9, + size * ValueLayout.JAVA_SHORT.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + x6: Int, + x7: Int, + x8: Int, + x9: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh + .step4 * x4 + vh.offset4 + vh.step5 * x5 + vh + .offset5 + vh.step6 * x6 + vh.offset6 + vh.step7 * x7 + vh + .offset7 + vh.step8 * x8 + vh.offset8 + vh.step9 * x9 + vh.offset9, + size * ValueLayout.JAVA_SHORT.byteSize(), + ) + } implicit final class Char0Ops[L <: Layout]( @@ -1949,6 +2769,14 @@ object MemoryHandle { region: Region[R], ): Unit = mem.asJava.set(ValueLayout.JAVA_CHAR, vh.offset0, value) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global](mem: Memory[L, R], size: Int)( + implicit + region: Region[R], + ): MemorySegment = + mem.asJava.asSlice(vh.offset0, size * ValueLayout.JAVA_CHAR.byteSize()) + } implicit final class Char1Ops[L <: Layout]( @@ -2003,6 +2831,32 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global](mem: Memory[L, R], x1: Long, size: Int)( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1, + size * ValueLayout.JAVA_CHAR.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global](mem: Memory[L, R], x1: Int, size: Int)( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1, + size * ValueLayout.JAVA_CHAR.byteSize(), + ) + } implicit final class Char2Ops[L <: Layout]( @@ -2063,6 +2917,42 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh.offset2, + size * ValueLayout.JAVA_CHAR.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh.offset2, + size * ValueLayout.JAVA_CHAR.byteSize(), + ) + } implicit final class Char3Ops[L <: Layout]( @@ -2139,6 +3029,46 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh + .offset1 + vh.step2 * x2 + vh.offset2 + vh.step3 * x3 + vh.offset3, + size * ValueLayout.JAVA_CHAR.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh + .offset1 + vh.step2 * x2 + vh.offset2 + vh.step3 * x3 + vh.offset3, + size * ValueLayout.JAVA_CHAR.byteSize(), + ) + } implicit final class Char4Ops[L <: Layout]( @@ -2223,6 +3153,48 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh.offset4, + size * ValueLayout.JAVA_CHAR.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh.offset4, + size * ValueLayout.JAVA_CHAR.byteSize(), + ) + } implicit final class Char5Ops[L <: Layout]( @@ -2321,6 +3293,52 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh + .step2 * x2 + vh.offset2 + vh.step3 * x3 + vh + .offset3 + vh.step4 * x4 + vh.offset4 + vh.step5 * x5 + vh.offset5, + size * ValueLayout.JAVA_CHAR.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh + .step2 * x2 + vh.offset2 + vh.step3 * x3 + vh + .offset3 + vh.step4 * x4 + vh.offset4 + vh.step5 * x5 + vh.offset5, + size * ValueLayout.JAVA_CHAR.byteSize(), + ) + } implicit final class Char6Ops[L <: Layout]( @@ -2387,40 +3405,88 @@ object MemoryHandle { )( implicit region: Region[R], - ): Unit = + ): Unit = + mem + .asJava + .set( + ValueLayout.JAVA_CHAR, + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh + .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh.offset6, + value, + ) + + @IntrinsicCandidate + @inline + def set[R <: Global]( + mem: Memory[L, R], + value: Char, + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + x6: Int, + )( + implicit + region: Region[R], + ): Unit = + mem + .asJava + .set( + ValueLayout.JAVA_CHAR, + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh + .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh.offset6, + value, + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + x6: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = mem .asJava - .set( - ValueLayout.JAVA_CHAR, + .asSlice( vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh.offset6, - value, + size * ValueLayout.JAVA_CHAR.byteSize(), ) @IntrinsicCandidate @inline - def set[R <: Global]( + def getMemorySegment[R <: Global]( mem: Memory[L, R], - value: Char, x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, + size: Int, )( implicit region: Region[R], - ): Unit = + ): MemorySegment = mem .asJava - .set( - ValueLayout.JAVA_CHAR, + .asSlice( vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh.offset6, - value, + size * ValueLayout.JAVA_CHAR.byteSize(), ) } @@ -2533,6 +3599,58 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + x6: Long, + x7: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh + .offset1 + vh.step2 * x2 + vh.offset2 + vh.step3 * x3 + vh + .offset3 + vh.step4 * x4 + vh.offset4 + vh.step5 * x5 + vh + .offset5 + vh.step6 * x6 + vh.offset6 + vh.step7 * x7 + vh.offset7, + size * ValueLayout.JAVA_CHAR.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + x6: Int, + x7: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh + .offset1 + vh.step2 * x2 + vh.offset2 + vh.step3 * x3 + vh + .offset3 + vh.step4 * x4 + vh.offset4 + vh.step5 * x5 + vh + .offset5 + vh.step6 * x6 + vh.offset6 + vh.step7 * x7 + vh.offset7, + size * ValueLayout.JAVA_CHAR.byteSize(), + ) + } implicit final class Char8Ops[L <: Layout]( @@ -2647,6 +3765,60 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + x6: Long, + x7: Long, + x8: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh + .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh + .offset6 + vh.step7 * x7 + vh.offset7 + vh.step8 * x8 + vh.offset8, + size * ValueLayout.JAVA_CHAR.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + x6: Int, + x7: Int, + x8: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh + .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh + .offset6 + vh.step7 * x7 + vh.offset7 + vh.step8 * x8 + vh.offset8, + size * ValueLayout.JAVA_CHAR.byteSize(), + ) + } implicit final class Char9Ops[L <: Layout]( @@ -2769,6 +3941,64 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + x6: Long, + x7: Long, + x8: Long, + x9: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh + .step4 * x4 + vh.offset4 + vh.step5 * x5 + vh + .offset5 + vh.step6 * x6 + vh.offset6 + vh.step7 * x7 + vh + .offset7 + vh.step8 * x8 + vh.offset8 + vh.step9 * x9 + vh.offset9, + size * ValueLayout.JAVA_CHAR.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + x6: Int, + x7: Int, + x8: Int, + x9: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh + .step4 * x4 + vh.offset4 + vh.step5 * x5 + vh + .offset5 + vh.step6 * x6 + vh.offset6 + vh.step7 * x7 + vh + .offset7 + vh.step8 * x8 + vh.offset8 + vh.step9 * x9 + vh.offset9, + size * ValueLayout.JAVA_CHAR.byteSize(), + ) + } implicit final class Int0Ops[L <: Layout]( @@ -2789,6 +4019,14 @@ object MemoryHandle { region: Region[R], ): Unit = mem.asJava.set(ValueLayout.JAVA_INT, vh.offset0, value) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global](mem: Memory[L, R], size: Int)( + implicit + region: Region[R], + ): MemorySegment = + mem.asJava.asSlice(vh.offset0, size * ValueLayout.JAVA_INT.byteSize()) + } implicit final class Int1Ops[L <: Layout]( @@ -2843,6 +4081,32 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global](mem: Memory[L, R], x1: Long, size: Int)( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1, + size * ValueLayout.JAVA_INT.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global](mem: Memory[L, R], x1: Int, size: Int)( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1, + size * ValueLayout.JAVA_INT.byteSize(), + ) + } implicit final class Int2Ops[L <: Layout]( @@ -2903,6 +4167,42 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh.offset2, + size * ValueLayout.JAVA_INT.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh.offset2, + size * ValueLayout.JAVA_INT.byteSize(), + ) + } implicit final class Int3Ops[L <: Layout]( @@ -2979,6 +4279,46 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh + .offset1 + vh.step2 * x2 + vh.offset2 + vh.step3 * x3 + vh.offset3, + size * ValueLayout.JAVA_INT.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh + .offset1 + vh.step2 * x2 + vh.offset2 + vh.step3 * x3 + vh.offset3, + size * ValueLayout.JAVA_INT.byteSize(), + ) + } implicit final class Int4Ops[L <: Layout]( @@ -3010,57 +4350,99 @@ object MemoryHandle { def get[R <: Global](mem: Memory[L, R], x1: Int, x2: Int, x3: Int, x4: Int)( implicit region: Region[R], - ): Int = + ): Int = + mem + .asJava + .get( + ValueLayout.JAVA_INT, + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh.offset4, + ) + + @IntrinsicCandidate + @inline + def set[R <: Global]( + mem: Memory[L, R], + value: Int, + x1: Long, + x2: Long, + x3: Long, + x4: Long, + )( + implicit + region: Region[R], + ): Unit = + mem + .asJava + .set( + ValueLayout.JAVA_INT, + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh.offset4, + value, + ) + + @IntrinsicCandidate + @inline + def set[R <: Global]( + mem: Memory[L, R], + value: Int, + x1: Int, + x2: Int, + x3: Int, + x4: Int, + )( + implicit + region: Region[R], + ): Unit = mem .asJava - .get( + .set( ValueLayout.JAVA_INT, vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh.offset4, + value, ) @IntrinsicCandidate @inline - def set[R <: Global]( + def getMemorySegment[R <: Global]( mem: Memory[L, R], - value: Int, x1: Long, x2: Long, x3: Long, x4: Long, + size: Int, )( implicit region: Region[R], - ): Unit = + ): MemorySegment = mem .asJava - .set( - ValueLayout.JAVA_INT, + .asSlice( vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh.offset4, - value, + size * ValueLayout.JAVA_INT.byteSize(), ) @IntrinsicCandidate @inline - def set[R <: Global]( + def getMemorySegment[R <: Global]( mem: Memory[L, R], - value: Int, x1: Int, x2: Int, x3: Int, x4: Int, + size: Int, )( implicit region: Region[R], - ): Unit = + ): MemorySegment = mem .asJava - .set( - ValueLayout.JAVA_INT, + .asSlice( vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh.offset4, - value, + size * ValueLayout.JAVA_INT.byteSize(), ) } @@ -3161,6 +4543,52 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh + .step2 * x2 + vh.offset2 + vh.step3 * x3 + vh + .offset3 + vh.step4 * x4 + vh.offset4 + vh.step5 * x5 + vh.offset5, + size * ValueLayout.JAVA_INT.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh + .step2 * x2 + vh.offset2 + vh.step3 * x3 + vh + .offset3 + vh.step4 * x4 + vh.offset4 + vh.step5 * x5 + vh.offset5, + size * ValueLayout.JAVA_INT.byteSize(), + ) + } implicit final class Int6Ops[L <: Layout]( @@ -3263,6 +4691,54 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + x6: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh + .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh.offset6, + size * ValueLayout.JAVA_INT.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + x6: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh + .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh.offset6, + size * ValueLayout.JAVA_INT.byteSize(), + ) + } implicit final class Int7Ops[L <: Layout]( @@ -3373,6 +4849,58 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + x6: Long, + x7: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh + .offset1 + vh.step2 * x2 + vh.offset2 + vh.step3 * x3 + vh + .offset3 + vh.step4 * x4 + vh.offset4 + vh.step5 * x5 + vh + .offset5 + vh.step6 * x6 + vh.offset6 + vh.step7 * x7 + vh.offset7, + size * ValueLayout.JAVA_INT.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + x6: Int, + x7: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh + .offset1 + vh.step2 * x2 + vh.offset2 + vh.step3 * x3 + vh + .offset3 + vh.step4 * x4 + vh.offset4 + vh.step5 * x5 + vh + .offset5 + vh.step6 * x6 + vh.offset6 + vh.step7 * x7 + vh.offset7, + size * ValueLayout.JAVA_INT.byteSize(), + ) + } implicit final class Int8Ops[L <: Layout]( @@ -3487,6 +5015,60 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + x6: Long, + x7: Long, + x8: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh + .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh + .offset6 + vh.step7 * x7 + vh.offset7 + vh.step8 * x8 + vh.offset8, + size * ValueLayout.JAVA_INT.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + x6: Int, + x7: Int, + x8: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh + .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh + .offset6 + vh.step7 * x7 + vh.offset7 + vh.step8 * x8 + vh.offset8, + size * ValueLayout.JAVA_INT.byteSize(), + ) + } implicit final class Int9Ops[L <: Layout]( @@ -3609,6 +5191,64 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + x6: Long, + x7: Long, + x8: Long, + x9: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh + .step4 * x4 + vh.offset4 + vh.step5 * x5 + vh + .offset5 + vh.step6 * x6 + vh.offset6 + vh.step7 * x7 + vh + .offset7 + vh.step8 * x8 + vh.offset8 + vh.step9 * x9 + vh.offset9, + size * ValueLayout.JAVA_INT.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + x6: Int, + x7: Int, + x8: Int, + x9: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh + .step4 * x4 + vh.offset4 + vh.step5 * x5 + vh + .offset5 + vh.step6 * x6 + vh.offset6 + vh.step7 * x7 + vh + .offset7 + vh.step8 * x8 + vh.offset8 + vh.step9 * x9 + vh.offset9, + size * ValueLayout.JAVA_INT.byteSize(), + ) + } implicit final class Long0Ops[L <: Layout]( @@ -3629,6 +5269,14 @@ object MemoryHandle { region: Region[R], ): Unit = mem.asJava.set(ValueLayout.JAVA_LONG, vh.offset0, value) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global](mem: Memory[L, R], size: Int)( + implicit + region: Region[R], + ): MemorySegment = + mem.asJava.asSlice(vh.offset0, size * ValueLayout.JAVA_LONG.byteSize()) + } implicit final class Long1Ops[L <: Layout]( @@ -3680,7 +5328,33 @@ object MemoryHandle { .set( ValueLayout.JAVA_LONG, vh.offset0 + vh.step1 * x1 + vh.offset1, - value, + value, + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global](mem: Memory[L, R], x1: Long, size: Int)( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1, + size * ValueLayout.JAVA_LONG.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global](mem: Memory[L, R], x1: Int, size: Int)( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1, + size * ValueLayout.JAVA_LONG.byteSize(), ) } @@ -3743,6 +5417,42 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh.offset2, + size * ValueLayout.JAVA_LONG.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh.offset2, + size * ValueLayout.JAVA_LONG.byteSize(), + ) + } implicit final class Long3Ops[L <: Layout]( @@ -3819,6 +5529,46 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh + .offset1 + vh.step2 * x2 + vh.offset2 + vh.step3 * x3 + vh.offset3, + size * ValueLayout.JAVA_LONG.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh + .offset1 + vh.step2 * x2 + vh.offset2 + vh.step3 * x3 + vh.offset3, + size * ValueLayout.JAVA_LONG.byteSize(), + ) + } implicit final class Long4Ops[L <: Layout]( @@ -3903,6 +5653,48 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh.offset4, + size * ValueLayout.JAVA_LONG.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh.offset4, + size * ValueLayout.JAVA_LONG.byteSize(), + ) + } implicit final class Long5Ops[L <: Layout]( @@ -4001,6 +5793,52 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh + .step2 * x2 + vh.offset2 + vh.step3 * x3 + vh + .offset3 + vh.step4 * x4 + vh.offset4 + vh.step5 * x5 + vh.offset5, + size * ValueLayout.JAVA_LONG.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh + .step2 * x2 + vh.offset2 + vh.step3 * x3 + vh + .offset3 + vh.step4 * x4 + vh.offset4 + vh.step5 * x5 + vh.offset5, + size * ValueLayout.JAVA_LONG.byteSize(), + ) + } implicit final class Long6Ops[L <: Layout]( @@ -4103,6 +5941,54 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + x6: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh + .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh.offset6, + size * ValueLayout.JAVA_LONG.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + x6: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh + .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh.offset6, + size * ValueLayout.JAVA_LONG.byteSize(), + ) + } implicit final class Long7Ops[L <: Layout]( @@ -4213,6 +6099,58 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + x6: Long, + x7: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh + .offset1 + vh.step2 * x2 + vh.offset2 + vh.step3 * x3 + vh + .offset3 + vh.step4 * x4 + vh.offset4 + vh.step5 * x5 + vh + .offset5 + vh.step6 * x6 + vh.offset6 + vh.step7 * x7 + vh.offset7, + size * ValueLayout.JAVA_LONG.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + x6: Int, + x7: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh + .offset1 + vh.step2 * x2 + vh.offset2 + vh.step3 * x3 + vh + .offset3 + vh.step4 * x4 + vh.offset4 + vh.step5 * x5 + vh + .offset5 + vh.step6 * x6 + vh.offset6 + vh.step7 * x7 + vh.offset7, + size * ValueLayout.JAVA_LONG.byteSize(), + ) + } implicit final class Long8Ops[L <: Layout]( @@ -4247,8 +6185,63 @@ object MemoryHandle { @IntrinsicCandidate @inline - def get[R <: Global]( + def get[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + x6: Int, + x7: Int, + x8: Int, + )( + implicit + region: Region[R], + ): Long = + mem + .asJava + .get( + ValueLayout.JAVA_LONG, + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh + .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh + .offset6 + vh.step7 * x7 + vh.offset7 + vh.step8 * x8 + vh.offset8, + ) + + @IntrinsicCandidate + @inline + def set[R <: Global]( + mem: Memory[L, R], + value: Long, + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + x6: Long, + x7: Long, + x8: Long, + )( + implicit + region: Region[R], + ): Unit = + mem + .asJava + .set( + ValueLayout.JAVA_LONG, + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh + .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh + .offset6 + vh.step7 * x7 + vh.offset7 + vh.step8 * x8 + vh.offset8, + value, + ) + + @IntrinsicCandidate + @inline + def set[R <: Global]( mem: Memory[L, R], + value: Long, x1: Int, x2: Int, x3: Int, @@ -4260,22 +6253,22 @@ object MemoryHandle { )( implicit region: Region[R], - ): Long = + ): Unit = mem .asJava - .get( + .set( ValueLayout.JAVA_LONG, vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh .offset6 + vh.step7 * x7 + vh.offset7 + vh.step8 * x8 + vh.offset8, + value, ) @IntrinsicCandidate @inline - def set[R <: Global]( + def getMemorySegment[R <: Global]( mem: Memory[L, R], - value: Long, x1: Long, x2: Long, x3: Long, @@ -4284,26 +6277,25 @@ object MemoryHandle { x6: Long, x7: Long, x8: Long, + size: Int, )( implicit region: Region[R], - ): Unit = + ): MemorySegment = mem .asJava - .set( - ValueLayout.JAVA_LONG, + .asSlice( vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh .offset6 + vh.step7 * x7 + vh.offset7 + vh.step8 * x8 + vh.offset8, - value, + size * ValueLayout.JAVA_LONG.byteSize(), ) @IntrinsicCandidate @inline - def set[R <: Global]( + def getMemorySegment[R <: Global]( mem: Memory[L, R], - value: Long, x1: Int, x2: Int, x3: Int, @@ -4312,19 +6304,19 @@ object MemoryHandle { x6: Int, x7: Int, x8: Int, + size: Int, )( implicit region: Region[R], - ): Unit = + ): MemorySegment = mem .asJava - .set( - ValueLayout.JAVA_LONG, + .asSlice( vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh .offset6 + vh.step7 * x7 + vh.offset7 + vh.step8 * x8 + vh.offset8, - value, + size * ValueLayout.JAVA_LONG.byteSize(), ) } @@ -4449,6 +6441,64 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + x6: Long, + x7: Long, + x8: Long, + x9: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh + .step4 * x4 + vh.offset4 + vh.step5 * x5 + vh + .offset5 + vh.step6 * x6 + vh.offset6 + vh.step7 * x7 + vh + .offset7 + vh.step8 * x8 + vh.offset8 + vh.step9 * x9 + vh.offset9, + size * ValueLayout.JAVA_LONG.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + x6: Int, + x7: Int, + x8: Int, + x9: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh + .step4 * x4 + vh.offset4 + vh.step5 * x5 + vh + .offset5 + vh.step6 * x6 + vh.offset6 + vh.step7 * x7 + vh + .offset7 + vh.step8 * x8 + vh.offset8 + vh.step9 * x9 + vh.offset9, + size * ValueLayout.JAVA_LONG.byteSize(), + ) + } implicit final class Float0Ops[L <: Layout]( @@ -4469,6 +6519,14 @@ object MemoryHandle { region: Region[R], ): Unit = mem.asJava.set(ValueLayout.JAVA_FLOAT, vh.offset0, value) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global](mem: Memory[L, R], size: Int)( + implicit + region: Region[R], + ): MemorySegment = + mem.asJava.asSlice(vh.offset0, size * ValueLayout.JAVA_FLOAT.byteSize()) + } implicit final class Float1Ops[L <: Layout]( @@ -4523,6 +6581,32 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global](mem: Memory[L, R], x1: Long, size: Int)( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1, + size * ValueLayout.JAVA_FLOAT.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global](mem: Memory[L, R], x1: Int, size: Int)( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1, + size * ValueLayout.JAVA_FLOAT.byteSize(), + ) + } implicit final class Float2Ops[L <: Layout]( @@ -4583,6 +6667,42 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh.offset2, + size * ValueLayout.JAVA_FLOAT.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh.offset2, + size * ValueLayout.JAVA_FLOAT.byteSize(), + ) + } implicit final class Float3Ops[L <: Layout]( @@ -4659,6 +6779,46 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh + .offset1 + vh.step2 * x2 + vh.offset2 + vh.step3 * x3 + vh.offset3, + size * ValueLayout.JAVA_FLOAT.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh + .offset1 + vh.step2 * x2 + vh.offset2 + vh.step3 * x3 + vh.offset3, + size * ValueLayout.JAVA_FLOAT.byteSize(), + ) + } implicit final class Float4Ops[L <: Layout]( @@ -4743,6 +6903,48 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh.offset4, + size * ValueLayout.JAVA_FLOAT.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh.offset4, + size * ValueLayout.JAVA_FLOAT.byteSize(), + ) + } implicit final class Float5Ops[L <: Layout]( @@ -4841,6 +7043,52 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh + .step2 * x2 + vh.offset2 + vh.step3 * x3 + vh + .offset3 + vh.step4 * x4 + vh.offset4 + vh.step5 * x5 + vh.offset5, + size * ValueLayout.JAVA_FLOAT.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh + .step2 * x2 + vh.offset2 + vh.step3 * x3 + vh + .offset3 + vh.step4 * x4 + vh.offset4 + vh.step5 * x5 + vh.offset5, + size * ValueLayout.JAVA_FLOAT.byteSize(), + ) + } implicit final class Float6Ops[L <: Layout]( @@ -4849,8 +7097,55 @@ object MemoryHandle { @IntrinsicCandidate @inline - def get[R <: Global]( + def get[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + x6: Long, + )( + implicit + region: Region[R], + ): Float = + mem + .asJava + .get( + ValueLayout.JAVA_FLOAT, + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh + .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh.offset6, + ) + + @IntrinsicCandidate + @inline + def get[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + x6: Int, + )( + implicit + region: Region[R], + ): Float = + mem + .asJava + .get( + ValueLayout.JAVA_FLOAT, + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh + .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh.offset6, + ) + + @IntrinsicCandidate + @inline + def set[R <: Global]( mem: Memory[L, R], + value: Float, x1: Long, x2: Long, x3: Long, @@ -4860,20 +7155,22 @@ object MemoryHandle { )( implicit region: Region[R], - ): Float = + ): Unit = mem .asJava - .get( + .set( ValueLayout.JAVA_FLOAT, vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh.offset6, + value, ) @IntrinsicCandidate @inline - def get[R <: Global]( + def set[R <: Global]( mem: Memory[L, R], + value: Float, x1: Int, x2: Int, x3: Int, @@ -4883,64 +7180,63 @@ object MemoryHandle { )( implicit region: Region[R], - ): Float = + ): Unit = mem .asJava - .get( + .set( ValueLayout.JAVA_FLOAT, vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh.offset6, + value, ) @IntrinsicCandidate @inline - def set[R <: Global]( + def getMemorySegment[R <: Global]( mem: Memory[L, R], - value: Float, x1: Long, x2: Long, x3: Long, x4: Long, x5: Long, x6: Long, + size: Int, )( implicit region: Region[R], - ): Unit = + ): MemorySegment = mem .asJava - .set( - ValueLayout.JAVA_FLOAT, + .asSlice( vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh.offset6, - value, + size * ValueLayout.JAVA_FLOAT.byteSize(), ) @IntrinsicCandidate @inline - def set[R <: Global]( + def getMemorySegment[R <: Global]( mem: Memory[L, R], - value: Float, x1: Int, x2: Int, x3: Int, x4: Int, x5: Int, x6: Int, + size: Int, )( implicit region: Region[R], - ): Unit = + ): MemorySegment = mem .asJava - .set( - ValueLayout.JAVA_FLOAT, + .asSlice( vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh.offset6, - value, + size * ValueLayout.JAVA_FLOAT.byteSize(), ) } @@ -5053,6 +7349,58 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + x6: Long, + x7: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh + .offset1 + vh.step2 * x2 + vh.offset2 + vh.step3 * x3 + vh + .offset3 + vh.step4 * x4 + vh.offset4 + vh.step5 * x5 + vh + .offset5 + vh.step6 * x6 + vh.offset6 + vh.step7 * x7 + vh.offset7, + size * ValueLayout.JAVA_FLOAT.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + x6: Int, + x7: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh + .offset1 + vh.step2 * x2 + vh.offset2 + vh.step3 * x3 + vh + .offset3 + vh.step4 * x4 + vh.offset4 + vh.step5 * x5 + vh + .offset5 + vh.step6 * x6 + vh.offset6 + vh.step7 * x7 + vh.offset7, + size * ValueLayout.JAVA_FLOAT.byteSize(), + ) + } implicit final class Float8Ops[L <: Layout]( @@ -5167,6 +7515,60 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + x6: Long, + x7: Long, + x8: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh + .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh + .offset6 + vh.step7 * x7 + vh.offset7 + vh.step8 * x8 + vh.offset8, + size * ValueLayout.JAVA_FLOAT.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + x6: Int, + x7: Int, + x8: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh + .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh + .offset6 + vh.step7 * x7 + vh.offset7 + vh.step8 * x8 + vh.offset8, + size * ValueLayout.JAVA_FLOAT.byteSize(), + ) + } implicit final class Float9Ops[L <: Layout]( @@ -5289,6 +7691,64 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + x6: Long, + x7: Long, + x8: Long, + x9: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh + .step4 * x4 + vh.offset4 + vh.step5 * x5 + vh + .offset5 + vh.step6 * x6 + vh.offset6 + vh.step7 * x7 + vh + .offset7 + vh.step8 * x8 + vh.offset8 + vh.step9 * x9 + vh.offset9, + size * ValueLayout.JAVA_FLOAT.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + x6: Int, + x7: Int, + x8: Int, + x9: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh + .step4 * x4 + vh.offset4 + vh.step5 * x5 + vh + .offset5 + vh.step6 * x6 + vh.offset6 + vh.step7 * x7 + vh + .offset7 + vh.step8 * x8 + vh.offset8 + vh.step9 * x9 + vh.offset9, + size * ValueLayout.JAVA_FLOAT.byteSize(), + ) + } implicit final class Double0Ops[L <: Layout]( @@ -5309,6 +7769,14 @@ object MemoryHandle { region: Region[R], ): Unit = mem.asJava.set(ValueLayout.JAVA_DOUBLE, vh.offset0, value) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global](mem: Memory[L, R], size: Int)( + implicit + region: Region[R], + ): MemorySegment = + mem.asJava.asSlice(vh.offset0, size * ValueLayout.JAVA_DOUBLE.byteSize()) + } implicit final class Double1Ops[L <: Layout]( @@ -5363,6 +7831,32 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global](mem: Memory[L, R], x1: Long, size: Int)( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1, + size * ValueLayout.JAVA_DOUBLE.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global](mem: Memory[L, R], x1: Int, size: Int)( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1, + size * ValueLayout.JAVA_DOUBLE.byteSize(), + ) + } implicit final class Double2Ops[L <: Layout]( @@ -5423,6 +7917,42 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh.offset2, + size * ValueLayout.JAVA_DOUBLE.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh.offset2, + size * ValueLayout.JAVA_DOUBLE.byteSize(), + ) + } implicit final class Double3Ops[L <: Layout]( @@ -5468,35 +7998,75 @@ object MemoryHandle { )( implicit region: Region[R], - ): Unit = + ): Unit = + mem + .asJava + .set( + ValueLayout.JAVA_DOUBLE, + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh + .step2 * x2 + vh.offset2 + vh.step3 * x3 + vh.offset3, + value, + ) + + @IntrinsicCandidate + @inline + def set[R <: Global]( + mem: Memory[L, R], + value: Double, + x1: Int, + x2: Int, + x3: Int, + )( + implicit + region: Region[R], + ): Unit = + mem + .asJava + .set( + ValueLayout.JAVA_DOUBLE, + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh + .step2 * x2 + vh.offset2 + vh.step3 * x3 + vh.offset3, + value, + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = mem .asJava - .set( - ValueLayout.JAVA_DOUBLE, - vh.offset0 + vh.step1 * x1 + vh.offset1 + vh - .step2 * x2 + vh.offset2 + vh.step3 * x3 + vh.offset3, - value, + .asSlice( + vh.offset0 + vh.step1 * x1 + vh + .offset1 + vh.step2 * x2 + vh.offset2 + vh.step3 * x3 + vh.offset3, + size * ValueLayout.JAVA_DOUBLE.byteSize(), ) @IntrinsicCandidate @inline - def set[R <: Global]( + def getMemorySegment[R <: Global]( mem: Memory[L, R], - value: Double, x1: Int, x2: Int, x3: Int, + size: Int, )( implicit region: Region[R], - ): Unit = + ): MemorySegment = mem .asJava - .set( - ValueLayout.JAVA_DOUBLE, - vh.offset0 + vh.step1 * x1 + vh.offset1 + vh - .step2 * x2 + vh.offset2 + vh.step3 * x3 + vh.offset3, - value, + .asSlice( + vh.offset0 + vh.step1 * x1 + vh + .offset1 + vh.step2 * x2 + vh.offset2 + vh.step3 * x3 + vh.offset3, + size * ValueLayout.JAVA_DOUBLE.byteSize(), ) } @@ -5583,6 +8153,48 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh.offset4, + size * ValueLayout.JAVA_DOUBLE.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh.offset4, + size * ValueLayout.JAVA_DOUBLE.byteSize(), + ) + } implicit final class Double5Ops[L <: Layout]( @@ -5681,6 +8293,52 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh + .step2 * x2 + vh.offset2 + vh.step3 * x3 + vh + .offset3 + vh.step4 * x4 + vh.offset4 + vh.step5 * x5 + vh.offset5, + size * ValueLayout.JAVA_DOUBLE.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh + .step2 * x2 + vh.offset2 + vh.step3 * x3 + vh + .offset3 + vh.step4 * x4 + vh.offset4 + vh.step5 * x5 + vh.offset5, + size * ValueLayout.JAVA_DOUBLE.byteSize(), + ) + } implicit final class Double6Ops[L <: Layout]( @@ -5783,6 +8441,54 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + x6: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh + .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh.offset6, + size * ValueLayout.JAVA_DOUBLE.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + x6: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh + .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh.offset6, + size * ValueLayout.JAVA_DOUBLE.byteSize(), + ) + } implicit final class Double7Ops[L <: Layout]( @@ -5893,6 +8599,58 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + x6: Long, + x7: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh + .offset1 + vh.step2 * x2 + vh.offset2 + vh.step3 * x3 + vh + .offset3 + vh.step4 * x4 + vh.offset4 + vh.step5 * x5 + vh + .offset5 + vh.step6 * x6 + vh.offset6 + vh.step7 * x7 + vh.offset7, + size * ValueLayout.JAVA_DOUBLE.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + x6: Int, + x7: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh + .offset1 + vh.step2 * x2 + vh.offset2 + vh.step3 * x3 + vh + .offset3 + vh.step4 * x4 + vh.offset4 + vh.step5 * x5 + vh + .offset5 + vh.step6 * x6 + vh.offset6 + vh.step7 * x7 + vh.offset7, + size * ValueLayout.JAVA_DOUBLE.byteSize(), + ) + } implicit final class Double8Ops[L <: Layout]( @@ -6007,6 +8765,60 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + x6: Long, + x7: Long, + x8: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh + .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh + .offset6 + vh.step7 * x7 + vh.offset7 + vh.step8 * x8 + vh.offset8, + size * ValueLayout.JAVA_DOUBLE.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + x6: Int, + x7: Int, + x8: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh.step4 * x4 + vh + .offset4 + vh.step5 * x5 + vh.offset5 + vh.step6 * x6 + vh + .offset6 + vh.step7 * x7 + vh.offset7 + vh.step8 * x8 + vh.offset8, + size * ValueLayout.JAVA_DOUBLE.byteSize(), + ) + } implicit final class Double9Ops[L <: Layout]( @@ -6129,6 +8941,64 @@ object MemoryHandle { value, ) + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Long, + x2: Long, + x3: Long, + x4: Long, + x5: Long, + x6: Long, + x7: Long, + x8: Long, + x9: Long, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh + .step4 * x4 + vh.offset4 + vh.step5 * x5 + vh + .offset5 + vh.step6 * x6 + vh.offset6 + vh.step7 * x7 + vh + .offset7 + vh.step8 * x8 + vh.offset8 + vh.step9 * x9 + vh.offset9, + size * ValueLayout.JAVA_DOUBLE.byteSize(), + ) + + @IntrinsicCandidate + @inline + def getMemorySegment[R <: Global]( + mem: Memory[L, R], + x1: Int, + x2: Int, + x3: Int, + x4: Int, + x5: Int, + x6: Int, + x7: Int, + x8: Int, + x9: Int, + size: Int, + )( + implicit + region: Region[R], + ): MemorySegment = + mem + .asJava + .asSlice( + vh.offset0 + vh.step1 * x1 + vh.offset1 + vh.step2 * x2 + vh + .offset2 + vh.step3 * x3 + vh.offset3 + vh + .step4 * x4 + vh.offset4 + vh.step5 * x5 + vh + .offset5 + vh.step6 * x6 + vh.offset6 + vh.step7 * x7 + vh + .offset7 + vh.step8 * x8 + vh.offset8 + vh.step9 * x9 + vh.offset9, + size * ValueLayout.JAVA_DOUBLE.byteSize(), + ) + } } diff --git a/memory/src/main/scala/alien/memory/handle/MemoryPtr0.generated.scala b/memory/src/main/scala/alien/memory/handle/MemoryPtr0.generated.scala index 30e0a8e..6dc5100 100644 --- a/memory/src/main/scala/alien/memory/handle/MemoryPtr0.generated.scala +++ b/memory/src/main/scala/alien/memory/handle/MemoryPtr0.generated.scala @@ -4,6 +4,6 @@ import alien.memory.* import scala.Specializable.AllNumeric -case class MemoryPtr0[L <: Layout, @specialized(AllNumeric) T]( +case class MemoryPtr0[L <: Layout, @specialized(AllNumeric) T] private[alien] ( private[alien] val offset0: Long, ) diff --git a/memory/src/main/scala/alien/memory/handle/MemoryPtr1.generated.scala b/memory/src/main/scala/alien/memory/handle/MemoryPtr1.generated.scala index c0989dc..4e7106a 100644 --- a/memory/src/main/scala/alien/memory/handle/MemoryPtr1.generated.scala +++ b/memory/src/main/scala/alien/memory/handle/MemoryPtr1.generated.scala @@ -4,7 +4,7 @@ import alien.memory.* import scala.Specializable.AllNumeric -case class MemoryPtr1[L <: Layout, @specialized(AllNumeric) T]( +case class MemoryPtr1[L <: Layout, @specialized(AllNumeric) T] private[alien] ( private[alien] val offset0: Long, private[alien] val step1: Long, private[alien] val offset1: Long, diff --git a/memory/src/main/scala/alien/memory/handle/MemoryPtr2.generated.scala b/memory/src/main/scala/alien/memory/handle/MemoryPtr2.generated.scala index 6336adb..718f958 100644 --- a/memory/src/main/scala/alien/memory/handle/MemoryPtr2.generated.scala +++ b/memory/src/main/scala/alien/memory/handle/MemoryPtr2.generated.scala @@ -4,7 +4,7 @@ import alien.memory.* import scala.Specializable.AllNumeric -case class MemoryPtr2[L <: Layout, @specialized(AllNumeric) T]( +case class MemoryPtr2[L <: Layout, @specialized(AllNumeric) T] private[alien] ( private[alien] val offset0: Long, private[alien] val step1: Long, private[alien] val offset1: Long, diff --git a/memory/src/main/scala/alien/memory/handle/MemoryPtr4.generated.scala b/memory/src/main/scala/alien/memory/handle/MemoryPtr4.generated.scala index 26ae0ab..45c0f4a 100644 --- a/memory/src/main/scala/alien/memory/handle/MemoryPtr4.generated.scala +++ b/memory/src/main/scala/alien/memory/handle/MemoryPtr4.generated.scala @@ -4,7 +4,7 @@ import alien.memory.* import scala.Specializable.AllNumeric -case class MemoryPtr4[L <: Layout, @specialized(AllNumeric) T]( +case class MemoryPtr4[L <: Layout, @specialized(AllNumeric) T] private[alien] ( private[alien] val offset0: Long, private[alien] val step1: Long, private[alien] val offset1: Long, diff --git a/memory/src/main/scala/alien/memory/handle/MemoryPtr5.generated.scala b/memory/src/main/scala/alien/memory/handle/MemoryPtr5.generated.scala index 1b6b3c0..4501d1c 100644 --- a/memory/src/main/scala/alien/memory/handle/MemoryPtr5.generated.scala +++ b/memory/src/main/scala/alien/memory/handle/MemoryPtr5.generated.scala @@ -4,7 +4,7 @@ import alien.memory.* import scala.Specializable.AllNumeric -case class MemoryPtr5[L <: Layout, @specialized(AllNumeric) T]( +case class MemoryPtr5[L <: Layout, @specialized(AllNumeric) T] private[alien] ( private[alien] val offset0: Long, private[alien] val step1: Long, private[alien] val offset1: Long, diff --git a/memory/src/main/scala/alien/memory/handle/MemoryPtr6.generated.scala b/memory/src/main/scala/alien/memory/handle/MemoryPtr6.generated.scala index be8973e..198ac1a 100644 --- a/memory/src/main/scala/alien/memory/handle/MemoryPtr6.generated.scala +++ b/memory/src/main/scala/alien/memory/handle/MemoryPtr6.generated.scala @@ -4,7 +4,7 @@ import alien.memory.* import scala.Specializable.AllNumeric -case class MemoryPtr6[L <: Layout, @specialized(AllNumeric) T]( +case class MemoryPtr6[L <: Layout, @specialized(AllNumeric) T] private[alien] ( private[alien] val offset0: Long, private[alien] val step1: Long, private[alien] val offset1: Long, diff --git a/memory/src/main/scala/alien/memory/handle/MemoryPtr7.generated.scala b/memory/src/main/scala/alien/memory/handle/MemoryPtr7.generated.scala index 9181031..550eedf 100644 --- a/memory/src/main/scala/alien/memory/handle/MemoryPtr7.generated.scala +++ b/memory/src/main/scala/alien/memory/handle/MemoryPtr7.generated.scala @@ -4,7 +4,7 @@ import alien.memory.* import scala.Specializable.AllNumeric -case class MemoryPtr7[L <: Layout, @specialized(AllNumeric) T]( +case class MemoryPtr7[L <: Layout, @specialized(AllNumeric) T] private[alien] ( private[alien] val offset0: Long, private[alien] val step1: Long, private[alien] val offset1: Long, diff --git a/memory/src/main/scala/alien/memory/handle/MemoryPtr8.generated.scala b/memory/src/main/scala/alien/memory/handle/MemoryPtr8.generated.scala index 03d4b82..d6dba4f 100644 --- a/memory/src/main/scala/alien/memory/handle/MemoryPtr8.generated.scala +++ b/memory/src/main/scala/alien/memory/handle/MemoryPtr8.generated.scala @@ -4,7 +4,7 @@ import alien.memory.* import scala.Specializable.AllNumeric -case class MemoryPtr8[L <: Layout, @specialized(AllNumeric) T]( +case class MemoryPtr8[L <: Layout, @specialized(AllNumeric) T] private[alien] ( private[alien] val offset0: Long, private[alien] val step1: Long, private[alien] val offset1: Long, diff --git a/memory/src/main/scala/alien/memory/handle/MemoryPtr9.generated.scala b/memory/src/main/scala/alien/memory/handle/MemoryPtr9.generated.scala index 5ac3ef8..ba0dc56 100644 --- a/memory/src/main/scala/alien/memory/handle/MemoryPtr9.generated.scala +++ b/memory/src/main/scala/alien/memory/handle/MemoryPtr9.generated.scala @@ -4,7 +4,7 @@ import alien.memory.* import scala.Specializable.AllNumeric -case class MemoryPtr9[L <: Layout, @specialized(AllNumeric) T]( +case class MemoryPtr9[L <: Layout, @specialized(AllNumeric) T] private[alien] ( private[alien] val offset0: Long, private[alien] val step1: Long, private[alien] val offset1: Long,