[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
Tue Nov 10 01:11:59 UTC 2020
On Wed, 4 Nov 2020 23:09:14 GMT, Andrii Rodionov <github.com+1538227+arodionov at openjdk.org> wrote:
>>> Actually, we have found this issue during JCK tests execution that was built as a native image. The fix criteria are the successful tests run.
>>
>> But what exact steps should be done to reproduce this bug w/o using jck or any external tools? Something like:
>> - Clone JDK
>> - Build JDK using some specific options.
>> - Create some small test case
>> - Somehow create the native image
>> - Run the app -> boom -> bug is reproduced
>
> @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.
-------------
PR: https://git.openjdk.java.net/jdk/pull/562
More information about the 2d-dev
mailing list