[OpenJDK 2D-Dev] RFR: 8254024: Enhance native libs for AWT and Swing to work with GraalVM Native Image
Sergey Bylokhov
serb at openjdk.java.net
Sat Nov 14 00:27:55 UTC 2020
On Tue, 10 Nov 2020 01:09:03 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
>> @mrserb With the last dev build of GraalVM based on JDK 11.09, the bug can be reproduced by the approach that I've mentioned above.
>> The general steps:
>> - download the [last dev build](https://github.com/graalvm/graalvm-ce-dev-builds/releases) of GraalVM + Native image
>> - build the native image for AWTFixExample class (ziped configs for reflection and JNI is attached):
>> `$ ~/graalvm-ce-java11-21.0.0-dev/bin/native-image -H:ConfigurationFileDirectories=./configs -Djava.awt.headless=true --native-image-info AWTFixExample`
>> - run built image - it should be executed successfully
>> - clone any version of the OpenJDK (11.09 - 16)
>> - build static libraries by executing `make static-libs-image` target
>> - replace `libawt.a` in GraalVM on built static library from OpenJDK
>> - try to build example again and run it - it should be failed
>> - clone OpenJDK with the proposed fix
>> - build static libraries
>> - replace `libawt.a` in GraalVM on built static library with the fix
>> - build example and run it - it should be executed successfully
>>
>> public class AWTFixExample {
>> public static void main(String[] args) {
>> float[] data = new float[]{0.0f, 1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f};
>> Kernel kernel = new Kernel(3, 3, data);
>> ConvolveOp op = new ConvolveOp(kernel);
>>
>> BufferedImage src = new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB);
>> BufferedImage dest = new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB);
>>
>> BufferedImage image = op.filter(src, dest);
>> System.out.println(image);
>> }
>> }
>>
>> [configs.zip](https://github.com/openjdk/jdk/files/5490906/configs.zip)
>
> I think part of the changed code is actually dead code and can be removed, I'll take a look.
The changes in awt_LoadLibrary.c and XToolkit.c is mostly noop except excluding dladdr/dlopen. Since XsessionWMcommand/AWTIsHeadless are not used at least in the mainline(jdk16).
The changes in the mlib look fine.
The testing is in progress.
-------------
PR: https://git.openjdk.java.net/jdk/pull/562
More information about the 2d-dev
mailing list