Skip to content

Commit

Permalink
JDK21 Updates for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
admin authored and admin committed Sep 22, 2023
1 parent 41230e8 commit 9326123
Show file tree
Hide file tree
Showing 398 changed files with 18,527 additions and 15,703 deletions.
3 changes: 3 additions & 0 deletions LibRawFX/nbactions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
<properties>
<exec.args>-classpath %classpath org.librawfx.TestApp</exec.args>
<exec.executable>java</exec.executable>
<exec.vmArgs>--enable-preview</exec.vmArgs>


</properties>
</action>
<action>
Expand Down
590 changes: 295 additions & 295 deletions LibRawFX/pom.xml

Large diffs are not rendered by default.

25 changes: 0 additions & 25 deletions LibRawFX/src/main/java/org/libraw/linuxosx/Constants$root.java

This file was deleted.

19 changes: 13 additions & 6 deletions LibRawFX/src/main/java/org/libraw/linuxosx/RuntimeHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.lang.foreign.SymbolLookup;
import java.lang.foreign.MemoryLayout;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.Arena;
import java.lang.foreign.SegmentAllocator;
import java.lang.foreign.ValueLayout;
import java.lang.invoke.MethodHandle;
Expand All @@ -19,6 +20,9 @@
import java.util.Optional;
import java.util.stream.Stream;

import java.lang.foreign.AddressLayout;
import java.lang.foreign.MemoryLayout;

import static java.lang.foreign.Linker.*;
import static java.lang.foreign.ValueLayout.*;

