From Panama 17 to 19, ability to get M1?

Martin Pernollet martin.pernollet at protonmail.com
Sat Jan 21 14:36:04 UTC 2023


Stupid me! One year ago we discussed this and the solution was to use $func on macOS instead of $callback on Linux. I do not remember the reason for this, but that would be handy to have a single name pattern across all OS :)

So thanks to your help I succeeded bumping to JDK19 an can run all tests and demos of PanamaGL on macOS.

Now a last issue - probably my IDE rather than FFM/JExtract but maybe you have a suggestion :

Error: LinkageError occurred while loading main class demos.panamagl.macos.swing.DemoTeapot_Onscreen_macOS_Swing

java.lang.UnsupportedClassVersionError: demos/panamagl/macos/swing/DemoTeapot_Onscreen_macOS_Swing (class file version 61.65535) was compiled with preview features that are unsupported. This version of the Java Runtime only recognizes preview features for class file version 63.65535

Is triggered as soon as I edit a file that depend on a maven artifact containing the bindings.

To avoid this, I clean install the module containing the demo and this fix it.

My Eclipse IDE is configured for using JDK 19.0.2 like Maven, and I am sure I depend on bindings built with JDK 19.0.2.

Would you at least confirm if those class file are related to JDK 17 and 19?

Cheers,

Martin
------- Original Message -------
Le vendredi 20 janvier 2023 à 23:00, Maurizio Cimadamore <maurizio.cimadamore at oracle.com> a écrit :

