Project panama

Started by ealrann, January 06, 2019, 21:35:27

Previous topic - Next topic

ealrann

Hello,

I just saw some "news" around project panama: a way better solution to use native code, more easily and more efficiently, perfect for LWJGL I guess.

They released a beta 0 on the main website : https://jdk.java.net/panama/

A youtube presentation: https://youtu.be/M-FPNBFAoSo
This video give some information about the use: annotations to describe the header, no need to modify the native library, some tool to generate the binding. He says that the firsts parts of this project could come soon into the JDK (mainly around the off-heap usage).

I guess it will simplify a lot LWJGL.

spasi

Yes, it will. I'm reviewing every commit that goes into Project Panama, a lot of progress has been made but it's still not there yet.

KaiHH


tlf30

@Spasi, I was just checking up on the Panama project. It looks like they have made a lot of progress, but trying to find a roadmap for them is like pulling teeth.
Have you heard of any timeline for them? What are your thoughts on their progress?

Thanks,
Trevor

spasi

I'm still following Panama's progress, but I will not start testing until it stabilizes. There are still too many API changes happening and the promised performance isn't there.

The latest bad news is that they're trying to shoehorn safety features into the memory access API. Which is hopeless without a) sacrificing performance or b) copying something like Rust (impossible). Not saying it's not a noble effort, but it will take more and more time to sort it all out. I would have preferred just being able to write C in Java (same semantics, same unsafety, same performance), then letting libraries like LWJGL handle and hide the nasty stuff.

On the performance front, there are still too many open issues with Hotspot that affect Panama performance, who knows when and if they'll be fixed.

And, as always, we're still waiting for Valhalla, which imho is a prerequisite for Panama to turn out nice. The good news is that I personally trust the engineers involved and they'll eventually figure out the best approach for both projects. However, the design and implementation issues are extremely hard and the process necessarily time-consuming.

tlf30

Thank you for the update!
I see that JDK14 is finally out... (for better or worse) I need to start looking into what they broke this time around. It looks like improvements have been made to gc though.

I guess we will not see the Panama project for a while then. Which is unfortunate, it would be great to get C++ support in LWJGL.

Anyways, thanks again for the update, you are much more in the loop on the project status than anyone else I have talked to.

~Trevor

tlf30

I see that Panama will be included as a preview in JDK 16. Exciting to see it finally making it into a JDK!

tlf30

JDK 16 is now out.
Any thoughts on the panama project so far? Is it going to be feasible to make lwjgl based on jdk 17 with panama instead of jni?

spasi

It's looking better as time passes, but the API is still not stable. We're getting close now though, it would make sense to start the migration around the JDK 17 release date.

Performance-wise I'm not expecting miracles, but at least upcalls (i.e. C-to-Java callbacks) will be much faster than JNI.

tlf30

What does the C++ support look like? Is it functional, or just a dream at this point?

spasi

C++ is not supported.

tlf30

Hello @Spasi, any new thoughts on Panama with JDK 17 out?
It is exciting to see JDK 17 out. I am disappointed that Adoptium is only releasing a JDK and not a JRE, but that is neither here nor there.

spasi

The API released in JDK 17 is already obsolete: Finalizing the foreign APIs. The project will still be in incubation in JDK 18 and a preview is planned for JDK 19. My guess is that JDK 21, which will be the next LTS release in Sep 2023, will likely be the minimum requirement for projects like LWJGL wanting to target Panama.

I personally don't mind the delay. I would love to explore the API and how it applies to LWJGL before that, but my firm belief has always been that Panama without Valhalla is not that exciting. I'm sure Panama will get where it needs to be soon, but the extra couple of years should be enough time for Valhalla to mature and the final combo will be amazing. I'm also expecting that we'll see more major changes in the Panama API once Valhalla is available.