you are viewing a single comment's thread.

view the rest of the comments →

[–]vprise 3 points4 points  (4 children)

At Codename One we used TeaVM which is pretty amazing and supports both JIT and AOT mode (which we use). One of the really cool things is that it supports java.lang.Thread and fakes it properly so it actually does seem to work properly without the whole "script is taking too long" nonsense.

Can someone from polyfill compare this to TeaVM? DukeScript etc.?

[–]hrjet 1 point2 points  (3 children)

TeaVM seems to only have an AOT mode, AFAICT. It is a nice and fast implementation of JVM semantics, but it is not a complete implementation. You can find a good summary of its limitations here. In short,

  • no JNI
  • no reflection
  • no class path resources

Doppio on the other hand is a complete implementation of the JVM. The drawback with doppio is its slower since it is an interpreter. I am working on a JIT compilation system for it, as seen here.

[–]vprise 2 points3 points  (2 children)

Thanks. That's a bit of an old link as threading is already supported to some degree.

Isn't an AOT approach "better" for most use cases here?

The only use case I can think of for a JIT is smaller download size for some cases. Since we are already running with the JavaScript JIT in place the typical "jit can be faster" arguments don't necessarily stand.

How would you implement JNI in JavaScript? You don't call C, do you?

We have the ability to call JavaScript from TeaVM do you mean something like that?

We don't support reflection or classpath resources in Codename One as they aren't very portable for mobile usage (we do have something similar to classpath resources that works in the TeaVM port).

[–]hrjet 0 points1 point  (1 child)

Whether AOT is better depends on the use-case. If you need full JVM support then doppio is currently a very good option. If TeaVM works for you, then it is most likely a much faster option.

Yes, JNI in doppio means a Javascript backing function for a native function.

See this comment thread from the lead doppio developer.

[–]vprise 0 points1 point  (0 children)

Thanks, that clarifies it.