Re: Implemenation of Global Variables
- From: "Neng-Fa Zhou" <nzhou@xxxxxxx>
- Date: Thu, 23 Nov 2006 15:36:43 -0500
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
.
- Follow-Ups:
- Re: Implemenation of Global Variables
- From: bart demoen
- Re: Implemenation of Global Variables
- References:
- Implemenation of Global Variables
- From: andy . bartholomew
- Re: Implemenation of Global Variables
- From: bart demoen
- Re: Implemenation of Global Variables
- From: Neng-Fa Zhou
- Re: Implemenation of Global Variables
- From: bart demoen
- Implemenation of Global Variables
- Prev by Date: Re: The n-knights problem
- Next by Date: Re: Implemenation of Global Variables
- Previous by thread: Re: Implemenation of Global Variables
- Next by thread: Re: Implemenation of Global Variables
- Index(es):
Relevant Pages
|
|