Re: Implemenation of Global Variables



Your micro is the best explanation. The idea is interesting but the overhead
is too big. You need to sacrifice a heap word each time an update is
trailed. Noya trailing does not seem to work for bit vectors, an important
type in CLP(FD), since the content of a location may happen to have the ref
tag.

B-Prolog adopts the naive trailing scheme. The trail stack is compacted
before its space runs out.

Cheers,
Neng-Fa


"bart demoen" <bmd@xxxxxxxxxxxxxx> wrote in message
news:pan.2006.11.22.16.24.11.193765@xxxxxxxxxxxxxxxxx
On Wed, 22 Nov 2006 10:28:44 -0500, Neng-Fa Zhou wrote:


Do you know any papers on Noye trailing? I am curious about how it works.

I don't know about any papers describing Noye trailing - Jacques' thesis
has it of course. To satisfy your curiosity, here is the hProlog macro
iomplementing it - it should be self-explaining, but just ask if something
is not clear (I have removed some irrelevant overflow checking and type
casting):

#define noye_trail(loc,bh,trreg,newval) \
if (loc >= bh) \
*loc = newval; \
else \
{ if (!is_ref(*loc) || (*loc) < bh)) \
{ *trreg++ = *loc; /* old value */ \
*trreg++ = loc; /* location */ \
} \
*loc = hreg; \
*hreg = newval; \
hreg++; \
}


Cheers

Bart Demoen


.



Relevant Pages

  • Re: Implemenation of Global Variables
    ... I don't know about any papers describing Noye trailing - Jacques' thesis ... *loc = newval; \ ... *hreg = newval; \ ... to create the extra indirection. ...
    (comp.lang.prolog)
  • Re: Implemenation of Global Variables
    ... here is the hProlog macro ... iomplementing it - it should be self-explaining, ... *loc = newval; \ ... *hreg = newval; \ ...
    (comp.lang.prolog)
  • Re: Implemenation of Global Variables
    ... bart demoen wrote: if (loc>= bh) \ ... *hreg = newval; \ ... to create the extra indirection. ... boxed constant on the heap etc. ...
    (comp.lang.prolog)
  • Re: Implemenation of Global Variables
    ... here is the hProlog macro ... is not clear (I have removed some irrelevant overflow checking and type ... *loc = newval; \ ... *hreg = newval; \ ...
    (comp.lang.prolog)