try to improve slot allocation.

This commit is contained in:
Vitor Santos Costa 2012-12-10 12:14:24 +00:00
parent 9e63e83f1f
commit b34c8b1b2c
2 changed files with 19 additions and 19 deletions

View File

@ -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));
}
@ -2433,7 +2431,6 @@ YAP_RunGoal(Term t)
B = B->cp_b;
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
View File

@ -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)
{