JIT
This commit is contained in:
parent
61d6015d76
commit
bece9d05d8
13
C/absmi.c
13
C/absmi.c
|
@ -620,7 +620,7 @@ push_live_regs(yamop *pco)
|
|||
|
||||
#if defined(ANALYST) || defined(DEBUG)
|
||||
|
||||
char *Yap_op_names[_std_top + 1] =
|
||||
char *Yap_op_names[] =
|
||||
{
|
||||
#define OPCODE(OP,TYPE) #OP
|
||||
#include "YapOpcodes.h"
|
||||
|
@ -1571,7 +1571,7 @@ Yap_absmi(int inp)
|
|||
struct timeval timstart, timend;
|
||||
struct rusage rustart, ruend;
|
||||
#endif
|
||||
static void *control_labels[] = { &&fail, &&NoStackCut, &&NoStackCommitY, &&NoStackCutT, &&NoStackEither, &&NoStackExecute, &&NoStackCall, &&NoStackDExecute, &&NoStackDeallocate, &¬railleft, &&NoStackFail, &&NoStackCommitX, &&dospy };
|
||||
static void *control_labels[] = { &&fail, &&NoStackCut, &&NoStackCommitY, &&NoStackCutT, &&NoStackEither, &&NoStackExecute, &&NoStackCall, &&NoStackDExecute, &&NoStackDeallocate, &¬railleft, &&NoStackFail, &&NoStackCommitX };
|
||||
curtrace = NULL;
|
||||
curpreg = NULL;
|
||||
globalcurblock = NULL;
|
||||
|
@ -1799,7 +1799,14 @@ Yap_absmi(int inp)
|
|||
#include "absmi_insts.h"
|
||||
|
||||
#if YAP_JIT
|
||||
#include "traced_absmi_insts.i"
|
||||
#include "traced_absmi_insts.h"
|
||||
#if YAPOR
|
||||
#include "traced_or.insts.h"
|
||||
#endif
|
||||
#if TABLING
|
||||
#include "traced_tab.insts.h"
|
||||
#include "traced_tab.tries.insts.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !USE_THREADED_CODE
|
||||
|
|
|
@ -65,13 +65,14 @@ BOp(Ystop, l);
|
|||
ENDBOp();
|
||||
#endif
|
||||
|
||||
#include "cp_absmi_insts.c"
|
||||
#include "lu_absmi_insts.c"
|
||||
#include "fail_absmi_insts.c"
|
||||
#include "control_absmi_insts.c"
|
||||
#include "unify_absmi_insts.c"
|
||||
#include "fli_absmi_insts.c"
|
||||
#include "or_absmi_insts.c"
|
||||
#include "index_absmi_insts.c"
|
||||
#include "prim_absmi_insts.c"
|
||||
#include "meta_absmi_insts.c"
|
||||
#include "cp_absmi_insts.h"
|
||||
#include "lu_absmi_insts.h"
|
||||
#include "fail_absmi_insts.h"
|
||||
#include "control_absmi_insts.h"
|
||||
#include "unify_absmi_insts.h"
|
||||
#include "fli_absmi_insts.h"
|
||||
#include "or_absmi_insts.h"
|
||||
#include "index_absmi_insts.h"
|
||||
#include "type_absmi_insts.h"
|
||||
#include "prim_absmi_insts.h"
|
||||
#include "meta_absmi_insts.h"
|
||||
|
|
18
C/amasm.c
18
C/amasm.c
|
@ -1556,21 +1556,6 @@ a_empty_call(clause_info *clinfo, yamop *code_p, int pass_no, struct intermedia
|
|||
return code_p;
|
||||
}
|
||||
|
||||
static yamop *
|
||||
a_cnp(op_numbers opcode, yamop *code_p, int pass_no, struct intermediates *cip)
|
||||
{
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op(opcode);
|
||||
code_p->y_u.aFlp.n = 0;
|
||||
code_p->y_u.aFlp.native = NULL;
|
||||
code_p->y_u.aFlp.native_next = 0;
|
||||
code_p->y_u.aFlp.p = cip->CurrentPred;
|
||||
}
|
||||
GONEXT(aFlp);
|
||||
return code_p;
|
||||
}
|
||||
|
||||
|
||||
static yamop *
|
||||
a_pl(op_numbers opcode, PredEntry *pred, yamop *code_p, int pass_no)
|
||||
{
|
||||
|
@ -3363,9 +3348,6 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
|
|||
case cut_op:
|
||||
code_p = a_cut(&clinfo, code_p, pass_no, cip);
|
||||
break;
|
||||
case native_op:
|
||||
code_p = a_cnp(_native_me, code_p, pass_no, cip);
|
||||
break;
|
||||
case cutexit_op:
|
||||
cip->clause_has_cut = TRUE;
|
||||
if (cip->CurrentPred->PredFlags & LogUpdatePredFlag &&
|
||||
|
|
|
@ -145,7 +145,7 @@ Yap_AllocExternalDataInStack(CELL tag, size_t bytes)
|
|||
MP_INT *dst = (MP_INT *)(HR+2);
|
||||
CELL *ret = HR;
|
||||
|
||||
nlimbs = ALIGN_YAPTYPE(bytes,CELL)/CellSize;
|
||||
nlimbs = ALIGN_BY_TYPE(bytes,CELL)/CellSize;
|
||||
if (nlimbs > (ASP-ret)-1024) {
|
||||
return TermNil;
|
||||
}
|
||||
|
|
|
@ -332,7 +332,9 @@
|
|||
|
||||
#define Bool int
|
||||
#define flt double
|
||||
#define C_INTERFACE
|
||||
#define C_INTERFACE 1
|
||||
#define _yap_c_interface_h 1
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "Yap.h"
|
||||
|
@ -2910,7 +2912,7 @@ do_bootfile (char *bootfilename)
|
|||
}
|
||||
else if (t == term_true)
|
||||
{
|
||||
YAP_Exit(0);
|
||||
Yap_exit(0);
|
||||
}
|
||||
else if (t == term_end_of_file)
|
||||
{
|
||||
|
|
|
@ -224,9 +224,9 @@
|
|||
#ifdef DEPTH_LIMIT
|
||||
if (DEPTH <= MkIntTerm(1)) {/* I assume Module==0 is prolog */
|
||||
if (pt0->ModuleOfPred) {
|
||||
if (DEPTH == MkIntTerm(0))
|
||||
if (DEPTH == MkIntTerm(0)) {
|
||||
FAIL();
|
||||
else DEPTH = RESET_DEPTH();
|
||||
} else { DEPTH = RESET_DEPTH(); }
|
||||
}
|
||||
} else if (pt0->ModuleOfPred)
|
||||
DEPTH -= MkIntConstant(2);
|
||||
|
@ -267,9 +267,11 @@
|
|||
#ifdef DEPTH_LIMIT
|
||||
if (DEPTH <= MkIntTerm(1)) {/* I assume Module==0 is primitives */
|
||||
if (pt0->ModuleOfPred) {
|
||||
if (DEPTH == MkIntTerm(0))
|
||||
if (DEPTH == MkIntTerm(0)) {
|
||||
FAIL();
|
||||
else DEPTH = RESET_DEPTH();
|
||||
} else {
|
||||
DEPTH = RESET_DEPTH();
|
||||
}
|
||||
}
|
||||
} else if (pt0->ModuleOfPred)
|
||||
DEPTH -= MkIntConstant(2);
|
||||
|
@ -353,9 +355,11 @@
|
|||
#ifdef DEPTH_LIMIT
|
||||
if (DEPTH <= MkIntTerm(1)) {/* I assume Module==0 is primitives */
|
||||
if (pt->ModuleOfPred) {
|
||||
if (DEPTH == MkIntTerm(0))
|
||||
if (DEPTH == MkIntTerm(0)) {
|
||||
FAIL();
|
||||
else DEPTH = RESET_DEPTH();
|
||||
} else {
|
||||
DEPTH = RESET_DEPTH();
|
||||
}
|
||||
}
|
||||
} else if (pt->ModuleOfPred)
|
||||
DEPTH -= MkIntConstant(2);
|
||||
|
@ -476,11 +480,11 @@
|
|||
**********************************************/
|
||||
|
||||
#ifdef YAPOR
|
||||
#include "or.insts.i"
|
||||
#include "or.insts.h"
|
||||
#endif /* YAPOR */
|
||||
#ifdef TABLING
|
||||
#include "tab.insts.i"
|
||||
#include "tab.tries.insts.i"
|
||||
#include "tab.insts.h"
|
||||
#include "tab.tries.insts.h"
|
||||
#endif /* TABLING */
|
||||
|
||||
|
||||
|
|
|
@ -100,9 +100,11 @@
|
|||
#ifdef DEPTH_LIMIT
|
||||
if (DEPTH <= MkIntTerm(1)) {/* I assume Module==0 is prolog */
|
||||
if (pt0->ModuleOfPred) {
|
||||
if (DEPTH == MkIntTerm(0))
|
||||
if (DEPTH == MkIntTerm(0)) {
|
||||
FAIL();
|
||||
else DEPTH = RESET_DEPTH();
|
||||
} else{
|
||||
DEPTH = RESET_DEPTH();
|
||||
}
|
||||
}
|
||||
} else if (pt0->ModuleOfPred) {
|
||||
DEPTH -= MkIntConstant(2);
|
||||
|
@ -351,7 +353,7 @@
|
|||
#endif
|
||||
SET_BB(B_YREG);
|
||||
ENDCACHE_Y();
|
||||
LOCAL_PrologMode |= UserCCallMode;
|
||||
LOCAL_PrologMode = UserCCallMode;
|
||||
ASP = YREG;
|
||||
saveregs();
|
||||
save_machine_regs();
|
||||
|
@ -359,7 +361,7 @@
|
|||
EX = NULL;
|
||||
restore_machine_regs();
|
||||
setregs();
|
||||
LOCAL_PrologMode &= ~UserCCallMode;
|
||||
LOCAL_PrologMode &= UserMode;
|
||||
if (!SREG) {
|
||||
FAIL();
|
||||
}
|
||||
|
|
|
@ -1116,8 +1116,10 @@ move_next(ClauseDef *clause, UInt regno)
|
|||
op_numbers op = Yap_op_from_opcode(cl->opc);
|
||||
|
||||
switch (op) {
|
||||
case _native_me:
|
||||
#if YAP_JIT
|
||||
case _jit_handler:
|
||||
return;
|
||||
#endif
|
||||
#if THREADS
|
||||
case _unlock_lu:
|
||||
clause->CurrentCode = NEXTOP(cl,e);
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#ifdef INDENT_CODE
|
||||
{
|
||||
{
|
||||
{
|
||||
#endif /* INDENT_CODE */
|
||||
|
||||
BOp(user_switch, lp);
|
||||
|
|
|
@ -5,9 +5,50 @@
|
|||
#ifdef INDENT_CODE
|
||||
{
|
||||
{
|
||||
{
|
||||
#endif /* INDENT_CODE */
|
||||
|
||||
/************************************************************************\
|
||||
* Logical Updates *
|
||||
\************************************************************************/
|
||||
|
||||
/* enter logical pred */
|
||||
BOp(enter_lu_pred, Illss);
|
||||
check_trail(TR);
|
||||
/* mark the indexing code */
|
||||
{
|
||||
LogUpdIndex *cl = PREG->y_u.Illss.I;
|
||||
PredEntry *ap = cl->ClPred;
|
||||
|
||||
if (!cl) { FAIL(); } /* in case the index is empty */
|
||||
if (ap->LastCallOfPred != LUCALL_EXEC) {
|
||||
/*
|
||||
only increment time stamp if we are working on current time
|
||||
stamp
|
||||
*/
|
||||
if (ap->TimeStampOfPred >= TIMESTAMP_RESET)
|
||||
Yap_UpdateTimestamps(ap);
|
||||
ap->TimeStampOfPred++;
|
||||
ap->LastCallOfPred = LUCALL_EXEC;
|
||||
/* fprintf(stderr,"R %x--%d--%ul\n",ap,ap->TimeStampOfPred,ap->ArityOfPE);*/
|
||||
}
|
||||
*--YREG = MkIntegerTerm(ap->TimeStampOfPred);
|
||||
/* fprintf(stderr,"> %p/%p %d %d\n",cl,ap,ap->TimeStampOfPred,PREG->y_u.Illss.s);*/
|
||||
PREG = PREG->y_u.Illss.l1;
|
||||
/* indicate the indexing code is being used */
|
||||
#if MULTIPLE_STACKS
|
||||
/* just store a reference */
|
||||
INC_CLREF_COUNT(cl);
|
||||
TRAIL_CLREF(cl);
|
||||
#else
|
||||
if (!(cl->ClFlags & InUseMask)) {
|
||||
cl->ClFlags |= InUseMask;
|
||||
TRAIL_CLREF(cl);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
JMPNext();
|
||||
ENDBOp();
|
||||
|
||||
BOp(profiled_retry_logical, OtaLl);
|
||||
check_trail(TR);
|
||||
{
|
||||
|
@ -164,12 +205,376 @@
|
|||
}
|
||||
ENDBOp();
|
||||
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
#endif /* FROZEN_STACKS */
|
||||
set_cut(S_YREG, B);
|
||||
BOp(try_logical, OtaLl);
|
||||
check_trail(TR);
|
||||
{
|
||||
UInt timestamp;
|
||||
|
||||
CACHE_Y(YREG);
|
||||
timestamp = IntegerOfTerm(S_YREG[0]);
|
||||
/* fprintf(stderr,"+ %p/%p %d %d %d--%u\n",PREG,PREG->y_u.OtaLl.d->ClPred,timestamp,PREG->y_u.OtaLl.d->ClPred->TimeStampOfPred,PREG->y_u.OtaLl.d->ClTimeStart,PREG->y_u.OtaLl.d->ClTimeEnd);*/
|
||||
/* Point AP to the code that follows this instruction */
|
||||
/* always do this, even if we are not going to use it */
|
||||
store_args(PREG->y_u.OtaLl.s);
|
||||
store_yaam_regs(PREG->y_u.OtaLl.n, 0);
|
||||
set_cut(S_YREG, B);
|
||||
B = B_YREG;
|
||||
#ifdef YAPOR
|
||||
SCH_set_load(B_YREG);
|
||||
#endif /* YAPOR */
|
||||
#ifdef YAPOR
|
||||
PP = PREG->y_u.OtaLl.d->ClPred;
|
||||
#endif /* YAPOR */
|
||||
if (!VALID_TIMESTAMP(timestamp, PREG->y_u.OtaLl.d)) {
|
||||
/* jump to next alternative */
|
||||
PREG=PREG->y_u.OtaLl.n;
|
||||
} else {
|
||||
PREG = PREG->y_u.OtaLl.d->ClCode;
|
||||
}
|
||||
SET_BB(B_YREG);
|
||||
ENDCACHE_Y();
|
||||
}
|
||||
JMPNext();
|
||||
ENDBOp();
|
||||
|
||||
BOp(count_retry_logical, OtaLl);
|
||||
check_trail(TR);
|
||||
{
|
||||
UInt timestamp;
|
||||
CACHE_Y(B);
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
if (PP != PREG->y_u.OtaLl.d->ClPred) {
|
||||
if (PP) UNLOCKPE(15,PP);
|
||||
PP = PREG->y_u.OtaLl.d->ClPred;
|
||||
PELOCK(15,PP);
|
||||
}
|
||||
#endif
|
||||
timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[PREG->y_u.OtaLl.s]);
|
||||
if (!VALID_TIMESTAMP(timestamp, PREG->y_u.OtaLl.d)) {
|
||||
/* jump to next instruction */
|
||||
PREG=PREG->y_u.OtaLl.n;
|
||||
JMPNext();
|
||||
}
|
||||
restore_yaam_regs(PREG->y_u.OtaLl.n);
|
||||
restore_args(PREG->y_u.OtaLl.s);
|
||||
LOCAL_RetriesCounter--;
|
||||
if (LOCAL_RetriesCounter == 0) {
|
||||
saveregs();
|
||||
Yap_NilError(RETRY_COUNTER_UNDERFLOW,"");
|
||||
setregs();
|
||||
JMPNext();
|
||||
}
|
||||
LOCAL_PredEntriesCounter--;
|
||||
if (LOCAL_PredEntriesCounter == 0) {
|
||||
saveregs();
|
||||
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
|
||||
setregs();
|
||||
JMPNext();
|
||||
}
|
||||
LOCK(PREG->y_u.OtaLl.d->ClPred->StatisticsForPred.lock);
|
||||
PREG->y_u.OtaLl.d->ClPred->StatisticsForPred.NOfRetries++;
|
||||
UNLOCK(PREG->y_u.OtaLl.d->ClPred->StatisticsForPred.lock);
|
||||
#ifdef THREADS
|
||||
PP = PREG->y_u.OtaLl.d->ClPred;
|
||||
#endif
|
||||
PREG = PREG->y_u.OtaLl.d->ClCode;
|
||||
#ifdef FROZEN_STACKS
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
set_cut(S_YREG, B->cp_b);
|
||||
#else
|
||||
set_cut(S_YREG, B_YREG->cp_b);
|
||||
#endif /* FROZEN_STACKS */
|
||||
SET_BB(B_YREG);
|
||||
ENDCACHE_Y();
|
||||
}
|
||||
JMPNext();
|
||||
ENDBOp();
|
||||
|
||||
BOp(count_trust_logical, OtILl);
|
||||
CACHE_Y(B);
|
||||
{
|
||||
LogUpdIndex *cl = PREG->y_u.OtILl.block;
|
||||
PredEntry *ap = cl->ClPred;
|
||||
LogUpdClause *lcl = PREG->y_u.OtILl.d;
|
||||
UInt timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[ap->ArityOfPE]);
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
if (PP != ap) {
|
||||
if (PP) UNLOCKPE(16,PP);
|
||||
PP = ap;
|
||||
PELOCK(16,PP);
|
||||
}
|
||||
#endif
|
||||
if (!VALID_TIMESTAMP(timestamp, lcl)) {
|
||||
/* jump to next alternative */
|
||||
PREG = FAILCODE;
|
||||
} else {
|
||||
LOCAL_RetriesCounter--;
|
||||
if (LOCAL_RetriesCounter == 0) {
|
||||
saveregs();
|
||||
Yap_NilError(RETRY_COUNTER_UNDERFLOW,"");
|
||||
setregs();
|
||||
JMPNext();
|
||||
}
|
||||
LOCAL_PredEntriesCounter--;
|
||||
if (LOCAL_PredEntriesCounter == 0) {
|
||||
saveregs();
|
||||
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
|
||||
setregs();
|
||||
JMPNext();
|
||||
}
|
||||
LOCK(ap->StatisticsForPred.lock);
|
||||
ap->StatisticsForPred.NOfRetries++;
|
||||
UNLOCK(ap->StatisticsForPred.lock);
|
||||
PREG = lcl->ClCode;
|
||||
}
|
||||
/* HEY, leave indexing block alone!! */
|
||||
/* check if we are the ones using this code */
|
||||
#if MULTIPLE_STACKS
|
||||
PELOCK(2, ap);
|
||||
PP = ap;
|
||||
DEC_CLREF_COUNT(cl);
|
||||
/* clear the entry from the trail */
|
||||
--B->cp_tr;
|
||||
TR = B->cp_tr;
|
||||
/* actually get rid of the code */
|
||||
if (cl->ClRefCount == 0 && (cl->ClFlags & (ErasedMask|DirtyMask))) {
|
||||
if (PREG != FAILCODE) {
|
||||
/* I am the last one using this clause, hence I don't need a lock
|
||||
to dispose of it
|
||||
*/
|
||||
if (lcl->ClRefCount == 1) {
|
||||
/* make sure the clause isn't destroyed */
|
||||
/* always add an extra reference */
|
||||
INC_CLREF_COUNT(lcl);
|
||||
TRAIL_CLREF(lcl);
|
||||
}
|
||||
}
|
||||
if (cl->ClFlags & ErasedMask) {
|
||||
saveregs();
|
||||
Yap_ErLogUpdIndex(cl);
|
||||
setregs();
|
||||
} else {
|
||||
saveregs();
|
||||
Yap_CleanUpIndex(cl);
|
||||
setregs();
|
||||
}
|
||||
save_pc();
|
||||
}
|
||||
#else
|
||||
if (TrailTerm(B->cp_tr-1) == CLREF_TO_TRENTRY(cl) &&
|
||||
B->cp_tr != B->cp_b->cp_tr) {
|
||||
cl->ClFlags &= ~InUseMask;
|
||||
--B->cp_tr;
|
||||
#if FROZEN_STACKS
|
||||
if (B->cp_tr > TR_FZ)
|
||||
#endif
|
||||
{
|
||||
TR = B->cp_tr;
|
||||
}
|
||||
/* next, recover space for the indexing code if it was erased */
|
||||
if (cl->ClFlags & (ErasedMask|DirtyMask)) {
|
||||
if (PREG != FAILCODE) {
|
||||
/* make sure we don't erase the clause we are jumping too */
|
||||
if (!(lcl->ClFlags & InUseMask)) {
|
||||
lcl->ClFlags |= InUseMask;
|
||||
TRAIL_CLREF(lcl);
|
||||
}
|
||||
}
|
||||
if (cl->ClFlags & ErasedMask) {
|
||||
saveregs();
|
||||
Yap_ErLogUpdIndex(cl);
|
||||
setregs();
|
||||
} else {
|
||||
saveregs();
|
||||
Yap_CleanUpIndex(cl);
|
||||
setregs();
|
||||
}
|
||||
save_pc();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef YAPOR
|
||||
if (SCH_top_shared_cp(B)) {
|
||||
SCH_last_alternative(PREG, B_YREG);
|
||||
restore_args(ap->ArityOfPE);
|
||||
#ifdef FROZEN_STACKS
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
#else
|
||||
S_YREG++;
|
||||
#endif /* FROZEN_STACKS */
|
||||
set_cut(S_YREG, B->cp_b);
|
||||
} else
|
||||
#endif /* YAPOR */
|
||||
{
|
||||
pop_yaam_regs();
|
||||
pop_args(ap->ArityOfPE);
|
||||
S_YREG--;
|
||||
#ifdef FROZEN_STACKS
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
#endif /* FROZEN_STACKS */
|
||||
set_cut(S_YREG, B);
|
||||
}
|
||||
SET_BB(B_YREG);
|
||||
ENDCACHE_Y();
|
||||
JMPNext();
|
||||
}
|
||||
ENDBOp();
|
||||
|
||||
|
||||
|
||||
BOp(retry_logical, OtaLl);
|
||||
check_trail(TR);
|
||||
{
|
||||
UInt timestamp;
|
||||
CACHE_Y(B);
|
||||
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
if (PP != PREG->y_u.OtaLl.d->ClPred) {
|
||||
if (PP) UNLOCKPE(15,PP);
|
||||
PP = PREG->y_u.OtaLl.d->ClPred;
|
||||
PELOCK(15,PP);
|
||||
}
|
||||
#endif
|
||||
timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[PREG->y_u.OtaLl.s]);
|
||||
/* fprintf(stderr,"^ %p/%p %d %d %d--%u\n",PREG,PREG->y_u.OtaLl.d->ClPred,timestamp,PREG->y_u.OtaLl.d->ClPred->TimeStampOfPred,PREG->y_u.OtaLl.d->ClTimeStart,PREG->y_u.OtaLl.d->ClTimeEnd);*/
|
||||
if (!VALID_TIMESTAMP(timestamp, PREG->y_u.OtaLl.d)) {
|
||||
/* jump to next instruction */
|
||||
PREG=PREG->y_u.OtaLl.n;
|
||||
JMPNext();
|
||||
}
|
||||
restore_yaam_regs(PREG->y_u.OtaLl.n);
|
||||
restore_at_least_one_arg(PREG->y_u.OtaLl.s);
|
||||
#ifdef THREADS
|
||||
PP = PREG->y_u.OtaLl.d->ClPred;
|
||||
#endif
|
||||
PREG = PREG->y_u.OtaLl.d->ClCode;
|
||||
#ifdef FROZEN_STACKS
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
set_cut(S_YREG, B->cp_b);
|
||||
#else
|
||||
set_cut(S_YREG, B_YREG->cp_b);
|
||||
#endif /* FROZEN_STACKS */
|
||||
SET_BB(B_YREG);
|
||||
ENDCACHE_Y();
|
||||
}
|
||||
JMPNext();
|
||||
ENDBOp();
|
||||
|
||||
BOp(trust_logical, OtILl);
|
||||
CACHE_Y(B);
|
||||
{
|
||||
LogUpdIndex *cl = PREG->y_u.OtILl.block;
|
||||
PredEntry *ap = cl->ClPred;
|
||||
LogUpdClause *lcl = PREG->y_u.OtILl.d;
|
||||
UInt timestamp = IntegerOfTerm(((CELL *)(B_YREG+1))[ap->ArityOfPE]);
|
||||
|
||||
/* fprintf(stderr,"- %p/%p %d %d %p\n",PREG,ap,timestamp,ap->TimeStampOfPred,PREG->y_u.OtILl.d->ClCode);*/
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
if (PP != ap) {
|
||||
if (PP) UNLOCKPE(16,PP);
|
||||
PP = ap;
|
||||
PELOCK(16,PP);
|
||||
}
|
||||
#endif
|
||||
if (!VALID_TIMESTAMP(timestamp, lcl)) {
|
||||
/* jump to next alternative */
|
||||
PREG = FAILCODE;
|
||||
} else {
|
||||
PREG = lcl->ClCode;
|
||||
}
|
||||
/* HEY, leave indexing block alone!! */
|
||||
/* check if we are the ones using this code */
|
||||
#if MULTIPLE_STACKS
|
||||
DEC_CLREF_COUNT(cl);
|
||||
/* clear the entry from the trail */
|
||||
B->cp_tr--;
|
||||
TR = B->cp_tr;
|
||||
/* actually get rid of the code */
|
||||
if (cl->ClRefCount == 0 && (cl->ClFlags & (ErasedMask|DirtyMask))) {
|
||||
if (PREG != FAILCODE) {
|
||||
if (lcl->ClRefCount == 1) {
|
||||
/* make sure the clause isn't destroyed */
|
||||
/* always add an extra reference */
|
||||
INC_CLREF_COUNT(lcl);
|
||||
TRAIL_CLREF(lcl);
|
||||
B->cp_tr = TR;
|
||||
}
|
||||
}
|
||||
if (cl->ClFlags & ErasedMask) {
|
||||
saveregs();
|
||||
Yap_ErLogUpdIndex(cl);
|
||||
setregs();
|
||||
} else {
|
||||
saveregs();
|
||||
Yap_CleanUpIndex(cl);
|
||||
setregs();
|
||||
}
|
||||
save_pc();
|
||||
}
|
||||
#else
|
||||
if (TrailTerm(B->cp_tr-1) == CLREF_TO_TRENTRY(cl) &&
|
||||
B->cp_tr != B->cp_b->cp_tr) {
|
||||
cl->ClFlags &= ~InUseMask;
|
||||
B->cp_tr--;
|
||||
#if FROZEN_STACKS
|
||||
if (B->cp_tr > TR_FZ)
|
||||
#endif
|
||||
{
|
||||
TR = B->cp_tr;
|
||||
}
|
||||
/* next, recover space for the indexing code if it was erased */
|
||||
if (cl->ClFlags & (ErasedMask|DirtyMask)) {
|
||||
if (PREG != FAILCODE) {
|
||||
/* make sure we don't erase the clause we are jumping too */
|
||||
if (!(lcl->ClFlags & InUseMask)) {
|
||||
lcl->ClFlags |= InUseMask;
|
||||
TRAIL_CLREF(lcl);
|
||||
B->cp_tr = TR;
|
||||
}
|
||||
}
|
||||
if (cl->ClFlags & ErasedMask) {
|
||||
saveregs();
|
||||
Yap_ErLogUpdIndex(cl);
|
||||
setregs();
|
||||
} else {
|
||||
saveregs();
|
||||
Yap_CleanUpIndex(cl);
|
||||
setregs();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef YAPOR
|
||||
if (SCH_top_shared_cp(B)) {
|
||||
SCH_last_alternative(PREG, B_YREG);
|
||||
restore_args(ap->ArityOfPE);
|
||||
#ifdef FROZEN_STACKS
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
#else
|
||||
S_YREG++;
|
||||
#endif /* FROZEN_STACKS */
|
||||
set_cut(S_YREG, B->cp_b);
|
||||
} else
|
||||
#endif /* YAPOR */
|
||||
{
|
||||
pop_yaam_regs();
|
||||
pop_args(ap->ArityOfPE);
|
||||
S_YREG--;
|
||||
#ifdef FROZEN_STACKS
|
||||
S_YREG = (CELL *) PROTECT_FROZEN_B(B_YREG);
|
||||
#endif /* FROZEN_STACKS */
|
||||
set_cut(S_YREG, B);
|
||||
}
|
||||
SET_BB(B_YREG);
|
||||
ENDCACHE_Y();
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
if (PREG == FAILCODE) {
|
||||
UNLOCKPE(26,PP);
|
||||
PP = NULL;
|
||||
}
|
||||
#endif
|
||||
JMPNext();
|
||||
}
|
||||
ENDBOp();
|
||||
|
|
|
@ -244,9 +244,11 @@
|
|||
#ifdef DEPTH_LIMIT
|
||||
if (DEPTH <= MkIntTerm(1)) {/* I assume Module==0 is primitives */
|
||||
if (pen->ModuleOfPred) {
|
||||
if (DEPTH == MkIntTerm(0))
|
||||
FAIL();
|
||||
else DEPTH = RESET_DEPTH();
|
||||
if (DEPTH == MkIntTerm(0)) {
|
||||
FAIL();
|
||||
} else {
|
||||
DEPTH = RESET_DEPTH();
|
||||
}
|
||||
}
|
||||
} else if (pen->ModuleOfPred)
|
||||
DEPTH -= MkIntConstant(2);
|
||||
|
|
1636
C/prim_absmi_insts.h
1636
C/prim_absmi_insts.h
File diff suppressed because it is too large
Load Diff
144
C/sysbits.c
144
C/sysbits.c
|
@ -143,7 +143,7 @@ Yap_WinError(char *yap_error)
|
|||
char msg[256];
|
||||
/* Error, we could not read time */
|
||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL, GetLastError(),
|
||||
NULL, GetLastError(),
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), msg, 256,
|
||||
NULL);
|
||||
Yap_Error(OPERATING_SYSTEM_ERROR, TermNil, "%s at %s", msg, yap_error);
|
||||
|
@ -195,13 +195,13 @@ is_directory(const char *FileName)
|
|||
s1[-1] = '\\';
|
||||
}
|
||||
if (ExpandEnvironmentStrings(s, (LPSTR)FileName, YAP_FILENAME_MAX) == 0)
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
|
||||
DWORD dwAtts = GetFileAttributes( FileName );
|
||||
if (dwAtts == INVALID_FILE_ATTRIBUTES)
|
||||
return FALSE;
|
||||
return (dwAtts & FILE_ATTRIBUTE_DIRECTORY);
|
||||
#elif HAVE_LSTAT
|
||||
#elif HAVE_LSTAT
|
||||
struct stat buf;
|
||||
|
||||
if (lstat(FileName, &buf) == -1) {
|
||||
|
@ -261,7 +261,7 @@ initSysPath(Term tlib, Term tcommons, bool dir_done, bool commons_done) {
|
|||
MkAtomTerm(Yap_LookupAtom(dir))) )
|
||||
return FALSE;
|
||||
}
|
||||
commons_done = true;
|
||||
commons_done = true;
|
||||
}
|
||||
if (dir_done && commons_done)
|
||||
return TRUE;
|
||||
|
@ -271,7 +271,7 @@ initSysPath(Term tlib, Term tcommons, bool dir_done, bool commons_done) {
|
|||
len = strlen(LOCAL_FileNameBuf);
|
||||
if (!dir_done) {
|
||||
strncat(LOCAL_FileNameBuf, "Yap", YAP_FILENAME_MAX);
|
||||
if (is_directory(LOCAL_FileNameBuf))
|
||||
if (is_directory(LOCAL_FileNameBuf))
|
||||
{
|
||||
if (! Yap_unify( tlib,
|
||||
MkAtomTerm(Yap_LookupAtom(LOCAL_FileNameBuf))) )
|
||||
|
@ -300,7 +300,7 @@ initSysPath(Term tlib, Term tcommons, bool dir_done, bool commons_done) {
|
|||
/* couldn't find it where it was supposed to be,
|
||||
let's try using the executable */
|
||||
if (!GetModuleFileName( NULL, LOCAL_FileNameBuf, YAP_FILENAME_MAX)) {
|
||||
Yap_WinError( "could not find executable name" );
|
||||
Yap_WinError( "could not find executable name" );
|
||||
/* do nothing */
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -468,31 +468,31 @@ InitTime (int wid)
|
|||
REMOTE_ThreadHandle(wid).last_time_sysp = (struct timeval *)malloc(sizeof(struct timeval));
|
||||
getrusage(RUSAGE_SELF, &rusage);
|
||||
(*REMOTE_ThreadHandle(wid).last_timep).tv_sec =
|
||||
(*REMOTE_ThreadHandle(wid).start_of_timesp).tv_sec =
|
||||
(*REMOTE_ThreadHandle(wid).start_of_timesp).tv_sec =
|
||||
rusage.ru_utime.tv_sec;
|
||||
(*REMOTE_ThreadHandle(wid).last_timep).tv_usec =
|
||||
(*REMOTE_ThreadHandle(wid).start_of_timesp).tv_usec =
|
||||
(*REMOTE_ThreadHandle(wid).start_of_timesp).tv_usec =
|
||||
rusage.ru_utime.tv_usec;
|
||||
(*REMOTE_ThreadHandle(wid).last_time_sysp).tv_sec =
|
||||
(*REMOTE_ThreadHandle(wid).start_of_times_sysp).tv_sec =
|
||||
(*REMOTE_ThreadHandle(wid).start_of_times_sysp).tv_sec =
|
||||
rusage.ru_stime.tv_sec;
|
||||
(*REMOTE_ThreadHandle(wid).last_time_sysp).tv_usec =
|
||||
(*REMOTE_ThreadHandle(wid).start_of_times_sysp).tv_usec =
|
||||
(*REMOTE_ThreadHandle(wid).start_of_times_sysp).tv_usec =
|
||||
rusage.ru_stime.tv_usec;
|
||||
#else
|
||||
getrusage(RUSAGE_SELF, &rusage);
|
||||
last_time.tv_sec =
|
||||
StartOfTimes.tv_sec =
|
||||
StartOfTimes.tv_sec =
|
||||
rusage.ru_utime.tv_sec;
|
||||
last_time.tv_usec =
|
||||
StartOfTimes.tv_usec =
|
||||
StartOfTimes.tv_usec =
|
||||
rusage.ru_utime.tv_usec;
|
||||
last_time_sys.tv_sec =
|
||||
StartOfTimes_sys.tv_sec =
|
||||
StartOfTimes_sys.tv_sec =
|
||||
rusage.ru_stime.tv_sec;
|
||||
last_time_sys.tv_usec =
|
||||
StartOfTimes_sys.tv_usec =
|
||||
rusage.ru_stime.tv_usec;
|
||||
StartOfTimes_sys.tv_usec =
|
||||
rusage.ru_stime.tv_usec;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -586,51 +586,51 @@ InitTime (int wid)
|
|||
REMOTE_ThreadHandle(wid).last_timep = (struct _FILETIME *)malloc(sizeof(FILETIME));
|
||||
REMOTE_ThreadHandle(wid).start_of_times_sysp = (struct _FILETIME *)malloc(sizeof(FILETIME));
|
||||
REMOTE_ThreadHandle(wid).last_time_sysp = (struct _FILETIME *)malloc(sizeof(FILETIME));
|
||||
(*REMOTE_ThreadHandle(wid).last_timep).dwLowDateTime =
|
||||
(*REMOTE_ThreadHandle(wid).last_timep).dwLowDateTime =
|
||||
UserTime.dwLowDateTime;
|
||||
(*REMOTE_ThreadHandle(wid).last_timep).dwHighDateTime =
|
||||
UserTime.dwHighDateTime;
|
||||
(*REMOTE_ThreadHandle(wid).start_of_timesp).dwLowDateTime =
|
||||
UserTime.dwLowDateTime;
|
||||
(*REMOTE_ThreadHandle(wid).start_of_timesp).dwHighDateTime =
|
||||
(*REMOTE_ThreadHandle(wid).start_of_timesp).dwHighDateTime =
|
||||
UserTime.dwHighDateTime;
|
||||
(*REMOTE_ThreadHandle(wid).last_time_sysp).dwLowDateTime =
|
||||
KernelTime.dwLowDateTime;
|
||||
(*REMOTE_ThreadHandle(wid).last_time_sysp).dwHighDateTime =
|
||||
(*REMOTE_ThreadHandle(wid).last_time_sysp).dwHighDateTime =
|
||||
KernelTime.dwHighDateTime;
|
||||
(*REMOTE_ThreadHandle(wid).start_of_times_sysp).dwLowDateTime =
|
||||
KernelTime.dwLowDateTime;
|
||||
(*REMOTE_ThreadHandle(wid).start_of_times_sysp).dwHighDateTime =
|
||||
(*REMOTE_ThreadHandle(wid).start_of_times_sysp).dwHighDateTime =
|
||||
KernelTime.dwHighDateTime;
|
||||
#else
|
||||
last_time.dwLowDateTime =
|
||||
last_time.dwLowDateTime =
|
||||
UserTime.dwLowDateTime;
|
||||
last_time.dwHighDateTime =
|
||||
UserTime.dwHighDateTime;
|
||||
StartOfTimes.dwLowDateTime =
|
||||
UserTime.dwLowDateTime;
|
||||
StartOfTimes.dwHighDateTime =
|
||||
StartOfTimes.dwHighDateTime =
|
||||
UserTime.dwHighDateTime;
|
||||
last_time_sys.dwLowDateTime =
|
||||
KernelTime.dwLowDateTime;
|
||||
last_time_sys.dwHighDateTime =
|
||||
last_time_sys.dwHighDateTime =
|
||||
KernelTime.dwHighDateTime;
|
||||
StartOfTimes_sys.dwLowDateTime =
|
||||
KernelTime.dwLowDateTime;
|
||||
StartOfTimes_sys.dwHighDateTime =
|
||||
StartOfTimes_sys.dwHighDateTime =
|
||||
KernelTime.dwHighDateTime;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
static unsigned long long int
|
||||
static unsigned long long int
|
||||
sub_utime(FILETIME t1, FILETIME t2)
|
||||
{
|
||||
ULARGE_INTEGER u[2];
|
||||
memcpy((void *)u,(void *)&t1,sizeof(FILETIME));
|
||||
memcpy((void *)(u+1),(void *)&t2,sizeof(FILETIME));
|
||||
return
|
||||
return
|
||||
u[0].QuadPart - u[1].QuadPart;
|
||||
}
|
||||
#endif
|
||||
|
@ -951,7 +951,7 @@ real_cputime ()
|
|||
static hrtime_t StartOfWTimes;
|
||||
|
||||
/* since last call to walltime */
|
||||
#define LastWtime (*(hrtime_t *)ALIGN_YAPTYPE(LastWtimePtr,hrtime_t))
|
||||
#define LastWtime (*(hrtime_t *)ALIGN_BY_TYPE(LastWtimePtr,hrtime_t))
|
||||
|
||||
static void
|
||||
InitWTime (void)
|
||||
|
@ -1178,7 +1178,7 @@ p_init_random_state ( USES_REGS1 )
|
|||
current_seed = (unsigned int) FloatOfTerm (t0);
|
||||
else
|
||||
current_seed = (unsigned int) LongIntOfTerm (t0);
|
||||
|
||||
|
||||
new = (char *) malloc(256);
|
||||
old = initstate(random(), new, 256);
|
||||
return Yap_unify(ARG2, MkIntegerTerm((Int)old)) &&
|
||||
|
@ -1383,7 +1383,7 @@ Yap_signal_index(const char *name)
|
|||
{ struct signame *sn = signames;
|
||||
char tmp[12];
|
||||
|
||||
if ( strncmp(name, "SIG", 3) == 0 && strlen(name) < 12 )
|
||||
if ( strncmp(name, "SIG", 3) == 0 && strlen(name) < 12 )
|
||||
{ char *p = (char *)name+3, *q = tmp;
|
||||
while ((*q++ = tolower(*p++))) {};
|
||||
name = tmp;
|
||||
|
@ -1415,7 +1415,7 @@ SearchForTrailFault(void *ptr, int sure)
|
|||
crash again
|
||||
*/
|
||||
#if OS_HANDLES_TR_OVERFLOW && !USE_SYSTEM_MALLOC
|
||||
if ((ptr > (void *)LOCAL_TrailTop-1024 &&
|
||||
if ((ptr > (void *)LOCAL_TrailTop-1024 &&
|
||||
TR < (tr_fr_ptr) LOCAL_TrailTop+(64*1024))) {
|
||||
if (!Yap_growtrail(64*1024, TRUE)) {
|
||||
Yap_Error(OUT_OF_TRAIL_ERROR, TermNil, "YAP failed to reserve %ld bytes in growtrail", K64);
|
||||
|
@ -1563,7 +1563,7 @@ HandleMatherr(int sig, void *sipv, void *uapv)
|
|||
|
||||
typedef void (*signal_handler_t)(int, void *, void *);
|
||||
|
||||
#if HAVE_SIGACTION
|
||||
#if HAVE_SIGACTION
|
||||
static void
|
||||
my_signal_info(int sig, void * handler)
|
||||
{
|
||||
|
@ -1604,7 +1604,7 @@ my_signal_info(int sig, void *handler)
|
|||
|
||||
#endif
|
||||
|
||||
#if !defined(LIGHT) && !_MSC_VER && !defined(__MINGW32__) && !defined(LIGHT)
|
||||
#if !defined(LIGHT) && !_MSC_VER && !defined(__MINGW32__) && !defined(LIGHT)
|
||||
static RETSIGTYPE
|
||||
ReceiveSignal (int s, void *x, void *y)
|
||||
{
|
||||
|
@ -1702,7 +1702,7 @@ static void
|
|||
InitSignals (void)
|
||||
{
|
||||
if (GLOBAL_PrologShouldHandleInterrupts) {
|
||||
#if !defined(LIGHT) && !_MSC_VER && !defined(__MINGW32__) && !defined(LIGHT)
|
||||
#if !defined(LIGHT) && !_MSC_VER && !defined(__MINGW32__) && !defined(LIGHT)
|
||||
my_signal (SIGQUIT, ReceiveSignal);
|
||||
my_signal (SIGKILL, ReceiveSignal);
|
||||
my_signal (SIGUSR1, ReceiveSignal);
|
||||
|
@ -1727,7 +1727,7 @@ InitSignals (void)
|
|||
my_signal_info (SIGSEGV, HandleSIGSEGV);
|
||||
#endif
|
||||
#ifdef YAPOR_COW
|
||||
signal(SIGCHLD, SIG_IGN); /* avoid ghosts */
|
||||
signal(SIGCHLD, SIG_IGN); /* avoid ghosts */
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -1780,7 +1780,7 @@ TrueFileName (char *source, char *root, char *result, int in_lib, int expand_roo
|
|||
|
||||
result[0] = '\0';
|
||||
if (strlen(source) >= YAP_FILENAME_MAX) {
|
||||
Yap_Error(OPERATING_SYSTEM_ERROR, TermNil, "%s in true_file-name is larger than the buffer size (%d bytes)", source, strlen(source));
|
||||
Yap_Error(OPERATING_SYSTEM_ERROR, TermNil, "%s in true_file-name is larger than the buffer size (%d bytes)", source, strlen(source));
|
||||
}
|
||||
#if defined(__MINGW32__) || _MSC_VER
|
||||
/* step 0: replace / by \ */
|
||||
|
@ -1816,7 +1816,7 @@ TrueFileName (char *source, char *root, char *result, int in_lib, int expand_roo
|
|||
} else {
|
||||
#if HAVE_GETPWNAM
|
||||
struct passwd *user_passwd;
|
||||
char *res0 = result;
|
||||
char *res0 = result;
|
||||
|
||||
source++;
|
||||
while (!dir_separator((*res0 = *source)) && *res0 != '\0')
|
||||
|
@ -1841,7 +1841,7 @@ TrueFileName (char *source, char *root, char *result, int in_lib, int expand_roo
|
|||
while ((ch = *res0) && is_valid_env_char (ch) && ch != '}') {
|
||||
res0++;
|
||||
}
|
||||
*res0++ = '\0';
|
||||
*res0++ = '\0';
|
||||
if (ch == '}') {
|
||||
// {...}
|
||||
source++;
|
||||
|
@ -1977,7 +1977,7 @@ static Int
|
|||
p_true_file_name ( USES_REGS1 )
|
||||
{
|
||||
Term t = Deref(ARG1);
|
||||
|
||||
|
||||
if (IsVarTerm(t)) {
|
||||
Yap_Error(INSTANTIATION_ERROR,t,"argument to true_file_name unbound");
|
||||
return FALSE;
|
||||
|
@ -1994,7 +1994,7 @@ static Int
|
|||
p_expand_file_name ( USES_REGS1 )
|
||||
{
|
||||
Term t = Deref(ARG1);
|
||||
|
||||
|
||||
if (IsVarTerm(t)) {
|
||||
Yap_Error(INSTANTIATION_ERROR,t,"argument to true_file_name unbound");
|
||||
return FALSE;
|
||||
|
@ -2012,7 +2012,7 @@ p_true_file_name3 ( USES_REGS1 )
|
|||
{
|
||||
Term t = Deref(ARG1), t2 = Deref(ARG2);
|
||||
char *root = NULL;
|
||||
|
||||
|
||||
if (IsVarTerm(t)) {
|
||||
Yap_Error(INSTANTIATION_ERROR,t,"argument to true_file_name unbound");
|
||||
return FALSE;
|
||||
|
@ -2033,12 +2033,12 @@ p_true_file_name3 ( USES_REGS1 )
|
|||
}
|
||||
|
||||
/* Executes $SHELL under Prolog */
|
||||
/** @pred sh
|
||||
/** @pred sh
|
||||
|
||||
|
||||
Creates a new shell interaction.
|
||||
|
||||
|
||||
|
||||
*/
|
||||
static Int
|
||||
p_sh ( USES_REGS1 )
|
||||
|
@ -2088,7 +2088,7 @@ p_shell ( USES_REGS1 )
|
|||
|
||||
return FALSE;
|
||||
#else
|
||||
#if HAVE_SYSTEM
|
||||
#if HAVE_SYSTEM
|
||||
char *shell;
|
||||
register int bourne = FALSE;
|
||||
Term t1 = Deref (ARG1);
|
||||
|
@ -2167,7 +2167,7 @@ p_system ( USES_REGS1 )
|
|||
si.cb = sizeof(si);
|
||||
ZeroMemory( &pi, sizeof(pi) );
|
||||
|
||||
// Start the child process.
|
||||
// Start the child process.
|
||||
if( !CreateProcess( NULL, // No module name (use command line)
|
||||
cmd, // Command line
|
||||
NULL, // Process handle not inheritable
|
||||
|
@ -2175,10 +2175,10 @@ p_system ( USES_REGS1 )
|
|||
FALSE, // Set handle inheritance to FALSE
|
||||
0, // No creation flags
|
||||
NULL, // Use parent's environment block
|
||||
NULL, // Use parent's starting directory
|
||||
NULL, // Use parent's starting directory
|
||||
&si, // Pointer to STARTUPINFO structure
|
||||
&pi ) // Pointer to PROCESS_INFORMATION structure
|
||||
)
|
||||
)
|
||||
{
|
||||
Yap_Error( SYSTEM_ERROR, ARG1, "CreateProcess failed (%d).\n", GetLastError() );
|
||||
return FALSE;
|
||||
|
@ -2186,7 +2186,7 @@ p_system ( USES_REGS1 )
|
|||
// Wait until child process exits.
|
||||
WaitForSingleObject( pi.hProcess, INFINITE );
|
||||
|
||||
// Close process and thread handles.
|
||||
// Close process and thread handles.
|
||||
CloseHandle( pi.hProcess );
|
||||
CloseHandle( pi.hThread );
|
||||
|
||||
|
@ -2243,7 +2243,7 @@ p_system ( USES_REGS1 )
|
|||
|
||||
|
||||
/* Rename a file */
|
||||
/** @pred rename(+ _F_,+ _G_)
|
||||
/** @pred rename(+ _F_,+ _G_)
|
||||
|
||||
Renames file _F_ to _G_.
|
||||
*/
|
||||
|
@ -2454,7 +2454,7 @@ p_alarm( USES_REGS1 )
|
|||
#else
|
||||
Yap_get_signal( YAP_ALARM_SIGNAL );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#if _MSC_VER || defined(__MINGW32__)
|
||||
{
|
||||
Term tout;
|
||||
|
@ -2462,19 +2462,19 @@ p_alarm( USES_REGS1 )
|
|||
|
||||
time[0] = i1;
|
||||
time[1] = i2;
|
||||
|
||||
if (time[0] != 0 && time[1] != 0) {
|
||||
DWORD dwThreadId;
|
||||
HANDLE hThread;
|
||||
|
||||
hThread = CreateThread(
|
||||
if (time[0] != 0 && time[1] != 0) {
|
||||
DWORD dwThreadId;
|
||||
HANDLE hThread;
|
||||
|
||||
hThread = CreateThread(
|
||||
NULL, /* no security attributes */
|
||||
0, /* use default stack size */
|
||||
0, /* use default stack size */
|
||||
DoTimerThread, /* thread function */
|
||||
(LPVOID)time, /* argument to thread function */
|
||||
0, /* use default creation flags */
|
||||
&dwThreadId); /* returns the thread identifier */
|
||||
|
||||
|
||||
/* Check the return value for success. */
|
||||
if (hThread == NULL) {
|
||||
Yap_WinError("trying to use alarm");
|
||||
|
@ -2549,19 +2549,19 @@ p_virtual_alarm( USES_REGS1 )
|
|||
|
||||
time[0] = IntegerOfTerm(t);
|
||||
time[1] = IntegerOfTerm(t2);
|
||||
|
||||
if (time[0] != 0 && time[1] != 0) {
|
||||
DWORD dwThreadId;
|
||||
HANDLE hThread;
|
||||
|
||||
hThread = CreateThread(
|
||||
if (time[0] != 0 && time[1] != 0) {
|
||||
DWORD dwThreadId;
|
||||
HANDLE hThread;
|
||||
|
||||
hThread = CreateThread(
|
||||
NULL, /* no security attributes */
|
||||
0, /* use default stack size */
|
||||
0, /* use default stack size */
|
||||
DoTimerThread, /* thread function */
|
||||
(LPVOID)time, /* argument to thread function */
|
||||
0, /* use default creation flags */
|
||||
&dwThreadId); /* returns the thread identifier */
|
||||
|
||||
|
||||
/* Check the return value for success. */
|
||||
if (hThread == NULL) {
|
||||
Yap_WinError("trying to use alarm");
|
||||
|
@ -2667,7 +2667,7 @@ set_fpu_exceptions(bool flag)
|
|||
/* this will probably not work in older releases of Linux */
|
||||
int v = _FPU_IEEE;
|
||||
_FPU_SETCW(v);
|
||||
#endif
|
||||
#endif
|
||||
#ifdef HAVE_SIGFPE
|
||||
my_signal (SIGFPE, SIG_IGN);
|
||||
#endif
|
||||
|
@ -2709,14 +2709,14 @@ p_yap_paths( USES_REGS1 ) {
|
|||
char destdir[YAP_FILENAME_MAX+1];
|
||||
|
||||
if (env_destdir) {
|
||||
strncat(destdir, env_destdir, YAP_FILENAME_MAX );
|
||||
strncat(destdir, "/" YAP_LIBDIR, YAP_FILENAME_MAX );
|
||||
strncat(destdir, env_destdir, YAP_FILENAME_MAX );
|
||||
strncat(destdir, "/" YAP_LIBDIR, YAP_FILENAME_MAX );
|
||||
out1 = MkAtomTerm(Yap_LookupAtom(destdir));
|
||||
} else {
|
||||
out1 = MkAtomTerm(Yap_LookupAtom(YAP_LIBDIR));
|
||||
}
|
||||
if (env_destdir) {
|
||||
strncat(destdir, env_destdir, YAP_FILENAME_MAX );
|
||||
strncat(destdir, env_destdir, YAP_FILENAME_MAX );
|
||||
strncat(destdir, "/" YAP_SHAREDIR, YAP_FILENAME_MAX );
|
||||
out2 = MkAtomTerm(Yap_LookupAtom(destdir));
|
||||
} else {
|
||||
|
@ -2727,7 +2727,7 @@ p_yap_paths( USES_REGS1 ) {
|
|||
#endif
|
||||
}
|
||||
if (env_destdir) {
|
||||
strncat(destdir, env_destdir, YAP_FILENAME_MAX );
|
||||
strncat(destdir, env_destdir, YAP_FILENAME_MAX );
|
||||
strncat(destdir, "/" YAP_BINDIR, YAP_FILENAME_MAX );
|
||||
out3 = MkAtomTerm(Yap_LookupAtom(destdir));
|
||||
} else {
|
||||
|
@ -2804,7 +2804,7 @@ void
|
|||
Yap_ReInitWallTime (void)
|
||||
{
|
||||
InitWTime();
|
||||
if (Yap_heap_regs->last_wtime != NULL)
|
||||
if (Yap_heap_regs->last_wtime != NULL)
|
||||
Yap_FreeCodeSpace(Yap_heap_regs->last_wtime);
|
||||
InitLastWtime();
|
||||
}
|
||||
|
@ -2963,7 +2963,7 @@ WideStringFromAtom(Atom KeyAt USES_REGS)
|
|||
if (!Yap_growheap(FALSE, sz, NULL)) {
|
||||
Yap_Error(OUT_OF_HEAP_ERROR, MkIntegerTerm(sz), "generating key in win_registry_get_value/3");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
kptr = k;
|
||||
while ((*kptr++ = *chp++));
|
||||
|
@ -3098,8 +3098,8 @@ Yap_InitSysPreds(void)
|
|||
Yap_InitCPred ("$yap_home", 1, p_yap_home, SafePredFlag);
|
||||
Yap_InitCPred ("$yap_paths", 3, p_yap_paths, SafePredFlag);
|
||||
Yap_InitCPred ("$dir_separator", 1, p_dir_sp, SafePredFlag);
|
||||
Yap_InitCPred ("libraries_directory", 2, p_libraries_path, 0);
|
||||
Yap_InitCPred ("system_library", 1, p_library_dir, 0);
|
||||
Yap_InitCPred ("libraries_directory", 2, p_libraries_path, 0);
|
||||
Yap_InitCPred ("system_library", 1, p_library_dir, 0);
|
||||
Yap_InitCPred ("commons_library", 1, p_commons_dir, 0);
|
||||
Yap_InitCPred ("$alarm", 4, p_alarm, SafePredFlag|SyncPredFlag);
|
||||
Yap_InitCPred ("$getenv", 2, p_getenv, SafePredFlag);
|
||||
|
@ -3180,7 +3180,7 @@ int WINAPI win_yap(HANDLE, DWORD, LPVOID);
|
|||
|
||||
int WINAPI win_yap(HANDLE hinst, DWORD reason, LPVOID reserved)
|
||||
{
|
||||
switch (reason)
|
||||
switch (reason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
break;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -149,6 +149,8 @@ set (BUILD_SHARED_LIBS ON)
|
|||
#
|
||||
add_subdirectory (os/libtai)
|
||||
|
||||
add_subdirectory (CXX)
|
||||
|
||||
option (WITH_TABLING "Support tabling" ON)
|
||||
if (WITH_TABLING)
|
||||
#this depends on DEPTH_LIMIT define it after
|
||||
|
@ -221,9 +223,24 @@ if (WIN32)
|
|||
)
|
||||
endif (WIN32)
|
||||
|
||||
set (ENGINE_SOURCES
|
||||
C/agc.c
|
||||
set (ABSMI_SOURCES
|
||||
C/absmi.c
|
||||
C/absmi_insts.h
|
||||
C/fli_absmi_insts.h
|
||||
C/or_absmi_insts.h
|
||||
C/control_absmi_insts.h
|
||||
C/index_absmi_insts.h
|
||||
C/prim_absmi_insts.h
|
||||
C/cp_absmi_insts.h
|
||||
C/lu_absmi_insts.h
|
||||
C/unify_absmi_insts.h
|
||||
C/fail_absmi_insts.h
|
||||
C/meta_absmi_insts.h
|
||||
)
|
||||
|
||||
set (ENGINE_SOURCES
|
||||
${ABSMI_SOURCES}
|
||||
C/agc.c
|
||||
C/adtdefs.c
|
||||
C/alloc.c
|
||||
C/amasm.c
|
||||
|
@ -319,6 +336,8 @@ SET(OPTYAP_SOURCES
|
|||
OPTYap/tab.completion.c
|
||||
)
|
||||
|
||||
|
||||
|
||||
set(STATIC_SOURCES
|
||||
#NOT INCLUDED FOR NOW
|
||||
)
|
||||
|
@ -346,7 +365,8 @@ add_library(libYap SHARED
|
|||
${C_INTERFACE_SOURCES}
|
||||
${STATIC_SOURCES}
|
||||
${OPTYAP_SOURCES}
|
||||
$<TARGET_OBJECTS:libyaptai> )
|
||||
$<TARGET_OBJECTS:libyaptai>
|
||||
)
|
||||
|
||||
target_link_libraries(libYap
|
||||
m resolv stdc++ )
|
||||
|
@ -357,7 +377,6 @@ set_target_properties(libYap
|
|||
OUTPUT_NAME Yap
|
||||
)
|
||||
|
||||
|
||||
option (WITH_Dynamic_BDD
|
||||
"dynamic bdd library" OFF)
|
||||
#TODO:
|
||||
|
@ -413,7 +432,7 @@ if (READLINE_FOUND)
|
|||
endif (READLINE_FOUND)
|
||||
|
||||
|
||||
macro_optional_find_package (Threads ON)
|
||||
macro_optional_find_package (Threads OFF)
|
||||
macro_log_feature (THREADS_FOUND "Threads Support"
|
||||
"GNU Threads Library (or similar)"
|
||||
"http://www.gnu.org/software/threads")
|
||||
|
@ -462,6 +481,22 @@ cmake_dependent_option (WITH_PThreadLocking
|
|||
"use pthread locking primitives for internal locking" ON
|
||||
System_Threads OFF)
|
||||
|
||||
option (Use_JIT
|
||||
"use just-in-time compilation (experimental)" OFF)
|
||||
if (Use_JIT)
|
||||
macro_optional_find_package (LLVM ON)
|
||||
macro_log_feature (LLVM_FOUND "LLVM JIT generator"
|
||||
"The LLVM Compiler Infrastructure"
|
||||
"http://www.llvm.org")
|
||||
if (LLVM_FOUND)
|
||||
add_subdirectory (JIT)
|
||||
include_directories (JIT/HPP)
|
||||
add_definitions(-DYAP_JIT=1)
|
||||
endif (LLVM_FOUND)
|
||||
endif (Use_JIT)
|
||||
|
||||
|
||||
|
||||
ADD_SUBDIRECTORY(library)
|
||||
ADD_SUBDIRECTORY(swi/library)
|
||||
# ADD_SUBDIRECTORY(os)
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
add_library (Yap++ SHARED yapi.cpp)
|
||||
|
||||
target_link_libraries(Yap++ libYap)
|
||||
|
||||
install(TARGETS Yap++
|
||||
LIBRARY DESTINATION ${libdir} )
|
||||
|
||||
include_directories (${GMP_INCLUDE_DIR})
|
||||
|
||||
|
||||
|
|
@ -365,7 +365,7 @@ INLINE_ONLY inline EXTERN Term
|
|||
__MkStringTerm (const char *s USES_REGS)
|
||||
{
|
||||
Term t = AbsAppl(HR);
|
||||
size_t sz = ALIGN_YAPTYPE(strlen(s)+1,CELL);
|
||||
size_t sz = ALIGN_BY_TYPE(strlen(s)+1,CELL);
|
||||
HR[0] = (CELL) FunctorString;
|
||||
HR[1] = (CELL) sz;
|
||||
strcpy((char *)(HR+2), s);
|
||||
|
|
99
H/Yap.h
99
H/Yap.h
|
@ -43,6 +43,18 @@
|
|||
#endif
|
||||
#include "config.h"
|
||||
|
||||
#ifndef COROUTINING
|
||||
#define COROUTINING 1
|
||||
#endif
|
||||
|
||||
#ifndef RATIONAL_TREES
|
||||
#define RATIONAL_TREES 1
|
||||
#endif
|
||||
|
||||
#ifndef CUT_C
|
||||
#define CUT_C 1
|
||||
#endif
|
||||
|
||||
#define FunAdr(X) X
|
||||
|
||||
#include "inline-only.h"
|
||||
|
@ -97,26 +109,6 @@
|
|||
#define TERM_EXTENSIONS 1
|
||||
#endif /* COROUTINING && !TERM_EXTENSIONS */
|
||||
|
||||
/* truth-values */
|
||||
#if HAVE_STDBOOL_H
|
||||
#include <stdbool.h>
|
||||
#else
|
||||
|
||||
typedef int _Bool;
|
||||
|
||||
#define bool _Bool;
|
||||
|
||||
#define false 0
|
||||
#define true 1
|
||||
#endif
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE true
|
||||
#endif
|
||||
#ifndef FALSE
|
||||
#define FALSE false
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Stolen from Mozzila, this code should deal with bad implementations of stdc++.
|
||||
*
|
||||
|
@ -182,6 +174,16 @@ typedef int _Bool;
|
|||
#define DUMMY_FILLER_FOR_ABS_TYPE int dummy;
|
||||
#endif /* HAVE_GCC */
|
||||
|
||||
/*************************************************************************************************
|
||||
main exports in YapInterface.h
|
||||
*************************************************************************************************/
|
||||
|
||||
/* Basic exports */
|
||||
|
||||
#include "YapDefs.h"
|
||||
|
||||
/* expect controls the direction of branches */
|
||||
|
||||
#ifdef HAVE___BUILTIN_EXPECT
|
||||
#define likely(x) __builtin_expect((x), 1)
|
||||
#define unlikely(x) __builtin_expect((x), 0)
|
||||
|
@ -199,20 +201,10 @@ typedef int _Bool;
|
|||
#include <pthread.h>
|
||||
#endif /* THREADS */
|
||||
|
||||
#ifndef ADTDEFS_C
|
||||
#define EXTERN static
|
||||
#else
|
||||
#define EXTERN
|
||||
#endif /* ADTDEFS_C */
|
||||
|
||||
|
||||
/* null pointer */
|
||||
#define NIL 0
|
||||
|
||||
/* Basic types */
|
||||
|
||||
#include "YapTerm.h"
|
||||
|
||||
#if HAVE_SIGPROF && (defined(__linux__) || defined(__APPLE__))
|
||||
#define LOW_PROF 1
|
||||
#endif
|
||||
|
@ -349,7 +341,7 @@ typedef pthread_rwlock_t rwlock_t;
|
|||
|
||||
|
||||
/*************************************************************************************************
|
||||
use an auxiliary function for ranges
|
||||
use an auxiliary function for ranges
|
||||
*************************************************************************************************/
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
@ -365,21 +357,13 @@ typedef pthread_rwlock_t rwlock_t;
|
|||
#endif
|
||||
|
||||
/*************************************************************************************************
|
||||
main exports in YapInterface.h
|
||||
*************************************************************************************************/
|
||||
|
||||
/* Basic exports */
|
||||
|
||||
#include "YapDefs.h"
|
||||
|
||||
/*************************************************************************************************
|
||||
Atoms
|
||||
Atoms
|
||||
*************************************************************************************************/
|
||||
|
||||
#include "Atoms.h"
|
||||
|
||||
/*************************************************************************************************
|
||||
Coroutining
|
||||
Coroutining
|
||||
*************************************************************************************************/
|
||||
|
||||
|
||||
|
@ -389,7 +373,7 @@ typedef pthread_rwlock_t rwlock_t;
|
|||
#endif
|
||||
|
||||
/*************************************************************************************************
|
||||
abstract machine registers
|
||||
abstract machine registers
|
||||
*************************************************************************************************/
|
||||
|
||||
#include "amidefs.h"
|
||||
|
@ -406,7 +390,7 @@ typedef pthread_rwlock_t rwlock_t;
|
|||
#endif
|
||||
|
||||
/*************************************************************************************************
|
||||
variables concerned with Error Handling
|
||||
variables concerned with Error Handling
|
||||
*************************************************************************************************/
|
||||
|
||||
#include <setjmp.h>
|
||||
|
@ -496,7 +480,7 @@ typedef enum
|
|||
#define TermSize sizeof(Term)
|
||||
|
||||
/*************************************************************************************************
|
||||
variables related to memory allocation
|
||||
variables related to memory allocation
|
||||
*************************************************************************************************/
|
||||
/* must be before TermExt.h */
|
||||
|
||||
|
@ -561,7 +545,7 @@ typedef struct opcode_tab_entry
|
|||
#endif
|
||||
|
||||
/*************************************************************************************************
|
||||
Prolog may be in several modes
|
||||
Prolog may be in several modes
|
||||
*************************************************************************************************/
|
||||
|
||||
typedef enum
|
||||
|
@ -679,13 +663,16 @@ typedef struct TIMED_MAVAR
|
|||
|
||||
typedef enum
|
||||
{
|
||||
INTERPRETED, /* interpreted */
|
||||
MIXED_MODE_USER, /* mixed mode only for user predicates */
|
||||
MIXED_MODE_ALL, /* mixed mode for all predicates */
|
||||
COMPILE_USER, /* compile all user predicates*/
|
||||
COMPILE_ALL /* compile all predicates */
|
||||
INTERPRETED = 0x1, /* interpreted */
|
||||
MIXED_MODE_USER = 0x2, /* mixed mode only for user predicates */
|
||||
MIXED_MODE_ALL = 0x4, /* mixed mode for all predicates */
|
||||
COMPILE_USER = 0x8, /* compile all user predicates*/
|
||||
COMPILE_ALL = 0x10 /* compile all predicates */
|
||||
} yap_exec_mode;
|
||||
|
||||
#define MIXED_MODE ( MIXED_MODE_USER | MIXED_MODE_ALL )
|
||||
|
||||
#define COMPILED ( COMPILE_USER | COMPILE_ALL )
|
||||
|
||||
/************************/
|
||||
// queues are an example of collections of DB objects
|
||||
|
@ -855,6 +842,16 @@ extern struct worker_local Yap_local;
|
|||
|
||||
#include "YapSignals.h"
|
||||
|
||||
/*************************************************************************************************
|
||||
Global variables for JIT
|
||||
*************************************************************************************************/
|
||||
|
||||
#if YAP_JIT
|
||||
#ifndef __cplusplus
|
||||
#ifndef _NATIVE
|
||||
#include "JIT.hpp"
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* YAP_H */
|
||||
|
||||
|
|
478
H/YapOpcodes.h
478
H/YapOpcodes.h
|
@ -4,6 +4,9 @@
|
|||
|
||||
OPCODE(Ystop ,l),
|
||||
OPCODE(Nstop ,e),
|
||||
#ifdef YAP_JIT
|
||||
OPCODE(jit_handler ,J),
|
||||
#endif
|
||||
OPCODE(try_me ,Otapl),
|
||||
OPCODE(retry_me ,Otapl),
|
||||
OPCODE(trust_me ,Otapl),
|
||||
|
@ -20,25 +23,39 @@
|
|||
OPCODE(retry_profiled ,p),
|
||||
OPCODE(profiled_retry_me ,Otapl),
|
||||
OPCODE(profiled_trust_me ,Otapl),
|
||||
OPCODE(profiled_retry_logical ,OtaLl),
|
||||
OPCODE(profiled_trust_logical ,OtILl),
|
||||
OPCODE(count_call ,p),
|
||||
OPCODE(count_retry ,p),
|
||||
OPCODE(count_retry_me ,Otapl),
|
||||
OPCODE(count_trust_me ,Otapl),
|
||||
OPCODE(count_retry_logical ,OtaLl),
|
||||
OPCODE(count_trust_logical ,OtILl),
|
||||
OPCODE(lock_lu ,p),
|
||||
OPCODE(unlock_lu ,e),
|
||||
OPCODE(alloc_for_logical_pred ,L),
|
||||
OPCODE(copy_idb_term ,e),
|
||||
OPCODE(unify_idb_term ,e),
|
||||
OPCODE(ensure_space ,Osbpa),
|
||||
OPCODE(spy_or_trymark ,Otapl),
|
||||
OPCODE(try_and_mark ,Otapl),
|
||||
OPCODE(count_retry_and_mark ,Otapl),
|
||||
OPCODE(profiled_retry_and_mark ,Otapl),
|
||||
OPCODE(retry_and_mark ,Otapl),
|
||||
OPCODE(try_clause ,Otapl),
|
||||
OPCODE(try_clause2 ,l),
|
||||
OPCODE(try_clause3 ,l),
|
||||
OPCODE(try_clause4 ,l),
|
||||
OPCODE(retry ,Otapl),
|
||||
OPCODE(retry2 ,l),
|
||||
OPCODE(retry3 ,l),
|
||||
OPCODE(retry4 ,l),
|
||||
OPCODE(trust ,Otapl),
|
||||
OPCODE(try_in ,l),
|
||||
OPCODE(enter_lu_pred ,Illss),
|
||||
OPCODE(profiled_retry_logical ,OtaLl),
|
||||
OPCODE(profiled_trust_logical ,OtILl),
|
||||
OPCODE(try_logical ,OtaLl),
|
||||
OPCODE(count_retry_logical ,OtaLl),
|
||||
OPCODE(count_trust_logical ,OtILl),
|
||||
OPCODE(retry_logical ,OtaLl),
|
||||
OPCODE(trust_logical ,OtILl),
|
||||
OPCODE(lock_lu ,p),
|
||||
OPCODE(unlock_lu ,e),
|
||||
OPCODE(alloc_for_logical_pred ,L),
|
||||
OPCODE(copy_idb_term ,e),
|
||||
OPCODE(unify_idb_term ,e),
|
||||
OPCODE(trust_fail ,e),
|
||||
OPCODE(op_fail ,e),
|
||||
OPCODE(cut ,s),
|
||||
|
@ -190,13 +207,6 @@
|
|||
OPCODE(save_appl_x_write ,ox),
|
||||
OPCODE(save_appl_y ,oy),
|
||||
OPCODE(save_appl_y_write ,oy),
|
||||
OPCODE(jump ,l),
|
||||
OPCODE(move_back ,l),
|
||||
OPCODE(skip ,l),
|
||||
OPCODE(either ,Osblp),
|
||||
OPCODE(or_else ,Osblp),
|
||||
OPCODE(pop_n ,s),
|
||||
OPCODE(pop ,e),
|
||||
OPCODE(call_cpred ,Osbpp),
|
||||
OPCODE(execute_cpred ,pp),
|
||||
OPCODE(call_usercpred ,Osbpp),
|
||||
|
@ -216,20 +226,13 @@
|
|||
OPCODE(expand_clauses ,sssllp),
|
||||
OPCODE(undef_p ,e),
|
||||
OPCODE(spy_pred ,e),
|
||||
OPCODE(try_clause ,Otapl),
|
||||
OPCODE(try_clause2 ,l),
|
||||
OPCODE(try_clause3 ,l),
|
||||
OPCODE(try_clause4 ,l),
|
||||
OPCODE(retry ,Otapl),
|
||||
OPCODE(retry2 ,l),
|
||||
OPCODE(retry3 ,l),
|
||||
OPCODE(retry4 ,l),
|
||||
OPCODE(trust ,Otapl),
|
||||
OPCODE(try_in ,l),
|
||||
OPCODE(enter_lu_pred ,Illss),
|
||||
OPCODE(try_logical ,OtaLl),
|
||||
OPCODE(retry_logical ,OtaLl),
|
||||
OPCODE(trust_logical ,OtILl),
|
||||
OPCODE(jump ,l),
|
||||
OPCODE(move_back ,l),
|
||||
OPCODE(skip ,l),
|
||||
OPCODE(either ,Osblp),
|
||||
OPCODE(or_else ,Osblp),
|
||||
OPCODE(pop_n ,s),
|
||||
OPCODE(pop ,e),
|
||||
OPCODE(user_switch ,lp),
|
||||
OPCODE(switch_on_type ,llll),
|
||||
OPCODE(switch_list_nl ,ollll),
|
||||
|
@ -247,7 +250,6 @@
|
|||
OPCODE(index_dbref ,e),
|
||||
OPCODE(index_blob ,e),
|
||||
OPCODE(index_long ,e),
|
||||
OPCODE(native_me ,aFlp),
|
||||
OPCODE(p_atom_x ,xl),
|
||||
OPCODE(p_atom_y ,yl),
|
||||
OPCODE(p_atomic_x ,xl),
|
||||
|
@ -421,9 +423,415 @@
|
|||
OPCODE(trie_try_gterm ,e),
|
||||
OPCODE(trie_retry_gterm ,e),
|
||||
#endif
|
||||
/* this instruction is hardwired */
|
||||
#ifdef YAP_JIT
|
||||
OPCODE(traced_Ystop ,l),
|
||||
OPCODE(traced_Nstop ,e),
|
||||
OPCODE(traced_try_me ,Otapl),
|
||||
OPCODE(traced_retry_me ,Otapl),
|
||||
OPCODE(traced_trust_me ,Otapl),
|
||||
OPCODE(traced_enter_profiling ,p),
|
||||
OPCODE(traced_retry_profiled ,p),
|
||||
OPCODE(traced_profiled_retry_me ,Otapl),
|
||||
OPCODE(traced_profiled_trust_me ,Otapl),
|
||||
OPCODE(traced_profiled_retry_logical,OtaLl),
|
||||
OPCODE(traced_profiled_trust_logical,OtILl),
|
||||
OPCODE(traced_count_call ,p),
|
||||
OPCODE(traced_count_retry ,p),
|
||||
OPCODE(traced_count_retry_me ,Otapl),
|
||||
OPCODE(traced_count_trust_me ,Otapl),
|
||||
OPCODE(traced_count_retry_logical ,OtaLl),
|
||||
OPCODE(traced_count_trust_logical ,OtILl),
|
||||
OPCODE(traced_lock_lu ,p),
|
||||
OPCODE(traced_unlock_lu ,e),
|
||||
OPCODE(traced_alloc_for_logical_pred,L),
|
||||
OPCODE(traced_copy_idb_term ,e),
|
||||
OPCODE(traced_unify_idb_term ,e),
|
||||
OPCODE(traced_ensure_space ,Osbpa),
|
||||
OPCODE(traced_spy_or_trymark ,Otapl),
|
||||
OPCODE(traced_try_and_mark ,Otapl),
|
||||
OPCODE(traced_count_retry_and_mark,Otapl),
|
||||
OPCODE(traced_profiled_retry_and_mark,Otapl),
|
||||
OPCODE(traced_retry_and_mark ,Otapl),
|
||||
OPCODE(traced_trust_fail ,e),
|
||||
OPCODE(traced_op_fail ,e),
|
||||
OPCODE(traced_cut ,s),
|
||||
OPCODE(traced_cut_t ,s),
|
||||
OPCODE(traced_cut_e ,s),
|
||||
OPCODE(traced_save_b_x ,x),
|
||||
OPCODE(traced_save_b_y ,y),
|
||||
OPCODE(traced_commit_b_x ,xps),
|
||||
OPCODE(traced_commit_b_y ,yps),
|
||||
OPCODE(traced_execute ,pp),
|
||||
OPCODE(traced_dexecute ,pp),
|
||||
OPCODE(traced_fcall ,Osbpp),
|
||||
OPCODE(traced_call ,Osbpp),
|
||||
OPCODE(traced_procceed ,p),
|
||||
OPCODE(traced_allocate ,e),
|
||||
OPCODE(traced_deallocate ,p),
|
||||
OPCODE(traced_retry_eam ,e),
|
||||
OPCODE(traced_run_eam ,os),
|
||||
OPCODE(traced_get_x_var ,xx),
|
||||
OPCODE(traced_get_y_var ,yx),
|
||||
OPCODE(traced_get_yy_var ,yyxx),
|
||||
OPCODE(traced_get_x_val ,xx),
|
||||
OPCODE(traced_get_y_val ,yx),
|
||||
OPCODE(traced_get_atom ,xc),
|
||||
OPCODE(traced_get_2atoms ,cc),
|
||||
OPCODE(traced_get_3atoms ,ccc),
|
||||
OPCODE(traced_get_4atoms ,cccc),
|
||||
OPCODE(traced_get_5atoms ,ccccc),
|
||||
OPCODE(traced_get_6atoms ,cccccc),
|
||||
OPCODE(traced_get_list ,x),
|
||||
OPCODE(traced_get_struct ,xfa),
|
||||
OPCODE(traced_get_float ,xd),
|
||||
OPCODE(traced_get_longint ,xi),
|
||||
OPCODE(traced_get_bigint ,xN),
|
||||
OPCODE(traced_get_dbterm ,xD),
|
||||
OPCODE(traced_glist_valx ,xx),
|
||||
OPCODE(traced_glist_valy ,yx),
|
||||
OPCODE(traced_gl_void_varx ,xx),
|
||||
OPCODE(traced_gl_void_vary ,yx),
|
||||
OPCODE(traced_gl_void_valx ,xx),
|
||||
OPCODE(traced_gl_void_valy ,yx),
|
||||
OPCODE(traced_unify_x_var ,ox),
|
||||
OPCODE(traced_unify_x_var_write ,ox),
|
||||
OPCODE(traced_unify_l_x_var ,ox),
|
||||
OPCODE(traced_unify_l_x_var_write ,ox),
|
||||
OPCODE(traced_unify_x_var2 ,oxx),
|
||||
OPCODE(traced_unify_x_var2_write ,oxx),
|
||||
OPCODE(traced_unify_l_x_var2 ,oxx),
|
||||
OPCODE(traced_unify_l_x_var2_write,oxx),
|
||||
OPCODE(traced_unify_y_var ,oy),
|
||||
OPCODE(traced_unify_y_var_write ,oy),
|
||||
OPCODE(traced_unify_l_y_var ,oy),
|
||||
OPCODE(traced_unify_l_y_var_write ,oy),
|
||||
OPCODE(traced_unify_x_val ,ox),
|
||||
OPCODE(traced_unify_x_val_write ,ox),
|
||||
OPCODE(traced_unify_l_x_val ,ox),
|
||||
OPCODE(traced_unify_l_x_val_write ,ox),
|
||||
OPCODE(traced_unify_y_val ,oy),
|
||||
OPCODE(traced_unify_y_val_write ,oy),
|
||||
OPCODE(traced_unify_l_y_val ,oy),
|
||||
OPCODE(traced_unify_l_y_val_write ,oy),
|
||||
OPCODE(traced_unify_x_loc ,ox),
|
||||
OPCODE(traced_unify_x_loc_write ,ox),
|
||||
OPCODE(traced_unify_l_x_loc ,ox),
|
||||
OPCODE(traced_unify_l_x_loc_write ,ox),
|
||||
OPCODE(traced_unify_y_loc ,oy),
|
||||
OPCODE(traced_unify_y_loc_write ,oy),
|
||||
OPCODE(traced_unify_l_y_loc ,oy),
|
||||
OPCODE(traced_unify_l_y_loc_write ,oy),
|
||||
OPCODE(traced_unify_void ,o),
|
||||
OPCODE(traced_unify_void_write ,o),
|
||||
OPCODE(traced_unify_l_void ,o),
|
||||
OPCODE(traced_unify_l_void_write ,o),
|
||||
OPCODE(traced_unify_n_voids ,os),
|
||||
OPCODE(traced_unify_n_voids_write ,os),
|
||||
OPCODE(traced_unify_l_n_voids ,os),
|
||||
OPCODE(traced_unify_l_n_voids_write,os),
|
||||
OPCODE(traced_unify_atom ,oc),
|
||||
OPCODE(traced_unify_atom_write ,oc),
|
||||
OPCODE(traced_unify_l_atom ,oc),
|
||||
OPCODE(traced_unify_l_atom_write ,oc),
|
||||
OPCODE(traced_unify_n_atoms ,osc),
|
||||
OPCODE(traced_unify_n_atoms_write ,osc),
|
||||
OPCODE(traced_unify_float ,od),
|
||||
OPCODE(traced_unify_float_write ,od),
|
||||
OPCODE(traced_unify_l_float ,od),
|
||||
OPCODE(traced_unify_l_float_write ,od),
|
||||
OPCODE(traced_unify_longint ,oi),
|
||||
OPCODE(traced_unify_longint_write ,oi),
|
||||
OPCODE(traced_unify_l_longint ,oi),
|
||||
OPCODE(traced_unify_l_longint_write,oi),
|
||||
OPCODE(traced_unify_bigint ,oN),
|
||||
OPCODE(traced_unify_l_bigint ,oN),
|
||||
OPCODE(traced_unify_dbterm ,oD),
|
||||
OPCODE(traced_unify_l_dbterm ,oD),
|
||||
OPCODE(traced_unify_list ,o),
|
||||
OPCODE(traced_unify_list_write ,o),
|
||||
OPCODE(traced_unify_l_list ,o),
|
||||
OPCODE(traced_unify_l_list_write ,o),
|
||||
OPCODE(traced_unify_struct ,ofa),
|
||||
OPCODE(traced_unify_struct_write ,ofa),
|
||||
OPCODE(traced_unify_l_struc ,ofa),
|
||||
OPCODE(traced_unify_l_struc_write ,ofa),
|
||||
OPCODE(traced_put_x_var ,xx),
|
||||
OPCODE(traced_put_y_var ,yx),
|
||||
OPCODE(traced_put_x_val ,xx),
|
||||
OPCODE(traced_put_xx_val ,xxxx),
|
||||
OPCODE(traced_put_y_val ,yx),
|
||||
OPCODE(traced_put_y_vals ,yyxx),
|
||||
OPCODE(traced_put_unsafe ,yx),
|
||||
OPCODE(traced_put_atom ,xc),
|
||||
OPCODE(traced_put_dbterm ,xD),
|
||||
OPCODE(traced_put_bigint ,xN),
|
||||
OPCODE(traced_put_float ,xd),
|
||||
OPCODE(traced_put_longint ,xi),
|
||||
OPCODE(traced_put_list ,x),
|
||||
OPCODE(traced_put_struct ,xfa),
|
||||
OPCODE(traced_write_x_var ,x),
|
||||
OPCODE(traced_write_void ,e),
|
||||
OPCODE(traced_write_n_voids ,s),
|
||||
OPCODE(traced_write_y_var ,y),
|
||||
OPCODE(traced_write_x_val ,x),
|
||||
OPCODE(traced_write_x_loc ,x),
|
||||
OPCODE(traced_write_y_val ,y),
|
||||
OPCODE(traced_write_y_loc ,y),
|
||||
OPCODE(traced_write_atom ,c),
|
||||
OPCODE(traced_write_bigint ,N),
|
||||
OPCODE(traced_write_dbterm ,D),
|
||||
OPCODE(traced_write_float ,d),
|
||||
OPCODE(traced_write_longint ,i),
|
||||
OPCODE(traced_write_n_atoms ,sc),
|
||||
OPCODE(traced_write_list ,e),
|
||||
OPCODE(traced_write_l_list ,e),
|
||||
OPCODE(traced_write_struct ,fa),
|
||||
OPCODE(traced_write_l_struc ,fa),
|
||||
OPCODE(traced_save_pair_x ,ox),
|
||||
OPCODE(traced_save_pair_x_write ,ox),
|
||||
OPCODE(traced_save_pair_y ,oy),
|
||||
OPCODE(traced_save_pair_y_write ,oy),
|
||||
OPCODE(traced_save_appl_x ,ox),
|
||||
OPCODE(traced_save_appl_x_write ,ox),
|
||||
OPCODE(traced_save_appl_y ,oy),
|
||||
OPCODE(traced_save_appl_y_write ,oy),
|
||||
OPCODE(traced_jump ,l),
|
||||
OPCODE(traced_move_back ,l),
|
||||
OPCODE(traced_skip ,l),
|
||||
OPCODE(traced_either ,Osblp),
|
||||
OPCODE(traced_or_else ,Osblp),
|
||||
OPCODE(traced_pop_n ,s),
|
||||
OPCODE(traced_pop ,e),
|
||||
OPCODE(traced_call_cpred ,Osbpp),
|
||||
OPCODE(traced_execute_cpred ,pp),
|
||||
OPCODE(traced_call_usercpred ,Osbpp),
|
||||
OPCODE(traced_call_c_wfail ,slp),
|
||||
OPCODE(traced_try_c ,OtapFs),
|
||||
OPCODE(traced_retry_c ,OtapFs),
|
||||
OPCODE(traced_cut_c ,OtapFs),
|
||||
OPCODE(traced_try_userc ,OtapFs),
|
||||
OPCODE(traced_retry_userc ,OtapFs),
|
||||
OPCODE(traced_cut_userc ,OtapFs),
|
||||
OPCODE(traced_lock_pred ,e),
|
||||
OPCODE(traced_index_pred ,e),
|
||||
OPCODE(traced_thread_local ,e),
|
||||
OPCODE(traced_expand_index ,e),
|
||||
OPCODE(traced_expand_clauses ,sssllp),
|
||||
OPCODE(traced_undef_p ,e),
|
||||
OPCODE(traced_spy_pred ,e),
|
||||
OPCODE(traced_try_clause ,Otapl),
|
||||
OPCODE(traced_try_clause2 ,l),
|
||||
OPCODE(traced_try_clause3 ,l),
|
||||
OPCODE(traced_try_clause4 ,l),
|
||||
OPCODE(traced_retry ,Otapl),
|
||||
OPCODE(traced_retry2 ,l),
|
||||
OPCODE(traced_retry3 ,l),
|
||||
OPCODE(traced_retry4 ,l),
|
||||
OPCODE(traced_trust ,Otapl),
|
||||
OPCODE(traced_try_in ,l),
|
||||
OPCODE(traced_enter_lu_pred ,Illss),
|
||||
OPCODE(traced_try_logical ,OtaLl),
|
||||
OPCODE(traced_retry_logical ,OtaLl),
|
||||
OPCODE(traced_trust_logical ,OtILl),
|
||||
OPCODE(traced_user_switch ,lp),
|
||||
OPCODE(traced_switch_on_type ,llll),
|
||||
OPCODE(traced_switch_list_nl ,ollll),
|
||||
OPCODE(traced_switch_on_arg_type ,xllll),
|
||||
OPCODE(traced_switch_on_sub_arg_type,sllll),
|
||||
OPCODE(traced_jump_if_var ,l),
|
||||
OPCODE(traced_jump_if_nonvar ,xll),
|
||||
OPCODE(traced_if_not_then ,clll),
|
||||
OPCODE(traced_switch_on_func ,sssl),
|
||||
OPCODE(traced_switch_on_cons ,sssl),
|
||||
OPCODE(traced_go_on_func ,sssl),
|
||||
OPCODE(traced_go_on_cons ,sssl),
|
||||
OPCODE(traced_if_func ,sssl),
|
||||
OPCODE(traced_if_cons ,sssl),
|
||||
OPCODE(traced_index_dbref ,e),
|
||||
OPCODE(traced_index_blob ,e),
|
||||
OPCODE(traced_index_long ,e),
|
||||
OPCODE(traced_jit_handler ,J),
|
||||
OPCODE(traced_p_atom_x ,xl),
|
||||
OPCODE(traced_p_atom_y ,yl),
|
||||
OPCODE(traced_p_atomic_x ,xl),
|
||||
OPCODE(traced_p_atomic_y ,yl),
|
||||
OPCODE(traced_p_integer_x ,xl),
|
||||
OPCODE(traced_p_integer_y ,yl),
|
||||
OPCODE(traced_p_nonvar_x ,xl),
|
||||
OPCODE(traced_p_nonvar_y ,yl),
|
||||
OPCODE(traced_p_number_x ,xl),
|
||||
OPCODE(traced_p_number_y ,yl),
|
||||
OPCODE(traced_p_var_x ,xl),
|
||||
OPCODE(traced_p_var_y ,yl),
|
||||
OPCODE(traced_p_db_ref_x ,xl),
|
||||
OPCODE(traced_p_db_ref_y ,yl),
|
||||
OPCODE(traced_p_primitive_x ,xl),
|
||||
OPCODE(traced_p_primitive_y ,yl),
|
||||
OPCODE(traced_p_compound_x ,xl),
|
||||
OPCODE(traced_p_compound_y ,yl),
|
||||
OPCODE(traced_p_float_x ,xl),
|
||||
OPCODE(traced_p_float_y ,yl),
|
||||
OPCODE(traced_p_plus_vv ,xxx),
|
||||
OPCODE(traced_p_plus_vc ,xxn),
|
||||
OPCODE(traced_p_plus_y_vv ,yxx),
|
||||
OPCODE(traced_p_plus_y_vc ,yxn),
|
||||
OPCODE(traced_p_minus_vv ,xxx),
|
||||
OPCODE(traced_p_minus_cv ,xxn),
|
||||
OPCODE(traced_p_minus_y_vv ,yxx),
|
||||
OPCODE(traced_p_minus_y_cv ,yxn),
|
||||
OPCODE(traced_p_times_vv ,xxx),
|
||||
OPCODE(traced_p_times_vc ,xxn),
|
||||
OPCODE(traced_p_times_y_vv ,yxx),
|
||||
OPCODE(traced_p_times_y_vc ,yxn),
|
||||
OPCODE(traced_p_div_vv ,xxx),
|
||||
OPCODE(traced_p_div_vc ,xxn),
|
||||
OPCODE(traced_p_div_cv ,xxn),
|
||||
OPCODE(traced_p_div_y_vv ,yxx),
|
||||
OPCODE(traced_p_div_y_vc ,yxn),
|
||||
OPCODE(traced_p_div_y_cv ,yxn),
|
||||
OPCODE(traced_p_and_vv ,xxx),
|
||||
OPCODE(traced_p_and_vc ,xxn),
|
||||
OPCODE(traced_p_and_y_vv ,yxx),
|
||||
OPCODE(traced_p_and_y_vc ,yxn),
|
||||
OPCODE(traced_p_or_vv ,xxx),
|
||||
OPCODE(traced_p_or_vc ,xxn),
|
||||
OPCODE(traced_p_or_y_vv ,yxx),
|
||||
OPCODE(traced_p_or_y_vc ,yxn),
|
||||
OPCODE(traced_p_sll_vv ,xxx),
|
||||
OPCODE(traced_p_sll_vc ,xxn),
|
||||
OPCODE(traced_p_sll_cv ,xxn),
|
||||
OPCODE(traced_p_sll_y_vv ,yxx),
|
||||
OPCODE(traced_p_sll_y_vc ,yxn),
|
||||
OPCODE(traced_p_sll_y_cv ,yxn),
|
||||
OPCODE(traced_p_slr_vv ,xxx),
|
||||
OPCODE(traced_p_slr_vc ,xxn),
|
||||
OPCODE(traced_p_slr_cv ,xxn),
|
||||
OPCODE(traced_p_slr_y_vv ,yxx),
|
||||
OPCODE(traced_p_slr_y_vc ,yxn),
|
||||
OPCODE(traced_p_slr_y_cv ,yxn),
|
||||
OPCODE(traced_call_bfunc_xx ,plxxs),
|
||||
OPCODE(traced_call_bfunc_yx ,plxys),
|
||||
OPCODE(traced_call_bfunc_xy ,plxys),
|
||||
OPCODE(traced_call_bfunc_yy ,plyys),
|
||||
OPCODE(traced_p_equal ,e),
|
||||
OPCODE(traced_p_dif ,l),
|
||||
OPCODE(traced_p_eq ,l),
|
||||
OPCODE(traced_p_arg_vv ,xxx),
|
||||
OPCODE(traced_p_arg_cv ,xxn),
|
||||
OPCODE(traced_p_arg_y_vv ,yxx),
|
||||
OPCODE(traced_p_arg_y_cv ,yxn),
|
||||
OPCODE(traced_p_func2s_vv ,xxx),
|
||||
OPCODE(traced_p_func2s_cv ,xxc),
|
||||
OPCODE(traced_p_func2s_vc ,xxn),
|
||||
OPCODE(traced_p_func2s_y_vv ,yxx),
|
||||
OPCODE(traced_p_func2s_y_cv ,yxn),
|
||||
OPCODE(traced_p_func2s_y_vc ,yxn),
|
||||
OPCODE(traced_p_func2f_xx ,xxx),
|
||||
OPCODE(traced_p_func2f_xy ,xxy),
|
||||
OPCODE(traced_p_func2f_yx ,yxx),
|
||||
OPCODE(traced_p_func2f_yy ,yyx),
|
||||
OPCODE(traced_p_functor ,e),
|
||||
OPCODE(traced_p_execute_tail ,Osbmp),
|
||||
OPCODE(traced_p_execute2 ,Osbpp),
|
||||
OPCODE(traced_p_execute ,Osbmp),
|
||||
#ifdef YAPOR
|
||||
OPCODE(or_last ,sblp)
|
||||
#else
|
||||
OPCODE(or_last ,p)
|
||||
OPCODE(traced_getwork_first_time ,e),
|
||||
OPCODE(traced_getwork ,Otapl),
|
||||
OPCODE(traced_getwork_seq ,Otapl),
|
||||
OPCODE(traced_sync ,Otapl),
|
||||
#endif
|
||||
#ifdef TABLING
|
||||
OPCODE(traced_clause_with_cut ,e),
|
||||
OPCODE(traced_table_load_answer ,Otapl),
|
||||
OPCODE(traced_table_try_answer ,Otapl),
|
||||
OPCODE(traced_table_try_single ,Otapl),
|
||||
OPCODE(traced_table_try_me ,Otapl),
|
||||
OPCODE(traced_table_try ,Otapl),
|
||||
OPCODE(traced_table_retry_me ,Otapl),
|
||||
OPCODE(traced_table_retry ,Otapl),
|
||||
OPCODE(traced_table_trust_me ,Otapl),
|
||||
OPCODE(traced_table_trust ,Otapl),
|
||||
OPCODE(traced_table_new_answer ,s),
|
||||
OPCODE(traced_table_answer_resolution,Otapl),
|
||||
OPCODE(traced_table_completion ,Otapl),
|
||||
OPCODE(traced_table_answer_resolution_completion,Otapl),
|
||||
OPCODE(traced_trie_do_var ,e),
|
||||
OPCODE(traced_trie_trust_var ,e),
|
||||
OPCODE(traced_trie_try_var ,e),
|
||||
OPCODE(traced_trie_retry_var ,e),
|
||||
OPCODE(traced_trie_do_var_in_pair ,e),
|
||||
OPCODE(traced_trie_trust_var_in_pair,e),
|
||||
OPCODE(traced_trie_try_var_in_pair,e),
|
||||
OPCODE(traced_trie_retry_var_in_pair,e),
|
||||
OPCODE(traced_trie_do_val ,e),
|
||||
OPCODE(traced_trie_trust_val ,e),
|
||||
OPCODE(traced_trie_try_val ,e),
|
||||
OPCODE(traced_trie_retry_val ,e),
|
||||
OPCODE(traced_trie_do_val_in_pair ,e),
|
||||
OPCODE(traced_trie_trust_val_in_pair,e),
|
||||
OPCODE(traced_trie_try_val_in_pair,e),
|
||||
OPCODE(traced_trie_retry_val_in_pair,e),
|
||||
OPCODE(traced_trie_do_atom ,e),
|
||||
OPCODE(traced_trie_trust_atom ,e),
|
||||
OPCODE(traced_trie_try_atom ,e),
|
||||
OPCODE(traced_trie_retry_atom ,e),
|
||||
OPCODE(traced_trie_do_atom_in_pair,e),
|
||||
OPCODE(traced_trie_trust_atom_in_pair,e),
|
||||
OPCODE(traced_trie_try_atom_in_pair,e),
|
||||
OPCODE(traced_trie_retry_atom_in_pair,e),
|
||||
OPCODE(traced_trie_do_null ,e),
|
||||
OPCODE(traced_trie_trust_null ,e),
|
||||
OPCODE(traced_trie_try_null ,e),
|
||||
OPCODE(traced_trie_retry_null ,e),
|
||||
OPCODE(traced_trie_do_null_in_pair,e),
|
||||
OPCODE(traced_trie_trust_null_in_pair,e),
|
||||
OPCODE(traced_trie_try_null_in_pair,e),
|
||||
OPCODE(traced_trie_retry_null_in_pair,e),
|
||||
OPCODE(traced_trie_do_pair ,e),
|
||||
OPCODE(traced_trie_trust_pair ,e),
|
||||
OPCODE(traced_trie_try_pair ,e),
|
||||
OPCODE(traced_trie_retry_pair ,e),
|
||||
OPCODE(traced_trie_do_appl ,e),
|
||||
OPCODE(traced_trie_trust_appl ,e),
|
||||
OPCODE(traced_trie_try_appl ,e),
|
||||
OPCODE(traced_trie_retry_appl ,e),
|
||||
OPCODE(traced_trie_do_appl_in_pair,e),
|
||||
OPCODE(traced_trie_trust_appl_in_pair,e),
|
||||
OPCODE(traced_trie_try_appl_in_pair,e),
|
||||
OPCODE(traced_trie_retry_appl_in_pair,e),
|
||||
OPCODE(traced_trie_do_extension ,e),
|
||||
OPCODE(traced_trie_trust_extension,e),
|
||||
OPCODE(traced_trie_try_extension ,e),
|
||||
OPCODE(traced_trie_retry_extension,e),
|
||||
OPCODE(traced_trie_do_double ,e),
|
||||
OPCODE(traced_trie_trust_double ,e),
|
||||
OPCODE(traced_trie_try_double ,e),
|
||||
OPCODE(traced_trie_retry_double ,e),
|
||||
OPCODE(traced_trie_do_longint ,e),
|
||||
OPCODE(traced_trie_trust_longint ,e),
|
||||
OPCODE(traced_trie_try_longint ,e),
|
||||
OPCODE(traced_trie_retry_longint ,e),
|
||||
OPCODE(traced_trie_do_bigint ,e),
|
||||
OPCODE(traced_trie_trust_bigint ,e),
|
||||
OPCODE(traced_trie_try_bigint ,e),
|
||||
OPCODE(traced_trie_retry_bigint ,e),
|
||||
OPCODE(traced_trie_do_gterm ,e),
|
||||
OPCODE(traced_trie_trust_gterm ,e),
|
||||
OPCODE(traced_trie_try_gterm ,e),
|
||||
OPCODE(traced_trie_retry_gterm ,e),
|
||||
#endif
|
||||
#endif
|
||||
/* this instruction is hardwired */
|
||||
/* or_last must be the last instruction. */
|
||||
#ifdef YAP_JIT
|
||||
#ifdef YAPOR
|
||||
OPCODE(traced_or_last ,sblp),
|
||||
#else
|
||||
OPCODE(traced_or_last ,p),
|
||||
#endif
|
||||
#endif
|
||||
#ifdef YAPOR
|
||||
OPCODE(or_last ,sblp),
|
||||
#else
|
||||
OPCODE(or_last ,p),
|
||||
#endif
|
||||
|
|
|
@ -323,7 +323,7 @@ INLINE_ONLY EXTERN inline Term MkPairTerm__(Term head, Term tail USES_REGS );
|
|||
INLINE_ONLY EXTERN inline Term
|
||||
MkPairTerm__ (Term head, Term tail USES_REGS)
|
||||
{
|
||||
register CELL *p = HR;
|
||||
CELL *p = HR;
|
||||
|
||||
HR[0] = head;
|
||||
HR[1] = tail;
|
||||
|
|
|
@ -28,7 +28,7 @@ typedef void *Atom;
|
|||
|
||||
#endif
|
||||
|
||||
#define ALIGN_YAPTYPE(X,TYPE) (((CELL)(X)+(sizeof(TYPE)-1)) & ~(sizeof(TYPE)-1))
|
||||
#define ALIGN_BY_TYPE(X,TYPE) (((CELL)(X)+(sizeof(TYPE)-1)) & ~(sizeof(TYPE)-1))
|
||||
|
||||
|
||||
#ifndef EXTERN
|
||||
|
@ -43,10 +43,10 @@ typedef uintptr_t UInt;
|
|||
|
||||
#if SIZEOF_INT_P==4
|
||||
|
||||
#if SIZEOF_INT==4
|
||||
#if SIZEOF_LONGINT==4
|
||||
|
||||
#define Int_FORMAT "%d"
|
||||
#define UInt_FORMAT "%u"
|
||||
#define Int_FORMAT "%l"
|
||||
#define UInt_FORMAT "%ul"
|
||||
|
||||
#elif SIZEOF_LONG_INT==4
|
||||
/* */ typedef long int Int;
|
||||
|
|
|
@ -106,7 +106,7 @@ buf_from_tstring( CELL *p ) {
|
|||
static inline void
|
||||
close_tstring( char *p USES_REGS ) {
|
||||
CELL *szp = HR+1;
|
||||
HR = (CELL *)ALIGN_YAPTYPE( p ,CELL);
|
||||
HR = (CELL *)ALIGN_BY_TYPE( p ,CELL);
|
||||
*szp = (HR - szp)-1;
|
||||
*HR++ = EndSpecials;
|
||||
}
|
||||
|
|
24
H/amidefs.h
24
H/amidefs.h
|
@ -97,7 +97,6 @@ typedef Int (*CPredicate)(CACHE_TYPE1);
|
|||
|
||||
typedef Int (*CmpPredicate)(Term, Term);
|
||||
|
||||
|
||||
#define OpRegSize sizeof(OPREG)
|
||||
|
||||
/*
|
||||
|
@ -112,6 +111,7 @@ typedef OPREG wamreg;
|
|||
typedef OPREG yslot;
|
||||
typedef OPREG COUNT;
|
||||
|
||||
#include "amijit.h"
|
||||
|
||||
/*
|
||||
This is a table with the codes for YAP instructions
|
||||
|
@ -223,7 +223,6 @@ typedef enum {
|
|||
#endif
|
||||
#define OpCodeSize sizeof(OPCODE)
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Types of possible YAAM instructions.
|
||||
|
@ -237,6 +236,7 @@ typedef enum {
|
|||
d: double (functor + unaligned double)
|
||||
f: functor
|
||||
F: Function, CPredicate
|
||||
J: JIT interface
|
||||
i: large integer (functor + long)
|
||||
I: logic upd index (struct logic_upd_index *)
|
||||
l: label, yamop *
|
||||
|
@ -261,6 +261,10 @@ typedef enum {
|
|||
*/
|
||||
typedef struct yami {
|
||||
OPCODE opc;
|
||||
#if YAP_JIT
|
||||
CELL next_native_r;
|
||||
CELL next_native_w;
|
||||
#endif
|
||||
union {
|
||||
struct {
|
||||
CELL next;
|
||||
|
@ -361,16 +365,12 @@ typedef struct yami {
|
|||
CELL next;
|
||||
} Otapl;
|
||||
struct {
|
||||
/* call counter */
|
||||
COUNT n;
|
||||
/* native code pointer */
|
||||
CPredicate native;
|
||||
/* next instruction to execute after native code if the predicate was not fully compiled */
|
||||
struct yami *native_next;
|
||||
/* Pointer to pred */
|
||||
struct pred_entry *p;
|
||||
CELL next;
|
||||
} aFlp;
|
||||
/* jit_handler */
|
||||
#if YAP_JIT
|
||||
JitHandlContext *jh;
|
||||
#endif
|
||||
CELL next;
|
||||
} J;
|
||||
/* The next two instructions are twin: they both correspond to the old ldd. */
|
||||
/* The first one, aLl, handles try_logical and retry_logical, */
|
||||
/* Ill handles trust_logical. */
|
||||
|
|
69
H/amiops.h
69
H/amiops.h
|
@ -36,12 +36,35 @@ Dereferencing macros
|
|||
/* For DEREFD, D has both the input and the exit argument */
|
||||
/* A is only used locally */
|
||||
|
||||
#define profiled_deref_head_TEST(D,Label) \
|
||||
if (IsVarTerm(D)) { \
|
||||
if (!strcmp(#D, "d0")) { EMIT_CONDITIONAL_SUCCESS("IsVarTerm(d0)"); } \
|
||||
else if (!strcmp(#D, "d1")) { EMIT_CONDITIONAL_SUCCESS("IsVarTerm(d1)"); } \
|
||||
goto Label; \
|
||||
} \
|
||||
if (!strcmp(#D, "d0")) { EMIT_CONDITIONAL_FAIL("IsVarTerm(d0)"); } \
|
||||
else if (!strcmp(#D, "d1")) { EMIT_CONDITIONAL_FAIL("IsVarTerm(d1)"); }
|
||||
|
||||
#define deref_head(D,Label) if (IsVarTerm(D)) goto Label
|
||||
|
||||
#define profiled_deref_body(D,A,LabelUnk,LabelNonVar) \
|
||||
do { \
|
||||
if(!IsVarTerm(D)) goto LabelNonVar; \
|
||||
LabelUnk: \
|
||||
(A) = (CELL *)(D); \
|
||||
(D) = *(CELL *)(D); \
|
||||
if (!strcmp(#D, "d0") && !strcmp(#A, "pt0")) { EMIT_SIMPLE_BLOCK_TEST(YAAM_DEREF_BODY_D0PT0); } \
|
||||
else if (!strcmp(#D, "d0") && !strcmp(#A, "pt1")) { EMIT_SIMPLE_BLOCK_TEST(YAAM_DEREF_BODY_D0PT1); } \
|
||||
else if (!strcmp(#D, "d0") && !strcmp(#A, "S_SREG")) { EMIT_SIMPLE_BLOCK_TEST(YAAM_DEREF_BODY_D0S_SREG); } \
|
||||
else if (!strcmp(#D, "d1") && !strcmp(#A, "pt0")) { EMIT_SIMPLE_BLOCK_TEST(YAAM_DEREF_BODY_D1PT0); } \
|
||||
else if (!strcmp(#D, "d1") && !strcmp(#A, "pt1")) { EMIT_SIMPLE_BLOCK_TEST(YAAM_DEREF_BODY_D1PT1); } \
|
||||
} while (Unsigned(A) != (D));
|
||||
|
||||
|
||||
#define deref_body(D,A,LabelUnk,LabelNonVar) \
|
||||
do { \
|
||||
do { \
|
||||
if(!IsVarTerm(D)) goto LabelNonVar; \
|
||||
LabelUnk: \
|
||||
LabelUnk: \
|
||||
(A) = (CELL *)(D); \
|
||||
(D) = *(CELL *)(D); \
|
||||
} while (Unsigned(A) != (D))
|
||||
|
@ -58,12 +81,26 @@ Dereferencing macros
|
|||
} while (Unsigned(A) != (D));\
|
||||
LabelDone:
|
||||
|
||||
#define profiled_derefa_body(D,A,LabelUnk,LabelNonVar) \
|
||||
do { \
|
||||
(A) = (CELL *)(D); \
|
||||
(D) = *(CELL *)(D); \
|
||||
if (!strcmp(#D, "d0") && !strcmp(#A, "pt0")) { EMIT_SIMPLE_BLOCK_TEST(YAAM_DEREF_BODY_D0PT0); } \
|
||||
else if (!strcmp(#D, "d0") && !strcmp(#A, "pt1")) { EMIT_SIMPLE_BLOCK_TEST(YAAM_DEREF_BODY_D0PT1); } \
|
||||
else if (!strcmp(#D, "d0") && !strcmp(#A, "S_SREG")) { EMIT_SIMPLE_BLOCK_TEST(YAAM_DEREF_BODY_D0S_SREG); } \
|
||||
else if (!strcmp(#D, "d1") && !strcmp(#A, "pt0")) { EMIT_SIMPLE_BLOCK_TEST(YAAM_DEREF_BODY_D1PT0); } \
|
||||
else if (!strcmp(#D, "d1") && !strcmp(#A, "pt1")) { EMIT_SIMPLE_BLOCK_TEST(YAAM_DEREF_BODY_D1PT1); } \
|
||||
if(!IsVarTerm(D)) goto LabelNonVar; \
|
||||
LabelUnk: ; \
|
||||
} while (Unsigned(A) != (D));
|
||||
|
||||
|
||||
#define derefa_body(D,A,LabelUnk,LabelNonVar) \
|
||||
do { \
|
||||
do { \
|
||||
(A) = (CELL *)(D); \
|
||||
(D) = *(CELL *)(D); \
|
||||
if(!IsVarTerm(D)) goto LabelNonVar; \
|
||||
LabelUnk: ; \
|
||||
LabelUnk: ; \
|
||||
} while (Unsigned(A) != (D))
|
||||
|
||||
#if UNIQUE_TAG_FOR_PAIRS
|
||||
|
@ -103,12 +140,12 @@ A contains the address of the variable that is to be trailed
|
|||
#ifdef TABLING
|
||||
|
||||
#define DO_TRAIL(TERM, VAL) \
|
||||
{ \
|
||||
register tr_fr_ptr r; \
|
||||
r = TR; \
|
||||
TR = r + 1; \
|
||||
TrailTerm(r) = (Term) (TERM); \
|
||||
TrailVal(r) = (CELL) (VAL); \
|
||||
{ \
|
||||
tr_fr_ptr r; \
|
||||
r = TR; \
|
||||
TR = r + 1; \
|
||||
TrailTerm(r) = (Term) (TERM); \
|
||||
TrailVal(r) = (CELL) (VAL); \
|
||||
}
|
||||
|
||||
#ifdef BFZ_TRAIL_SCHEME
|
||||
|
@ -157,7 +194,7 @@ A contains the address of the variable that is to be trailed
|
|||
|
||||
#define DO_TRAIL(A,D) \
|
||||
{ \
|
||||
register tr_fr_ptr r; \
|
||||
tr_fr_ptr r; \
|
||||
r = TR; \
|
||||
TR = r+1; \
|
||||
TrailTerm(r) = (CELL)(A); \
|
||||
|
@ -253,11 +290,11 @@ extern void Yap_WakeUp(CELL *v);
|
|||
|
||||
#define Bind_Local(A,D) { TRAIL_LOCAL(A,D); *(A) = (D); }
|
||||
#define Bind_Global(A,D) { *(A) = (D); if (__builtin_expect(GlobalIsAttVar(A),0)) Yap_WakeUp(A); else TRAIL_GLOBAL(A,D); }
|
||||
#define YapBind(A,D) { *(A) = (D); if (A < HR) { if (__builtin_expect(GlobalIsAttVar(A),0)) Yap_WakeUp(A); else TRAIL_GLOBAL(A,D); } else { TRAIL_LOCAL(A,D); } }
|
||||
#define YapBind(A,D) { *(A) = (D); if (A < HR) { if (__builtin_expect(GlobalIsAttVar(A),0)) Yap_WakeUp(A); else TRAIL_GLOBAL(A,D); } else { TRAIL_LOCAL(A,D); } }
|
||||
#define Bind_NonAtt(A,D) { *(A) = (D); TRAIL(A,D); }
|
||||
#define Bind_Global_NonAtt(A,D) { *(A) = (D); TRAIL_GLOBAL(A,D); }
|
||||
#define Bind_and_Trail(A,D) { *(A) = (D); DO_TRAIL(A, D); }
|
||||
|
||||
#define Bind(A,D) YapBind(A,D)
|
||||
|
||||
#define MaBind(VP,D) { MATRAIL((VP),*(VP),(D)); *(VP) = (D); }
|
||||
|
||||
|
@ -353,10 +390,10 @@ Int Yap_unify(Term t0, Term t1)
|
|||
}
|
||||
}
|
||||
|
||||
EXTERN Int Yap_unify_constant(Term a, Term cons);
|
||||
INLINE_ONLY EXTERN inline Int Yap_unify_constant(Term a, Term cons);
|
||||
|
||||
EXTERN inline Int
|
||||
Yap_unify_constant(register Term a, register Term cons)
|
||||
INLINE_ONLY EXTERN inline Int
|
||||
Yap_unify_constant(Term a, Term cons)
|
||||
{
|
||||
CACHE_REGS
|
||||
CELL *pt;
|
||||
|
|
|
@ -250,13 +250,8 @@
|
|||
#define REMOTE_ErrorMessage(wid) REMOTE(wid)->ErrorMessage_
|
||||
#define LOCAL_Error_Term LOCAL->Error_Term_
|
||||
#define REMOTE_Error_Term(wid) REMOTE(wid)->Error_Term_
|
||||
#ifdef THREADS
|
||||
#define LOCAL_Error_TYPE LOCAL->Error_TYPE_
|
||||
#define REMOTE_Error_TYPE(wid) REMOTE(wid)->Error_TYPE_
|
||||
#else
|
||||
#define LOCAL_Error_TYPE LOCAL->Error_TYPE_
|
||||
#define REMOTE_Error_TYPE(wid) REMOTE(wid)->Error_TYPE_
|
||||
#endif
|
||||
#define LOCAL_Error_Size LOCAL->Error_Size_
|
||||
#define REMOTE_Error_Size(wid) REMOTE(wid)->Error_Size_
|
||||
#define LOCAL_ErrorSay LOCAL->ErrorSay_
|
||||
|
|
|
@ -9,6 +9,11 @@
|
|||
case _write_dbterm:
|
||||
cl = NEXTOP(cl,D);
|
||||
break;
|
||||
#ifdef YAP_JIT
|
||||
case _jit_handler:
|
||||
#endif
|
||||
cl = NEXTOP(cl,J);
|
||||
break;
|
||||
case _alloc_for_logical_pred:
|
||||
cl = NEXTOP(cl,L);
|
||||
break;
|
||||
|
@ -18,9 +23,6 @@
|
|||
case _ensure_space:
|
||||
cl = NEXTOP(cl,Osbpa);
|
||||
break;
|
||||
case _native_me:
|
||||
cl = NEXTOP(cl,aFlp);
|
||||
break;
|
||||
case _write_atom:
|
||||
cl = NEXTOP(cl,c);
|
||||
break;
|
||||
|
@ -287,6 +289,9 @@
|
|||
return;
|
||||
cl = NEXTOP(cl,e);
|
||||
break;
|
||||
case _unlock_lu:
|
||||
cl = NEXTOP(cl,e);
|
||||
break;
|
||||
case _write_l_list:
|
||||
cl = NEXTOP(cl,e);
|
||||
break;
|
||||
|
@ -625,9 +630,6 @@
|
|||
case _lock_lu:
|
||||
cl = NEXTOP(cl,p);
|
||||
break;
|
||||
case _unlock_lu:
|
||||
cl = NEXTOP(cl,e);
|
||||
break;
|
||||
case _call_bfunc_xx:
|
||||
cl = NEXTOP(cl,plxxs);
|
||||
break;
|
||||
|
@ -1531,6 +1533,12 @@
|
|||
cl = NEXTOP(cl,Otapl);
|
||||
break;
|
||||
#endif
|
||||
#ifdef YAP_JIT
|
||||
#ifdef YAPOR
|
||||
#endif
|
||||
#ifdef TABLING
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
clause->Tag = (CELL)NULL;
|
||||
return;
|
||||
|
|
|
@ -6,14 +6,13 @@
|
|||
while (TRUE) {
|
||||
op_numbers op = Yap_op_from_opcode(cl->opc);
|
||||
switch (op) {
|
||||
#ifdef YAP_JIT
|
||||
case _jit_handler:
|
||||
#endif
|
||||
cl = NEXTOP(cl,J);
|
||||
break;
|
||||
case _ensure_space:
|
||||
cl = NEXTOP(cl,Osbpa);
|
||||
break;
|
||||
case _unlock_lu:
|
||||
cl = NEXTOP(cl,e);
|
||||
break;
|
||||
case _native_me:
|
||||
cl = NEXTOP(cl,aFlp);
|
||||
cl = NEXTOP(cl,Osbpa);
|
||||
break;
|
||||
case _get_2atoms:
|
||||
if (iarg == Yap_regnotoreg(1)) {
|
||||
|
@ -224,7 +223,7 @@
|
|||
CELL *pt = RepAppl(t);
|
||||
|
||||
clause->Tag = AbsAppl((CELL *)pt[0]);
|
||||
if (IsExtensionFunctor(FunctorOfTerm(t))) {
|
||||
if (IsExtensionFunctor(FunctorOfTerm(t))) {
|
||||
clause->ucd.t_ptr = t;
|
||||
} else {
|
||||
clause->ucd.c_sreg = pt;
|
||||
|
@ -259,7 +258,7 @@
|
|||
CELL *pt = RepAppl(t);
|
||||
|
||||
clause->Tag = AbsAppl((CELL *)pt[0]);
|
||||
if (IsExtensionFunctor(FunctorOfTerm(t))) {
|
||||
if (IsExtensionFunctor(FunctorOfTerm(t))) {
|
||||
clause->ucd.t_ptr = t;
|
||||
} else {
|
||||
clause->ucd.c_sreg = pt;
|
||||
|
@ -277,6 +276,9 @@
|
|||
return;
|
||||
cl = NEXTOP(cl,e);
|
||||
break;
|
||||
case _unlock_lu:
|
||||
cl = NEXTOP(cl,e);
|
||||
break;
|
||||
case _unify_l_list:
|
||||
cl = NEXTOP(cl,o);
|
||||
break;
|
||||
|
@ -812,6 +814,12 @@
|
|||
cl = NEXTOP(cl,Otapl);
|
||||
break;
|
||||
#endif
|
||||
#ifdef YAP_JIT
|
||||
#ifdef YAPOR
|
||||
#endif
|
||||
#ifdef TABLING
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
clause->Tag = (CELL)NULL;
|
||||
return;
|
||||
|
|
|
@ -140,11 +140,7 @@ typedef struct worker_local {
|
|||
ADDR TrailTop_;
|
||||
char* ErrorMessage_;
|
||||
Term Error_Term_;
|
||||
#ifdef THREADS
|
||||
Term Error_TYPE_;
|
||||
#else
|
||||
yap_error_number Error_TYPE_;
|
||||
#endif
|
||||
UInt Error_Size_;
|
||||
char ErrorSay_[MAX_ERROR_MSG_SIZE];
|
||||
jmp_buf IOBotch_;
|
||||
|
|
|
@ -140,11 +140,7 @@ static void InitWorker(int wid) {
|
|||
|
||||
|
||||
|
||||
#ifdef THREADS
|
||||
|
||||
#else
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -281,8 +281,8 @@ getUnknownModule(module_t m);
|
|||
#define clearPrologFlagMask(flag) clear(&LD->prolog_flag.mask, flag)
|
||||
|
||||
#ifndef YAP_CPP_INTERFACE
|
||||
COMMON(int) debugmode(debug_type new, debug_type *old);
|
||||
COMMON(int) tracemode(debug_type new, debug_type *old);
|
||||
COMMON(int) debugmode(debug_type newp, debug_type *old);
|
||||
COMMON(int) tracemode(debug_type newp, debug_type *old);
|
||||
#endif
|
||||
COMMON(void) Yap_setCurrentSourceLocation( void *rd );
|
||||
|
||||
|
|
963
H/rclause.h
963
H/rclause.h
File diff suppressed because it is too large
Load Diff
|
@ -140,11 +140,7 @@ static void RestoreWorker(int wid USES_REGS) {
|
|||
|
||||
|
||||
|
||||
#ifdef THREADS
|
||||
|
||||
#else
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
|
922
H/saveclause.h
922
H/saveclause.h
|
@ -25,6 +25,10 @@
|
|||
CHECK(save_Constant(stream, pc->y_u.Illss.e));
|
||||
pc = NEXTOP(pc,Illss);
|
||||
break;
|
||||
/* instructions type J */
|
||||
#ifdef YAP_JIT
|
||||
case _jit_handler:
|
||||
#endif
|
||||
/* instructions type L */
|
||||
case _alloc_for_logical_pred:
|
||||
CHECK(save_PtoLUClause(stream, pc->y_u.L.ClBase));
|
||||
|
@ -162,14 +166,6 @@
|
|||
CHECK(save_PtoOp(stream, pc->y_u.Otapl.d));
|
||||
pc = NEXTOP(pc,Otapl);
|
||||
break;
|
||||
/* instructions type aFlp */
|
||||
case _native_me:
|
||||
CHECK(save_Arity(stream, pc->y_u.aFlp.n));
|
||||
CHECK(save_ExternalFunction(stream, pc->y_u.aFlp.native));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.aFlp.native_next));
|
||||
CHECK(save_PtoPred(stream, pc->y_u.aFlp.p));
|
||||
pc = NEXTOP(pc,aFlp);
|
||||
break;
|
||||
/* instructions type c */
|
||||
case _write_atom:
|
||||
CHECK(save_ConstantTerm(stream, pc->y_u.c.c));
|
||||
|
@ -964,6 +960,916 @@
|
|||
pc = NEXTOP(pc,e);
|
||||
break;
|
||||
#endif
|
||||
#ifdef YAP_JIT
|
||||
/* instructions type D */
|
||||
case _traced_write_dbterm:
|
||||
CHECK(save_DBGroundTerm(stream, pc->y_u.D.D));
|
||||
pc = NEXTOP(pc,D);
|
||||
break;
|
||||
/* instructions type Illss */
|
||||
case _traced_enter_lu_pred:
|
||||
CHECK(save_PtoLUIndex(stream, pc->y_u.Illss.I));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.Illss.l1));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.Illss.l2));
|
||||
CHECK(save_Constant(stream, pc->y_u.Illss.s));
|
||||
CHECK(save_Constant(stream, pc->y_u.Illss.e));
|
||||
pc = NEXTOP(pc,Illss);
|
||||
break;
|
||||
/* instructions type J */
|
||||
case _traced_jit_handler:
|
||||
/* instructions type L */
|
||||
case _traced_alloc_for_logical_pred:
|
||||
CHECK(save_PtoLUClause(stream, pc->y_u.L.ClBase));
|
||||
pc = NEXTOP(pc,L);
|
||||
break;
|
||||
/* instructions type N */
|
||||
case _traced_write_bigint:
|
||||
CHECK(save_BlobTermInCode(stream, pc->y_u.N.b));
|
||||
pc = NEXTOP(pc,N);
|
||||
break;
|
||||
/* instructions type Osblp */
|
||||
case _traced_either:
|
||||
case _traced_or_else:
|
||||
#ifdef YAPOR
|
||||
CHECK(save_OrArg(stream, pc->y_u.Osblp.or_arg));
|
||||
#endif
|
||||
CHECK(save_Constant(stream, pc->y_u.Osblp.s));
|
||||
CHECK(save_CellPtoHeap(stream, pc->y_u.Osblp.bmap));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.Osblp.l));
|
||||
CHECK(save_PtoPred(stream, pc->y_u.Osblp.p0));
|
||||
pc = NEXTOP(pc,Osblp);
|
||||
break;
|
||||
/* instructions type Osbmp */
|
||||
case _traced_p_execute:
|
||||
case _traced_p_execute_tail:
|
||||
#ifdef YAPOR
|
||||
CHECK(save_OrArg(stream, pc->y_u.Osbmp.or_arg));
|
||||
#endif
|
||||
CHECK(save_Constant(stream, pc->y_u.Osbmp.s));
|
||||
CHECK(save_CellPtoHeap(stream, pc->y_u.Osbmp.bmap));
|
||||
CHECK(save_Module(stream, pc->y_u.Osbmp.mod));
|
||||
CHECK(save_PtoPred(stream, pc->y_u.Osbmp.p0));
|
||||
pc = NEXTOP(pc,Osbmp);
|
||||
break;
|
||||
/* instructions type Osbpa */
|
||||
case _traced_ensure_space:
|
||||
#ifdef YAPOR
|
||||
CHECK(save_OrArg(stream, pc->y_u.Osbpa.or_arg));
|
||||
#endif
|
||||
CHECK(save_Constant(stream, pc->y_u.Osbpa.s));
|
||||
CHECK(save_CellPtoHeap(stream, pc->y_u.Osbpa.bmap));
|
||||
CHECK(save_PtoPred(stream, pc->y_u.Osbpa.p));
|
||||
CHECK(save_Arity(stream, pc->y_u.Osbpa.i));
|
||||
pc = NEXTOP(pc,Osbpa);
|
||||
break;
|
||||
/* instructions type Osbpp */
|
||||
case _traced_call:
|
||||
case _traced_call_cpred:
|
||||
case _traced_call_usercpred:
|
||||
case _traced_fcall:
|
||||
case _traced_p_execute2:
|
||||
#ifdef YAPOR
|
||||
CHECK(save_OrArg(stream, pc->y_u.Osbpp.or_arg));
|
||||
#endif
|
||||
CHECK(save_Constant(stream, pc->y_u.Osbpp.s));
|
||||
CHECK(save_CellPtoHeap(stream, pc->y_u.Osbpp.bmap));
|
||||
CHECK(save_PtoPred(stream, pc->y_u.Osbpp.p));
|
||||
CHECK(save_PtoPred(stream, pc->y_u.Osbpp.p0));
|
||||
pc = NEXTOP(pc,Osbpp);
|
||||
break;
|
||||
/* instructions type OtILl */
|
||||
case _traced_count_trust_logical:
|
||||
case _traced_profiled_trust_logical:
|
||||
case _traced_trust_logical:
|
||||
#ifdef YAPOR
|
||||
CHECK(save_OrArg(stream, pc->y_u.OtILl.or_arg));
|
||||
#endif
|
||||
#ifdef TABLING
|
||||
CHECK(save_TabEntry(stream, pc->y_u.OtILl.te));
|
||||
#endif
|
||||
CHECK(save_PtoLUIndex(stream, pc->y_u.OtILl.block));
|
||||
CHECK(save_PtoLUClause(stream, pc->y_u.OtILl.d));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.OtILl.n));
|
||||
pc = NEXTOP(pc,OtILl);
|
||||
break;
|
||||
/* instructions type OtaLl */
|
||||
case _traced_count_retry_logical:
|
||||
case _traced_profiled_retry_logical:
|
||||
case _traced_retry_logical:
|
||||
case _traced_try_logical:
|
||||
#ifdef YAPOR
|
||||
CHECK(save_OrArg(stream, pc->y_u.OtaLl.or_arg));
|
||||
#endif
|
||||
#ifdef TABLING
|
||||
CHECK(save_TabEntry(stream, pc->y_u.OtaLl.te));
|
||||
#endif
|
||||
CHECK(save_Arity(stream, pc->y_u.OtaLl.s));
|
||||
CHECK(save_PtoLUClause(stream, pc->y_u.OtaLl.d));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.OtaLl.n));
|
||||
pc = NEXTOP(pc,OtaLl);
|
||||
break;
|
||||
/* instructions type OtapFs */
|
||||
case _traced_cut_c:
|
||||
case _traced_cut_userc:
|
||||
case _traced_retry_c:
|
||||
case _traced_retry_userc:
|
||||
case _traced_try_c:
|
||||
case _traced_try_userc:
|
||||
#ifdef YAPOR
|
||||
CHECK(save_OrArg(stream, pc->y_u.OtapFs.or_arg));
|
||||
#endif
|
||||
#ifdef TABLING
|
||||
CHECK(save_TabEntry(stream, pc->y_u.OtapFs.te));
|
||||
#endif
|
||||
CHECK(save_Arity(stream, pc->y_u.OtapFs.s));
|
||||
CHECK(save_PtoPred(stream, pc->y_u.OtapFs.p));
|
||||
CHECK(save_ExternalFunction(stream, pc->y_u.OtapFs.f));
|
||||
CHECK(save_Constant(stream, pc->y_u.OtapFs.extra));
|
||||
pc = NEXTOP(pc,OtapFs);
|
||||
break;
|
||||
/* instructions type Otapl */
|
||||
case _traced_count_retry_and_mark:
|
||||
case _traced_count_retry_me:
|
||||
case _traced_count_trust_me:
|
||||
case _traced_profiled_retry_and_mark:
|
||||
case _traced_profiled_retry_me:
|
||||
case _traced_profiled_trust_me:
|
||||
case _traced_retry:
|
||||
case _traced_retry_and_mark:
|
||||
case _traced_retry_me:
|
||||
case _traced_spy_or_trymark:
|
||||
case _traced_trust:
|
||||
case _traced_trust_me:
|
||||
case _traced_try_and_mark:
|
||||
case _traced_try_clause:
|
||||
case _traced_try_me:
|
||||
#ifdef YAPOR
|
||||
CHECK(save_OrArg(stream, pc->y_u.Otapl.or_arg));
|
||||
#endif
|
||||
#ifdef TABLING
|
||||
CHECK(save_TabEntry(stream, pc->y_u.Otapl.te));
|
||||
#endif
|
||||
CHECK(save_Arity(stream, pc->y_u.Otapl.s));
|
||||
CHECK(save_PtoPred(stream, pc->y_u.Otapl.p));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.Otapl.d));
|
||||
pc = NEXTOP(pc,Otapl);
|
||||
break;
|
||||
/* instructions type c */
|
||||
case _traced_write_atom:
|
||||
CHECK(save_ConstantTerm(stream, pc->y_u.c.c));
|
||||
pc = NEXTOP(pc,c);
|
||||
break;
|
||||
/* instructions type cc */
|
||||
case _traced_get_2atoms:
|
||||
CHECK(save_ConstantTerm(stream, pc->y_u.cc.c1));
|
||||
CHECK(save_ConstantTerm(stream, pc->y_u.cc.c2));
|
||||
pc = NEXTOP(pc,cc);
|
||||
break;
|
||||
/* instructions type ccc */
|
||||
case _traced_get_3atoms:
|
||||
CHECK(save_ConstantTerm(stream, pc->y_u.ccc.c1));
|
||||
CHECK(save_ConstantTerm(stream, pc->y_u.ccc.c2));
|
||||
CHECK(save_ConstantTerm(stream, pc->y_u.ccc.c3));
|
||||
pc = NEXTOP(pc,ccc);
|
||||
break;
|
||||
/* instructions type cccc */
|
||||
case _traced_get_4atoms:
|
||||
CHECK(save_ConstantTerm(stream, pc->y_u.cccc.c1));
|
||||
CHECK(save_ConstantTerm(stream, pc->y_u.cccc.c2));
|
||||
CHECK(save_ConstantTerm(stream, pc->y_u.cccc.c3));
|
||||
CHECK(save_ConstantTerm(stream, pc->y_u.cccc.c4));
|
||||
pc = NEXTOP(pc,cccc);
|
||||
break;
|
||||
/* instructions type ccccc */
|
||||
case _traced_get_5atoms:
|
||||
CHECK(save_ConstantTerm(stream, pc->y_u.ccccc.c1));
|
||||
CHECK(save_ConstantTerm(stream, pc->y_u.ccccc.c2));
|
||||
CHECK(save_ConstantTerm(stream, pc->y_u.ccccc.c3));
|
||||
CHECK(save_ConstantTerm(stream, pc->y_u.ccccc.c4));
|
||||
CHECK(save_ConstantTerm(stream, pc->y_u.ccccc.c5));
|
||||
pc = NEXTOP(pc,ccccc);
|
||||
break;
|
||||
/* instructions type cccccc */
|
||||
case _traced_get_6atoms:
|
||||
CHECK(save_ConstantTerm(stream, pc->y_u.cccccc.c1));
|
||||
CHECK(save_ConstantTerm(stream, pc->y_u.cccccc.c2));
|
||||
CHECK(save_ConstantTerm(stream, pc->y_u.cccccc.c3));
|
||||
CHECK(save_ConstantTerm(stream, pc->y_u.cccccc.c4));
|
||||
CHECK(save_ConstantTerm(stream, pc->y_u.cccccc.c5));
|
||||
CHECK(save_ConstantTerm(stream, pc->y_u.cccccc.c6));
|
||||
pc = NEXTOP(pc,cccccc);
|
||||
break;
|
||||
/* instructions type clll */
|
||||
case _traced_if_not_then:
|
||||
CHECK(save_ConstantTerm(stream, pc->y_u.clll.c));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.clll.l1));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.clll.l2));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.clll.l3));
|
||||
pc = NEXTOP(pc,clll);
|
||||
break;
|
||||
/* instructions type d */
|
||||
case _traced_write_float:
|
||||
CHECK(save_DoubleInCode(stream, pc->y_u.d.d));
|
||||
pc = NEXTOP(pc,d);
|
||||
break;
|
||||
/* instructions type e */
|
||||
case _traced_Nstop:
|
||||
case _traced_allocate:
|
||||
case _traced_copy_idb_term:
|
||||
case _traced_expand_index:
|
||||
case _traced_index_blob:
|
||||
case _traced_index_dbref:
|
||||
case _traced_index_long:
|
||||
case _traced_index_pred:
|
||||
case _traced_lock_pred:
|
||||
case _traced_op_fail:
|
||||
case _traced_p_equal:
|
||||
case _traced_p_functor:
|
||||
case _traced_pop:
|
||||
case _traced_retry_eam:
|
||||
case _traced_spy_pred:
|
||||
case _traced_thread_local:
|
||||
case _traced_trust_fail:
|
||||
case _traced_undef_p:
|
||||
case _traced_unify_idb_term:
|
||||
case _traced_unlock_lu:
|
||||
case _traced_write_l_list:
|
||||
case _traced_write_list:
|
||||
case _traced_write_void:
|
||||
if (op == _Nstop || op == _copy_idb_term || op == _unify_idb_term) return 1;
|
||||
pc = NEXTOP(pc,e);
|
||||
break;
|
||||
/* instructions type fa */
|
||||
case _traced_write_l_struc:
|
||||
case _traced_write_struct:
|
||||
CHECK(save_Func(stream, pc->y_u.fa.f));
|
||||
CHECK(save_Arity(stream, pc->y_u.fa.a));
|
||||
pc = NEXTOP(pc,fa);
|
||||
break;
|
||||
/* instructions type i */
|
||||
case _traced_write_longint:
|
||||
CHECK(save_IntegerInCode(stream, pc->y_u.i.i));
|
||||
pc = NEXTOP(pc,i);
|
||||
break;
|
||||
/* instructions type l */
|
||||
case _traced_Ystop:
|
||||
case _traced_jump:
|
||||
case _traced_jump_if_var:
|
||||
case _traced_move_back:
|
||||
case _traced_p_dif:
|
||||
case _traced_p_eq:
|
||||
case _traced_retry2:
|
||||
case _traced_retry3:
|
||||
case _traced_retry4:
|
||||
case _traced_skip:
|
||||
case _traced_try_clause2:
|
||||
case _traced_try_clause3:
|
||||
case _traced_try_clause4:
|
||||
case _traced_try_in:
|
||||
CHECK(save_PtoOp(stream, pc->y_u.l.l));
|
||||
pc = NEXTOP(pc,l);
|
||||
break;
|
||||
/* instructions type llll */
|
||||
case _traced_switch_on_type:
|
||||
CHECK(save_PtoOp(stream, pc->y_u.llll.l1));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.llll.l2));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.llll.l3));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.llll.l4));
|
||||
pc = NEXTOP(pc,llll);
|
||||
break;
|
||||
/* instructions type lp */
|
||||
case _traced_user_switch:
|
||||
CHECK(save_PtoOp(stream, pc->y_u.lp.l));
|
||||
CHECK(save_PtoPred(stream, pc->y_u.lp.p));
|
||||
pc = NEXTOP(pc,lp);
|
||||
break;
|
||||
/* instructions type o */
|
||||
case _traced_unify_l_list:
|
||||
case _traced_unify_l_list_write:
|
||||
case _traced_unify_l_void:
|
||||
case _traced_unify_l_void_write:
|
||||
case _traced_unify_list:
|
||||
case _traced_unify_list_write:
|
||||
case _traced_unify_void:
|
||||
case _traced_unify_void_write:
|
||||
CHECK(save_Opcode(stream, pc->y_u.o.opcw));
|
||||
pc = NEXTOP(pc,o);
|
||||
break;
|
||||
/* instructions type oD */
|
||||
case _traced_unify_dbterm:
|
||||
case _traced_unify_l_dbterm:
|
||||
CHECK(save_Opcode(stream, pc->y_u.oD.opcw));
|
||||
CHECK(save_DBGroundTerm(stream, pc->y_u.oD.D));
|
||||
pc = NEXTOP(pc,oD);
|
||||
break;
|
||||
/* instructions type oN */
|
||||
case _traced_unify_bigint:
|
||||
case _traced_unify_l_bigint:
|
||||
CHECK(save_Opcode(stream, pc->y_u.oN.opcw));
|
||||
CHECK(save_BlobTermInCode(stream, pc->y_u.oN.b));
|
||||
pc = NEXTOP(pc,oN);
|
||||
break;
|
||||
/* instructions type oc */
|
||||
case _traced_unify_atom:
|
||||
case _traced_unify_atom_write:
|
||||
case _traced_unify_l_atom:
|
||||
case _traced_unify_l_atom_write:
|
||||
CHECK(save_Opcode(stream, pc->y_u.oc.opcw));
|
||||
CHECK(save_ConstantTerm(stream, pc->y_u.oc.c));
|
||||
pc = NEXTOP(pc,oc);
|
||||
break;
|
||||
/* instructions type od */
|
||||
case _traced_unify_float:
|
||||
case _traced_unify_float_write:
|
||||
case _traced_unify_l_float:
|
||||
case _traced_unify_l_float_write:
|
||||
CHECK(save_Opcode(stream, pc->y_u.od.opcw));
|
||||
CHECK(save_DoubleInCode(stream, pc->y_u.od.d));
|
||||
pc = NEXTOP(pc,od);
|
||||
break;
|
||||
/* instructions type ofa */
|
||||
case _traced_unify_l_struc:
|
||||
case _traced_unify_l_struc_write:
|
||||
case _traced_unify_struct:
|
||||
case _traced_unify_struct_write:
|
||||
CHECK(save_Opcode(stream, pc->y_u.ofa.opcw));
|
||||
CHECK(save_Func(stream, pc->y_u.ofa.f));
|
||||
CHECK(save_Arity(stream, pc->y_u.ofa.a));
|
||||
pc = NEXTOP(pc,ofa);
|
||||
break;
|
||||
/* instructions type oi */
|
||||
case _traced_unify_l_longint:
|
||||
case _traced_unify_l_longint_write:
|
||||
case _traced_unify_longint:
|
||||
case _traced_unify_longint_write:
|
||||
CHECK(save_Opcode(stream, pc->y_u.oi.opcw));
|
||||
CHECK(save_IntegerInCode(stream, pc->y_u.oi.i));
|
||||
pc = NEXTOP(pc,oi);
|
||||
break;
|
||||
/* instructions type ollll */
|
||||
case _traced_switch_list_nl:
|
||||
CHECK(save_Opcode(stream, pc->y_u.ollll.pop));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.ollll.l1));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.ollll.l2));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.ollll.l3));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.ollll.l4));
|
||||
pc = NEXTOP(pc,ollll);
|
||||
break;
|
||||
/* instructions type os */
|
||||
case _traced_run_eam:
|
||||
case _traced_unify_l_n_voids:
|
||||
case _traced_unify_l_n_voids_write:
|
||||
case _traced_unify_n_voids:
|
||||
case _traced_unify_n_voids_write:
|
||||
CHECK(save_Opcode(stream, pc->y_u.os.opcw));
|
||||
CHECK(save_Constant(stream, pc->y_u.os.s));
|
||||
pc = NEXTOP(pc,os);
|
||||
break;
|
||||
/* instructions type osc */
|
||||
case _traced_unify_n_atoms:
|
||||
case _traced_unify_n_atoms_write:
|
||||
CHECK(save_Opcode(stream, pc->y_u.osc.opcw));
|
||||
CHECK(save_Constant(stream, pc->y_u.osc.s));
|
||||
CHECK(save_ConstantTerm(stream, pc->y_u.osc.c));
|
||||
pc = NEXTOP(pc,osc);
|
||||
break;
|
||||
/* instructions type ox */
|
||||
case _traced_save_appl_x:
|
||||
case _traced_save_appl_x_write:
|
||||
case _traced_save_pair_x:
|
||||
case _traced_save_pair_x_write:
|
||||
case _traced_unify_l_x_loc:
|
||||
case _traced_unify_l_x_loc_write:
|
||||
case _traced_unify_l_x_val:
|
||||
case _traced_unify_l_x_val_write:
|
||||
case _traced_unify_l_x_var:
|
||||
case _traced_unify_l_x_var_write:
|
||||
case _traced_unify_x_loc:
|
||||
case _traced_unify_x_loc_write:
|
||||
case _traced_unify_x_val:
|
||||
case _traced_unify_x_val_write:
|
||||
case _traced_unify_x_var:
|
||||
case _traced_unify_x_var_write:
|
||||
CHECK(save_Opcode(stream, pc->y_u.ox.opcw));
|
||||
CHECK(save_X(stream, pc->y_u.ox.x));
|
||||
pc = NEXTOP(pc,ox);
|
||||
break;
|
||||
/* instructions type oxx */
|
||||
case _traced_unify_l_x_var2:
|
||||
case _traced_unify_l_x_var2_write:
|
||||
case _traced_unify_x_var2:
|
||||
case _traced_unify_x_var2_write:
|
||||
CHECK(save_Opcode(stream, pc->y_u.oxx.opcw));
|
||||
CHECK(save_X(stream, pc->y_u.oxx.xl));
|
||||
CHECK(save_X(stream, pc->y_u.oxx.xr));
|
||||
pc = NEXTOP(pc,oxx);
|
||||
break;
|
||||
/* instructions type oy */
|
||||
case _traced_save_appl_y:
|
||||
case _traced_save_appl_y_write:
|
||||
case _traced_save_pair_y:
|
||||
case _traced_save_pair_y_write:
|
||||
case _traced_unify_l_y_loc:
|
||||
case _traced_unify_l_y_loc_write:
|
||||
case _traced_unify_l_y_val:
|
||||
case _traced_unify_l_y_val_write:
|
||||
case _traced_unify_l_y_var:
|
||||
case _traced_unify_l_y_var_write:
|
||||
case _traced_unify_y_loc:
|
||||
case _traced_unify_y_loc_write:
|
||||
case _traced_unify_y_val:
|
||||
case _traced_unify_y_val_write:
|
||||
case _traced_unify_y_var:
|
||||
case _traced_unify_y_var_write:
|
||||
CHECK(save_Opcode(stream, pc->y_u.oy.opcw));
|
||||
CHECK(save_Y(stream, pc->y_u.oy.y));
|
||||
pc = NEXTOP(pc,oy);
|
||||
break;
|
||||
/* instructions type p */
|
||||
case _traced_count_call:
|
||||
case _traced_count_retry:
|
||||
case _traced_deallocate:
|
||||
case _traced_enter_profiling:
|
||||
case _traced_lock_lu:
|
||||
case _traced_procceed:
|
||||
case _traced_retry_profiled:
|
||||
CHECK(save_PtoPred(stream, pc->y_u.p.p));
|
||||
pc = NEXTOP(pc,p);
|
||||
break;
|
||||
/* instructions type plxxs */
|
||||
case _traced_call_bfunc_xx:
|
||||
CHECK(save_PtoPred(stream, pc->y_u.plxxs.p));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.plxxs.f));
|
||||
CHECK(save_X(stream, pc->y_u.plxxs.x1));
|
||||
CHECK(save_X(stream, pc->y_u.plxxs.x2));
|
||||
CHECK(save_Constant(stream, pc->y_u.plxxs.flags));
|
||||
pc = NEXTOP(pc,plxxs);
|
||||
break;
|
||||
/* instructions type plxys */
|
||||
case _traced_call_bfunc_xy:
|
||||
case _traced_call_bfunc_yx:
|
||||
CHECK(save_PtoPred(stream, pc->y_u.plxys.p));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.plxys.f));
|
||||
CHECK(save_X(stream, pc->y_u.plxys.x));
|
||||
CHECK(save_Y(stream, pc->y_u.plxys.y));
|
||||
CHECK(save_Constant(stream, pc->y_u.plxys.flags));
|
||||
pc = NEXTOP(pc,plxys);
|
||||
break;
|
||||
/* instructions type plyys */
|
||||
case _traced_call_bfunc_yy:
|
||||
CHECK(save_PtoPred(stream, pc->y_u.plyys.p));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.plyys.f));
|
||||
CHECK(save_Y(stream, pc->y_u.plyys.y1));
|
||||
CHECK(save_Y(stream, pc->y_u.plyys.y2));
|
||||
CHECK(save_Constant(stream, pc->y_u.plyys.flags));
|
||||
pc = NEXTOP(pc,plyys);
|
||||
break;
|
||||
/* instructions type pp */
|
||||
case _traced_dexecute:
|
||||
case _traced_execute:
|
||||
case _traced_execute_cpred:
|
||||
CHECK(save_PtoPred(stream, pc->y_u.pp.p));
|
||||
CHECK(save_PtoPred(stream, pc->y_u.pp.p0));
|
||||
pc = NEXTOP(pc,pp);
|
||||
break;
|
||||
/* instructions type s */
|
||||
case _traced_cut:
|
||||
case _traced_cut_e:
|
||||
case _traced_cut_t:
|
||||
case _traced_pop_n:
|
||||
case _traced_write_n_voids:
|
||||
CHECK(save_Constant(stream, pc->y_u.s.s));
|
||||
pc = NEXTOP(pc,s);
|
||||
break;
|
||||
/* instructions type sc */
|
||||
case _traced_write_n_atoms:
|
||||
CHECK(save_Constant(stream, pc->y_u.sc.s));
|
||||
CHECK(save_ConstantTerm(stream, pc->y_u.sc.c));
|
||||
pc = NEXTOP(pc,sc);
|
||||
break;
|
||||
/* instructions type sllll */
|
||||
case _traced_switch_on_sub_arg_type:
|
||||
CHECK(save_Constant(stream, pc->y_u.sllll.s));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.sllll.l1));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.sllll.l2));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.sllll.l3));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.sllll.l4));
|
||||
pc = NEXTOP(pc,sllll);
|
||||
break;
|
||||
/* instructions type slp */
|
||||
case _traced_call_c_wfail:
|
||||
CHECK(save_Constant(stream, pc->y_u.slp.s));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.slp.l));
|
||||
CHECK(save_PtoPred(stream, pc->y_u.slp.p));
|
||||
pc = NEXTOP(pc,slp);
|
||||
break;
|
||||
/* instructions type sssl */
|
||||
case _traced_go_on_cons:
|
||||
case _traced_go_on_func:
|
||||
case _traced_if_cons:
|
||||
case _traced_if_func:
|
||||
case _traced_switch_on_cons:
|
||||
case _traced_switch_on_func:
|
||||
CHECK(save_Constant(stream, pc->y_u.sssl.s));
|
||||
CHECK(save_Constant(stream, pc->y_u.sssl.e));
|
||||
CHECK(save_Constant(stream, pc->y_u.sssl.w));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.sssl.l));
|
||||
pc = NEXTOP(pc,sssl);
|
||||
break;
|
||||
/* instructions type sssllp */
|
||||
case _traced_expand_clauses:
|
||||
CHECK(save_Constant(stream, pc->y_u.sssllp.s1));
|
||||
CHECK(save_Constant(stream, pc->y_u.sssllp.s2));
|
||||
CHECK(save_Constant(stream, pc->y_u.sssllp.s3));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.sssllp.sprev));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.sssllp.snext));
|
||||
CHECK(save_PtoPred(stream, pc->y_u.sssllp.p));
|
||||
pc = NEXTOP(pc,sssllp);
|
||||
break;
|
||||
/* instructions type x */
|
||||
case _traced_get_list:
|
||||
case _traced_put_list:
|
||||
case _traced_save_b_x:
|
||||
case _traced_write_x_loc:
|
||||
case _traced_write_x_val:
|
||||
case _traced_write_x_var:
|
||||
CHECK(save_X(stream, pc->y_u.x.x));
|
||||
pc = NEXTOP(pc,x);
|
||||
break;
|
||||
/* instructions type xD */
|
||||
case _traced_get_dbterm:
|
||||
case _traced_put_dbterm:
|
||||
CHECK(save_X(stream, pc->y_u.xD.x));
|
||||
CHECK(save_DBGroundTerm(stream, pc->y_u.xD.D));
|
||||
pc = NEXTOP(pc,xD);
|
||||
break;
|
||||
/* instructions type xN */
|
||||
case _traced_get_bigint:
|
||||
case _traced_put_bigint:
|
||||
CHECK(save_X(stream, pc->y_u.xN.x));
|
||||
CHECK(save_BlobTermInCode(stream, pc->y_u.xN.b));
|
||||
pc = NEXTOP(pc,xN);
|
||||
break;
|
||||
/* instructions type xc */
|
||||
case _traced_get_atom:
|
||||
case _traced_put_atom:
|
||||
CHECK(save_X(stream, pc->y_u.xc.x));
|
||||
CHECK(save_ConstantTerm(stream, pc->y_u.xc.c));
|
||||
pc = NEXTOP(pc,xc);
|
||||
break;
|
||||
/* instructions type xd */
|
||||
case _traced_get_float:
|
||||
case _traced_put_float:
|
||||
CHECK(save_X(stream, pc->y_u.xd.x));
|
||||
CHECK(save_DoubleInCode(stream, pc->y_u.xd.d));
|
||||
pc = NEXTOP(pc,xd);
|
||||
break;
|
||||
/* instructions type xfa */
|
||||
case _traced_get_struct:
|
||||
case _traced_put_struct:
|
||||
CHECK(save_X(stream, pc->y_u.xfa.x));
|
||||
CHECK(save_Func(stream, pc->y_u.xfa.f));
|
||||
CHECK(save_Arity(stream, pc->y_u.xfa.a));
|
||||
pc = NEXTOP(pc,xfa);
|
||||
break;
|
||||
/* instructions type xi */
|
||||
case _traced_get_longint:
|
||||
case _traced_put_longint:
|
||||
CHECK(save_X(stream, pc->y_u.xi.x));
|
||||
CHECK(save_IntegerInCode(stream, pc->y_u.xi.i));
|
||||
pc = NEXTOP(pc,xi);
|
||||
break;
|
||||
/* instructions type xl */
|
||||
case _traced_p_atom_x:
|
||||
case _traced_p_atomic_x:
|
||||
case _traced_p_compound_x:
|
||||
case _traced_p_db_ref_x:
|
||||
case _traced_p_float_x:
|
||||
case _traced_p_integer_x:
|
||||
case _traced_p_nonvar_x:
|
||||
case _traced_p_number_x:
|
||||
case _traced_p_primitive_x:
|
||||
case _traced_p_var_x:
|
||||
CHECK(save_X(stream, pc->y_u.xl.x));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.xl.F));
|
||||
pc = NEXTOP(pc,xl);
|
||||
break;
|
||||
/* instructions type xll */
|
||||
case _traced_jump_if_nonvar:
|
||||
CHECK(save_X(stream, pc->y_u.xll.x));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.xll.l1));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.xll.l2));
|
||||
pc = NEXTOP(pc,xll);
|
||||
break;
|
||||
/* instructions type xllll */
|
||||
case _traced_switch_on_arg_type:
|
||||
CHECK(save_X(stream, pc->y_u.xllll.x));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.xllll.l1));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.xllll.l2));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.xllll.l3));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.xllll.l4));
|
||||
pc = NEXTOP(pc,xllll);
|
||||
break;
|
||||
/* instructions type xps */
|
||||
case _traced_commit_b_x:
|
||||
CHECK(save_X(stream, pc->y_u.xps.x));
|
||||
CHECK(save_PtoPred(stream, pc->y_u.xps.p0));
|
||||
CHECK(save_Constant(stream, pc->y_u.xps.s));
|
||||
pc = NEXTOP(pc,xps);
|
||||
break;
|
||||
/* instructions type xx */
|
||||
case _traced_get_x_val:
|
||||
case _traced_get_x_var:
|
||||
case _traced_gl_void_valx:
|
||||
case _traced_gl_void_varx:
|
||||
case _traced_glist_valx:
|
||||
case _traced_put_x_val:
|
||||
case _traced_put_x_var:
|
||||
CHECK(save_X(stream, pc->y_u.xx.xl));
|
||||
CHECK(save_X(stream, pc->y_u.xx.xr));
|
||||
pc = NEXTOP(pc,xx);
|
||||
break;
|
||||
/* instructions type xxc */
|
||||
case _traced_p_func2s_cv:
|
||||
CHECK(save_X(stream, pc->y_u.xxc.x));
|
||||
CHECK(save_X(stream, pc->y_u.xxc.xi));
|
||||
CHECK(save_ConstantTerm(stream, pc->y_u.xxc.c));
|
||||
pc = NEXTOP(pc,xxc);
|
||||
break;
|
||||
/* instructions type xxn */
|
||||
case _traced_p_and_vc:
|
||||
case _traced_p_arg_cv:
|
||||
case _traced_p_div_cv:
|
||||
case _traced_p_div_vc:
|
||||
case _traced_p_func2s_vc:
|
||||
case _traced_p_minus_cv:
|
||||
case _traced_p_or_vc:
|
||||
case _traced_p_plus_vc:
|
||||
case _traced_p_sll_cv:
|
||||
case _traced_p_sll_vc:
|
||||
case _traced_p_slr_cv:
|
||||
case _traced_p_slr_vc:
|
||||
case _traced_p_times_vc:
|
||||
CHECK(save_X(stream, pc->y_u.xxn.x));
|
||||
CHECK(save_X(stream, pc->y_u.xxn.xi));
|
||||
CHECK(save_Integer(stream, pc->y_u.xxn.c));
|
||||
pc = NEXTOP(pc,xxn);
|
||||
break;
|
||||
/* instructions type xxx */
|
||||
case _traced_p_and_vv:
|
||||
case _traced_p_arg_vv:
|
||||
case _traced_p_div_vv:
|
||||
case _traced_p_func2f_xx:
|
||||
case _traced_p_func2s_vv:
|
||||
case _traced_p_minus_vv:
|
||||
case _traced_p_or_vv:
|
||||
case _traced_p_plus_vv:
|
||||
case _traced_p_sll_vv:
|
||||
case _traced_p_slr_vv:
|
||||
case _traced_p_times_vv:
|
||||
CHECK(save_X(stream, pc->y_u.xxx.x));
|
||||
CHECK(save_X(stream, pc->y_u.xxx.x1));
|
||||
CHECK(save_X(stream, pc->y_u.xxx.x2));
|
||||
pc = NEXTOP(pc,xxx);
|
||||
break;
|
||||
/* instructions type xxxx */
|
||||
case _traced_put_xx_val:
|
||||
CHECK(save_X(stream, pc->y_u.xxxx.xl1));
|
||||
CHECK(save_X(stream, pc->y_u.xxxx.xl2));
|
||||
CHECK(save_X(stream, pc->y_u.xxxx.xr1));
|
||||
CHECK(save_X(stream, pc->y_u.xxxx.xr2));
|
||||
pc = NEXTOP(pc,xxxx);
|
||||
break;
|
||||
/* instructions type xxy */
|
||||
case _traced_p_func2f_xy:
|
||||
CHECK(save_X(stream, pc->y_u.xxy.x));
|
||||
CHECK(save_X(stream, pc->y_u.xxy.x1));
|
||||
CHECK(save_Y(stream, pc->y_u.xxy.y2));
|
||||
pc = NEXTOP(pc,xxy);
|
||||
break;
|
||||
/* instructions type y */
|
||||
case _traced_save_b_y:
|
||||
case _traced_write_y_loc:
|
||||
case _traced_write_y_val:
|
||||
case _traced_write_y_var:
|
||||
CHECK(save_Y(stream, pc->y_u.y.y));
|
||||
pc = NEXTOP(pc,y);
|
||||
break;
|
||||
/* instructions type yl */
|
||||
case _traced_p_atom_y:
|
||||
case _traced_p_atomic_y:
|
||||
case _traced_p_compound_y:
|
||||
case _traced_p_db_ref_y:
|
||||
case _traced_p_float_y:
|
||||
case _traced_p_integer_y:
|
||||
case _traced_p_nonvar_y:
|
||||
case _traced_p_number_y:
|
||||
case _traced_p_primitive_y:
|
||||
case _traced_p_var_y:
|
||||
CHECK(save_Y(stream, pc->y_u.yl.y));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.yl.F));
|
||||
pc = NEXTOP(pc,yl);
|
||||
break;
|
||||
/* instructions type yps */
|
||||
case _traced_commit_b_y:
|
||||
CHECK(save_Y(stream, pc->y_u.yps.y));
|
||||
CHECK(save_PtoPred(stream, pc->y_u.yps.p0));
|
||||
CHECK(save_Constant(stream, pc->y_u.yps.s));
|
||||
pc = NEXTOP(pc,yps);
|
||||
break;
|
||||
/* instructions type yx */
|
||||
case _traced_get_y_val:
|
||||
case _traced_get_y_var:
|
||||
case _traced_gl_void_valy:
|
||||
case _traced_gl_void_vary:
|
||||
case _traced_glist_valy:
|
||||
case _traced_put_unsafe:
|
||||
case _traced_put_y_val:
|
||||
case _traced_put_y_var:
|
||||
CHECK(save_Y(stream, pc->y_u.yx.y));
|
||||
CHECK(save_X(stream, pc->y_u.yx.x));
|
||||
pc = NEXTOP(pc,yx);
|
||||
break;
|
||||
/* instructions type yxn */
|
||||
case _traced_p_and_y_vc:
|
||||
case _traced_p_arg_y_cv:
|
||||
case _traced_p_div_y_cv:
|
||||
case _traced_p_div_y_vc:
|
||||
case _traced_p_func2s_y_cv:
|
||||
case _traced_p_func2s_y_vc:
|
||||
case _traced_p_minus_y_cv:
|
||||
case _traced_p_or_y_vc:
|
||||
case _traced_p_plus_y_vc:
|
||||
case _traced_p_sll_y_cv:
|
||||
case _traced_p_sll_y_vc:
|
||||
case _traced_p_slr_y_cv:
|
||||
case _traced_p_slr_y_vc:
|
||||
case _traced_p_times_y_vc:
|
||||
CHECK(save_Y(stream, pc->y_u.yxn.y));
|
||||
CHECK(save_X(stream, pc->y_u.yxn.xi));
|
||||
CHECK(save_Integer(stream, pc->y_u.yxn.c));
|
||||
pc = NEXTOP(pc,yxn);
|
||||
break;
|
||||
/* instructions type yxx */
|
||||
case _traced_p_and_y_vv:
|
||||
case _traced_p_arg_y_vv:
|
||||
case _traced_p_div_y_vv:
|
||||
case _traced_p_func2f_yx:
|
||||
case _traced_p_func2s_y_vv:
|
||||
case _traced_p_minus_y_vv:
|
||||
case _traced_p_or_y_vv:
|
||||
case _traced_p_plus_y_vv:
|
||||
case _traced_p_sll_y_vv:
|
||||
case _traced_p_slr_y_vv:
|
||||
case _traced_p_times_y_vv:
|
||||
CHECK(save_Y(stream, pc->y_u.yxx.y));
|
||||
CHECK(save_X(stream, pc->y_u.yxx.x1));
|
||||
CHECK(save_X(stream, pc->y_u.yxx.x2));
|
||||
pc = NEXTOP(pc,yxx);
|
||||
break;
|
||||
/* instructions type yyx */
|
||||
case _traced_p_func2f_yy:
|
||||
CHECK(save_Y(stream, pc->y_u.yyx.y1));
|
||||
CHECK(save_Y(stream, pc->y_u.yyx.y2));
|
||||
CHECK(save_X(stream, pc->y_u.yyx.x));
|
||||
pc = NEXTOP(pc,yyx);
|
||||
break;
|
||||
/* instructions type yyxx */
|
||||
case _traced_get_yy_var:
|
||||
case _traced_put_y_vals:
|
||||
CHECK(save_Y(stream, pc->y_u.yyxx.y1));
|
||||
CHECK(save_Y(stream, pc->y_u.yyxx.y2));
|
||||
CHECK(save_X(stream, pc->y_u.yyxx.x1));
|
||||
CHECK(save_X(stream, pc->y_u.yyxx.x2));
|
||||
pc = NEXTOP(pc,yyxx);
|
||||
break;
|
||||
#ifdef YAPOR
|
||||
/* instructions type Otapl */
|
||||
case _traced_getwork:
|
||||
case _traced_getwork_seq:
|
||||
case _traced_sync:
|
||||
#ifdef YAPOR
|
||||
CHECK(save_OrArg(stream, pc->y_u.Otapl.or_arg));
|
||||
#endif
|
||||
#ifdef TABLING
|
||||
CHECK(save_TabEntry(stream, pc->y_u.Otapl.te));
|
||||
#endif
|
||||
CHECK(save_Arity(stream, pc->y_u.Otapl.s));
|
||||
CHECK(save_PtoPred(stream, pc->y_u.Otapl.p));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.Otapl.d));
|
||||
pc = NEXTOP(pc,Otapl);
|
||||
break;
|
||||
/* instructions type e */
|
||||
case _traced_getwork_first_time:
|
||||
if (op == _Nstop || op == _copy_idb_term || op == _unify_idb_term) return 1;
|
||||
pc = NEXTOP(pc,e);
|
||||
break;
|
||||
#endif
|
||||
#ifdef TABLING
|
||||
/* instructions type Otapl */
|
||||
case _traced_table_answer_resolution:
|
||||
case _traced_table_answer_resolution_completion:
|
||||
case _traced_table_completion:
|
||||
case _traced_table_load_answer:
|
||||
case _traced_table_retry:
|
||||
case _traced_table_retry_me:
|
||||
case _traced_table_trust:
|
||||
case _traced_table_trust_me:
|
||||
case _traced_table_try:
|
||||
case _traced_table_try_answer:
|
||||
case _traced_table_try_me:
|
||||
case _traced_table_try_single:
|
||||
#ifdef YAPOR
|
||||
CHECK(save_OrArg(stream, pc->y_u.Otapl.or_arg));
|
||||
#endif
|
||||
#ifdef TABLING
|
||||
CHECK(save_TabEntry(stream, pc->y_u.Otapl.te));
|
||||
#endif
|
||||
CHECK(save_Arity(stream, pc->y_u.Otapl.s));
|
||||
CHECK(save_PtoPred(stream, pc->y_u.Otapl.p));
|
||||
CHECK(save_PtoOp(stream, pc->y_u.Otapl.d));
|
||||
pc = NEXTOP(pc,Otapl);
|
||||
break;
|
||||
/* instructions type e */
|
||||
case _traced_clause_with_cut:
|
||||
if (op == _Nstop || op == _copy_idb_term || op == _unify_idb_term) return 1;
|
||||
pc = NEXTOP(pc,e);
|
||||
break;
|
||||
/* instructions type s */
|
||||
case _traced_table_new_answer:
|
||||
CHECK(save_Constant(stream, pc->y_u.s.s));
|
||||
pc = NEXTOP(pc,s);
|
||||
break;
|
||||
/* instructions type e */
|
||||
case _traced_trie_do_appl:
|
||||
case _traced_trie_do_appl_in_pair:
|
||||
case _traced_trie_do_atom:
|
||||
case _traced_trie_do_atom_in_pair:
|
||||
case _traced_trie_do_bigint:
|
||||
case _traced_trie_do_double:
|
||||
case _traced_trie_do_extension:
|
||||
case _traced_trie_do_gterm:
|
||||
case _traced_trie_do_longint:
|
||||
case _traced_trie_do_null:
|
||||
case _traced_trie_do_null_in_pair:
|
||||
case _traced_trie_do_pair:
|
||||
case _traced_trie_do_val:
|
||||
case _traced_trie_do_val_in_pair:
|
||||
case _traced_trie_do_var:
|
||||
case _traced_trie_do_var_in_pair:
|
||||
case _traced_trie_retry_appl:
|
||||
case _traced_trie_retry_appl_in_pair:
|
||||
case _traced_trie_retry_atom:
|
||||
case _traced_trie_retry_atom_in_pair:
|
||||
case _traced_trie_retry_bigint:
|
||||
case _traced_trie_retry_double:
|
||||
case _traced_trie_retry_extension:
|
||||
case _traced_trie_retry_gterm:
|
||||
case _traced_trie_retry_longint:
|
||||
case _traced_trie_retry_null:
|
||||
case _traced_trie_retry_null_in_pair:
|
||||
case _traced_trie_retry_pair:
|
||||
case _traced_trie_retry_val:
|
||||
case _traced_trie_retry_val_in_pair:
|
||||
case _traced_trie_retry_var:
|
||||
case _traced_trie_retry_var_in_pair:
|
||||
case _traced_trie_trust_appl:
|
||||
case _traced_trie_trust_appl_in_pair:
|
||||
case _traced_trie_trust_atom:
|
||||
case _traced_trie_trust_atom_in_pair:
|
||||
case _traced_trie_trust_bigint:
|
||||
case _traced_trie_trust_double:
|
||||
case _traced_trie_trust_extension:
|
||||
case _traced_trie_trust_gterm:
|
||||
case _traced_trie_trust_longint:
|
||||
case _traced_trie_trust_null:
|
||||
case _traced_trie_trust_null_in_pair:
|
||||
case _traced_trie_trust_pair:
|
||||
case _traced_trie_trust_val:
|
||||
case _traced_trie_trust_val_in_pair:
|
||||
case _traced_trie_trust_var:
|
||||
case _traced_trie_trust_var_in_pair:
|
||||
case _traced_trie_try_appl:
|
||||
case _traced_trie_try_appl_in_pair:
|
||||
case _traced_trie_try_atom:
|
||||
case _traced_trie_try_atom_in_pair:
|
||||
case _traced_trie_try_bigint:
|
||||
case _traced_trie_try_double:
|
||||
case _traced_trie_try_extension:
|
||||
case _traced_trie_try_gterm:
|
||||
case _traced_trie_try_longint:
|
||||
case _traced_trie_try_null:
|
||||
case _traced_trie_try_null_in_pair:
|
||||
case _traced_trie_try_pair:
|
||||
case _traced_trie_try_val:
|
||||
case _traced_trie_try_val_in_pair:
|
||||
case _traced_trie_try_var:
|
||||
case _traced_trie_try_var_in_pair:
|
||||
if (op == _Nstop || op == _copy_idb_term || op == _unify_idb_term) return 1;
|
||||
pc = NEXTOP(pc,e);
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
|
682
H/walkclause.h
682
H/walkclause.h
|
@ -16,6 +16,12 @@
|
|||
/* instructions type Illss */
|
||||
case _enter_lu_pred:
|
||||
return walk_got_lu_block(pc->y_u.Illss.I, startp, endp);
|
||||
/* instructions type J */
|
||||
#ifdef YAP_JIT
|
||||
case _jit_handler:
|
||||
#endif
|
||||
pc = NEXTOP(pc,J);
|
||||
break;
|
||||
/* instructions type L */
|
||||
case _alloc_for_logical_pred:
|
||||
return walk_got_lu_clause(pc->y_u.L.ClBase, startp, endp);
|
||||
|
@ -97,10 +103,6 @@
|
|||
pp = pc->y_u.Otapl.p;
|
||||
pc = NEXTOP(pc,Otapl);
|
||||
break;
|
||||
/* instructions type aFlp */
|
||||
case _native_me:
|
||||
pc = NEXTOP(pc,aFlp);
|
||||
break;
|
||||
/* instructions type c */
|
||||
case _write_atom:
|
||||
pc = NEXTOP(pc,c);
|
||||
|
@ -724,8 +726,680 @@
|
|||
case _trie_try_var_in_pair:
|
||||
pc = NEXTOP(pc,e);
|
||||
break;
|
||||
#endif
|
||||
#ifdef YAP_JIT
|
||||
/* instructions type D */
|
||||
case _traced_write_dbterm:
|
||||
pc = NEXTOP(pc,D);
|
||||
break;
|
||||
/* instructions type Illss */
|
||||
case _traced_enter_lu_pred:
|
||||
return walk_got_lu_block(pc->y_u.Illss.I, startp, endp);
|
||||
/* instructions type J */
|
||||
case _traced_jit_handler:
|
||||
pc = NEXTOP(pc,J);
|
||||
break;
|
||||
/* instructions type L */
|
||||
case _traced_alloc_for_logical_pred:
|
||||
return walk_got_lu_clause(pc->y_u.L.ClBase, startp, endp);
|
||||
/* instructions type N */
|
||||
case _traced_write_bigint:
|
||||
pc = NEXTOP(pc,N);
|
||||
break;
|
||||
/* instructions type Osblp */
|
||||
case _traced_either:
|
||||
case _traced_or_else:
|
||||
clause_code = TRUE;
|
||||
pp = pc->y_u.Osblp.p0;
|
||||
pc = NEXTOP(pc,Osblp);
|
||||
break;
|
||||
/* instructions type Osbmp */
|
||||
case _traced_p_execute:
|
||||
case _traced_p_execute_tail:
|
||||
pc = NEXTOP(pc,Osbmp);
|
||||
break;
|
||||
/* instructions type Osbpa */
|
||||
case _traced_ensure_space:
|
||||
pc = NEXTOP(pc,Osbpa);
|
||||
break;
|
||||
/* instructions type Osbpp */
|
||||
case _traced_call:
|
||||
case _traced_call_cpred:
|
||||
case _traced_call_usercpred:
|
||||
case _traced_fcall:
|
||||
case _traced_p_execute2:
|
||||
clause_code = TRUE;
|
||||
pp = pc->y_u.Osbpp.p0;
|
||||
pc = NEXTOP(pc,Osbpp);
|
||||
break;
|
||||
/* instructions type OtILl */
|
||||
case _traced_count_trust_logical:
|
||||
case _traced_profiled_trust_logical:
|
||||
case _traced_trust_logical:
|
||||
return walk_got_lu_block(pc->y_u.OtILl.block, startp, endp);
|
||||
/* instructions type OtaLl */
|
||||
case _traced_count_retry_logical:
|
||||
case _traced_profiled_retry_logical:
|
||||
case _traced_retry_logical:
|
||||
case _traced_try_logical:
|
||||
pc = pc->y_u.OtaLl.n;
|
||||
break;
|
||||
/* instructions type OtapFs */
|
||||
case _traced_cut_c:
|
||||
case _traced_cut_userc:
|
||||
case _traced_retry_c:
|
||||
case _traced_retry_userc:
|
||||
case _traced_try_c:
|
||||
case _traced_try_userc:
|
||||
clause_code = TRUE;
|
||||
pp = pc->y_u.OtapFs.p;
|
||||
pc = NEXTOP(pc,OtapFs);
|
||||
break;
|
||||
/* instructions type Otapl */
|
||||
case _traced_count_retry_and_mark:
|
||||
case _traced_count_retry_me:
|
||||
case _traced_count_trust_me:
|
||||
case _traced_profiled_retry_and_mark:
|
||||
case _traced_profiled_retry_me:
|
||||
case _traced_profiled_trust_me:
|
||||
case _traced_retry:
|
||||
case _traced_retry_and_mark:
|
||||
case _traced_retry_me:
|
||||
case _traced_spy_or_trymark:
|
||||
case _traced_trust:
|
||||
case _traced_trust_me:
|
||||
case _traced_try_and_mark:
|
||||
case _traced_try_clause:
|
||||
case _traced_try_me:
|
||||
clause_code = FALSE;
|
||||
pp = pc->y_u.Otapl.p;
|
||||
pc = NEXTOP(pc,Otapl);
|
||||
break;
|
||||
/* instructions type c */
|
||||
case _traced_write_atom:
|
||||
pc = NEXTOP(pc,c);
|
||||
break;
|
||||
/* instructions type cc */
|
||||
case _traced_get_2atoms:
|
||||
pc = NEXTOP(pc,cc);
|
||||
break;
|
||||
/* instructions type ccc */
|
||||
case _traced_get_3atoms:
|
||||
pc = NEXTOP(pc,ccc);
|
||||
break;
|
||||
/* instructions type cccc */
|
||||
case _traced_get_4atoms:
|
||||
pc = NEXTOP(pc,cccc);
|
||||
break;
|
||||
/* instructions type ccccc */
|
||||
case _traced_get_5atoms:
|
||||
pc = NEXTOP(pc,ccccc);
|
||||
break;
|
||||
/* instructions type cccccc */
|
||||
case _traced_get_6atoms:
|
||||
pc = NEXTOP(pc,cccccc);
|
||||
break;
|
||||
/* instructions type clll */
|
||||
case _traced_if_not_then:
|
||||
pc = NEXTOP(pc,clll);
|
||||
break;
|
||||
/* instructions type d */
|
||||
case _traced_write_float:
|
||||
pc = NEXTOP(pc,d);
|
||||
break;
|
||||
/* instructions type e */
|
||||
case _traced_Nstop:
|
||||
case _traced_allocate:
|
||||
case _traced_copy_idb_term:
|
||||
case _traced_expand_index:
|
||||
case _traced_index_blob:
|
||||
case _traced_index_dbref:
|
||||
case _traced_index_long:
|
||||
case _traced_index_pred:
|
||||
case _traced_lock_pred:
|
||||
case _traced_op_fail:
|
||||
case _traced_p_equal:
|
||||
case _traced_p_functor:
|
||||
case _traced_pop:
|
||||
case _traced_retry_eam:
|
||||
case _traced_spy_pred:
|
||||
case _traced_thread_local:
|
||||
case _traced_trust_fail:
|
||||
case _traced_undef_p:
|
||||
case _traced_unify_idb_term:
|
||||
case _traced_unlock_lu:
|
||||
case _traced_write_l_list:
|
||||
case _traced_write_list:
|
||||
case _traced_write_void:
|
||||
pc = NEXTOP(pc,e);
|
||||
break;
|
||||
/* instructions type fa */
|
||||
case _traced_write_l_struc:
|
||||
case _traced_write_struct:
|
||||
pc = NEXTOP(pc,fa);
|
||||
break;
|
||||
/* instructions type i */
|
||||
case _traced_write_longint:
|
||||
pc = NEXTOP(pc,i);
|
||||
break;
|
||||
/* instructions type l */
|
||||
case _traced_Ystop:
|
||||
case _traced_jump:
|
||||
case _traced_jump_if_var:
|
||||
case _traced_move_back:
|
||||
case _traced_p_dif:
|
||||
case _traced_p_eq:
|
||||
case _traced_retry2:
|
||||
case _traced_retry3:
|
||||
case _traced_retry4:
|
||||
case _traced_skip:
|
||||
case _traced_try_clause2:
|
||||
case _traced_try_clause3:
|
||||
case _traced_try_clause4:
|
||||
case _traced_try_in:
|
||||
pc = NEXTOP(pc,l);
|
||||
break;
|
||||
/* instructions type llll */
|
||||
case _traced_switch_on_type:
|
||||
pc = NEXTOP(pc,llll);
|
||||
break;
|
||||
/* instructions type lp */
|
||||
case _traced_user_switch:
|
||||
pc = NEXTOP(pc,lp);
|
||||
break;
|
||||
/* instructions type o */
|
||||
case _traced_unify_l_list:
|
||||
case _traced_unify_l_list_write:
|
||||
case _traced_unify_l_void:
|
||||
case _traced_unify_l_void_write:
|
||||
case _traced_unify_list:
|
||||
case _traced_unify_list_write:
|
||||
case _traced_unify_void:
|
||||
case _traced_unify_void_write:
|
||||
pc = NEXTOP(pc,o);
|
||||
break;
|
||||
/* instructions type oD */
|
||||
case _traced_unify_dbterm:
|
||||
case _traced_unify_l_dbterm:
|
||||
pc = NEXTOP(pc,oD);
|
||||
break;
|
||||
/* instructions type oN */
|
||||
case _traced_unify_bigint:
|
||||
case _traced_unify_l_bigint:
|
||||
pc = NEXTOP(pc,oN);
|
||||
break;
|
||||
/* instructions type oc */
|
||||
case _traced_unify_atom:
|
||||
case _traced_unify_atom_write:
|
||||
case _traced_unify_l_atom:
|
||||
case _traced_unify_l_atom_write:
|
||||
pc = NEXTOP(pc,oc);
|
||||
break;
|
||||
/* instructions type od */
|
||||
case _traced_unify_float:
|
||||
case _traced_unify_float_write:
|
||||
case _traced_unify_l_float:
|
||||
case _traced_unify_l_float_write:
|
||||
pc = NEXTOP(pc,od);
|
||||
break;
|
||||
/* instructions type ofa */
|
||||
case _traced_unify_l_struc:
|
||||
case _traced_unify_l_struc_write:
|
||||
case _traced_unify_struct:
|
||||
case _traced_unify_struct_write:
|
||||
pc = NEXTOP(pc,ofa);
|
||||
break;
|
||||
/* instructions type oi */
|
||||
case _traced_unify_l_longint:
|
||||
case _traced_unify_l_longint_write:
|
||||
case _traced_unify_longint:
|
||||
case _traced_unify_longint_write:
|
||||
pc = NEXTOP(pc,oi);
|
||||
break;
|
||||
/* instructions type ollll */
|
||||
case _traced_switch_list_nl:
|
||||
pc = NEXTOP(pc,ollll);
|
||||
break;
|
||||
/* instructions type os */
|
||||
case _traced_run_eam:
|
||||
case _traced_unify_l_n_voids:
|
||||
case _traced_unify_l_n_voids_write:
|
||||
case _traced_unify_n_voids:
|
||||
case _traced_unify_n_voids_write:
|
||||
pc = NEXTOP(pc,os);
|
||||
break;
|
||||
/* instructions type osc */
|
||||
case _traced_unify_n_atoms:
|
||||
case _traced_unify_n_atoms_write:
|
||||
pc = NEXTOP(pc,osc);
|
||||
break;
|
||||
/* instructions type ox */
|
||||
case _traced_save_appl_x:
|
||||
case _traced_save_appl_x_write:
|
||||
case _traced_save_pair_x:
|
||||
case _traced_save_pair_x_write:
|
||||
case _traced_unify_l_x_loc:
|
||||
case _traced_unify_l_x_loc_write:
|
||||
case _traced_unify_l_x_val:
|
||||
case _traced_unify_l_x_val_write:
|
||||
case _traced_unify_l_x_var:
|
||||
case _traced_unify_l_x_var_write:
|
||||
case _traced_unify_x_loc:
|
||||
case _traced_unify_x_loc_write:
|
||||
case _traced_unify_x_val:
|
||||
case _traced_unify_x_val_write:
|
||||
case _traced_unify_x_var:
|
||||
case _traced_unify_x_var_write:
|
||||
pc = NEXTOP(pc,ox);
|
||||
break;
|
||||
/* instructions type oxx */
|
||||
case _traced_unify_l_x_var2:
|
||||
case _traced_unify_l_x_var2_write:
|
||||
case _traced_unify_x_var2:
|
||||
case _traced_unify_x_var2_write:
|
||||
pc = NEXTOP(pc,oxx);
|
||||
break;
|
||||
/* instructions type oy */
|
||||
case _traced_save_appl_y:
|
||||
case _traced_save_appl_y_write:
|
||||
case _traced_save_pair_y:
|
||||
case _traced_save_pair_y_write:
|
||||
case _traced_unify_l_y_loc:
|
||||
case _traced_unify_l_y_loc_write:
|
||||
case _traced_unify_l_y_val:
|
||||
case _traced_unify_l_y_val_write:
|
||||
case _traced_unify_l_y_var:
|
||||
case _traced_unify_l_y_var_write:
|
||||
case _traced_unify_y_loc:
|
||||
case _traced_unify_y_loc_write:
|
||||
case _traced_unify_y_val:
|
||||
case _traced_unify_y_val_write:
|
||||
case _traced_unify_y_var:
|
||||
case _traced_unify_y_var_write:
|
||||
pc = NEXTOP(pc,oy);
|
||||
break;
|
||||
/* instructions type p */
|
||||
case _traced_count_call:
|
||||
case _traced_count_retry:
|
||||
case _traced_deallocate:
|
||||
case _traced_enter_profiling:
|
||||
case _traced_lock_lu:
|
||||
case _traced_procceed:
|
||||
case _traced_retry_profiled:
|
||||
pc = NEXTOP(pc,p);
|
||||
break;
|
||||
/* instructions type plxxs */
|
||||
case _traced_call_bfunc_xx:
|
||||
pc = NEXTOP(pc,plxxs);
|
||||
break;
|
||||
/* instructions type plxys */
|
||||
case _traced_call_bfunc_xy:
|
||||
case _traced_call_bfunc_yx:
|
||||
pc = NEXTOP(pc,plxys);
|
||||
break;
|
||||
/* instructions type plyys */
|
||||
case _traced_call_bfunc_yy:
|
||||
pc = NEXTOP(pc,plyys);
|
||||
break;
|
||||
/* instructions type pp */
|
||||
case _traced_dexecute:
|
||||
case _traced_execute:
|
||||
case _traced_execute_cpred:
|
||||
clause_code = TRUE;
|
||||
pp = pc->y_u.pp.p0;
|
||||
pc = NEXTOP(pc,pp);
|
||||
break;
|
||||
/* instructions type s */
|
||||
case _traced_cut:
|
||||
case _traced_cut_e:
|
||||
case _traced_cut_t:
|
||||
case _traced_pop_n:
|
||||
case _traced_write_n_voids:
|
||||
pc = NEXTOP(pc,s);
|
||||
break;
|
||||
/* instructions type sc */
|
||||
case _traced_write_n_atoms:
|
||||
pc = NEXTOP(pc,sc);
|
||||
break;
|
||||
/* instructions type sllll */
|
||||
case _traced_switch_on_sub_arg_type:
|
||||
pc = NEXTOP(pc,sllll);
|
||||
break;
|
||||
/* instructions type slp */
|
||||
case _traced_call_c_wfail:
|
||||
pc = NEXTOP(pc,slp);
|
||||
break;
|
||||
/* instructions type sssl */
|
||||
case _traced_go_on_cons:
|
||||
case _traced_go_on_func:
|
||||
case _traced_if_cons:
|
||||
case _traced_if_func:
|
||||
case _traced_switch_on_cons:
|
||||
case _traced_switch_on_func:
|
||||
pc = NEXTOP(pc,sssl);
|
||||
break;
|
||||
/* instructions type sssllp */
|
||||
case _traced_expand_clauses:
|
||||
return found_expand_index(pc, startp, endp, codeptr PASS_REGS);
|
||||
pc = NEXTOP(pc,sssllp);
|
||||
break;
|
||||
/* instructions type x */
|
||||
case _traced_get_list:
|
||||
case _traced_put_list:
|
||||
case _traced_save_b_x:
|
||||
case _traced_write_x_loc:
|
||||
case _traced_write_x_val:
|
||||
case _traced_write_x_var:
|
||||
pc = NEXTOP(pc,x);
|
||||
break;
|
||||
/* instructions type xD */
|
||||
case _traced_get_dbterm:
|
||||
case _traced_put_dbterm:
|
||||
pc = NEXTOP(pc,xD);
|
||||
break;
|
||||
/* instructions type xN */
|
||||
case _traced_get_bigint:
|
||||
case _traced_put_bigint:
|
||||
pc = NEXTOP(pc,xN);
|
||||
break;
|
||||
/* instructions type xc */
|
||||
case _traced_get_atom:
|
||||
case _traced_put_atom:
|
||||
pc = NEXTOP(pc,xc);
|
||||
break;
|
||||
/* instructions type xd */
|
||||
case _traced_get_float:
|
||||
case _traced_put_float:
|
||||
pc = NEXTOP(pc,xd);
|
||||
break;
|
||||
/* instructions type xfa */
|
||||
case _traced_get_struct:
|
||||
case _traced_put_struct:
|
||||
pc = NEXTOP(pc,xfa);
|
||||
break;
|
||||
/* instructions type xi */
|
||||
case _traced_get_longint:
|
||||
case _traced_put_longint:
|
||||
pc = NEXTOP(pc,xi);
|
||||
break;
|
||||
/* instructions type xl */
|
||||
case _traced_p_atom_x:
|
||||
case _traced_p_atomic_x:
|
||||
case _traced_p_compound_x:
|
||||
case _traced_p_db_ref_x:
|
||||
case _traced_p_float_x:
|
||||
case _traced_p_integer_x:
|
||||
case _traced_p_nonvar_x:
|
||||
case _traced_p_number_x:
|
||||
case _traced_p_primitive_x:
|
||||
case _traced_p_var_x:
|
||||
pc = NEXTOP(pc,xl);
|
||||
break;
|
||||
/* instructions type xll */
|
||||
case _traced_jump_if_nonvar:
|
||||
pc = NEXTOP(pc,xll);
|
||||
break;
|
||||
/* instructions type xllll */
|
||||
case _traced_switch_on_arg_type:
|
||||
pc = NEXTOP(pc,xllll);
|
||||
break;
|
||||
/* instructions type xps */
|
||||
case _traced_commit_b_x:
|
||||
pc = NEXTOP(pc,xps);
|
||||
break;
|
||||
/* instructions type xx */
|
||||
case _traced_get_x_val:
|
||||
case _traced_get_x_var:
|
||||
case _traced_gl_void_valx:
|
||||
case _traced_gl_void_varx:
|
||||
case _traced_glist_valx:
|
||||
case _traced_put_x_val:
|
||||
case _traced_put_x_var:
|
||||
pc = NEXTOP(pc,xx);
|
||||
break;
|
||||
/* instructions type xxc */
|
||||
case _traced_p_func2s_cv:
|
||||
pc = NEXTOP(pc,xxc);
|
||||
break;
|
||||
/* instructions type xxn */
|
||||
case _traced_p_and_vc:
|
||||
case _traced_p_arg_cv:
|
||||
case _traced_p_div_cv:
|
||||
case _traced_p_div_vc:
|
||||
case _traced_p_func2s_vc:
|
||||
case _traced_p_minus_cv:
|
||||
case _traced_p_or_vc:
|
||||
case _traced_p_plus_vc:
|
||||
case _traced_p_sll_cv:
|
||||
case _traced_p_sll_vc:
|
||||
case _traced_p_slr_cv:
|
||||
case _traced_p_slr_vc:
|
||||
case _traced_p_times_vc:
|
||||
pc = NEXTOP(pc,xxn);
|
||||
break;
|
||||
/* instructions type xxx */
|
||||
case _traced_p_and_vv:
|
||||
case _traced_p_arg_vv:
|
||||
case _traced_p_div_vv:
|
||||
case _traced_p_func2f_xx:
|
||||
case _traced_p_func2s_vv:
|
||||
case _traced_p_minus_vv:
|
||||
case _traced_p_or_vv:
|
||||
case _traced_p_plus_vv:
|
||||
case _traced_p_sll_vv:
|
||||
case _traced_p_slr_vv:
|
||||
case _traced_p_times_vv:
|
||||
pc = NEXTOP(pc,xxx);
|
||||
break;
|
||||
/* instructions type xxxx */
|
||||
case _traced_put_xx_val:
|
||||
pc = NEXTOP(pc,xxxx);
|
||||
break;
|
||||
/* instructions type xxy */
|
||||
case _traced_p_func2f_xy:
|
||||
pc = NEXTOP(pc,xxy);
|
||||
break;
|
||||
/* instructions type y */
|
||||
case _traced_save_b_y:
|
||||
case _traced_write_y_loc:
|
||||
case _traced_write_y_val:
|
||||
case _traced_write_y_var:
|
||||
pc = NEXTOP(pc,y);
|
||||
break;
|
||||
/* instructions type yl */
|
||||
case _traced_p_atom_y:
|
||||
case _traced_p_atomic_y:
|
||||
case _traced_p_compound_y:
|
||||
case _traced_p_db_ref_y:
|
||||
case _traced_p_float_y:
|
||||
case _traced_p_integer_y:
|
||||
case _traced_p_nonvar_y:
|
||||
case _traced_p_number_y:
|
||||
case _traced_p_primitive_y:
|
||||
case _traced_p_var_y:
|
||||
pc = NEXTOP(pc,yl);
|
||||
break;
|
||||
/* instructions type yps */
|
||||
case _traced_commit_b_y:
|
||||
pc = NEXTOP(pc,yps);
|
||||
break;
|
||||
/* instructions type yx */
|
||||
case _traced_get_y_val:
|
||||
case _traced_get_y_var:
|
||||
case _traced_gl_void_valy:
|
||||
case _traced_gl_void_vary:
|
||||
case _traced_glist_valy:
|
||||
case _traced_put_unsafe:
|
||||
case _traced_put_y_val:
|
||||
case _traced_put_y_var:
|
||||
pc = NEXTOP(pc,yx);
|
||||
break;
|
||||
/* instructions type yxn */
|
||||
case _traced_p_and_y_vc:
|
||||
case _traced_p_arg_y_cv:
|
||||
case _traced_p_div_y_cv:
|
||||
case _traced_p_div_y_vc:
|
||||
case _traced_p_func2s_y_cv:
|
||||
case _traced_p_func2s_y_vc:
|
||||
case _traced_p_minus_y_cv:
|
||||
case _traced_p_or_y_vc:
|
||||
case _traced_p_plus_y_vc:
|
||||
case _traced_p_sll_y_cv:
|
||||
case _traced_p_sll_y_vc:
|
||||
case _traced_p_slr_y_cv:
|
||||
case _traced_p_slr_y_vc:
|
||||
case _traced_p_times_y_vc:
|
||||
pc = NEXTOP(pc,yxn);
|
||||
break;
|
||||
/* instructions type yxx */
|
||||
case _traced_p_and_y_vv:
|
||||
case _traced_p_arg_y_vv:
|
||||
case _traced_p_div_y_vv:
|
||||
case _traced_p_func2f_yx:
|
||||
case _traced_p_func2s_y_vv:
|
||||
case _traced_p_minus_y_vv:
|
||||
case _traced_p_or_y_vv:
|
||||
case _traced_p_plus_y_vv:
|
||||
case _traced_p_sll_y_vv:
|
||||
case _traced_p_slr_y_vv:
|
||||
case _traced_p_times_y_vv:
|
||||
pc = NEXTOP(pc,yxx);
|
||||
break;
|
||||
/* instructions type yyx */
|
||||
case _traced_p_func2f_yy:
|
||||
pc = NEXTOP(pc,yyx);
|
||||
break;
|
||||
/* instructions type yyxx */
|
||||
case _traced_get_yy_var:
|
||||
case _traced_put_y_vals:
|
||||
pc = NEXTOP(pc,yyxx);
|
||||
break;
|
||||
#ifdef YAPOR
|
||||
/* instructions type Otapl */
|
||||
case _traced_getwork:
|
||||
case _traced_getwork_seq:
|
||||
case _traced_sync:
|
||||
clause_code = FALSE;
|
||||
pp = pc->y_u.Otapl.p;
|
||||
pc = NEXTOP(pc,Otapl);
|
||||
break;
|
||||
/* instructions type e */
|
||||
case _traced_getwork_first_time:
|
||||
pc = NEXTOP(pc,e);
|
||||
break;
|
||||
#endif
|
||||
#ifdef TABLING
|
||||
/* instructions type Otapl */
|
||||
case _traced_table_answer_resolution:
|
||||
case _traced_table_answer_resolution_completion:
|
||||
case _traced_table_completion:
|
||||
case _traced_table_load_answer:
|
||||
case _traced_table_retry:
|
||||
case _traced_table_retry_me:
|
||||
case _traced_table_trust:
|
||||
case _traced_table_trust_me:
|
||||
case _traced_table_try:
|
||||
case _traced_table_try_answer:
|
||||
case _traced_table_try_me:
|
||||
case _traced_table_try_single:
|
||||
clause_code = FALSE;
|
||||
pp = pc->y_u.Otapl.p;
|
||||
pc = NEXTOP(pc,Otapl);
|
||||
break;
|
||||
/* instructions type e */
|
||||
case _traced_clause_with_cut:
|
||||
pc = NEXTOP(pc,e);
|
||||
break;
|
||||
/* instructions type s */
|
||||
case _traced_table_new_answer:
|
||||
pc = NEXTOP(pc,s);
|
||||
break;
|
||||
/* instructions type e */
|
||||
case _traced_trie_do_appl:
|
||||
case _traced_trie_do_appl_in_pair:
|
||||
case _traced_trie_do_atom:
|
||||
case _traced_trie_do_atom_in_pair:
|
||||
case _traced_trie_do_bigint:
|
||||
case _traced_trie_do_double:
|
||||
case _traced_trie_do_extension:
|
||||
case _traced_trie_do_gterm:
|
||||
case _traced_trie_do_longint:
|
||||
case _traced_trie_do_null:
|
||||
case _traced_trie_do_null_in_pair:
|
||||
case _traced_trie_do_pair:
|
||||
case _traced_trie_do_val:
|
||||
case _traced_trie_do_val_in_pair:
|
||||
case _traced_trie_do_var:
|
||||
case _traced_trie_do_var_in_pair:
|
||||
case _traced_trie_retry_appl:
|
||||
case _traced_trie_retry_appl_in_pair:
|
||||
case _traced_trie_retry_atom:
|
||||
case _traced_trie_retry_atom_in_pair:
|
||||
case _traced_trie_retry_bigint:
|
||||
case _traced_trie_retry_double:
|
||||
case _traced_trie_retry_extension:
|
||||
case _traced_trie_retry_gterm:
|
||||
case _traced_trie_retry_longint:
|
||||
case _traced_trie_retry_null:
|
||||
case _traced_trie_retry_null_in_pair:
|
||||
case _traced_trie_retry_pair:
|
||||
case _traced_trie_retry_val:
|
||||
case _traced_trie_retry_val_in_pair:
|
||||
case _traced_trie_retry_var:
|
||||
case _traced_trie_retry_var_in_pair:
|
||||
case _traced_trie_trust_appl:
|
||||
case _traced_trie_trust_appl_in_pair:
|
||||
case _traced_trie_trust_atom:
|
||||
case _traced_trie_trust_atom_in_pair:
|
||||
case _traced_trie_trust_bigint:
|
||||
case _traced_trie_trust_double:
|
||||
case _traced_trie_trust_extension:
|
||||
case _traced_trie_trust_gterm:
|
||||
case _traced_trie_trust_longint:
|
||||
case _traced_trie_trust_null:
|
||||
case _traced_trie_trust_null_in_pair:
|
||||
case _traced_trie_trust_pair:
|
||||
case _traced_trie_trust_val:
|
||||
case _traced_trie_trust_val_in_pair:
|
||||
case _traced_trie_trust_var:
|
||||
case _traced_trie_trust_var_in_pair:
|
||||
case _traced_trie_try_appl:
|
||||
case _traced_trie_try_appl_in_pair:
|
||||
case _traced_trie_try_atom:
|
||||
case _traced_trie_try_atom_in_pair:
|
||||
case _traced_trie_try_bigint:
|
||||
case _traced_trie_try_double:
|
||||
case _traced_trie_try_extension:
|
||||
case _traced_trie_try_gterm:
|
||||
case _traced_trie_try_longint:
|
||||
case _traced_trie_try_null:
|
||||
case _traced_trie_try_null_in_pair:
|
||||
case _traced_trie_try_pair:
|
||||
case _traced_trie_try_val:
|
||||
case _traced_trie_try_val_in_pair:
|
||||
case _traced_trie_try_var:
|
||||
case _traced_trie_try_var_in_pair:
|
||||
pc = NEXTOP(pc,e);
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
/* this instruction is hardwired */
|
||||
#ifdef YAP_JIT
|
||||
case _traced_or_last:
|
||||
#ifdef YAPOR
|
||||
pp = pc->y_u.Osblp.p0;
|
||||
if (pp->PredFlags & MegaClausePredFlag)
|
||||
return found_mega_clause(pp, startp, endp);
|
||||
clause_code = TRUE;
|
||||
pc = NEXTOP(pc,Osblp);
|
||||
#else
|
||||
pp = pc->y_u.p.p;
|
||||
if (pp->PredFlags & MegaClausePredFlag)
|
||||
return found_mega_clause(pp, startp, endp);
|
||||
clause_code = TRUE;
|
||||
pc = NEXTOP(pc,p);
|
||||
#endif
|
||||
#endif
|
||||
case _or_last:
|
||||
#ifdef YAPOR
|
||||
pp = pc->y_u.Osblp.p0;
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
set(LIBJIT_MAJOR_VERSION 0)
|
||||
set(LIBJIT_MINOR_VERSION 2)
|
||||
set(LIBJIT_PATCH_VERSION 1)
|
||||
set(LIBJIT_FULL_VERSION
|
||||
${LIBJIT_MAJOR_VERSION}.${LIBJIT_MINOR_VERSION}.${LIBJIT_PATCH_VERSION})
|
||||
|
||||
|
||||
set(LIBJIT_SOURCES
|
||||
jit_analysispreds.c
|
||||
jit_configpreds.c
|
||||
jit_statisticpreds.c
|
||||
jit_codegenpreds.c
|
||||
jit_debugpreds.c
|
||||
jit_transformpreds.c
|
||||
JIT_Compiler.cpp
|
||||
)
|
||||
|
||||
# The following variables are defined:
|
||||
# LLVM_FOUND - true if LLVM was found
|
||||
# LLVM_CXXFLAGS - C++ compiler flags for files that include LLVM headers.
|
||||
# LLVM_HOST_TARGET - Target triple used to configure LLVM.
|
||||
# LLVM_INCLUDE_DIRS - Directory containing LLVM include files.
|
||||
# LLVM_LDFLAGS - Linker flags to add when linking against LLVM
|
||||
# (includes -LLLVM_LIBRARY_DIRS).
|
||||
# LLVM_LIBRARIES - Full paths to the library files to link against.
|
||||
# LLVM_LIBRARY_DIRS - Directory containing LLVM libraries.
|
||||
# LLVM_ROOT_DIR - The root directory of the LLVM installation.
|
||||
# llvm-config is searched for in ${LLVM_ROOT_DIR}/bin.
|
||||
# LLVM_VERSION_MAJOR - Major version of LLVM.
|
||||
# LLVM_VERSION_MINOR - Minor version of LLVM.
|
||||
# LLVM_VERSION_STRING - Full LLVM version string (e.g. 2.9).
|
||||
#
|
||||
# Note: The variable names were chosen in conformance with the offical CMake
|
||||
# guidelines, see ${CMAKE_ROOT}/Modules/readme.txt.
|
||||
|
||||
# Try suffixed versions to pick up the newest LLVM install available on Debian
|
||||
# derivatives.
|
||||
# We also want an user-specified LLVM_ROOT_DIR to take precedence over the
|
||||
# system default locations such as /usr/local/bin. Executing find_program()
|
||||
# multiples times is the approach recommended in the docs.
|
||||
|
||||
|
||||
# ugh
|
||||
set (POSITION_INDEPENDENT_CODE TRUE)
|
||||
|
||||
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} ${LLVM_CXXFLAGS})
|
||||
|
||||
add_library (libyapjit SHARED
|
||||
${LIBJIT_SOURCES})
|
||||
|
||||
set_target_properties(libyapjit
|
||||
PROPERTIES
|
||||
# RPATH ${libdir} VERSION ${LIBJIT_FULL_VERSION}
|
||||
# SOVERSION ${LIBJIT_MAJOR_VERSION}.${LIBJIT_MINOR_VERSION}
|
||||
POSITION_INDEPENDENT_CODE TRUE
|
||||
OUTPUT_NAME YapJIT
|
||||
)
|
||||
|
||||
target_link_libraries(libyapjit libYap ${LLVM_LIBRARIES})
|
||||
|
||||
|
||||
|
1563
JIT/HPP/IsGround.h
1563
JIT/HPP/IsGround.h
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,24 @@
|
|||
#ifndef JIT_HPP
|
||||
#define JIT_HPP
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <time.h>
|
||||
#include <dlfcn.h>
|
||||
#include "config.h"
|
||||
#include "absmi.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
#else
|
||||
|
||||
#define LIMIT_COUNT 4096
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,109 @@
|
|||
#ifndef JIT_COMPILER_HPP
|
||||
#define JIT_COMPILER_HPP
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/Constants.h"
|
||||
#include "llvm/IR/DerivedTypes.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/Linker/Linker.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/Analysis/CallGraphSCCPass.h"
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
#include "llvm/ADT/StringSet.h"
|
||||
#include "llvm/ADT/Triple.h"
|
||||
#include "llvm/IR/IRPrintingPasses.h"
|
||||
#include "llvm/CodeGen/Passes.h"
|
||||
#include "llvm/CodeGen/MachineCodeInfo.h"
|
||||
#include "llvm/ExecutionEngine/JIT.h"
|
||||
#include "llvm/ExecutionEngine/Interpreter.h"
|
||||
#include "llvm/ExecutionEngine/GenericValue.h"
|
||||
#include "llvm/ExecutionEngine/JITMemoryManager.h"
|
||||
#include "llvm/ExecutionEngine/JITEventListener.h"
|
||||
#include "llvm/Support/DataStream.h"
|
||||
#include "llvm/IRReader/IRReader.h"
|
||||
#include "llvm/Support/Host.h"
|
||||
#include "llvm/Support/Path.h"
|
||||
#include "llvm/Support/TargetSelect.h"
|
||||
#include "llvm/Support/ManagedStatic.h"
|
||||
#include "llvm/Support/raw_os_ostream.h"
|
||||
#include "llvm/IR/IRBuilder.h"
|
||||
//#include "llvm/Support/PathV1.h"
|
||||
#include "llvm/IR/TypeBuilder.h"
|
||||
#include "llvm/Support/ToolOutputFile.h"
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Target/TargetOptions.h"
|
||||
#include "llvm/Target/TargetLibraryInfo.h"
|
||||
#include "llvm/Analysis/Passes.h"
|
||||
#include "llvm/Analysis/IVUsers.h"
|
||||
#include "llvm/Analysis/Lint.h"
|
||||
#include "llvm/IR/DebugInfo.h"
|
||||
#include "llvm/IR/Verifier.h"
|
||||
#include "llvm/Analysis/LoopPass.h"
|
||||
#include "llvm/Analysis/RegionPass.h"
|
||||
#include "llvm/Analysis/CFGPrinter.h"
|
||||
#include "llvm/Analysis/DomPrinter.h"
|
||||
#include "llvm/Analysis/BranchProbabilityInfo.h"
|
||||
#include "llvm/Analysis/RegionPrinter.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
//#include "llvm/Support/system_error.h"
|
||||
#include "llvm/Support/Process.h"
|
||||
#include "llvm/Bitcode/ReaderWriter.h"
|
||||
#include "llvm/Transforms/IPO.h"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Transforms/Vectorize.h"
|
||||
#include "llvm/Transforms/IPO/PassManagerBuilder.h"
|
||||
#include "llvm/Transforms/Utils/Cloning.h"
|
||||
#include "llvm/Transforms/ObjCARC.h"
|
||||
#include "llvm/Support/FileSystem.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
#include <errno.h>
|
||||
#include "JIT.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
extern short global;
|
||||
extern Environment ExpEnv;
|
||||
extern NativeContext *NativeArea;
|
||||
|
||||
class JIT_Compiler {
|
||||
private:
|
||||
/* main method of JIT Compiler: compiles by clang, analyzes, optimizs and generates code accordingly the user choices */
|
||||
void* compile_all(LLVMContext* &Context, yamop* p);
|
||||
|
||||
/* aid method to 'compile_all': adds register allocator pass to be used.
|
||||
WARNING: don't use! For some reasons llvm crashes when I use it */
|
||||
void set_regalloc_pass(PassManager &PM);
|
||||
|
||||
/* aid method to 'compile_all': optimizes module by individual transform passes or transform level */
|
||||
void optimize_module(llvm::Module* &M);
|
||||
|
||||
/* aid method to 'compile_all': analyzes module by individual analysis passes */
|
||||
void analyze_module(llvm::Module* &M);
|
||||
public:
|
||||
/* method invoked by wrapper 'call_JIT_Compiler' */
|
||||
void* compile(yamop*);
|
||||
};
|
||||
#else
|
||||
|
||||
struct JIT_Compiler{}; // Doing this, I can call class 'JIT_Compiler' from C code
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
|
||||
extern "C" void* call_JIT_Compiler(JIT_Compiler* jc, yamop* p);
|
||||
extern "C" void shutdown_llvm();
|
||||
|
||||
extern "C" void* call_JIT_Compiler(JIT_Compiler* jc, yamop* p) { return jc->compile(p); }
|
||||
extern "C" void shutdown_llvm() { llvm_shutdown(); }
|
||||
|
||||
#endif //#ifdef __cplusplus
|
||||
|
||||
#endif
|
|
@ -0,0 +1,47 @@
|
|||
//===- PassPrinters.h - Utilities to print analysis info for passes -------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// \brief Utilities to print analysis info for various kinds of passes.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
#ifndef LLVM_TOOLS_OPT_PASSPRINTERS_H
|
||||
#define LLVM_TOOLS_OPT_PASSPRINTERS_H
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class BasicBlockPass;
|
||||
class CallGraphSCCPass;
|
||||
class FunctionPass;
|
||||
class ModulePass;
|
||||
class LoopPass;
|
||||
class PassInfo;
|
||||
class RegionPass;
|
||||
class raw_ostream;
|
||||
|
||||
FunctionPass *createFunctionPassPrinter(const PassInfo *passInfo, raw_ostream &out,
|
||||
bool Quiet);
|
||||
|
||||
CallGraphSCCPass *createCallGraphPassPrinter(const PassInfo *passInfo,
|
||||
raw_ostream &out, bool Quiet);
|
||||
|
||||
ModulePass *createModulePassPrinter(const PassInfo *passInfo, raw_ostream &out,
|
||||
bool Quiet);
|
||||
|
||||
LoopPass *createLoopPassPrinter(const PassInfo *passInfo, raw_ostream &out,
|
||||
bool Quiet);
|
||||
|
||||
RegionPass *createRegionPassPrinter(const PassInfo *passInfo, raw_ostream &out,
|
||||
bool Quiet);
|
||||
|
||||
BasicBlockPass *createBasicBlockPassPrinter(const PassInfo *passInfo,
|
||||
raw_ostream &out, bool Quiet);
|
||||
}
|
||||
|
||||
#endif // LLVM_TOOLS_OPT_PASSPRINTERS_H
|
|
@ -0,0 +1,183 @@
|
|||
/**
|
||||
* The code below is adapted from opt tool according to clearance and conditions established in NCSA license as follows:
|
||||
|
||||
* Copyright (c) 2003 University of Illinois. All rights reserved.
|
||||
|
||||
* Developed by: LLVM Developer Group
|
||||
* University of Illinois
|
||||
* http://llvm.org/
|
||||
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal with the Software without restriction, including without limitation the rights to use, copy,
|
||||
* modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
|
||||
* is furnished to do so, subject to the following conditions:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimers.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimers
|
||||
* in the documentation and/or other materials provided with the distribution.
|
||||
* Neither the names of LLVM Developer Group, University of Illinois, nor the names of its contributors may be used to endorse or
|
||||
* promote products derived from this Software without specific prior written permission.
|
||||
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
* IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
|
||||
|
||||
**/
|
||||
|
||||
struct CallGraphSCCPassPrinter : public CallGraphSCCPass {
|
||||
static char ID;
|
||||
const PassInfo *PassToPrint;
|
||||
std::string PassName;
|
||||
|
||||
CallGraphSCCPassPrinter(const PassInfo *PInfo) :
|
||||
CallGraphSCCPass(ID), PassToPrint(PInfo) {
|
||||
std::string PassToPrintName = PassToPrint->getPassName();
|
||||
PassName = "CallGraphSCCPass Printer: " + PassToPrintName;
|
||||
}
|
||||
|
||||
virtual bool runOnSCC(CallGraphSCC &SCC) {
|
||||
errs() << "Printing analysis '" << PassToPrint->getPassName() << "':\n";
|
||||
|
||||
// Get and print pass...
|
||||
for (CallGraphSCC::iterator I = SCC.begin(), E = SCC.end(); I != E; ++I) {
|
||||
Function *F = (*I)->getFunction();
|
||||
if (F)
|
||||
getAnalysisID<Pass>(PassToPrint->getTypeInfo()).print(errs(),
|
||||
F->getParent());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual const char *getPassName() const { return PassName.c_str(); }
|
||||
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.addRequiredID(PassToPrint->getTypeInfo());
|
||||
AU.setPreservesAll();
|
||||
}
|
||||
};
|
||||
|
||||
char CallGraphSCCPassPrinter::ID = 0;
|
||||
|
||||
struct ModulePassPrinter : public ModulePass {
|
||||
static char ID;
|
||||
const PassInfo *PassToPrint;
|
||||
std::string PassName;
|
||||
|
||||
ModulePassPrinter(const PassInfo *PInfo)
|
||||
: ModulePass(ID), PassToPrint(PInfo) {
|
||||
std::string PassToPrintName = PassToPrint->getPassName();
|
||||
PassName = "ModulePass Printer: " + PassToPrintName;
|
||||
}
|
||||
|
||||
virtual bool runOnModule(Module &M) {
|
||||
errs() << "Printing analysis '" << PassToPrint->getPassName() << "':\n";
|
||||
|
||||
// Get and print pass...
|
||||
getAnalysisID<Pass>(PassToPrint->getTypeInfo()).print(errs(), &M);
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual const char *getPassName() const { return PassName.c_str(); }
|
||||
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.addRequiredID(PassToPrint->getTypeInfo());
|
||||
AU.setPreservesAll();
|
||||
}
|
||||
};
|
||||
|
||||
char ModulePassPrinter::ID = 0;
|
||||
|
||||
struct FunctionPassPrinter : public FunctionPass {
|
||||
const PassInfo *PassToPrint;
|
||||
static char ID;
|
||||
std::string PassName;
|
||||
|
||||
FunctionPassPrinter(const PassInfo *PInfo)
|
||||
: FunctionPass(ID), PassToPrint(PInfo) {
|
||||
std::string PassToPrintName = PassToPrint->getPassName();
|
||||
PassName = "FunctionPass Printer: " + PassToPrintName;
|
||||
}
|
||||
|
||||
virtual bool runOnFunction(Function &F) {
|
||||
errs() << "Printing analysis '" << PassToPrint->getPassName()
|
||||
<< "' for function '" << F.getName() << "':\n";
|
||||
|
||||
// Get and print pass...
|
||||
getAnalysisID<Pass>(PassToPrint->getTypeInfo()).print(errs(),
|
||||
F.getParent());
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual const char *getPassName() const { return PassName.c_str(); }
|
||||
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.addRequiredID(PassToPrint->getTypeInfo());
|
||||
AU.setPreservesAll();
|
||||
}
|
||||
};
|
||||
|
||||
char FunctionPassPrinter::ID = 0;
|
||||
|
||||
struct LoopPassPrinter : public LoopPass {
|
||||
static char ID;
|
||||
const PassInfo *PassToPrint;
|
||||
std::string PassName;
|
||||
|
||||
LoopPassPrinter(const PassInfo *PInfo) :
|
||||
LoopPass(ID), PassToPrint(PInfo) {
|
||||
std::string PassToPrintName = PassToPrint->getPassName();
|
||||
PassName = "LoopPass Printer: " + PassToPrintName;
|
||||
}
|
||||
|
||||
|
||||
virtual bool runOnLoop(Loop *L, LPPassManager &LPM) {
|
||||
errs() << "Printing analysis '" << PassToPrint->getPassName() << "':\n";
|
||||
|
||||
// Get and print pass...
|
||||
getAnalysisID<Pass>(PassToPrint->getTypeInfo()).print(errs(),
|
||||
L->getHeader()->getParent()->getParent());
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual const char *getPassName() const { return PassName.c_str(); }
|
||||
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.addRequiredID(PassToPrint->getTypeInfo());
|
||||
AU.setPreservesAll();
|
||||
}
|
||||
};
|
||||
|
||||
char LoopPassPrinter::ID = 0;
|
||||
|
||||
struct RegionPassPrinter : public RegionPass {
|
||||
static char ID;
|
||||
const PassInfo *PassToPrint;
|
||||
std::string PassName;
|
||||
|
||||
RegionPassPrinter(const PassInfo *PInfo) : RegionPass(ID),
|
||||
PassToPrint(PInfo) {
|
||||
std::string PassToPrintName = PassToPrint->getPassName();
|
||||
PassName = "RegionPass Printer: " + PassToPrintName;
|
||||
}
|
||||
|
||||
virtual bool runOnRegion(Region *R, RGPassManager &RGM) {
|
||||
errs() << "Printing analysis '" << PassToPrint->getPassName() << "' for "
|
||||
<< "region: '" << R->getNameStr() << "' in function '"
|
||||
<< R->getEntry()->getParent()->getName() << "':\n";
|
||||
|
||||
// Get and print pass...
|
||||
getAnalysisID<Pass>(PassToPrint->getTypeInfo()).print(errs(),
|
||||
R->getEntry()->getParent()->getParent());
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual const char *getPassName() const { return PassName.c_str(); }
|
||||
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.addRequiredID(PassToPrint->getTypeInfo());
|
||||
AU.setPreservesAll();
|
||||
}
|
||||
};
|
||||
|
||||
char RegionPassPrinter::ID = 0;
|
|
@ -358,7 +358,7 @@
|
|||
#ifdef USE_GMP
|
||||
GET_BIGINT_INSTINIT,
|
||||
GET_BIGINT_GBIGINT_NONVAR,
|
||||
GET_BIGINT_GBIGINT_UNK
|
||||
GET_BIGINT_GBIGINT_UNK,
|
||||
#endif
|
||||
GET_DBTERM_INSTINIT,
|
||||
GET_DBTERM_GDBTERM_NONVAR,
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
#include "Yap.h"
|
||||
#include "clause.h"
|
||||
#include "eval.h"
|
||||
#if HAVE_ERRNO_H
|
||||
#include <errno.h>
|
||||
#else
|
||||
extern int errno;
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#define UPPER_ENTRY(S) \
|
||||
tmp = (char*)malloc((strlen(S)+1)*sizeof(char)); \
|
||||
while (S[i]) { \
|
||||
if (S[i] != '-' && S[i] != '_' && S[i] != ' ') { \
|
||||
if ((S[i] >= '0' && S[i] <= '9') || (S[i] == '.')) \
|
||||
tmp[j] = S[i]; \
|
||||
else \
|
||||
tmp[j] = toupper(S[i]); \
|
||||
j++; \
|
||||
} \
|
||||
i++; \
|
||||
} \
|
||||
tmp[j] = 0; \
|
||||
strcpy(S, tmp); \
|
||||
free(tmp);
|
||||
|
||||
#if YAP_JIT
|
||||
void Yap_InitJitAnalysisPreds(void);
|
||||
void Yap_InitJitCodegenPreds(void);
|
||||
void Yap_InitJitConfigPreds(void);
|
||||
void Yap_InitJitTransformPreds(void);
|
||||
#if YAP_STAT_PREDS
|
||||
void Yap_InitJitStatisticPreds(void);
|
||||
#endif
|
||||
#endif /* YAP_JIT */
|
||||
#if YAP_DBG_PREDS
|
||||
void Yap_InitJitDebugPreds(void);
|
||||
#endif
|
||||
|
||||
Environment ExpEnv;
|
||||
#if YAP_JIT
|
||||
extern NativeContext *NativeArea;
|
||||
extern IntermediatecodeContext *IntermediatecodeArea;
|
||||
#endif
|
1564
JIT/HPP/lastop.h
1564
JIT/HPP/lastop.h
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -49,7 +49,7 @@ if test x"$LLVM_CONFIG" = x"no" ;then
|
|||
AC_MSG_ERROR([--enable-jit was given, but test for LLVM 3.5 failed])
|
||||
else
|
||||
LLVM_VERSION="`$LLVM_CONFIG --version`"
|
||||
if test "$LLVM_VERSION" != "3.5.0";then
|
||||
if test "$LLVM_VERSION" != "3.5.0" -o "$LLVM_VERSION" != "3.5.1";then
|
||||
AC_MSG_ERROR([Test for LLVM 3.5 failed])
|
||||
fi
|
||||
|
||||
|
|
|
@ -38,9 +38,9 @@ Yap_MAVAR_HASH(CELL *addr USES_REGS) {
|
|||
OPT_MAVAR_STATIC struct ma_h_entry *
|
||||
Yap_ALLOC_NEW_MASPACE(USES_REGS1)
|
||||
{
|
||||
ma_h_inner_struct *new = LOCAL_ma_h_top;
|
||||
ma_h_inner_struct *newS = LOCAL_ma_h_top;
|
||||
LOCAL_ma_h_top++;
|
||||
return new;
|
||||
return newS;
|
||||
}
|
||||
|
||||
OPT_MAVAR_STATIC int
|
||||
|
|
|
@ -678,14 +678,14 @@ static inline void **__get_insert_thread_bucket(void **buckets, lockvar *buckets
|
|||
/* indirect bucket */
|
||||
buckets = buckets + THREADS_DIRECT_BUCKETS + (worker_id - THREADS_DIRECT_BUCKETS) / THREADS_DIRECT_BUCKETS;
|
||||
if (*buckets)
|
||||
return *buckets + (worker_id - THREADS_DIRECT_BUCKETS) % THREADS_DIRECT_BUCKETS;
|
||||
return (void **)((char *)(*buckets) + (worker_id - THREADS_DIRECT_BUCKETS) % THREADS_DIRECT_BUCKETS);
|
||||
|
||||
/* insert indirect bucket */
|
||||
LOCK(*buckets_lock);
|
||||
if (*buckets == NULL)
|
||||
ALLOC_BUCKETS(*buckets, THREADS_DIRECT_BUCKETS);
|
||||
UNLOCK(*buckets_lock);
|
||||
return *buckets + (worker_id - THREADS_DIRECT_BUCKETS) % THREADS_DIRECT_BUCKETS;
|
||||
return (void **)((char *)(*buckets) + (worker_id - THREADS_DIRECT_BUCKETS) % THREADS_DIRECT_BUCKETS);
|
||||
}
|
||||
|
||||
#define get_thread_bucket(b) __get_thread_bucket((b) PASS_REGS)
|
||||
|
@ -699,7 +699,7 @@ static inline void **__get_thread_bucket(void **buckets USES_REGS) {
|
|||
/* indirect bucket */
|
||||
buckets = buckets + THREADS_DIRECT_BUCKETS + (worker_id - THREADS_DIRECT_BUCKETS) / THREADS_DIRECT_BUCKETS;
|
||||
if (*buckets)
|
||||
return *buckets + (worker_id - THREADS_DIRECT_BUCKETS) % THREADS_DIRECT_BUCKETS;
|
||||
return (void **)((char *)(buckets) + (worker_id - THREADS_DIRECT_BUCKETS) % THREADS_DIRECT_BUCKETS);
|
||||
|
||||
/* empty indirect bucket */
|
||||
return buckets;
|
||||
|
@ -1236,15 +1236,15 @@ static inline void __restore_bindings(tr_fr_ptr unbind_tr, tr_fr_ptr rebind_tr U
|
|||
#define expand_auxiliary_stack(s) __expand_auxiliary_stack((s) PASS_REGS)
|
||||
|
||||
static inline CELL *__expand_auxiliary_stack(CELL *stack USES_REGS) {
|
||||
void *old_top = LOCAL_TrailTop;
|
||||
char *old_top = (char *)LOCAL_TrailTop;
|
||||
INFORMATION_MESSAGE("Expanding trail in 64 Kbytes");
|
||||
if (! Yap_growtrail(K64, TRUE)) { /* TRUE means 'contiguous_only' */
|
||||
Yap_Error(OUT_OF_TRAIL_ERROR, TermNil, "stack full (STACK_CHECK_EXPAND)");
|
||||
return NULL;
|
||||
} else {
|
||||
UInt diff = (void *)LOCAL_TrailTop - old_top;
|
||||
CELL *new_stack = (CELL *)((void *)stack + diff);
|
||||
memmove((void *)new_stack, (void *)stack, old_top - (void *)stack);
|
||||
UInt diff = (char *)LOCAL_TrailTop - old_top;
|
||||
CELL *new_stack = (CELL *)((char *)stack + diff);
|
||||
memmove((void *)new_stack, stack, old_top - (char *)stack);
|
||||
return new_stack;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,77 +0,0 @@
|
|||
/************************************************************************
|
||||
** **
|
||||
** The YapTab/YapOr/OPTYap systems **
|
||||
** **
|
||||
** YapTab extends the Yap Prolog engine to support sequential tabling **
|
||||
** YapOr extends the Yap Prolog engine to support or-parallelism **
|
||||
** OPTYap extends the Yap Prolog engine to support or-parallel tabling **
|
||||
** **
|
||||
** **
|
||||
** Yap Prolog was developed at University of Porto, Portugal **
|
||||
** **
|
||||
************************************************************************/
|
||||
|
||||
#define RationalMark 7 //0m0...111
|
||||
#define IsRationalTerm(TERM) ((int) TERM == 7)
|
||||
|
||||
typedef struct term_array {
|
||||
void* *terms;
|
||||
void* *nodes;
|
||||
size_t length;
|
||||
size_t capacity;
|
||||
} term_array;
|
||||
|
||||
void term_array_init(term_array *array, int capacity);
|
||||
void term_array_free(term_array *array);
|
||||
void term_array_push(term_array *array, void* t, void* n);
|
||||
void* term_array_member(term_array array, void* t);
|
||||
|
||||
void term_array_init(term_array *array, int capacity) {
|
||||
array->length = 0;
|
||||
array->terms = malloc(capacity * sizeof(void*));
|
||||
if (array->terms != NULL) {
|
||||
array->capacity = capacity;
|
||||
} else
|
||||
Yap_Error(RESOURCE_ERROR_MEMORY, TermNil, "Out of memory."); // Handle out-of-memory
|
||||
array->capacity = capacity;
|
||||
array->nodes = malloc(capacity * sizeof(void*));
|
||||
if (array->nodes == NULL)
|
||||
Yap_Error(RESOURCE_ERROR_MEMORY, TermNil, "Out of memory."); // Handle out-of-memory
|
||||
}
|
||||
|
||||
void term_array_free(term_array *array) {
|
||||
free(array->terms);
|
||||
free(array->nodes);
|
||||
array->terms = NULL;
|
||||
array->nodes = NULL;
|
||||
array->length = 0;
|
||||
array->capacity = 0;
|
||||
}
|
||||
|
||||
void term_array_push(term_array *array, void* t, void* n) {
|
||||
if (array->length == array->capacity) {
|
||||
int new_capacity = array->capacity * 2;
|
||||
void *new_terms = realloc(array->terms, new_capacity * sizeof(void*));
|
||||
if (new_terms != NULL) {
|
||||
array->terms = new_terms;
|
||||
} else
|
||||
Yap_Error(RESOURCE_ERROR_MEMORY, TermNil, "Out of memory."); // Handle out-of-memory
|
||||
void *new_nodes = realloc(array->nodes, new_capacity * sizeof(void *));
|
||||
if (new_nodes != NULL) {
|
||||
array->nodes = new_nodes;
|
||||
} else
|
||||
Yap_Error(RESOURCE_ERROR_MEMORY, TermNil, "Out of memory."); // Handle out-of-memory
|
||||
array->capacity = new_capacity;
|
||||
}
|
||||
array->terms[array->length] = t;
|
||||
array->nodes[array->length] = n;
|
||||
array->length++;
|
||||
}
|
||||
|
||||
void* term_array_member(term_array array, void* t) {
|
||||
int i;
|
||||
for (i = 0; i < array.length; i++)
|
||||
if (array.terms[i] == t) return array.nodes[i];
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -168,7 +168,7 @@ static struct trie_statistics{
|
|||
** Rational Terms Support **
|
||||
******************************/
|
||||
#ifdef TRIE_RATIONAL_TERMS
|
||||
#include "tab.rational.i"
|
||||
#include "tab.rational.h"
|
||||
#endif /* RATIONAL TERM SUPPORT FOR TRIES */
|
||||
|
||||
|
||||
|
@ -179,7 +179,7 @@ static struct trie_statistics{
|
|||
#define INCLUDE_SUBGOAL_TRIE_CHECK_INSERT /* subgoal_trie_check_insert_entry */
|
||||
#define INCLUDE_ANSWER_TRIE_CHECK_INSERT /* answer_trie_check_insert_entry */
|
||||
#define INCLUDE_GLOBAL_TRIE_CHECK_INSERT /* global_trie_check_insert_entry */
|
||||
#include "tab.tries.i"
|
||||
#include "tab.tries.h"
|
||||
#undef INCLUDE_GLOBAL_TRIE_CHECK_INSERT
|
||||
#undef INCLUDE_ANSWER_TRIE_CHECK_INSERT
|
||||
#undef INCLUDE_SUBGOAL_TRIE_CHECK_INSERT
|
||||
|
@ -190,7 +190,7 @@ static struct trie_statistics{
|
|||
#ifdef GLOBAL_TRIE_FOR_SUBTERMS
|
||||
#define INCLUDE_GLOBAL_TRIE_CHECK_INSERT /* global_trie_check_insert_gt_entry */
|
||||
#endif /* GLOBAL_TRIE_FOR_SUBTERMS */
|
||||
#include "tab.tries.i"
|
||||
#include "tab.tries.h"
|
||||
#undef INCLUDE_GLOBAL_TRIE_CHECK_INSERT
|
||||
#undef INCLUDE_ANSWER_TRIE_CHECK_INSERT
|
||||
#undef INCLUDE_SUBGOAL_TRIE_CHECK_INSERT
|
||||
|
@ -199,7 +199,7 @@ static struct trie_statistics{
|
|||
#define INCLUDE_SUBGOAL_SEARCH_LOOP /* subgoal_search_loop */
|
||||
#define INCLUDE_ANSWER_SEARCH_LOOP /* answer_search_loop */
|
||||
#define INCLUDE_LOAD_ANSWER_LOOP /* load_answer_loop */
|
||||
#include "tab.tries.i"
|
||||
#include "tab.tries.h"
|
||||
#undef INCLUDE_LOAD_ANSWER_LOOP
|
||||
#undef INCLUDE_ANSWER_SEARCH_LOOP
|
||||
#undef INCLUDE_SUBGOAL_SEARCH_LOOP
|
||||
|
@ -209,10 +209,10 @@ static struct trie_statistics{
|
|||
#define INCLUDE_ANSWER_SEARCH_LOOP /* answer_search_terms_loop */
|
||||
#ifdef TRIE_RATIONAL_TERMS
|
||||
#undef TRIE_RATIONAL_TERMS
|
||||
#include "tab.tries.i"
|
||||
#include "tab.tries.h"
|
||||
#define TRIE_RATIONAL_TERMS
|
||||
#else
|
||||
#include "tab.tries.i"
|
||||
#include "tab.tries.h"
|
||||
#endif
|
||||
#undef INCLUDE_ANSWER_SEARCH_LOOP
|
||||
#undef INCLUDE_SUBGOAL_SEARCH_LOOP
|
||||
|
@ -224,10 +224,10 @@ static struct trie_statistics{
|
|||
#define INCLUDE_LOAD_ANSWER_LOOP /* load_substitution_loop */
|
||||
#ifdef TRIE_RATIONAL_TERMS
|
||||
#undef TRIE_RATIONAL_TERMS
|
||||
#include "tab.tries.i"
|
||||
#include "tab.tries.h"
|
||||
#define TRIE_RATIONAL_TERMS
|
||||
#else
|
||||
#include "tab.tries.i"
|
||||
#include "tab.tries.h"
|
||||
#endif
|
||||
#undef INCLUDE_LOAD_ANSWER_LOOP
|
||||
#undef INCLUDE_ANSWER_SEARCH_LOOP
|
||||
|
@ -236,7 +236,7 @@ static struct trie_statistics{
|
|||
|
||||
#ifdef MODE_DIRECTED_TABLING
|
||||
#define INCLUDE_ANSWER_SEARCH_MODE_DIRECTED
|
||||
#include "tab.tries.i" /* answer_search_min_max + answer_search_sum + invalidate_answer_trie */
|
||||
#include "tab.tries.h" /* answer_search_min_max + answer_search_sum + invalidate_answer_trie */
|
||||
#undef INCLUDE_ANSWER_SEARCH_MODE_DIRECTED
|
||||
#endif /* MODE_DIRECTED_TABLING */
|
||||
|
||||
|
|
2045
OPTYap/tab.tries.i
2045
OPTYap/tab.tries.i
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,41 @@
|
|||
/************************************************************************
|
||||
** **
|
||||
** The YapTab/YapOr/OPTYap systems **
|
||||
** **
|
||||
** YapTab extends the Yap Prolog engine to support sequential tabling **
|
||||
** YapOr extends the Yap Prolog engine to support or-parallelism **
|
||||
** OPTYap extends the Yap Prolog engine to support or-parallel tabling **
|
||||
** **
|
||||
** **
|
||||
** Yap Prolog was developed at University of Porto, Portugal **
|
||||
** **
|
||||
************************************************************************/
|
||||
|
||||
/* -------------------------------- **
|
||||
** Scheduler instructions **
|
||||
** -------------------------------- */
|
||||
|
||||
PBOp(traced_getwork_first_time,e)
|
||||
{ printf("Or-parallelism not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
|
||||
|
||||
PBOp(traced_getwork,Otapl)
|
||||
{ printf("Or-parallelism not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
|
||||
/* The idea is to check whether we are the last worker in the node.
|
||||
If we are, we can go ahead, otherwise we should call the scheduler. */
|
||||
PBOp(traced_getwork_seq,Otapl)
|
||||
{ printf("Or-parallelism not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
|
||||
PBOp(traced_sync,Otapl)
|
||||
{ printf("Or-parallelism not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
|
@ -0,0 +1,154 @@
|
|||
/************************************************************************
|
||||
** **
|
||||
** The YapTab/YapOr/OPTYap systems **
|
||||
** **
|
||||
** YapTab extends the Yap Prolog engine to support sequential tabling **
|
||||
** YapOr extends the Yap Prolog engine to support or-parallelism **
|
||||
** OPTYap extends the Yap Prolog engine to support or-parallel tabling **
|
||||
** **
|
||||
** **
|
||||
** Yap Prolog was developed at University of Porto, Portugal **
|
||||
** **
|
||||
************************************************************************/
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
** clause_with_cut **
|
||||
************************************************************************/
|
||||
|
||||
Op(traced_clause_with_cut, e)
|
||||
{ printf("Tabling not supported by JIT!!\n"); exit(1); }
|
||||
ENDOp();
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
** table_load_answer **
|
||||
************************************************************************/
|
||||
|
||||
PBOp(traced_table_load_answer, Otapl)
|
||||
{ printf("Or-parallelism not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
** table_try_answer **
|
||||
************************************************************************/
|
||||
|
||||
PBOp(traced_table_try_answer, Otapl)
|
||||
{ printf("Or-parallelism not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
** table_try_single **
|
||||
************************************************************************/
|
||||
|
||||
PBOp(traced_table_try_single, Otapl)
|
||||
{ printf("Or-parallelism not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
** table_try_me **
|
||||
************************************************************************/
|
||||
|
||||
PBOp(traced_table_try_me, Otapl)
|
||||
{ printf("Or-parallelism not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
** table_try **
|
||||
************************************************************************/
|
||||
|
||||
PBOp(traced_table_try, Otapl)
|
||||
{ printf("Or-parallelism not supported by JIT!!\n"); exit(1); }
|
||||
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
** table_retry_me **
|
||||
************************************************************************/
|
||||
|
||||
Op(traced_table_retry_me, Otapl)
|
||||
{ printf("Or-parallelism not supported by JIT!!\n"); exit(1); }
|
||||
ENDOp();
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
** table_retry **
|
||||
************************************************************************/
|
||||
|
||||
Op(traced_table_retry, Otapl)
|
||||
{ printf("Or-parallelism not supported by JIT!!\n"); exit(1); }
|
||||
ENDOp();
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
** table_trust_me **
|
||||
************************************************************************/
|
||||
|
||||
Op(traced_table_trust_me, Otapl)
|
||||
{ printf("Or-parallelism not supported by JIT!!\n"); exit(1); }
|
||||
ENDOp();
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
** table_trust **
|
||||
************************************************************************/
|
||||
|
||||
Op(traced_table_trust, Otapl)
|
||||
{ printf("Or-parallelism not supported by JIT!!\n"); exit(1); }
|
||||
ENDOp();
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
** table_new_answer **
|
||||
************************************************************************/
|
||||
|
||||
PBOp(traced_table_new_answer, s)
|
||||
{ printf("Or-parallelism not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
** table_answer_resolution **
|
||||
************************************************************************/
|
||||
|
||||
BOp(traced_table_answer_resolution, Otapl)
|
||||
{ printf("Or-parallelism not supported by JIT!!\n"); exit(1); }
|
||||
ENDBOp();
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
** table_completion **
|
||||
************************************************************************/
|
||||
|
||||
BOp(traced_table_completion, Otapl)
|
||||
ENDBOp();
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
** table_answer_resolution_completion **
|
||||
************************************************************************/
|
||||
|
||||
BOp(traced_table_answer_resolution_completion, Otapl)
|
||||
#ifdef THREADS_CONSUMER_SHARING
|
||||
{ printf("Or-parallelism not supported by JIT!!\n"); exit(1); }
|
||||
#endif /* THREADS_CONSUMER_SHARING */
|
||||
ENDBOp();
|
|
@ -0,0 +1,370 @@
|
|||
/************************************************************************
|
||||
** **
|
||||
** The YapTab/YapOr/OPTYap systems **
|
||||
** **
|
||||
** YapTab extends the Yap Prolog engine to support sequential tabling **
|
||||
** YapOr extends the Yap Prolog engine to support or-parallelism **
|
||||
** OPTYap extends the Yap Prolog engine to support or-parallel tabling **
|
||||
** **
|
||||
** **
|
||||
** Yap Prolog was developed at University of Porto, Portugal **
|
||||
** **
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
** Trie instructions **
|
||||
************************************************************************/
|
||||
|
||||
PBOp(traced_trie_do_var, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_trust_var, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_try_var, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
|
||||
PBOp(traced_trie_retry_var, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_do_var_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_trust_var_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_try_var_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_retry_var_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_do_val, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_trust_val, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_try_val, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_retry_val, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_do_val_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_trust_val_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_try_val_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_retry_val_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_do_atom, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_trust_atom, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_try_atom, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_retry_atom, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_do_atom_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_trust_atom_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_try_atom_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_retry_atom_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_do_null, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_trust_null, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_try_null, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_retry_null, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_do_null_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_trust_null_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_try_null_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_retry_null_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_do_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_trust_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_try_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_retry_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_do_appl, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_trust_appl, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_try_appl, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_retry_appl, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_do_appl_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_trust_appl_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_try_appl_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_retry_appl_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_do_extension, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_trust_extension, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_try_extension, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_retry_extension, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_do_double, e)
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_stack = TOP_STACK;
|
||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||
volatile union {
|
||||
Float dbl;
|
||||
Term ts[SIZEOF_DOUBLE/SIZEOF_INT_P];
|
||||
} td;
|
||||
Term t;
|
||||
|
||||
#if SIZEOF_DOUBLE == 2 * SIZEOF_INT_P
|
||||
td.ts[0] = aux_stack[HEAP_ENTRY(1)];
|
||||
td.ts[1] = aux_stack[HEAP_ENTRY(3)]; /* jump the first extension mark */
|
||||
heap_arity -= 4;
|
||||
TOP_STACK = aux_stack = &aux_stack[4]; /* jump until the second extension mark */
|
||||
#else /* SIZEOF_DOUBLE == SIZEOF_INT_P */
|
||||
td.ts[0] = aux_stack[HEAP_ENTRY(1)];
|
||||
heap_arity -= 2;
|
||||
TOP_STACK = aux_stack = &aux_stack[2]; /* jump until the extension mark */
|
||||
#endif /* SIZEOF_DOUBLE x SIZEOF_INT_P */
|
||||
TOP_STACK[HEAP_ARITY_ENTRY] = heap_arity;
|
||||
t = MkFloatTerm(td.dbl);
|
||||
aux_stack_term_instr();
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
BOp(traced_trie_trust_double, e)
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "trie_trust_double: invalid instruction");
|
||||
ENDBOp();
|
||||
|
||||
|
||||
BOp(traced_trie_try_double, e)
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "trie_try_double: invalid instruction");
|
||||
ENDBOp();
|
||||
|
||||
|
||||
BOp(traced_trie_retry_double, e)
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "trie_retry_double: invalid instruction");
|
||||
ENDBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_do_longint, e)
|
||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||
register CELL *aux_stack = TOP_STACK;
|
||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||
Term t = MkLongIntTerm(aux_stack[HEAP_ENTRY(1)]);
|
||||
|
||||
heap_arity -= 2;
|
||||
TOP_STACK = aux_stack = &aux_stack[2]; /* jump until the extension mark */
|
||||
TOP_STACK[HEAP_ARITY_ENTRY] = heap_arity;
|
||||
aux_stack_term_instr();
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
BOp(traced_trie_trust_longint, e)
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "trie_trust_longint: invalid instruction");
|
||||
ENDBOp();
|
||||
|
||||
|
||||
BOp(traced_trie_try_longint, e)
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "traced_trie_try_longint: invalid instruction");
|
||||
ENDBOp();
|
||||
|
||||
|
||||
BOp(traced_trie_retry_longint, e)
|
||||
ENDBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_do_bigint, e)
|
||||
{ printf("Traced_Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
BOp(traced_trie_trust_bigint, e)
|
||||
ENDBOp();
|
||||
|
||||
|
||||
BOp(traced_trie_try_bigint, e)
|
||||
ENDBOp();
|
||||
|
||||
|
||||
BOp(traced_trie_retry_bigint, e)
|
||||
ENDBOp();
|
||||
|
||||
|
||||
|
||||
PBOp(traced_trie_do_gterm, e)
|
||||
|
||||
{ printf("Traced_Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_trust_gterm, e)
|
||||
{ printf("Traced_Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_try_gterm, e)
|
||||
{ printf("Traced_Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_retry_gterm, e)
|
||||
{ printf("Traced_Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
|
@ -4,20 +4,55 @@
|
|||
#define YAP_TERM_CONFIG 1
|
||||
|
||||
/* Define sizes of some basic types */
|
||||
#undef SIZEOF_INT_P
|
||||
#undef SIZEOF_INT
|
||||
#undef SIZEOF_SHORT_INT
|
||||
#undef SIZEOF_LONG_INT
|
||||
#undef SIZEOF_LONG_LONG_INT
|
||||
#undef SIZEOF_FLOAT
|
||||
#undef SIZEOF_DOUBLE
|
||||
#ifndef SIZEOF_INT_P
|
||||
#cmakedefine SIZEOF_INT_P ${SIZEOF_INT_P}
|
||||
#endif
|
||||
|
||||
/* The size of `int', as computed by sizeof. */
|
||||
#ifndef SIZEOF_INT
|
||||
#cmakedefine SIZEOF_INT ${SIZEOF_INT}
|
||||
#endif
|
||||
|
||||
/* The size of `short int', as computed by sizeof. */
|
||||
#ifndef SIZEOF_SHORT_INT
|
||||
#define SIZEOF_SHORT_INT ${SIZEOF_SHORT_INT}
|
||||
#endif
|
||||
|
||||
/* The size of `long int', as computed by sizeof. */
|
||||
#ifndef SIZEOF_LONG_INT
|
||||
#cmakedefine SIZEOF_LONG_INT ${SIZEOF_LONG_INT}
|
||||
#endif
|
||||
|
||||
/* The size of `long long', as computed by sizeof. */
|
||||
#ifndef SIZEOF_LONG_LONG
|
||||
#cmakedefine SIZEOF_LONG_LONG ${SIZEOF_LONG_LONG}
|
||||
#endif
|
||||
|
||||
/* The size of `float', as computed by sizeof. */
|
||||
#ifndef SIZEOF_FLOAT
|
||||
#cmakedefine SIZEOF_FLOAT ${SIZEOF_FLOAT}
|
||||
#endif
|
||||
|
||||
/* The size of `float', as computed by sizeof. */
|
||||
#ifndef SIZEOF_FLOAT
|
||||
#cmakedefine SIZEOF_FLOAT ${SIZEOF_FLOAT}
|
||||
#endif
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#ifndef HAVE_INTTYPES_H
|
||||
#undef HAVE_INTTYPES_H
|
||||
#cmakedefine HAVE_INTTYPES_H ${HAVE_INTTYPES_H}
|
||||
#endif
|
||||
|
||||
/* Define to 1 if you have the <stdbool.h> header file. */
|
||||
#ifndef HAVE_STDBOOL_H
|
||||
#cmakedefine HAVE_STDBOOL_H ${HAVE_STDBOOL_H}
|
||||
#endif
|
||||
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#ifndef HAVE_STDINT_H
|
||||
#undef HAVE_STDINT_H
|
||||
#cmakedefine HAVE_STDINT_H ${HAVE_STDINT_H}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,205 @@
|
|||
# - Find LLVM headers and libraries.
|
||||
# This module locates LLVM and adapts the llvm-config output for use with
|
||||
# CMake.
|
||||
#
|
||||
# A given list of COMPONENTS is passed to llvm-config.
|
||||
#
|
||||
# The following variables are defined:
|
||||
# LLVM_FOUND - true if LLVM was found
|
||||
# LLVM_CXXFLAGS - C++ compiler flags for files that include LLVM headers.
|
||||
# LLVM_HOST_TARGET - Target triple used to configure LLVM.
|
||||
# LLVM_INCLUDE_DIRS - Directory containing LLVM include files.
|
||||
# LLVM_LDFLAGS - Linker flags to add when linking against LLVM
|
||||
# (includes -LLLVM_LIBRARY_DIRS).
|
||||
# LLVM_LIBRARIES - Full paths to the library files to link against.
|
||||
# LLVM_LIBRARY_DIRS - Directory containing LLVM libraries.
|
||||
# LLVM_ROOT_DIR - The root directory of the LLVM installation.
|
||||
# llvm-config is searched for in ${LLVM_ROOT_DIR}/bin.
|
||||
# LLVM_VERSION_MAJOR - Major version of LLVM.
|
||||
# LLVM_VERSION_MINOR - Minor version of LLVM.
|
||||
# LLVM_VERSION_STRING - Full LLVM version string (e.g. 2.9).
|
||||
#
|
||||
# Note: The variable names were chosen in conformance with the offical CMake
|
||||
# guidelines, see ${CMAKE_ROOT}/Modules/readme.txt.
|
||||
|
||||
# Try suffixed versions to pick up the newest LLVM install available on Debian
|
||||
# derivatives.
|
||||
# We also want an user-specified LLVM_ROOT_DIR to take precedence over the
|
||||
# system default locations such as /usr/local/bin. Executing find_program()
|
||||
# multiples times is the approach recommended in the docs.
|
||||
set(llvm_config_names llvm-config-3.6 llvm-config36
|
||||
llvm-config-3.5 llvm-config35
|
||||
llvm-config-3.4 llvm-config34
|
||||
llvm-config-3.3 llvm-config33
|
||||
llvm-config-3.2 llvm-config32
|
||||
llvm-config-3.1 llvm-config31 llvm-config
|
||||
)
|
||||
|
||||
find_program(LLVM_CONFIG
|
||||
NAMES ${llvm_config_names}
|
||||
PATHS ${LLVM_ROOT_DIR}/bin NO_DEFAULT_PATH
|
||||
DOC "Path to llvm-config tool.")
|
||||
|
||||
IF(APPLE)
|
||||
set(llvm_config_paths
|
||||
/sw/bin
|
||||
/opt/local/bin
|
||||
/opt/bin
|
||||
/usr/local/opt/llvm/bin #brew
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
# mac oriented: avoid the default llvm (x-code)
|
||||
find_program(LLVM_CONFIG
|
||||
NAMES ${llvm_config_names}
|
||||
PATHS ${llvm_config_paths} NO_DEFAULT_PATH
|
||||
DOC "Path to llvm-config tool.")
|
||||
|
||||
ENDIF(APPLE)
|
||||
|
||||
find_program(LLVM_CONFIG NAMES ${llvm_config_names})
|
||||
|
||||
if ((WIN32 AND NOT(MINGW OR CYGWIN)) OR NOT LLVM_CONFIG)
|
||||
if (WIN32)
|
||||
# A bit of a sanity check:
|
||||
if( NOT EXISTS ${LLVM_ROOT_DIR}/include/llvm )
|
||||
message(FATAL_ERROR "LLVM_ROOT_DIR (${LLVM_ROOT_DIR}) is not a valid LLVM install")
|
||||
endif()
|
||||
# We incorporate the CMake features provided by LLVM:
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${LLVM_ROOT_DIR}/share/llvm/cmake")
|
||||
include(LLVMConfig)
|
||||
# Set properties
|
||||
set(LLVM_HOST_TARGET ${TARGET_TRIPLE})
|
||||
set(LLVM_VERSION_STRING ${LLVM_PACKAGE_VERSION})
|
||||
set(LLVM_CXXFLAGS ${LLVM_DEFINITIONS})
|
||||
set(LLVM_LDFLAGS "")
|
||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "all-targets" index)
|
||||
list(APPEND LLVM_FIND_COMPONENTS ${LLVM_TARGETS_TO_BUILD})
|
||||
# Work around LLVM bug 21016
|
||||
list(FIND LLVM_TARGETS_TO_BUILD "X86" TARGET_X86)
|
||||
if(TARGET_X86 GREATER -1)
|
||||
list(APPEND LLVM_FIND_COMPONENTS x86utils)
|
||||
endif()
|
||||
# Similar to the work around above, but for AArch64
|
||||
list(FIND LLVM_TARGETS_TO_BUILD "AArch64" TARGET_AArch64)
|
||||
if(TARGET_AArch64 GREATER -1)
|
||||
list(APPEND LLVM_FIND_COMPONENTS AArch64Utils)
|
||||
endif()
|
||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "backend" index)
|
||||
if(${LLVM_VERSION_STRING} MATCHES "^3\\.[0-2][\\.0-9A-Za-z]*")
|
||||
# Versions below 3.3 do not support components objcarcopts, option
|
||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "objcarcopts" index)
|
||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "option" index)
|
||||
endif()
|
||||
if(${LLVM_VERSION_STRING} MATCHES "^3\\.[0-4][\\.0-9A-Za-z]*")
|
||||
# Versions below 3.5 do not support components lto, profiledata
|
||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "lto" index)
|
||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "profiledata" index)
|
||||
endif()
|
||||
|
||||
if(${LLVM_VERSION_STRING} MATCHES "^3\\.[0-4][\\.0-9A-Za-z]*")
|
||||
llvm_map_components_to_libraries(tmplibs ${LLVM_FIND_COMPONENTS})
|
||||
else()
|
||||
llvm_map_components_to_libnames(tmplibs ${LLVM_FIND_COMPONENTS})
|
||||
endif()
|
||||
if(MSVC)
|
||||
foreach(lib ${tmplibs})
|
||||
list(APPEND LLVM_LIBRARIES "${LLVM_LIBRARY_DIRS}/${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
endforeach()
|
||||
else()
|
||||
# Rely on the library search path being set correctly via -L on
|
||||
# MinGW and others, as the library list returned by
|
||||
# llvm_map_components_to_libraries also includes imagehlp and psapi.
|
||||
set(LLVM_LDFLAGS "-L${LLVM_LIBRARY_DIRS}")
|
||||
set(LLVM_LIBRARIES ${tmplibs})
|
||||
endif()
|
||||
|
||||
# When using the CMake LLVM module, LLVM_DEFINITIONS is a list
|
||||
# instead of a string. Later, the list seperators would entirely
|
||||
# disappear, replace them by spaces instead. A better fix would be
|
||||
# to switch to add_definitions() instead of throwing strings around.
|
||||
string(REPLACE ";" " " LLVM_CXXFLAGS "${LLVM_CXXFLAGS}")
|
||||
else()
|
||||
if (NOT FIND_LLVM_QUIETLY)
|
||||
message(WARNING "Could not find llvm-config. Try manually setting LLVM_CONFIG to the llvm-config executable of the installation to use.")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
macro(llvm_set var flag)
|
||||
if(LLVM_FIND_QUIETLY)
|
||||
set(_quiet_arg ERROR_QUIET)
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND ${LLVM_CONFIG} --${flag}
|
||||
OUTPUT_VARIABLE LLVM_${var}
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
${_quiet_arg}
|
||||
)
|
||||
if(${ARGV2})
|
||||
file(TO_CMAKE_PATH "${LLVM_${var}}" LLVM_${var})
|
||||
endif()
|
||||
endmacro()
|
||||
macro(llvm_set_libs var flag prefix)
|
||||
if(LLVM_FIND_QUIETLY)
|
||||
set(_quiet_arg ERROR_QUIET)
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND ${LLVM_CONFIG} --${flag} ${LLVM_FIND_COMPONENTS}
|
||||
OUTPUT_VARIABLE tmplibs
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
${_quiet_arg}
|
||||
)
|
||||
file(TO_CMAKE_PATH "${tmplibs}" tmplibs)
|
||||
string(REGEX REPLACE "([$^.[|*+?()]|])" "\\\\\\1" pattern "${prefix}/")
|
||||
string(REGEX MATCHALL "${pattern}[^ ]+" LLVM_${var} ${tmplibs})
|
||||
endmacro()
|
||||
|
||||
llvm_set(VERSION_STRING version)
|
||||
llvm_set(CXXFLAGS cxxflags)
|
||||
llvm_set(HOST_TARGET host-target)
|
||||
llvm_set(INCLUDE_DIRS includedir true)
|
||||
llvm_set(ROOT_DIR prefix true)
|
||||
|
||||
if(${LLVM_VERSION_STRING} MATCHES "^3\\.[0-2][\\.0-9A-Za-z]*")
|
||||
# Versions below 3.3 do not support components objcarcopts, option
|
||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "objcarcopts" index)
|
||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "option" index)
|
||||
endif()
|
||||
if(${LLVM_VERSION_STRING} MATCHES "^3\\.[0-4][\\.0-9A-Za-z]*")
|
||||
# Versions below 3.5 do not support components lto, profiledata
|
||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "lto" index)
|
||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "profiledata" index)
|
||||
endif()
|
||||
|
||||
llvm_set(LDFLAGS ldflags)
|
||||
if(NOT ${LLVM_VERSION_STRING} MATCHES "^3\\.[0-4][\\.0-9A-Za-z]*")
|
||||
# In LLVM 3.5+, the system library dependencies (e.g. "-lz") are accessed
|
||||
# using the separate "--system-libs" flag.
|
||||
llvm_set(SYSTEM_LIBS system-libs)
|
||||
string(REPLACE "\n" " " LLVM_LDFLAGS "${LLVM_LDFLAGS} ${LLVM_SYSTEM_LIBS}")
|
||||
endif()
|
||||
llvm_set(LIBRARY_DIRS libdir true)
|
||||
llvm_set_libs(LIBRARIES libfiles "${LLVM_LIBRARY_DIRS}")
|
||||
endif()
|
||||
|
||||
# On CMake builds of LLVM, the output of llvm-config --cxxflags does not
|
||||
# include -fno-rtti, leading to linker errors. Be sure to add it.
|
||||
if(CMAKE_COMPILER_IS_GNUCXX OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"))
|
||||
if(NOT ${LLVM_CXXFLAGS} MATCHES "-fno-rtti")
|
||||
set(LLVM_CXXFLAGS "${LLVM_CXXFLAGS} -fno-rtti")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
string(REGEX REPLACE "([0-9]+).*" "\\1" LLVM_VERSION_MAJOR "${LLVM_VERSION_STRING}" )
|
||||
string(REGEX REPLACE "[0-9]+\\.([0-9]+).*[A-Za-z]*" "\\1" LLVM_VERSION_MINOR "${LLVM_VERSION_STRING}" )
|
||||
|
||||
# Use the default CMake facilities for handling QUIET/REQUIRED.
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
if(${CMAKE_VERSION} VERSION_LESS "2.8.4")
|
||||
# The VERSION_VAR argument is not supported on pre-2.8.4, work around this.
|
||||
set(VERSION_VAR dummy)
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args(LLVM
|
||||
REQUIRED_VARS LLVM_ROOT_DIR LLVM_HOST_TARGET
|
||||
VERSION_VAR LLVM_VERSION_STRING)
|
|
@ -1,18 +0,0 @@
|
|||
#CHECK: DOXYGEN
|
||||
macro_optional_find_package (Doxygen ON)
|
||||
macro_log_feature (DOXYGEN_FOUND "Doxygen"
|
||||
"Use DOXYGEN Documentation System "
|
||||
"http://www.doxygen.org" FALSE)
|
||||
if (DOXYGEN_FOUND)
|
||||
#
|
||||
# DOXYGEN_EXECUTABLE = The path to the doxygen command.
|
||||
# DOXYGEN_FOUND = Was Doxygen found or not?
|
||||
# DOXYGEN_VERSION = The version reported by doxygen --version
|
||||
#
|
||||
#
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# DOXYGEN_DOT_EXECUTABLE = The path to the dot program used by doxygen.
|
||||
# DOXYGEN_DOT_FOUND = Was Dot found or not?
|
||||
endif (DOXYGEN_FOUND)
|
|
@ -359,6 +359,7 @@ DISTRIBUTE_GROUP_DOC = NO
|
|||
# \nosubgrouping command.
|
||||
# The default value is: YES.
|
||||
|
||||
|
||||
SUBGROUPING = YES
|
||||
|
||||
# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
|
||||
|
@ -370,7 +371,7 @@ SUBGROUPING = YES
|
|||
# SEPARATE_MEMBER_PAGES.
|
||||
# The default value is: NO.
|
||||
|
||||
INLINE_GROUPED_CLASSES = NO
|
||||
INLINE_GROUPED_CLASSES = YES
|
||||
|
||||
# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
|
||||
# with only public data fields or simple typedef fields will be shown inline in
|
||||
|
@ -380,7 +381,7 @@ INLINE_GROUPED_CLASSES = NO
|
|||
# Man pages) or section (for LaTeX and RTF).
|
||||
# The default value is: NO.
|
||||
|
||||
INLINE_SIMPLE_STRUCTS = NO
|
||||
INLINE_SIMPLE_STRUCTS = YES
|
||||
|
||||
# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
|
||||
# enum is documented as struct, union, or enum with the name of the typedef. So
|
||||
|
@ -484,7 +485,7 @@ HIDE_UNDOC_CLASSES = NO
|
|||
# included in the documentation.
|
||||
# The default value is: NO.
|
||||
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_FRIEND_COMPOUNDS = YES
|
||||
|
||||
# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
|
||||
# documentation blocks found inside the body of a function. If set to NO these
|
||||
|
|
|
@ -13,12 +13,43 @@
|
|||
* comments: Data structures and defines used in the Interface *
|
||||
* *
|
||||
*************************************************************************/
|
||||
|
||||
#ifndef _YAPDEFS_H
|
||||
|
||||
#define _YAPDEFS_H 1
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
/* The YAP main types */
|
||||
#include "YapTerm.h"
|
||||
|
||||
/* truth-values */
|
||||
/* stdbool defines the booleam type, bool,
|
||||
and the constants false and true */
|
||||
#if HAVE_STDBOOL_H
|
||||
#include <stdbool.h>
|
||||
#else
|
||||
#ifndef true
|
||||
typedef int _Bool;
|
||||
|
||||
#define bool _Bool;
|
||||
|
||||
#define false 0
|
||||
#define true 1
|
||||
#endif
|
||||
#endif /* HAVE_STDBOOL_H */
|
||||
|
||||
/**
|
||||
FALSE and TRUE are the pre-standard versions,
|
||||
still widely used.
|
||||
*/
|
||||
#ifndef TRUE
|
||||
#define TRUE true
|
||||
#endif
|
||||
#ifndef FALSE
|
||||
#define FALSE false
|
||||
#endif
|
||||
|
||||
#ifdef YAP_H
|
||||
|
||||
/* if Yap.h is available, just reexport */
|
||||
|
@ -27,9 +58,9 @@
|
|||
|
||||
#define YAP_Term Term
|
||||
|
||||
typedef UInt YAP_Arity;
|
||||
#define YAP_Arity arity_t
|
||||
|
||||
typedef Term YAP_Module;
|
||||
#define YAP_Module Term
|
||||
|
||||
#define YAP_Functor Functor
|
||||
|
||||
|
@ -41,9 +72,9 @@ typedef Term YAP_Module;
|
|||
|
||||
#define YAP_Float Float
|
||||
|
||||
typedef int YAP_Bool;
|
||||
#define YAP_Bool bool
|
||||
|
||||
typedef yhandle_t YAP_handle_t;
|
||||
#define YAP_handle_t yhandle_t
|
||||
|
||||
#define YAP_PredEntryPtr struct pred_entry *
|
||||
|
||||
|
@ -58,10 +89,10 @@ typedef yhandle_t YAP_handle_t;
|
|||
#if _WIN64
|
||||
typedef unsigned long long YAP_CELL;
|
||||
#else
|
||||
typedef unsigned long YAP_CELL;
|
||||
typedef uintptr_t YAP_CELL;
|
||||
#endif
|
||||
|
||||
typedef int YAP_Bool;
|
||||
typedef bool YAP_Bool;
|
||||
|
||||
typedef YAP_CELL YAP_Term;
|
||||
|
||||
|
|
|
@ -23,6 +23,9 @@ typedef enum
|
|||
FATAL_ERROR,
|
||||
INTERNAL_ERROR,
|
||||
INTERNAL_COMPILER_ERROR,
|
||||
#if !YAP_JIT
|
||||
NOJIT_ERROR, /* I added */
|
||||
#endif
|
||||
PURE_ABORT,
|
||||
CALL_COUNTER_UNDERFLOW,
|
||||
/* ISO_ERRORS */
|
||||
|
@ -59,10 +62,14 @@ typedef enum
|
|||
EXISTENCE_ERROR_SOURCE_SINK,
|
||||
EXISTENCE_ERROR_STREAM,
|
||||
EXISTENCE_ERROR_VARIABLE,
|
||||
INCOMPATIBLEMODE_WARNING, /* I added */
|
||||
INCOMPATIBLE_CODEMODE_WARNING, /* I added */
|
||||
INSTANTIATION_ERROR,
|
||||
INTERRUPT_ERROR,
|
||||
INVALID_PARAMETER_TYPE_ERROR, /* I added */
|
||||
OPERATING_SYSTEM_ERROR,
|
||||
OUT_OF_HEAP_ERROR,
|
||||
OUT_OF_KNOWNRANGE_ERROR, /* I added */
|
||||
OUT_OF_STACK_ERROR,
|
||||
OUT_OF_TRAIL_ERROR,
|
||||
OUT_OF_ATTVARS_ERROR,
|
||||
|
@ -126,6 +133,7 @@ typedef enum
|
|||
UNKNOWN_ERROR
|
||||
} yap_error_number;
|
||||
|
||||
|
||||
#define JMP_LOCAL_ERROR(v, LAB) \
|
||||
if (H + 2*(v) > ASP-1024) { \
|
||||
LOCAL_Error_TYPE = OUT_OF_STACK_ERROR;\
|
||||
|
|
|
@ -32,54 +32,54 @@ typedef struct {
|
|||
/* -------------------------- */
|
||||
|
||||
void init_tries(void);
|
||||
static int p_trie_open(void);
|
||||
static int p_trie_close(void);
|
||||
static int p_trie_close_all(void);
|
||||
static int p_trie_mode(void);
|
||||
static int p_trie_put_entry(void);
|
||||
static int p_trie_check_entry(void);
|
||||
static int p_trie_get_entry(void);
|
||||
static int p_trie_get_first_entry(void);
|
||||
static int p_trie_get_last_entry(void);
|
||||
static int p_trie_traverse_init(void);
|
||||
static int p_trie_traverse_cont(void);
|
||||
static int p_trie_remove_entry(void);
|
||||
static int p_trie_remove_subtree(void);
|
||||
static int p_trie_join(void);
|
||||
static int p_trie_intersect(void);
|
||||
static int p_trie_count_join(void);
|
||||
static int p_trie_count_intersect(void);
|
||||
static int p_trie_save(void);
|
||||
static int p_trie_load(void);
|
||||
static int p_trie_stats(void);
|
||||
static int p_trie_max_stats(void);
|
||||
static int p_trie_usage(void);
|
||||
static int p_trie_print(void);
|
||||
static YAP_Bool p_trie_open(void);
|
||||
static YAP_Bool p_trie_close(void);
|
||||
static YAP_Bool p_trie_close_all(void);
|
||||
static YAP_Bool p_trie_mode(void);
|
||||
static YAP_Bool p_trie_put_entry(void);
|
||||
static YAP_Bool p_trie_check_entry(void);
|
||||
static YAP_Bool p_trie_get_entry(void);
|
||||
static YAP_Bool p_trie_get_first_entry(void);
|
||||
static YAP_Bool p_trie_get_last_entry(void);
|
||||
static YAP_Bool p_trie_traverse_init(void);
|
||||
static YAP_Bool p_trie_traverse_cont(void);
|
||||
static YAP_Bool p_trie_remove_entry(void);
|
||||
static YAP_Bool p_trie_remove_subtree(void);
|
||||
static YAP_Bool p_trie_join(void);
|
||||
static YAP_Bool p_trie_intersect(void);
|
||||
static YAP_Bool p_trie_count_join(void);
|
||||
static YAP_Bool p_trie_count_intersect(void);
|
||||
static YAP_Bool p_trie_save(void);
|
||||
static YAP_Bool p_trie_load(void);
|
||||
static YAP_Bool p_trie_stats(void);
|
||||
static YAP_Bool p_trie_max_stats(void);
|
||||
static YAP_Bool p_trie_usage(void);
|
||||
static YAP_Bool p_trie_print(void);
|
||||
|
||||
static int p_trie_traverse_mode(void);
|
||||
static int p_trie_disable_hash(void);
|
||||
static int p_trie_enable_hash(void);
|
||||
static int p_trie_traverse_first(void);
|
||||
static int p_trie_traverse_next(void);
|
||||
static YAP_Bool p_trie_traverse_mode(void);
|
||||
static YAP_Bool p_trie_disable_hash(void);
|
||||
static YAP_Bool p_trie_enable_hash(void);
|
||||
static YAP_Bool p_trie_traverse_first(void);
|
||||
static YAP_Bool p_trie_traverse_next(void);
|
||||
|
||||
static int p_trie_to_list(void);
|
||||
static YAP_Bool p_trie_to_list(void);
|
||||
|
||||
/* dbtries support */
|
||||
static int p_trie_depth_breadth(void);
|
||||
static int p_trie_get_depth_breadth_reduction_current_data(void);
|
||||
static int p_trie_get_db_opt_level_count_init(void);
|
||||
static int p_trie_get_db_opt_level_count_cont(void);
|
||||
static int p_trie_replace_nested_trie(void);
|
||||
static int p_trie_db_opt_min_prefix(void);
|
||||
static YAP_Bool p_trie_depth_breadth(void);
|
||||
static YAP_Bool p_trie_get_depth_breadth_reduction_current_data(void);
|
||||
static YAP_Bool p_trie_get_db_opt_level_count_init(void);
|
||||
static YAP_Bool p_trie_get_db_opt_level_count_cont(void);
|
||||
static YAP_Bool p_trie_replace_nested_trie(void);
|
||||
static YAP_Bool p_trie_db_opt_min_prefix(void);
|
||||
|
||||
/* backwards compatibility */
|
||||
static int p_open_trie(void);
|
||||
static int p_close_trie(void);
|
||||
static int p_close_all_tries(void);
|
||||
static int p_put_trie_entry(void);
|
||||
static int p_get_trie_entry(void);
|
||||
static int p_remove_trie_entry(void);
|
||||
static int p_print_trie(void);
|
||||
static YAP_Bool p_open_trie(void);
|
||||
static YAP_Bool p_close_trie(void);
|
||||
static YAP_Bool p_close_all_tries(void);
|
||||
static YAP_Bool p_put_trie_entry(void);
|
||||
static YAP_Bool p_get_trie_entry(void);
|
||||
static YAP_Bool p_remove_trie_entry(void);
|
||||
static YAP_Bool p_print_trie(void);
|
||||
|
||||
|
||||
|
||||
|
@ -146,19 +146,19 @@ void init_tries(void) {
|
|||
/* --------------------------------- */
|
||||
|
||||
/* open_trie(-Trie) */
|
||||
static int p_open_trie(void) {
|
||||
static YAP_Bool p_open_trie(void) {
|
||||
return p_trie_open();
|
||||
}
|
||||
|
||||
|
||||
/* close_trie(+Trie) */
|
||||
static int p_close_trie(void) {
|
||||
static YAP_Bool p_close_trie(void) {
|
||||
return p_trie_close();
|
||||
}
|
||||
|
||||
|
||||
/* close_all_tries() */
|
||||
static int p_close_all_tries(void) {
|
||||
static YAP_Bool p_close_all_tries(void) {
|
||||
return p_trie_close_all();
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ static int p_close_all_tries(void) {
|
|||
#define arg_trie YAP_ARG2
|
||||
#define arg_entry YAP_ARG3
|
||||
#define arg_ref YAP_ARG4
|
||||
static int p_put_trie_entry(void) {
|
||||
static YAP_Bool p_put_trie_entry(void) {
|
||||
TrData data;
|
||||
const char *mode_str;
|
||||
YAP_Int mode, current_mode;
|
||||
|
@ -201,7 +201,7 @@ static int p_put_trie_entry(void) {
|
|||
#define arg_mode YAP_ARG1
|
||||
#define arg_ref YAP_ARG2
|
||||
#define arg_entry YAP_ARG3
|
||||
static int p_get_trie_entry(void) {
|
||||
static YAP_Bool p_get_trie_entry(void) {
|
||||
YAP_Term entry;
|
||||
const char *mode_str;
|
||||
YAP_Int mode, current_mode;
|
||||
|
@ -230,13 +230,13 @@ static int p_get_trie_entry(void) {
|
|||
|
||||
|
||||
/* remove_trie_entry(+Ref) */
|
||||
static int p_remove_trie_entry(void) {
|
||||
static YAP_Bool p_remove_trie_entry(void) {
|
||||
return p_trie_remove_entry();
|
||||
}
|
||||
|
||||
|
||||
/* print_trie(+Trie) */
|
||||
static int p_print_trie(void) {
|
||||
static YAP_Bool p_print_trie(void) {
|
||||
return p_trie_print();
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,7 @@ static int p_print_trie(void) {
|
|||
|
||||
/* trie_open(-Trie) */
|
||||
#define arg_trie YAP_ARG1
|
||||
static int p_trie_open(void) {
|
||||
static YAP_Bool p_trie_open(void) {
|
||||
TrEntry trie;
|
||||
|
||||
/* check arg */
|
||||
|
@ -264,7 +264,7 @@ static int p_trie_open(void) {
|
|||
|
||||
/* trie_close(+Trie) */
|
||||
#define arg_trie YAP_ARG1
|
||||
static int p_trie_close(void) {
|
||||
static YAP_Bool p_trie_close(void) {
|
||||
/* check arg */
|
||||
if (!YAP_IsIntTerm(arg_trie))
|
||||
return FALSE;
|
||||
|
@ -277,7 +277,7 @@ static int p_trie_close(void) {
|
|||
|
||||
|
||||
/* trie_close_all() */
|
||||
static int p_trie_close_all(void) {
|
||||
static YAP_Bool p_trie_close_all(void) {
|
||||
trie_close_all();
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ static int p_trie_close_all(void) {
|
|||
|
||||
/* trie_mode(?Mode) */
|
||||
#define arg_mode YAP_ARG1
|
||||
static int p_trie_mode(void) {
|
||||
static YAP_Bool p_trie_mode(void) {
|
||||
YAP_Term mode_term;
|
||||
const char *mode_str;
|
||||
YAP_Int mode;
|
||||
|
@ -320,7 +320,7 @@ static int p_trie_mode(void) {
|
|||
#define arg_trie YAP_ARG1
|
||||
#define arg_entry YAP_ARG2
|
||||
#define arg_ref YAP_ARG3
|
||||
static int p_trie_put_entry(void) {
|
||||
static YAP_Bool p_trie_put_entry(void) {
|
||||
TrData data;
|
||||
|
||||
/* check args */
|
||||
|
@ -340,7 +340,7 @@ static int p_trie_put_entry(void) {
|
|||
#define arg_trie YAP_ARG1
|
||||
#define arg_entry YAP_ARG2
|
||||
#define arg_ref YAP_ARG3
|
||||
static int p_trie_check_entry(void) {
|
||||
static YAP_Bool p_trie_check_entry(void) {
|
||||
TrData data;
|
||||
|
||||
/* check args */
|
||||
|
@ -360,7 +360,7 @@ static int p_trie_check_entry(void) {
|
|||
/* trie_get_entry(+Ref,-Entry) */
|
||||
#define arg_ref YAP_ARG1
|
||||
#define arg_entry YAP_ARG2
|
||||
static int p_trie_get_entry(void) {
|
||||
static YAP_Bool p_trie_get_entry(void) {
|
||||
YAP_Term entry;
|
||||
|
||||
/* check args */
|
||||
|
@ -378,7 +378,7 @@ static int p_trie_get_entry(void) {
|
|||
/* trie_get_first_entry(+Trie,-Ref) */
|
||||
#define arg_trie YAP_ARG1
|
||||
#define arg_ref YAP_ARG2
|
||||
static int p_trie_get_first_entry(void) {
|
||||
static YAP_Bool p_trie_get_first_entry(void) {
|
||||
TrData data;
|
||||
|
||||
/* check args */
|
||||
|
@ -397,7 +397,7 @@ static int p_trie_get_first_entry(void) {
|
|||
/* trie_get_last_entry(+Trie,-Ref) */
|
||||
#define arg_trie YAP_ARG1
|
||||
#define arg_ref YAP_ARG2
|
||||
static int p_trie_get_last_entry(void) {
|
||||
static YAP_Bool p_trie_get_last_entry(void) {
|
||||
TrData data;
|
||||
|
||||
/* check args */
|
||||
|
@ -417,7 +417,7 @@ static int p_trie_get_last_entry(void) {
|
|||
#define arg_trie YAP_ARG1
|
||||
#define arg_init_ref YAP_ARG2
|
||||
#define arg_ref YAP_ARG3
|
||||
static int p_trie_traverse_init(void) {
|
||||
static YAP_Bool p_trie_traverse_init(void) {
|
||||
TrData data;
|
||||
|
||||
/* check args */
|
||||
|
@ -442,7 +442,7 @@ static int p_trie_traverse_init(void) {
|
|||
#define arg_trie YAP_ARG1
|
||||
#define arg_init_ref YAP_ARG2
|
||||
#define arg_ref YAP_ARG3
|
||||
static int p_trie_traverse_cont(void) {
|
||||
static YAP_Bool p_trie_traverse_cont(void) {
|
||||
TrData data;
|
||||
|
||||
/* traverse trie */
|
||||
|
@ -459,7 +459,7 @@ static int p_trie_traverse_cont(void) {
|
|||
|
||||
/* trie_remove_entry(+Ref) */
|
||||
#define arg_ref YAP_ARG1
|
||||
static int p_trie_remove_entry(void) {
|
||||
static YAP_Bool p_trie_remove_entry(void) {
|
||||
/* check arg */
|
||||
if (!YAP_IsIntTerm(arg_ref))
|
||||
return FALSE;
|
||||
|
@ -473,7 +473,7 @@ static int p_trie_remove_entry(void) {
|
|||
|
||||
/* trie_remove_subtree(+Ref) */
|
||||
#define arg_ref YAP_ARG1
|
||||
static int p_trie_remove_subtree(void) {
|
||||
static YAP_Bool p_trie_remove_subtree(void) {
|
||||
/* check arg */
|
||||
if (!YAP_IsIntTerm(arg_ref))
|
||||
return FALSE;
|
||||
|
@ -488,7 +488,7 @@ static int p_trie_remove_subtree(void) {
|
|||
/* trie_join(+TrieDest,+TrieSource) */
|
||||
#define arg_trie_dest YAP_ARG1
|
||||
#define arg_trie_source YAP_ARG2
|
||||
static int p_trie_join(void) {
|
||||
static YAP_Bool p_trie_join(void) {
|
||||
/* check args */
|
||||
if (!YAP_IsIntTerm(arg_trie_dest))
|
||||
return FALSE;
|
||||
|
@ -506,7 +506,7 @@ static int p_trie_join(void) {
|
|||
/* trie_intersect(+TrieDest,+TrieSource) */
|
||||
#define arg_trie_dest YAP_ARG1
|
||||
#define arg_trie_source YAP_ARG2
|
||||
static int p_trie_intersect(void) {
|
||||
static YAP_Bool p_trie_intersect(void) {
|
||||
/* check args */
|
||||
if (!YAP_IsIntTerm(arg_trie_dest))
|
||||
return FALSE;
|
||||
|
@ -525,7 +525,7 @@ static int p_trie_intersect(void) {
|
|||
#define arg_trie1 YAP_ARG1
|
||||
#define arg_trie2 YAP_ARG2
|
||||
#define arg_entries YAP_ARG3
|
||||
static int p_trie_count_join(void) {
|
||||
static YAP_Bool p_trie_count_join(void) {
|
||||
YAP_Int entries;
|
||||
|
||||
/* check args */
|
||||
|
@ -547,7 +547,7 @@ static int p_trie_count_join(void) {
|
|||
#define arg_trie1 YAP_ARG1
|
||||
#define arg_trie2 YAP_ARG2
|
||||
#define arg_entries YAP_ARG3
|
||||
static int p_trie_count_intersect(void) {
|
||||
static YAP_Bool p_trie_count_intersect(void) {
|
||||
YAP_Int entries;
|
||||
|
||||
/* check args */
|
||||
|
@ -568,7 +568,7 @@ static int p_trie_count_intersect(void) {
|
|||
/* trie_save(+Trie,+FileName) */
|
||||
#define arg_trie YAP_ARG1
|
||||
#define arg_file YAP_ARG2
|
||||
static int p_trie_save(void) {
|
||||
static YAP_Bool p_trie_save(void) {
|
||||
const char *file_str;
|
||||
FILE *file;
|
||||
|
||||
|
@ -596,7 +596,7 @@ static int p_trie_save(void) {
|
|||
/* trie_load(-Trie,+FileName) */
|
||||
#define arg_trie YAP_ARG1
|
||||
#define arg_file YAP_ARG2
|
||||
static int p_trie_load(void) {
|
||||
static YAP_Bool p_trie_load(void) {
|
||||
TrEntry data;
|
||||
const char *file_str;
|
||||
FILE *file;
|
||||
|
@ -628,7 +628,7 @@ static int p_trie_load(void) {
|
|||
#define arg_tries YAP_ARG2
|
||||
#define arg_entries YAP_ARG3
|
||||
#define arg_nodes YAP_ARG4
|
||||
static int p_trie_stats(void) {
|
||||
static YAP_Bool p_trie_stats(void) {
|
||||
YAP_Int memory, tries, entries, nodes;
|
||||
|
||||
/* get stats */
|
||||
|
@ -654,7 +654,7 @@ static int p_trie_stats(void) {
|
|||
#define arg_tries YAP_ARG2
|
||||
#define arg_entries YAP_ARG3
|
||||
#define arg_nodes YAP_ARG4
|
||||
static int p_trie_max_stats(void) {
|
||||
static YAP_Bool p_trie_max_stats(void) {
|
||||
YAP_Int memory, tries, entries, nodes;
|
||||
|
||||
/* get stats */
|
||||
|
@ -680,7 +680,7 @@ static int p_trie_max_stats(void) {
|
|||
#define arg_entries YAP_ARG2
|
||||
#define arg_nodes YAP_ARG3
|
||||
#define arg_virtualnodes YAP_ARG4
|
||||
static int p_trie_usage(void) {
|
||||
static YAP_Bool p_trie_usage(void) {
|
||||
YAP_Int entries, nodes, virtualnodes;
|
||||
|
||||
/* check arg */
|
||||
|
@ -705,7 +705,7 @@ static int p_trie_usage(void) {
|
|||
|
||||
/* trie_print(+Trie) */
|
||||
#define arg_trie YAP_ARG1
|
||||
static int p_trie_print(void) {
|
||||
static YAP_Bool p_trie_print(void) {
|
||||
/* check arg */
|
||||
if (!YAP_IsIntTerm(arg_trie))
|
||||
return FALSE;
|
||||
|
@ -719,7 +719,7 @@ static int p_trie_print(void) {
|
|||
|
||||
/* trie_traverse_mode(?Mode) */
|
||||
#define arg_mode YAP_ARG1
|
||||
static int p_trie_traverse_mode(void) {
|
||||
static YAP_Bool p_trie_traverse_mode(void) {
|
||||
YAP_Term mode_term;
|
||||
const char *mode_str;
|
||||
YAP_Int mode;
|
||||
|
@ -753,7 +753,7 @@ static int p_trie_traverse_mode(void) {
|
|||
/* trie_traverse_first(+Trie, -Ref) */
|
||||
#define arg_trie YAP_ARG1
|
||||
#define arg_ref YAP_ARG2
|
||||
static int p_trie_traverse_first(void) {
|
||||
static YAP_Bool p_trie_traverse_first(void) {
|
||||
TrData data;
|
||||
|
||||
/* check arg */
|
||||
|
@ -773,7 +773,7 @@ static int p_trie_traverse_first(void) {
|
|||
/* trie_traverse_next(+Ref, -Ref) */
|
||||
#define arg_cur YAP_ARG1
|
||||
#define arg_next YAP_ARG2
|
||||
static int p_trie_traverse_next(void) {
|
||||
static YAP_Bool p_trie_traverse_next(void) {
|
||||
TrData data;
|
||||
|
||||
/* check arg */
|
||||
|
@ -791,14 +791,14 @@ static int p_trie_traverse_next(void) {
|
|||
|
||||
|
||||
/* trie_disable_hash */
|
||||
static int p_trie_disable_hash(void) {
|
||||
static YAP_Bool p_trie_disable_hash(void) {
|
||||
trie_disable_hash_table();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* trie_enable_hash */
|
||||
static int p_trie_enable_hash(void) {
|
||||
static YAP_Bool p_trie_enable_hash(void) {
|
||||
trie_enable_hash_table();
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -807,7 +807,7 @@ static int p_trie_enable_hash(void) {
|
|||
/* trie_to_list(+Trie, -List) */
|
||||
#define arg_trie YAP_ARG1
|
||||
#define arg_list YAP_ARG2
|
||||
static int p_trie_to_list(void) {
|
||||
static YAP_Bool p_trie_to_list(void) {
|
||||
YAP_Term list;
|
||||
|
||||
/* check arg */
|
||||
|
@ -829,7 +829,7 @@ static int p_trie_to_list(void) {
|
|||
#define arg_opt_level YAP_ARG4
|
||||
#define arg_start_counter YAP_ARG5
|
||||
#define arg_end_counter YAP_ARG6
|
||||
static int p_trie_depth_breadth(void) {
|
||||
static YAP_Bool p_trie_depth_breadth(void) {
|
||||
/* get depth breadth trie */
|
||||
if (!YAP_IsIntTerm(arg_opt_level))
|
||||
return FALSE;
|
||||
|
@ -851,7 +851,7 @@ static int p_trie_depth_breadth(void) {
|
|||
|
||||
/* trie_get_depth_breadth_reduction_entry(-Entry) */
|
||||
#define arg_entry YAP_ARG1
|
||||
static int p_trie_get_depth_breadth_reduction_current_data(void) {
|
||||
static YAP_Bool p_trie_get_depth_breadth_reduction_current_data(void) {
|
||||
TrData data = trie_get_depth_breadth_reduction_current_data();
|
||||
if (data)
|
||||
return YAP_Unify(arg_entry, YAP_MkIntTerm((YAP_Int) data));
|
||||
|
@ -865,7 +865,7 @@ db_trie_opt_level *opt_level;
|
|||
/* trie_get_depth_breadth_reduction_opt_level_count(?OptLevel, -Count) */
|
||||
#define arg_opt_level YAP_ARG1
|
||||
#define arg_count YAP_ARG2
|
||||
static int p_trie_get_db_opt_level_count_init(void) {
|
||||
static YAP_Bool p_trie_get_db_opt_level_count_init(void) {
|
||||
if (YAP_IsIntTerm(arg_opt_level)) {
|
||||
if (YAP_IntOfTerm(arg_opt_level) > 0 && YAP_IntOfTerm(arg_opt_level) < 4) {
|
||||
if (YAP_Unify(arg_count, YAP_MkIntTerm(trie_get_db_opt_level_count(YAP_IntOfTerm(arg_opt_level))))) {
|
||||
|
@ -899,7 +899,7 @@ static int p_trie_get_db_opt_level_count_init(void) {
|
|||
/* trie_get_depth_breadth_reduction_opt_level_count(?OptLevel, -Count) */
|
||||
#define arg_opt_level YAP_ARG1
|
||||
#define arg_count YAP_ARG2
|
||||
static int p_trie_get_db_opt_level_count_cont(void) {
|
||||
static YAP_Bool p_trie_get_db_opt_level_count_cont(void) {
|
||||
YAP_PRESERVED_DATA(opt_level, db_trie_opt_level);
|
||||
opt_level->value = YAP_MkIntTerm(YAP_IntOfTerm(opt_level->value) + 1);
|
||||
if (YAP_IntOfTerm(opt_level->value) < 4) {
|
||||
|
@ -920,7 +920,7 @@ static int p_trie_get_db_opt_level_count_cont(void) {
|
|||
#define arg_trie YAP_ARG1
|
||||
#define arg_nested_id YAP_ARG2
|
||||
#define arg_term YAP_ARG3
|
||||
static int p_trie_replace_nested_trie(void) {
|
||||
static YAP_Bool p_trie_replace_nested_trie(void) {
|
||||
if (!YAP_IsIntTerm(arg_nested_id))
|
||||
return FALSE;
|
||||
if (!YAP_IsNonVarTerm(arg_term))
|
||||
|
@ -935,7 +935,7 @@ static int p_trie_replace_nested_trie(void) {
|
|||
|
||||
/* trie_db_opt_min_prefix(?MinPrefix) */
|
||||
#define arg_min_prefix YAP_ARG1
|
||||
static int p_trie_db_opt_min_prefix(void) {
|
||||
static YAP_Bool p_trie_db_opt_min_prefix(void) {
|
||||
YAP_Int min_prefix;
|
||||
|
||||
/* get mode */
|
||||
|
|
|
@ -157,11 +157,7 @@ ADDR TrailBase void
|
|||
ADDR TrailTop void
|
||||
char* ErrorMessage void
|
||||
Term Error_Term void
|
||||
#ifdef THREADS
|
||||
Term Error_TYPE void
|
||||
#else
|
||||
yap_error_number Error_TYPE void
|
||||
#endif
|
||||
UInt Error_Size void
|
||||
char ErrorSay[MAX_ERROR_MSG_SIZE] void
|
||||
jmp_buf IOBotch void
|
||||
|
|
|
@ -38,15 +38,26 @@ main :-
|
|||
header_find_clause(F),
|
||||
header_find_clause(H),
|
||||
header_save_clause(S),
|
||||
file('C/absmi.c', W, C, L, F, H, S),
|
||||
file('C/absmi_insts.h', W, C, L, F, H, S),
|
||||
start_ifdef("YAPOR", W, C, L, F, H, S),
|
||||
file('OPTYap/or.insts.i',W, C, L, F, H, S),
|
||||
file('OPTYap/or.insts.h',W, C, L, F, H, S),
|
||||
end_ifdef(W, C, L, F, H, S),
|
||||
start_ifdef("TABLING", W, C, L, F, H, S),
|
||||
file('OPTYap/tab.insts.i',W,C,L, F, H, S),
|
||||
file('OPTYap/tab.insts.h',W,C,L, F, H, S),
|
||||
retractall(op(_,_)),
|
||||
file('OPTYap/tab.tries.insts.i', W, C, L, F, H, S),
|
||||
file('OPTYap/tab.tries.insts.h', W, C, L, F, H, S),
|
||||
end_ifdef(W, C, L, F, H, S),
|
||||
start_ifdef("YAP_JIT", W, C, L, F, H, S),
|
||||
file('C/traced_absmi_insts.h', W, C, L, F, H, S),
|
||||
start_ifdef("YAPOR", W, C, L, F, H, S),
|
||||
file('OPTYap/traced_or.insts.h',W, C, L, F, H, S),
|
||||
end_ifdef(W, C, L, F, H, S),
|
||||
start_ifdef("TABLING", W, C, L, F, H, S),
|
||||
file('OPTYap/traced_tab.insts.h',W,C,L, F, H, S),
|
||||
retractall(op(_,_)),
|
||||
file('OPTYap/traced_tab.tries.insts.h', W, C, L, F, H, S),
|
||||
end_ifdef(W, C, L, F, H, S),
|
||||
end_ifdef(W, C, L, F, H, S),
|
||||
footer(W),
|
||||
footer_rclause(C),
|
||||
footer_walk_clause(L),
|
||||
|
@ -139,14 +150,28 @@ file(I,W,C,L,F,H, S) :-
|
|||
output_save_clause(S).
|
||||
|
||||
grep_opcode(W, Line) :-
|
||||
%format('~s~n', [Line]),
|
||||
split(Line," ,();",[OP,Name,Type]),
|
||||
Name \= "or_last",
|
||||
check_op(OP),
|
||||
Name \= "or_last", Name \= "traced_or_last",
|
||||
check_op(OP), !,
|
||||
special(Name,W),
|
||||
assert(op(Type,Name)),
|
||||
format(W,' OPCODE(~s~36+,~s),~n',[Name,Type]),
|
||||
end_special(Name,W).
|
||||
grep_opcode(W, Line) :-
|
||||
split(Line,"# \"<>",["include",File]),
|
||||
atom_codes(AFile, File),
|
||||
atomic_concat('C/',AFile,NFile),
|
||||
(
|
||||
catch( open(NFile,read,R), _, fail )
|
||||
->
|
||||
( sub_atom( AFile, 0, _, _, traced ) -> format(W,'#if YAP_JIT~n',[]) ; true ),
|
||||
process(R,grep_opcode(W)),
|
||||
( sub_atom( AFile, 0, _, _, traced ) -> format(W,'#endif~n',[]) ; true),
|
||||
close(R)
|
||||
;
|
||||
true
|
||||
).
|
||||
|
||||
|
||||
check_op("Op").
|
||||
check_op("BOp").
|
||||
|
@ -171,8 +196,7 @@ special_op("table_answer_resolution_completion","THREADS_CONSUMER_SHARING").
|
|||
special_op("run_eam","BEAM").
|
||||
special_op("retry_eam","BEAM").
|
||||
special_op("thread_local","THREADS").
|
||||
special_op("lock_lu","THREADS").
|
||||
special_op("unlock_lu","THREADS").
|
||||
special_op("jit_handler","YAP_JIT").
|
||||
|
||||
output_rclause(C) :-
|
||||
setof(T,O^op(T,O),Types),
|
||||
|
@ -198,7 +222,7 @@ output_typeinfo(_,_).
|
|||
|
||||
% tables require access to the table info.
|
||||
special_formats(C,"e") :- !,
|
||||
format(C,' if (pp == _nstop || op == _copy_idb_term || op == _unify_idb_term) return;~n',[]).
|
||||
format(C,' if (op == _Nstop || op == _copy_idb_term || op == _unify_idb_term) return;~n',[]).
|
||||
special_formats(C,"l") :- !,
|
||||
format(C,' if (op == _Ystop) return;~n',[]).
|
||||
special_formats(C,"sssl") :- !,
|
||||
|
@ -252,6 +276,7 @@ get_op(0'D,"DBGroundTerm").
|
|||
get_op(0'f,"Func").
|
||||
get_op(0'F,"ExternalFunction").
|
||||
get_op(0'i,"IntegerInCode").
|
||||
get_op(0'j,"JITCode").
|
||||
get_op(0'I,"PtoLUIndex").
|
||||
get_op(0'l,"PtoOp").
|
||||
get_op(0'L,"PtoLUClause").
|
||||
|
@ -698,7 +723,7 @@ dump_head_action(logical, _, _, L) :-
|
|||
CELL *pt = RepAppl(t);
|
||||
|
||||
clause->Tag = AbsAppl((CELL *)pt[0]);
|
||||
if (IsExtensionFunctor(FunctorOfTerm(t))) {
|
||||
if (IsExtensionFunctor(FunctorOfTerm(t))) {
|
||||
clause->ucd.t_ptr = t;
|
||||
} else {
|
||||
clause->ucd.c_sreg = pt;
|
||||
|
@ -718,15 +743,31 @@ dump_head_action(logical, _, _, L) :-
|
|||
/* or_last requires special handling */
|
||||
footer(W) :-
|
||||
format(W,' /* this instruction is hardwired */~n',[]),
|
||||
format(W,'#ifdef YAPOR~n',[]),
|
||||
format(W,' OPCODE(~s~36+,~s)~n',["or_last","sblp"]),
|
||||
format(W,' /* or_last must be the last instruction. */~n',[]),
|
||||
format(W,'#ifdef YAP_JIT~n',[]),
|
||||
format(W,'#ifdef YAPOR~n',[]),
|
||||
format(W,' OPCODE(~s~36+,~s),~n',["traced_or_last","sblp"]),
|
||||
format(W,'#else~n',[]),
|
||||
format(W,' OPCODE(~s~36+,~s)~n',["or_last","p"]),
|
||||
format(W,'#endif~n',[]).
|
||||
format(W,' OPCODE(~s~36+,~s),~n',["traced_or_last","p"]),
|
||||
format(W,'#endif~n',[]),
|
||||
format(W,'#endif~n',[]),
|
||||
format(W,'#ifdef YAPOR~n',[]),
|
||||
format(W,' OPCODE(~s~36+,~s),~n',["or_last","sblp"]),
|
||||
format(W,'#else~n',[]),
|
||||
format(W,' OPCODE(~s~36+,~s),~n',["or_last","p"]),
|
||||
format(W,'#endif~n',[]).
|
||||
|
||||
|
||||
footer_rclause(W) :-
|
||||
format(W,' /* this instruction is hardwired */~n',[]),
|
||||
format(W,'#ifdef YAP_JIT~n',[]),
|
||||
dump_ops(W,["traced_or_last"]),
|
||||
format(W,'#ifdef YAPOR~n',[]),
|
||||
output_typeinfo(W,"Osblp"),
|
||||
format(W,'#else~n',[]),
|
||||
output_typeinfo(W,"p"),
|
||||
format(W,'#endif~n',[]),
|
||||
format(W,'#endif~n',[]),
|
||||
dump_ops(W,["or_last"]),
|
||||
format(W,'#ifdef YAPOR~n',[]),
|
||||
output_typeinfo(W,"Osblp"),
|
||||
|
@ -740,13 +781,21 @@ footer_rclause(W) :-
|
|||
|
||||
footer_walk_clause(W) :-
|
||||
format(W,' /* this instruction is hardwired */~n',[]),
|
||||
dump_ops(W,["or_last"]),
|
||||
format(W,'#ifdef YAP_JIT~n',[]),
|
||||
dump_ops(W,["traced_or_last"]),
|
||||
format(W,'#ifdef YAPOR~n',[]),
|
||||
add_pp(W,"Osblp","p0"),
|
||||
format(W,'#else~n',[]),
|
||||
add_pp(W,"p","p"),
|
||||
format(W,'#endif~n',[]),
|
||||
format(W,'#endif~n',[]),
|
||||
dump_ops(W,["or_last"]),
|
||||
format(W,'#ifdef YAPOR~n',[]),
|
||||
add_pp(W,"Osblp","p0"),
|
||||
format(W,'#else~n',[]),
|
||||
add_pp(W,"p","p"),
|
||||
format(W,'#endif~n',[]),
|
||||
format(W,' }
|
||||
format(W,' }
|
||||
}
|
||||
',[]).
|
||||
|
||||
|
@ -784,7 +833,7 @@ read_field_by_field(A) :-
|
|||
split(L," ",Statement),
|
||||
read_field_by_field(A,Statement).
|
||||
|
||||
read_field_by_field(_,["}","u;"]) :- !.
|
||||
read_field_by_field(_,["}","y_u;"]) :- !.
|
||||
read_field_by_field(A,["struct","{"]) :- !,
|
||||
read_fields(A,Fields,Type),
|
||||
assert(tinfo(Type,Fields)),
|
||||
|
@ -813,6 +862,12 @@ read_fields(A,Fields,Type) :-
|
|||
retract(qual(_)),
|
||||
assert(qual(If)),
|
||||
read_fields(A,Fields,Type)
|
||||
;
|
||||
Statements = ["#if",If]
|
||||
->
|
||||
retract(qual(_)),
|
||||
assert(qual(If)),
|
||||
read_fields(A,Fields,Type)
|
||||
;
|
||||
Statements = ["#endif"|_]
|
||||
->
|
||||
|
@ -1141,7 +1196,7 @@ opinfo("retry_eam",[body]).
|
|||
opinfo("alloc_for_logical_pred",[body]).
|
||||
opinfo("deallocate",[body]).
|
||||
opinfo("table_try_single",[]).
|
||||
opinfo("native_me",[]).
|
||||
opinfo("jit_handler",[]).
|
||||
|
||||
output_save_clause(S) :-
|
||||
setof(T,O^op(T,O),Types),
|
||||
|
@ -1151,7 +1206,7 @@ output_save_clause(S) :-
|
|||
output_save_clause(_).
|
||||
|
||||
output_save_type(S, T) :-
|
||||
(T=="e" -> start_low_level_trace; true),
|
||||
%(T=="e" -> start_low_level_trace; true),
|
||||
format(S,' /* instructions type ~s */~n',[T]),
|
||||
setof(Op,op(T,Op),Ops),
|
||||
dump_ops(S,Ops),
|
||||
|
|
952
misc/sysgraph
952
misc/sysgraph
|
@ -1,4 +1,4 @@
|
|||
#!/usr/local/bin/yap -L -- *
|
||||
x#!/usr/local/bin/yap -L -- *
|
||||
#.
|
||||
|
||||
|
||||
|
@ -53,31 +53,18 @@ main :-
|
|||
init,
|
||||
fail.
|
||||
main :-
|
||||
unix(argv([D])),
|
||||
working_directory(_, D),
|
||||
fail.
|
||||
unix(argv([D])),
|
||||
load( D/['C'-prolog,
|
||||
'os'-prolog,
|
||||
'pl'-prolog,
|
||||
'OPTYap'-prolog,
|
||||
'library'-user,
|
||||
'swi/console'-prolog,
|
||||
'swi/library'-user,
|
||||
'packages'-user
|
||||
]),
|
||||
fail.
|
||||
main :-
|
||||
% from libraries outside the current directories
|
||||
assert( node( attributes, woken_att_do/4, 'library/atts.yap', prolog ) ),
|
||||
fail.
|
||||
main :-
|
||||
Dirs = ['C'-prolog,
|
||||
'os'-prolog,
|
||||
'pl'-prolog,
|
||||
'OPTYap'-prolog,
|
||||
'library'-user,
|
||||
'swi/console'-prolog,
|
||||
'swi/library'-user,
|
||||
'packages'-user],
|
||||
dirs( Dirs ),
|
||||
%%% phase 1: find modules
|
||||
nb_setval( current_module, user ),
|
||||
nb_setval( private, false ),
|
||||
nb_setval( file_entry, user:user ),
|
||||
init_loop( Dirs ),
|
||||
maplist( pl_interfs, Dirs ),
|
||||
%%% phase 2: find C-code predicates
|
||||
maplist( c_preds, Dirs ),
|
||||
%%% phase 4: construct graph
|
||||
retractall( consulted(_,_) ),
|
||||
% maplist( pl_graphs, Dirs ),
|
||||
|
@ -88,880 +75,36 @@ main :-
|
|||
mkdocs.
|
||||
|
||||
|
||||
dirs( Roots ) :-
|
||||
member( Root-_, Roots ),
|
||||
absolute_file_name( Root, FRoot ),
|
||||
rdir( FRoot ),
|
||||
fail.
|
||||
dirs( _Roots ).
|
||||
|
||||
rdir( FRoot ) :-
|
||||
directory_files( FRoot , Files),
|
||||
member( File, Files ),
|
||||
atom_concat( [FRoot,'/',File], New0 ),
|
||||
absolute_file_name( New0, New ),
|
||||
\+ doskip( New ),
|
||||
(
|
||||
file_property( New, type(directory) )
|
||||
->
|
||||
File \= '.',
|
||||
File \= '..',
|
||||
File \= '.git',
|
||||
rdir( New )
|
||||
;
|
||||
assert_new( dir( FRoot, File ))
|
||||
),
|
||||
fail.
|
||||
rdir(_).
|
||||
|
||||
init :-
|
||||
retractall(dir(_)),
|
||||
retractall(edge(_)),
|
||||
retractall(private(_,_)),
|
||||
retractall(public(_,_)),
|
||||
retractall(undef(_,_)),
|
||||
retractall(consulted(_,_)),
|
||||
retractall(module_on(_,_,_)),
|
||||
retractall(op_export(_,_,_)),
|
||||
retractall(exported(_)),
|
||||
retractall(do_comment(_,_,_,_,_)).
|
||||
retractall(dir(_)),
|
||||
retractall(edge(_)),
|
||||
retractall(private(_,_)),
|
||||
retractall(public(_,_)),
|
||||
retractall(undef(_,_)),
|
||||
retractall(consulted(_,_)),
|
||||
retractall(module_on(_,_,_)),
|
||||
retractall(op_export(_,_,_)),
|
||||
retractall(exported(_)),
|
||||
retractall(do_comment(_,_,_,_,_)).
|
||||
init :-
|
||||
user_c_dep(A,B),
|
||||
do_user_c_dep(A,B),
|
||||
fail.
|
||||
user_c_dep(A,B),
|
||||
do_user_c_dep(A,B),
|
||||
fail.
|
||||
init :-
|
||||
user_skip(A),
|
||||
do_user_skip(A),
|
||||
fail.
|
||||
user_skip(A),
|
||||
do_user_skip(A),
|
||||
fail.
|
||||
init :-
|
||||
user_expand(N,A),
|
||||
do_user_expand(N,A),
|
||||
fail.
|
||||
user_expand(N,A),
|
||||
do_user_expand(N,A),
|
||||
fail.
|
||||
init :-
|
||||
catch( make_directory(tmp), _, fail),
|
||||
fail.
|
||||
catch( make_directory(tmp), _, fail),
|
||||
fail.
|
||||
init.
|
||||
|
||||
init_loop( _Dirs ).
|
||||
|
||||
c_preds(Dir - Mod) :-
|
||||
atom( Dir ),
|
||||
atom_concat([Dir,'/*'], Pattern),
|
||||
expand_file_name( Pattern, Files ),
|
||||
member( File0, Files ),
|
||||
absolute_file_name( File0, File ),
|
||||
( ( sub_atom(File,_,_,0,'.c')
|
||||
;
|
||||
sub_atom(File,_,_,0,'.i')
|
||||
;
|
||||
sub_atom(File,_,_,0,'.C')
|
||||
;
|
||||
sub_atom(File,_,_,0,'.cpp')
|
||||
;
|
||||
sub_atom(File,_,_,0,'.icc')
|
||||
;
|
||||
sub_atom(File,_,_,0,'.h')
|
||||
) ->
|
||||
\+ doskip( File ),
|
||||
c_file( File , Mod )
|
||||
;
|
||||
exists_directory( File ),
|
||||
\+ atom_concat(_, '/.', File),
|
||||
\+ atom_concat(_, '/..', File),
|
||||
\+ doskip( File ),
|
||||
c_preds( File - Mod )
|
||||
),
|
||||
fail.
|
||||
c_preds(_).
|
||||
|
||||
|
||||
c_file(F, _Mod) :-
|
||||
consulted( F, _ ),
|
||||
!.
|
||||
c_file(F, Mod) :-
|
||||
% writeln(F),
|
||||
assert( consulted( F, Mod ) ),
|
||||
nb_setval( current_module, Mod ),
|
||||
open(F, read, S, [alias(c_file)]),
|
||||
repeat,
|
||||
read_line_to_string( S, String ),
|
||||
( String == end_of_file
|
||||
->
|
||||
!,
|
||||
close(S)
|
||||
;
|
||||
sub_string(String, _, _, _, "PL_extension"),
|
||||
%writeln(Fields),
|
||||
c_ext(S, Mod, F),
|
||||
fail
|
||||
;
|
||||
split_string(String, ",; ()\t\"\'", Fields), %'
|
||||
%writeln(Fields),
|
||||
line_count(S, Lines),
|
||||
c_line(Fields , Mod, F:Lines),
|
||||
fail
|
||||
).
|
||||
|
||||
c_line(["}"], Mod, _) :- !,
|
||||
nb_setval( current_module, Mod ).
|
||||
c_line(Line, _Mod, _) :-
|
||||
append( _, [ "CurrentModule", "=", M|_], Line),
|
||||
system_mod(M, _Mod, Mod, _),
|
||||
nb_setval( current_module, Mod ).
|
||||
c_line(Line, Mod, F: LineP) :-
|
||||
break_line( Line, N/A, Fu),
|
||||
assert( node( Mod, N/A, F-LineP, Fu ) ),
|
||||
handle_pred( Mod, N, A, F ).
|
||||
|
||||
c_ext( S, Mod, F ) :-
|
||||
repeat,
|
||||
read_line_to_string( S, String ),
|
||||
(
|
||||
sub_string( String, _, _, _, "NULL" ),
|
||||
!
|
||||
;
|
||||
split_string(String, ",; (){}\t\"\'", ["FRG", NS,AS,FS|_]), %'
|
||||
atom_string(N,NS),
|
||||
atom_string(Fu,FS),
|
||||
number_string(A, AS),
|
||||
stream_property( S, position( Pos ) ),
|
||||
stream_position_data( line_count, Pos, Line ),
|
||||
assert( node( Mod , N/A, F-Line, Fu ) ),
|
||||
handle_pred( Mod, N, A, F )
|
||||
;
|
||||
split_string(String, ",; (){}\t\"\'", [NS,AS,FS|_]), %'
|
||||
atom_string(N,NS),
|
||||
atom_string(Fu,FS),
|
||||
number_string(A, AS),
|
||||
stream_property( S, position( Pos ) ),
|
||||
stream_position_data( line_count, Pos, Line ),
|
||||
Line0 is Line-1,
|
||||
assert( node( Mod, N/A, F-Line0, Fu ) ),
|
||||
handle_pred( Mod, N, A, F )
|
||||
).
|
||||
|
||||
|
||||
break_line( Line, N/A, c(Fu)) :-
|
||||
take_line( Line, NS, AS, FS ), !,
|
||||
atom_string(N,NS),
|
||||
atom_string(Fu,FS),
|
||||
number_string(A, AS).
|
||||
break_line( Line, N/A, swi(Fu)) :-
|
||||
take_line( Line, NS, AS, FS ), !,
|
||||
atom_string(N,NS),
|
||||
number_string(A, AS),
|
||||
atomic_concat(["pl_",FS,"_",A,"_va"], Fu).
|
||||
break_line( Line, N/A, bp(Fu)) :-
|
||||
take_line( Line, NS, AS, FS ), !,
|
||||
atom_string(N,NS),
|
||||
number_string(A, AS),
|
||||
atomic_concat(["pc_",FS,"_",A], Fu).
|
||||
break_line( Line, N/A, c(FuE, FuB)) :-
|
||||
take_line( Line, NS, AS, FSE, FSB ), !,
|
||||
atom_string(N,NS),
|
||||
atom_string(FuE,FSE),
|
||||
atom_string(FuB,FSB),
|
||||
number_string(A, AS).
|
||||
|
||||
take_line( Line, NS, AS, FS ) :-
|
||||
append( _, [ "Yap_InitCPred", NS, AS, FS|_], Line), !.
|
||||
take_line( Line, NS, AS, FS ) :-
|
||||
append( _, [ "Yap_InitAsmPred", NS, AS, _, FS|_], Line), !.
|
||||
take_line( Line, NS, AS, FS ) :-
|
||||
append( _, [ "Yap_InitCmpPred", NS, AS, FS|_], Line), !.
|
||||
take_line( Line, NS, AS, FS ) :-
|
||||
append( _, [ "Yap_InitCmpPred", NS, AS, FS|_], Line), !.
|
||||
take_line( Line, NS, AS, FS ) :-
|
||||
append( _, [ "YAP_UserCPredicate", NS, FS, AS|_], Line), !.
|
||||
take_line( Line, NS, AS, FS ) :-
|
||||
append( _, [ "PRED", NS0, AS, FS|_], Line), !,
|
||||
append( ["pl_", NS0, AS, "_va"], NS ).
|
||||
take_line( Line, NS, AS, FS ) :-
|
||||
append( _, [ "PRED_IMPL", NS0, AS, FS|_], Line), !,
|
||||
append( ["pl_", NS0, AS, "_va"], NS ).
|
||||
take_line( Line, NS, AS, FS ) :-
|
||||
append( _, [ "PL_register_foreign", NS, AS, FS|_], Line), !.
|
||||
take_line( Line, NS, AS, FS ) :-
|
||||
append( _, [ "PRED_DEF", NS0, AS, FS|_], Line), !,
|
||||
append( ["pl_", NS0, AS, "_va"], NS ).
|
||||
take_line( Line, NS, AS, FS ) :-
|
||||
append( _, [ "FRG", NS, AS, FS|_], Line), !.
|
||||
% from odbc
|
||||
take_line( Line, NS, AS, FS ) :-
|
||||
append( _, [ "NDET", NS, AS, FS|_], Line), !.
|
||||
take_line( Line, NS, AS, FS ) :-
|
||||
append( _, [ "DET", NS, AS, FS|_], Line), !.
|
||||
|
||||
|
||||
take_line( Line, AS, FS ) :-
|
||||
append( _, [ "REGISTER_CPRED", FS, AS], Line), !.
|
||||
|
||||
|
||||
take_line( Line, NS, AS, FSE, FSB ) :-
|
||||
append( _, [ "Yap_InitCPredBack", NS, AS, _, FSE, FSB|_], Line), !.
|
||||
|
||||
system_mod("ATTRIBUTES_MODULE", _, attributes, user ).
|
||||
system_mod("HACKS_MODULE", _, '$hacks' , sys ).
|
||||
system_mod("USER_MODULE", _, user, user ).
|
||||
system_mod("DBLOAD_MODULE", _, '$db_load', sys ).
|
||||
system_mod("GLOBALS_MODULE", _, globals, sys ).
|
||||
system_mod("ARG_MODULE", _, arg, sys ).
|
||||
system_mod("PROLOG_MODULE", _ , prolog, sys ).
|
||||
system_mod("RANGE_MODULE", _, range, user ).
|
||||
system_mod("SWI_MODULE", _, swi, sys ).
|
||||
system_mod("OPERATING_SYSTEM_MODULE", _, operating_system_support , sys ).
|
||||
system_mod("TERMS_MODULE", _, terms , sys).
|
||||
system_mod("SYSTEM_MODULE", _, system, sys ).
|
||||
system_mod("IDB_MODULE", _, idb, user ).
|
||||
system_mod("CHARSIO_MODULE", _, charsio, sys ).
|
||||
system_mod("cm", M, M, user ).
|
||||
|
||||
call_c_files( File, Mod, _Fun, [CFile] ) :-
|
||||
search_file( CFile, File, c, F ),
|
||||
c_file(F, Mod).
|
||||
call_c_files( File, Mod, _Fun, CFile ) :-
|
||||
CFile \= [_|_],
|
||||
search_file( CFile, File, c, F ),
|
||||
c_file(F, Mod).
|
||||
|
||||
|
||||
pl_interfs(Dir - Mod) :-
|
||||
\+ doskip( Dir ),
|
||||
format('% ************* ~a\n', [Dir]),
|
||||
nb_setval( current_module, Mod ),
|
||||
atom( Dir ),
|
||||
directory_files( Dir , Files),
|
||||
member( File, Files ),
|
||||
atom_concat([Dir,'/',File], Path),
|
||||
( ( sub_atom(File,_,_,0,'.yap') ; sub_atom(File,_,_,0,'.pl') ; sub_atom(File,_,_,0,'.ypp') ) ->
|
||||
ops_restore,
|
||||
absolute_file_name( Path, APath ),
|
||||
pl_interf( APath , Mod )
|
||||
;
|
||||
exists_directory( Path ),
|
||||
\+ atom_concat(_, '/.', Path),
|
||||
\+ atom_concat(_, '/..', Path),
|
||||
\+ atom_concat(_, '/.git', Path),
|
||||
absolute_file_name( Path, APath ),
|
||||
\+ doskip( APath ),
|
||||
pl_interfs( APath - Mod )
|
||||
),
|
||||
fail.
|
||||
pl_interfs(_).
|
||||
|
||||
%%
|
||||
% pl_interf( File, Mod)
|
||||
% adds a node to the file graph and marks which files are modules
|
||||
%
|
||||
% main side-effect facts like edge( F0-Mod:File )
|
||||
% exported( ( FMNATarget :- FMNASource ) ) ou exported(F-M, Op ),
|
||||
% module_on ( M, File )
|
||||
%
|
||||
pl_interf(F, _Mod) :-
|
||||
module_on( F , _M, _Is),
|
||||
!.
|
||||
pl_interf(F, Mod) :-
|
||||
consulted(F, Mod ),
|
||||
!.
|
||||
pl_interf(F, Mod) :-
|
||||
% ( sub_atom(F,_,_,_,'matrix.yap') -> spy get_interf ; true ),
|
||||
% ( sub_atom( F, _, _, 0, 'gecode.yap' ) -> spy user_deps; true ),
|
||||
assert_new(consulted(F, Mod ) ),
|
||||
nb_getval( private, Default ),
|
||||
nb_setval( private, false ),
|
||||
nb_getval( file_entry, OF:OMod ),
|
||||
nb_setval( file_entry, F:Mod ),
|
||||
preprocess_file( F, PF ),
|
||||
catch( open(PF, read, S, [scripting(true)]) , _, fail ),
|
||||
repeat,
|
||||
nb_getval( current_module, MR ),
|
||||
%( sub_atom(F,_,_,_,'e.yap') -> spy get_interf ; nospyall ),
|
||||
catch( read_term( S, T, [module( MR ),term_position(Pos)] ), Throw, (ypp(F,Throw), fail)),
|
||||
(
|
||||
T == end_of_file
|
||||
->
|
||||
!,
|
||||
close(S),
|
||||
(
|
||||
c_dep( F, Fc),
|
||||
c_file( Fc, MR ),
|
||||
fail
|
||||
;
|
||||
build_graph( F, MR ),
|
||||
fail
|
||||
% cleanup
|
||||
;
|
||||
module_on( F , _M, _Is)
|
||||
->
|
||||
% also, close ops defined in the module M, if M \= Mod
|
||||
nb_setval( current_module, Mod ),
|
||||
nb_setval( private, Default ),
|
||||
nb_setval( file_entry, OF:OMod )
|
||||
;
|
||||
true
|
||||
)
|
||||
;
|
||||
nb_getval( current_module, MC0 ),
|
||||
stream_position_data( line_count, Pos, Line ),
|
||||
nb_setval( line, Line ),
|
||||
( Mod == prolog -> MC = prolog ; MC = MC0 ),
|
||||
get_interf( T, F, MC ),
|
||||
fail
|
||||
).
|
||||
|
||||
get_interf( T, _F, _M0 ) :-
|
||||
var(T),
|
||||
!.
|
||||
get_interf( T, _F, _M0 ) :-
|
||||
% ( T = (:- op(_,_,_)) -> trace ; true ),
|
||||
var(T),
|
||||
!.
|
||||
get_interf( M:T, F, _M0 ) :- !,
|
||||
get_interf( T, F, M ).
|
||||
get_interf( goal_expansion(G, M, _) , F, _M0 ) :-
|
||||
nonvar( G ),
|
||||
!,
|
||||
( var( M ) -> M1 = prolog ; M = M1 ),
|
||||
functor( G, N, A ),
|
||||
handle_pred( M1, N, A, F ).
|
||||
get_interf( goal_expansion(G, _) , F, _M0 ) :-
|
||||
nonvar( G ),
|
||||
!,
|
||||
functor( G, N, A ),
|
||||
handle_pred( prolog, N, A, F ).
|
||||
get_interf( ( M:H :- _B), F, _M ) :-
|
||||
!,
|
||||
get_interf( H, F, M ).
|
||||
get_interf( ( goal_expansion(G, M, _) :- _) , F, _M0 ) :-
|
||||
nonvar( G ),
|
||||
!,
|
||||
( var( M ) -> M1 = prolog ; M = M1 ),
|
||||
functor( G, N, A ),
|
||||
handle_pred( M1, N, A, F ).
|
||||
get_interf( ( goal_expansion(G, _) :- _) , F, _M0 ) :-
|
||||
nonvar( G ),
|
||||
!,
|
||||
functor( G, N, A ),
|
||||
handle_pred( prolog, N, A, F ).
|
||||
get_interf( ( M:H --> _B), F, _ ) :-
|
||||
!,
|
||||
get_interf( ( H --> _B), F, M ).
|
||||
get_interf( ( A, _ --> _B), F, M ) :-
|
||||
get_interf( ( A --> _B), F, M ).
|
||||
get_interf( (H --> _B), F, M ) :-
|
||||
!,
|
||||
functor( H, N, Ar),
|
||||
Ar2 is Ar+2,
|
||||
functor( H2, N, Ar2),
|
||||
get_interf( H2, F, M ).
|
||||
get_interf( (H :- _B), F, M ) :-
|
||||
!,
|
||||
get_interf( H, F, M ).
|
||||
%% switches to new file n
|
||||
get_interf( (:- V ), _F, _M ) :-
|
||||
var( V ),
|
||||
!.
|
||||
get_interf( (:- module( NM, Is ) ), F, _M ) :-
|
||||
!,
|
||||
assert(module_file( F, NM ) ),
|
||||
nb_setval( current_module, NM ),
|
||||
assert( module_on( F , NM, Is) ),
|
||||
maplist( public(F, NM), Is ),
|
||||
nb_setval( private, true ).
|
||||
get_interf( (:- reexport( Loc, Is ) ), F, M ) :-
|
||||
!,
|
||||
% find the file
|
||||
search_file( Loc, F, pl, NF ),
|
||||
include_files( F, M, Is, NF ),
|
||||
% extend the interface.rg
|
||||
retract( module_on( F , M, Is0) ),
|
||||
append( Is0, Is, NIs ),
|
||||
assert( module_on( F , M, NIs) ),
|
||||
maplist( public(F, M), NIs ).
|
||||
get_interf( (:- use_module( Loc, Is ) ), F, M ) :- !,
|
||||
!,
|
||||
include_files( F, M, Is, Loc ).
|
||||
get_interf( (:- use_module( Loc ) ), F, M ) :- !,
|
||||
!,
|
||||
include_files( F, M, Loc ).
|
||||
% nb_getval(current_module,MM), writeln(NM:MM:M).
|
||||
get_interf( (:- use_module( Loc, Is, _ ) ), F, M ) :- !,
|
||||
!,
|
||||
include_files( F, M, Is, Loc ).
|
||||
get_interf( (:- consult( Files ) ), F, M ) :-
|
||||
!,
|
||||
include_files( F, M, Files ).
|
||||
get_interf( (:- reconsult( Files ) ), F, M ) :-
|
||||
!,
|
||||
include_files( F, M, Files ).
|
||||
get_interf( (:- ensure_loaded( Files ) ), F, M ) :-
|
||||
!,
|
||||
include_files( F, M, Files ).
|
||||
get_interf( (:- include( Files ) ), F, M ) :-
|
||||
!,
|
||||
source_files( F, M, Files ).
|
||||
get_interf( (:- load_files( Files , [_|_] ) ), F, M ) :-
|
||||
!,
|
||||
include_files( F, M, Files ).
|
||||
get_interf( ( :- ( G -> _ ; _ ) ) , F, M) :-
|
||||
!,
|
||||
get_interf( (:- G ) , F, M).
|
||||
get_interf( (:- catch( G , _, _ ) ) , F, M) :-
|
||||
!,
|
||||
get_interf( (:- G ) , F, M).
|
||||
get_interf( (:- initialization( G , now ) ) , F, M) :-
|
||||
!,
|
||||
get_interf( (:- G ) , F, M).
|
||||
get_interf( (:- load_files( Files , [_|_] ) ), F, M ) :-
|
||||
!,
|
||||
include_files( F, M, Files ).
|
||||
get_interf( (:- [F1|Fs] ), F, M ) :-
|
||||
!,
|
||||
include_files( F, M, [F1|Fs] ).
|
||||
% don't actually use this one.
|
||||
get_interf( (:- load_foreign_files(Fs, _, Fun) ), F, M ) :-
|
||||
!,
|
||||
call_c_files( F, M, Fun, Fs ).
|
||||
get_interf( (:- load_foreign_library(F) ), F0, M ) :-
|
||||
!,
|
||||
always_strip_module(M:F, M1, F1),
|
||||
call_c_files( F0, M1, '', F1 ).
|
||||
get_interf( (:- load_foreign_library(F,Fun) ), F0, M ) :-
|
||||
!,
|
||||
always_strip_module(M:F, M1, F1),
|
||||
call_c_files( F0, M1, Fun, F1 ).
|
||||
get_interf( (:- use_foreign_library(F) ), F0, M ) :-
|
||||
!,
|
||||
always_strip_module(M:F, M1, F1),
|
||||
call_c_files( F0, M1, '', F1 ).
|
||||
get_interf( (:- system_module( _NM, _Publics, _Hiddens) ), _F, _M ) :-
|
||||
!.
|
||||
get_interf( (:- style_checker( _ ) ), _F, _M ) :-
|
||||
!.
|
||||
get_interf( (:- dynamic T), F, M ) :-
|
||||
!,
|
||||
declare_functors( T, F, M ).
|
||||
get_interf( (:- multifile T), F, M ) :- % public?
|
||||
!,
|
||||
declare_functors( T, F, M ).
|
||||
get_interf( (:- meta_predicate T), F, M ) :-!,
|
||||
declare_terms( T, F, M ), % public?
|
||||
!.
|
||||
get_interf( (:- '$install_meta_predicate'( H, M) ), F, __M ) :-
|
||||
!,
|
||||
declare_functors( H, F, M ).
|
||||
get_interf( (:- thread_local T), F, M ) :-
|
||||
!,
|
||||
declare_functors( T, F, M ).
|
||||
get_interf( (:- op( X, Y, Z) ), F, M ) :-
|
||||
!,
|
||||
always_strip_module(M:Z, M1, Z1),
|
||||
handle_op( F, M1, op( X, Y, Z1) ).
|
||||
get_interf( (:- record( Records ) ), F, M ) :-
|
||||
!,
|
||||
handle_record( Records, F, M).
|
||||
get_interf( (:- set_prolog_flag(dollar_as_lower_case,On) ), _F, _M ) :-
|
||||
!,
|
||||
set_prolog_flag(dollar_as_lower_case,On).
|
||||
get_interf( (:- _ ), _F, _M ) :- !.
|
||||
get_interf( (?- _ ), _F, _M ) :- !.
|
||||
get_interf( V , _F, _M ) :-
|
||||
var( V ),
|
||||
!,
|
||||
error( instantiation_error ).
|
||||
get_interf( G , F, M ) :-
|
||||
functor( G, N, A),
|
||||
handle_pred( M, N, A, F ),
|
||||
!.
|
||||
|
||||
% support SWI package record
|
||||
handle_record( (Records1, Records2), F, M ) :-
|
||||
!,
|
||||
handle_record( Records1, F, M ),
|
||||
handle_record( Records2, F, M ).
|
||||
handle_record( Record, F, M ) :-
|
||||
Record =.. [Constructor|Fields],
|
||||
atom_concat(Constructor, '_data', Data),
|
||||
handle_pred( M, Data, 3, F),
|
||||
atom_concat(default_, Constructor, New),
|
||||
handle_pred( M, New, 1, F),
|
||||
atom_concat(is_, Constructor, Is),
|
||||
handle_pred( M, Is, 1, F),
|
||||
atom_concat(make_, Constructor, Make),
|
||||
handle_pred( M, Make, 2, F),
|
||||
handle_pred( M, Make, 3, F),
|
||||
atom_concat([set_, Constructor,'_fields'], Sets),
|
||||
handle_pred( M, Sets, 3, F),
|
||||
handle_pred( M, Sets, 4, F),
|
||||
atom_concat([set_, Constructor,'_field'], Set),
|
||||
handle_pred( M, Set, 3, F),
|
||||
maplist( handle_record_field( Constructor, F, M) , Fields ).
|
||||
|
||||
handle_record_field( Constructor, F, M, Name:_=_ ) :-
|
||||
!,
|
||||
handle_record_field_name( Constructor, F, M, Name).
|
||||
handle_record_field( Constructor, F, M, Name:_ ) :-
|
||||
!,
|
||||
handle_record_field_name( Constructor, F, M, Name).
|
||||
handle_record_field( Constructor, F, M, Name=_ ) :-
|
||||
!,
|
||||
handle_record_field_name( Constructor, F, M, Name).
|
||||
handle_record_field( Constructor, F, M, Name ) :-
|
||||
handle_record_field_name( Constructor, F, M, Name).
|
||||
|
||||
handle_record_field_name( Constructor, F, M, Name) :-
|
||||
atom_concat([ Constructor,'_', Name], Val),
|
||||
handle_pred( M, Val, 2, F),
|
||||
atom_concat([ set_, Name, '_of_', Constructor ], Set),
|
||||
handle_pred( M, Set, 3, F),
|
||||
handle_pred( M, Set, 2, F),
|
||||
atom_concat([ nb_set_, Name, '_of_', Constructor ], Set),
|
||||
handle_pred( M, Set, 3, F),
|
||||
handle_pred( M, Set, 2, F).
|
||||
|
||||
handle_pred( M, N, A, F ) :-
|
||||
(
|
||||
system_mod( _, _, M, sys )
|
||||
->
|
||||
(
|
||||
atom_concat('$',_,N)
|
||||
->
|
||||
private( F, M, N/A )
|
||||
;
|
||||
public( F, M, N/A )
|
||||
)
|
||||
;
|
||||
( nb_getval( private, false )
|
||||
->
|
||||
public( F, M, N/A )
|
||||
;
|
||||
private( F, M, N/A )
|
||||
)
|
||||
).
|
||||
|
||||
handle_op( F, M, Op ) :-
|
||||
( nb_getval( private, false )
|
||||
->
|
||||
public( F, M, Op )
|
||||
;
|
||||
private( F, M, Op )
|
||||
),
|
||||
Op = op(X, Y, Z ),
|
||||
( ( M == user ; M == prolog )
|
||||
->
|
||||
op( X, Y, prolog:Z )
|
||||
;
|
||||
op( X, Y, M:Z )
|
||||
).
|
||||
|
||||
exported( NF, F, NM, M, op(X,Y,Z)) :-
|
||||
!,
|
||||
public( NF , NM:op(X,Y,Z) ),
|
||||
handle_op( F, M , op(X,Y,Z) ).
|
||||
exported( NF, F, NM, M, N/A) :- !,
|
||||
% sink no more
|
||||
retractall( exported(( _ :- F-M:N/A) ) ),
|
||||
assert_new( exported( (F-M:N/A :- NF-NM:N/A )) ).
|
||||
exported( NF, F, NM, M, N/A as NN) :- !,
|
||||
% sink no more
|
||||
retractall( exported(( _ :- F-M:N/A) ) ),
|
||||
assert_new( exported( ( F-M:NN/A :- NF-NM:N/A ) ) ).
|
||||
exported( NF, F, NM, M, N//A) :- !,
|
||||
A2 is A+2,
|
||||
% sink no more
|
||||
retractall( exported(( _ :- F-M:N/A2) ) ),
|
||||
assert_new( exported( (F-M:N/A2 :- NF-NM:N/A2) ) ).
|
||||
exported( NF, F, NM, M, N//A as NN) :- !,
|
||||
A2 is A+2,
|
||||
% sink no more
|
||||
retractall( exported(( _ :- F-M:N/A2) ) ),
|
||||
assert_new( exported( ( F-M:NN/A2 :- NF-NM:N/A2 )) ).
|
||||
|
||||
import_publics( F, ProducerMod, ConsumerMod ) :-
|
||||
public(F, ProducerMod:op(X,Y,Z) ),
|
||||
handle_op( F, ConsumerMod, op(X,Y,Z) ),
|
||||
fail.
|
||||
import_publics( _F, _ProducerMod, _ConsumerMod ).
|
||||
|
||||
all_imported( ProducerFile, ConsumerFile, ProducerMod, ConsumerMod ) :-
|
||||
public(ProducerFile, ProducerMod:op(X,Y,Z) ),
|
||||
handle_op( ConsumerFile, ConsumerMod, op(X,Y,Z) ),
|
||||
fail.
|
||||
all_imported( ProducerFile, ConsumerFile, ProducerMod, ConsumerMod ) :-
|
||||
public(ProducerFile, ProducerMod:N/A ),
|
||||
exported( ProducerFile, ConsumerFile, ProducerMod, ConsumerMod, N/A ),
|
||||
fail.
|
||||
all_imported( _ProducerFile, _ConsumerFile, _ProducerMod, _ConsumerMod ).
|
||||
|
||||
|
||||
include_files( F, M, Files ) :-
|
||||
include_files( F, M, _Is, Files ).
|
||||
|
||||
include_files( F, M, Is, Files ) :-
|
||||
maplist( include_files( F, M, Is ), Files ),
|
||||
!.
|
||||
include_files( F, M, Is, -Files ) :-
|
||||
!,
|
||||
include_files( F, M, Is, Files).
|
||||
include_files( F, M, Is, Files ) :-
|
||||
!,
|
||||
always_strip_module(M:Files, M1, NFiles),
|
||||
include_file( F, M1, Is, NFiles ).
|
||||
include_files( F, M, Is, Loc ) :-
|
||||
include_file( F, M, Is, Loc ).
|
||||
|
||||
include_file( F, M, Is, Loc ) :-
|
||||
is_list( Loc ), !,
|
||||
maplist( include_file( F, M, Is), Loc ).
|
||||
include_file( F, M, Is0, Loc ) :-
|
||||
nb_getval( private, Private ),
|
||||
% find the file
|
||||
once( search_file( Loc, F, pl, NF ) ),
|
||||
% depth visit
|
||||
pl_interf(NF, M), % should verify Is in _Is
|
||||
% link b
|
||||
( module_on(NF, NM, Is)
|
||||
->
|
||||
( var(Is0) -> Is = Is0 ; true ),
|
||||
maplist( exported( NF, F, NM, M) , Is0 )
|
||||
;
|
||||
all_imported( NF, F, NM, M)
|
||||
),
|
||||
nb_setval( private, Private ).
|
||||
|
||||
|
||||
source_files( F, M, Files ) :-
|
||||
maplist( source_files( F, M ), Files ),
|
||||
!.
|
||||
source_files( F, M, Loc ) :-
|
||||
source_file( F, M, Loc ).
|
||||
|
||||
source_file( F, M, Loc ) :-
|
||||
once( search_file( Loc, F, pl, NF ) ),
|
||||
% depth visit
|
||||
pl_source(NF, F, M). % should verify Is in _Is
|
||||
|
||||
pl_source(F, F0, Mod) :-
|
||||
% writeln( -F ),
|
||||
preprocess_file( F, PF ),
|
||||
catch( open(PF, read, S, []) , _, fail ),
|
||||
repeat,
|
||||
nb_getval( current_module, MR ),
|
||||
%( sub_atom(F,_,_,_,'examples/matrix.yap') -> spy get_interf ; nospyall ),
|
||||
catch( read_term( S, T, [module( MR ),term_position(Pos)] ), Throw, (writeln(F:MR:Throw), break, fail)),
|
||||
(
|
||||
T == end_of_file
|
||||
->
|
||||
!,
|
||||
close(S)
|
||||
;
|
||||
nb_getval( current_module, MC0 ),
|
||||
stream_position_data( line_count, Pos, Line ),
|
||||
nb_setval( line, Line ),
|
||||
( Mod == prolog -> MC = prolog ; MC = MC0 ),
|
||||
get_interf( T, F0, MC ),
|
||||
fail
|
||||
).
|
||||
|
||||
declare_functors( T, _F, _M1) :- var(T), !,
|
||||
error( unbound_variable ).
|
||||
declare_functors( M:T, F, _M1) :- !,
|
||||
declare_functors( T, F, M).
|
||||
declare_functors( (T1,T2), F, M1) :- !,
|
||||
declare_functors( T1, F, M1),
|
||||
declare_functors( T2, F, M1).
|
||||
declare_functors( Ts, F, M1) :-
|
||||
maplist( declare_functor( F, M1), Ts ), !.
|
||||
declare_functors( T, F, M1) :-
|
||||
declare_functor( F, M1, T).
|
||||
|
||||
declare_functor(File, M, N/A) :-
|
||||
handle_pred( M, N, A, File ).
|
||||
|
||||
declare_terms( T, _F, _M1) :- var(T), !,
|
||||
error( unbound_variable ).
|
||||
declare_terms( M:T, F, _M1) :- !,
|
||||
declare_functors( T, F, M).
|
||||
declare_terms( (N1,N2), F, M) :-
|
||||
number(N1),
|
||||
number(N2),
|
||||
!,
|
||||
declare_term( F, M, (N1,N2)).
|
||||
declare_terms( (T1,T2), F, M1) :- !,
|
||||
declare_terms( T1, F, M1),
|
||||
declare_terms( T2, F, M1).
|
||||
declare_terms( Ts, F, M1) :-
|
||||
maplist( declare_term( F, M1), Ts ), !.
|
||||
declare_terms( T, F, M1) :-
|
||||
declare_term( F, M1, T).
|
||||
|
||||
declare_term(F, M, S) :-
|
||||
functor(S, N, A),
|
||||
handle_pred( M, N, A, F ).
|
||||
|
||||
pl_graphs(Dir - Mod) :-
|
||||
format(' ************* GRAPH: ~a ***********************~n', [Dir]),
|
||||
atom( Dir ),
|
||||
atom_concat([Dir,'/*'], Pattern),
|
||||
expand_file_name( Pattern, Files ),
|
||||
member( File, Files ),
|
||||
( ( sub_atom(File,_,_,0,'.yap') ; sub_atom(File,_,_,0,'.pl') ) ->
|
||||
build_graph( File , Mod )
|
||||
;
|
||||
exists_directory( File ),
|
||||
\+ atom_concat(_, '/.', File),
|
||||
\+ atom_concat(_, '/..', File),
|
||||
\+ atom_concat(_, '/.git', File),
|
||||
pl_graphs( File - Mod )
|
||||
),
|
||||
fail.
|
||||
pl_graphs(_).
|
||||
|
||||
%%
|
||||
% pl_graph( File, Mod)
|
||||
% adds a node to the file graph and marks which files are modules
|
||||
%
|
||||
% main side-effect facts like edge( F0-Mod:File )
|
||||
% exported( F-M , N/A ) ou exported(F- M. Op ),
|
||||
% module_on ( M, File )
|
||||
% pred ( M :N/A )
|
||||
%
|
||||
build_graph(F, Mod) :-
|
||||
% writeln(F),
|
||||
preprocess_file( F, PF ),
|
||||
catch( open(PF, read, S, [scripting(true)]), _, fail ),
|
||||
repeat,
|
||||
nb_getval( current_module, MR ),
|
||||
catch(read_term( S, T, [term_position(Pos),module(MR),comments(Cs)] ), Throw, (writeln(Throw))),
|
||||
(
|
||||
T == end_of_file
|
||||
->
|
||||
!,
|
||||
% also, clo ops defined in the module M, if M \= Mod
|
||||
% ( sub_atom(F,_,_,_,'/matrix.yap') -> start_low_level_trace ; nospyall ),
|
||||
close(S)
|
||||
;
|
||||
stream_position_data( line_count, Pos, Line ),
|
||||
maplist( comment, Cs ),
|
||||
nb_setval( line, Line ),
|
||||
nb_getval( current_module, MC0 ),
|
||||
( Mod == prolog -> MC = prolog ; MC = MC0 ),
|
||||
get_graph( T, F, Pos, MC ),
|
||||
fail
|
||||
).
|
||||
|
||||
|
||||
get_graph( V , _F, _Pos, _M ) :-
|
||||
var( V ),
|
||||
!,
|
||||
error( instantiation_error ).
|
||||
get_graph( T, _F, _Pos, _M0 ) :-
|
||||
var(T),
|
||||
!.
|
||||
get_graph( M:T, F, _Pos, _M0 ) :- !,
|
||||
get_graph( T, F, _Pos, M ).
|
||||
get_graph( ( M:H :- B), F, _Pos, M0 ) :-
|
||||
!,
|
||||
get_graph( (H :- M0:B), F, _Pos, M ).
|
||||
get_graph( ( M:H --> B), F, _Pos, M0 ) :-
|
||||
!,
|
||||
get_graph( ( H --> M0:B), F, _Pos, M ).
|
||||
get_graph( ( A, _ --> B), F, _Pos, M ) :-
|
||||
get_graph( ( A --> B), F, _Pos, M ).
|
||||
get_graph( (H --> B), F, _Pos, M ) :-
|
||||
!,
|
||||
functor( H, N, Ar),
|
||||
Ar2 is Ar+2,
|
||||
add_deps( B, M, M:N/Ar2, F, _Pos, 2 ).
|
||||
get_graph( (H :- B), F, _Pos, M ) :-
|
||||
!,
|
||||
functor( H, N, Ar),
|
||||
add_deps( B, M, M:N/Ar, F, _Pos, 0 ).
|
||||
%% switches to new file n
|
||||
get_graph( (:-include( Fs ) ), F, _Pos, M ) :-
|
||||
!,
|
||||
source_graphs( M, F, Fs ).
|
||||
get_graph( (?- _ ), _F, _Pos, _M ) :- !.
|
||||
get_graph( (:- _ ), _F, _Pos, _M ) :- !.
|
||||
|
||||
source_graphs( M, F, Fs ) :-
|
||||
maplist( source_graph( M, F ), Fs ), !.
|
||||
source_graphs( M, F, Fs ) :-
|
||||
search_file( Fs, F, pl, NF ),
|
||||
build_graph( NF , M ), !.
|
||||
|
||||
add_deps(V, _M, _P, _F, _Pos, _) :-
|
||||
var(V), !.
|
||||
add_deps(M1:G, _M, _P, _F, _Pos,L) :-
|
||||
!,
|
||||
always_strip_module(M1:G, M2, G2),
|
||||
add_deps(G2, M2, _P, _F, _Pos, L).
|
||||
add_deps((A,B), M, P, F, _Pos, L) :-
|
||||
!,
|
||||
add_deps(A, M, P, F, _Pos, L),
|
||||
add_deps(B, M, P, F, _Pos, L).
|
||||
add_deps((A;B), M, P, F, _Pos, L) :- !,
|
||||
add_deps(A, M, P, F, _Pos, L),
|
||||
add_deps(B, M, P, F, _Pos, L).
|
||||
add_deps((A|B), M, P, F, _Pos, L) :- !,
|
||||
add_deps(A, M, P, F, _Pos, L),
|
||||
add_deps(B, M, P, F, _Pos, L).
|
||||
add_deps((A->B), M, P, F, _Pos, L) :- !,
|
||||
add_deps(A, M, P, F, _Pos, L),
|
||||
add_deps(B, M, P, F, _Pos, L).
|
||||
add_deps((A*->B), M, P, F, _Pos, L) :- !,
|
||||
add_deps(A, M, P, F, _Pos, L),
|
||||
add_deps(B, M, P, F, _Pos, L).
|
||||
add_deps(once(A), M, P, F, _Pos, L) :- !,
|
||||
add_deps(A, M, P, F, _Pos, L).
|
||||
add_deps({A}, M, P, F, _Pos, 2) :- !,
|
||||
add_deps(A, M, P, F, _Pos, 0).
|
||||
add_deps([_|_], M, P, F, Pos, 2) :-
|
||||
!,
|
||||
put_dep( (F-M:P :- prolog:'C'/3 ), Pos ).
|
||||
add_deps(String, _M, _P, _F, _Pos, _) :- string(String), !.
|
||||
add_deps([], _M, _P, _F, _Pos, 2) :- !.
|
||||
add_deps(!, _M, _P, _F, _Pos, _) :- !.
|
||||
add_deps(true, _M, _P, _F, _Pos, 0) :- !.
|
||||
add_deps(false, _M, _P, _F, _Pos, 0) :- !.
|
||||
add_deps(fail, _M, _P, _F, _Pos, 0) :- !.
|
||||
add_deps(repeat, _M, _P, _F, _Pos, 0) :- !.
|
||||
add_deps(A, M, P, F, Pos, L) :-
|
||||
% we're home, M:N/Ar -> P=M1:N1/A1
|
||||
functor(A, N, Ar0),
|
||||
Ar is Ar0+L,
|
||||
put_dep( ( F-M:P :- F-M:N/Ar ), Pos ).
|
||||
|
||||
put_dep( (Target :- F0-M:Goal ), Pos ) :-
|
||||
exported( ( F0-M:Goal :- F1-M1:N/Ar ) ), !,
|
||||
%follow ancestor chain
|
||||
ancestor( ( F1-M1:N/Ar :- FA-MA:NA/Ar ) ),
|
||||
put_dep( ( Target :- FA-MA:NA/Ar ), Pos ).
|
||||
% the base case, copying from the same module ( but maybe not same file 0.
|
||||
put_dep( ( Target :- _F-M:N/Ar ) , _ ) :-
|
||||
m_exists(M:N/Ar, F0),
|
||||
!,
|
||||
assert_new( edge( ( Target :- F0-M:N/Ar ) ) ).
|
||||
% prolog is visible ( but maybe not same file ).
|
||||
put_dep( ( Target :- _F-_prolog:N/Ar ), _ ) :-
|
||||
m_exists(prolog:N/Ar, F0),
|
||||
!,
|
||||
assert_new( edge( ( Target :- F0-prolog:N/Ar ) ) ).
|
||||
put_dep( ( _Target :- _F-Mod:_N/_Ar ), _Pos) :-
|
||||
var( Mod ), !.
|
||||
put_dep( ( Target :- F-Mod:N/Ar ), Pos) :-
|
||||
atom( Mod ),
|
||||
stream_position_data( line_count, Pos, Line ),
|
||||
assert_new( undef( (Target :- F-Mod:N/Ar ), Line) ).
|
||||
|
||||
ancestor( ( Younger :- Older) ) :-
|
||||
exported( ( Mid :- Older ) ), !,
|
||||
ancestor( ( Younger :- Mid) ).
|
||||
ancestor( (Older :- Older) ).
|
||||
|
||||
m_exists(P, F) :- private( F, P ), !.
|
||||
m_exists(P, F) :- public( F, P ).
|
||||
|
||||
doubles :-
|
||||
node(M, P, F-_, _),
|
||||
node(M1, P, F1-_, _),
|
||||
|
@ -1344,7 +487,9 @@ mkdocs :-
|
|||
close( S2 ),
|
||||
open( 'tmp/groups', write, S3),
|
||||
close( S3 ),
|
||||
open( 'docs/yapdocs.yap', read, S),
|
||||
open( 'tmp/groups.yap', write, S4),
|
||||
close( S4 ),
|
||||
open( 'docs/yapdocs.yap', read, S),
|
||||
repeat,
|
||||
(
|
||||
blanks(S, Comment, Rest)
|
||||
|
@ -1410,7 +555,11 @@ store_comment(Comment) :-
|
|||
|
||||
defgroup -->
|
||||
"/**", % */
|
||||
blanks,
|
||||
blanks_or_stars,
|
||||
"@defgroup".
|
||||
defgroup -->
|
||||
"%%", % */
|
||||
blanks_or_percs,
|
||||
"@defgroup".
|
||||
|
||||
page -->
|
||||
|
@ -1468,11 +617,22 @@ decl(I0, I) -->
|
|||
[_],
|
||||
decl( I0, I).
|
||||
|
||||
blanks --> " ", !, blanks.
|
||||
blanks --> "\t", !, blanks.
|
||||
blanks --> [].
|
||||
skip_early_comment(C) -->
|
||||
[C], !,
|
||||
skip_early_comment(C).
|
||||
skip_early_comment(C) -->
|
||||
( " " ; "\t" ; "\n" ), !,
|
||||
skip_early_comment(C).
|
||||
skip_early_comment(C) -->
|
||||
"@" ( "{" ; "}" ), !,
|
||||
skip_early_comment(C).
|
||||
skip_early_comment(_) --> [].
|
||||
|
||||
atom([A|As]) -->
|
||||
blanks --> " ", !, blanks.
|
||||
blanks --> "\t", !, blanks.
|
||||
blanks --> [].
|
||||
|
||||
atom([A|As]) -->
|
||||
[A],
|
||||
{ A >= "a", A =< "z" },
|
||||
atom2( As ).
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
all:
|
||||
python code-generator.py
|
||||
|
||||
clean:
|
||||
-rm -f *~ *.pyc
|
|
@ -1,36 +0,0 @@
|
|||
GECODEDIR := $(shell g++ $(CPPFLAGS) $(CXXFLAGS) -H -E gecodedir.hh 2>&1 >/dev/null | grep gecode/kernel.hh | awk '{print $$2}' | sed 's|/kernel.hh||')
|
||||
GECODECONFIG := $(GECODEDIR)/support/config.hpp
|
||||
GECODEVERSION := $(shell cat $(GECODECONFIG) | egrep '\<GECODE_VERSION\>' | awk '{print $$3}' | sed 's/"//g')
|
||||
PROTOTYPES = ../gecode-prototypes-$(GECODEVERSION).hh
|
||||
ENUMS = ../gecode-enums-$(GECODEVERSION).py
|
||||
|
||||
all: $(PROTOTYPES) $(ENUMS)
|
||||
|
||||
$(PROTOTYPES): % : xml/namespaceGecode.xml extract-prototypes.xsl
|
||||
cat notice.hh > $@ || { rm -f $@; exit 1; }
|
||||
xsltproc extract-prototypes.xsl $< \
|
||||
| grep EXPORT \
|
||||
| grep -v Symmetry \
|
||||
| sed 's/Gecode:://g' \
|
||||
| sed 's/< /</g' \
|
||||
| sed 's/ >/>/g' \
|
||||
| sed 's/ \&/\&/g' \
|
||||
| sed 's/, /,/g' \
|
||||
| sed 's/forceinline //g' \
|
||||
| sed 's/GECODE_INT_EXPORT //g' \
|
||||
| sed 's/GECODE_FLOAT_EXPORT //g' \
|
||||
| sed 's/GECODE_SET_EXPORT //g' \
|
||||
| grep -v '*' | sort >> $@ || { rm -f $@; exit 1; }
|
||||
|
||||
$(ENUMS): % : xml/namespaceGecode.xml extract-enums.xsl
|
||||
cat notice.py > $@ || { rm -f $@; exit 1; }
|
||||
xsltproc extract-enums.xsl $< >> $@ || { rm -f $@; exit 1; }
|
||||
|
||||
xml/namespaceGecode.xml: Doxyfile
|
||||
doxygen Doxyfile
|
||||
|
||||
Doxyfile: Doxyfile.in
|
||||
cat $< | sed "s#@GECODEDIR@#$(GECODEDIR)#" > $@ || { rm -f $@; exit 1; }
|
||||
|
||||
clean:
|
||||
-rm -rf *~ gecode-prototypes-*.hh gecode-enums-*.py Doxyfile xml
|
|
@ -1 +1 @@
|
|||
Subproject commit 9972458293415b2d72276bd67875767bfeed00df
|
||||
Subproject commit d0d1ee4d58373cc611676103e0a50a3ae451a023
|
Reference in New Issue