[gambit-list] Strange Gambit error problems DS

Marc Feeley feeley at iro.umontreal.ca
Thu Oct 26 11:21:48 EDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 26-Oct-06, at 9:41 AM, Andrew Lentvorski wrote:

> Marc Feeley wrote:
>> Before the call (##interrupt-vector-set! 1 ...) the heartbeat  
>> interrupt will call the thread scheduler.  It is quite possible  
>> that one of the C functions called by the thread scheduler is  
>> incomplete or contains a bug, and that's why you get a crash.
>> You could avoid getting the crash in this case by calling  
>> ##interrupt-vector-set! before calling ##heartbeat-interval-set! .
>
> Unfortunately, the runtime system does a "##heartbeat-interval-set!  
> 0.0" somewhere before I even get to a repl.  My debugging code  
> shows a call setting the heartbeat interval to less than zero  
> followed by a call setting it to exactly 0.0.
>
> If I make the default tick is too quick, it hangs.  It looks like  
> it has already set a vector in the scheme code, though.  I'm stumped.
>

I see.

> Unfortunately, _thread.scm seems to be beyond my ability to grasp  
> even after having read your paper.  If you could take a look at it  
> and at least point me somewhat in the right direction (like exactly  
> where the final ##os-condvar-select before the hang is in code),  
> I'd appreciate it.
>
> I have attached the log that it generated just before the hang.  Be  
> aware that while I try to make sure that everything gets out to  
> flash, sometimes it misses a line.  Also, the "E" at the end of the  
> line indicates that it successfully returned from the subprocedure.
>

My best guess is that the function ___device_select in lib/os_io.c,  
which implements a timed blocking on a set of devices, must be  
returning an error.  I assume that you want to implement this later,  
so for now you could change the last section of the function  
___os_condvar_select in the same file to this:

   e = ___FIX(___NO_ERR); /* instead of ___device_select (devs,  
read_pos, MAX_CONDVARS-write_pos, to) */

   i = 0;

   while (i < read_pos)
     {
       condvar = condvars[i];
       ___FIELD(condvar,___BTQ_OWNER) |= ___FIX(1);
       i++;
     }

   j = MAX_CONDVARS;

   while (j > write_pos)
     {
       j--;
       condvar = condvars[j];
       ___FIELD(condvar,___BTQ_OWNER) |= ___FIX(1);
       i++;
     }

   return e;
}

>> Try: (time->seconds (current-time)) .  The value returned is the  
>> number of seconds since January 1, 1970.
>
> Works fine.  Thanks for the test.
>
>> #define ___INT_TIME_REPRESENTATION
>
> Already done.  I had to fix up the main system a bit, though.
>
> However, ___set_heartbeat_interval still demands floats.  I'll fix  
> that later.

Does the Nintendo DS have floating point emulation?  You need  
floating point for some things (like gathering GC statistics,  
reporting time and bignum multiplication of large numbers).  Floating  
point operations are not used in time critical parts of Gambit.

Marc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)

iD8DBQFFQNKN//V9Zc2T/v4RAnYOAJ9jpNvSL7gzUfr4/6uIUlyPsobeowCglceF
K3m4MwxmkqPuDaSIYlVAY7U=
=SDn1
-----END PGP SIGNATURE-----



More information about the Gambit-list mailing list