> That is odd - all the functions should be there and generated statically - there's nothing dynamic going on.
>
> That said, I seem to recall that the name of "glutIdleFunc$callback" really depends on the version of glut you are using. In some the parameter is called "callback" in others is called in some other way, so the binding will be diiferent.
>
> But that doesn't explain the other errors on the more plain glutDisplayFunc - those symbols should be there.
>
> (btw, all of this works on Linux).
>
> Maurizio
>
> On 20/01/2023 19:09, Martin Pernollet wrote:
>
>> Thank you, that was indeed confusing but this now "works".
>>
>> One last point that I could not figure out is why I can't build this :
>>
>> [image.png]
>>
>> If you don't get the image, [this line of the teapot](https://urldefense.com/v3/__https://github.com/openjdk/jextract/blob/master/samples/opengl/Teapot.java*L82__;Iw!!ACWV5N9M2RV99hQ!KHDR-GSa3Kh7FBYMI8DbfdImUc9um9r4usRG4l50tL0MiYsh0GfVPDgkxkfyhmjiQ33KB1BfFVzbsQdGNoUX5YCUFQ3nWS8Oin0GzQ$) can't build saying :
>>
>> glutDisplayFunc#callback cannot be resolved
>>
>> I only found in generated source glut_h_3
>>
>> publicstaticMethodHandleglutDisplayFunc$MH(){
>>
>> returnRuntimeHelper.requireNonNull(constants$185.glutDisplayFunc$MH,"glutDisplayFunc");
>>
>> }
>>
>> publicstaticvoidglutDisplayFunc(Addressablefunc){
>>
>> varmh$=glutDisplayFunc$MH();
>>
>> try {
>>
>> mh$.invokeExact(func);
>>
>> } catch (Throwable ex$) {
>>
>> thrownewAssertionError("should not reach here",ex$);
>>
>> }
>>
>> }
>>
>> And no glutDisplayFunc$callback (But this was seamingly the same with version 17)
>>
>> Should I expect a function to be named this way or is this something dynamic I am missing?
>>
>> Any hint appreciated :)
>>
>> Martin
>>
>> ------- Original Message -------
>> Le vendredi 20 janvier 2023 à 18:59, Maurizio Cimadamore [<maurizio.cimadamore at oracle.com>](mailto:maurizio.cimadamore at oracle.com) a écrit :
>>
>>> Please, get jextract from here:
>>>
>>> [https://jdk.java.net/jextract/](https://urldefense.com/v3/__https://jdk.java.net/jextract/__;!!ACWV5N9M2RV99hQ!KHDR-GSa3Kh7FBYMI8DbfdImUc9um9r4usRG4l50tL0MiYsh0GfVPDgkxkfyhmjiQ33KB1BfFVzbsQdGNoUX5YCUFQ3nWS8IP6L77Q$)
>>>
>>> And JDK 19 from here:
>>>
>>> [https://jdk.java.net/19/](https://urldefense.com/v3/__https://jdk.java.net/19/__;!!ACWV5N9M2RV99hQ!KHDR-GSa3Kh7FBYMI8DbfdImUc9um9r4usRG4l50tL0MiYsh0GfVPDgkxkfyhmjiQ33KB1BfFVzbsQdGNoUX5YCUFQ3nWS8E0vIwhA$)
>>>
>>> These two should work well together.
>>>
>>> The Panama early access binaries are now obsolete, and should not be used. In fact, I think it might be time to remove them, as they are a constant source of confusion.
>>>
>>> Cheers
>>> Maurizio
>>>
>>> On 20/01/2023 17:54, Martin Pernollet wrote:
>>>
>>>> Hi all,
>>>>
>>>> Just tried to switch to JExtract samples for JDK 19. I am suprised by the fact that the following imports shown in the JExtract Teapot sample (on master banch, hence v19) can't be resolved
>>>>
>>>> import java.lang.foreign.MemorySession;
>>>>
>>>> import java.lang.foreign.SegmentAllocator;
>>>>
>>>> And indeed, as shown by this picture, java.lang has no foreign subfolder in JDK 19
>>>>
>>>> [image.png]
>>>>
>>>> However, I found foreign packages to still appear in jdk.incubator module.
>>>>
>>>> May this be due to me downloading JDK19 from the panama page? [https://jdk.java.net/panama/](https://urldefense.com/v3/__https://jdk.java.net/panama/__;!!ACWV5N9M2RV99hQ!KHDR-GSa3Kh7FBYMI8DbfdImUc9um9r4usRG4l50tL0MiYsh0GfVPDgkxkfyhmjiQ33KB1BfFVzbsQdGNoUX5YCUFQ3nWS8hi7axdQ$)
>>>>
>>>> Envoyé avec la messagerie sécurisée [Proton Mail](https://urldefense.com/v3/__https://proton.me/__;!!ACWV5N9M2RV99hQ!KHDR-GSa3Kh7FBYMI8DbfdImUc9um9r4usRG4l50tL0MiYsh0GfVPDgkxkfyhmjiQ33KB1BfFVzbsQdGNoUX5YCUFQ3nWS_6VosVXA$).
>>>>
>>>> ------- Original Message -------
>>>> Le lundi 2 janvier 2023 à 11:57, Jorn Vernee [<jorn.vernee at oracle.com>](mailto:jorn.vernee at oracle.com) a écrit :
>>>>
>>>>> Hi Martin,
>>>>>
>>>>> On 23/12/2022 17:20, Martin Pernollet wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Would anyone suggest examples showing how to use Panama 19 instead of 17? A couple of things have changed ( e.g. how to use the new
>>>>>>
>>>>>> locator
>>>>>>
>>>>>> .allocateArray(
>>>>>>
>>>>>> new
>>>>>>
>>>>>> ValueLayout.OfDouble(
>>>>>>
>>>>>> , and deal with all other datatypes, strings, etc).
>>>>>
>>>>> The general idea is to either use one of the layout constants in the ValueLayout class, such as JAVA_DOUBLE. Or use a layout generated by jextract for a specific type. For strings the type would be a pointer, so the ValueLayout.ADDRESS layout or the C_POINTER layout generated by jextract can be used for instance.
>>>>>
>>>>>> One additional question : when will ARM be supported to run panama on Apple M1?
>>>>>
>>>>> MacOs/AArch64 (i.e ARM) has been supported since Java 17 [1]
>>>>>
>>>>> Jorn
>>>>>
>>>>> [1]: [https://github.com/openjdk/jdk/pull/3617](https://urldefense.com/v3/__https://github.com/openjdk/jdk/pull/3617__;!!ACWV5N9M2RV99hQ!KHDR-GSa3Kh7FBYMI8DbfdImUc9um9r4usRG4l50tL0MiYsh0GfVPDgkxkfyhmjiQ33KB1BfFVzbsQdGNoUX5YCUFQ3nWS-LQIElmg$)
>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20230121/4380e3f6/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 171721 bytes
Desc: not available
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20230121/4380e3f6/image-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 85092 bytes
Desc: not available
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20230121/4380e3f6/image-0003.png>


More information about the panama-dev mailing list