don't try to do module expansion if module borders are not crossed.

expand on-line depth_call and once.
improve write_x_loc


git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@752 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc
2003-01-30 16:27:45 +00:00
parent 1369dfa410
commit f5dad3ac1f
7 changed files with 88 additions and 36 deletions

View File

@@ -5396,10 +5396,10 @@ Yap_absmi(int inp)
Op(write_x_loc, x);
BEGD(d0);
d0 = XREG(PREG->u.x.x);
PREG = NEXTOP(PREG, x);
deref_head(d0, w_x_unk);
w_x_bound:
*SREG++ = d0;
PREG = NEXTOP(PREG, x);
GONext();
BEGP(pt0);
@@ -5409,7 +5409,6 @@ Yap_absmi(int inp)
#else
if (pt0 > H) {
#endif
PREG = NEXTOP(PREG, x);
/* local variable: let us bind it to the list */
#ifdef FROZEN_STACKS /* TRAIL */
Bind_Local(pt0, Unsigned(SREG));
@@ -5422,7 +5421,6 @@ Yap_absmi(int inp)
GONext();
}
else {
PREG = NEXTOP(PREG, x);
*SREG++ = Unsigned(pt0);
GONext();
}
@@ -11801,8 +11799,8 @@ Yap_absmi(int inp)
goto execute_metacall;
ENDP(pt1);
ENDD(d1);
} else {
goto execute_metacall;
} else if (mod != CurrentModule) {
goto execute_metacall;
}
}
if (PRED_GOAL_EXPANSION_ON) {
@@ -11990,7 +11988,12 @@ Yap_absmi(int inp)
goto execute_comma;
}
} else {
goto execute_metacall_after_comma;
if (mod != CurrentModule)
goto execute_metacall_after_comma;
else {
arity = pen->ArityOfPE;
goto execute_comma;
}
}
BEGP(pt1);
@@ -12004,12 +12007,14 @@ Yap_absmi(int inp)
ENDP(pt1);
ENDD(d1);
} else {
execute_metacall_after_comma:
ARG1 = ARG3 = d0;
pen = PredMetaCall;
ARG2 = Yap_cp_as_integer((choiceptr)ENV[E_CB]);
ARG4 = ModuleName[mod];
goto execute_after_comma;
if (mod != CurrentModule) {
execute_metacall_after_comma:
ARG1 = ARG3 = d0;
pen = PredMetaCall;
ARG2 = Yap_cp_as_integer((choiceptr)ENV[E_CB]);
ARG4 = ModuleName[mod];
goto execute_after_comma;
}
}
}
execute_comma:

View File

@@ -51,10 +51,29 @@ static Int p_set_depth_limit(void)
return(TRUE);
}
static Int p_set_depth_limit_for_next_call(void)
{
Term d = Deref(ARG1);
if (IsVarTerm(d)) {
Yap_Error(INSTANTIATION_ERROR, d, "set-depth_limit");
return(FALSE);
} else if (!IsIntegerTerm(d)) {
Yap_Error(TYPE_ERROR_INTEGER, d, "set-depth_limit");
return(FALSE);
}
d = MkIntTerm(IntegerOfTerm(d)*2);
DEPTH = d;
return(TRUE);
}
void Yap_InitItDeepenPreds(void)
{
Yap_InitCPred("get_depth_limit", 1, p_get_depth_limit, SafePredFlag);
Yap_InitCPred("$set_depth_limit", 1, p_set_depth_limit, 0);
Yap_InitCPred("$set_depth_limit_for_next_call", 1, p_set_depth_limit_for_next_call, 0);
}
#endif

View File

@@ -262,7 +262,7 @@ do_execute(Term t, SMALLUNSGN mod)
YENV[-EnvSizeInCells-2] = MkIntegerTerm((Int)PredPropByFunc(f,mod));
}
} else {
return CallMetaCall(mod);
return CallMetaCall(mod);
}
YENV[E_CP] = (CELL)P;
YENV[E_CB] = (CELL)B;
@@ -277,9 +277,10 @@ do_execute(Term t, SMALLUNSGN mod)
P = NEXTOP(COMMA_CODE,sla);
t = ArgOfTerm(1,t);
goto restart_exec;
}
} else if (mod != CurrentModule) {
return(CallMetaCall(mod));
}
}
/* now let us do what we wanted to do from the beginning !! */
/* I cannot use the standard macro here because
otherwise I would dereference the argument and
@@ -384,7 +385,8 @@ p_execute_within(void)
goto restart_exec;
}
}
return(CallMetaCallWithin(mod, B));
if (mod != CurrentModule)
return(CallMetaCallWithin(mod, B));
}
/* at this point check if we should enter creep mode */
if (yap_flags[SPY_CREEP_FLAG]) {
@@ -1733,7 +1735,7 @@ Yap_InitExecFs(void)
Yap_InitCPred("$call_with_args", 11, p_execute_9, 0);
Yap_InitCPred("$call_with_args", 12, p_execute_10, 0);
#ifdef DEPTH_LIMIT
Yap_InitCPred("$execute_under_depth_limit", 2, p_execute_depth_limit, 0);
Yap_InitCPred("depth_bound_call", 2, p_execute_depth_limit, 0);
#endif
Yap_InitCPred("$execute0", 2, p_execute0, 0);
Yap_InitCPred("$save_current_choice_point", 1, p_save_cp, 0);

View File

@@ -14,10 +14,6 @@
* comments: Prolog's scanner *
* *
*************************************************************************/
#ifdef SCCS
static char SccsId[] = "@(#)scanner.c 1.2";
#endif
/*
* Description: