[Vm-dev] Event-driven Cog still crashing (more observations)

Mariano Martinez Peck marianopeck at gmail.com
Mon Jul 18 14:04:00 UTC 2011


Hi Dimitry. I will probably be completely useless, but one of the things I
would do is to compile the VM in debug mode (in fact, only the asserts is
needed).
If you are compiling Cog with CMakeVMMaker just use a debug config. The
important flags are DNDEBUG and DDEBUGVM. For more details read:

http://forum.world.st/DNDEBUG-0-and-DDEBUGVM-1-td3447587.html

My guess is that the VM is crashing as you said because of a corrupted
stack, so when it crash you don't have any useful information. So...once you
build a VM with debug you will also have the asserts. So run the VM from
command line, and all those assert that fails will be shown in the console
and they will show the value of the variables involved in the assert.
With this, you can see as soon as a assert fails (which may be much before
the crash) and could point you to something interesting :)

Good luck.

On Mon, Jul 18, 2011 at 5:55 AM, Dimitry Golubovsky <golubovsky at gmail.com>wrote:

>
> Hi,
>
> My variant of Cog still keeps crashing in GC, but now it seems I made
> those crashes more "consistent". Now I am posting my code to better
> illustrate the problem, maybe this helps.
>
> Fileout of the class which implements my variant of VM.
>
> http://pastebin.com/WJKtXVk5
>
> It overrides few methods of its parent classes to implement the
> event-driven VM. Most important changes are in methods interpret,
> wakeHighestPriority, and transferTo.
>
> The crash log (output of printOop inserted at each entry of markAndTrace)
>
> http://pastebin.com/sHSyHqHE
>
> It shows the debug output from the last entry in the interpreter after
> which GC happens which crashes.
>
> The host program runs the interpreter like this:
>
> ------------------------------------------------------
>  if (runInterpreter) {
>    interpret();
>    while(1) {
>      int rc;
>      if(!aioPoll(1000)) continue;
>      heartbeat();
>      printf("enter interpreter\n");
>      rc = interpret();
>      printf("exit interpreter: %d\n", rc);
>      if(rc == 1) break;
>    }
>  }
> ------------------------------------------------------
>
> and heartbeat() is reduced to
>
> ------------------------------------------------------
> void
> heartbeat()
> {
>        int saved_errno = errno;
> printf("heartbeat\n");
>        updateMicrosecondClock();
>        if (get64(frequencyMeasureStart) == 0) {
>                set64(frequencyMeasureStart,utcMicrosecondClock);
>                heartbeats = 0;
>        }
>        else
>                heartbeats += 1;
>        forceInterruptCheckFromHeartbeat();
>
>        errno = saved_errno;
> }
> ------------------------------------------------------
>
> In order to put the VM into event-driven mode, the following is
> executed in a workspace:
>
> (ProcessorScheduler classPool at: #BackgroundProcess) terminate.
>
> VM continues working, interpreter is entered on any mouse move or
> click, I could open World menu for example. First GC crashes.
>
> It is my understanding that longjmp I use to exit the interpreter
> somehow does not unwind the native stack properly thus corrupting the
> heap which crashes GC. What could it be?
>
> Thanks for any ideas.
>
> --
> Dimitry Golubovsky
>
> Anywhere on the Web
>



-- 
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20110718/c7935ca0/attachment-0001.htm


More information about the Vm-dev mailing list