more simplifications on the catch and throw mechanism after

having failed the ISO testset.


git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@341 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc
2002-01-30 03:49:50 +00:00
parent af7cb4cd93
commit f9ff6498d8
4 changed files with 25 additions and 21 deletions

View File

@@ -1252,24 +1252,28 @@ p_clean_ifcp(void) {
Int
JumpToEnv(Term t) {
yamop *min = (yamop *)(PredCatch->CodeOfPred);
yamop *max = (yamop *)(PredThrow->CodeOfPred);
CELL *cur = ENV, *env;
yamop *cpe = (yamop *)(cur[E_CP]);
yamop *pos = (yamop *)(PredDollarCatch->LastClause);
CELL *env;
while (cpe < min || cpe > max) {
cur = (CELL *)cur[E_E];
cpe = (yamop *)(cur[E_CP]);
}
CP = cpe;
env = (CELL *)cur[E_E];
YENV = ENV = (CELL *)(env[E_E]);
while (B->cp_b < (choiceptr)env) {
do {
/* find the first choicepoint that may be a catch */
while (B->cp_ap != pos) {
B = B->cp_b;
}
/* is it a continuation? */
env = B->cp_env;
while (env > ENV)
ENV = (CELL *)ENV[E_E];
/* yes, we found it ! */
if (env == ENV) break;
/* oops, try next */
B = B->cp_b;
}
B->cp_cp = (yamop *)(env[E_CP]);
} while (TRUE);
/* step one environment above */
B->cp_cp = (yamop *)env[E_CP];
B->cp_ap = (yamop *)(PredHandleThrow->LastClause);
B->cp_env = ENV;
B->cp_env = (CELL *)env[E_E];
/* cannot recover Heap because of copy term :-( */
B->cp_h = H;
/* I could backtrack here, but it is easier to leave the unwinding
to the emulator */

View File

@@ -1012,7 +1012,7 @@ InitCodes(void)
CurrentModule = 0;
heap_regs->dead_clauses = NULL;
heap_regs->pred_meta_call = RepPredProp(PredPropByFunc(MkFunctor(heap_regs->atom_meta_call,4),0));
heap_regs->pred_catch = RepPredProp(PredPropByFunc(MkFunctor(LookupAtom("catch"),3),0));
heap_regs->pred_dollar_catch = RepPredProp(PredPropByFunc(MkFunctor(LookupAtom("$catch"),3),0));
heap_regs->pred_throw = RepPredProp(PredPropByFunc(FunctorThrow,0));
heap_regs->pred_handle_throw = RepPredProp(PredPropByFunc(MkFunctor(LookupAtom("$handle_throw"),3),0));
ReleaseAtom(AtomOfTerm(heap_regs->term_refound_var));

View File

@@ -1122,8 +1122,8 @@ restore_codes(void)
(PredEntry *)AddrAdjust((ADDR)heap_regs->pred_goal_expansion);
heap_regs->pred_meta_call =
(PredEntry *)AddrAdjust((ADDR)heap_regs->pred_meta_call);
heap_regs->pred_catch =
(PredEntry *)AddrAdjust((ADDR)heap_regs->pred_catch);
heap_regs->pred_dollar_catch =
(PredEntry *)AddrAdjust((ADDR)heap_regs->pred_dollar_catch);
heap_regs->pred_throw =
(PredEntry *)AddrAdjust((ADDR)heap_regs->pred_throw);
heap_regs->pred_handle_throw =