diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 2376488..029ec75 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -19,7 +19,7 @@ jobs: strategy: matrix: java: [ - 22 + 23-ea ] os: [ ubuntu-latest, windows-latest ] runs-on: ${{ matrix.os }} @@ -30,7 +30,6 @@ jobs: with: java-version: | ${{ matrix.java }} - 21 distribution: 'temurin' - name: Grant execute permission for gradlew if: ${{ runner.os != 'Windows' }} @@ -40,16 +39,14 @@ jobs: - name: Execute Gradle build run: ./gradlew build - name: Upload build reports - if: ${{ runner.os == 'Linux' && matrix.java == '22' }} uses: actions/upload-artifact@v4 with: - name: build-reports + name: build-reports-${{ runner.os }}-jdk${{ matrix.java }} path: | build/reports/ - name: Capture build artifacts - if: ${{ runner.os == 'Linux' && matrix.java == '22' }} uses: actions/upload-artifact@v4 with: - name: Artifacts + name: artifacts-${{ runner.os }}-jdk${{ matrix.java }} path: | build/libs/ diff --git a/README.md b/README.md index 0cfd04a..c54a540 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Marshal allows you to conveniently create native library bindings with [FFM API] ~~See [wiki](https://github.com/Over-Run/marshal/wiki) for more information.~~ -This library requires JDK 22 or newer. +This library requires JDK 23 or newer. ## Overview @@ -95,7 +95,7 @@ Import as a Gradle dependency: ```groovy dependencies { - implementation("io.github.over-run:marshal:0.1.0-alpha.28-jdk22") + implementation("io.github.over-run:marshal:0.1.0-alpha.29-jdk23") } ``` diff --git a/gradle.properties b/gradle.properties index 5e7118c..d8f0af0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ projGroupId=io.github.over-run projArtifactId=marshal # The project name should only contain lowercase letters, numbers and hyphen. projName=marshal -projVersion=0.1.0-alpha.28-jdk22 +projVersion=0.1.0-alpha.29-jdk23 projDesc=Marshaler of native libraries # Uncomment them if you want to publish to maven repository. projUrl=https://github.com/Over-Run/marshal @@ -27,9 +27,9 @@ orgName=Overrun Organization orgUrl=https://over-run.github.io/ # JDK Options -jdkVersion=22 +jdkVersion=23 jdkEnablePreview=true # javadoc link of JDK early access build # https://download.java.net/java/early_access/$jdkEarlyAccessDoc/docs/api/ # Uncomment it if you need to use EA build of JDK. -#jdkEarlyAccessDoc=jdk22 +jdkEarlyAccessDoc=jdk23 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 2c35211..a4b76b9 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 09523c0..9355b41 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/java/overrun/marshal/Downcall.java b/src/main/java/overrun/marshal/Downcall.java index a366f19..ef20d40 100644 --- a/src/main/java/overrun/marshal/Downcall.java +++ b/src/main/java/overrun/marshal/Downcall.java @@ -161,7 +161,7 @@ private static void invokeSuperMethod(CodeBuilder codeBuilder, List p codeBuilder.aload(codeBuilder.receiverSlot()); for (int i = 0, size = parameters.size(); i < size; i++) { final var parameter = parameters.get(i); - codeBuilder.loadInstruction( + codeBuilder.loadLocal( TypeKind.fromDescriptor(parameter.getType().descriptorString()) .asLoadable(), codeBuilder.parameterSlot(i)); @@ -394,7 +394,7 @@ private static T loadBytecode(MethodHandles.Lookup caller, SymbolLookup look methodName, mtd_method, targetClass.isInterface() - ).returnInstruction(returnTypeKind); + ).return_(returnTypeKind); } else { //region body final boolean hasAllocator = @@ -520,7 +520,7 @@ private static T loadBytecode(MethodHandles.Lookup caller, SymbolLookup look } else { final TypeKind typeKind = TypeKind.from(cd_returnTypeDowncall); resultSlot = blockCodeBuilder.allocateLocal(typeKind); - blockCodeBuilder.storeInstruction(typeKind, resultSlot); + blockCodeBuilder.storeLocal(typeKind, resultSlot); } // copy ref result @@ -566,7 +566,7 @@ private static T loadBytecode(MethodHandles.Lookup caller, SymbolLookup look } else { unmarshalSlot = -1; } - blockCodeBuilder.loadInstruction(TypeKind.from(cd_returnTypeDowncall), resultSlot); + blockCodeBuilder.loadLocal(TypeKind.from(cd_returnTypeDowncall), resultSlot); } final Convert convert = method.getDeclaredAnnotation(Convert.class); if (convert != null && returnType == boolean.class) { @@ -612,18 +612,18 @@ private static T loadBytecode(MethodHandles.Lookup caller, SymbolLookup look // reset stack if (shouldAddStack) { if (!returnVoid) { - blockCodeBuilder.storeInstruction(returnTypeKind, unmarshalSlot); + blockCodeBuilder.storeLocal(returnTypeKind, unmarshalSlot); } blockCodeBuilder.aload(stackSlot) .lload(stackPointerSlot) .invokevirtual(CD_MemoryStack, "setPointer", MTD_void_long); if (!returnVoid) { - blockCodeBuilder.loadInstruction(returnTypeKind, unmarshalSlot); + blockCodeBuilder.loadLocal(returnTypeKind, unmarshalSlot); } } // return - blockCodeBuilder.returnInstruction(returnTypeKind); + blockCodeBuilder.return_(returnTypeKind); }, catchBuilder -> catchBuilder.catching(CD_Throwable, blockCodeBuilder -> { final int slot = blockCodeBuilder.allocateLocal(TypeKind.ReferenceType); diff --git a/src/main/java/overrun/marshal/gen/processor/ArgumentProcessor.java b/src/main/java/overrun/marshal/gen/processor/ArgumentProcessor.java index 8278a39..2197a4f 100644 --- a/src/main/java/overrun/marshal/gen/processor/ArgumentProcessor.java +++ b/src/main/java/overrun/marshal/gen/processor/ArgumentProcessor.java @@ -47,14 +47,14 @@ public boolean process(CodeBuilder builder, ProcessorType type, ArgumentProcesso if (value == ProcessorType.Value.BOOLEAN && context.convert() != null) { final Type convertType = context.convert().value(); - builder.loadInstruction( + builder.loadLocal( value.typeKind(), context.parameterSlot() ).invokestatic(CD_Marshal, marshalFromBooleanMethod(convertType), MethodTypeDesc.of(convertType.classDesc(), CD_boolean)); } else { - builder.loadInstruction( + builder.loadLocal( value.typeKind().asLoadable(), context.parameterSlot() ); diff --git a/src/main/java/overrun/marshal/struct/StructAllocator.java b/src/main/java/overrun/marshal/struct/StructAllocator.java index 14a60b6..0e1b31b 100644 --- a/src/main/java/overrun/marshal/struct/StructAllocator.java +++ b/src/main/java/overrun/marshal/struct/StructAllocator.java @@ -284,7 +284,7 @@ private static byte[] buildBytecode(MethodHandles.Lookup lookup, StructLayout la list.add(CD_long); list.addAll(getterParams); }))) - .returnInstruction(returnKind); + .return_(returnKind); }); // setter @@ -302,7 +302,7 @@ private static byte[] buildBytecode(MethodHandles.Lookup lookup, StructLayout la for (int i = 0; i < indexCount; i++) { codeBuilder.lload(codeBuilder.parameterSlot(i)); } - codeBuilder.loadInstruction(returnKind, codeBuilder.parameterSlot(indexCount)) + codeBuilder.loadLocal(returnKind, codeBuilder.parameterSlot(indexCount)) .invokevirtual(CD_VarHandle, "set", MethodTypeDesc.of(CD_void, makeClassDescriptors(list -> { list.add(CD_MemorySegment); list.add(CD_long); @@ -329,7 +329,7 @@ private static byte[] buildBytecode(MethodHandles.Lookup lookup, StructLayout la .getfield(cd_thisClass, "_segment", CD_MemorySegment) .lconst_0() .invokevirtual(CD_VarHandle, "get", MethodTypeDesc.of(returnDesc, CD_MemorySegment, CD_long)) - .returnInstruction(returnKind)); + .return_(returnKind)); // setter classBuilder.withMethodBody(name, MethodTypeDesc.of(cd_caller, returnDesc), Modifier.PUBLIC, codeBuilder -> { @@ -337,7 +337,7 @@ private static byte[] buildBytecode(MethodHandles.Lookup lookup, StructLayout la .aload(codeBuilder.receiverSlot()) .getfield(cd_thisClass, "_segment", CD_MemorySegment) .lconst_0() - .loadInstruction(returnKind, codeBuilder.parameterSlot(0)) + .loadLocal(returnKind, codeBuilder.parameterSlot(0)) .invokevirtual(CD_VarHandle, "set", MethodTypeDesc.of(CD_void, CD_MemorySegment, CD_long, returnDesc)); codeBuilder.aload(codeBuilder.receiverSlot()) .areturn();