Merge branch 'master' of ssh://git.dcc.fc.up.pt/yap-6.3
This commit is contained in:
commit
2db0b9d6a6
69
C/absmi.c
69
C/absmi.c
@ -501,7 +501,8 @@
|
||||
We next discuss several issues on trying to make Prolog programs run
|
||||
fast in YAP. We assume two different programming styles:
|
||||
|
||||
+ Execution of <em>deterministic</em> programs often
|
||||
+ Execution of <em>deterministic</em> programs ofte
|
||||
n
|
||||
boils down to a recursive loop of the form:
|
||||
|
||||
~~~~~
|
||||
@ -516,11 +517,30 @@ loop(Env) :-
|
||||
#define IN_ABSMI_C 1
|
||||
#define HAS_CACHE_REGS 1
|
||||
|
||||
|
||||
|
||||
#include "absmi.h"
|
||||
#include "heapgc.h"
|
||||
|
||||
#include "cut_c.h"
|
||||
|
||||
#if YAP_JIT
|
||||
#include "IsGround.h"
|
||||
|
||||
NativeContext *NativeArea;
|
||||
IntermediatecodeContext *IntermediatecodeArea;
|
||||
|
||||
CELL l;
|
||||
|
||||
CELL nnexec;
|
||||
|
||||
static Int traced_absmi(void)
|
||||
{
|
||||
return Yap_traced_absmi();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef PUSH_X
|
||||
#else
|
||||
|
||||
@ -537,31 +557,6 @@ Term Yap_XREGS[MaxTemps]; /* 29 */
|
||||
//#include "sprint_op.hpp"
|
||||
//#include "print_op.hpp"
|
||||
|
||||
#if YAP_JIT
|
||||
#include "IsGround.h"
|
||||
#include "yaam_macros.hpp"
|
||||
#include "fprintblock.h"
|
||||
|
||||
#if YAP_DBG_PREDS
|
||||
#include "debug_printers.h"
|
||||
#endif
|
||||
|
||||
struct JIT_Compiler *J;
|
||||
|
||||
NativeContext *NativeArea;
|
||||
IntermediatecodeContext *IntermediatecodeArea;
|
||||
void shutdown_llvm(void);
|
||||
|
||||
CELL l;
|
||||
short global;
|
||||
CELL nnexec;
|
||||
yamop* HEADPREG;
|
||||
CELL BLOCK;
|
||||
CELL BLOCKADDRESS;
|
||||
CELL FAILED;
|
||||
|
||||
#endif /* YAP_JIT */
|
||||
|
||||
#ifdef COROUTINING
|
||||
/*
|
||||
Imagine we are interrupting the execution, say, because we have a spy
|
||||
@ -1588,10 +1583,6 @@ Yap_absmi(int inp)
|
||||
#define I_R (XREGS[0])
|
||||
|
||||
#if YAP_JIT
|
||||
#if YAP_STAT_PREDS
|
||||
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 };
|
||||
curtrace = NULL;
|
||||
curpreg = NULL;
|
||||
@ -1638,7 +1629,8 @@ Yap_absmi(int inp)
|
||||
};
|
||||
|
||||
#if YAP_JIT
|
||||
ExpEnv.config_struc.TOTAL_OF_OPCODES = sizeof(OpAddress)/(2*sizeof(void*));
|
||||
ExpEnv.config_struc.TOTAL_OF_OPCODES =
|
||||
sizeof(OpAddress)/(2*sizeof(void*));
|
||||
#endif
|
||||
|
||||
#endif /* USE_THREADED_CODE */
|
||||
@ -1693,6 +1685,9 @@ Yap_absmi(int inp)
|
||||
/* absmadr */
|
||||
if (inp > 0) {
|
||||
Yap_ABSMI_OPCODES = OpAddress;
|
||||
#if YAP_JIT
|
||||
Yap_ABSMI_ControlLabels = control_labels;
|
||||
#endif
|
||||
#if BP_FREE
|
||||
P1REG = PCBACKUP;
|
||||
#endif
|
||||
@ -1819,16 +1814,6 @@ Yap_absmi(int inp)
|
||||
// so that they are easier to analyse.
|
||||
#include "absmi_insts.h"
|
||||
|
||||
#if YAP_JIT
|
||||
#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
|
||||
default:
|
||||
@ -1850,8 +1835,6 @@ Yap_absmi(int inp)
|
||||
|
||||
return (0);
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* dummy function that is needed for profiler */
|
||||
|
@ -55,7 +55,8 @@ BOp(Ystop, l);
|
||||
fprintf(stderr, "%s", (char*)ExpEnv.debug_struc.pprint_me.criticals);
|
||||
}
|
||||
#endif
|
||||
goto critical_lbl;
|
||||
traced_absmi();
|
||||
|
||||
}
|
||||
#if YAP_DBG_PREDS
|
||||
print_main_when_head(PREG, ON_INTERPRETER);
|
||||
|
@ -388,7 +388,8 @@ Yap_FullLookupAtom(const char *atom)
|
||||
}
|
||||
|
||||
void
|
||||
Yap_LookupAtomWithAddress(const char *atom, AtomEntry *ae)
|
||||
Yap_LookupAtomWithAddress(const char *atom,
|
||||
AtomEntry *ae)
|
||||
{ /* lookup atom in atom table */
|
||||
register CELL hash;
|
||||
register unsigned char *p;
|
||||
|
67
C/init.c
67
C/init.c
@ -93,6 +93,8 @@ int Yap_page_size;
|
||||
#if USE_THREADED_CODE
|
||||
/* easy access to instruction opcodes */
|
||||
void **Yap_ABSMI_OPCODES;
|
||||
void **Yap_ABSMI_ControlLabels;
|
||||
|
||||
#endif
|
||||
|
||||
#if DEBUG
|
||||
@ -591,6 +593,54 @@ Yap_InitCPred(const char *Name, UInt Arity, CPredicate code, pred_flags_t flags)
|
||||
pe->OpcodeOfPred = pe->CodeOfPred->opc;
|
||||
}
|
||||
|
||||
bool
|
||||
Yap_AddCallToFli( PredEntry *pe, CPredicate call )
|
||||
{
|
||||
yamop *p_code;
|
||||
|
||||
if (pe->PredFlags & BackCPredFlag) {
|
||||
p_code = (yamop *)(pe->cs.p_code.FirstClause);
|
||||
p_code->y_u.OtapFs.f = call;
|
||||
return true;
|
||||
} else if (pe->PredFlags & CPredFlag) {
|
||||
pe->cs.f_code = call;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
Yap_AddRetryToFli( PredEntry *pe, CPredicate re )
|
||||
{
|
||||
yamop *p_code;
|
||||
|
||||
if (pe->PredFlags & BackCPredFlag) {
|
||||
p_code = (yamop *)(pe->cs.p_code.FirstClause);
|
||||
p_code = NEXTOP(p_code,OtapFs);
|
||||
p_code->y_u.OtapFs.f = re;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
Yap_AddCutToFli( PredEntry *pe, CPredicate CUT )
|
||||
{
|
||||
yamop *p_code;
|
||||
|
||||
if (pe->PredFlags & BackCPredFlag) {
|
||||
p_code = (yamop *)(pe->cs.p_code.FirstClause);
|
||||
p_code = NEXTOP(p_code,OtapFs);
|
||||
p_code = NEXTOP(p_code,OtapFs);
|
||||
p_code->y_u.OtapFs.f = CUT;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Yap_InitCmpPred(const char *Name, UInt Arity, CmpPredicate cmp_code, pred_flags_t flags)
|
||||
{
|
||||
@ -1080,21 +1130,12 @@ InitAtoms(void)
|
||||
HashChain[i].Entry = NIL;
|
||||
}
|
||||
NOfAtoms = 0;
|
||||
#if THREADS
|
||||
SF_STORE->AtFoundVar = Yap_LookupAtom("**");
|
||||
Yap_LookupAtomWithAddress("**",(AtomEntry *)&(SF_STORE->AtFoundVar));
|
||||
Yap_ReleaseAtom(AtomFoundVar);
|
||||
SF_STORE->AtFreeTerm = Yap_LookupAtom("?");
|
||||
Yap_LookupAtomWithAddress("?",(AtomEntry *)&(SF_STORE->AtFreeTerm));
|
||||
Yap_ReleaseAtom(AtomFreeTerm);
|
||||
SF_STORE->AtNil = Yap_LookupAtom("[]");
|
||||
SF_STORE->AtDot = Yap_LookupAtom(".");
|
||||
#else
|
||||
Yap_LookupAtomWithAddress("**",&(SF_STORE->AtFoundVar));
|
||||
Yap_ReleaseAtom(AtomFoundVar);
|
||||
Yap_LookupAtomWithAddress("?",&(SF_STORE->AtFreeTerm));
|
||||
Yap_ReleaseAtom(AtomFreeTerm);
|
||||
Yap_LookupAtomWithAddress("[]",&(SF_STORE->AtNil));
|
||||
Yap_LookupAtomWithAddress(".",&(SF_STORE->AtDot));
|
||||
#endif
|
||||
Yap_LookupAtomWithAddress("[]",(AtomEntry *)&(SF_STORE->AtNil));
|
||||
Yap_LookupAtomWithAddress(".",(AtomEntry *)&(SF_STORE->AtDot));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -342,8 +342,9 @@ static Int p_set_yap_flags(USES_REGS1);
|
||||
static Int p_break(USES_REGS1);
|
||||
|
||||
#if YAP_JIT
|
||||
void* (*Yap_JitCall)(struct JIT_Compiler* jc, yamop* p);
|
||||
void* (*Yap_JitCall)(JIT_Compiler* jc, yamop* p);
|
||||
void (* Yap_llvmShutdown)(void ) ;
|
||||
Int (* Yap_traced_absmi)(void ) ;
|
||||
|
||||
Environment ExpEnv;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1267,8 +1267,14 @@ Yap_ImportTerm(char * buf) {
|
||||
tret = MkAtomTerm(addAtom(NULL,(char *)(bc+3)));
|
||||
return tret;
|
||||
}
|
||||
if (HR + sz > ASP)
|
||||
return (Term)0;
|
||||
// call the gc/stack shifter mechanism
|
||||
// if not enough stack available
|
||||
while (HR + sz > ASP - 4096) {
|
||||
if (!Yap_gcl( (sz+4096)*sizeof(CELL), PP->ArityOfPE, ENV, gc_P(P,CP))) {
|
||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
memcpy(HR, buf+bc[0], sizeof(CELL)*sz);
|
||||
if (IsApplTerm(tinp)) {
|
||||
tret = AbsAppl(HR);
|
||||
|
@ -141,6 +141,7 @@ endif()
|
||||
# Model Specific
|
||||
if (HAVE_GCC)
|
||||
set_property( DIRECTORY APPEND_STRING PROPERTY COMPILE_OPTIONS -Wall;-Wstrict-prototypes;-Wmissing-prototypes )
|
||||
set_property( DIRECTORY APPEND_STRING PROPERTY COMPILE_OPTIONS -fexceptions )
|
||||
endif()
|
||||
|
||||
message(STATUS "Original CMAKE_C_FLAGS ${CMAKE_C_FLAGS}")
|
||||
|
96
CXX/yapa.hh
Normal file
96
CXX/yapa.hh
Normal file
@ -0,0 +1,96 @@
|
||||
#ifndef YAPA_HH
|
||||
#define YAPA_HH 1
|
||||
|
||||
/**
|
||||
Prolog operates over constants, called atoms
|
||||
YAP, like lisp, associates properties with atoms.
|
||||
*/
|
||||
enum PropTag {
|
||||
/// predicate
|
||||
PRED_TAG = PEProp, // 0x0000,
|
||||
/// db key, may be associated with a functor
|
||||
DB_TAG = DBProperty, // 0x8000,
|
||||
/// generic functor, may include sub-properties
|
||||
FUNCTOR_TAG = FunctorProperty, // 0xBB00,
|
||||
// SPARSE_FUNCTOR_TAG = 0xFFDF,
|
||||
/// arithmetic function
|
||||
ARITHMETIC_PROPERTY_TAG = ExpProperty, // 0xFFE3,
|
||||
/// map the atom to an integer
|
||||
TRANSLATION_TAG = TranslationProperty, // 0xFFF4,
|
||||
/// SWI-STYLE ATOM Extension
|
||||
BLOB_TAG = BlobProperty, // 0xFFF5,
|
||||
/// named mutEX
|
||||
MUTEX_TAG = MutexProperty, // 0xFFF6,
|
||||
/// A typed array, may be in-db or in-stack deped
|
||||
ARRAY_TAG = ArrayProperty, // 0xFFF7,
|
||||
/// atom does not fit ISO-LATIN-1
|
||||
WIDE_TAG = WideAtomProperty, // 0xFFF8,
|
||||
/// module
|
||||
MODULE_TAG = ModProperty, // 0xFFFA,
|
||||
/// the original SICStus blackboard
|
||||
BLACKBOARD_TAG = BBProperty, // 0xFFFB,
|
||||
/// asociate an atomic value with the atom
|
||||
VALUE_TAG = ValProperty, // 0xFFFC,
|
||||
/// Demoen's proposal for gkobal variables
|
||||
GLOBAL_VAR_TAG = GlobalProperty, // 0xFFFD
|
||||
/// ensure the atom may not be garbafe colected
|
||||
HOLD_TAG = HoldProperty, // 0xFFF
|
||||
/// Prolog operator,
|
||||
OPERATOR_TAG = OpProperty, // 0xFFFF,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Atom
|
||||
* A YAP data-base is a collection of atoms, where each atom has a name
|
||||
* and a set of Properties. Examples of properties include functors,
|
||||
* predicates, operators, modules, almost everything.
|
||||
*
|
||||
*/
|
||||
class YAPAtom {
|
||||
friend class YAPModuleProp;
|
||||
friend class YAPPredicate;
|
||||
friend class YAPFunctor;
|
||||
friend class YAPAtomTerm;
|
||||
friend class YAProp;
|
||||
friend class YAPModule;
|
||||
Atom a;
|
||||
/// construct new YAPAtom from Atom
|
||||
YAPAtom( Atom at ) { a = at; }
|
||||
public:
|
||||
/// construct new YAPAtom from string
|
||||
YAPAtom( const char * s) { a = Yap_LookupAtom( s ); }
|
||||
/// construct new YAPAtom from wide string
|
||||
YAPAtom( const wchar_t * s) { a = Yap_LookupMaybeWideAtom( s ); }
|
||||
/// construct new YAPAtom from max-length string
|
||||
YAPAtom( const char * s, size_t len) { a = Yap_LookupAtomWithLength( s, len ); }
|
||||
/// construct new YAPAtom from max-length wide string
|
||||
YAPAtom( const wchar_t * s, size_t len) { a = Yap_LookupMaybeWideAtomWithLength( s, len ); }
|
||||
/// get name of atom
|
||||
char *getName(void);
|
||||
/// get prop of type
|
||||
Prop getProp( PropTag tag ) { return Yap_GetAProp( a , (PropFlags)tag ); }
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Prop
|
||||
* A YAP Propery is ameta-class for everything one can in a atom.
|
||||
* Examples of properties include functors,
|
||||
* predicates, operators, modules, almost everything.
|
||||
*
|
||||
*/
|
||||
class YAPProp {
|
||||
friend class YAPModuleProp;
|
||||
friend class YAPFunctor;
|
||||
/// does nothing, p is defined by the subclass
|
||||
YAPProp() { }
|
||||
/// get type of prop
|
||||
PropTag tag( Prop p ) { return (PropTag)(p->KindOfPE); }
|
||||
public:
|
||||
/// get name of property
|
||||
virtual YAPAtom name() = 0;
|
||||
virtual ~YAPProp() {};
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif /* YAPA_HH */
|
318
CXX/yapdb.hh
Normal file
318
CXX/yapdb.hh
Normal file
@ -0,0 +1,318 @@
|
||||
|
||||
#define YAP_CPP_DB_INTERFACE 1
|
||||
|
||||
//! @{
|
||||
|
||||
/**
|
||||
*
|
||||
* @defgroup yap-cplus-db-interface Data-Base Component of YAP interface.
|
||||
*
|
||||
* @ingroup yap-cplus-interface
|
||||
* @tableofcontents
|
||||
*
|
||||
*
|
||||
* Data-base component of C++ interface to YAP. It manipulates sets of
|
||||
* atoms, each one containing a number of props.
|
||||
*/
|
||||
|
||||
class YAPTerm;
|
||||
|
||||
class YAPError;
|
||||
|
||||
class YAPModule;
|
||||
|
||||
extern "C" {
|
||||
static inline Term
|
||||
Yap_CurrentModule( void )
|
||||
{
|
||||
CACHE_REGS
|
||||
return CurrentModule;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief YAPModule
|
||||
* A YAPModule describes a bare module, which in YAP is just a name.
|
||||
*
|
||||
* Info about the module is in YAPModuleProp
|
||||
*
|
||||
*/
|
||||
class YAPModule : protected YAPAtomTerm {
|
||||
friend class YAPPredicate;
|
||||
YAPModule( Term t ): YAPAtomTerm( t ) {};
|
||||
Term t() { return gt(); }
|
||||
public:
|
||||
~YAPModule( ) {};
|
||||
YAPModule( ): YAPAtomTerm( Yap_CurrentModule() ) {};
|
||||
YAPModule( YAPAtom t ): YAPAtomTerm( t ) {};
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief YAPModuleProp
|
||||
* A YAPModuleProp controls access to a module property.
|
||||
*
|
||||
*/
|
||||
class YAPModuleProp: public YAPProp {
|
||||
friend class YAPPredicate;
|
||||
ModEntry *m;
|
||||
|
||||
YAPModuleProp(ModEntry *mod) {m = mod;};
|
||||
YAPModuleProp(Term tmod) { m = Yap_GetModuleEntry(tmod); };
|
||||
public:
|
||||
YAPModuleProp() { m = Yap_GetModuleEntry(Yap_CurrentModule()); };
|
||||
YAPModuleProp(YAPModule tmod) ;
|
||||
virtual YAPModule module() { return YAPModule(m->AtomOfME); };
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief YAPFunctor represents Prolog functors Name/Arity
|
||||
*/
|
||||
class YAPFunctor: public YAPProp {
|
||||
friend class YAPApplTerm;
|
||||
friend class YAPPredicate;
|
||||
Functor f;
|
||||
/// Constructor: receives Prolog functor and casts it to YAPFunctor
|
||||
///
|
||||
/// Notice that this is designed for internal use only.
|
||||
YAPFunctor( Functor ff) { f = ff; }
|
||||
public:
|
||||
~YAPFunctor( ) { };
|
||||
/// Constructor: receives name as a string plus arity
|
||||
///
|
||||
/// Notice that this is designed for ISO-LATIN-1 right now
|
||||
YAPFunctor( char * s, arity_t arity) { f = Yap_MkFunctor( Yap_LookupAtom( s ), arity ); }
|
||||
/// Constructor: receives name as a wide string plus arity
|
||||
///
|
||||
/// Notice that this is designed for UNICODE right now
|
||||
YAPFunctor( wchar_t * s, arity_t arity) { f = Yap_MkFunctor( Yap_LookupWideAtom( s ), arity ) ; }
|
||||
/// Constructor: receives name as an atom, plus arity
|
||||
///
|
||||
/// This is the default method, and the most popi;at
|
||||
YAPFunctor( YAPAtom at, arity_t arity) { f = Yap_MkFunctor( at.a, arity ); }
|
||||
|
||||
/// Getter: extract name of functor as an atom
|
||||
///
|
||||
/// this is for external usage.
|
||||
YAPAtom name(void) {
|
||||
return YAPAtom( NameOfFunctor( f ) );
|
||||
}
|
||||
|
||||
/// Getter: extract arity of functor as an unsigned integer
|
||||
///
|
||||
/// this is for external usage.
|
||||
arity_t arity(void) {
|
||||
return ArityOfFunctor( f );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Predicates
|
||||
*
|
||||
* This class interfaces with PredEntry in Yatom.
|
||||
*/
|
||||
class YAPPredicate: public YAPModuleProp {
|
||||
friend class YAPQuery;
|
||||
|
||||
protected:
|
||||
PredEntry *ap;
|
||||
|
||||
/// auxiliary routine to find a predicate in the current module.
|
||||
PredEntry *getPred( Term t, Term* &outp ) ;
|
||||
|
||||
/// String constructor for predicates
|
||||
///
|
||||
/// It also communicates the array of arguments t[]
|
||||
/// and the array of variables
|
||||
/// back to yapquery
|
||||
YAPPredicate(const char *s, Term* &out, Term& vnames ) throw (int);
|
||||
|
||||
/// Term constructor for predicates
|
||||
///
|
||||
/// It is just a call to getPred
|
||||
inline YAPPredicate(Term t) {
|
||||
CELL * v = NULL;
|
||||
ap = getPred( t , v );
|
||||
}
|
||||
|
||||
/// Cast constructor for predicates,
|
||||
/// if we have the implementation data.
|
||||
///
|
||||
inline YAPPredicate(PredEntry *pe) {
|
||||
ap = pe;
|
||||
}
|
||||
|
||||
public:
|
||||
~YAPPredicate() {};
|
||||
|
||||
/// Functor constructor for predicates
|
||||
///
|
||||
/// Asssumes that we use the current module.
|
||||
YAPPredicate(YAPFunctor f) {
|
||||
ap = RepPredProp(PredPropByFunc(f.f,Yap_CurrentModule()));
|
||||
};
|
||||
|
||||
/// Functor constructor for predicates, is given a specific module.
|
||||
///
|
||||
inline YAPPredicate(YAPFunctor f, YAPTerm mod) {
|
||||
ap = RepPredProp(PredPropByFunc(f.f,mod.t));
|
||||
}
|
||||
|
||||
/// Name/arity constructor for predicates.
|
||||
///
|
||||
inline YAPPredicate(YAPAtom at, YAPTerm mod) {
|
||||
ap = RepPredProp(PredPropByAtom(at.a,mod.t));
|
||||
}
|
||||
|
||||
|
||||
/// Name/0 constructor for predicates.
|
||||
///
|
||||
YAPPredicate(YAPAtom at);
|
||||
|
||||
/// Mod:Name/Arity constructor for predicates.
|
||||
///
|
||||
inline YAPPredicate(YAPAtom at, arity_t arity, YAPModule mod) {
|
||||
if (arity) {
|
||||
Functor f = Yap_MkFunctor(at.a, arity);
|
||||
ap = RepPredProp(PredPropByFunc(f,mod.t()));
|
||||
} else {
|
||||
ap = RepPredProp(PredPropByAtom(at.a,mod.t()));
|
||||
}
|
||||
}
|
||||
|
||||
/// Atom/Arity constructor for predicates.
|
||||
///
|
||||
YAPPredicate(YAPAtom at, arity_t arity);
|
||||
|
||||
|
||||
/// String constructor for predicates.
|
||||
///
|
||||
/// String is a Prolog term, we extract the main functor after considering the module qualifiers.
|
||||
inline YAPPredicate(const char *s) throw (int) {
|
||||
Term t, tp;
|
||||
t = YAP_ReadBuffer(s,&tp);
|
||||
if (t == 0L)
|
||||
throw YAPError::YAP_SYNTAX_ERROR;
|
||||
CELL * v;
|
||||
ap = getPred( t, v);
|
||||
}
|
||||
|
||||
|
||||
/// String constructor for predicates, also keeps arguments in tp[]
|
||||
///
|
||||
/// String is a Prolog term, we extract the main functor after considering the module qualifiers.
|
||||
inline YAPPredicate(const char *s, Term* outp) throw (int) {
|
||||
Term t, tp;
|
||||
t = YAP_ReadBuffer(s,&tp);
|
||||
if (t == 0L)
|
||||
throw YAPError::YAP_SYNTAX_ERROR;
|
||||
ap = getPred( t, outp );
|
||||
}
|
||||
|
||||
/// module of a predicate
|
||||
///
|
||||
/// notice that modules are currently treated as atoms, this should change.
|
||||
YAPModule module() {
|
||||
if (ap->ModuleOfPred == PROLOG_MODULE)
|
||||
return YAPModule(AtomProlog);
|
||||
else
|
||||
return YAPModule(AtomOfTerm(ap->ModuleOfPred));
|
||||
}
|
||||
|
||||
/// name of predicate
|
||||
///
|
||||
/// notice that we return the atom, not a string.
|
||||
YAPAtom name() { if (ap->ArityOfPE)
|
||||
return YAPAtom((Atom)ap->FunctorOfPred);
|
||||
else
|
||||
return YAPAtom(NameOfFunctor(ap->FunctorOfPred));
|
||||
}
|
||||
|
||||
/// arity of predicate
|
||||
///
|
||||
/// we return a positive number.
|
||||
arity_t getArity() { return ap->ArityOfPE; }
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief PrologPredicate
|
||||
*
|
||||
* This class interfaces with Predicates Implemented in Prolog.
|
||||
*/
|
||||
class YAPPrologPredicate: public YAPPredicate {
|
||||
public:
|
||||
YAPPrologPredicate(YAPAtom name,
|
||||
arity_t arity,
|
||||
YAPModule module = YAPModule(),
|
||||
bool tabled = false,
|
||||
bool logical_updates = false,
|
||||
bool local = false,
|
||||
bool sourced = true,
|
||||
bool discontiguous = false,
|
||||
bool multiFile = false,
|
||||
bool hidden = false,
|
||||
bool untraceable = false,
|
||||
bool unspyable = false,
|
||||
bool meta = false,
|
||||
bool sync = false,
|
||||
bool quasi_quotable = false,
|
||||
size_t mega_clause = 0
|
||||
);
|
||||
void *assertClause( YAPTerm clause, bool last=true, YAPTerm source= YAPTerm(TermNil));
|
||||
void *retractClause( YAPTerm skeleton, bool all=false);
|
||||
void *clause( YAPTerm skeleton, YAPTerm &body );
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief PrologPredicate
|
||||
*
|
||||
* This class interfaces with Predicates Implemented in Prolog.
|
||||
*/
|
||||
class YAPFLIP: public YAPPredicate {
|
||||
public:
|
||||
YAPFLIP(CPredicate call,
|
||||
YAPAtom name,
|
||||
arity_t arity,
|
||||
YAPModule module = YAPModule(),
|
||||
CPredicate retry = 0,
|
||||
CPredicate cut = 0,
|
||||
size_t extra = 0,
|
||||
bool test = false
|
||||
) : YAPPredicate( name, arity, module) {
|
||||
if (retry) {
|
||||
Yap_InitCPredBackCut(name.getName(), arity, extra, call, retry, cut, UserCPredFlag);
|
||||
} else {
|
||||
if (test) {
|
||||
YAP_UserCPredicate (name.getName(),
|
||||
call, arity);
|
||||
} else {
|
||||
YAP_UserCPredicate (name.getName(),
|
||||
call, arity);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
YAPFLIP(const char *name,
|
||||
arity_t arity,
|
||||
YAPModule module = YAPModule(),
|
||||
bool backtrackable = false
|
||||
) : YAPPredicate( YAPAtom(name), arity, module) {
|
||||
if (backtrackable) {
|
||||
Yap_InitCPredBackCut(name, arity, 0, 0, 0, 0, UserCPredFlag);
|
||||
} else {
|
||||
YAP_UserCPredicate (name,
|
||||
0, arity);
|
||||
}
|
||||
};
|
||||
bool addCall(CPredicate call) {
|
||||
return Yap_AddCallToFli( ap, call );
|
||||
}
|
||||
bool addRetry(CPredicate call) {
|
||||
return Yap_AddRetryToFli( ap, call );
|
||||
}
|
||||
bool addCut(CPredicate call) {
|
||||
return Yap_AddCutToFli( ap, call );
|
||||
}
|
||||
|
||||
};
|
||||
|
234
CXX/yapi.cpp
234
CXX/yapi.cpp
@ -5,6 +5,7 @@
|
||||
#include "SWI-Stream.h"
|
||||
|
||||
|
||||
|
||||
YAPAtomTerm::YAPAtomTerm(char *s) { // build string
|
||||
BACKUP_H();
|
||||
|
||||
@ -267,7 +268,7 @@ intptr_t YAPTerm::hashTerm(size_t sz, size_t depth, bool variant) {
|
||||
return out;
|
||||
}
|
||||
|
||||
char *YAPTerm::text(void) {
|
||||
char *YAPTerm::text() {
|
||||
size_t sze = 4096, length;
|
||||
char *os;
|
||||
int enc;
|
||||
@ -281,7 +282,7 @@ char *YAPTerm::text(void) {
|
||||
return os;
|
||||
}
|
||||
|
||||
char *YAPQuery::text(void) {
|
||||
char *YAPQuery::text() {
|
||||
size_t sze = 4096, length;
|
||||
char *os;
|
||||
int enc;
|
||||
@ -387,81 +388,18 @@ char *YAPAtom::getName(void) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
YAPPredicate::YAPPredicate(const char *s, Term* &outp, YAPTerm &vnames) throw (int) {
|
||||
CACHE_REGS
|
||||
vnames = Yap_NewSlots(1 PASS_REGS);
|
||||
Term t = Yap_StringToTerm(s, strlen(s)+1, Yap_GetFromSlot( vnames.t PASS_REGS));
|
||||
if (t == 0L)
|
||||
throw YAPError::YAP_SYNTAX_ERROR;
|
||||
ap = getPred( t, outp );
|
||||
}
|
||||
|
||||
YAPPredicate::YAPPredicate(YAPAtom at) {
|
||||
CACHE_REGS
|
||||
ap = RepPredProp(PredPropByAtom(at.a,CurrentModule));
|
||||
}
|
||||
|
||||
YAPPredicate::YAPPredicate(YAPAtom at, arity_t arity) {
|
||||
CACHE_REGS
|
||||
if (arity) {
|
||||
Functor f = Yap_MkFunctor(at.a, arity);
|
||||
ap = RepPredProp(PredPropByFunc(f,CurrentModule));
|
||||
} else {
|
||||
ap = RepPredProp(PredPropByAtom(at.a,CurrentModule));
|
||||
}
|
||||
}
|
||||
|
||||
/// auxiliary routine to find a predicate in the current module.
|
||||
PredEntry *YAPPredicate::getPred( Term t, Term* &outp ) {
|
||||
CACHE_REGS
|
||||
Term m = CurrentModule ;
|
||||
{ CACHE_REGS __android_log_print(ANDROID_LOG_ERROR, __FUNCTION__, "H= %p, outp=%p", HR, outp) ; }
|
||||
t = Yap_StripModule(t, &m);
|
||||
if (IsVarTerm(t) || IsNumTerm(t)) {
|
||||
ap = (PredEntry *)NULL;
|
||||
outp = (Term *)NULL;
|
||||
}
|
||||
if (IsAtomTerm(t)) {
|
||||
ap = RepPredProp(PredPropByAtom(AtomOfTerm(t), m));
|
||||
if (outp) outp = (Term *)NULL;
|
||||
} else if (IsPairTerm(t)) {
|
||||
ap = RepPredProp(PredPropByFunc(FunctorCsult, PROLOG_MODULE));
|
||||
outp = HR;
|
||||
HR[0] = RepPair(t)[0];
|
||||
HR[1] = m;
|
||||
HR+=2;
|
||||
} else {
|
||||
Functor f = FunctorOfTerm(t);
|
||||
if (IsExtensionFunctor(f)) {
|
||||
ap = (PredEntry *)NULL;
|
||||
outp = (Term *)NULL;
|
||||
} else {
|
||||
ap = RepPredProp(PredPropByFunc(f, m));
|
||||
outp = RepAppl(t)+1;
|
||||
}
|
||||
}
|
||||
{ CACHE_REGS __android_log_print(ANDROID_LOG_ERROR, __FUNCTION__, "done H= %p, outp=%p", HR, outp) ; }
|
||||
return ap;
|
||||
}
|
||||
|
||||
YAPPredicate::YAPPredicate(YAPFunctor f) {
|
||||
CACHE_REGS
|
||||
ap = RepPredProp(PredPropByFunc(f.f,CurrentModule));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
YAPQuery::initQuery( Term *ts )
|
||||
{
|
||||
CACHE_REGS
|
||||
|
||||
this->oq = (YAPQuery *)LOCAL_execution;
|
||||
LOCAL_execution = (struct open_query_struct *)this;
|
||||
this->q_open=1;
|
||||
this->q_state=0;
|
||||
this->q_flags = PL_Q_PASS_EXCEPTION;
|
||||
this->q_g = ts;
|
||||
this->q_p = P;
|
||||
this->q_cp = CP;
|
||||
}
|
||||
|
||||
void
|
||||
@ -502,6 +440,7 @@ bool YAPQuery::next()
|
||||
{
|
||||
CACHE_REGS
|
||||
int result;
|
||||
|
||||
if (q_open != 1) return false;
|
||||
if (setjmp(((YAPQuery *)LOCAL_execution)->q_env))
|
||||
return false;
|
||||
@ -549,17 +488,6 @@ void YAPQuery::close()
|
||||
LOCAL_execution = (struct open_query_struct *)this->oq;
|
||||
}
|
||||
|
||||
int YAPPredicate::call(YAPTerm t[])
|
||||
{
|
||||
YAPQuery q = YAPQuery(*this, t);
|
||||
int ret;
|
||||
|
||||
ret = q.next();
|
||||
q.cut();
|
||||
q.close();
|
||||
return ret;
|
||||
}
|
||||
|
||||
static YAPEngine *curren;
|
||||
|
||||
#if __ANDROID__
|
||||
@ -644,3 +572,153 @@ YAPQuery *YAPEngine::query( char *s ) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
YAPPredicate::YAPPredicate(const char *s, Term* &outp, Term &vnames) throw (int) {
|
||||
CACHE_REGS
|
||||
yhandle_t sl = Yap_NewSlots(1 PASS_REGS);
|
||||
Term t = Yap_StringToTerm(s, strlen(s)+1, sl );
|
||||
if (t == 0L)
|
||||
throw YAPError::YAP_SYNTAX_ERROR;
|
||||
vnames = Yap_GetFromSlot( sl PASS_REGS );
|
||||
ap = getPred( t, outp );
|
||||
}
|
||||
|
||||
YAPPredicate::YAPPredicate(YAPAtom at) {
|
||||
CACHE_REGS
|
||||
ap = RepPredProp(PredPropByAtom(at.a,CurrentModule));
|
||||
}
|
||||
|
||||
YAPPredicate::YAPPredicate(YAPAtom at, arity_t arity) {
|
||||
CACHE_REGS
|
||||
if (arity) {
|
||||
Functor f = Yap_MkFunctor(at.a, arity);
|
||||
ap = RepPredProp(PredPropByFunc(f,CurrentModule));
|
||||
} else {
|
||||
ap = RepPredProp(PredPropByAtom(at.a,CurrentModule));
|
||||
}
|
||||
}
|
||||
|
||||
/// auxiliary routine to find a predicate in the current module.
|
||||
PredEntry *YAPPredicate::getPred( Term t, Term* &outp ) {
|
||||
CACHE_REGS
|
||||
Term m = CurrentModule ;
|
||||
{ CACHE_REGS __android_log_print(ANDROID_LOG_ERROR, __FUNCTION__, "H= %p, outp=%p", HR, outp) ; }
|
||||
t = Yap_StripModule(t, &m);
|
||||
if (IsVarTerm(t) || IsNumTerm(t)) {
|
||||
ap = (PredEntry *)NULL;
|
||||
outp = (Term *)NULL;
|
||||
}
|
||||
if (IsAtomTerm(t)) {
|
||||
ap = RepPredProp(PredPropByAtom(AtomOfTerm(t), m));
|
||||
if (outp) outp = (Term *)NULL;
|
||||
} else if (IsPairTerm(t)) {
|
||||
ap = RepPredProp(PredPropByFunc(FunctorCsult, PROLOG_MODULE));
|
||||
outp = HR;
|
||||
HR[0] = RepPair(t)[0];
|
||||
HR[1] = m;
|
||||
HR+=2;
|
||||
} else {
|
||||
Functor f = FunctorOfTerm(t);
|
||||
if (IsExtensionFunctor(f)) {
|
||||
ap = (PredEntry *)NULL;
|
||||
outp = (Term *)NULL;
|
||||
} else {
|
||||
ap = RepPredProp(PredPropByFunc(f, m));
|
||||
outp = RepAppl(t)+1;
|
||||
}
|
||||
}
|
||||
{ CACHE_REGS __android_log_print(ANDROID_LOG_ERROR, __FUNCTION__, "done H= %p, outp=%p", HR, outp) ; }
|
||||
return ap;
|
||||
}
|
||||
|
||||
|
||||
YAPPrologPredicate::YAPPrologPredicate(YAPAtom name,
|
||||
arity_t arity,
|
||||
YAPModule mod,
|
||||
bool tabled,
|
||||
bool logical_updates,
|
||||
bool thread_local,
|
||||
bool sourced,
|
||||
bool discontiguous,
|
||||
bool multiFile,
|
||||
bool hidden,
|
||||
bool untraceable,
|
||||
bool unspyable,
|
||||
bool meta,
|
||||
bool moduleTransparent,
|
||||
bool quasiQuotable,
|
||||
size_t mega_clause
|
||||
) : YAPPredicate(name, arity, mod) {
|
||||
if (!ap) return;
|
||||
if (thread_local) {
|
||||
if (ap->cs.p_code.NOfClauses || tabled)
|
||||
return;
|
||||
ap->PredFlags |= (ThreadLocalPredFlag|LogUpdatePredFlag);
|
||||
} else if (logical_updates) {
|
||||
if (ap->cs.p_code.NOfClauses || tabled)
|
||||
return;
|
||||
ap->PredFlags |= LogUpdatePredFlag;
|
||||
ap->CodeOfPred = FAILCODE;
|
||||
ap->OpcodeOfPred = FAILCODE->opc;
|
||||
}
|
||||
if (tabled) {
|
||||
ap->PredFlags |= TabledPredFlag;
|
||||
if (ap->cs.p_code.NOfClauses || tabled)
|
||||
return;
|
||||
ap->PredFlags |= TabledPredFlag;
|
||||
}
|
||||
if (sourced) {
|
||||
ap->PredFlags |= SourcePredFlag;
|
||||
}
|
||||
if (discontiguous) {
|
||||
ap->PredFlags |= DiscontiguousPredFlag;
|
||||
}
|
||||
if (multiFile) {
|
||||
ap->PredFlags |= MultiFileFlag;
|
||||
}
|
||||
if (hidden) {
|
||||
ap->PredFlags |= HiddenPredFlag;
|
||||
}
|
||||
if (untraceable) {
|
||||
ap->PredFlags |= SourcePredFlag;
|
||||
}
|
||||
if (unspyable) {
|
||||
ap->PredFlags |= NoSpyPredFlag;
|
||||
}
|
||||
if (meta) {
|
||||
ap->PredFlags |= MetaPredFlag;
|
||||
} else if (moduleTransparent) {
|
||||
ap->PredFlags |= ModuleTransparentPredFlag;
|
||||
}
|
||||
if (quasiQuotable) {
|
||||
ap->PredFlags |= QuasiQuotationPredFlag;
|
||||
}
|
||||
if (untraceable) {
|
||||
ap->PredFlags |= SourcePredFlag;
|
||||
}
|
||||
if (hidden) {
|
||||
ap->PredFlags |= SourcePredFlag;
|
||||
}
|
||||
}
|
||||
|
||||
void *YAPPrologPredicate::assertClause( YAPTerm clause, bool last, YAPTerm source) {
|
||||
CACHE_REGS
|
||||
|
||||
Term tt = clause.gt();
|
||||
Term sourcet = source.gt();
|
||||
yamop *codeaddr = Yap_cclause(tt, PP->ArityOfPE, CurrentModule, sourcet); /* vsc: give the number of arguments
|
||||
to cclause in case there is overflow */
|
||||
Term ntt = clause.gt();
|
||||
if (LOCAL_ErrorMessage)
|
||||
return 0;
|
||||
Term *tref = &ntt;
|
||||
if (Yap_addclause(ntt, codeaddr, (last ? 0 : 2), CurrentModule, tref))
|
||||
return tref;
|
||||
return 0;
|
||||
}
|
||||
void* YAPPrologPredicate::retractClause( YAPTerm skeleton, bool all) {
|
||||
return 0;
|
||||
}
|
||||
void* YAPPrologPredicate::clause( YAPTerm skeleton, YAPTerm &body ) {
|
||||
return 0;
|
||||
}
|
||||
|
511
CXX/yapi.hh
511
CXX/yapi.hh
@ -31,14 +31,6 @@
|
||||
extern "C" {
|
||||
|
||||
#include <stddef.h>
|
||||
#ifdef __cplusplus
|
||||
#define old_cplusplus __cplusplus
|
||||
#undef __cplusplus
|
||||
#endif
|
||||
#ifdef old_cplusplus
|
||||
#define __cplusplus old_cplusplus
|
||||
#undef old_cplusplus
|
||||
#endif
|
||||
|
||||
#include "Yap.h"
|
||||
|
||||
@ -60,8 +52,6 @@ extern "C" {
|
||||
|
||||
#include "YapText.h"
|
||||
|
||||
#include "yapie.hh"
|
||||
|
||||
#if HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
@ -88,6 +78,7 @@ extern "C" {
|
||||
// it shouldn't
|
||||
}
|
||||
|
||||
|
||||
//#include <vector>
|
||||
|
||||
|
||||
@ -97,503 +88,19 @@ class YAPFunctor;
|
||||
class YAPApplTerm;
|
||||
class YAPPairTerm;
|
||||
class YAPQuery;
|
||||
class YAPModule;
|
||||
class YAPError;
|
||||
class YAPPredicate;
|
||||
|
||||
/**
|
||||
* @brief Generic Prolog Term
|
||||
*/
|
||||
class YAPTerm {
|
||||
friend class YAPPredicate;
|
||||
friend class YAPApplTerm;
|
||||
friend class YAPPairTerm;
|
||||
friend class YAPListTerm;
|
||||
friend class YAPQuery;
|
||||
protected:
|
||||
yhandle_t t; /// handle to term, equivalent to term_t
|
||||
void mk(Term t0); /// internal method to convert from term to handle
|
||||
Term gt(); /// get handle and obtain term
|
||||
YAPTerm(Term tn) { mk( tn ); } /// private method to convert from Term (internal YAP representation) to YAPTerm
|
||||
inline Term term() { return gt(); } /// private method to convert from YAPTerm to Term (internal YAP representation)
|
||||
public:
|
||||
// do nothing constructor
|
||||
YAPTerm() { mk(TermNil); }
|
||||
/// integer to term
|
||||
YAPTerm(intptr_t i);
|
||||
/// pointer to term
|
||||
YAPTerm(void *ptr);
|
||||
/// parse string s and construct a term.
|
||||
YAPTerm(char *s) { Term tp ; mk( YAP_ReadBuffer(s,&tp) ); }
|
||||
/// extract the tag of a term, after dereferencing.
|
||||
YAP_tag_t tag();
|
||||
/// copy the term ( term copy )
|
||||
YAPTerm deepCopy();
|
||||
//const YAPTerm *vars();
|
||||
/// this term is == to t1
|
||||
bool exactlyEqual(YAPTerm t1);
|
||||
bool unify(YAPTerm t1); /// t = t1
|
||||
bool unifiable(YAPTerm t1); /// we can unify t and t1
|
||||
bool variant(YAPTerm t1); /// t =@= t1, the two terms are equal up to variable renaming
|
||||
intptr_t hashTerm(size_t sz, size_t depth, bool variant); /// term hash,
|
||||
bool isVar() { return IsVarTerm( gt() ); } /// type check for unbound
|
||||
bool isAtom() { return IsAtomTerm( gt() ); } /// type check for atom
|
||||
bool isInteger() { return IsIntegerTerm( gt() ); } /// type check for integer
|
||||
bool isFloat() { return IsFloatTerm( gt() ); } /// type check for floating-point
|
||||
bool isString() { return IsStringTerm( gt() ); } /// type check for a string " ... "
|
||||
bool isCompound() { return !(IsVarTerm( gt() ) || IsNumTerm( gt() )); } /// is a primitive term
|
||||
bool isAppl() { return IsApplTerm( gt() ); } /// is a structured term
|
||||
bool isPair() { return IsPairTerm( gt() ); } /// is a pair term
|
||||
bool isGround() { return Yap_IsGroundTerm( gt() ); } /// term is ground
|
||||
bool isList() { return Yap_IsListTerm( gt() ); } /// term is a list
|
||||
#include "yapa.hh"
|
||||
|
||||
/// extract the argument i of the term, where i in 1...arity
|
||||
inline YAPTerm getArg(int i) {
|
||||
Term t0 = gt();
|
||||
if (IsApplTerm(t0))
|
||||
return YAPTerm(ArgOfTerm(i, t0));
|
||||
else if (IsPairTerm(t0)) {
|
||||
if (i==1)
|
||||
return YAPTerm(HeadOfTerm(t0));
|
||||
if (i==2)
|
||||
return YAPTerm(TailOfTerm(t0));
|
||||
}
|
||||
return YAPTerm((Term)0);
|
||||
}
|
||||
#include "yapie.hh"
|
||||
|
||||
/// return a string with a textual representation of the term
|
||||
char *text();
|
||||
};
|
||||
#include "yapt.hh"
|
||||
|
||||
/**
|
||||
* @brief Variable Term
|
||||
*/
|
||||
class YAPVarTerm: public YAPTerm {
|
||||
YAPVarTerm(Term t) { if (IsVarTerm(t)) mk( t ); }
|
||||
public:
|
||||
/// constructor
|
||||
YAPVarTerm();
|
||||
/// get the internal representation
|
||||
CELL *getVar() { return VarOfTerm( gt() ); }
|
||||
/// is the variable bound to another one
|
||||
bool unbound() { return IsUnboundVar(VarOfTerm( gt() )); }
|
||||
};
|
||||
#include "yapdb.hh"
|
||||
|
||||
/**
|
||||
* @brief Compound Term
|
||||
*/
|
||||
class YAPApplTerm: public YAPTerm {
|
||||
friend class YAPTerm;
|
||||
YAPApplTerm(Term t0) { mk(t0); }
|
||||
public:
|
||||
YAPApplTerm(YAPTerm t0) { mk(t0.term()); }
|
||||
YAPApplTerm(YAPFunctor f, YAPTerm ts[]);
|
||||
YAPApplTerm(YAPFunctor f);
|
||||
YAPFunctor getFunctor();
|
||||
YAPTerm getArg(int i);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief List Constructor Term
|
||||
*/
|
||||
class YAPPairTerm: public YAPTerm {
|
||||
friend class YAPTerm;
|
||||
YAPPairTerm(Term t0) { if (IsPairTerm(t0)) mk( t0 ); else mk(0); }
|
||||
public:
|
||||
YAPPairTerm(YAPTerm hd, YAPTerm tl);
|
||||
YAPPairTerm();
|
||||
YAPTerm getHead() { return YAPTerm(HeadOfTerm( gt() )); }
|
||||
YAPTerm getTail() { return YAPTerm(TailOfTerm( gt() )); }
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Integer Term
|
||||
*/
|
||||
|
||||
class YAPIntegerTerm: public YAPTerm {
|
||||
public:
|
||||
YAPIntegerTerm(intptr_t i);
|
||||
intptr_t getInteger() { return IntegerOfTerm( gt() ); }
|
||||
bool isTagged() { return IsIntTerm( gt() ); }
|
||||
};
|
||||
|
||||
class YAPListTerm: public YAPTerm {
|
||||
public:
|
||||
/// Create a list term out of a standard term. Check if a valid operation.
|
||||
///
|
||||
/// @param[in] the term
|
||||
YAPListTerm(Term t0) { mk(t0); /* else type_error */ }
|
||||
/* /// Create a list term out of an array of terms.
|
||||
///
|
||||
/// @param[in] the array of terms
|
||||
/// @param[in] the length of the array
|
||||
YAPListTerm(YAPTerm ts[], size_t n);
|
||||
*/
|
||||
// YAPListTerm( vector<YAPTerm> v );
|
||||
/// Return the number of elements in a list term.
|
||||
size_t length() { Term *tailp; Term t1 = gt(); return Yap_SkipList(&t1, &tailp); }
|
||||
/// Extract the first element of a list.
|
||||
///
|
||||
/// @param[in] the list
|
||||
YAPTerm car();
|
||||
/// Extract the tail elements of a list.
|
||||
///
|
||||
/// @param[in] the list
|
||||
YAPListTerm cdr()
|
||||
{
|
||||
Term to = gt();
|
||||
if (IsPairTerm( to ))
|
||||
return YAPListTerm(TailOfTerm( to ));
|
||||
else
|
||||
return MkIntTerm(-1);
|
||||
}
|
||||
|
||||
/// Check if the list is empty.
|
||||
///
|
||||
/// @param[in] the list
|
||||
bool nil();
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Atom
|
||||
*/
|
||||
class YAPAtom {
|
||||
friend class YAPPredicate;
|
||||
friend class YAPFunctor;
|
||||
friend class YAPAtomTerm;
|
||||
Atom a;
|
||||
/// construct new YAPAtom from Atom
|
||||
YAPAtom( Atom at ) { a = at; }
|
||||
public:
|
||||
/// construct new YAPAtom from string
|
||||
YAPAtom( char * s) { a = Yap_LookupAtom( s ); }
|
||||
/// construct new YAPAtom from wide string
|
||||
YAPAtom( wchar_t * s) { a = Yap_LookupMaybeWideAtom( s ); }
|
||||
/// construct new YAPAtom from max-length string
|
||||
YAPAtom( char * s, size_t len) { a = Yap_LookupAtomWithLength( s, len ); }
|
||||
/// construct new YAPAtom from max-length wide string
|
||||
YAPAtom( wchar_t * s, size_t len) { a = Yap_LookupMaybeWideAtomWithLength( s, len ); }
|
||||
/// get name of atom
|
||||
char *getName(void);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief String Term
|
||||
*/
|
||||
class YAPStringTerm: public YAPTerm {
|
||||
public:
|
||||
/// your standard constructor
|
||||
YAPStringTerm(char *s) ;
|
||||
/// use this one to construct length limited strings
|
||||
YAPStringTerm(char *s, size_t len);
|
||||
/// construct using wide chars
|
||||
YAPStringTerm(wchar_t *s) ;
|
||||
/// construct using length-limited wide chars
|
||||
YAPStringTerm(wchar_t *s, size_t len);
|
||||
const char *getString() { return StringOfTerm( gt() ); }
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Atom Term
|
||||
*/
|
||||
class YAPAtomTerm: public YAPTerm {
|
||||
public:
|
||||
YAPAtomTerm(YAPAtom a): YAPTerm() { mk( MkAtomTerm(a.a) ); }
|
||||
YAPAtomTerm(Atom a): YAPTerm() { mk( MkAtomTerm(a) ); }
|
||||
YAPAtomTerm(char *s) ;
|
||||
YAPAtomTerm(char *s, size_t len);
|
||||
YAPAtomTerm(wchar_t *s) ;
|
||||
YAPAtomTerm(wchar_t *s, size_t len);
|
||||
YAPAtom getAtom() { return YAPAtom(AtomOfTerm( gt() )); }
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief YAPFunctor represents Prolog functors Name/Arity
|
||||
*/
|
||||
class YAPFunctor {
|
||||
friend class YAPApplTerm;
|
||||
friend class YAPPredicate;
|
||||
Functor f;
|
||||
/// Constructor: receives Prolog functor and casts it to YAPFunctor
|
||||
///
|
||||
/// Notice that this is designed for internal use only.
|
||||
YAPFunctor( Functor ff) { f = ff; }
|
||||
public:
|
||||
/// Constructor: receives name as a string plus arity
|
||||
///
|
||||
/// Notice that this is designed for ISO-LATIN-1 right now
|
||||
YAPFunctor( char * s, arity_t arity) { f = Yap_MkFunctor( Yap_LookupAtom( s ), arity ); }
|
||||
/// Constructor: receives name as a wide string plus arity
|
||||
///
|
||||
/// Notice that this is designed for UNICODE right now
|
||||
YAPFunctor( wchar_t * s, arity_t arity) { f = Yap_MkFunctor( Yap_LookupWideAtom( s ), arity ); }
|
||||
/// Constructor: receives name as an atom, plus arity
|
||||
///
|
||||
/// This is the default method, and the most popi;at
|
||||
YAPFunctor( YAPAtom at, arity_t arity) { f = Yap_MkFunctor( at.a, arity ); }
|
||||
|
||||
/// Getter: extract name of functor as an atom
|
||||
///
|
||||
/// this is for external usage.
|
||||
YAPAtom name(void) {
|
||||
return YAPAtom( NameOfFunctor( f ) );
|
||||
}
|
||||
|
||||
/// Getter: extract arity of functor as an unsigned integer
|
||||
///
|
||||
/// this is for external usage.
|
||||
arity_t arity(void) {
|
||||
return ArityOfFunctor( f );
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Predicates
|
||||
*
|
||||
* This class interfaces with PredEntry in Yatom.g
|
||||
*/
|
||||
class YAPPredicate {
|
||||
friend class YAPQuery;
|
||||
|
||||
private:
|
||||
PredEntry *ap;
|
||||
|
||||
/// auxiliary routine to find a predicate in the current module.
|
||||
PredEntry *getPred( Term t, Term* &outp ) ;
|
||||
|
||||
/// String constructor for predicates
|
||||
///
|
||||
/// It also communicates the array of arguments t[] abd the array of variables
|
||||
/// back to yapquery
|
||||
YAPPredicate(const char *s, Term* &outp, YAPTerm& vnames ) throw (int);
|
||||
|
||||
/// Term constructor for predicates
|
||||
///
|
||||
/// It is just a call to getPred
|
||||
inline YAPPredicate(Term t) {
|
||||
CELL * v = NULL;
|
||||
ap = getPred( t , v );
|
||||
}
|
||||
|
||||
/// Cast constructor for predicates,
|
||||
/// if we have the implementation data.
|
||||
///
|
||||
inline YAPPredicate(PredEntry *pe) {
|
||||
ap = pe;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// Functor constructor for predicates
|
||||
///
|
||||
/// Asssumes that we use the current module.
|
||||
YAPPredicate(YAPFunctor f);
|
||||
|
||||
/// Functor constructor for predicates, is given a specific module.
|
||||
///
|
||||
inline YAPPredicate(YAPFunctor f, YAPTerm mod) {
|
||||
ap = RepPredProp(PredPropByFunc(f.f,mod.t));
|
||||
}
|
||||
|
||||
/// Name/arity constructor for predicates.
|
||||
///
|
||||
inline YAPPredicate(YAPAtom at, YAPTerm mod) {
|
||||
ap = RepPredProp(PredPropByAtom(at.a,mod.t));
|
||||
}
|
||||
|
||||
|
||||
/// Name/0 constructor for predicates.
|
||||
///
|
||||
YAPPredicate(YAPAtom at);
|
||||
|
||||
/// Mod:Name/Arity constructor for predicates.
|
||||
///
|
||||
inline YAPPredicate(YAPAtom at, arity_t arity, YAPTerm mod) {
|
||||
if (arity) {
|
||||
Functor f = Yap_MkFunctor(at.a, arity);
|
||||
ap = RepPredProp(PredPropByFunc(f,mod.t));
|
||||
} else {
|
||||
ap = RepPredProp(PredPropByAtom(at.a,mod.t));
|
||||
}
|
||||
}
|
||||
|
||||
/// Atom/Arity constructor for predicates.
|
||||
///
|
||||
YAPPredicate(YAPAtom at, arity_t arity);
|
||||
|
||||
|
||||
/// String constructor for predicates.
|
||||
///
|
||||
/// String is a Prolog term, we extract the main functor after considering the module qualifiers.
|
||||
inline YAPPredicate(char *s) throw (int) {
|
||||
Term t, tp;
|
||||
t = YAP_ReadBuffer(s,&tp);
|
||||
if (t == 0L)
|
||||
throw YAPError::YAP_SYNTAX_ERROR;
|
||||
CELL * v;
|
||||
ap = getPred( t, v);
|
||||
}
|
||||
|
||||
|
||||
/// String constructor for predicates, also keeps arguments in tp[]
|
||||
///
|
||||
/// String is a Prolog term, we extract the main functor after considering the module qualifiers.
|
||||
inline YAPPredicate(char *s, Term* &outp) throw (int) {
|
||||
Term t, tp;
|
||||
t = YAP_ReadBuffer(s,&tp);
|
||||
if (t == 0L)
|
||||
throw YAPError::YAP_SYNTAX_ERROR;
|
||||
ap = getPred( t, outp );
|
||||
}
|
||||
|
||||
/// meta-call this predicate, with arguments ts[]
|
||||
///
|
||||
int call(YAPTerm ts[]);
|
||||
|
||||
/// module of a predicate
|
||||
///
|
||||
/// notice that modules are currently treated as atoms, this should change.
|
||||
YAPAtom module() {
|
||||
if (ap->ModuleOfPred == PROLOG_MODULE)
|
||||
return YAPAtom(AtomProlog);
|
||||
else
|
||||
return YAPAtom(AtomOfTerm(ap->ModuleOfPred));
|
||||
}
|
||||
|
||||
/// name of predicate
|
||||
///
|
||||
/// notice that we return the atom, not a string.
|
||||
YAPAtom name() { if (ap->ArityOfPE)
|
||||
return YAPAtom((Atom)ap->FunctorOfPred);
|
||||
else
|
||||
return YAPAtom(NameOfFunctor(ap->FunctorOfPred));
|
||||
}
|
||||
|
||||
/// arity of predicate
|
||||
///
|
||||
/// we return a positive number.
|
||||
arity_t getArity() { return ap->ArityOfPE; }
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Queries
|
||||
*
|
||||
* interface to a YAP Query;
|
||||
* uses an SWI-like status info internally.
|
||||
*/
|
||||
class YAPQuery: public YAPPredicate {
|
||||
int q_open;
|
||||
int q_state;
|
||||
Term *q_g;
|
||||
yamop *q_p, *q_cp;
|
||||
jmp_buf q_env;
|
||||
int q_flags;
|
||||
YAP_dogoalinfo q_h;
|
||||
YAPQuery *oq;
|
||||
YAPTerm vnames;
|
||||
void initQuery( Term ts[] );
|
||||
void initQuery( YAPTerm t[], arity_t arity );
|
||||
public:
|
||||
/// main constructor, uses a predicate and an array of terms
|
||||
///
|
||||
/// It is given a YAPPredicate _p_ , and an array of terms that must have at least
|
||||
/// the same arity as the functor.
|
||||
YAPQuery(YAPPredicate p, YAPTerm t[]);
|
||||
/// full constructor,
|
||||
///
|
||||
/// It is given a functor, module, and an array of terms that must have at least
|
||||
/// the same arity as the functor.
|
||||
YAPQuery(YAPFunctor f, YAPTerm mod, YAPTerm t[]);
|
||||
/// functor/term constructor,
|
||||
///
|
||||
/// It is given a functor, and an array of terms that must have at least
|
||||
/// the same arity as the functor. Works within the current module.
|
||||
YAPQuery(YAPFunctor f, YAPTerm t[]);
|
||||
/// string constructor without varnames
|
||||
///
|
||||
/// It is given a string, calls the parser and obtains a Prolog term that should be a callable
|
||||
/// goal. It does not ask for a list of variables.
|
||||
inline YAPQuery(char *s): YAPPredicate(s, q_g)
|
||||
{
|
||||
initQuery( q_g );
|
||||
}
|
||||
/// string constructor with varnames
|
||||
///
|
||||
/// It is given a string, calls the parser and obtains a Prolog term that should be a callable
|
||||
/// goal and a list of variables. Useful for top-level simulation. Works within the current module.
|
||||
inline YAPQuery(char *s, YAPTerm &vnames): YAPPredicate(s, q_g, vnames)
|
||||
{
|
||||
initQuery( q_g );
|
||||
}
|
||||
/// set flags for query execution, currently only for exception handling
|
||||
void setFlag(int flag) {q_flags |= flag; }
|
||||
/// reset flags for query execution, currently only for exception handling
|
||||
void resetFlag(int flag) {q_flags &= ~flag; }
|
||||
/// first query
|
||||
///
|
||||
/// actually implemented by calling the next();
|
||||
inline bool first() { return next(); }
|
||||
/// ask for the next solution of the current query
|
||||
/// same call for every solution
|
||||
bool next();
|
||||
/// represent the top-goal
|
||||
char *text();
|
||||
/// remove alternatives in the current search space, and finish the current query
|
||||
void cut();
|
||||
/// finish the current query: undo all bindings.
|
||||
void close();
|
||||
/// query variables.
|
||||
YAPListTerm namedVars();
|
||||
};
|
||||
|
||||
// Java support
|
||||
|
||||
/// This class implements a callback Prolog-side. It will be inherited by the Java or Python
|
||||
/// class that actually implements the callback.
|
||||
class YAPCallback {
|
||||
public:
|
||||
virtual ~YAPCallback() { printf("~YAPCallback\n"); }
|
||||
virtual void run() { __android_log_print(ANDROID_LOG_INFO, __FUNCTION__, "callback"); }
|
||||
virtual void run(char *s) { }
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief YAP Engine: takes care of the execution environment
|
||||
where we can go executing goals.
|
||||
*
|
||||
*
|
||||
*/
|
||||
class YAPEngine {
|
||||
private:
|
||||
YAPCallback *_callback;
|
||||
YAP_init_args init_args;
|
||||
YAPError yerror;
|
||||
public:
|
||||
YAPEngine(char *savedState = (char *)NULL,
|
||||
size_t stackSize = 0,
|
||||
size_t trailSize = 0,
|
||||
size_t maxStackSize = 0,
|
||||
size_t maxTrailSize = 0,
|
||||
char *libDir = (char *)NULL,
|
||||
char *bootFile = (char *)NULL,
|
||||
char *goal = (char *)NULL,
|
||||
char *topLevel = (char *)NULL,
|
||||
bool script = FALSE,
|
||||
bool fastBoot = FALSE,
|
||||
YAPCallback *callback=(YAPCallback *)NULL); /// construct a new engine, including aaccess to callbacks
|
||||
/// kill engine
|
||||
~YAPEngine() { delYAPCallback(); }
|
||||
/// remove current callback
|
||||
void delYAPCallback() { _callback = 0; }
|
||||
/// set a new callback
|
||||
void setYAPCallback(YAPCallback *cb) { delYAPCallback(); _callback = cb; }
|
||||
/// execute the callback.
|
||||
void run() { if (_callback) _callback->run(); }
|
||||
/// execute the callback with a text argument.
|
||||
void run( char *s) { if (_callback) _callback->run(s); }
|
||||
/// execute the callback with a text argument.
|
||||
YAPError hasError( ) { return yerror; }
|
||||
/// build a query on the engine
|
||||
YAPQuery *query( char *s );
|
||||
};
|
||||
#include "yapq.hh"
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
127
CXX/yapq.hh
Normal file
127
CXX/yapq.hh
Normal file
@ -0,0 +1,127 @@
|
||||
#ifndef YAPQ_HH
|
||||
#define YAPQ_HH 1
|
||||
|
||||
/**
|
||||
Queries and engines
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Queries
|
||||
*
|
||||
* interface to a YAP Query;
|
||||
* uses an SWI-like status info internally.
|
||||
*/
|
||||
class YAPQuery: public YAPPredicate {
|
||||
int q_open;
|
||||
int q_state;
|
||||
Term *q_g;
|
||||
yamop *q_p, *q_cp;
|
||||
jmp_buf q_env;
|
||||
int q_flags;
|
||||
Term vs;
|
||||
YAP_dogoalinfo q_h;
|
||||
YAPQuery *oq;
|
||||
YAPTerm vnames;
|
||||
void initQuery( Term ts[] );
|
||||
void initQuery( YAPTerm t[], arity_t arity );
|
||||
public:
|
||||
/// main constructor, uses a predicate and an array of terms
|
||||
///
|
||||
/// It is given a YAPPredicate _p_ , and an array of terms that must have at least
|
||||
/// the same arity as the functor.
|
||||
YAPQuery(YAPPredicate p, YAPTerm t[]);
|
||||
/// full constructor,
|
||||
///
|
||||
/// It is given a functor, module, and an array of terms that must have at least
|
||||
/// the same arity as the functor.
|
||||
YAPQuery(YAPFunctor f, YAPTerm mod, YAPTerm t[]);
|
||||
/// functor/term constructor,
|
||||
///
|
||||
/// It is given a functor, and an array of terms that must have at least
|
||||
/// the same arity as the functor. Works within the current module.
|
||||
YAPQuery(YAPFunctor f, YAPTerm t[]);
|
||||
/// string constructor without varnames
|
||||
///
|
||||
/// It is given a string, calls the parser and obtains a Prolog term that should be a callable
|
||||
/// goal. It does not ask for a list of variables.
|
||||
inline YAPQuery(const char *s): YAPPredicate(s, q_g, vs)
|
||||
{
|
||||
vnames = YAPTerm( vs );
|
||||
initQuery( q_g );
|
||||
}
|
||||
|
||||
/// set flags for query execution, currently only for exception handling
|
||||
void setFlag(int flag) {q_flags |= flag; }
|
||||
/// reset flags for query execution, currently only for exception handling
|
||||
void resetFlag(int flag) {q_flags &= ~flag; }
|
||||
/// first query
|
||||
///
|
||||
/// actually implemented by calling the next();
|
||||
inline bool first() { return next(); }
|
||||
/// ask for the next solution of the current query
|
||||
/// same call for every solution
|
||||
bool next();
|
||||
/// represent the top-goal
|
||||
char *text();
|
||||
/// remove alternatives in the current search space, and finish the current query
|
||||
void cut();
|
||||
/// finish the current query: undo all bindings.
|
||||
void close();
|
||||
/// query variables.
|
||||
YAPListTerm namedVars();
|
||||
};
|
||||
|
||||
// Java support
|
||||
|
||||
/// This class implements a callback Prolog-side. It will be inherited by the Java or Python
|
||||
/// class that actually implements the callback.
|
||||
class YAPCallback {
|
||||
public:
|
||||
virtual ~YAPCallback() { printf("~YAPCallback\n"); }
|
||||
virtual void run() { __android_log_print(ANDROID_LOG_INFO, __FUNCTION__, "callback"); }
|
||||
virtual void run(char *s) { }
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief YAP Engine: takes care of the execution environment
|
||||
where we can go executing goals.
|
||||
*
|
||||
*
|
||||
*/
|
||||
class YAPEngine {
|
||||
private:
|
||||
YAPCallback *_callback;
|
||||
YAP_init_args init_args;
|
||||
YAPError yerror;
|
||||
public:
|
||||
YAPEngine(char *savedState = (char *)NULL,
|
||||
size_t stackSize = 0,
|
||||
size_t trailSize = 0,
|
||||
size_t maxStackSize = 0,
|
||||
size_t maxTrailSize = 0,
|
||||
char *libDir = (char *)NULL,
|
||||
char *bootFile = (char *)NULL,
|
||||
char *goal = (char *)NULL,
|
||||
char *topLevel = (char *)NULL,
|
||||
bool script = FALSE,
|
||||
bool fastBoot = FALSE,
|
||||
YAPCallback *callback=(YAPCallback *)NULL); /// construct a new engine, including aaccess to callbacks
|
||||
/// kill engine
|
||||
~YAPEngine() { delYAPCallback(); }
|
||||
/// remove current callback
|
||||
void delYAPCallback() { _callback = 0; }
|
||||
/// set a new callback
|
||||
void setYAPCallback(YAPCallback *cb) { delYAPCallback(); _callback = cb; }
|
||||
/// execute the callback.
|
||||
void run() { if (_callback) _callback->run(); }
|
||||
/// execute the callback with a text argument.
|
||||
void run( char *s) { if (_callback) _callback->run(s); }
|
||||
/// execute the callback with a text argument.
|
||||
YAPError hasError( ) { return yerror; }
|
||||
/// build a query on the engine
|
||||
YAPQuery *query( char *s );
|
||||
/// current module for the engine
|
||||
YAPModule currentModule( ) { return YAPModule( ) ; }
|
||||
};
|
||||
|
||||
#endif /* YAPQ_HH */
|
202
CXX/yapt.hh
Normal file
202
CXX/yapt.hh
Normal file
@ -0,0 +1,202 @@
|
||||
#ifndef YAPT_HH
|
||||
#define YAPT_HH 1
|
||||
|
||||
/**
|
||||
* @brief Generic Prolog Term
|
||||
*/
|
||||
class YAPTerm {
|
||||
friend class YAPPredicate;
|
||||
friend class YAPPrologPredicate;
|
||||
friend class YAPQuery;
|
||||
friend class YAPModule;
|
||||
friend class YAPModuleProp;
|
||||
protected:
|
||||
yhandle_t t; /// handle to term, equivalent to term_t
|
||||
void mk(Term t0); /// internal method to convert from term to handle
|
||||
Term gt(); /// get handle and obtain term
|
||||
public:
|
||||
~YAPTerm() {};
|
||||
YAPTerm(Term tn) { mk( tn ); } /// private method to convert from Term (internal YAP representation) to YAPTerm
|
||||
// do nothing constructor
|
||||
YAPTerm() { mk(TermNil); }
|
||||
/// integer to term
|
||||
YAPTerm(intptr_t i);
|
||||
/// pointer to term
|
||||
YAPTerm(void *ptr);
|
||||
/// parse string s and construct a term.
|
||||
YAPTerm(char *s) { Term tp ; mk( YAP_ReadBuffer(s,&tp) ); }
|
||||
/// extract the tag of a term, after dereferencing.
|
||||
YAP_tag_t tag();
|
||||
/// copy the term ( term copy )
|
||||
YAPTerm deepCopy();
|
||||
inline Term term() { return gt(); } /// private method to convert from YAPTerm to Term (internal YAP representation)
|
||||
//const YAPTerm *vars();
|
||||
/// this term is == to t1
|
||||
bool exactlyEqual(YAPTerm t1);
|
||||
bool unify(YAPTerm t1); /// t = t1
|
||||
bool unifiable(YAPTerm t1); /// we can unify t and t1
|
||||
bool variant(YAPTerm t1); /// t =@= t1, the two terms are equal up to variable renaming
|
||||
intptr_t hashTerm(size_t sz, size_t depth, bool variant); /// term hash,
|
||||
bool isVar() { return IsVarTerm( gt() ); } /// type check for unbound
|
||||
bool isAtom() { return IsAtomTerm( gt() ); } /// type check for atom
|
||||
bool isInteger() { return IsIntegerTerm( gt() ); } /// type check for integer
|
||||
bool isFloat() { return IsFloatTerm( gt() ); } /// type check for floating-point
|
||||
bool isString() { return IsStringTerm( gt() ); } /// type check for a string " ... "
|
||||
bool isCompound() { return !(IsVarTerm( gt() ) || IsNumTerm( gt() )); } /// is a primitive term
|
||||
bool isAppl() { return IsApplTerm( gt() ); } /// is a structured term
|
||||
bool isPair() { return IsPairTerm( gt() ); } /// is a pair term
|
||||
bool isGround() { return Yap_IsGroundTerm( gt() ); } /// term is ground
|
||||
bool isList() { return Yap_IsListTerm( gt() ); } /// term is a list
|
||||
|
||||
/// extract the argument i of the term, where i in 1...arity
|
||||
inline YAPTerm getArg(int i) {
|
||||
Term t0 = gt();
|
||||
if (IsApplTerm(t0))
|
||||
return YAPTerm(ArgOfTerm(i, t0));
|
||||
else if (IsPairTerm(t0)) {
|
||||
if (i==1)
|
||||
return YAPTerm(HeadOfTerm(t0));
|
||||
if (i==2)
|
||||
return YAPTerm(TailOfTerm(t0));
|
||||
}
|
||||
return YAPTerm((Term)0);
|
||||
}
|
||||
|
||||
/// return a string with a textual representation of the term
|
||||
char *text();
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Variable Term
|
||||
*/
|
||||
class YAPVarTerm: private YAPTerm {
|
||||
YAPVarTerm(Term t) { if (IsVarTerm(t)) mk( t ); }
|
||||
public:
|
||||
/// constructor
|
||||
YAPVarTerm();
|
||||
/// get the internal representation
|
||||
CELL *getVar() { return VarOfTerm( gt() ); }
|
||||
/// is the variable bound to another one
|
||||
bool unbound() { return IsUnboundVar(VarOfTerm( gt() )); }
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Compound Term
|
||||
*/
|
||||
class YAPApplTerm: YAPTerm {
|
||||
friend class YAPTerm;
|
||||
YAPApplTerm(Term t0) { mk(t0); }
|
||||
public:
|
||||
~YAPApplTerm() { }
|
||||
YAPApplTerm(YAPFunctor f, YAPTerm ts[]);
|
||||
YAPApplTerm(YAPFunctor f);
|
||||
YAPFunctor getFunctor();
|
||||
YAPTerm getArg(int i);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief List Constructor Term
|
||||
*/
|
||||
class YAPPairTerm: YAPTerm {
|
||||
friend class YAPTerm;
|
||||
YAPPairTerm(Term t0) { if (IsPairTerm(t0)) mk( t0 ); else mk(0); }
|
||||
public:
|
||||
YAPPairTerm(YAPTerm hd, YAPTerm tl);
|
||||
YAPPairTerm();
|
||||
YAPTerm getHead() { return YAPTerm(HeadOfTerm( gt() )); }
|
||||
YAPTerm getTail() { return YAPTerm(TailOfTerm( gt() )); }
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Integer Term
|
||||
*/
|
||||
|
||||
class YAPIntegerTerm: private YAPTerm {
|
||||
public:
|
||||
YAPIntegerTerm(intptr_t i);
|
||||
intptr_t getInteger() { return IntegerOfTerm( gt() ); }
|
||||
bool isTagged() { return IsIntTerm( gt() ); }
|
||||
};
|
||||
|
||||
class YAPListTerm: private YAPTerm {
|
||||
public:
|
||||
/// Create a list term out of a standard term. Check if a valid operation.
|
||||
///
|
||||
/// @param[in] the term
|
||||
YAPListTerm(Term t0) { mk(t0); /* else type_error */ }
|
||||
/* /// Create a list term out of an array of terms.
|
||||
///
|
||||
/// @param[in] the array of terms
|
||||
/// @param[in] the length of the array
|
||||
YAPListTerm(YAPTerm ts[], size_t n);
|
||||
*/
|
||||
// YAPListTerm( vector<YAPTerm> v );
|
||||
/// Return the number of elements in a list term.
|
||||
size_t length() { Term *tailp; Term t1 = gt(); return Yap_SkipList(&t1, &tailp); }
|
||||
/// Extract the first element of a list.
|
||||
///
|
||||
/// @param[in] the list
|
||||
YAPTerm car();
|
||||
/// Extract the tail elements of a list.
|
||||
///
|
||||
/// @param[in] the list
|
||||
YAPListTerm cdr()
|
||||
{
|
||||
Term to = gt();
|
||||
if (IsPairTerm( to ))
|
||||
return YAPListTerm(TailOfTerm( to ));
|
||||
else
|
||||
return MkIntTerm(-1);
|
||||
}
|
||||
|
||||
/// Check if the list is empty.
|
||||
///
|
||||
/// @param[in] the list
|
||||
bool nil();
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief String Term
|
||||
*/
|
||||
class YAPStringTerm: private YAPTerm {
|
||||
public:
|
||||
/// your standard constructor
|
||||
YAPStringTerm(char *s) ;
|
||||
/// use this one to construct length limited strings
|
||||
YAPStringTerm(char *s, size_t len);
|
||||
/// construct using wide chars
|
||||
YAPStringTerm(wchar_t *s) ;
|
||||
/// construct using length-limited wide chars
|
||||
YAPStringTerm(wchar_t *s, size_t len);
|
||||
const char *getString() { return StringOfTerm( gt() ); }
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Atom Term
|
||||
* Term Representation of an Atom
|
||||
*/
|
||||
class YAPAtomTerm: YAPTerm {
|
||||
friend class YAPModule;
|
||||
// Constructor: receives a C-atom;
|
||||
YAPAtomTerm(Atom a) { mk( MkAtomTerm(a) ); }
|
||||
YAPAtomTerm(Term t): YAPTerm(t) { IsAtomTerm(t); }
|
||||
// Getter for Prolog atom
|
||||
Term getTerm() { return t; }
|
||||
public:
|
||||
// Constructor: receives an atom;
|
||||
YAPAtomTerm(YAPAtom a): YAPTerm() { mk( MkAtomTerm(a.a) ); }
|
||||
// Constructor: receives a sequence of ISO-LATIN1 codes;
|
||||
YAPAtomTerm(char *s) ;
|
||||
// Constructor: receives a sequence of up to n ISO-LATIN1 codes;
|
||||
YAPAtomTerm(char *s, size_t len);
|
||||
// Constructor: receives a sequence of wchar_ts, whatever they may be;
|
||||
YAPAtomTerm(wchar_t *s) ;
|
||||
// Constructor: receives a sequence of n wchar_ts, whatever they may be;
|
||||
YAPAtomTerm(wchar_t *s, size_t len);
|
||||
// Getter: outputs the atom;
|
||||
YAPAtom getAtom() { return YAPAtom(AtomOfTerm( gt() )); }
|
||||
// Getter: outputs the name as a sequence of ISO-LATIN1 codes;
|
||||
const char *getName() { return AtomOfTerm( gt() )->StrOfAE; }
|
||||
};
|
||||
|
||||
#endif /* YAPT_HH */
|
17
H/Atoms.h
17
H/Atoms.h
@ -66,6 +66,23 @@ typedef struct AtomEntryStruct
|
||||
}
|
||||
AtomEntry;
|
||||
|
||||
// compatible with C and C++;
|
||||
typedef struct ExtraAtomEntryStruct
|
||||
{
|
||||
Atom NextOfAE; /* used to build hash chains */
|
||||
Prop PropsOfAE; /* property list for this atom */
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
rwlock_t ARWLock;
|
||||
#endif
|
||||
|
||||
union {
|
||||
char uStrOfAE[4]; /* representation of atom as a string */
|
||||
wchar_t uWStrOfAE[1]; /* representation of atom as a string */
|
||||
struct atom_blob blob[1];
|
||||
} rep;
|
||||
}
|
||||
ExtraAtomEntry;
|
||||
|
||||
#define StrOfAE rep.uStrOfAE
|
||||
#define WStrOfAE rep.uWStrOfAE
|
||||
|
||||
|
38
H/TermExt.h
38
H/TermExt.h
@ -37,16 +37,11 @@ language. Next, we discuss support to the most important ones.
|
||||
#define AtomFreeTerm ((Atom)(&(((special_functors *)(NULL))->AtFreeTerm)))
|
||||
#define AtomNil ((Atom)(&(((special_functors *)(NULL))->AtNil)))
|
||||
#define AtomDot ((Atom)(&(((special_functors *)(NULL))->AtDot)))
|
||||
#elif defined(THREADS)
|
||||
#define AtomFoundVar AbsAtom(SF_STORE->AtFoundVar)
|
||||
#define AtomFreeTerm AbsAtom(SF_STORE->AtFreeTerm)
|
||||
#define AtomNil AbsAtom(SF_STORE->AtNil)
|
||||
#define AtomDot AbsAtom(SF_STORE->AtDot)
|
||||
#else
|
||||
#define AtomFoundVar AbsAtom(&(SF_STORE->AtFoundVar))
|
||||
#define AtomFreeTerm AbsAtom(&(SF_STORE->AtFreeTerm))
|
||||
#define AtomNil AbsAtom(&(SF_STORE->AtNil))
|
||||
#define AtomDot AbsAtom(&(SF_STORE->AtDot))
|
||||
#define AtomFoundVar AbsAtom((AtomEntry *)&(SF_STORE->AtFoundVar))
|
||||
#define AtomFreeTerm AbsAtom((AtomEntry *)&(SF_STORE->AtFreeTerm))
|
||||
#define AtomNil AbsAtom((AtomEntry *)&(SF_STORE->AtNil))
|
||||
#define AtomDot AbsAtom((AtomEntry *)&(SF_STORE->AtDot))
|
||||
#endif
|
||||
|
||||
#define TermFoundVar MkAtomTerm(AtomFoundVar)
|
||||
@ -164,32 +159,17 @@ exts;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef YAP_H
|
||||
#if defined(YAP_H)
|
||||
/* make sure that these data structures are the first thing to be allocated
|
||||
in the heap when we start the system */
|
||||
#ifdef THREADS
|
||||
typedef struct special_functors_struct
|
||||
{
|
||||
AtomEntry *AtFoundVar;
|
||||
AtomEntry *AtFreeTerm;
|
||||
AtomEntry *AtNil;
|
||||
AtomEntry *AtDot;
|
||||
} special_functors;
|
||||
#else
|
||||
typedef struct special_functors_struct
|
||||
{
|
||||
AtomEntry AtFoundVar;
|
||||
char AtFoundVarChars[8];
|
||||
AtomEntry AtFreeTerm;
|
||||
char AtFreeTermChars[8];
|
||||
AtomEntry AtNil;
|
||||
char AtNilChars[8];
|
||||
AtomEntry AtDot;
|
||||
char AtDotChars[8];
|
||||
struct ExtraAtomEntryStruct AtFoundVar;
|
||||
struct ExtraAtomEntryStruct AtFreeTerm;
|
||||
struct ExtraAtomEntryStruct AtNil;
|
||||
struct ExtraAtomEntryStruct AtDot;
|
||||
}
|
||||
special_functors;
|
||||
#endif
|
||||
|
||||
#endif /* YAP_H */
|
||||
|
||||
INLINE_ONLY inline EXTERN Float CpFloatUnaligned(CELL *ptr);
|
||||
|
2
H/Yap.h
2
H/Yap.h
@ -166,7 +166,7 @@
|
||||
#endif /* _WIN32 */
|
||||
#endif /* __MINGW32__ */
|
||||
|
||||
#if HAVE_GCC
|
||||
#if HAVE_GCC && !defined(__cplusplus)
|
||||
#define MIN_ARRAY 0
|
||||
#define DUMMY_FILLER_FOR_ABS_TYPE
|
||||
#else
|
||||
|
405
H/YapOpcodes.h
405
H/YapOpcodes.h
@ -422,414 +422,9 @@
|
||||
OPCODE(trie_trust_gterm ,e),
|
||||
OPCODE(trie_try_gterm ,e),
|
||||
OPCODE(trie_retry_gterm ,e),
|
||||
#endif
|
||||
#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(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
|
||||
|
13
H/Yapproto.h
13
H/Yapproto.h
@ -24,19 +24,19 @@ Term Yap_ArrayToList(Term *,size_t);
|
||||
int Yap_GetName(char *,UInt,Term);
|
||||
Term Yap_GetValue(Atom);
|
||||
int Yap_HasOp(Atom);
|
||||
struct operator_entry *Yap_GetOpPropForAModuleHavingALock(AtomEntry *, Term);
|
||||
struct operator_entry *Yap_GetOpPropForAModuleHavingALock(struct AtomEntryStruct *, Term);
|
||||
Atom Yap_LookupAtom(const char *);
|
||||
Atom Yap_LookupAtomWithLength(const char *, size_t);
|
||||
Atom Yap_LookupUTF8Atom(const char *);
|
||||
Atom Yap_LookupMaybeWideAtom(const wchar_t *);
|
||||
Atom Yap_LookupMaybeWideAtomWithLength(const wchar_t *, size_t);
|
||||
Atom Yap_FullLookupAtom(const char *);
|
||||
void Yap_LookupAtomWithAddress(const char *,AtomEntry *);
|
||||
void Yap_LookupAtomWithAddress(const char *,struct AtomEntryStruct *);
|
||||
Prop Yap_NewPredPropByFunctor(struct FunctorEntryStruct *, Term);
|
||||
Prop Yap_NewPredPropByAtom(struct AtomEntryStruct *, Term);
|
||||
Prop Yap_PredPropByFunctorNonThreadLocal(struct FunctorEntryStruct *, Term);
|
||||
Prop Yap_PredPropByAtomNonThreadLocal(struct AtomEntryStruct *, Term);
|
||||
Functor Yap_UnlockedMkFunctor(AtomEntry *,unsigned int);
|
||||
Functor Yap_UnlockedMkFunctor(struct AtomEntryStruct *,unsigned int);
|
||||
Functor Yap_MkFunctor(Atom,unsigned int);
|
||||
void Yap_MkFunctorWithAddress(Atom,unsigned int,FunctorEntry *);
|
||||
void Yap_PutValue(Atom,Term);
|
||||
@ -57,7 +57,7 @@ Prop Yap_GetPredPropByAtomInThisModule(Atom, Term);
|
||||
Prop Yap_GetPredPropByFuncInThisModule(Functor, Term);
|
||||
Prop Yap_GetPredPropHavingLock(Atom,unsigned int, Term);
|
||||
Prop Yap_GetExpProp(Atom,unsigned int);
|
||||
Prop Yap_GetExpPropHavingLock(AtomEntry *,unsigned int);
|
||||
Prop Yap_GetExpPropHavingLock(struct AtomEntryStruct *,unsigned int);
|
||||
|
||||
/* agc.c */
|
||||
void Yap_atom_gc( CACHE_TYPE1 );
|
||||
@ -251,6 +251,9 @@ int Yap_DebugGetc(void);
|
||||
#endif
|
||||
int Yap_IsOpType(char *);
|
||||
void Yap_InitWorkspace(UInt,UInt,UInt,UInt,UInt,int,int,int);
|
||||
bool Yap_AddCallToFli( struct pred_entry *pe, CPredicate call );
|
||||
bool Yap_AddRetryToFli( struct pred_entry *pe, CPredicate re );
|
||||
bool Yap_AddCutToFli( struct pred_entry *pe, CPredicate cut );
|
||||
|
||||
#ifdef YAPOR
|
||||
void Yap_init_yapor_workers(void);
|
||||
@ -443,7 +446,7 @@ void Yap_swi_install(void);
|
||||
void Yap_InitSWIHash(void);
|
||||
int Yap_get_stream_handle(Term, int, int, void *);
|
||||
Term Yap_get_stream_position(void *);
|
||||
AtomEntry *Yap_lookupBlob(void *blob, size_t len, void *type, int *newp);
|
||||
struct AtomEntryStruct *Yap_lookupBlob(void *blob, size_t len, void *type, int *newp);
|
||||
|
||||
/* opt.preds.c */
|
||||
void Yap_init_optyap_preds(void);
|
||||
|
@ -153,7 +153,7 @@ AbsFunctorProp (FunctorEntry * p)
|
||||
#endif
|
||||
|
||||
|
||||
INLINE_ONLY inline EXTERN Int ArityOfFunctor (Functor);
|
||||
INLINE_ONLY inline EXTERN Int ArityOfFunctor (Functor);
|
||||
|
||||
INLINE_ONLY inline EXTERN Int
|
||||
ArityOfFunctor (Functor Fun)
|
||||
@ -491,7 +491,7 @@ typedef enum
|
||||
} op_type;
|
||||
|
||||
|
||||
OpEntry *Yap_GetOpProp(Atom, op_type CACHE_TYPE);
|
||||
OpEntry *Yap_GetOpProp(Atom, op_type CACHE_TYPE);
|
||||
|
||||
int Yap_IsPrefixOp(Atom,int *,int *);
|
||||
int Yap_IsOp(Atom);
|
||||
|
38
H/absmi.h
38
H/absmi.h
@ -32,6 +32,11 @@ static char SccsId[] = "%W% %G%";
|
||||
#define Yapc_Compile(P) 0
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define register
|
||||
#endif
|
||||
|
||||
|
||||
/***************************************************************
|
||||
* Macros for register manipulation *
|
||||
***************************************************************/
|
||||
@ -416,7 +421,13 @@ restore_absmi_regs(REGSTORE * old_regs)
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#if USE_THREADED_CODE
|
||||
#if __YAP_TRACED
|
||||
|
||||
#define DO_PREFETCH(TYPE)
|
||||
|
||||
#define DO_PREFETCH_W(TYPE)
|
||||
|
||||
#elif USE_THREADED_CODE
|
||||
|
||||
#ifndef _NATIVE
|
||||
|
||||
@ -626,7 +637,17 @@ restore_absmi_regs(REGSTORE * old_regs)
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#if USE_THREADED_CODE
|
||||
#if __YAP_TRACED
|
||||
|
||||
#define JMP(Lab) { opcode = Yap_op_from_opcode( goto *Lab ); goto op_switch; }
|
||||
|
||||
#define JMPNext(Lab) { opcode = Yap_op_from_opcode( PREG->opc ) + ExpEnv.config_struc.current_displacement; goto op_switch; }
|
||||
|
||||
#define JMPNextW(Lab) { opcode = Yap_op_from_opcode( PREG->opcw ) + ExpEnv.config_struc.current_displacement; goto op_switch; }
|
||||
|
||||
|
||||
|
||||
#elif USE_THREADED_CODE
|
||||
|
||||
#ifndef _NATIVE
|
||||
|
||||
@ -2204,17 +2225,23 @@ prune(choiceptr cp USES_REGS)
|
||||
#endif
|
||||
|
||||
|
||||
#if YAP_JIT
|
||||
|
||||
extern Environment ExpEnv;
|
||||
extern char fin[1024];
|
||||
|
||||
#if YAP_JIT
|
||||
#ifndef _NATIVE
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#ifndef __cplusplus
|
||||
#include "JIT_Compiler.hpp"
|
||||
|
||||
extern struct JIT_Compiler *J;
|
||||
|
||||
void* (*Yap_JitCall)(JIT_Compiler* jc, yamop* p);
|
||||
void (* Yap_llvmShutdown)(void ) ;
|
||||
Int (* Yap_traced_absmi)(void ) ;
|
||||
extern JIT_Compiler *J;
|
||||
#endif
|
||||
|
||||
extern NativeContext *NativeArea;
|
||||
extern IntermediatecodeContext *IntermediatecodeArea;
|
||||
@ -2264,4 +2291,3 @@ yamop* headoftrace;
|
||||
#endif
|
||||
|
||||
#endif // ABSMI_H
|
||||
|
||||
|
@ -177,9 +177,9 @@ typedef struct printt_struc {
|
||||
CELL msg_after; // If I print, what message should come after?
|
||||
} PrinttStruc;
|
||||
|
||||
#if YAP_JIT
|
||||
/* This struct represents our experimental environment for YAP */
|
||||
typedef struct environment {
|
||||
#if YAP_JIT
|
||||
// struct for analysis predicates -- all fields are modified by analysis predicates (JIT_AnalysisPreds.c)
|
||||
struct {
|
||||
CELL outfile; // Where will analysis results be printed?
|
||||
@ -331,8 +331,8 @@ typedef struct environment {
|
||||
Int exit_on_error; // Should I exit when any error occur?
|
||||
} act_predicate_actions;
|
||||
} debug_struc;
|
||||
#endif
|
||||
} Environment;
|
||||
#endif
|
||||
|
||||
#if YAP_JIT
|
||||
/* Enumeration for types of basic blocks -- used on trace construction */
|
||||
@ -489,6 +489,9 @@ typedef struct jit_handl_context {
|
||||
CELL torecomp;
|
||||
}jitman;
|
||||
} JitHandlContext;
|
||||
|
||||
void **Yap_ABSMI_ControlLabels;
|
||||
|
||||
#endif /* YAP_JIT */
|
||||
|
||||
|
||||
|
@ -1533,12 +1533,6 @@
|
||||
cl = NEXTOP(cl,Otapl);
|
||||
break;
|
||||
#endif
|
||||
#ifdef YAP_JIT
|
||||
#ifdef YAPOR
|
||||
#endif
|
||||
#ifdef TABLING
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
clause->Tag = (CELL)NULL;
|
||||
return;
|
||||
|
@ -814,12 +814,6 @@
|
||||
cl = NEXTOP(cl,Otapl);
|
||||
break;
|
||||
#endif
|
||||
#ifdef YAP_JIT
|
||||
#ifdef YAPOR
|
||||
#endif
|
||||
#ifdef TABLING
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
clause->Tag = (CELL)NULL;
|
||||
return;
|
||||
|
897
H/rclause.h
897
H/rclause.h
@ -935,905 +935,8 @@ restore_opcodes(yamop *pc, yamop *max USES_REGS)
|
||||
if (op == _Nstop || op == _copy_idb_term || op == _unify_idb_term) return;
|
||||
pc = NEXTOP(pc,e);
|
||||
break;
|
||||
#endif
|
||||
#ifdef YAP_JIT
|
||||
/* instructions type D */
|
||||
case _traced_write_dbterm:
|
||||
pc->y_u.D.D = DBGroundTermAdjust(pc->y_u.D.D);
|
||||
pc = NEXTOP(pc,D);
|
||||
break;
|
||||
/* instructions type Illss */
|
||||
case _traced_enter_lu_pred:
|
||||
pc->y_u.Illss.I = PtoLUIndexAdjust(pc->y_u.Illss.I);
|
||||
pc->y_u.Illss.l1 = PtoOpAdjust(pc->y_u.Illss.l1);
|
||||
pc->y_u.Illss.l2 = PtoOpAdjust(pc->y_u.Illss.l2);
|
||||
pc->y_u.Illss.s = ConstantAdjust(pc->y_u.Illss.s);
|
||||
pc->y_u.Illss.e = ConstantAdjust(pc->y_u.Illss.e);
|
||||
opc = NEXTOP(pc,Illss);
|
||||
pc = pc->y_u.Illss.l1;
|
||||
break;
|
||||
/* instructions type J */
|
||||
case _traced_jit_handler:
|
||||
/* instructions type L */
|
||||
case _traced_alloc_for_logical_pred:
|
||||
pc->y_u.L.ClBase = PtoLUClauseAdjust(pc->y_u.L.ClBase);
|
||||
pc = NEXTOP(pc,L);
|
||||
break;
|
||||
/* instructions type N */
|
||||
case _traced_write_bigint:
|
||||
pc->y_u.N.b = BlobTermInCodeAdjust(pc->y_u.N.b);
|
||||
pc = NEXTOP(pc,N);
|
||||
break;
|
||||
/* instructions type Osblp */
|
||||
case _traced_either:
|
||||
case _traced_or_else:
|
||||
OrArgAdjust(pc->y_u.Osblp.or_arg);
|
||||
pc->y_u.Osblp.s = ConstantAdjust(pc->y_u.Osblp.s);
|
||||
pc->y_u.Osblp.bmap = CellPtoHeapAdjust(pc->y_u.Osblp.bmap);
|
||||
pc->y_u.Osblp.l = PtoOpAdjust(pc->y_u.Osblp.l);
|
||||
pc->y_u.Osblp.p0 = PtoPredAdjust(pc->y_u.Osblp.p0);
|
||||
pc = NEXTOP(pc,Osblp);
|
||||
break;
|
||||
/* instructions type Osbmp */
|
||||
case _traced_p_execute:
|
||||
case _traced_p_execute_tail:
|
||||
OrArgAdjust(pc->y_u.Osbmp.or_arg);
|
||||
pc->y_u.Osbmp.s = ConstantAdjust(pc->y_u.Osbmp.s);
|
||||
pc->y_u.Osbmp.bmap = CellPtoHeapAdjust(pc->y_u.Osbmp.bmap);
|
||||
pc->y_u.Osbmp.mod = ModuleAdjust(pc->y_u.Osbmp.mod);
|
||||
pc->y_u.Osbmp.p0 = PtoPredAdjust(pc->y_u.Osbmp.p0);
|
||||
pc = NEXTOP(pc,Osbmp);
|
||||
break;
|
||||
/* instructions type Osbpa */
|
||||
case _traced_ensure_space:
|
||||
OrArgAdjust(pc->y_u.Osbpa.or_arg);
|
||||
pc->y_u.Osbpa.s = ConstantAdjust(pc->y_u.Osbpa.s);
|
||||
pc->y_u.Osbpa.bmap = CellPtoHeapAdjust(pc->y_u.Osbpa.bmap);
|
||||
pc->y_u.Osbpa.p = PtoPredAdjust(pc->y_u.Osbpa.p);
|
||||
pc->y_u.Osbpa.i = ArityAdjust(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:
|
||||
OrArgAdjust(pc->y_u.Osbpp.or_arg);
|
||||
pc->y_u.Osbpp.s = ConstantAdjust(pc->y_u.Osbpp.s);
|
||||
pc->y_u.Osbpp.bmap = CellPtoHeapAdjust(pc->y_u.Osbpp.bmap);
|
||||
pc->y_u.Osbpp.p = PtoPredAdjust(pc->y_u.Osbpp.p);
|
||||
pc->y_u.Osbpp.p0 = PtoPredAdjust(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:
|
||||
OrArgAdjust(pc->y_u.OtILl.or_arg);
|
||||
TabEntryAdjust(pc->y_u.OtILl.te);
|
||||
pc->y_u.OtILl.block = PtoLUIndexAdjust(pc->y_u.OtILl.block);
|
||||
pc->y_u.OtILl.d = PtoLUClauseAdjust(pc->y_u.OtILl.d);
|
||||
pc->y_u.OtILl.n = PtoOpAdjust(pc->y_u.OtILl.n);
|
||||
pc = opc;
|
||||
break;
|
||||
/* instructions type OtaLl */
|
||||
case _traced_count_retry_logical:
|
||||
case _traced_profiled_retry_logical:
|
||||
case _traced_retry_logical:
|
||||
case _traced_try_logical:
|
||||
OrArgAdjust(pc->y_u.OtaLl.or_arg);
|
||||
TabEntryAdjust(pc->y_u.OtaLl.te);
|
||||
pc->y_u.OtaLl.s = ArityAdjust(pc->y_u.OtaLl.s);
|
||||
pc->y_u.OtaLl.d = PtoLUClauseAdjust(pc->y_u.OtaLl.d);
|
||||
pc->y_u.OtaLl.n = PtoOpAdjust(pc->y_u.OtaLl.n);
|
||||
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:
|
||||
OrArgAdjust(pc->y_u.OtapFs.or_arg);
|
||||
TabEntryAdjust(pc->y_u.OtapFs.te);
|
||||
pc->y_u.OtapFs.s = ArityAdjust(pc->y_u.OtapFs.s);
|
||||
pc->y_u.OtapFs.p = PtoPredAdjust(pc->y_u.OtapFs.p);
|
||||
pc->y_u.OtapFs.f = ExternalFunctionAdjust(pc->y_u.OtapFs.f);
|
||||
pc->y_u.OtapFs.extra = ConstantAdjust(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:
|
||||
OrArgAdjust(pc->y_u.Otapl.or_arg);
|
||||
TabEntryAdjust(pc->y_u.Otapl.te);
|
||||
pc->y_u.Otapl.s = ArityAdjust(pc->y_u.Otapl.s);
|
||||
pc->y_u.Otapl.p = PtoPredAdjust(pc->y_u.Otapl.p);
|
||||
pc->y_u.Otapl.d = PtoOpAdjust(pc->y_u.Otapl.d);
|
||||
pc = NEXTOP(pc,Otapl);
|
||||
break;
|
||||
/* instructions type c */
|
||||
case _traced_write_atom:
|
||||
pc->y_u.c.c = ConstantTermAdjust(pc->y_u.c.c);
|
||||
pc = NEXTOP(pc,c);
|
||||
break;
|
||||
/* instructions type cc */
|
||||
case _traced_get_2atoms:
|
||||
pc->y_u.cc.c1 = ConstantTermAdjust(pc->y_u.cc.c1);
|
||||
pc->y_u.cc.c2 = ConstantTermAdjust(pc->y_u.cc.c2);
|
||||
pc = NEXTOP(pc,cc);
|
||||
break;
|
||||
/* instructions type ccc */
|
||||
case _traced_get_3atoms:
|
||||
pc->y_u.ccc.c1 = ConstantTermAdjust(pc->y_u.ccc.c1);
|
||||
pc->y_u.ccc.c2 = ConstantTermAdjust(pc->y_u.ccc.c2);
|
||||
pc->y_u.ccc.c3 = ConstantTermAdjust(pc->y_u.ccc.c3);
|
||||
pc = NEXTOP(pc,ccc);
|
||||
break;
|
||||
/* instructions type cccc */
|
||||
case _traced_get_4atoms:
|
||||
pc->y_u.cccc.c1 = ConstantTermAdjust(pc->y_u.cccc.c1);
|
||||
pc->y_u.cccc.c2 = ConstantTermAdjust(pc->y_u.cccc.c2);
|
||||
pc->y_u.cccc.c3 = ConstantTermAdjust(pc->y_u.cccc.c3);
|
||||
pc->y_u.cccc.c4 = ConstantTermAdjust(pc->y_u.cccc.c4);
|
||||
pc = NEXTOP(pc,cccc);
|
||||
break;
|
||||
/* instructions type ccccc */
|
||||
case _traced_get_5atoms:
|
||||
pc->y_u.ccccc.c1 = ConstantTermAdjust(pc->y_u.ccccc.c1);
|
||||
pc->y_u.ccccc.c2 = ConstantTermAdjust(pc->y_u.ccccc.c2);
|
||||
pc->y_u.ccccc.c3 = ConstantTermAdjust(pc->y_u.ccccc.c3);
|
||||
pc->y_u.ccccc.c4 = ConstantTermAdjust(pc->y_u.ccccc.c4);
|
||||
pc->y_u.ccccc.c5 = ConstantTermAdjust(pc->y_u.ccccc.c5);
|
||||
pc = NEXTOP(pc,ccccc);
|
||||
break;
|
||||
/* instructions type cccccc */
|
||||
case _traced_get_6atoms:
|
||||
pc->y_u.cccccc.c1 = ConstantTermAdjust(pc->y_u.cccccc.c1);
|
||||
pc->y_u.cccccc.c2 = ConstantTermAdjust(pc->y_u.cccccc.c2);
|
||||
pc->y_u.cccccc.c3 = ConstantTermAdjust(pc->y_u.cccccc.c3);
|
||||
pc->y_u.cccccc.c4 = ConstantTermAdjust(pc->y_u.cccccc.c4);
|
||||
pc->y_u.cccccc.c5 = ConstantTermAdjust(pc->y_u.cccccc.c5);
|
||||
pc->y_u.cccccc.c6 = ConstantTermAdjust(pc->y_u.cccccc.c6);
|
||||
pc = NEXTOP(pc,cccccc);
|
||||
break;
|
||||
/* instructions type clll */
|
||||
case _traced_if_not_then:
|
||||
pc->y_u.clll.c = ConstantTermAdjust(pc->y_u.clll.c);
|
||||
pc->y_u.clll.l1 = PtoOpAdjust(pc->y_u.clll.l1);
|
||||
pc->y_u.clll.l2 = PtoOpAdjust(pc->y_u.clll.l2);
|
||||
pc->y_u.clll.l3 = PtoOpAdjust(pc->y_u.clll.l3);
|
||||
pc = NEXTOP(pc,clll);
|
||||
break;
|
||||
/* instructions type d */
|
||||
case _traced_write_float:
|
||||
DoubleInCodeAdjust(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;
|
||||
pc = NEXTOP(pc,e);
|
||||
break;
|
||||
/* instructions type fa */
|
||||
case _traced_write_l_struc:
|
||||
case _traced_write_struct:
|
||||
pc->y_u.fa.f = FuncAdjust(pc->y_u.fa.f);
|
||||
pc->y_u.fa.a = ArityAdjust(pc->y_u.fa.a);
|
||||
pc = NEXTOP(pc,fa);
|
||||
break;
|
||||
/* instructions type i */
|
||||
case _traced_write_longint:
|
||||
IntegerInCodeAdjust(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:
|
||||
pc->y_u.l.l = PtoOpAdjust(pc->y_u.l.l);
|
||||
if (op == _Ystop) return;
|
||||
pc = NEXTOP(pc,l);
|
||||
break;
|
||||
/* instructions type llll */
|
||||
case _traced_switch_on_type:
|
||||
pc->y_u.llll.l1 = PtoOpAdjust(pc->y_u.llll.l1);
|
||||
pc->y_u.llll.l2 = PtoOpAdjust(pc->y_u.llll.l2);
|
||||
pc->y_u.llll.l3 = PtoOpAdjust(pc->y_u.llll.l3);
|
||||
pc->y_u.llll.l4 = PtoOpAdjust(pc->y_u.llll.l4);
|
||||
pc = NEXTOP(pc,llll);
|
||||
break;
|
||||
/* instructions type lp */
|
||||
case _traced_user_switch:
|
||||
pc->y_u.lp.l = PtoOpAdjust(pc->y_u.lp.l);
|
||||
pc->y_u.lp.p = PtoPredAdjust(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:
|
||||
pc->y_u.o.opcw = OpcodeAdjust(pc->y_u.o.opcw);
|
||||
pc = NEXTOP(pc,o);
|
||||
break;
|
||||
/* instructions type oD */
|
||||
case _traced_unify_dbterm:
|
||||
case _traced_unify_l_dbterm:
|
||||
pc->y_u.oD.opcw = OpcodeAdjust(pc->y_u.oD.opcw);
|
||||
pc->y_u.oD.D = DBGroundTermAdjust(pc->y_u.oD.D);
|
||||
pc = NEXTOP(pc,oD);
|
||||
break;
|
||||
/* instructions type oN */
|
||||
case _traced_unify_bigint:
|
||||
case _traced_unify_l_bigint:
|
||||
pc->y_u.oN.opcw = OpcodeAdjust(pc->y_u.oN.opcw);
|
||||
pc->y_u.oN.b = BlobTermInCodeAdjust(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:
|
||||
pc->y_u.oc.opcw = OpcodeAdjust(pc->y_u.oc.opcw);
|
||||
pc->y_u.oc.c = ConstantTermAdjust(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:
|
||||
pc->y_u.od.opcw = OpcodeAdjust(pc->y_u.od.opcw);
|
||||
DoubleInCodeAdjust(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:
|
||||
pc->y_u.ofa.opcw = OpcodeAdjust(pc->y_u.ofa.opcw);
|
||||
pc->y_u.ofa.f = FuncAdjust(pc->y_u.ofa.f);
|
||||
pc->y_u.ofa.a = ArityAdjust(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:
|
||||
pc->y_u.oi.opcw = OpcodeAdjust(pc->y_u.oi.opcw);
|
||||
IntegerInCodeAdjust(pc->y_u.oi.i);
|
||||
pc = NEXTOP(pc,oi);
|
||||
break;
|
||||
/* instructions type ollll */
|
||||
case _traced_switch_list_nl:
|
||||
pc->y_u.ollll.pop = OpcodeAdjust(pc->y_u.ollll.pop);
|
||||
pc->y_u.ollll.l1 = PtoOpAdjust(pc->y_u.ollll.l1);
|
||||
pc->y_u.ollll.l2 = PtoOpAdjust(pc->y_u.ollll.l2);
|
||||
pc->y_u.ollll.l3 = PtoOpAdjust(pc->y_u.ollll.l3);
|
||||
pc->y_u.ollll.l4 = PtoOpAdjust(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:
|
||||
pc->y_u.os.opcw = OpcodeAdjust(pc->y_u.os.opcw);
|
||||
pc->y_u.os.s = ConstantAdjust(pc->y_u.os.s);
|
||||
pc = NEXTOP(pc,os);
|
||||
break;
|
||||
/* instructions type osc */
|
||||
case _traced_unify_n_atoms:
|
||||
case _traced_unify_n_atoms_write:
|
||||
pc->y_u.osc.opcw = OpcodeAdjust(pc->y_u.osc.opcw);
|
||||
pc->y_u.osc.s = ConstantAdjust(pc->y_u.osc.s);
|
||||
pc->y_u.osc.c = ConstantTermAdjust(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:
|
||||
pc->y_u.ox.opcw = OpcodeAdjust(pc->y_u.ox.opcw);
|
||||
pc->y_u.ox.x = XAdjust(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:
|
||||
pc->y_u.oxx.opcw = OpcodeAdjust(pc->y_u.oxx.opcw);
|
||||
pc->y_u.oxx.xl = XAdjust(pc->y_u.oxx.xl);
|
||||
pc->y_u.oxx.xr = XAdjust(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:
|
||||
pc->y_u.oy.opcw = OpcodeAdjust(pc->y_u.oy.opcw);
|
||||
pc->y_u.oy.y = YAdjust(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:
|
||||
pc->y_u.p.p = PtoPredAdjust(pc->y_u.p.p);
|
||||
pc = NEXTOP(pc,p);
|
||||
break;
|
||||
/* instructions type plxxs */
|
||||
case _traced_call_bfunc_xx:
|
||||
pc->y_u.plxxs.p = PtoPredAdjust(pc->y_u.plxxs.p);
|
||||
pc->y_u.plxxs.f = PtoOpAdjust(pc->y_u.plxxs.f);
|
||||
pc->y_u.plxxs.x1 = XAdjust(pc->y_u.plxxs.x1);
|
||||
pc->y_u.plxxs.x2 = XAdjust(pc->y_u.plxxs.x2);
|
||||
pc->y_u.plxxs.flags = ConstantAdjust(pc->y_u.plxxs.flags);
|
||||
pc = NEXTOP(pc,plxxs);
|
||||
break;
|
||||
/* instructions type plxys */
|
||||
case _traced_call_bfunc_xy:
|
||||
case _traced_call_bfunc_yx:
|
||||
pc->y_u.plxys.p = PtoPredAdjust(pc->y_u.plxys.p);
|
||||
pc->y_u.plxys.f = PtoOpAdjust(pc->y_u.plxys.f);
|
||||
pc->y_u.plxys.x = XAdjust(pc->y_u.plxys.x);
|
||||
pc->y_u.plxys.y = YAdjust(pc->y_u.plxys.y);
|
||||
pc->y_u.plxys.flags = ConstantAdjust(pc->y_u.plxys.flags);
|
||||
pc = NEXTOP(pc,plxys);
|
||||
break;
|
||||
/* instructions type plyys */
|
||||
case _traced_call_bfunc_yy:
|
||||
pc->y_u.plyys.p = PtoPredAdjust(pc->y_u.plyys.p);
|
||||
pc->y_u.plyys.f = PtoOpAdjust(pc->y_u.plyys.f);
|
||||
pc->y_u.plyys.y1 = YAdjust(pc->y_u.plyys.y1);
|
||||
pc->y_u.plyys.y2 = YAdjust(pc->y_u.plyys.y2);
|
||||
pc->y_u.plyys.flags = ConstantAdjust(pc->y_u.plyys.flags);
|
||||
pc = NEXTOP(pc,plyys);
|
||||
break;
|
||||
/* instructions type pp */
|
||||
case _traced_dexecute:
|
||||
case _traced_execute:
|
||||
case _traced_execute_cpred:
|
||||
pc->y_u.pp.p = PtoPredAdjust(pc->y_u.pp.p);
|
||||
pc->y_u.pp.p0 = PtoPredAdjust(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->y_u.s.s = ConstantAdjust(pc->y_u.s.s);
|
||||
pc = NEXTOP(pc,s);
|
||||
break;
|
||||
/* instructions type sc */
|
||||
case _traced_write_n_atoms:
|
||||
pc->y_u.sc.s = ConstantAdjust(pc->y_u.sc.s);
|
||||
pc->y_u.sc.c = ConstantTermAdjust(pc->y_u.sc.c);
|
||||
pc = NEXTOP(pc,sc);
|
||||
break;
|
||||
/* instructions type sllll */
|
||||
case _traced_switch_on_sub_arg_type:
|
||||
pc->y_u.sllll.s = ConstantAdjust(pc->y_u.sllll.s);
|
||||
pc->y_u.sllll.l1 = PtoOpAdjust(pc->y_u.sllll.l1);
|
||||
pc->y_u.sllll.l2 = PtoOpAdjust(pc->y_u.sllll.l2);
|
||||
pc->y_u.sllll.l3 = PtoOpAdjust(pc->y_u.sllll.l3);
|
||||
pc->y_u.sllll.l4 = PtoOpAdjust(pc->y_u.sllll.l4);
|
||||
pc = NEXTOP(pc,sllll);
|
||||
break;
|
||||
/* instructions type slp */
|
||||
case _traced_call_c_wfail:
|
||||
pc->y_u.slp.s = ConstantAdjust(pc->y_u.slp.s);
|
||||
pc->y_u.slp.l = PtoOpAdjust(pc->y_u.slp.l);
|
||||
pc->y_u.slp.p = PtoPredAdjust(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:
|
||||
pc->y_u.sssl.s = ConstantAdjust(pc->y_u.sssl.s);
|
||||
pc->y_u.sssl.e = ConstantAdjust(pc->y_u.sssl.e);
|
||||
pc->y_u.sssl.w = ConstantAdjust(pc->y_u.sssl.w);
|
||||
pc->y_u.sssl.l = PtoOpAdjust(pc->y_u.sssl.l);
|
||||
AdjustSwitchTable(op, pc->y_u.sssl.l, pc->y_u.sssl.s);
|
||||
pc = NEXTOP(pc,sssl);
|
||||
break;
|
||||
/* instructions type sssllp */
|
||||
case _traced_expand_clauses:
|
||||
pc->y_u.sssllp.s1 = ConstantAdjust(pc->y_u.sssllp.s1);
|
||||
pc->y_u.sssllp.s2 = ConstantAdjust(pc->y_u.sssllp.s2);
|
||||
pc->y_u.sssllp.s3 = ConstantAdjust(pc->y_u.sssllp.s3);
|
||||
pc->y_u.sssllp.sprev = PtoOpAdjust(pc->y_u.sssllp.sprev);
|
||||
pc->y_u.sssllp.snext = PtoOpAdjust(pc->y_u.sssllp.snext);
|
||||
pc->y_u.sssllp.p = PtoPredAdjust(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:
|
||||
pc->y_u.x.x = XAdjust(pc->y_u.x.x);
|
||||
pc = NEXTOP(pc,x);
|
||||
break;
|
||||
/* instructions type xD */
|
||||
case _traced_get_dbterm:
|
||||
case _traced_put_dbterm:
|
||||
pc->y_u.xD.x = XAdjust(pc->y_u.xD.x);
|
||||
pc->y_u.xD.D = DBGroundTermAdjust(pc->y_u.xD.D);
|
||||
pc = NEXTOP(pc,xD);
|
||||
break;
|
||||
/* instructions type xN */
|
||||
case _traced_get_bigint:
|
||||
case _traced_put_bigint:
|
||||
pc->y_u.xN.x = XAdjust(pc->y_u.xN.x);
|
||||
pc->y_u.xN.b = BlobTermInCodeAdjust(pc->y_u.xN.b);
|
||||
pc = NEXTOP(pc,xN);
|
||||
break;
|
||||
/* instructions type xc */
|
||||
case _traced_get_atom:
|
||||
case _traced_put_atom:
|
||||
pc->y_u.xc.x = XAdjust(pc->y_u.xc.x);
|
||||
pc->y_u.xc.c = ConstantTermAdjust(pc->y_u.xc.c);
|
||||
pc = NEXTOP(pc,xc);
|
||||
break;
|
||||
/* instructions type xd */
|
||||
case _traced_get_float:
|
||||
case _traced_put_float:
|
||||
pc->y_u.xd.x = XAdjust(pc->y_u.xd.x);
|
||||
DoubleInCodeAdjust(pc->y_u.xd.d);
|
||||
pc = NEXTOP(pc,xd);
|
||||
break;
|
||||
/* instructions type xfa */
|
||||
case _traced_get_struct:
|
||||
case _traced_put_struct:
|
||||
pc->y_u.xfa.x = XAdjust(pc->y_u.xfa.x);
|
||||
pc->y_u.xfa.f = FuncAdjust(pc->y_u.xfa.f);
|
||||
pc->y_u.xfa.a = ArityAdjust(pc->y_u.xfa.a);
|
||||
pc = NEXTOP(pc,xfa);
|
||||
break;
|
||||
/* instructions type xi */
|
||||
case _traced_get_longint:
|
||||
case _traced_put_longint:
|
||||
pc->y_u.xi.x = XAdjust(pc->y_u.xi.x);
|
||||
IntegerInCodeAdjust(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:
|
||||
pc->y_u.xl.x = XAdjust(pc->y_u.xl.x);
|
||||
pc->y_u.xl.F = PtoOpAdjust(pc->y_u.xl.F);
|
||||
pc = NEXTOP(pc,xl);
|
||||
break;
|
||||
/* instructions type xll */
|
||||
case _traced_jump_if_nonvar:
|
||||
pc->y_u.xll.x = XAdjust(pc->y_u.xll.x);
|
||||
pc->y_u.xll.l1 = PtoOpAdjust(pc->y_u.xll.l1);
|
||||
pc->y_u.xll.l2 = PtoOpAdjust(pc->y_u.xll.l2);
|
||||
pc = NEXTOP(pc,xll);
|
||||
break;
|
||||
/* instructions type xllll */
|
||||
case _traced_switch_on_arg_type:
|
||||
pc->y_u.xllll.x = XAdjust(pc->y_u.xllll.x);
|
||||
pc->y_u.xllll.l1 = PtoOpAdjust(pc->y_u.xllll.l1);
|
||||
pc->y_u.xllll.l2 = PtoOpAdjust(pc->y_u.xllll.l2);
|
||||
pc->y_u.xllll.l3 = PtoOpAdjust(pc->y_u.xllll.l3);
|
||||
pc->y_u.xllll.l4 = PtoOpAdjust(pc->y_u.xllll.l4);
|
||||
pc = NEXTOP(pc,xllll);
|
||||
break;
|
||||
/* instructions type xps */
|
||||
case _traced_commit_b_x:
|
||||
pc->y_u.xps.x = XAdjust(pc->y_u.xps.x);
|
||||
pc->y_u.xps.p0 = PtoPredAdjust(pc->y_u.xps.p0);
|
||||
pc->y_u.xps.s = ConstantAdjust(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:
|
||||
pc->y_u.xx.xl = XAdjust(pc->y_u.xx.xl);
|
||||
pc->y_u.xx.xr = XAdjust(pc->y_u.xx.xr);
|
||||
pc = NEXTOP(pc,xx);
|
||||
break;
|
||||
/* instructions type xxc */
|
||||
case _traced_p_func2s_cv:
|
||||
pc->y_u.xxc.x = XAdjust(pc->y_u.xxc.x);
|
||||
pc->y_u.xxc.xi = XAdjust(pc->y_u.xxc.xi);
|
||||
pc->y_u.xxc.c = ConstantTermAdjust(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:
|
||||
pc->y_u.xxn.x = XAdjust(pc->y_u.xxn.x);
|
||||
pc->y_u.xxn.xi = XAdjust(pc->y_u.xxn.xi);
|
||||
pc->y_u.xxn.c = IntegerAdjust(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:
|
||||
pc->y_u.xxx.x = XAdjust(pc->y_u.xxx.x);
|
||||
pc->y_u.xxx.x1 = XAdjust(pc->y_u.xxx.x1);
|
||||
pc->y_u.xxx.x2 = XAdjust(pc->y_u.xxx.x2);
|
||||
pc = NEXTOP(pc,xxx);
|
||||
break;
|
||||
/* instructions type xxxx */
|
||||
case _traced_put_xx_val:
|
||||
pc->y_u.xxxx.xl1 = XAdjust(pc->y_u.xxxx.xl1);
|
||||
pc->y_u.xxxx.xl2 = XAdjust(pc->y_u.xxxx.xl2);
|
||||
pc->y_u.xxxx.xr1 = XAdjust(pc->y_u.xxxx.xr1);
|
||||
pc->y_u.xxxx.xr2 = XAdjust(pc->y_u.xxxx.xr2);
|
||||
pc = NEXTOP(pc,xxxx);
|
||||
break;
|
||||
/* instructions type xxy */
|
||||
case _traced_p_func2f_xy:
|
||||
pc->y_u.xxy.x = XAdjust(pc->y_u.xxy.x);
|
||||
pc->y_u.xxy.x1 = XAdjust(pc->y_u.xxy.x1);
|
||||
pc->y_u.xxy.y2 = YAdjust(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:
|
||||
pc->y_u.y.y = YAdjust(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:
|
||||
pc->y_u.yl.y = YAdjust(pc->y_u.yl.y);
|
||||
pc->y_u.yl.F = PtoOpAdjust(pc->y_u.yl.F);
|
||||
pc = NEXTOP(pc,yl);
|
||||
break;
|
||||
/* instructions type yps */
|
||||
case _traced_commit_b_y:
|
||||
pc->y_u.yps.y = YAdjust(pc->y_u.yps.y);
|
||||
pc->y_u.yps.p0 = PtoPredAdjust(pc->y_u.yps.p0);
|
||||
pc->y_u.yps.s = ConstantAdjust(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:
|
||||
pc->y_u.yx.y = YAdjust(pc->y_u.yx.y);
|
||||
pc->y_u.yx.x = XAdjust(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:
|
||||
pc->y_u.yxn.y = YAdjust(pc->y_u.yxn.y);
|
||||
pc->y_u.yxn.xi = XAdjust(pc->y_u.yxn.xi);
|
||||
pc->y_u.yxn.c = IntegerAdjust(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:
|
||||
pc->y_u.yxx.y = YAdjust(pc->y_u.yxx.y);
|
||||
pc->y_u.yxx.x1 = XAdjust(pc->y_u.yxx.x1);
|
||||
pc->y_u.yxx.x2 = XAdjust(pc->y_u.yxx.x2);
|
||||
pc = NEXTOP(pc,yxx);
|
||||
break;
|
||||
/* instructions type yyx */
|
||||
case _traced_p_func2f_yy:
|
||||
pc->y_u.yyx.y1 = YAdjust(pc->y_u.yyx.y1);
|
||||
pc->y_u.yyx.y2 = YAdjust(pc->y_u.yyx.y2);
|
||||
pc->y_u.yyx.x = XAdjust(pc->y_u.yyx.x);
|
||||
pc = NEXTOP(pc,yyx);
|
||||
break;
|
||||
/* instructions type yyxx */
|
||||
case _traced_get_yy_var:
|
||||
case _traced_put_y_vals:
|
||||
pc->y_u.yyxx.y1 = YAdjust(pc->y_u.yyxx.y1);
|
||||
pc->y_u.yyxx.y2 = YAdjust(pc->y_u.yyxx.y2);
|
||||
pc->y_u.yyxx.x1 = XAdjust(pc->y_u.yyxx.x1);
|
||||
pc->y_u.yyxx.x2 = XAdjust(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:
|
||||
OrArgAdjust(pc->y_u.Otapl.or_arg);
|
||||
TabEntryAdjust(pc->y_u.Otapl.te);
|
||||
pc->y_u.Otapl.s = ArityAdjust(pc->y_u.Otapl.s);
|
||||
pc->y_u.Otapl.p = PtoPredAdjust(pc->y_u.Otapl.p);
|
||||
pc->y_u.Otapl.d = PtoOpAdjust(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;
|
||||
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:
|
||||
OrArgAdjust(pc->y_u.Otapl.or_arg);
|
||||
TabEntryAdjust(pc->y_u.Otapl.te);
|
||||
pc->y_u.Otapl.s = ArityAdjust(pc->y_u.Otapl.s);
|
||||
pc->y_u.Otapl.p = PtoPredAdjust(pc->y_u.Otapl.p);
|
||||
pc->y_u.Otapl.d = PtoOpAdjust(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;
|
||||
pc = NEXTOP(pc,e);
|
||||
break;
|
||||
/* instructions type s */
|
||||
case _traced_table_new_answer:
|
||||
pc->y_u.s.s = ConstantAdjust(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;
|
||||
pc = NEXTOP(pc,e);
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
/* this instruction is hardwired */
|
||||
#ifdef YAP_JIT
|
||||
case _traced_or_last:
|
||||
#ifdef YAPOR
|
||||
OrArgAdjust(pc->y_u.Osblp.or_arg);
|
||||
pc->y_u.Osblp.s = ConstantAdjust(pc->y_u.Osblp.s);
|
||||
pc->y_u.Osblp.bmap = CellPtoHeapAdjust(pc->y_u.Osblp.bmap);
|
||||
pc->y_u.Osblp.l = PtoOpAdjust(pc->y_u.Osblp.l);
|
||||
pc->y_u.Osblp.p0 = PtoPredAdjust(pc->y_u.Osblp.p0);
|
||||
pc = NEXTOP(pc,Osblp);
|
||||
break;
|
||||
#else
|
||||
pc->y_u.p.p = PtoPredAdjust(pc->y_u.p.p);
|
||||
pc = NEXTOP(pc,p);
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
case _or_last:
|
||||
#ifdef YAPOR
|
||||
OrArgAdjust(pc->y_u.Osblp.or_arg);
|
||||
|
910
H/saveclause.h
910
H/saveclause.h
@ -960,916 +960,6 @@
|
||||
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;
|
||||
}
|
||||
|
672
H/walkclause.h
672
H/walkclause.h
@ -726,680 +726,8 @@
|
||||
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;
|
||||
|
@ -10,6 +10,7 @@ set(LIBJIT_SOURCES
|
||||
jit_statisticpreds.c
|
||||
jit_codegenpreds.c
|
||||
jit_debugpreds.c
|
||||
jit_traced.c
|
||||
jit_transformpreds.c
|
||||
JIT_Compiler.cpp
|
||||
JIT_Init.cpp
|
||||
@ -61,6 +62,6 @@ set_target_properties(libyapjit
|
||||
OUTPUT_NAME YapJIT
|
||||
)
|
||||
|
||||
target_link_libraries(libyapjit libYap ${LLVM_LIBRARIES} )
|
||||
target_link_libraries(libyapjit libYap ${LLVM_LIBRARIES} z)
|
||||
|
||||
set ( YAP_YAPJITLIB $<TARGET_FILE_NAME:libyapjit> )
|
||||
|
1203
JIT/HPP/IsGround.h
1203
JIT/HPP/IsGround.h
File diff suppressed because it is too large
Load Diff
@ -12,6 +12,9 @@
|
||||
#include <time.h>
|
||||
#include <dlfcn.h>
|
||||
#include "config.h"
|
||||
#if USE_GMP
|
||||
#include <gmpxx.h>
|
||||
#endif
|
||||
extern "C" {
|
||||
#include "absmi.h"
|
||||
}
|
||||
|
@ -89,26 +89,21 @@ class JIT_Compiler {
|
||||
/* 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
|
||||
extern "C" void* call_JIT_Compiler(JIT_Compiler* jc, yamop* p);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" void* call_JIT_Compiler(JIT_Compiler* jc, yamop* p) { return jc->compile(p); }
|
||||
|
||||
extern "C" void shutdown_llvm() { llvm_shutdown(); }
|
||||
extern "C" void shutdown_llvm();
|
||||
|
||||
#else
|
||||
|
||||
INLINE_ONLY inline EXTERN void* call_JIT_Compiler(struct JIT_Compiler* jc, yamop* p);
|
||||
typedef struct jit_compiler JIT_Compiler;
|
||||
|
||||
extern void* (*Yap_JitCall)(struct JIT_Compiler* jc, yamop* p);
|
||||
EXTERN void* (*Yap_JitCall)(JIT_Compiler* jc, yamop* p);
|
||||
|
||||
INLINE_ONLY inline EXTERN void* call_JIT_Compiler(JIT_Compiler* jc, yamop* p);
|
||||
|
||||
INLINE_ONLY inline EXTERN void* call_JIT_Compiler(struct JIT_Compiler* jc, yamop* p) { return Yap_JitCall (jc,p); }
|
||||
INLINE_ONLY inline EXTERN void* call_JIT_Compiler(JIT_Compiler* jc, yamop* p) {
|
||||
return Yap_JitCall (jc,p); }
|
||||
|
||||
INLINE_ONLY inline EXTERN void shutdown_llvm(void ) ;
|
||||
|
||||
@ -116,6 +111,6 @@ EXTERN void (* Yap_llvmShutdown)(void ) ;
|
||||
|
||||
INLINE_ONLY inline EXTERN void shutdown_llvm(void ) { Yap_llvmShutdown (); }
|
||||
|
||||
#endif //#ifdef __cplusplus
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -30,8 +30,8 @@ struct CallGraphSCCPassPrinter : public CallGraphSCCPass {
|
||||
const PassInfo *PassToPrint;
|
||||
std::string PassName;
|
||||
|
||||
CallGraphSCCPassPrinter(const PassInfo *PI) :
|
||||
CallGraphSCCPass(ID), PassToPrint(PI) {
|
||||
CallGraphSCCPassPrinter(const PassInfo *PassInfo) :
|
||||
CallGraphSCCPass(ID), PassToPrint(PassInfo) {
|
||||
std::string PassToPrintName = PassToPrint->getPassName();
|
||||
PassName = "CallGraphSCCPass Printer: " + PassToPrintName;
|
||||
}
|
||||
@ -64,8 +64,8 @@ struct ModulePassPrinter : public ModulePass {
|
||||
const PassInfo *PassToPrint;
|
||||
std::string PassName;
|
||||
|
||||
ModulePassPrinter(const PassInfo *PI)
|
||||
: ModulePass(ID), PassToPrint(PI) {
|
||||
ModulePassPrinter(const PassInfo *PassInfo)
|
||||
: ModulePass(ID), PassToPrint(PassInfo) {
|
||||
std::string PassToPrintName = PassToPrint->getPassName();
|
||||
PassName = "ModulePass Printer: " + PassToPrintName;
|
||||
}
|
||||
@ -93,8 +93,8 @@ struct FunctionPassPrinter : public FunctionPass {
|
||||
static char ID;
|
||||
std::string PassName;
|
||||
|
||||
FunctionPassPrinter(const PassInfo *PI)
|
||||
: FunctionPass(ID), PassToPrint(PI) {
|
||||
FunctionPassPrinter(const PassInfo *PassInfo)
|
||||
: FunctionPass(ID), PassToPrint(PassInfo) {
|
||||
std::string PassToPrintName = PassToPrint->getPassName();
|
||||
PassName = "FunctionPass Printer: " + PassToPrintName;
|
||||
}
|
||||
@ -124,8 +124,8 @@ struct LoopPassPrinter : public LoopPass {
|
||||
const PassInfo *PassToPrint;
|
||||
std::string PassName;
|
||||
|
||||
LoopPassPrinter(const PassInfo *PI) :
|
||||
LoopPass(ID), PassToPrint(PI) {
|
||||
LoopPassPrinter(const PassInfo *PassInfo) :
|
||||
LoopPass(ID), PassToPrint(PassInfo) {
|
||||
std::string PassToPrintName = PassToPrint->getPassName();
|
||||
PassName = "LoopPass Printer: " + PassToPrintName;
|
||||
}
|
||||
@ -155,8 +155,8 @@ struct RegionPassPrinter : public RegionPass {
|
||||
const PassInfo *PassToPrint;
|
||||
std::string PassName;
|
||||
|
||||
RegionPassPrinter(const PassInfo *PI) : RegionPass(ID),
|
||||
PassToPrint(PI) {
|
||||
RegionPassPrinter(const PassInfo *PassInfo) : RegionPass(ID),
|
||||
PassToPrint(PassInfo) {
|
||||
std::string PassToPrintName = PassToPrint->getPassName();
|
||||
PassName = "RegionPass Printer: " + PassToPrintName;
|
||||
}
|
||||
|
1192
JIT/HPP/lastop.h
1192
JIT/HPP/lastop.h
File diff suppressed because it is too large
Load Diff
1191
JIT/HPP/nextof.hpp
1191
JIT/HPP/nextof.hpp
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
58
JIT/JIT_Init.cpp
Normal file
58
JIT/JIT_Init.cpp
Normal file
@ -0,0 +1,58 @@
|
||||
|
||||
#include "JIT_Compiler.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-function-declaration"
|
||||
|
||||
extern "C" void Yap_InitJitAnalysisPreds(void);
|
||||
extern "C" void Yap_InitJitTransformPreds(void);
|
||||
extern "C" void Yap_InitJitCodegenPreds(void);
|
||||
extern "C" void Yap_InitJitConfigPreds(void);
|
||||
#if YAP_STAT_PREDS
|
||||
extern "C" void Yap_InitJitStatisticPreds(void);
|
||||
#endif
|
||||
#if YAP_DBG_PREDS
|
||||
extern "C" void Yap_InitJitDebugPreds(void);
|
||||
#endif
|
||||
|
||||
// global variables with intercae
|
||||
extern "C" void* (*Yap_JitCall)(JIT_Compiler* jc, yamop* p);
|
||||
extern "C" void (* Yap_llvmShutdown)( ) ;
|
||||
extern "C" Int (* Yap_traced_absmi)( ) ;
|
||||
|
||||
void init_jit();
|
||||
|
||||
extern "C" void* call_JIT_Compiler(JIT_Compiler* jc, yamop* p) {
|
||||
return jc->compile(p); }
|
||||
|
||||
extern "C" void shutdown_llvm() { llvm_shutdown(); }
|
||||
|
||||
extern "C" Int traced_absmi();
|
||||
|
||||
static void
|
||||
initJit(void)
|
||||
{
|
||||
Yap_InitJitAnalysisPreds();
|
||||
Yap_InitJitTransformPreds();
|
||||
Yap_InitJitCodegenPreds();
|
||||
Yap_InitJitConfigPreds();
|
||||
#if YAP_STAT_PREDS
|
||||
Yap_InitJitStatisticPreds();
|
||||
#endif
|
||||
#if YAP_DBG_PREDS
|
||||
Yap_InitJitDebugPreds();
|
||||
#endif
|
||||
Yap_JitCall = call_JIT_Compiler;
|
||||
Yap_llvmShutdown = llvm_shutdown;
|
||||
Yap_traced_absmi = traced_absmi;
|
||||
}
|
||||
|
||||
// export JIT as DLL
|
||||
void
|
||||
init_jit() {
|
||||
initJit();
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
38
JIT/JIT_interface.cpp
Normal file
38
JIT/JIT_interface.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
#if YAP_JIT
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-function-declaration"
|
||||
|
||||
typedef void *(*call_jitc_t)(struct JIT_Compiler*, yamop *);
|
||||
|
||||
void *call_JIT_Compiler(struct JIT_Compiler*, yamop *);
|
||||
|
||||
static void
|
||||
initJit(void)
|
||||
{
|
||||
extern void shutdown_llvm(void);
|
||||
extern call_jitc_t Yap_JITCall;
|
||||
|
||||
Yap_InitJitAnalysisPreds();
|
||||
Yap_InitJitTransformPreds();
|
||||
Yap_InitJitCodegenPreds();
|
||||
Yap_InitJitConfigPreds();
|
||||
#if YAP_STAT_PREDS
|
||||
Yap_InitJitStatisticPreds();
|
||||
#endif
|
||||
#if YAP_DBG_PREDS
|
||||
Yap_InitJitDebugPreds();
|
||||
#endif
|
||||
GLOBAL_JIT_finalizer = shutdown_llvm;
|
||||
Yap_JITCall = call_JIT_Compiler;
|
||||
Yap_llvmShutdown = llvm_shutdown;
|
||||
|
||||
}
|
||||
|
||||
// export JIT as DLL
|
||||
void
|
||||
init_jit(void) {
|
||||
initJit();
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
#endif /* YAP_JIT */
|
||||
|
@ -590,7 +590,7 @@ p_analysis_output_file( USES_REGS1 )
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
void
|
||||
void
|
||||
Yap_InitJitAnalysisPreds(void)
|
||||
{
|
||||
Yap_InitCPred("disable_analysis_pass", 1, p_disable_analysis_pass, SafePredFlag);
|
||||
|
267
JIT/jit_traced.c
Normal file
267
JIT/jit_traced.c
Normal file
@ -0,0 +1,267 @@
|
||||
/*************************************************************************
|
||||
* *
|
||||
* Yap Prolog *
|
||||
* *
|
||||
* Yap Prolog was developed at NCCUP - Universidade do Porto *
|
||||
* *
|
||||
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 *
|
||||
* *
|
||||
**************************************************************************
|
||||
* *
|
||||
* File: jit_traced.c *
|
||||
* comments: Portable abstract machine interpreter *
|
||||
* Last rev: $Date: 2008-08-13 01:16:26 $,$Author: vsc $ *
|
||||
* *
|
||||
*************************************************************************/
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@file jit_traced.c
|
||||
|
||||
@defgroup JIT_Impl Just-In-Time Compiler Implementation
|
||||
@ingroup
|
||||
|
||||
We next discuss several issues on trying to make Prolog programs run
|
||||
fast in YAP. We assume two different programming styles:
|
||||
|
||||
+ Execution of <em>deterministic</em> programs ofte
|
||||
n
|
||||
boils down to a recursive loop of the form:
|
||||
|
||||
~~~~~
|
||||
loop(Env) :-
|
||||
do_something(Env,NewEnv),
|
||||
loop(NewEnv).
|
||||
~~~~~
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#if YAP_JIT
|
||||
|
||||
#define YAP_TRACED 1
|
||||
#define IN_ABSMI_C 1
|
||||
#define HAS_CACHE_REGS 1
|
||||
|
||||
#include "absmi.h"
|
||||
#include "heapgc.h"
|
||||
|
||||
#include "cut_c.h"
|
||||
|
||||
Int traced_absmi(void);
|
||||
|
||||
#ifdef PUSH_X
|
||||
#else
|
||||
|
||||
/* keep X as a global variable */
|
||||
|
||||
Term Yap_XREGS[MaxTemps]; /* 29 */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// #include "print_preg.h"
|
||||
//#include "sprint_op.hpp"
|
||||
//#include "print_op.hpp"
|
||||
|
||||
static Term
|
||||
interrupt_pexecute( PredEntry *pen USES_REGS ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include "IsGround.h"
|
||||
#include "yaam_macros.hpp"
|
||||
#include "fprintblock.h"
|
||||
|
||||
#if YAP_DBG_PREDS
|
||||
#include "debug_printers.h"
|
||||
#endif
|
||||
|
||||
// ref to JIT compiler
|
||||
JIT_Compiler *J;
|
||||
|
||||
|
||||
extern NativeContext *NativeArea;
|
||||
extern IntermediatecodeContext *IntermediatecodeArea;
|
||||
|
||||
extern CELL l;
|
||||
|
||||
CELL nnexec;
|
||||
|
||||
void shutdown_llvm(void);
|
||||
|
||||
short global;
|
||||
yamop* HEADPREG;
|
||||
CELL BLOCK;
|
||||
CELL BLOCKADDRESS;
|
||||
CELL FAILED;
|
||||
|
||||
#undef SHADOW_P
|
||||
#undef SHADOW_CP
|
||||
#undef SHADOW_HB
|
||||
#undef SHADOW_Y
|
||||
#undef SHADOW_S
|
||||
|
||||
#undef PREG
|
||||
#define PREG P
|
||||
|
||||
#undef CPREG
|
||||
#define CPREG CP
|
||||
|
||||
#undef SREG
|
||||
#define SREG S
|
||||
|
||||
#undef YREG
|
||||
#define YREG YENV
|
||||
|
||||
#undef setregs
|
||||
#define setregs()
|
||||
|
||||
#undef saveregs
|
||||
#define saveregs()
|
||||
|
||||
#include "arith2.h"
|
||||
|
||||
Int
|
||||
traced_absmi(void)
|
||||
{
|
||||
CACHE_REGS
|
||||
|
||||
static void *OpAddress[] =
|
||||
{
|
||||
#define OPCODE(OP,TYPE) && OP
|
||||
#include "YapOpcodes.h"
|
||||
#undef OPCODE
|
||||
};
|
||||
|
||||
/* The indexing register so that we will not destroy ARG1 without
|
||||
* reason */
|
||||
#define I_R (XREGS[0])
|
||||
|
||||
static void *control_labels[] = { &&fail, &&NoStackCut, &&NoStackCommitY, &&NoStackCutE, &&NoStackCutT, &&NoStackEither, &&NoStackExecute, &&NoStackCall, &&NoStackDExecute, &&NoStackDeallocate, &¬railleft, &&NoStackFail, &&NoStackCommitX };
|
||||
|
||||
#if YAP_STAT_PREDS
|
||||
struct timeval timstart, timend;
|
||||
struct rusage rustart, ruend;
|
||||
#endif
|
||||
curtrace = NULL;
|
||||
curpreg = NULL;
|
||||
globalcurblock = NULL;
|
||||
ineedredefinedest = 0;
|
||||
NativeArea = (NativeContext*)malloc(sizeof(NativeContext));
|
||||
NativeArea->area.p = NULL;
|
||||
NativeArea->area.ok = NULL;
|
||||
NativeArea->area.pc = NULL;
|
||||
#if YAP_STAT_PREDS
|
||||
NativeArea->area.nrecomp = NULL;
|
||||
NativeArea->area.compilation_time = NULL;
|
||||
NativeArea->area.native_size_bytes = NULL;
|
||||
NativeArea->area.trace_size_bytes = NULL;
|
||||
NativeArea->success = NULL;
|
||||
NativeArea->runs = NULL;
|
||||
NativeArea->t_runs = NULL;
|
||||
#endif
|
||||
NativeArea->n = 0;
|
||||
IntermediatecodeArea = (IntermediatecodeContext*)malloc(sizeof(IntermediatecodeContext));
|
||||
IntermediatecodeArea->area.t = NULL;
|
||||
IntermediatecodeArea->area.ok = NULL;
|
||||
IntermediatecodeArea->area.isactive = NULL;
|
||||
IntermediatecodeArea->area.lastblock = NULL;
|
||||
#if YAP_STAT_PREDS
|
||||
IntermediatecodeArea->area.profiling_time = NULL;
|
||||
#endif
|
||||
IntermediatecodeArea->n = 0;
|
||||
nnexec = 0;
|
||||
l = 0;
|
||||
|
||||
|
||||
|
||||
setregs();
|
||||
|
||||
CACHE_A1();
|
||||
|
||||
reset_absmi:
|
||||
|
||||
SP = SP0;
|
||||
|
||||
/* when we start we are not in write mode */
|
||||
|
||||
{
|
||||
op_numbers opcode = _Ystop;
|
||||
goto critical_lbl;
|
||||
|
||||
nextop_write:
|
||||
|
||||
opcode = Yap_op_from_opcode( PREG->y_u.o.opcw );
|
||||
goto op_switch;
|
||||
|
||||
nextop:
|
||||
|
||||
opcode = Yap_op_from_opcode( PREG->opc );
|
||||
|
||||
op_switch:
|
||||
|
||||
|
||||
switch (opcode) {
|
||||
|
||||
#if !OS_HANDLES_TR_OVERFLOW
|
||||
notrailleft:
|
||||
/* if we are within indexing code, the system may have to
|
||||
* update a S */
|
||||
{
|
||||
CELL cut_b;
|
||||
|
||||
#ifdef SHADOW_S
|
||||
S = SREG;
|
||||
#endif
|
||||
/* YREG was pointing to where we were going to build the
|
||||
* next choice-point. The stack shifter will need to know this
|
||||
* to move the local stack */
|
||||
SET_ASP(YREG, E_CB*sizeof(CELL));
|
||||
cut_b = LCL0-(CELL *)(ASP[E_CB]);
|
||||
saveregs();
|
||||
if(!Yap_growtrail (0, false)) {
|
||||
Yap_NilError(OUT_OF_TRAIL_ERROR,"YAP failed to reserve %ld bytes in growtrail",sizeof(CELL) * K16);
|
||||
setregs();
|
||||
FAIL();
|
||||
}
|
||||
setregs();
|
||||
#ifdef SHADOW_S
|
||||
SREG = S;
|
||||
#endif
|
||||
if (SREG == ASP) {
|
||||
SREG[E_CB] = (CELL)(LCL0-cut_b);
|
||||
}
|
||||
}
|
||||
goto reset_absmi;
|
||||
|
||||
#endif /* OS_HANDLES_TR_OVERFLOW */
|
||||
|
||||
// move instructions to separate file
|
||||
// so that they are easier to analyse.
|
||||
#if YAP_JIT
|
||||
#include "../C/traced_absmi_insts.h"
|
||||
#if YAPOR
|
||||
#include "../OPTYap/traced_or.insts.h"
|
||||
#endif
|
||||
#if TABLING
|
||||
#include "../OPTYap/traced_tab.insts.h"
|
||||
#include "../OPTYap/traced_tab.tries.insts.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
default:
|
||||
saveregs();
|
||||
Yap_Error(SYSTEM_ERROR, MkIntegerTerm(opcode), "trying to execute invalid YAAM instruction %d", opcode);
|
||||
setregs();
|
||||
FAIL();
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
|
||||
}
|
||||
|
||||
#endif /* YAP_JIT */
|
||||
|
@ -192,7 +192,7 @@ HEADERS = \
|
||||
H/inline-only.h \
|
||||
H/iopreds.h \
|
||||
H/iswiatoms.h \
|
||||
H/qly.h \
|
||||
H/qly.h \
|
||||
H/rclause.h \
|
||||
H/rglobals.h \
|
||||
H/rlocals.h \
|
||||
@ -206,6 +206,7 @@ HEADERS = \
|
||||
H/YapText.h \
|
||||
H/cut_c.h \
|
||||
H/iatoms.h H/ratoms.h H/tatoms.h \
|
||||
CXX/yapdb.hh \
|
||||
CXX/yapi.hh \
|
||||
BEAM/eam.h BEAM/eamamasm.h \
|
||||
OPTYap/opt.config.h \
|
||||
@ -302,6 +303,7 @@ C_SOURCES= \
|
||||
# library/lammpi/yap_mpi.c library/lamm1pi/hash.c library/lammpi/prologterms2c.c
|
||||
CXX_SOURCES = \
|
||||
CXX/yapi.cpp \
|
||||
CXX/yapi.cpp \
|
||||
JIT/JIT_Compiler.cpp
|
||||
|
||||
PLCONS_SOURCES = \
|
||||
|
@ -79,9 +79,7 @@
|
||||
TOP_STACK -= size; \
|
||||
memcpy(TOP_STACK, aux_stack, size * sizeof(CELL *)); \
|
||||
aux_stack = TOP_STACK; \
|
||||
}
|
||||
|
||||
/* macros 'store_trie_node', 'restore_trie_node' and 'pop_trie_node' **
|
||||
}/* macros 'store_trie_node', 'restore_trie_node' and 'pop_trie_node' **
|
||||
** do not include 'set_cut' because trie instructions are cut safe */
|
||||
|
||||
#define store_trie_node(AP) \
|
||||
|
@ -15,14 +15,14 @@
|
||||
** Scheduler instructions **
|
||||
** -------------------------------- */
|
||||
|
||||
PBOp(traced_getwork_first_time,e)
|
||||
PBOp(getwork_first_time,e)
|
||||
{ printf("Or-parallelism not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
|
||||
|
||||
PBOp(traced_getwork,Otapl)
|
||||
PBOp(getwork,Otapl)
|
||||
{ printf("Or-parallelism not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
@ -30,12 +30,12 @@ PBOp(traced_getwork_first_time,e)
|
||||
|
||||
/* 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)
|
||||
PBOp(getwork_seq,Otapl)
|
||||
{ printf("Or-parallelism not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
|
||||
PBOp(traced_sync,Otapl)
|
||||
PBOp(sync,Otapl)
|
||||
{ printf("Or-parallelism not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
@ -11,13 +11,23 @@
|
||||
** **
|
||||
************************************************************************/
|
||||
|
||||
#define TOP_STACK YENV
|
||||
|
||||
#define HEAP_ARITY_ENTRY (0)
|
||||
#define VARS_ARITY_ENTRY (1 + heap_arity)
|
||||
#define SUBS_ARITY_ENTRY (1 + heap_arity + 1 + vars_arity)
|
||||
|
||||
/* macros 'HEAP_ENTRY', 'VARS_ENTRY' and 'SUBS_ENTRY' **
|
||||
** assume that INDEX starts at 1 (and not at 0 !!!) */
|
||||
#define HEAP_ENTRY(INDEX) (HEAP_ARITY_ENTRY + (INDEX))
|
||||
#define VARS_ENTRY(INDEX) (VARS_ARITY_ENTRY + 1 + vars_arity - (INDEX))
|
||||
#define SUBS_ENTRY(INDEX) (SUBS_ARITY_ENTRY + 1 + subs_arity - (INDEX))
|
||||
|
||||
/************************************************************************
|
||||
** clause_with_cut **
|
||||
************************************************************************/
|
||||
|
||||
Op(traced_clause_with_cut, e)
|
||||
Op(clause_with_cut, e)
|
||||
{ printf("Tabling not supported by JIT!!\n"); exit(1); }
|
||||
ENDOp();
|
||||
|
||||
@ -27,7 +37,7 @@ ENDOp();
|
||||
** table_load_answer **
|
||||
************************************************************************/
|
||||
|
||||
PBOp(traced_table_load_answer, Otapl)
|
||||
PBOp(table_load_answer, Otapl)
|
||||
{ printf("Or-parallelism not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
@ -37,7 +47,7 @@ PBOp(traced_table_load_answer, Otapl)
|
||||
** table_try_answer **
|
||||
************************************************************************/
|
||||
|
||||
PBOp(traced_table_try_answer, Otapl)
|
||||
PBOp(table_try_answer, Otapl)
|
||||
{ printf("Or-parallelism not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
@ -47,7 +57,7 @@ PBOp(traced_table_load_answer, Otapl)
|
||||
** table_try_single **
|
||||
************************************************************************/
|
||||
|
||||
PBOp(traced_table_try_single, Otapl)
|
||||
PBOp(table_try_single, Otapl)
|
||||
{ printf("Or-parallelism not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
@ -57,7 +67,7 @@ PBOp(traced_table_load_answer, Otapl)
|
||||
** table_try_me **
|
||||
************************************************************************/
|
||||
|
||||
PBOp(traced_table_try_me, Otapl)
|
||||
PBOp(table_try_me, Otapl)
|
||||
{ printf("Or-parallelism not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
@ -67,7 +77,7 @@ PBOp(traced_table_load_answer, Otapl)
|
||||
** table_try **
|
||||
************************************************************************/
|
||||
|
||||
PBOp(traced_table_try, Otapl)
|
||||
PBOp(table_try, Otapl)
|
||||
{ printf("Or-parallelism not supported by JIT!!\n"); exit(1); }
|
||||
|
||||
ENDPBOp();
|
||||
@ -78,7 +88,7 @@ PBOp(traced_table_load_answer, Otapl)
|
||||
** table_retry_me **
|
||||
************************************************************************/
|
||||
|
||||
Op(traced_table_retry_me, Otapl)
|
||||
Op(table_retry_me, Otapl)
|
||||
{ printf("Or-parallelism not supported by JIT!!\n"); exit(1); }
|
||||
ENDOp();
|
||||
|
||||
@ -88,7 +98,7 @@ PBOp(traced_table_load_answer, Otapl)
|
||||
** table_retry **
|
||||
************************************************************************/
|
||||
|
||||
Op(traced_table_retry, Otapl)
|
||||
Op(table_retry, Otapl)
|
||||
{ printf("Or-parallelism not supported by JIT!!\n"); exit(1); }
|
||||
ENDOp();
|
||||
|
||||
@ -98,7 +108,7 @@ PBOp(traced_table_load_answer, Otapl)
|
||||
** table_trust_me **
|
||||
************************************************************************/
|
||||
|
||||
Op(traced_table_trust_me, Otapl)
|
||||
Op(table_trust_me, Otapl)
|
||||
{ printf("Or-parallelism not supported by JIT!!\n"); exit(1); }
|
||||
ENDOp();
|
||||
|
||||
@ -108,7 +118,7 @@ PBOp(traced_table_load_answer, Otapl)
|
||||
** table_trust **
|
||||
************************************************************************/
|
||||
|
||||
Op(traced_table_trust, Otapl)
|
||||
Op(table_trust, Otapl)
|
||||
{ printf("Or-parallelism not supported by JIT!!\n"); exit(1); }
|
||||
ENDOp();
|
||||
|
||||
@ -118,7 +128,7 @@ PBOp(traced_table_load_answer, Otapl)
|
||||
** table_new_answer **
|
||||
************************************************************************/
|
||||
|
||||
PBOp(traced_table_new_answer, s)
|
||||
PBOp(table_new_answer, s)
|
||||
{ printf("Or-parallelism not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
@ -128,7 +138,7 @@ PBOp(traced_table_load_answer, Otapl)
|
||||
** table_answer_resolution **
|
||||
************************************************************************/
|
||||
|
||||
BOp(traced_table_answer_resolution, Otapl)
|
||||
BOp(table_answer_resolution, Otapl)
|
||||
{ printf("Or-parallelism not supported by JIT!!\n"); exit(1); }
|
||||
ENDBOp();
|
||||
|
||||
@ -138,7 +148,7 @@ PBOp(traced_table_load_answer, Otapl)
|
||||
** table_completion **
|
||||
************************************************************************/
|
||||
|
||||
BOp(traced_table_completion, Otapl)
|
||||
BOp(table_completion, Otapl)
|
||||
ENDBOp();
|
||||
|
||||
|
||||
@ -147,7 +157,7 @@ PBOp(traced_table_load_answer, Otapl)
|
||||
** table_answer_resolution_completion **
|
||||
************************************************************************/
|
||||
|
||||
BOp(traced_table_answer_resolution_completion, Otapl)
|
||||
BOp(table_answer_resolution_completion, Otapl)
|
||||
#ifdef THREADS_CONSUMER_SHARING
|
||||
{ printf("Or-parallelism not supported by JIT!!\n"); exit(1); }
|
||||
#endif /* THREADS_CONSUMER_SHARING */
|
||||
|
@ -11,253 +11,645 @@
|
||||
** **
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
** Trie instructions: auxiliary stack organization **
|
||||
*************************************************************************
|
||||
-------------------
|
||||
| ha = heap_arity |
|
||||
------------------- --
|
||||
| heap ptr 1 | |
|
||||
------------------- |
|
||||
| ... | -- heap_arity (0 if in global trie)
|
||||
------------------- |
|
||||
| heap ptr ha | |
|
||||
------------------- --
|
||||
| va = vars_arity |
|
||||
------------------- --
|
||||
| var ptr va | |
|
||||
------------------- |
|
||||
| ... | -- vars_arity
|
||||
------------------- |
|
||||
| var ptr 1 | |
|
||||
------------------- --
|
||||
| sa = subs_arity |
|
||||
------------------- --
|
||||
| subs ptr sa | |
|
||||
------------------- |
|
||||
| ... | -- subs_arity
|
||||
------------------- |
|
||||
| subs ptr 1 | |
|
||||
------------------- --
|
||||
************************************************************************/
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
** Trie instructions: macros **
|
||||
************************************************************************/
|
||||
|
||||
#define TOP_STACK YENV
|
||||
|
||||
#define HEAP_ARITY_ENTRY (0)
|
||||
#define VARS_ARITY_ENTRY (1 + heap_arity)
|
||||
#define SUBS_ARITY_ENTRY (1 + heap_arity + 1 + vars_arity)
|
||||
|
||||
/* macros 'HEAP_ENTRY', 'VARS_ENTRY' and 'SUBS_ENTRY' **
|
||||
** assume that INDEX starts at 1 (and not at 0 !!!) */
|
||||
#define HEAP_ENTRY(INDEX) (HEAP_ARITY_ENTRY + (INDEX))
|
||||
#define VARS_ENTRY(INDEX) (VARS_ARITY_ENTRY + 1 + vars_arity - (INDEX))
|
||||
#define SUBS_ENTRY(INDEX) (SUBS_ARITY_ENTRY + 1 + subs_arity - (INDEX))
|
||||
|
||||
#define next_trie_instruction(NODE) \
|
||||
PREG = (yamop *) TrNode_child(NODE); \
|
||||
PREFETCH_OP(PREG); \
|
||||
GONext()
|
||||
|
||||
#define next_instruction(CONDITION, NODE) \
|
||||
if (CONDITION) { \
|
||||
PREG = (yamop *) TrNode_child(NODE); \
|
||||
} else { /* procceed */ \
|
||||
PREG = (yamop *) CPREG; \
|
||||
TOP_STACK = ENV; \
|
||||
} \
|
||||
PREFETCH_OP(PREG); \
|
||||
GONext()
|
||||
|
||||
#define copy_aux_stack() \
|
||||
{ int size = 3 + heap_arity + subs_arity + vars_arity; \
|
||||
TOP_STACK -= size; \
|
||||
memcpy(TOP_STACK, aux_stack, size * sizeof(CELL *)); \
|
||||
aux_stack = TOP_STACK; \
|
||||
}/* macros 'store_trie_node', 'restore_trie_node' and 'pop_trie_node' **
|
||||
** do not include 'set_cut' because trie instructions are cut safe */
|
||||
|
||||
#define store_trie_node(AP) \
|
||||
{ register choiceptr cp; \
|
||||
TOP_STACK = (CELL *) (NORM_CP(TOP_STACK) - 1); \
|
||||
cp = NORM_CP(TOP_STACK); \
|
||||
HBREG = HR; \
|
||||
store_yaam_reg_cpdepth(cp); \
|
||||
cp->cp_tr = TR; \
|
||||
cp->cp_h = HR; \
|
||||
cp->cp_b = B; \
|
||||
cp->cp_cp = CPREG; \
|
||||
cp->cp_ap = (yamop *) AP; \
|
||||
cp->cp_env= ENV; \
|
||||
B = cp; \
|
||||
YAPOR_SET_LOAD(B); \
|
||||
SET_BB(B); \
|
||||
TABLING_ERROR_CHECKING_STACK; \
|
||||
} \
|
||||
copy_aux_stack()
|
||||
|
||||
#define restore_trie_node(AP) \
|
||||
HR = HBREG = PROTECT_FROZEN_H(B); \
|
||||
restore_yaam_reg_cpdepth(B); \
|
||||
CPREG = B->cp_cp; \
|
||||
ENV = B->cp_env; \
|
||||
YAPOR_update_alternative(PREG, (yamop *) AP) \
|
||||
B->cp_ap = (yamop *) AP; \
|
||||
TOP_STACK = (CELL *) PROTECT_FROZEN_B(B); \
|
||||
SET_BB(NORM_CP(TOP_STACK)); \
|
||||
copy_aux_stack()
|
||||
|
||||
#define really_pop_trie_node() \
|
||||
TOP_STACK = (CELL *) PROTECT_FROZEN_B((B + 1)); \
|
||||
HR = PROTECT_FROZEN_H(B); \
|
||||
pop_yaam_reg_cpdepth(B); \
|
||||
CPREG = B->cp_cp; \
|
||||
TABLING_close_alt(B); \
|
||||
ENV = B->cp_env; \
|
||||
B = B->cp_b; \
|
||||
HBREG = PROTECT_FROZEN_H(B); \
|
||||
SET_BB(PROTECT_FROZEN_B(B)); \
|
||||
if ((choiceptr) TOP_STACK == B_FZ) { \
|
||||
copy_aux_stack(); \
|
||||
}
|
||||
|
||||
#ifdef YAPOR
|
||||
#define pop_trie_node() \
|
||||
if (SCH_top_shared_cp(B)) { \
|
||||
restore_trie_node(NULL); \
|
||||
} else { \
|
||||
really_pop_trie_node(); \
|
||||
}
|
||||
#else
|
||||
#define pop_trie_node() \
|
||||
really_pop_trie_node()
|
||||
#endif /* YAPOR */
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
** aux_stack_null_instr **
|
||||
************************************************************************/
|
||||
|
||||
#define aux_stack_null_instr() \
|
||||
next_trie_instruction(node)
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
** aux_stack_extension_instr **
|
||||
************************************************************************/
|
||||
|
||||
#define aux_stack_extension_instr() \
|
||||
TOP_STACK = &aux_stack[-2]; \
|
||||
TOP_STACK[HEAP_ARITY_ENTRY] = heap_arity + 2; \
|
||||
TOP_STACK[HEAP_ENTRY(1)] = TrNode_entry(node); \
|
||||
TOP_STACK[HEAP_ENTRY(2)] = 0; /* extension mark */ \
|
||||
next_trie_instruction(node)
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
** aux_stack_term_(in_pair_)instr **
|
||||
************************************************************************/
|
||||
|
||||
#define aux_stack_term_instr() \
|
||||
if (heap_arity) { \
|
||||
Bind_Global((CELL *) aux_stack[HEAP_ENTRY(1)], t); \
|
||||
TOP_STACK = &aux_stack[1]; \
|
||||
TOP_STACK[HEAP_ARITY_ENTRY] = heap_arity - 1; \
|
||||
next_instruction(heap_arity - 1 || subs_arity, node); \
|
||||
} else { \
|
||||
YapBind((CELL *) aux_stack[SUBS_ENTRY(1)], t); \
|
||||
aux_stack[SUBS_ARITY_ENTRY] = subs_arity - 1; \
|
||||
next_instruction(subs_arity - 1, node); \
|
||||
}
|
||||
|
||||
#define aux_stack_term_in_pair_instr() \
|
||||
if (heap_arity) { \
|
||||
Bind_Global((CELL *) aux_stack[HEAP_ENTRY(1)], AbsPair(HR)); \
|
||||
} else { \
|
||||
YapBind((CELL *) aux_stack[SUBS_ENTRY(1)], AbsPair(HR)); \
|
||||
aux_stack[SUBS_ARITY_ENTRY] = subs_arity - 1; \
|
||||
TOP_STACK = &aux_stack[-1]; \
|
||||
TOP_STACK[HEAP_ARITY_ENTRY] = 1; \
|
||||
} \
|
||||
Bind_Global(HR, TrNode_entry(node)); \
|
||||
TOP_STACK[HEAP_ENTRY(1)] = (CELL) (HR + 1); \
|
||||
HR += 2; \
|
||||
next_trie_instruction(node)
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
** aux_stack_(new_)pair_instr **
|
||||
************************************************************************/
|
||||
|
||||
#define aux_stack_new_pair_instr() /* for term 'CompactPairInit' */ \
|
||||
if (heap_arity) { \
|
||||
Bind_Global((CELL *) aux_stack[HEAP_ENTRY(1)], AbsPair(HR)); \
|
||||
TOP_STACK = &aux_stack[-1]; \
|
||||
TOP_STACK[HEAP_ARITY_ENTRY] = heap_arity + 1; \
|
||||
} else { \
|
||||
YapBind((CELL *) aux_stack[SUBS_ENTRY(1)], AbsPair(HR)); \
|
||||
aux_stack[SUBS_ARITY_ENTRY] = subs_arity - 1; \
|
||||
TOP_STACK = &aux_stack[-2]; \
|
||||
TOP_STACK[HEAP_ARITY_ENTRY] = 2; \
|
||||
} \
|
||||
TOP_STACK[HEAP_ENTRY(1)] = (CELL) HR; \
|
||||
TOP_STACK[HEAP_ENTRY(2)] = (CELL) (HR + 1); \
|
||||
HR += 2; \
|
||||
next_trie_instruction(node)
|
||||
|
||||
#ifdef TRIE_COMPACT_PAIRS
|
||||
#define aux_stack_pair_instr() /* for term 'CompactPairEndList' */ \
|
||||
if (heap_arity) { \
|
||||
Bind_Global((CELL *) aux_stack[HEAP_ENTRY(1)], AbsPair(HR)); \
|
||||
} else { \
|
||||
YapBind((CELL *) aux_stack[SUBS_ENTRY(1)], AbsPair(HR)); \
|
||||
aux_stack[SUBS_ARITY_ENTRY] = subs_arity - 1; \
|
||||
TOP_STACK = &aux_stack[-1]; \
|
||||
TOP_STACK[HEAP_ARITY_ENTRY] = 1; \
|
||||
} \
|
||||
TOP_STACK[HEAP_ENTRY(1)] = (CELL) HR; \
|
||||
Bind_Global(HR + 1, TermNil); \
|
||||
HR += 2; \
|
||||
next_trie_instruction(node)
|
||||
#else
|
||||
#define aux_stack_pair_instr() \
|
||||
aux_stack_new_pair_instr()
|
||||
#endif /* TRIE_COMPACT_PAIRS */
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
** aux_stack_appl_(in_pair_)instr **
|
||||
************************************************************************/
|
||||
|
||||
#define aux_stack_appl_instr() \
|
||||
if (heap_arity) { \
|
||||
Bind_Global((CELL *) aux_stack[HEAP_ENTRY(1)], AbsAppl(HR)); \
|
||||
TOP_STACK = &aux_stack[-func_arity + 1]; \
|
||||
TOP_STACK[HEAP_ARITY_ENTRY] = heap_arity + func_arity - 1; \
|
||||
} else { \
|
||||
YapBind((CELL *) aux_stack[SUBS_ENTRY(1)], AbsAppl(HR)); \
|
||||
aux_stack[SUBS_ARITY_ENTRY] = subs_arity - 1; \
|
||||
TOP_STACK = &aux_stack[-func_arity]; \
|
||||
TOP_STACK[HEAP_ARITY_ENTRY] = func_arity; \
|
||||
} \
|
||||
*HR = (CELL) func; \
|
||||
{ int i; \
|
||||
for (i = 1; i <= func_arity; i++) \
|
||||
TOP_STACK[HEAP_ENTRY(i)] = (CELL) (HR + i); \
|
||||
} \
|
||||
HR += 1 + func_arity; \
|
||||
next_trie_instruction(node)
|
||||
|
||||
#define aux_stack_appl_in_pair_instr() \
|
||||
if (heap_arity) { \
|
||||
Bind_Global((CELL *) aux_stack[HEAP_ENTRY(1)], AbsPair(HR)); \
|
||||
TOP_STACK = &aux_stack[-func_arity]; \
|
||||
TOP_STACK[HEAP_ARITY_ENTRY] = heap_arity + func_arity; \
|
||||
} else { \
|
||||
YapBind((CELL *) aux_stack[SUBS_ENTRY(1)], AbsPair(HR)); \
|
||||
aux_stack[SUBS_ARITY_ENTRY] = subs_arity - 1; \
|
||||
TOP_STACK = &aux_stack[-func_arity - 1]; \
|
||||
TOP_STACK[HEAP_ARITY_ENTRY] = func_arity + 1; \
|
||||
} \
|
||||
TOP_STACK[HEAP_ENTRY(func_arity + 1)] = (CELL) (HR + 1); \
|
||||
Bind_Global(HR, AbsAppl(HR + 2)); \
|
||||
HR += 2; \
|
||||
*HR = (CELL) func; \
|
||||
{ int i; \
|
||||
for (i = 1; i <= func_arity; i++) \
|
||||
TOP_STACK[HEAP_ENTRY(i)] = (CELL) (HR + i); \
|
||||
} \
|
||||
HR += 1 + func_arity; \
|
||||
next_trie_instruction(node)
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
** aux_stack_var_(in_pair_)instr **
|
||||
************************************************************************/
|
||||
|
||||
#define aux_stack_var_instr() \
|
||||
if (heap_arity) { \
|
||||
int i; \
|
||||
CELL var = aux_stack[HEAP_ENTRY(1)]; \
|
||||
RESET_VARIABLE(var); \
|
||||
TOP_STACK[HEAP_ARITY_ENTRY] = heap_arity - 1; \
|
||||
for (i = 2; i <= heap_arity; i++) \
|
||||
TOP_STACK[HEAP_ENTRY(i - 1)] = aux_stack[HEAP_ENTRY(i)]; \
|
||||
aux_stack[VARS_ARITY_ENTRY - 1] = vars_arity + 1; \
|
||||
aux_stack[VARS_ENTRY(vars_arity + 1)] = var; \
|
||||
next_instruction(heap_arity - 1 || subs_arity, node); \
|
||||
} else { \
|
||||
CELL var = aux_stack[SUBS_ENTRY(1)]; \
|
||||
aux_stack[SUBS_ARITY_ENTRY] = subs_arity - 1; \
|
||||
TOP_STACK = &aux_stack[-1]; \
|
||||
TOP_STACK[HEAP_ARITY_ENTRY] = 0; \
|
||||
aux_stack[VARS_ARITY_ENTRY - 1] = vars_arity + 1; \
|
||||
aux_stack[VARS_ENTRY(vars_arity + 1)] = var; \
|
||||
next_instruction(subs_arity - 1, node); \
|
||||
}
|
||||
|
||||
#define aux_stack_var_in_pair_instr() \
|
||||
if (heap_arity) { \
|
||||
int i; \
|
||||
Bind_Global((CELL *) aux_stack[HEAP_ENTRY(1)], AbsPair(HR)); \
|
||||
TOP_STACK = &aux_stack[-1]; \
|
||||
TOP_STACK[HEAP_ARITY_ENTRY] = heap_arity; \
|
||||
TOP_STACK[HEAP_ENTRY(1)] = (CELL) (HR + 1); \
|
||||
for (i = 2; i <= heap_arity; i++) \
|
||||
TOP_STACK[HEAP_ENTRY(i)] = aux_stack[HEAP_ENTRY(i)]; \
|
||||
} else { \
|
||||
YapBind((CELL *) aux_stack[SUBS_ENTRY(1)], AbsPair(HR)); \
|
||||
aux_stack[SUBS_ARITY_ENTRY] = subs_arity - 1; \
|
||||
TOP_STACK = &aux_stack[-2]; \
|
||||
TOP_STACK[HEAP_ARITY_ENTRY] = 1; \
|
||||
TOP_STACK[HEAP_ENTRY(1)] = (CELL) (HR + 1); \
|
||||
} \
|
||||
aux_stack[VARS_ARITY_ENTRY - 1] = vars_arity + 1; \
|
||||
aux_stack[VARS_ENTRY(vars_arity + 1)] = (CELL) HR; \
|
||||
RESET_VARIABLE((CELL) HR); \
|
||||
HR += 2; \
|
||||
next_trie_instruction(node)
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
** aux_stack_val_(in_pair_)instr **
|
||||
************************************************************************/
|
||||
|
||||
#define aux_stack_val_instr() \
|
||||
if (heap_arity) { \
|
||||
CELL aux_sub, aux_var; \
|
||||
aux_sub = aux_stack[HEAP_ENTRY(1)]; \
|
||||
aux_var = aux_stack[VARS_ENTRY(var_index + 1)]; \
|
||||
if (aux_sub > aux_var) { \
|
||||
Bind_Global((CELL *) aux_sub, aux_var); \
|
||||
} else { \
|
||||
RESET_VARIABLE(aux_sub); \
|
||||
Bind_Local((CELL *) aux_var, aux_sub); \
|
||||
aux_stack[VARS_ENTRY(var_index + 1)] = aux_sub; \
|
||||
} \
|
||||
TOP_STACK = &aux_stack[1]; \
|
||||
TOP_STACK[HEAP_ARITY_ENTRY] = heap_arity - 1; \
|
||||
next_instruction(heap_arity - 1 || subs_arity, node); \
|
||||
} else { \
|
||||
CELL aux_sub, aux_var; \
|
||||
aux_sub = aux_stack[SUBS_ENTRY(1)]; \
|
||||
aux_stack[SUBS_ARITY_ENTRY] = subs_arity - 1; \
|
||||
aux_var = aux_stack[VARS_ENTRY(var_index + 1)]; \
|
||||
if (aux_sub > aux_var) { \
|
||||
if ((CELL *) aux_sub <= HR) { \
|
||||
Bind_Global((CELL *) aux_sub, aux_var); \
|
||||
} else if ((CELL *) aux_var <= HR) { \
|
||||
Bind_Local((CELL *) aux_sub, aux_var); \
|
||||
} else { \
|
||||
Bind_Local((CELL *) aux_var, aux_sub); \
|
||||
aux_stack[VARS_ENTRY(var_index + 1)] = aux_sub; \
|
||||
} \
|
||||
} else { \
|
||||
if ((CELL *) aux_var <= HR) { \
|
||||
Bind_Global((CELL *) aux_var, aux_sub); \
|
||||
aux_stack[VARS_ENTRY(var_index + 1)] = aux_sub; \
|
||||
} else if ((CELL *) aux_sub <= HR) { \
|
||||
Bind_Local((CELL *) aux_var, aux_sub); \
|
||||
aux_stack[VARS_ENTRY(var_index + 1)] = aux_sub; \
|
||||
} else { \
|
||||
Bind_Local((CELL *) aux_sub, aux_var); \
|
||||
} \
|
||||
} \
|
||||
next_instruction(subs_arity - 1, node); \
|
||||
}
|
||||
|
||||
#define aux_stack_val_in_pair_instr() \
|
||||
if (heap_arity) { \
|
||||
Bind_Global((CELL *) aux_stack[HEAP_ENTRY(1)], AbsPair(HR)); \
|
||||
} else { \
|
||||
YapBind((CELL *) aux_stack[SUBS_ENTRY(1)], AbsPair(HR)); \
|
||||
aux_stack[SUBS_ARITY_ENTRY] = subs_arity - 1; \
|
||||
TOP_STACK = &aux_stack[-1]; \
|
||||
TOP_STACK[HEAP_ARITY_ENTRY] = 1; \
|
||||
} \
|
||||
{ CELL aux_sub, aux_var; \
|
||||
aux_sub = (CELL) HR; \
|
||||
aux_var = aux_stack[VARS_ENTRY(var_index + 1)]; \
|
||||
if (aux_sub > aux_var) { \
|
||||
Bind_Global((CELL *) aux_sub, aux_var); \
|
||||
} else { \
|
||||
RESET_VARIABLE(aux_sub); \
|
||||
Bind_Local((CELL *) aux_var, aux_sub); \
|
||||
aux_stack[VARS_ENTRY(var_index + 1)] = aux_sub; \
|
||||
} \
|
||||
} \
|
||||
TOP_STACK[HEAP_ENTRY(1)] = (CELL) (HR + 1); \
|
||||
HR += 2; \
|
||||
next_trie_instruction(node)
|
||||
|
||||
|
||||
/************************************************************************
|
||||
** Trie instructions **
|
||||
************************************************************************/
|
||||
|
||||
PBOp(traced_trie_do_var, e)
|
||||
PBOp(trie_do_var, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_trust_var, e)
|
||||
PBOp(trie_trust_var, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_try_var, e)
|
||||
PBOp(trie_try_var, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
|
||||
PBOp(traced_trie_retry_var, e)
|
||||
PBOp(trie_retry_var, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_do_var_in_pair, e)
|
||||
PBOp(trie_do_var_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_trust_var_in_pair, e)
|
||||
PBOp(trie_trust_var_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_try_var_in_pair, e)
|
||||
PBOp(trie_try_var_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_retry_var_in_pair, e)
|
||||
PBOp(trie_retry_var_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_do_val, e)
|
||||
PBOp(trie_do_val, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_trust_val, e)
|
||||
PBOp(trie_trust_val, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_try_val, e)
|
||||
PBOp(trie_try_val, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_retry_val, e)
|
||||
PBOp(trie_retry_val, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_do_val_in_pair, e)
|
||||
PBOp(trie_do_val_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_trust_val_in_pair, e)
|
||||
PBOp(trie_trust_val_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_try_val_in_pair, e)
|
||||
PBOp(trie_try_val_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_retry_val_in_pair, e)
|
||||
PBOp(trie_retry_val_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_do_atom, e)
|
||||
PBOp(trie_do_atom, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_trust_atom, e)
|
||||
PBOp(trie_trust_atom, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_try_atom, e)
|
||||
PBOp(trie_try_atom, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_retry_atom, e)
|
||||
PBOp(trie_retry_atom, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_do_atom_in_pair, e)
|
||||
PBOp(trie_do_atom_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_trust_atom_in_pair, e)
|
||||
PBOp(trie_trust_atom_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_try_atom_in_pair, e)
|
||||
PBOp(trie_try_atom_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_retry_atom_in_pair, e)
|
||||
PBOp(trie_retry_atom_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_do_null, e)
|
||||
PBOp(trie_do_null, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_trust_null, e)
|
||||
PBOp(trie_trust_null, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_try_null, e)
|
||||
PBOp(trie_try_null, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_retry_null, e)
|
||||
PBOp(trie_retry_null, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_do_null_in_pair, e)
|
||||
PBOp(trie_do_null_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_trust_null_in_pair, e)
|
||||
PBOp(trie_trust_null_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_try_null_in_pair, e)
|
||||
PBOp(trie_try_null_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_retry_null_in_pair, e)
|
||||
PBOp(trie_retry_null_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_do_pair, e)
|
||||
PBOp(trie_do_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_trust_pair, e)
|
||||
PBOp(trie_trust_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_try_pair, e)
|
||||
PBOp(trie_try_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_retry_pair, e)
|
||||
PBOp(trie_retry_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_do_appl, e)
|
||||
PBOp(trie_do_appl, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_trust_appl, e)
|
||||
PBOp(trie_trust_appl, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_try_appl, e)
|
||||
PBOp(trie_try_appl, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_retry_appl, e)
|
||||
PBOp(trie_retry_appl, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_do_appl_in_pair, e)
|
||||
PBOp(trie_do_appl_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_trust_appl_in_pair, e)
|
||||
PBOp(trie_trust_appl_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_try_appl_in_pair, e)
|
||||
PBOp(trie_try_appl_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_retry_appl_in_pair, e)
|
||||
PBOp(trie_retry_appl_in_pair, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_do_extension, e)
|
||||
PBOp(trie_do_extension, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_trust_extension, e)
|
||||
PBOp(trie_trust_extension, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_try_extension, e)
|
||||
PBOp(trie_try_extension, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_retry_extension, e)
|
||||
PBOp(trie_retry_extension, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_do_double, e)
|
||||
PBOp(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];
|
||||
@ -286,22 +678,22 @@ ENDPBOp();
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
BOp(traced_trie_trust_double, e)
|
||||
BOp(trie_trust_double, e)
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "trie_trust_double: invalid instruction");
|
||||
ENDBOp();
|
||||
|
||||
|
||||
BOp(traced_trie_try_double, e)
|
||||
BOp(trie_try_double, e)
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "trie_try_double: invalid instruction");
|
||||
ENDBOp();
|
||||
|
||||
|
||||
BOp(traced_trie_retry_double, e)
|
||||
BOp(trie_retry_double, e)
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "trie_retry_double: invalid instruction");
|
||||
ENDBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_do_longint, e)
|
||||
PBOp(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];
|
||||
@ -317,54 +709,54 @@ ENDPBOp();
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
BOp(traced_trie_trust_longint, e)
|
||||
BOp(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");
|
||||
BOp(trie_try_longint, e)
|
||||
Yap_Error(INTERNAL_ERROR, TermNil, "trie_try_longint: invalid instruction");
|
||||
ENDBOp();
|
||||
|
||||
|
||||
BOp(traced_trie_retry_longint, e)
|
||||
BOp(trie_retry_longint, e)
|
||||
ENDBOp();
|
||||
|
||||
|
||||
PBOp(traced_trie_do_bigint, e)
|
||||
{ printf("Traced_Tries not supported by JIT!!\n"); exit(1); }
|
||||
PBOp(trie_do_bigint, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
||||
|
||||
BOp(traced_trie_trust_bigint, e)
|
||||
BOp(trie_trust_bigint, e)
|
||||
ENDBOp();
|
||||
|
||||
|
||||
BOp(traced_trie_try_bigint, e)
|
||||
BOp(trie_try_bigint, e)
|
||||
ENDBOp();
|
||||
|
||||
|
||||
BOp(traced_trie_retry_bigint, e)
|
||||
BOp(trie_retry_bigint, e)
|
||||
ENDBOp();
|
||||
|
||||
|
||||
|
||||
PBOp(traced_trie_do_gterm, e)
|
||||
PBOp(trie_do_gterm, e)
|
||||
|
||||
{ printf("Traced_Tries not supported by JIT!!\n"); exit(1); }
|
||||
{ printf("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); }
|
||||
PBOp(trie_trust_gterm, e)
|
||||
{ printf("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); }
|
||||
PBOp(trie_try_gterm, e)
|
||||
{ printf("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); }
|
||||
PBOp(trie_retry_gterm, e)
|
||||
{ printf("Tries not supported by JIT!!\n"); exit(1); }
|
||||
ENDPBOp();
|
||||
|
@ -208,7 +208,8 @@ message and _Data_ with the message itself.
|
||||
mpi_barrier/0,
|
||||
mpi_msg_buffer_size/2,
|
||||
mpi_msg_size/2,
|
||||
mpi_gc/0
|
||||
mpi_gc/0,
|
||||
mpi_default_buffer_size/2
|
||||
]).
|
||||
|
||||
:- load_foreign_files([yap_mpi], [], init_mpi).
|
||||
|
@ -102,11 +102,7 @@ void
|
||||
change_buffer_size(const size_t newsize) {
|
||||
if ( BUFFER_SIZE>=BLOCK_SIZE && BUFFER_SIZE>=newsize)
|
||||
return;
|
||||
if (BUFFER_PTR) {
|
||||
free(BUFFER_PTR);
|
||||
}
|
||||
BUFFER_PTR = (char*)malloc(newsize);
|
||||
if( BUFFER_PTR == NULL ) {
|
||||
if (realloc( BUFFER_PTR, newsize) == NULL) {
|
||||
YAP_Error(0,0,"Prolog2Term: Out of memory.\n");
|
||||
#ifdef MPI
|
||||
MPI_Finalize();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 2004,2005,2006 (Nuno A. Fonseca) <nuno.fonseca@gmail.com>
|
||||
Copyright (C) 2004,2005,2006 (Nuno A. Fonseca) <nuno.fonseca@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
@ -41,9 +41,7 @@ Comments: YAP interface to LAM/MPI
|
||||
|
||||
#include "prologterms2c.h"
|
||||
|
||||
#ifndef _yap_c_interface_h
|
||||
#include <YapInterface.h>
|
||||
#endif
|
||||
|
||||
#include "hash.h"
|
||||
|
||||
@ -976,7 +974,7 @@ mpi_gc(void) {
|
||||
RETURN(TRUE);
|
||||
}
|
||||
|
||||
int BLOCK_SIZE=4*1024;
|
||||
size_t BLOCK_SIZE=4*1024;
|
||||
|
||||
static int
|
||||
mpi_default_buffer_size(void)
|
||||
@ -1022,7 +1020,7 @@ init_mpi(void) {
|
||||
YAP_UserCPredicate( "mpi_wait", mpi_wait,2); // mpi_wait(+Handle,-Status).
|
||||
YAP_UserCPredicate( "mpi_wait_recv", mpi_wait_recv,3); // mpi_wait_recv(+Handle,-Status,-Data).
|
||||
YAP_UserCPredicate( "mpi_test", mpi_test,2); // mpi_test(+Handle,-Status).
|
||||
YAP_UserCPredicate( "mpi_test_rcv", mpi_test_recv,3); // mpi_test(+Handle,-Status,-Data).
|
||||
YAP_UserCPredicate( "mpi_test_recv", mpi_test_recv,3); // mpi_test(+Handle,-Status,-Data).
|
||||
YAP_UserCPredicate( "mpi_bcast", mpi_bcast,2); // mpi_bcast(Root,Term)
|
||||
YAP_UserCPredicate( "mpi_bcast2", mpi_bcast2,2); // mpi_bcast2(Root,Term)
|
||||
YAP_UserCPredicate( "mpi_bcast3", mpi_bcast3,3); // mpi_bcast3(Root,Term,Tag)
|
||||
|
@ -177,7 +177,7 @@ RL_Tree* set_in_rl(RL_Tree* tree,NUM number,STATUS status) {
|
||||
if ( number >0 && number <=tree->range_max)
|
||||
set_in(number,ROOT(tree),1,ROOT_INTERVAL(tree),tree->range_max,tree,status);
|
||||
#ifdef DEBUG
|
||||
printf("Setting: %d size=%d\n",number,tree->size);
|
||||
printf("Setting: %ul size=%ul\n",number,tree->size);
|
||||
#endif
|
||||
/*if (status==IN && !in_rl(tree,number)) {
|
||||
fprintf(stderr,"Error adding %lu to tree: size=%lu max=%lu\n",number,tree->size,tree->range_max);
|
||||
|
@ -47,17 +47,17 @@ main :-
|
||||
retractall(op(_,_)),
|
||||
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),
|
||||
%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),
|
||||
@ -744,13 +744,6 @@ dump_head_action(logical, _, _, L) :-
|
||||
footer(W) :-
|
||||
format(W,' /* this instruction is hardwired */~n',[]),
|
||||
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',["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',[]),
|
||||
@ -760,14 +753,6 @@ footer(W) :-
|
||||
|
||||
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"),
|
||||
@ -781,14 +766,6 @@ footer_rclause(W) :-
|
||||
|
||||
footer_walk_clause(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',[]),
|
||||
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"),
|
||||
|
@ -1,9 +1,10 @@
|
||||
|
||||
#include <Python.h>
|
||||
#include <SWI-Stream.h>
|
||||
#include <SWI-Prolog.h>
|
||||
#ifdef HAVE_STAT
|
||||
#undef HAVE_STAT
|
||||
#endif
|
||||
#include <Python.h>
|
||||
#include <assert.h>
|
||||
|
||||
static atom_t ATOM_true,
|
||||
|
@ -2,6 +2,7 @@ PACKAGE=swig
|
||||
DOC=swig
|
||||
PKGCFLAGS=
|
||||
SWIG=@SWIG@
|
||||
LIBS=@LIBS@
|
||||
JAVAC=@JAVAC@
|
||||
JAR=@JAR@
|
||||
include ../Makefile.defs
|
||||
@ -11,6 +12,14 @@ srcdir=@srcdir@
|
||||
CPPFLAGS= -I../.. -I$(srcdir)/../../H -I$(srcdir)/../../include -I$(srcdir)/../../os -I$(srcdir)/../../OPTYap -I$(srcdir)/../../BEAM -I$(srcdir)/../../CXX
|
||||
CXXFLAGS= $(YAP_EXTRAS) $(DEFS) $(CPPFLAGS)
|
||||
|
||||
YAP_SWIG_INTERFACE= $(srcdir)/yap.i \
|
||||
$(srcdir)/../../CXX/yapi.hh \
|
||||
$(srcdir)/../../CXX/yapa.hh \
|
||||
$(srcdir)/../../CXX/yapdb.hh \
|
||||
$(srcdir)/../../CXX/yapie.hh \
|
||||
$(srcdir)/../../CXX/yapq.hh \
|
||||
$(srcdir)/../../CXX/yapi.cpp
|
||||
|
||||
JNI_SQLITE="$(srcdir)/android/jni/sqlite"
|
||||
|
||||
JAVA_SQLITE="$(srcdir)/android/src/org"
|
||||
@ -46,7 +55,7 @@ python: $(SWIG_FILES) python/_yap.so python/yap.py
|
||||
python/_yap.so: python/yap_wrap.o
|
||||
$(CXX) -shared $(LDSOFLAGS) -o python/_yap.so python/yap_wrap.o ../../yapi.o $(LIBS) @PYTHON_LIBS@ -L ../.. -lYap -lpthread
|
||||
|
||||
python/yap_wrap.cpp python/yap.py: $(srcdir)/yap.i
|
||||
python/yap_wrap.cpp python/yap.py: $(YAP_SWIG_INTERFACE)
|
||||
mkdir -p python
|
||||
$(SWIG) -c++ -python -outdir python -o $@ $(CXXFLAGS) -Wall $<
|
||||
|
||||
@ -59,7 +68,7 @@ java: jni/libyap.@SO@ java/yap.java
|
||||
jni/libyap.@SO@: jni/yap_wrap.o
|
||||
$(CXX) -shared $(LDSOFLAGS) -o $@ ../../yapi.o $< $(LIBS) @JPLLDFLAGS@ -L ../.. -lYap -lpthread
|
||||
|
||||
jni/yap_wrap.cpp java/yap.java: $(srcdir)/yap.i
|
||||
jni/yap_wrap.cpp java/yap.java: $(YAP_SWIG_INTERFACE)
|
||||
$(SWIG) -c++ -java -package pt.up.fc.dcc.yap -outdir java -o jni/yap_wrap.cpp $(CXXFLAGS) -Wall $<
|
||||
|
||||
jni/yap_wrap.o: jni/yap_wrap.cpp
|
||||
@ -103,7 +112,7 @@ android/AndroidManifest.xml: $(ANDROID_PKG)
|
||||
mkdir -p android/assets/lib/Yap
|
||||
mkdir -p android/jni
|
||||
|
||||
android/jni/yap_wrap.cpp: $(srcdir)/yap.i $(srcdir)/../../CXX/yapi.hh $(srcdir)/../../CXX/yapi.cpp android/AndroidManifest.xml
|
||||
android/jni/yap_wrap.cpp: $(YAP_SWIG_INTERF) android/AndroidManifest.xml
|
||||
$(SWIG) -c++ -java -I$(srcdir)/../../CXX -package pt.up.fc.dcc.yap -outdir android/src/pt/up/fc/dcc/yap -o android/jni/yap_wrap.cpp $<
|
||||
|
||||
install-android: android
|
||||
|
@ -9,12 +9,12 @@ engine = yap.YAPEngine();
|
||||
def go():
|
||||
while True:
|
||||
s = raw_input("Prolog Query: ")
|
||||
try:
|
||||
q = engine.query(s)
|
||||
except:
|
||||
print "Oops! That was no valid number. Try again..."
|
||||
while q.next():
|
||||
vs = q.namedVars();
|
||||
if vs.length() == 0:
|
||||
print "yes"
|
||||
else:
|
||||
while vs.length() > 0:
|
||||
eq = vs.car()
|
||||
print eq.getArg(1).text() + " = " + eq.getArg(2).text()
|
||||
|
@ -46,10 +46,10 @@
|
||||
#define YAP_CPP_INTERFACE 1
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
#include "yapi.hh"
|
||||
|
||||
extern "C" {
|
||||
|
||||
extern Term Yap_StringToTerm(const char *s, size_t len, term_t bindings);
|
||||
|
||||
#if THREADS
|
||||
@ -68,6 +68,16 @@ extern "C" {
|
||||
|
||||
%include "yapi.hh"
|
||||
|
||||
%include "yapa.hh"
|
||||
|
||||
%include "yapie.hh"
|
||||
|
||||
%include "yapt.hh"
|
||||
|
||||
%include "yapdb.hh"
|
||||
|
||||
%include "yapq.hh"
|
||||
|
||||
#ifdef SWIGJAVA
|
||||
%javaexception("java.text.ParseException") YAPPredicate {
|
||||
try {
|
||||
|
Reference in New Issue
Block a user