From 87a481ca450daf45f1660d7b25e40d6c5d94f1be Mon Sep 17 00:00:00 2001 From: rslopes Date: Thu, 27 Apr 2006 14:13:24 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1612 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- C/absmi.c | 51 +++++++++++++++++++++++++++++++++++++++++++++----- C/cdmgr.c | 8 +++++++- C/index.c | 9 ++++++++- C/init.c | 3 +++ H/Heap.h | 8 +++++++- H/YapOpcodes.h | 7 ++++++- H/rclause.h | 9 ++++++++- 7 files changed, 85 insertions(+), 10 deletions(-) diff --git a/C/absmi.c b/C/absmi.c index b9adaf55b..e4b68d643 100644 --- a/C/absmi.c +++ b/C/absmi.c @@ -10,8 +10,11 @@ * * * File: absmi.c * * comments: Portable abstract machine interpreter * -* Last rev: $Date: 2006-04-12 17:14:58 $,$Author: rslopes $ * +* Last rev: $Date: 2006-04-27 14:11:57 $,$Author: rslopes $ * * $Log: not supported by cvs2svn $ +* Revision 1.200 2006/04/12 17:14:58 rslopes +* fix needed by the EAM engine +* * Revision 1.199 2006/04/12 15:51:23 rslopes * small fixes * @@ -2898,11 +2901,21 @@ Yap_absmi(int inp) #ifdef BEAM extern int eam_am(PredEntry *); + + Op(retry_eam, e); + printf("Aqui estou eu..................\n"); + if (!eam_am(2)) { + abort_eam("Falhei\n"); + FAIL(); + } + + goto procceed; + PREG = NEXTOP(PREG, e); + GONext(); + ENDOp(); + Op(run_eam, os); -/* - printf("%p - %p - %p \n", &&run_eam, (PredEntry *) PREG->u.os.s, (int *) PREG->u.os.opcw); -*/ - if (inp==-9000) { + if (inp==-9000) { /* usar a indexação para saber quais as alternativas validas */ extern CELL *beam_ALTERNATIVES; *beam_ALTERNATIVES= (CELL *) PREG->u.os.opcw; beam_ALTERNATIVES++; @@ -2916,6 +2929,34 @@ Yap_absmi(int inp) saveregs(); if (!eam_am((PredEntry *) PREG->u.os.s)) FAIL(); setregs(); + + /* cut */ + BACKUP_B(); +#ifdef CUT_C + while (POP_CHOICE_POINT(B->cp_b)) { + POP_EXECUTE(); + } +#endif /* CUT_C */ + B = B->cp_b; /* cut_fail */ + HB = B->cp_h; /* cut_fail */ + RECOVER_B(); + + if (0) { register choiceptr ccp; + /* initialize ccp */ +#define NORM_CP(CP) ((choiceptr)(CP)) + + YENV = (CELL *) (NORM_CP(YENV) - 1); + ccp = NORM_CP(YENV); + store_yaam_reg_cpdepth(ccp); + ccp->cp_tr = TR; + ccp->cp_ap = BEAM_RETRY_CODE; + ccp->cp_h = H; + ccp->cp_b = B; + ccp->cp_env= ENV; + ccp->cp_cp = CPREG; + B = ccp; + SET_BB(B); + } goto procceed; PREG = NEXTOP(PREG, os); GONext(); diff --git a/C/cdmgr.c b/C/cdmgr.c index f069eeef9..4221310b6 100644 --- a/C/cdmgr.c +++ b/C/cdmgr.c @@ -11,8 +11,11 @@ * File: cdmgr.c * * comments: Code manager * * * -* Last rev: $Date: 2006-03-29 16:00:10 $,$Author: vsc $ * +* Last rev: $Date: 2006-04-27 14:11:57 $,$Author: rslopes $ * * $Log: not supported by cvs2svn $ +* Revision 1.183 2006/03/29 16:00:10 vsc +* make tabling compile +* * Revision 1.182 2006/03/24 16:26:26 vsc * code review * @@ -3743,6 +3746,9 @@ ClauseInfoForCode(yamop *codeptr, CODEADDR *startp, CODEADDR *endp) { case _write_list: case _write_l_list: case _pop: +#ifdef BEAM + case _retry_eam: +#endif #if THREADS case _thread_local: #endif diff --git a/C/index.c b/C/index.c index 79fddf0b2..a953f36c5 100644 --- a/C/index.c +++ b/C/index.c @@ -11,8 +11,11 @@ * File: index.c * * comments: Indexing a Prolog predicate * * * -* Last rev: $Date: 2006-04-20 15:28:08 $,$Author: vsc $ * +* Last rev: $Date: 2006-04-27 14:10:36 $,$Author: rslopes $ * * $Log: not supported by cvs2svn $ +* Revision 1.163 2006/04/20 15:28:08 vsc +* more graph stuff. +* * Revision 1.162 2006/04/12 18:56:50 vsc * fix bug in clause: a trust_me followed by a try should be implemented by * reusing the choice-point. @@ -2330,6 +2333,10 @@ add_info(ClauseDef *clause, UInt regno) // clause->Tag = (CELL)NULL; cl = NEXTOP(cl,os); break; + case _retry_eam: + cl = NEXTOP(cl,e); + break; + #endif } diff --git a/C/init.c b/C/init.c index c764fe069..5c951111b 100644 --- a/C/init.c +++ b/C/init.c @@ -869,6 +869,9 @@ InitCodes(void) Yap_heap_regs->charsio_module = MkAtomTerm(Yap_LookupAtom("charsio")); Yap_heap_regs->terms_module = MkAtomTerm(Yap_LookupAtom("terms")); Yap_InitModules(); +#ifdef BEAM + Yap_heap_regs->beam_retry_code.opc = Yap_opcode(_retry_eam); +#endif #ifdef YAPOR Yap_heap_regs->seq_def = TRUE; Yap_heap_regs->getwork_code.opc = Yap_opcode(_getwork); diff --git a/H/Heap.h b/H/Heap.h index fbad01f73..4e5d525bb 100644 --- a/H/Heap.h +++ b/H/Heap.h @@ -10,7 +10,7 @@ * File: Heap.h * * mods: * * comments: Heap Init Structure * -* version: $Id: Heap.h,v 1.94 2006-03-30 01:11:10 vsc Exp $ * +* version: $Id: Heap.h,v 1.95 2006-04-27 14:13:24 rslopes Exp $ * *************************************************************************/ /* information that can be stored in Code Space */ @@ -182,6 +182,9 @@ typedef struct various_codes { #else worker_local wl; #endif +#ifdef BEAM + yamop beam_retry_code; +#endif /* BEAM */ #ifdef YAPOR int seq_def; yamop getwork_code; @@ -525,6 +528,9 @@ struct various_codes *Yap_heap_regs; #define GETWORK_SEQ (&(Yap_heap_regs->getwork_seq_code)) #define GETWORK_FIRST_TIME (&(Yap_heap_regs->getwork_first_time_code)) #endif /* YAPOR */ +#ifdef BEAM +#define BEAM_RETRY_CODE ((yamop *)&(Yap_heap_regs->beam_retry_code)) +#endif /* BEAM */ #ifdef TABLING #define LOAD_ANSWER ((yamop *)&(Yap_heap_regs->table_load_answer_code)) #define TRY_ANSWER ((yamop *)&(Yap_heap_regs->table_try_answer_code)) diff --git a/H/YapOpcodes.h b/H/YapOpcodes.h index f506db2a0..4439ce31b 100644 --- a/H/YapOpcodes.h +++ b/H/YapOpcodes.h @@ -11,8 +11,12 @@ * File: YapOpcodes.h * * comments: Central Table with all YAP opcodes * * * -* Last rev: $Date: 2006-03-24 16:34:21 $ * +* Last rev: $Date: 2006-04-27 14:13:24 $ * * $Log: not supported by cvs2svn $ +* Revision 1.37 2006/03/24 16:34:21 rslopes +* New update to BEAM engine. +* BEAM now uses YAP Indexing (JITI) +* * Revision 1.36 2005/12/17 03:25:39 vsc * major changes to support online event-based profiling * improve error discovery and restart on scanner. @@ -212,6 +216,7 @@ OPCODE(or_last ,p), #endif /* YAPOR */ #ifdef BEAM + OPCODE(retry_eam ,e), OPCODE(run_eam ,os), #endif OPCODE(call_cpred ,sla), diff --git a/H/rclause.h b/H/rclause.h index 049a48a49..1ea7fb3c6 100644 --- a/H/rclause.h +++ b/H/rclause.h @@ -12,8 +12,12 @@ * File: rclause.h * * comments: walk through a clause * * * -* Last rev: $Date: 2005-12-17 03:25:39 $,$Author: vsc $ * +* Last rev: $Date: 2006-04-27 14:13:24 $,$Author: rslopes $ * * $Log: not supported by cvs2svn $ +* Revision 1.14 2005/12/17 03:25:39 vsc +* major changes to support online event-based profiling +* improve error discovery and restart on scanner. +* * Revision 1.13 2005/11/24 15:35:29 tiagosoares * removed some compilation warnings related to the cut-c code * @@ -229,6 +233,9 @@ restore_opcodes(yamop *pc) case _write_l_list: case _pop: case _index_pred: +#ifdef BEAM + case _retry_eam: +#endif #if THREADS case _thread_local: #endif