New update to BEAM engine.
BEAM now uses YAP Indexing (JITI) git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1578 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
489b1a91c2
commit
f8360b6016
45
C/absmi.c
45
C/absmi.c
@ -10,8 +10,12 @@
|
||||
* *
|
||||
* File: absmi.c *
|
||||
* comments: Portable abstract machine interpreter *
|
||||
* Last rev: $Date: 2006-03-03 23:10:47 $,$Author: vsc $ *
|
||||
* Last rev: $Date: 2006-03-24 17:13:41 $,$Author: rslopes $ *
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.196 2006/03/03 23:10:47 vsc
|
||||
* fix MacOSX interrupt handling
|
||||
* fix using Yap files as Yap scripts.
|
||||
*
|
||||
* Revision 1.195 2006/02/01 13:28:56 vsc
|
||||
* bignum support fixes
|
||||
*
|
||||
@ -517,6 +521,22 @@ Yap_absmi(int inp)
|
||||
|
||||
#endif /* PUSH_REGS */
|
||||
|
||||
#ifdef BEAM
|
||||
CELL OLD_B=B;
|
||||
extern PredEntry *bpEntry;
|
||||
if (inp==-9000) {
|
||||
#if PUSH_REGS
|
||||
old_regs = &Yap_REGS;
|
||||
init_absmi_regs(&absmi_regs);
|
||||
Yap_regp = &absmi_regs;
|
||||
#endif
|
||||
PREG=bpEntry->CodeOfPred;
|
||||
JMPNext(); /* go execute instruction at PREG */
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if USE_THREADED_CODE
|
||||
/* absmadr */
|
||||
if (inp > 0) {
|
||||
@ -2867,9 +2887,26 @@ Yap_absmi(int inp)
|
||||
|
||||
#ifdef BEAM
|
||||
extern int eam_am(PredEntry *);
|
||||
Op(run_eam, s);
|
||||
if (!eam_am((PredEntry *) PREG->u.s.s)) FAIL();
|
||||
PREG = NEXTOP(PREG, s);
|
||||
Op(run_eam, os);
|
||||
/*
|
||||
printf("%p - %p - %p \n", &&run_eam, (PredEntry *) PREG->u.os.s, (int *) PREG->u.os.opcw);
|
||||
*/
|
||||
if (inp==-9000) {
|
||||
extern CELL *beam_ALTERNATIVES;
|
||||
*beam_ALTERNATIVES= (CELL *) PREG->u.os.opcw;
|
||||
beam_ALTERNATIVES++;
|
||||
if (OLD_B!=B) goto fail;
|
||||
#if PUSH_REGS
|
||||
Yap_regp=old_regs;
|
||||
#endif
|
||||
return(0);
|
||||
}
|
||||
|
||||
saveregs();
|
||||
if (!eam_am((PredEntry *) PREG->u.os.s)) FAIL();
|
||||
setregs();
|
||||
goto procceed;
|
||||
PREG = NEXTOP(PREG, os);
|
||||
GONext();
|
||||
ENDOp();
|
||||
#endif
|
||||
|
26
C/amasm.c
26
C/amasm.c
@ -11,8 +11,13 @@
|
||||
* File: amasm.c *
|
||||
* comments: abstract machine assembler *
|
||||
* *
|
||||
* Last rev: $Date: 2006-01-02 02:16:17 $ *
|
||||
* Last rev: $Date: 2006-03-24 17:13:41 $ *
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.86 2006/01/02 02:16:17 vsc
|
||||
* support new interface between YAP and GMP, so that we don't rely on our own
|
||||
* allocation routines.
|
||||
* Several big fixes.
|
||||
*
|
||||
* Revision 1.85 2005/12/17 03:25:39 vsc
|
||||
* major changes to support online event-based profiling
|
||||
* improve error discovery and restart on scanner.
|
||||
@ -125,6 +130,9 @@ static char SccsId[] = "@(#)amasm.c 1.3 3/15/90";
|
||||
#include "yapio.h"
|
||||
#include "compile.h"
|
||||
#include "clause.h"
|
||||
#ifdef BEAM
|
||||
#include"eam.h"
|
||||
#endif
|
||||
#ifdef YAPOR
|
||||
#include "or.macros.h"
|
||||
#endif /* YAPOR */
|
||||
@ -694,6 +702,20 @@ a_n(op_numbers opcode, int count, yamop *code_p, int pass_no)
|
||||
return code_p;
|
||||
}
|
||||
|
||||
#ifdef BEAM
|
||||
inline static yamop *
|
||||
a_eam(op_numbers opcode, int pred, long cl, yamop *code_p, int pass_no)
|
||||
{
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op(opcode);
|
||||
code_p->u.os.opcw = cl;
|
||||
code_p->u.os.s = pred;
|
||||
}
|
||||
GONEXT(os);
|
||||
return code_p;
|
||||
}
|
||||
#endif
|
||||
|
||||
inline static yamop *
|
||||
a_un(op_numbers opcode, op_numbers opcodew, int count, yamop *code_p, int pass_no)
|
||||
{
|
||||
@ -3130,7 +3152,7 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
|
||||
case endgoal_op:
|
||||
break;
|
||||
case run_op:
|
||||
code_p=a_n(_run_eam,cip->cpc->rnd2,code_p,pass_no);
|
||||
code_p=a_eam(_run_eam,cip->cpc->rnd2,(long) ((PredEntry *) cip->cpc->rnd2)->beamTable->last, code_p,pass_no);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
17
C/compiler.c
17
C/compiler.c
@ -11,8 +11,12 @@
|
||||
* File: compiler.c *
|
||||
* comments: Clause compiler *
|
||||
* *
|
||||
* Last rev: $Date: 2005-12-17 03:25:39 $,$Author: vsc $ *
|
||||
* Last rev: $Date: 2006-03-24 17:13:41 $,$Author: rslopes $ *
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.70 2005/12/17 03:25:39 vsc
|
||||
* major changes to support online event-based profiling
|
||||
* improve error discovery and restart on scanner.
|
||||
*
|
||||
* Revision 1.69 2005/09/08 22:06:44 rslopes
|
||||
* BEAM for YAP update...
|
||||
*
|
||||
@ -1867,10 +1871,20 @@ c_head(Term t, compiler_struct *cglobs)
|
||||
cglobs->branch_pointer = cglobs->parent_branches;
|
||||
if (IsAtomTerm(t)) {
|
||||
Yap_emit(name_op, (CELL) AtomOfTerm(t), Zero, &cglobs->cint);
|
||||
#ifdef BEAM
|
||||
if (EAM) {
|
||||
Yap_emit(run_op,Zero,(unsigned long) cglobs->cint.CurrentPred,&cglobs->cint);
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
f = FunctorOfTerm(t);
|
||||
Yap_emit(name_op, (CELL) NameOfFunctor(f), ArityOfFunctor(f), &cglobs->cint);
|
||||
#ifdef BEAM
|
||||
if (EAM) {
|
||||
Yap_emit(run_op,Zero,(unsigned long) cglobs->cint.CurrentPred,&cglobs->cint);
|
||||
}
|
||||
#endif
|
||||
c_args(t, 0, cglobs);
|
||||
}
|
||||
|
||||
@ -3108,6 +3122,7 @@ Yap_cclause(volatile Term inp_clause, int NOfArgs, int mod, volatile Term src)
|
||||
}
|
||||
cglobs.is_a_fact = (body == MkAtomTerm(AtomTrue));
|
||||
/* phase 1 : produce skeleton code and variable information */
|
||||
|
||||
c_head(head, &cglobs);
|
||||
|
||||
if (cglobs.is_a_fact && !cglobs.vtable) {
|
||||
|
32
C/index.c
32
C/index.c
@ -11,8 +11,11 @@
|
||||
* File: index.c *
|
||||
* comments: Indexing a Prolog predicate *
|
||||
* *
|
||||
* Last rev: $Date: 2006-03-22 20:07:28 $,$Author: vsc $ *
|
||||
* Last rev: $Date: 2006-03-24 17:13:41 $,$Author: rslopes $ *
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.159 2006/03/22 20:07:28 vsc
|
||||
* take better care of zombies
|
||||
*
|
||||
* Revision 1.158 2006/03/21 21:30:54 vsc
|
||||
* avoid looking around when expanding for statics too.
|
||||
*
|
||||
@ -2309,11 +2312,15 @@ add_info(ClauseDef *clause, UInt regno)
|
||||
case _trie_try_long:
|
||||
case _trie_retry_long:
|
||||
#endif /* TABLING */
|
||||
#ifdef BEAM
|
||||
case _run_eam:
|
||||
#endif
|
||||
clause->Tag = (CELL)NULL;
|
||||
return;
|
||||
#ifdef BEAM
|
||||
case _run_eam:
|
||||
// clause->Tag = (CELL)NULL;
|
||||
cl = NEXTOP(cl,os);
|
||||
break;
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2327,6 +2334,11 @@ add_head_info(ClauseDef *clause, UInt regno)
|
||||
while (TRUE) {
|
||||
op_numbers op = Yap_op_from_opcode(cl->opc);
|
||||
switch (op) {
|
||||
#ifdef BEAM
|
||||
case _run_eam:
|
||||
cl = NEXTOP(cl,os);
|
||||
break;
|
||||
#endif
|
||||
case _get_list:
|
||||
if (cl->u.x.x == iarg) {
|
||||
clause->Tag = AbsPair(NULL);
|
||||
@ -2919,7 +2931,12 @@ add_arg_info(ClauseDef *clause, PredEntry *ap, UInt argno)
|
||||
break;
|
||||
case _pop_n:
|
||||
cl = NEXTOP(cl,s);
|
||||
break;
|
||||
break;
|
||||
#ifdef BEAM
|
||||
case _run_eam:
|
||||
cl = NEXTOP(cl,os);
|
||||
break;
|
||||
#endif
|
||||
case _unify_idb_term:
|
||||
case _copy_idb_term:
|
||||
{
|
||||
@ -2971,6 +2988,11 @@ skip_to_arg(ClauseDef *clause, PredEntry *ap, UInt argno, int at_point)
|
||||
while (!done) {
|
||||
op_numbers op = Yap_op_from_opcode(cl->opc);
|
||||
switch (op) {
|
||||
#ifdef BEAM
|
||||
case _run_eam:
|
||||
clause->CurrentCode = clause->Code;
|
||||
return;
|
||||
#endif
|
||||
case _unify_void:
|
||||
if (argno == 1) {
|
||||
clause->CurrentCode = clause->Code;
|
||||
|
Reference in New Issue
Block a user