[Vm-dev] Is it possible to compile stack vm without heartbeat?

Dimitry Golubovsky golubovsky at gmail.com
Fri Sep 9 14:41:19 UTC 2011


It looks you are following the same trail I have been walking on for
some time (I mean Android Cog).

Feel free to borrow my experience from this repo:


and also VMMaker-oscog and CMakeVMMaker packages in squeaksource.com/EventVM

In general, I turned Stack Cog into an event-driven VM (like Andreas
did some time ago in his Android port of Classic VM).

I believe that for any kind of embedding this approach of making an
event-driven VM is preferrable.

I remember asking a similar question some time ago, here:


As a by-product of my Android port, I created a Unix EventVM (see
StackEvtUnixConfig class in CMakeVMMaker) though it is not polished.
It uses two extra files in the Unix platform: sqUnixEvtBeat.c and
sqUnixEvtMain.c. The former is transformed sqheartbeat.c, the latter
is replacement of sqUnixMain.c with dummy external event loop (as it
no longer belongs to the interpreter).

You also may look at the android version of the same file
(sqAndroidEvtBeat.c in the android platform) where all time-fetching
functions request actual time from the underlying OS (calling
gettimeofday() and similar functions instead of getting time from a
memory location updated by another thread).

Besides, my VM is single-threaded. I do use SIGALRM though, to limit
maximal time in interpreter so Android does not kill the application,
however NaCL's policy may be different.

Anyway, this may be a long discussion, Feel free to ask.


Dimitry Golubovsky

Anywhere on the Web

More information about the Vm-dev mailing list