Live data from Hacker News

Avian: a lightweight alternative to Java that runs on iOS and Android

oss.readytalk.com

11–20 of 29 posts

Re: Avian: a lightweight alternative to Java that runs on iOS and Android

#14
post #6

How does it JIT on iOS given that normal apps cannot write to executable memory ?

One of the core contributors here. The trick is that Avian doesn't do JIT compilation on iOS - instead, we run everything through the "JIT" compiler ahead of time, as we're building the app. This is the only possible technique, outside of interpretation (which Avian can also do, but slowly), and compiling to Javascript to run with JavascriptCore. It's also what I've seen most other VMs do for iOS (including, for instance, the Unity game engine, which used to embed Mono).

Re: Avian: a lightweight alternative to Java that runs on iOS and Android

#15

A java jitted VM built from scratch.. i wonder if we have a way to see how it performs, compared to other jits (specially the Android ART)? By a very crude look at the source, looks very lightweight indeed > Just-In-Time (JIT) compilation for fast method execution > Generational, copying garbage collection ensures short pause times and good spatial locality > Thread-local heaps provide O(1) memory allocation with no…

One of the core contributors here. I don't have any numbers, but I can reasonably guess it'll only beat the most naive JITs (i.e., JITs that only copy predefined templates that implement each instruction). Avian's JIT does no optimizations beyond a simple linear-time register allocator and a very basic instruction selector. Avian can run a simple Hello World somewhat faster than HotSpot, but that's about all. In any real-world scenarios, HotSpot and Dalvik/ART will kick the pants off it.

However, that's not what Avian is designed for. We (ReadyTalk) don't have the resources to compete in that sort of market, as fun as that might be. We designed Avian to run a relatively light-weight client application, so we can deploy the same code across all our platforms. We're not running a game or a server, so we don't care a lot frame rate or requests per second.

Re: Avian: a lightweight alternative to Java that runs on iOS and Android

#18
post #5

As an interesting aside, Avian has native support for coroutines through stack de/re-hydration. I have yet to use it, but it looks quite interesting.

Specifically, it supports native first class continuations, including both call/cc-style and delimited (shift/reset-style), which can form the basis for coroutines, generators, and other fun stuff. It also supports full tail call optimization.

Both of those features work with Java, Clojure, Scala, etc. For example: https://groups.google.com/d/msg/clojure/U4i4nVsYfi8/1GSGgNM8...

More info is available here: http://oss.readytalk.com/avian-web/javadoc-1.2.0/avian/Conti...

Re: Avian: a lightweight alternative to Java that runs on iOS and Android

#19

How does this compare with RoboVM ( https://robovm.com/ )?

It runs on Windows, Linux, FreeBSD, in addition to iOS and Android

Technically we don't support running the Avian VM on Android, although it should work with minimal porting. However, we support using the VM with any of three class libraries: Android's, OpenJDK's, or Avian's. So, ironically, you can use Android's class library with Avian on every platform you listed except Android :)

If there's interest in porting Avian on Android, we could do it, but since it already has Dalvik/ART, I'm not sure there's much of a point.

Re: Avian: a lightweight alternative to Java that runs on iOS and Android

#20

Does it support the full jdk?

As dkharrat pointed out, you can use the Avian VM with the OpenJDK class library instead of the much more limited default library. However, there's no support for JVMTI, and not everything in the OpenJDK library will work with every combination of platforms and build options.
Post reply on HN