JIT Compilation on Android

66 views
Skip to first unread message

MHOOO

unread,
May 28, 2010, 11:44:11 PM5/28/10
to Clojure
I've got 1.2.0-master running on android froyo with a repl. Froyo
supports JIT compilation, but whenever I call code which is defining a
new class (e.g.: "(defn blub [] nil)"), I get an Exception:
-------------------------------------------------------------
clojure.core=> (defn blub [] 1)
java.lang.RuntimeException: java.lang.UnsupportedOperationException:
can't load this type of class file (NO_SOURCE_FILE:15)
clojure.core=>
-------------------------------------------------------------
And the following error inside the android logs:
-------------------------------------------------------------
E/dalvikvm( 522): ERROR: defineClass(0x43e6e188, clojure.core$blub,
0x43f83a58, 0, 984, 0x0)
-------------------------------------------------------------
Am I doing something wrong/impossible or is there a way to fix this?

B Smith-Mannschott

unread,
May 29, 2010, 2:39:42 AM5/29/10
to clo...@googlegroups.com

Here's my guess: Android's virtual machine uses a different
instruction set than the Sun/Oracle JVM(s). Clojure's compiler would
have to generate Dalvik instructions instead of JVM Bytecode. I expect
that's not a trivial change.

// ben

Remco van 't Veer

unread,
May 29, 2010, 8:06:11 AM5/29/10
to clo...@googlegroups.com
The dalvikvm does not run java classes and has a different instruction
set. That's why you need to do the dex step before deploying your code
on android.

George Jahad did get a repl/eval to run on android some time ago. See:

http://groups.google.com/group/clojure/browse_thread/thread/14725172c626642c

And the revelant commit in his clojure fork:

http://github.com/GeorgeJahad/clojure-android/commit/9caf2913a2724c38d735743649763c7b0c96dfcd

MHOOO

unread,
May 29, 2010, 10:02:43 AM5/29/10
to Clojure
Ah yes, applying the commits onto clojure master worked. Thanks!

On May 29, 2:06 pm, Remco van 't Veer <rwvtv...@gmail.com> wrote:
> The dalvikvm does not run java classes and has a different instruction
> set.  That's why you need to do the dex step before deploying your code
> on android.
>
> George Jahad did get a repl/eval to run on android some time ago.  See:
>
>  http://groups.google.com/group/clojure/browse_thread/thread/14725172c...
>
> And the revelant commit in his clojure fork:
>
>  http://github.com/GeorgeJahad/clojure-android/commit/9caf2913a2724c38...

Philip

unread,
Jun 9, 2010, 3:42:17 AM6/9/10
to Clojure
George's modifications are a bit slow in compiling and require the App
to have writing privileges to the /data folder.

I have made a few patches to remedy that during my Bachelor's thesis
and hope to be able to put them on github in July, but there are some
things that have to be done first - mainly, the thesis has to be
finished ;-)
Reply all
Reply to author
Forward
0 new messages