[prev in list] [next in list] [prev in thread] [next in thread]
List: openjdk-openjfx-dev
Subject: Re: Minimum JDK policy for OpenJFX
From: Ty Young <youngty1997 () gmail ! com>
Date: 2021-05-31 3:53:38
Message-ID: 28120f92-d68f-cba8-2f1c-2bd4a52bcfea () gmail ! com
[Download RAW message or body]
On 5/30/21 5:19 PM, John Neffenger wrote:
> On 5/19/21 1:17 PM, Ty Young wrote:
> > Biggest things for JavaFX that I can think of is jextract, a tool for
> > generating Java headers from a C header, and having all binding code
> > written in Java.
>
> JavaFX has been doing its own manual form of Project Panama since
> 2014. Look for the string "extends C.Structure" in the following two
> files:
>
> https://github.com/openjdk/jfx/blob/master/modules/javafx.graphics/src/main/java/com/sun/glass/ui/monocle/MX6Cursor.java \
>
>
> https://github.com/openjdk/jfx/blob/master/modules/javafx.graphics/src/main/java/com/sun/glass/ui/monocle/EPDSystem.java \
>
>
> In both cases, the technique was used to let JavaFX bypass the header
> file 'mxcfb.h' from NXP (formerly Freescale).
>
> I'm looking forward to replacing those hard-coded offsets with the
> tools from Project Panama. In fact, I'm hopeful that Project Panama
> will let me remove all of the native C code from the Monocle EPD
> platform.
Now that you pointed it out, JavaFX uses SecurityManager:
https://github.com/openjdk/jfx/blob/5e6d4429159e3fab9ec0aab9720393850d179710/modules/javafx.graphics/src/main/java/com/sun/glass/ui/monocle/C.java#L40
Which is being deprecated. Panama has its own runtime flag to enable
native access not tied to SecurityManager.
The C class native implementation can be replaced with Panama easily. A
MemorySegment can be viewed using a ByteBuffer via:
MemorySegment segment = MemorySegment.allocateNative(8,
ResourceScope.newImplicitScope());
ByteBuffer buffer = segment.asByteBuffer();
asByteBuffer() doc says it wraps the MemorySegment, so I'm guessing it
has a strong reference and memory is freed once the buffer and segment
are no longer referenced.
If someone wanted to try swapping out JavaFX's native implementation
with Panama, this would be a good place to start IMO.
>
> John
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic