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

@@ -431,50 +431,37 @@ YAP_Unify(Term t1, Term t2)
X_API 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);
return _YAP_NewSlots(n);
}
X_API long
YAP_InitSlot(Term t)
{
Int old_slots = IntOfTerm(ASP[0]);
*ASP = t;
ASP--;
ASP[0] = MkIntTerm(old_slots+1);
return((ASP+1)-LCL0);
return _YAP_InitSlot(t);
}
X_API void
YAP_RecoverSlots(int n)
{
Int old_slots = IntOfTerm(ASP[0]);
ASP += n;
ASP[0] = MkIntTerm(old_slots-n);
return _YAP_RecoverSlots(n);
}
X_API Term
YAP_GetFromSlot(long slot)
{
return(Deref(LCL0[slot]));
return _YAP_GetFromSlot(slot);
}
X_API Term *
YAP_AddressFromSlot(long slot)
{
return(LCL0+slot);
return _YAP_AddressFromSlot(slot);
}
X_API void
YAP_PutInSlot(long slot, Term t)
{
LCL0[slot] = t;
_YAP_PutInSlot(slot, t);
}