YAP would break when gc was called from portray:

always save arguments before calling plwrite with possible portray
 only do it for portray because plwrite may be called from unsafe environments
 make Slot machinery mainstream.


git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@637 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc
2002-10-17 00:05:29 +00:00
parent 78923655b5
commit 153b2cb2a3
11 changed files with 219 additions and 42 deletions

View File

@@ -671,3 +671,54 @@ ArgsOfSFTerm(Term t)
}
#endif
long
_YAP_NewSlots(int n)
{
Int old_slots = IntOfTerm(ASP[0]), oldn = n;
while (n > 0) {
RESET_VARIABLE(ASP);
ASP--;
n--;
}
ASP[0] = MkIntTerm(old_slots+oldn);
return((ASP+1)-LCL0);
}
long
_YAP_InitSlot(Term t)
{
Int old_slots = IntOfTerm(ASP[0]);
*ASP = t;
ASP--;
ASP[0] = MkIntTerm(old_slots+1);
return((ASP+1)-LCL0);
}
void
_YAP_RecoverSlots(int n)
{
Int old_slots = IntOfTerm(ASP[0]);
ASP += n;
ASP[0] = MkIntTerm(old_slots-n);
}
Term
_YAP_GetFromSlot(long slot)
{
return(Deref(LCL0[slot]));
}
Term *
_YAP_AddressFromSlot(long slot)
{
return(LCL0+slot);
}
void
_YAP_PutInSlot(long slot, Term t)
{
LCL0[slot] = t;
}