Expand All @@ -29,12 +33,13 @@ final class RuntimeHelper {
private static final MethodHandles.Lookup MH_LOOKUP = MethodHandles.lookup();
private static final SymbolLookup SYMBOL_LOOKUP;
private static final SegmentAllocator THROWING_ALLOCATOR = (x, y) -> { throw new AssertionError("should not reach here"); };
static final AddressLayout POINTER = ValueLayout.ADDRESS.withTargetLayout(MemoryLayout.sequenceLayout(JAVA_BYTE));

final static SegmentAllocator CONSTANT_ALLOCATOR =
(size, align) -> SegmentAllocator.allocate(size, align);
(size, align) -> Arena.ofAuto().allocate(size, align);

static {
SegmentAllocator.prefixAllocator(MemorySegment.ofAddress(size));

SymbolLookup loaderLookup = SymbolLookup.loaderLookup();
SYMBOL_LOOKUP = name -> loaderLookup.find(name).or(() -> LINKER.defaultLookup().find(name));
}
Expand All @@ -50,7 +55,9 @@ static <T> T requireNonNull(T obj, String symbolName) {
}

static MemorySegment lookupGlobalVariable(String name, MemoryLayout layout) {
return SYMBOL_LOOKUP.find(name).map(symbol -> MemorySegment.ofAddress(symbol.address(), layout.byteSize())).orElse(null);
return SYMBOL_LOOKUP.find(name)
.map(s -> s.reinterpret(layout.byteSize()))
.orElse(null);
}

static MethodHandle downcallHandle(String name, FunctionDescriptor fdesc) {
Expand All @@ -77,7 +84,7 @@ static MethodHandle upcallHandle(Class<?> fi, String name, FunctionDescriptor fd
}
}

static <Z> MemorySegment upcallStub(MethodHandle fiHandle, Z z, FunctionDescriptor fdesc) {
static <Z> MemorySegment upcallStub(MethodHandle fiHandle, Z z, FunctionDescriptor fdesc, Arena scope) {
try {
fiHandle = fiHandle.bindTo(z);
return LINKER.upcallStub(fiHandle, fdesc, scope);
Expand All @@ -86,8 +93,8 @@ static <Z> MemorySegment upcallStub(MethodHandle fiHandle, Z z, FunctionDescript
}
}

static MemorySegment asArray(MemorySegment addr, MemoryLayout layout, int numElements) {
return MemorySegment.ofAddress(addr.address(), numElements * layout.byteSize(), scope);
static MemorySegment asArray(MemorySegment addr, MemoryLayout layout, int numElements, Arena arena) {
return addr.reinterpret(numElements * layout.byteSize(), arena, null);
}

// Internals only below this point
Expand Down
86 changes: 16 additions & 70 deletions LibRawFX/src/main/java/org/libraw/linuxosx/constants$0.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,76 +11,22 @@ final class constants$0 {

// Suppresses default constructor, ensuring non-instantiability.
private constants$0() {}
static final FunctionDescriptor memory_callback$FUNC = FunctionDescriptor.ofVoid(
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final FunctionDescriptor memory_callback_UP$FUNC = FunctionDescriptor.ofVoid(
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle memory_callback_UP$MH = RuntimeHelper.upcallHandle(memory_callback.class, "apply", constants$0.memory_callback_UP$FUNC);
static final FunctionDescriptor memory_callback_DOWN$FUNC = FunctionDescriptor.ofVoid(
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle memory_callback_DOWN$MH = RuntimeHelper.downcallHandle(
constants$0.memory_callback_DOWN$FUNC
);
static final FunctionDescriptor exif_parser_callback$FUNC = FunctionDescriptor.ofVoid(
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_LONG_LONG$LAYOUT
);
static final FunctionDescriptor exif_parser_callback_UP$FUNC = FunctionDescriptor.ofVoid(
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_LONG_LONG$LAYOUT
);
static final MethodHandle exif_parser_callback_UP$MH = RuntimeHelper.upcallHandle(exif_parser_callback.class, "apply", constants$0.exif_parser_callback_UP$FUNC);
static final FunctionDescriptor exif_parser_callback_DOWN$FUNC = FunctionDescriptor.ofVoid(
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_LONG_LONG$LAYOUT
);
static final MethodHandle exif_parser_callback_DOWN$MH = RuntimeHelper.downcallHandle(
constants$0.exif_parser_callback_DOWN$FUNC
);
static final FunctionDescriptor default_memory_callback$FUNC = FunctionDescriptor.ofVoid(
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle default_memory_callback$MH = RuntimeHelper.downcallHandle(
"default_memory_callback",
constants$0.default_memory_callback$FUNC
);
static final FunctionDescriptor data_callback$FUNC = FunctionDescriptor.ofVoid(
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final FunctionDescriptor data_callback_UP$FUNC = FunctionDescriptor.ofVoid(
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final MethodHandle data_callback_UP$MH = RuntimeHelper.upcallHandle(data_callback.class, "apply", constants$0.data_callback_UP$FUNC);
static final StructLayout const$0 = MemoryLayout.structLayout(
RuntimeHelper.POINTER.withName("decoder_name"),
JAVA_INT.withName("decoder_flags"),
MemoryLayout.paddingLayout(4)
).withName("libraw_decoder_info_t");
static final VarHandle const$1 = constants$0.const$0.varHandle(MemoryLayout.PathElement.groupElement("decoder_name"));
static final VarHandle const$2 = constants$0.const$0.varHandle(MemoryLayout.PathElement.groupElement("decoder_flags"));
static final StructLayout const$3 = MemoryLayout.structLayout(
JAVA_INT.withName("mix_green"),
JAVA_INT.withName("raw_color"),
JAVA_INT.withName("zero_is_bad"),
JAVA_SHORT.withName("shrink"),
JAVA_SHORT.withName("fuji_width")
).withName("libraw_internal_output_params_t");
static final VarHandle const$4 = constants$0.const$3.varHandle(MemoryLayout.PathElement.groupElement("mix_green"));
static final VarHandle const$5 = constants$0.const$3.varHandle(MemoryLayout.PathElement.groupElement("raw_color"));
}


62 changes: 11 additions & 51 deletions LibRawFX/src/main/java/org/libraw/linuxosx/constants$1.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,57 +11,17 @@ final class constants$1 {

// Suppresses default constructor, ensuring non-instantiability.
private constants$1() {}
static final FunctionDescriptor data_callback_DOWN$FUNC = FunctionDescriptor.ofVoid(
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final MethodHandle data_callback_DOWN$MH = RuntimeHelper.downcallHandle(
constants$1.data_callback_DOWN$FUNC
);
static final FunctionDescriptor default_data_callback$FUNC = FunctionDescriptor.ofVoid(
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final MethodHandle default_data_callback$MH = RuntimeHelper.downcallHandle(
"default_data_callback",
constants$1.default_data_callback$FUNC
);
static final FunctionDescriptor progress_callback$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final FunctionDescriptor progress_callback_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final MethodHandle progress_callback_UP$MH = RuntimeHelper.upcallHandle(progress_callback.class, "apply", constants$1.progress_callback_UP$FUNC);
static final FunctionDescriptor progress_callback_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final MethodHandle progress_callback_DOWN$MH = RuntimeHelper.downcallHandle(
constants$1.progress_callback_DOWN$FUNC
);
static final FunctionDescriptor pre_identify_callback$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final FunctionDescriptor pre_identify_callback_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle pre_identify_callback_UP$MH = RuntimeHelper.upcallHandle(pre_identify_callback.class, "apply", constants$1.pre_identify_callback_UP$FUNC);
static final FunctionDescriptor pre_identify_callback_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle pre_identify_callback_DOWN$MH = RuntimeHelper.downcallHandle(
constants$1.pre_identify_callback_DOWN$FUNC
static final VarHandle const$0 = constants$0.const$3.varHandle(MemoryLayout.PathElement.groupElement("zero_is_bad"));
static final VarHandle const$1 = constants$0.const$3.varHandle(MemoryLayout.PathElement.groupElement("shrink"));
static final VarHandle const$2 = constants$0.const$3.varHandle(MemoryLayout.PathElement.groupElement("fuji_width"));
static final FunctionDescriptor const$3 = FunctionDescriptor.ofVoid(
RuntimeHelper.POINTER,
RuntimeHelper.POINTER,
RuntimeHelper.POINTER
);
static final MethodHandle const$4 = RuntimeHelper.upcallHandle(memory_callback.class, "apply", constants$1.const$3);
static final MethodHandle const$5 = RuntimeHelper.downcallHandle(
constants$1.const$3
);
}

Expand Down
65 changes: 15 additions & 50 deletions LibRawFX/src/main/java/org/libraw/linuxosx/constants$10.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,56 +11,21 @@ final class constants$10 {

// Suppresses default constructor, ensuring non-instantiability.
private constants$10() {}
static final FunctionDescriptor libraw_set_user_mul$FUNC = FunctionDescriptor.ofVoid(
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_FLOAT$LAYOUT
);
static final MethodHandle libraw_set_user_mul$MH = RuntimeHelper.downcallHandle(
"libraw_set_user_mul",
constants$10.libraw_set_user_mul$FUNC
);
static final FunctionDescriptor libraw_set_output_bps$FUNC = FunctionDescriptor.ofVoid(
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final MethodHandle libraw_set_output_bps$MH = RuntimeHelper.downcallHandle(
"libraw_set_output_bps",
constants$10.libraw_set_output_bps$FUNC
);
static final FunctionDescriptor libraw_set_gamma$FUNC = FunctionDescriptor.ofVoid(
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_FLOAT$LAYOUT
);
static final MethodHandle libraw_set_gamma$MH = RuntimeHelper.downcallHandle(
"libraw_set_gamma",
constants$10.libraw_set_gamma$FUNC
);
static final FunctionDescriptor libraw_set_no_auto_bright$FUNC = FunctionDescriptor.ofVoid(
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final MethodHandle libraw_set_no_auto_bright$MH = RuntimeHelper.downcallHandle(
"libraw_set_no_auto_bright",
constants$10.libraw_set_no_auto_bright$FUNC
);
static final FunctionDescriptor libraw_set_bright$FUNC = FunctionDescriptor.ofVoid(
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_FLOAT$LAYOUT
);
static final MethodHandle libraw_set_bright$MH = RuntimeHelper.downcallHandle(
"libraw_set_bright",
constants$10.libraw_set_bright$FUNC
);
static final FunctionDescriptor libraw_set_highlight$FUNC = FunctionDescriptor.ofVoid(
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final MethodHandle libraw_set_highlight$MH = RuntimeHelper.downcallHandle(
"libraw_set_highlight",
constants$10.libraw_set_highlight$FUNC
);
static final VarHandle const$0 = constants$5.const$0.varHandle(MemoryLayout.PathElement.groupElement("post_interpolate_cb"));
static final MethodHandle const$1 = RuntimeHelper.upcallHandle(libraw_callbacks_t.pre_converttorgb_cb.class, "apply", constants$4.const$2);
static final VarHandle const$2 = constants$5.const$0.varHandle(MemoryLayout.PathElement.groupElement("pre_converttorgb_cb"));
static final MethodHandle const$3 = RuntimeHelper.upcallHandle(libraw_callbacks_t.post_converttorgb_cb.class, "apply", constants$4.const$2);
static final VarHandle const$4 = constants$5.const$0.varHandle(MemoryLayout.PathElement.groupElement("post_converttorgb_cb"));
static final StructLayout const$5 = MemoryLayout.structLayout(
JAVA_INT.withName("type"),
JAVA_SHORT.withName("height"),
JAVA_SHORT.withName("width"),
JAVA_SHORT.withName("colors"),
JAVA_SHORT.withName("bits"),
JAVA_INT.withName("data_size"),
MemoryLayout.sequenceLayout(1, JAVA_BYTE).withName("data"),
MemoryLayout.paddingLayout(3)
).withName("libraw_processed_image_t");
}


22 changes: 22 additions & 0 deletions LibRawFX/src/main/java/org/libraw/linuxosx/constants$100.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Generated by jextract

package org.libraw.linuxosx;

import java.lang.invoke.MethodHandle;
import java.lang.invoke.VarHandle;
import java.nio.ByteOrder;
import java.lang.foreign.*;
import static java.lang.foreign.ValueLayout.*;
final class constants$100 {

// Suppresses default constructor, ensuring non-instantiability.
private constants$100() {}
static final VarHandle const$0 = constants$98.const$1.varHandle(MemoryLayout.PathElement.groupElement("cr3_ifd0_length"));
static final VarHandle const$1 = constants$98.const$1.varHandle(MemoryLayout.PathElement.groupElement("thumb_misc"));
static final VarHandle const$2 = constants$98.const$1.varHandle(MemoryLayout.PathElement.groupElement("fuji_layout"));
static final VarHandle const$3 = constants$98.const$1.varHandle(MemoryLayout.PathElement.groupElement("tiff_samples"));
static final VarHandle const$4 = constants$98.const$1.varHandle(MemoryLayout.PathElement.groupElement("tiff_bps"));
static final VarHandle const$5 = constants$98.const$1.varHandle(MemoryLayout.PathElement.groupElement("tiff_compress"));
}


22 changes: 22 additions & 0 deletions LibRawFX/src/main/java/org/libraw/linuxosx/constants$101.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Generated by jextract

package org.libraw.linuxosx;

import java.lang.invoke.MethodHandle;
import java.lang.invoke.VarHandle;
import java.nio.ByteOrder;
import java.lang.foreign.*;
import static java.lang.foreign.ValueLayout.*;
final class constants$101 {

// Suppresses default constructor, ensuring non-instantiability.
private constants$101() {}
static final VarHandle const$0 = constants$98.const$1.varHandle(MemoryLayout.PathElement.groupElement("tiff_sampleformat"));
static final VarHandle const$1 = constants$98.const$1.varHandle(MemoryLayout.PathElement.groupElement("zero_after_ff"));
static final VarHandle const$2 = constants$98.const$1.varHandle(MemoryLayout.PathElement.groupElement("tile_width"));
static final VarHandle const$3 = constants$98.const$1.varHandle(MemoryLayout.PathElement.groupElement("tile_length"));
static final VarHandle const$4 = constants$98.const$1.varHandle(MemoryLayout.PathElement.groupElement("load_flags"));
static final VarHandle const$5 = constants$98.const$1.varHandle(MemoryLayout.PathElement.groupElement("data_error"));
}


Loading

0 comments on commit 9326123

Please sign in to comment.