try to improve slot allocation.
This commit is contained in:
parent
9e63e83f1f
commit
b34c8b1b2c
@ -2255,14 +2255,12 @@ YAP_AtomToPred(Atom at)
|
||||
X_API PredEntry *
|
||||
YAP_FunctorToPredInModule(Functor func, Term mod)
|
||||
{
|
||||
CACHE_REGS
|
||||
return RepPredProp(PredPropByFunc(func, mod));
|
||||
}
|
||||
|
||||
X_API PredEntry *
|
||||
YAP_AtomToPredInModule(Atom at, Term mod)
|
||||
{
|
||||
CACHE_REGS
|
||||
return RepPredProp(PredPropByAtom(at, mod));
|
||||
}
|
||||
|
||||
@ -2434,7 +2432,6 @@ YAP_RunGoal(Term t)
|
||||
LOCAL_AllowRestart = FALSE;
|
||||
}
|
||||
|
||||
|
||||
RECOVER_MACHINE_REGS();
|
||||
return out;
|
||||
}
|
||||
@ -2562,6 +2559,8 @@ YAP_RestartGoal(void)
|
||||
if (LOCAL_AllowRestart) {
|
||||
P = (yamop *)FAILCODE;
|
||||
LOCAL_PrologMode = UserMode;
|
||||
// exec_absmi destroys slots on top of stack....
|
||||
Yap_CloseSlots( PASS_REGS1 );
|
||||
out = Yap_exec_absmi(TRUE);
|
||||
LOCAL_PrologMode = UserCCallMode;
|
||||
if (out == FALSE) {
|
||||
|
33
H/Yap.h
33
H/Yap.h
@ -850,22 +850,6 @@ Yap_StartSlots( USES_REGS1 ) {
|
||||
CurSlot = LCL0-ASP;
|
||||
}
|
||||
|
||||
static inline void
|
||||
Yap_CloseSlots( USES_REGS1 ) {
|
||||
Int old_slots;
|
||||
if (CurSlot < LCL0-ASP)
|
||||
return;
|
||||
old_slots = IntOfTerm(ASP[0]);
|
||||
ASP += (old_slots+1);
|
||||
CurSlot = IntOfTerm(*ASP);
|
||||
ASP++;
|
||||
}
|
||||
|
||||
static inline Int
|
||||
Yap_CurrentSlot( USES_REGS1 ) {
|
||||
return IntOfTerm(ASP[0]);
|
||||
}
|
||||
|
||||
/* pop slots when pruning */
|
||||
static inline void
|
||||
Yap_PopSlots( USES_REGS1 ) {
|
||||
@ -878,6 +862,23 @@ Yap_PopSlots( USES_REGS1 ) {
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
Yap_CloseSlots( USES_REGS1 ) {
|
||||
Int old_slots;
|
||||
Yap_PopSlots( PASS_REGS1 );
|
||||
if (LCL0-CurSlot == ASP) {
|
||||
old_slots = IntOfTerm(ASP[0]);
|
||||
ASP += (old_slots+1);
|
||||
CurSlot = IntOfTerm(*ASP);
|
||||
ASP++;
|
||||
}
|
||||
}
|
||||
|
||||
static inline Int
|
||||
Yap_CurrentSlot( USES_REGS1 ) {
|
||||
return IntOfTerm(ASP[0]);
|
||||
}
|
||||
|
||||
static inline Term
|
||||
Yap_GetFromSlot(Int slot USES_REGS)
|
||||
{
|
||||
|
Reference in New Issue
Block a user