[Vm-dev] Reviving the Android VM

Eliot Miranda eliot.miranda at gmail.com
Tue Jun 20 17:08:04 UTC 2017


Hi Michael,

    take what I'm about to say with skepticism because I've not used the
Android VM but as I understand it there is already a Cog Android VM for ARM
v7 Androids.  If you look at the HowToBuilds in opensmalltalk/vm's
build.linux32ARMv6 & build.linux32ARMv7 you'll see

$ diff build.linux32ARMv*/HowToBuild
1c1
< How To Build On Linux ARMv6 (i.e. Raspbian for Raspberry Pi (*))
---
> How To Build On Linux ARM v7 (e.g. Android devices (*))
...

I'm pretty sure that the Rasperry Pi VM does crash on Android and vice
verse, because of floating point issues.  In the v6/RPi build we use
CC="gcc -march=armv6 -mfpu=vfp -mfloat-abi=hard"
and in the v7/Android build we use no such settings.

Right now there are only newspeak builds for Android
(build.linux32ARMv7/{newspeak.cog.spur,newspeak.stack.spur}, but if you
copy across build.linux32ARMv6/squeak.cog.spur and make the matching edits
to the mvm files then you should have a working Android build.  I'm cc'ing
Ryan Macnak who is the person behind the New3speak Android VM.  Ryan also
did a MIPS back end so there's a possibility of running on those devices
too.

I'm also pretty sure that this VM is missing the event-driven features of
Andreas' VM and it would be great to have that folded back in.

On Fri, Jun 16, 2017 at 12:48 PM, Michael Rueger <lists at andience.co.nz>
wrote:

>
> Hi all,
>
> long time no see :-)
>
> Recently I spent a bit of time trying to piece together an Android VM
> using the up to date versions of AndroidStudio, SDK and NDK. Once things
> are building and running, I was planning to fold everything back into the
> proper build process.
>
> Current (somewhat messy) state of things here
> https://github.com/mrueger42/st-android
>
> It has been quite a long time since I looked at building VMs, so forgive
> me if I'm just being stupid here...
>
> I was able to get the original port from Andreas to build and run, but it
> is a very outdated version. Still nice to have it as a piece of history, I
> think (AndroidVM in the above repo).
>
> Some puzzle pieces later I have something running that is based on recent
> CogSpur opensmalltalk code and bits and pieces I found. Unfortunately
> CogSpur doesn't seem to play well with the setjmp/longjmp used in the code
> (CogDroid in the above repo).
>
> Plus, the VM is running on the UI thread, not something that is viewed
> well on mobile. Actually it makes Android just kill the app if you block
> the UI thread for too long.
>
> Trying to run the VM on a thread runs into a division by 0 exception (I
> think) and finds me way out of my league to track down why that would be.
> Crash below...
>
> I haven't really tried getting Dmitry's version to build/work in a current
> environment, partly because I'm not sure I'm looking at the most up to date
> version (see below).
>
> Any help, pointers, code snippets highly appreciated!
>
> Cheers
>
> Michael
>
> P.S. Sending this to vm-dev and pharo-dev, but should probably send any
> followup to vm-dev?
>
> --------
>
>
> list of sources I looked at:
>
> -opensmalltalk
> -pharo
>
> -original port by Andreas
> git at github.com:timfel/squeak-android-vm.git
>
> -stack
> https://github.com/sbragagnolo/pharo-vm/
>
> -dmitry
> gitorious is no longer, just an archival snapshot
> clicking on snapshot gives you the sources
> https://gitorious.org/cogvm/dmg-blessed?p=cogvm:dmg-blessed.git;a=summary
> non-functional jenkins setup
> https://ci.inria.fr/pharo-contribution/view/VM/job/CogDroid/
> configure-readonly/
>
>
>
> -------------
>
> The Cog VM crash when running on a Thread:
>
>
> D/jni-vm: Java_org_smalltalk_android_vm_VM_runVM
> D/jni-vm: runVM
> D/jni-vm: interpret
>
> A/libc: Fatal signal 8 (SIGFPE), code -6, fault addr 0x67db in tid 26636
> (Thread-5)
>
> Revision: '6'
> ABI: 'arm'
> pid: 26587, tid: 26636, name: Thread-5  >>> org.smalltalk.android <<<
> signal 8 (SIGFPE), code -6 (SI_TKILL), fault addr 0x67db
>     r0 00000000  r1 0000680c  r2 00000008  r3 00000000
>     r4 e4f7f978  r5 00000008  r6 e4f7f920  r7 0000010c
>     r8 e4f7ef60  r9 e3516400  sl e351648c  fp e4f7ecb4
>     ip 00000002  sp e4f7ce30  lr efca84c7  pc efcaad30  cpsr 600e0010
>
> backtrace:
>     #00 pc 0004ad30  /system/lib/libc.so (tgkill+12)
>     #01 pc 000484c3  /system/lib/libc.so (pthread_kill+34)
>     #02 pc 0001dd99  /system/lib/libc.so (raise+10)
>     #03 pc 000c54a3  /data/app/org.smalltalk.androi
> d-2/lib/arm/libStackVM.so
>     #04 pc 00051507  /data/app/org.smalltalk.androi
> d-2/lib/arm/libStackVM.so
>     #05 pc 0003d38b  /data/app/org.smalltalk.android-2/lib/arm/libStackVM.so
> (interpret+238)
>     #06 pc 000a4e6f  /data/app/org.smalltalk.android-2/lib/arm/libStackVM.so
> (runVM+22)
>     #07 pc 000a4a55  /data/app/org.smalltalk.android-2/lib/arm/libStackVM.so
> (Java_org_smalltalk_android_vm_VM_runVM+36)
>     #08 pc 0031ec99  /data/app/org.smalltalk.android-2/oat/arm/base.odex
> (offset 0x302000)
>
>


-- 
_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20170620/3ed6eb6b/attachment.html>


More information about the Vm-dev mailing list