synchronize compiler oops with their descriptions
computils; allocate N instruction blocks.
This commit is contained in:
parent
f415e16b79
commit
37a49f2135
553
C/computils.c
553
C/computils.c
@ -66,9 +66,6 @@ static char SccsId[] = "%W% %G%";
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
static void ShowOp(const char *, struct PSEUDO *);
|
|
||||||
#endif /* DEBUG */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The compiler creates an instruction chain which will be assembled after
|
* The compiler creates an instruction chain which will be assembled after
|
||||||
@ -288,6 +285,72 @@ Yap_emit_4ops (compiler_vm_op o, CELL r1, CELL r2, CELL r3, CELL r4, struct inte
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Yap_emit_5ops (compiler_vm_op o, CELL r1, CELL r2, CELL r3, CELL r4, CELL r5, struct intermediates *cip)
|
||||||
|
{
|
||||||
|
PInstr *p;
|
||||||
|
p = (PInstr *) AllocCMem (sizeof (*p)+3*sizeof(CELL), cip);
|
||||||
|
p->op = o;
|
||||||
|
p->rnd1 = r1;
|
||||||
|
p->rnd2 = r2;
|
||||||
|
p->rnd3 = r3;
|
||||||
|
p->rnd4 = r4;
|
||||||
|
p->rnd5 = r5;
|
||||||
|
p->nextInst = NIL;
|
||||||
|
if (cip->cpc == NIL)
|
||||||
|
cip->cpc = cip->CodeStart = p;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cip->cpc->nextInst = p;
|
||||||
|
cip->cpc = p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Yap_emit_6ops (compiler_vm_op o, CELL r1, CELL r2, CELL r3, CELL r4, CELL r5, CELL r6, struct intermediates *cip)
|
||||||
|
{
|
||||||
|
PInstr *p;
|
||||||
|
p = (PInstr *) AllocCMem (sizeof (*p)+4*sizeof(CELL), cip);
|
||||||
|
p->op = o;
|
||||||
|
p->rnd1 = r1;
|
||||||
|
p->rnd2 = r2;
|
||||||
|
p->rnd3 = r3;
|
||||||
|
p->rnd4 = r4;
|
||||||
|
p->rnd5 = r5;
|
||||||
|
p->rnd6 = r6;
|
||||||
|
p->nextInst = NIL;
|
||||||
|
if (cip->cpc == NIL)
|
||||||
|
cip->cpc = cip->CodeStart = p;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cip->cpc->nextInst = p;
|
||||||
|
cip->cpc = p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Yap_emit_7ops (compiler_vm_op o, CELL r1, CELL r2, CELL r3, CELL r4, CELL r5, CELL r6, CELL r7, struct intermediates *cip)
|
||||||
|
{
|
||||||
|
PInstr *p;
|
||||||
|
p = (PInstr *) AllocCMem (sizeof (*p)+5*sizeof(CELL), cip);
|
||||||
|
p->op = o;
|
||||||
|
p->rnd1 = r1;
|
||||||
|
p->rnd2 = r2;
|
||||||
|
p->rnd3 = r3;
|
||||||
|
p->rnd4 = r4;
|
||||||
|
p->rnd5 = r5;
|
||||||
|
p->rnd6 = r6;
|
||||||
|
p->rnd7 = r7;
|
||||||
|
p->nextInst = NIL;
|
||||||
|
if (cip->cpc == NIL)
|
||||||
|
cip->cpc = cip->CodeStart = p;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cip->cpc->nextInst = p;
|
||||||
|
cip->cpc = p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CELL *
|
CELL *
|
||||||
Yap_emit_extra_size (compiler_vm_op o, CELL r1, int size, struct intermediates *cip)
|
Yap_emit_extra_size (compiler_vm_op o, CELL r1, int size, struct intermediates *cip)
|
||||||
{
|
{
|
||||||
@ -415,14 +478,51 @@ write_address(CELL address)
|
|||||||
sprintf(buf,"%p",(void *)address);
|
sprintf(buf,"%p",(void *)address);
|
||||||
#endif
|
#endif
|
||||||
p[31] = '\0'; /* so that I don't have to worry */
|
p[31] = '\0'; /* so that I don't have to worry */
|
||||||
Yap_DebugErrorPutc('0');
|
//Yap_DebugErrorPutc('0');
|
||||||
Yap_DebugErrorPutc('x');
|
//Yap_DebugErrorPutc('x');
|
||||||
while (*p != '\0') {
|
while (*p != '\0') {
|
||||||
Yap_DebugErrorPutc(*p++);
|
Yap_DebugErrorPutc(*p++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
write_special_label(special_label_op arg, special_label_id rn, UInt lab)
|
||||||
|
{
|
||||||
|
switch (arg) {
|
||||||
|
case SPECIAL_LABEL_INIT:
|
||||||
|
Yap_DebugErrorPuts("init,");
|
||||||
|
switch (rn) {
|
||||||
|
case SPECIAL_LABEL_EXCEPTION:
|
||||||
|
Yap_DebugErrorPuts("exception,");
|
||||||
|
break;
|
||||||
|
case SPECIAL_LABEL_SUCCESS:
|
||||||
|
Yap_DebugErrorPuts("success,");
|
||||||
|
break;
|
||||||
|
case SPECIAL_LABEL_FAILURE:
|
||||||
|
Yap_DebugErrorPuts("fail,");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
write_address(lab);
|
||||||
|
case SPECIAL_LABEL_SET:
|
||||||
|
Yap_DebugErrorPuts("set,");
|
||||||
|
break;
|
||||||
|
case SPECIAL_LABEL_CLEAR:
|
||||||
|
Yap_DebugErrorPuts("clear,");
|
||||||
|
switch (rn) {
|
||||||
|
case SPECIAL_LABEL_EXCEPTION:
|
||||||
|
Yap_DebugErrorPuts("exception");
|
||||||
|
break;
|
||||||
|
case SPECIAL_LABEL_SUCCESS:
|
||||||
|
Yap_DebugErrorPuts("success");
|
||||||
|
break;
|
||||||
|
case SPECIAL_LABEL_FAILURE:
|
||||||
|
Yap_DebugErrorPuts("fail");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_functor(Functor f)
|
write_functor(Functor f)
|
||||||
{
|
{
|
||||||
@ -445,14 +545,38 @@ write_functor(Functor f)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
char *opDesc[] = { mklist(f_arr) };
|
||||||
ShowOp (const char *f, struct PSEUDO *cpc)
|
|
||||||
|
static void send_pred(PredEntry *p)
|
||||||
{
|
{
|
||||||
|
Functor f = p->FunctorOfPred;
|
||||||
|
UInt arity = p->ArityOfPE;
|
||||||
|
Term mod = TermProlog;
|
||||||
|
|
||||||
|
if (p->ModuleOfPred) mod = p->ModuleOfPred;
|
||||||
|
Yap_DebugPlWrite (mod);
|
||||||
|
Yap_DebugErrorPutc (':');
|
||||||
|
if (arity == 0)
|
||||||
|
Yap_DebugPlWrite (MkAtomTerm ((Atom)f));
|
||||||
|
else
|
||||||
|
Yap_DebugPlWrite (MkAtomTerm (NameOfFunctor (f)));
|
||||||
|
Yap_DebugErrorPutc ('/');
|
||||||
|
Yap_DebugPlWrite (MkIntTerm (arity));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
ShowOp (compiler_vm_op ic, const char *f, struct PSEUDO *cpc)
|
||||||
|
{
|
||||||
|
CACHE_REGS
|
||||||
char ch;
|
char ch;
|
||||||
Int arg = cpc->rnd1;
|
Int arg = cpc->rnd1;
|
||||||
Int rn = cpc->rnd2;
|
Int rn = cpc->rnd2;
|
||||||
CELL *cptr = cpc->arnds;
|
CELL *cptr = cpc->arnds;
|
||||||
|
|
||||||
|
if (ic != label_op && ic != label_ctl_op && ic != name_op) {
|
||||||
|
Yap_DebugErrorPutc ('\t');
|
||||||
|
}
|
||||||
while ((ch = *f++) != 0)
|
while ((ch = *f++) != 0)
|
||||||
{
|
{
|
||||||
if (ch == '%')
|
if (ch == '%')
|
||||||
@ -466,6 +590,19 @@ ShowOp (const char *f, struct PSEUDO *cpc)
|
|||||||
Yap_DebugPlWrite(MkIntTerm(arg));
|
Yap_DebugPlWrite(MkIntTerm(arg));
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
case '2':
|
||||||
|
{
|
||||||
|
Ventry *v = (Ventry *) cpc->rnd3;
|
||||||
|
Yap_DebugErrorPutc (v->KindOfVE == PermVar ? 'Y' : 'X');
|
||||||
|
Yap_DebugPlWrite (MkIntTerm ((v->NoOfVE) & MaskVarAdrs));
|
||||||
|
Yap_DebugErrorPutc (',');
|
||||||
|
Yap_DebugErrorPutc ('A');
|
||||||
|
Yap_DebugPlWrite (MkIntegerTerm (cpc->rnd4));
|
||||||
|
Yap_DebugErrorPutc (',');
|
||||||
|
send_pred( RepPredProp((Prop)(cpc->rnd5)) );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 'a':
|
case 'a':
|
||||||
case 'n':
|
case 'n':
|
||||||
case 'S':
|
case 'S':
|
||||||
@ -474,7 +611,6 @@ ShowOp (const char *f, struct PSEUDO *cpc)
|
|||||||
case 'b':
|
case 'b':
|
||||||
/* write a variable bitmap for a call */
|
/* write a variable bitmap for a call */
|
||||||
{
|
{
|
||||||
CACHE_REGS
|
|
||||||
int max = arg/(8*sizeof(CELL)), i;
|
int max = arg/(8*sizeof(CELL)), i;
|
||||||
CELL *ptr = cptr;
|
CELL *ptr = cptr;
|
||||||
for (i = 0; i <= max; i++) {
|
for (i = 0; i <= max; i++) {
|
||||||
@ -485,6 +621,9 @@ ShowOp (const char *f, struct PSEUDO *cpc)
|
|||||||
case 'l':
|
case 'l':
|
||||||
write_address (arg);
|
write_address (arg);
|
||||||
break;
|
break;
|
||||||
|
case 'L':
|
||||||
|
write_special_label (arg, rn, cpc->rnd3);
|
||||||
|
break;
|
||||||
case 'B':
|
case 'B':
|
||||||
{
|
{
|
||||||
char s[32];
|
char s[32];
|
||||||
@ -494,10 +633,7 @@ ShowOp (const char *f, struct PSEUDO *cpc)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
{
|
Yap_DebugPlWrite (MkIntegerTerm (arg));
|
||||||
CACHE_REGS
|
|
||||||
Yap_DebugPlWrite (MkIntegerTerm (arg));
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'z':
|
case 'z':
|
||||||
Yap_DebugPlWrite (MkIntTerm (cpc->rnd3));
|
Yap_DebugPlWrite (MkIntTerm (cpc->rnd3));
|
||||||
@ -520,50 +656,17 @@ ShowOp (const char *f, struct PSEUDO *cpc)
|
|||||||
Yap_DebugPlWrite (MkIntTerm ((v->NoOfVE) & MaskVarAdrs));
|
Yap_DebugPlWrite (MkIntTerm ((v->NoOfVE) & MaskVarAdrs));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
Yap_DebugPlWrite (MkAtomTerm ((Atom) arg));
|
Yap_DebugPlWrite (MkAtomTerm ((Atom) arg));
|
||||||
Yap_DebugErrorPutc ('/');
|
Yap_DebugErrorPutc ('/');
|
||||||
Yap_DebugPlWrite (MkIntTerm (rn));
|
Yap_DebugPlWrite (MkIntTerm (rn));
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
{
|
send_pred( RepPredProp((Prop)(arg) ));
|
||||||
PredEntry *p = RepPredProp ((Prop) arg);
|
break;
|
||||||
Functor f = p->FunctorOfPred;
|
case 'P':
|
||||||
UInt arity = p->ArityOfPE;
|
send_pred( RepPredProp((Prop)(rn) ));
|
||||||
Term mod;
|
break;
|
||||||
|
|
||||||
if (p->ModuleOfPred)
|
|
||||||
mod = p->ModuleOfPred;
|
|
||||||
else
|
|
||||||
mod = TermProlog;
|
|
||||||
Yap_DebugPlWrite (mod);
|
|
||||||
Yap_DebugErrorPutc (':');
|
|
||||||
if (arity == 0)
|
|
||||||
Yap_DebugPlWrite (MkAtomTerm ((Atom)f));
|
|
||||||
else
|
|
||||||
Yap_DebugPlWrite (MkAtomTerm (NameOfFunctor (f)));
|
|
||||||
Yap_DebugErrorPutc ('/');
|
|
||||||
Yap_DebugPlWrite (MkIntTerm (arity));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'P':
|
|
||||||
{
|
|
||||||
PredEntry *p = RepPredProp((Prop) rn);
|
|
||||||
Functor f = p->FunctorOfPred;
|
|
||||||
UInt arity = p->ArityOfPE;
|
|
||||||
Term mod = TermProlog;
|
|
||||||
|
|
||||||
if (p->ModuleOfPred) mod = p->ModuleOfPred;
|
|
||||||
Yap_DebugPlWrite (mod);
|
|
||||||
Yap_DebugErrorPutc (':');
|
|
||||||
if (arity == 0)
|
|
||||||
Yap_DebugPlWrite (MkAtomTerm ((Atom)f));
|
|
||||||
else
|
|
||||||
Yap_DebugPlWrite (MkAtomTerm (NameOfFunctor (f)));
|
|
||||||
Yap_DebugErrorPutc ('/');
|
|
||||||
Yap_DebugPlWrite (MkIntTerm (arity));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'f':
|
case 'f':
|
||||||
write_functor((Functor)arg);
|
write_functor((Functor)arg);
|
||||||
break;
|
break;
|
||||||
@ -667,342 +770,6 @@ ShowOp (const char *f, struct PSEUDO *cpc)
|
|||||||
Yap_DebugErrorPutc ('\n');
|
Yap_DebugErrorPutc ('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
|
||||||
getFormat(compiler_vm_op ic) {
|
|
||||||
switch( ic ) {
|
|
||||||
case nop_op:
|
|
||||||
return "nop";
|
|
||||||
case get_var_op:
|
|
||||||
return "get_var\t\t%v,%r";
|
|
||||||
case put_var_op:
|
|
||||||
return "put_var\t\t%v,%r";
|
|
||||||
case get_val_op:
|
|
||||||
return "get_val\t\t%v,%r";
|
|
||||||
case put_val_op:
|
|
||||||
return "put_val\t\t%v,%r";
|
|
||||||
case get_atom_op:
|
|
||||||
return "get_atom\t%a,%r";
|
|
||||||
case put_atom_op:
|
|
||||||
return "put_atom\t%a,%r";
|
|
||||||
case get_num_op:
|
|
||||||
return "get_num\t\t%n,%r";
|
|
||||||
case put_num_op:
|
|
||||||
return "put_num\t\t%n,%r";
|
|
||||||
case get_float_op:
|
|
||||||
return "get_float\t\t%w,%r";
|
|
||||||
case put_float_op:
|
|
||||||
return "put_float\t\t%w,%r";
|
|
||||||
case get_string_op:
|
|
||||||
return "get_string\t\t%w,%S";
|
|
||||||
case put_string_op:
|
|
||||||
return "put_string\t\t%w,%S";
|
|
||||||
case get_dbterm_op:
|
|
||||||
return "get_dbterm\t%w,%r";
|
|
||||||
case put_dbterm_op:
|
|
||||||
return "put_dbterm\t%w,%r";
|
|
||||||
case get_longint_op:
|
|
||||||
return "get_longint\t\t%w,%r";
|
|
||||||
case put_longint_op:
|
|
||||||
return "put_longint\t\t%w,%r";
|
|
||||||
case get_bigint_op:
|
|
||||||
return "get_bigint\t\t%l,%r";
|
|
||||||
case put_bigint_op:
|
|
||||||
return "put_bigint\t\t%l,%r";
|
|
||||||
case get_list_op:
|
|
||||||
return "get_list\t%r";
|
|
||||||
case put_list_op:
|
|
||||||
return "put_list\t%r";
|
|
||||||
case get_struct_op:
|
|
||||||
return "get_struct\t%f,%r";
|
|
||||||
case put_struct_op:
|
|
||||||
return "put_struct\t%f,%r";
|
|
||||||
case put_unsafe_op:
|
|
||||||
return "put_unsafe\t%v,%r";
|
|
||||||
case unify_var_op:
|
|
||||||
return "unify_var\t%v";
|
|
||||||
case write_var_op:
|
|
||||||
return "write_var\t%v";
|
|
||||||
case unify_val_op:
|
|
||||||
return "unify_val\t%v";
|
|
||||||
case write_val_op:
|
|
||||||
return "write_val\t%v";
|
|
||||||
case unify_atom_op:
|
|
||||||
return "unify_atom\t%a";
|
|
||||||
case write_atom_op:
|
|
||||||
return "write_atom\t%a";
|
|
||||||
case unify_num_op:
|
|
||||||
return "unify_num\t%n";
|
|
||||||
case write_num_op:
|
|
||||||
return "write_num\t%n";
|
|
||||||
case unify_float_op:
|
|
||||||
return "unify_float\t%w";
|
|
||||||
case write_float_op:
|
|
||||||
return "write_float\t%w";
|
|
||||||
case unify_string_op:
|
|
||||||
return "unify_string\t%S";
|
|
||||||
case write_string_op:
|
|
||||||
return "write_string\t%S";
|
|
||||||
case unify_dbterm_op:
|
|
||||||
return "unify_dbterm\t%w";
|
|
||||||
case write_dbterm_op:
|
|
||||||
return "write_dbterm\t%w";
|
|
||||||
case unify_longint_op:
|
|
||||||
return "unify_longint\t%w";
|
|
||||||
case write_longint_op:
|
|
||||||
return "write_longint\t%w";
|
|
||||||
case unify_bigint_op:
|
|
||||||
return "unify_bigint\t%l";
|
|
||||||
case write_bigint_op:
|
|
||||||
return "write_bigint\t%l";
|
|
||||||
case unify_list_op:
|
|
||||||
return "unify_list";
|
|
||||||
case write_list_op:
|
|
||||||
return "write_list";
|
|
||||||
case unify_struct_op:
|
|
||||||
return "unify_struct\t%f";
|
|
||||||
case write_struct_op:
|
|
||||||
return "write_struct\t%f";
|
|
||||||
case write_unsafe_op:
|
|
||||||
return "write_unsafe\t%v";
|
|
||||||
case unify_local_op:
|
|
||||||
return "unify_local\t%v";
|
|
||||||
case write_local_op:
|
|
||||||
return "write local\t%v";
|
|
||||||
case unify_last_list_op:
|
|
||||||
return "unify_last_list";
|
|
||||||
case write_last_list_op:
|
|
||||||
return "write_last_list";
|
|
||||||
case unify_last_struct_op:
|
|
||||||
return "unify_last_struct\t%f";
|
|
||||||
case write_last_struct_op:
|
|
||||||
return "write_last_struct\t%f";
|
|
||||||
case unify_last_var_op:
|
|
||||||
return "unify_last_var\t%v";
|
|
||||||
case unify_last_val_op:
|
|
||||||
return "unify_last_val\t%v";
|
|
||||||
case unify_last_local_op:
|
|
||||||
return "unify_last_local\t%v";
|
|
||||||
case unify_last_atom_op:
|
|
||||||
return "unify_last_atom\t%a";
|
|
||||||
case unify_last_num_op:
|
|
||||||
return "unify_last_num\t%n";
|
|
||||||
case unify_last_float_op:
|
|
||||||
return "unify_last_float\t%w";
|
|
||||||
case unify_last_string_op:
|
|
||||||
return "unify_last_string\t%S";
|
|
||||||
case unify_last_dbterm_op:
|
|
||||||
return "unify_last_dbterm\t%w";
|
|
||||||
case unify_last_longint_op:
|
|
||||||
return "unify_last_longint\t%w";
|
|
||||||
case unify_last_bigint_op:
|
|
||||||
return "unify_last_bigint\t%l";
|
|
||||||
case ensure_space_op:
|
|
||||||
return "ensure_space";
|
|
||||||
case native_op:
|
|
||||||
return "native_code";
|
|
||||||
case f_var_op:
|
|
||||||
return "function_to_var\t%v,%B";
|
|
||||||
case f_val_op:
|
|
||||||
return "function_to_val\t%v,%B";
|
|
||||||
case f_0_op:
|
|
||||||
return "function_to_0\t%B";
|
|
||||||
case align_float_op:
|
|
||||||
return "align_float";
|
|
||||||
case fail_op:
|
|
||||||
return "fail";
|
|
||||||
case cut_op:
|
|
||||||
return "cut";
|
|
||||||
case cutexit_op:
|
|
||||||
return "cutexit";
|
|
||||||
case allocate_op:
|
|
||||||
return "allocate";
|
|
||||||
case deallocate_op:
|
|
||||||
return "deallocate";
|
|
||||||
case tryme_op:
|
|
||||||
return "try_me_else\t\t%l\t%x";
|
|
||||||
case jump_op:
|
|
||||||
return "jump\t\t%l";
|
|
||||||
case jumpi_op:
|
|
||||||
return "jump_in_indexing\t\t%i";
|
|
||||||
case procceed_op:
|
|
||||||
return "proceed";
|
|
||||||
case call_op:
|
|
||||||
return "call\t\t%p,%d,%z";
|
|
||||||
case execute_op:
|
|
||||||
return "execute\t\t%p";
|
|
||||||
case safe_call_op:
|
|
||||||
return "sys\t\t%p";
|
|
||||||
case label_op:
|
|
||||||
return "%l:";
|
|
||||||
case name_op:
|
|
||||||
return "name\t\t%m,%d";
|
|
||||||
case pop_op:
|
|
||||||
return "pop\t\t%l";
|
|
||||||
case retryme_op:
|
|
||||||
return "retry_me_else\t\t%l\t%x";
|
|
||||||
case trustme_op:
|
|
||||||
return "trust_me_else_fail\t%x";
|
|
||||||
case either_op:
|
|
||||||
return "either_me\t\t%l,%d,%z";
|
|
||||||
case orelse_op:
|
|
||||||
return "or_else\t\t%l,%z";
|
|
||||||
case orlast_op:
|
|
||||||
return "or_last";
|
|
||||||
case push_or_op:
|
|
||||||
return "push_or";
|
|
||||||
case pop_or_op:
|
|
||||||
return "pop_or";
|
|
||||||
case pushpop_or_op:
|
|
||||||
return "pushpop_or";
|
|
||||||
case save_b_op:
|
|
||||||
return "save_by\t\t%v";
|
|
||||||
case commit_b_op:
|
|
||||||
return "commit_by\t\t%v";
|
|
||||||
case patch_b_op:
|
|
||||||
return "patch_by\t\t%v";
|
|
||||||
case try_op:
|
|
||||||
return "try\t\t%g\t%x";
|
|
||||||
case retry_op:
|
|
||||||
return "retry\t\t%g\t%x";
|
|
||||||
case trust_op:
|
|
||||||
return "trust\t\t%g\t%x";
|
|
||||||
case try_in_op:
|
|
||||||
return "try_in\t\t%g\t%x";
|
|
||||||
case jump_v_op:
|
|
||||||
return "jump_if_var\t\t%g";
|
|
||||||
case jump_nv_op:
|
|
||||||
return "jump_if_nonvar\t\t%g";
|
|
||||||
case cache_arg_op:
|
|
||||||
return "cache_arg\t%r";
|
|
||||||
case cache_sub_arg_op:
|
|
||||||
return "cache_sub_arg\t%d";
|
|
||||||
case user_switch_op:
|
|
||||||
return "user_switch";
|
|
||||||
case switch_on_type_op:
|
|
||||||
return "switch_on_type\t%h\t%h\t%h\t%h";
|
|
||||||
case switch_c_op:
|
|
||||||
return "switch_on_constant\t%i\n%c";
|
|
||||||
case if_c_op:
|
|
||||||
return "if_constant\t%i\n%c";
|
|
||||||
case switch_f_op:
|
|
||||||
return "switch_on_functor\t%i\n%e";
|
|
||||||
case if_f_op:
|
|
||||||
return "if_functor\t%i\n%e";
|
|
||||||
case if_not_op:
|
|
||||||
return "if_not_then\t%i\t%h\t%h\t%h";
|
|
||||||
case index_dbref_op:
|
|
||||||
return "index_on_dbref";
|
|
||||||
case index_blob_op:
|
|
||||||
return "index_on_blob";
|
|
||||||
case index_long_op:
|
|
||||||
return "index_on_blob";
|
|
||||||
case index_string_op:
|
|
||||||
return "index_on_string";
|
|
||||||
case if_nonvar_op:
|
|
||||||
return "check_var\t %r";
|
|
||||||
case save_pair_op:
|
|
||||||
return "save_pair\t%v";
|
|
||||||
case save_appl_op:
|
|
||||||
return "save_appl\t%v";
|
|
||||||
case mark_initialised_pvars_op:
|
|
||||||
return "pvar_bitmap\t%l,%b";
|
|
||||||
case mark_live_regs_op:
|
|
||||||
return "pvar_live_regs\t%l,%b";
|
|
||||||
case fetch_args_vv_op:
|
|
||||||
return "fetch_reg1_reg2\t%N,%N";
|
|
||||||
case fetch_args_cv_op:
|
|
||||||
return "fetch_constant_reg\t%l,%N";
|
|
||||||
case fetch_args_vc_op:
|
|
||||||
return "fetch_reg_constant\t%l,%N";
|
|
||||||
case fetch_args_iv_op:
|
|
||||||
return "fetch_integer_reg\t%d,%N";
|
|
||||||
case fetch_args_vi_op:
|
|
||||||
return "fetch_reg_integer\t%d,%N";
|
|
||||||
case enter_profiling_op:
|
|
||||||
return "enter_profiling\t\t%g";
|
|
||||||
case retry_profiled_op:
|
|
||||||
return "retry_profiled\t\t%g";
|
|
||||||
case count_call_op:
|
|
||||||
return "count_call_op\t\t%g";
|
|
||||||
case count_retry_op:
|
|
||||||
return "count_retry_op\t\t%g";
|
|
||||||
case restore_tmps_op:
|
|
||||||
return "restore_temps\t\t%l";
|
|
||||||
case restore_tmps_and_skip_op:
|
|
||||||
return "restore_temps_and_skip\t\t%l";
|
|
||||||
case enter_lu_op:
|
|
||||||
return "enter_lu";
|
|
||||||
case empty_call_op:
|
|
||||||
return "empty_call\t\t%l,%d";
|
|
||||||
#ifdef YAPOR
|
|
||||||
case sync_op:
|
|
||||||
return "sync";
|
|
||||||
#endif /* YAPOR */
|
|
||||||
#ifdef TABLING
|
|
||||||
case table_new_answer_op:
|
|
||||||
return "table_new_answer";
|
|
||||||
case table_try_single_op:
|
|
||||||
return "table_try_single\t%g\t%x";
|
|
||||||
#endif /* TABLING */
|
|
||||||
#ifdef TABLING_INNER_CUTS
|
|
||||||
case "clause_with_cut":
|
|
||||||
return clause_with_cut_op;
|
|
||||||
#endif /* TABLING_INNER_CUTS */
|
|
||||||
#ifdef BEAM
|
|
||||||
"run_op %1,%4",
|
|
||||||
"body_op %1",
|
|
||||||
"endgoal_op",
|
|
||||||
"try_me_op %1,%4",
|
|
||||||
"retry_me_op %1,%4",
|
|
||||||
"trust_me_op %1,%4",
|
|
||||||
"only_1_clause_op %1,%4",
|
|
||||||
"create_first_box_op %1,%4",
|
|
||||||
"create_box_op %1,%4",
|
|
||||||
"create_last_box_op %1,%4",
|
|
||||||
"remove_box_op %1,%4",
|
|
||||||
"remove_last_box_op %1,%4",
|
|
||||||
"prepare_tries",
|
|
||||||
"std_base_op %1,%4",
|
|
||||||
"direct_safe_call",
|
|
||||||
"skip_while_var_op",
|
|
||||||
"wait_while_var_op",
|
|
||||||
"force_wait_op",
|
|
||||||
"write_op",
|
|
||||||
"is_op",
|
|
||||||
"equal_op",
|
|
||||||
"exit",
|
|
||||||
#endif
|
|
||||||
case fetch_args_for_bccall_op:
|
|
||||||
return "fetch_args_for_bccall\t%v";
|
|
||||||
case bccall_op:
|
|
||||||
return "binary_cfunc\t\t%v,%P";
|
|
||||||
case blob_op:
|
|
||||||
return "blob\t%O";
|
|
||||||
case string_op:
|
|
||||||
return "string\t%O";
|
|
||||||
case label_ctl_op:
|
|
||||||
return "label_control\t";
|
|
||||||
#ifdef SFUNC
|
|
||||||
,
|
|
||||||
"get_s_f_op\t%f,%r",
|
|
||||||
"put_s_f_op\t%f,%r",
|
|
||||||
"unify_s_f_op\t%f",
|
|
||||||
"write_s_f_op\t%f",
|
|
||||||
"unify_s_var\t%v,%r",
|
|
||||||
"write_s_var\t%v,%r",
|
|
||||||
"unify_s_val\t%v,%r",
|
|
||||||
"write_s_val\t%v,%r",
|
|
||||||
"unify_s_a\t%a,%r",
|
|
||||||
"write_s_a\t%a,%r",
|
|
||||||
"get_s_end",
|
|
||||||
"put_s_end",
|
|
||||||
"unify_s_end",
|
|
||||||
"write_s_end"
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Yap_ShowCode (struct intermediates *cint)
|
Yap_ShowCode (struct intermediates *cint)
|
||||||
{
|
{
|
||||||
@ -1015,8 +782,8 @@ Yap_ShowCode (struct intermediates *cint)
|
|||||||
while (cpc) {
|
while (cpc) {
|
||||||
compiler_vm_op ic = cpc->op;
|
compiler_vm_op ic = cpc->op;
|
||||||
if (ic != nop_op) {
|
if (ic != nop_op) {
|
||||||
}
|
ShowOp (ic, opDesc[ic], cpc);
|
||||||
ShowOp (getFormat(ic), cpc);
|
}
|
||||||
cpc = cpc->nextInst;
|
cpc = cpc->nextInst;
|
||||||
}
|
}
|
||||||
Yap_DebugErrorPutc ('\n');
|
Yap_DebugErrorPutc ('\n');
|
||||||
|
396
H/compile.h
396
H/compile.h
@ -18,197 +18,222 @@
|
|||||||
/* consult stack management */
|
/* consult stack management */
|
||||||
|
|
||||||
/* virtual machine instruction op-codes */
|
/* virtual machine instruction op-codes */
|
||||||
typedef enum compiler_op {
|
#define mklist0(f) \
|
||||||
nop_op,
|
f( nop_op, "nop") \
|
||||||
get_var_op,
|
f( get_var_op, "get_var\t\t%v,%r") \
|
||||||
put_var_op,
|
f( put_var_op, "put_var\t\t%v,%r") \
|
||||||
get_val_op,
|
f( get_val_op, "get_val\t\t%v,%r") \
|
||||||
put_val_op,
|
f( put_val_op, "put_val\t\t%v,%r") \
|
||||||
get_atom_op,
|
f( get_atom_op, "get_atom\t%a,%r") \
|
||||||
put_atom_op,
|
f( put_atom_op, "put_atom\t%a,%r") \
|
||||||
get_num_op,
|
f( get_num_op, "get_num\t\t%n,%r") \
|
||||||
put_num_op,
|
f( put_num_op, "put_num\t\t%n,%r") \
|
||||||
get_float_op,
|
f( get_float_op,"get_float\t\t%w,%r" ) \
|
||||||
put_float_op,
|
f( put_float_op, "put_float\t\t%w,%r") \
|
||||||
get_dbterm_op,
|
f( get_dbterm_op, "get_dbterm\t%w,%r") \
|
||||||
put_dbterm_op,
|
f( put_dbterm_op, "put_dbterm\t%w,%r") \
|
||||||
get_longint_op,
|
f( get_longint_op, "get_longint\t\t%w,%r") \
|
||||||
put_longint_op,
|
f( put_longint_op, "put_longint\t\t%w,%r") \
|
||||||
get_string_op,
|
f( get_string_op, "get_string\t\t%w,%S") \
|
||||||
put_string_op,
|
f( put_string_op, "put_string\t\t%w,%S") \
|
||||||
get_bigint_op,
|
f( get_bigint_op, "get_bigint\t\t%l,%r") \
|
||||||
put_bigint_op,
|
f( put_bigint_op, "put_bigint\t\t%l,%r") \
|
||||||
get_list_op,
|
f( get_list_op, "get_list\t%r") \
|
||||||
put_list_op,
|
f( put_list_op, "put_list\t%r") \
|
||||||
get_struct_op,
|
f( get_struct_op, "get_struct\t%f,%r") \
|
||||||
put_struct_op,
|
f( put_struct_op, "put_struct\t%f,%r") \
|
||||||
put_unsafe_op,
|
f( put_unsafe_op, "put_unsafe\t%v,%r") \
|
||||||
unify_var_op,
|
f( unify_var_op, "unify_var\t%v") \
|
||||||
write_var_op,
|
f( write_var_op, "write_var\t%v") \
|
||||||
unify_val_op,
|
f( unify_val_op, "unify_val\t%v") \
|
||||||
write_val_op,
|
f( write_val_op, "write_val\t%v") \
|
||||||
unify_atom_op,
|
f( unify_atom_op, "unify_atom\t%a") \
|
||||||
write_atom_op,
|
f( write_atom_op, "write_atom\t%a") \
|
||||||
unify_num_op,
|
f( unify_num_op, "unify_num\t%n") \
|
||||||
write_num_op,
|
f( write_num_op, "write_num\t%n") \
|
||||||
unify_float_op,
|
f( unify_float_op, "unify_float\t%w") \
|
||||||
write_float_op,
|
f( write_float_op, "write_float\t%w") \
|
||||||
unify_dbterm_op,
|
f( unify_dbterm_op, "unify_dbterm\t%w") \
|
||||||
write_dbterm_op,
|
f( write_dbterm_op, "write_dbterm\t%w") \
|
||||||
unify_longint_op,
|
f( unify_longint_op, "unify_longint\t%w") \
|
||||||
write_longint_op,
|
f( write_longint_op, "write_longint\t%w") \
|
||||||
unify_string_op,
|
f( unify_string_op, "unify_string\t%S") \
|
||||||
write_string_op,
|
f( write_string_op, "write_string\t%S") \
|
||||||
unify_bigint_op,
|
f( unify_bigint_op, "unify_bigint\t%l") \
|
||||||
write_bigint_op,
|
f( write_bigint_op, "write_bigint\t%l") \
|
||||||
unify_list_op,
|
f( unify_list_op, "unify_list") \
|
||||||
write_list_op,
|
f( write_list_op, "write_list") \
|
||||||
unify_struct_op,
|
f( unify_struct_op, "unify_struct\t%f") \
|
||||||
write_struct_op,
|
f( write_struct_op, "write_struct\t%f") \
|
||||||
write_unsafe_op,
|
f( write_unsafe_op, "write_unsafe\t%v") \
|
||||||
unify_local_op,
|
f( unify_local_op, "unify_local\t%v") \
|
||||||
write_local_op,
|
f( write_local_op, "write local\t%v") \
|
||||||
unify_last_list_op,
|
f( unify_last_list_op, "unify_last_list") \
|
||||||
write_last_list_op,
|
f( write_last_list_op, "write_last_list") \
|
||||||
unify_last_struct_op,
|
f( unify_last_struct_op, "unify_last_struct\t%f") \
|
||||||
write_last_struct_op,
|
f( write_last_struct_op, "write_last_struct\t%f") \
|
||||||
unify_last_var_op,
|
f( unify_last_var_op, "unify_last_var\t%v") \
|
||||||
unify_last_val_op,
|
f( unify_last_val_op, "unify_last_val\t%v") \
|
||||||
unify_last_local_op,
|
f( unify_last_local_op, "unify_last_local\t%v") \
|
||||||
unify_last_atom_op,
|
f( unify_last_atom_op, "unify_last_atom\t%a") \
|
||||||
unify_last_num_op,
|
f( unify_last_num_op, "unify_last_num\t%n") \
|
||||||
unify_last_float_op,
|
f( unify_last_float_op, "unify_last_float\t%w") \
|
||||||
unify_last_dbterm_op,
|
f( unify_last_dbterm_op, "unify_last_dbterm\t%w") \
|
||||||
unify_last_longint_op,
|
f( unify_last_longint_op, "unify_last_longint\t%w") \
|
||||||
unify_last_string_op,
|
f( unify_last_string_op, "unify_last_string\t%S") \
|
||||||
unify_last_bigint_op,
|
f( unify_last_bigint_op, "unify_last_bigint\t%l") \
|
||||||
ensure_space_op,
|
f( ensure_space_op, "ensure_space") \
|
||||||
native_op,
|
f( native_op, "native_code") \
|
||||||
f_var_op,
|
f( f_var_op, "function_to_var\t%v,%B") \
|
||||||
f_val_op,
|
f( f_val_op, "function_to_val\t%v,%B") \
|
||||||
f_0_op,
|
f( f_0_op, "function_to_0\t%B") \
|
||||||
align_float_op,
|
f( align_float_op, "align_float") \
|
||||||
fail_op,
|
f( fail_op, "fail") \
|
||||||
cut_op,
|
f( cut_op, "cut") \
|
||||||
cutexit_op,
|
f( cutexit_op, "cutexit") \
|
||||||
allocate_op,
|
f( allocate_op, "allocate") \
|
||||||
deallocate_op,
|
f( deallocate_op, "deallocate") \
|
||||||
tryme_op,
|
f( tryme_op, "try_me_else\t\t%l\t%x") \
|
||||||
jump_op,
|
f( jump_op, "jump\t\t%l") \
|
||||||
jumpi_op,
|
f( jumpi_op, "jump_in_indexing\t\t%i") \
|
||||||
procceed_op,
|
f( procceed_op, "proceed") \
|
||||||
call_op,
|
f( call_op, "call\t\t%p,%d,%z") \
|
||||||
execute_op,
|
f( execute_op, "execute\t\t%p") \
|
||||||
safe_call_op,
|
f( safe_call_op, "sys\t\t%p") \
|
||||||
label_op,
|
f( label_op, "%l:") \
|
||||||
name_op,
|
f( name_op, "name\t\t%m,%d") \
|
||||||
pop_op,
|
f( pop_op, "pop\t\t%l") \
|
||||||
retryme_op,
|
f( retryme_op, "retry_me_else\t\t%l\t%x") \
|
||||||
trustme_op,
|
f( trustme_op, "trust_me_else_fail\t%x") \
|
||||||
either_op,
|
f( either_op, "either_me\t\t%l,%d,%z") \
|
||||||
orelse_op,
|
f( orelse_op, "or_else\t\t%l,%z") \
|
||||||
orlast_op,
|
f( orlast_op, "or_last") \
|
||||||
push_or_op,
|
f( push_or_op, "push_or") \
|
||||||
pushpop_or_op,
|
f( pushpop_or_op, "pushpop_or") \
|
||||||
pop_or_op,
|
f( pop_or_op, "pop_or") \
|
||||||
save_b_op,
|
f( save_b_op, "save_by\t\t%v") \
|
||||||
commit_b_op,
|
f( commit_b_op, "commit_by\t\t%v") \
|
||||||
patch_b_op,
|
f( patch_b_op, "patch_by\t\t%v") \
|
||||||
try_op,
|
f( try_op, "try\t\t%g\t%x") \
|
||||||
retry_op,
|
f( retry_op, "retry\t\t%g\t%x") \
|
||||||
trust_op,
|
f( trust_op, "trust\t\t%g\t%x") \
|
||||||
try_in_op,
|
f( try_in_op, "try_in\t\t%g\t%x") \
|
||||||
jump_v_op,
|
f( jump_v_op, "jump_if_var\t\t%g") \
|
||||||
jump_nv_op,
|
f( jump_nv_op, "jump_if_nonvar\t\t%g") \
|
||||||
cache_arg_op,
|
f( cache_arg_op, "cache_arg\t%r") \
|
||||||
cache_sub_arg_op,
|
f( cache_sub_arg_op, "cache_sub_arg\t%d") \
|
||||||
user_switch_op,
|
f( user_switch_op, "user_switch") \
|
||||||
switch_on_type_op,
|
f( switch_on_type_op, "switch_on_type\t%h\t%h\t%h\t%h") \
|
||||||
switch_c_op,
|
f( switch_c_op, "switch_on_constant\t%i\n%c") \
|
||||||
if_c_op,
|
f( if_c_op, "if_constant\t%i\n%c") \
|
||||||
switch_f_op,
|
f( switch_f_op, "switch_on_functor\t%i\n%e") \
|
||||||
if_f_op,
|
f( if_f_op, "if_functor\t%i\n%e") \
|
||||||
if_not_op,
|
f( if_not_op, "if_not_then\t%i\t%h\t%h\t%h") \
|
||||||
index_dbref_op,
|
f( index_dbref_op, "index_on_dbref") \
|
||||||
index_blob_op,
|
f( index_blob_op, "index_on_blob") \
|
||||||
index_string_op,
|
f( index_string_op, "index_on_string") \
|
||||||
index_long_op,
|
f( index_long_op, "index_on_blob") \
|
||||||
if_nonvar_op,
|
f( if_nonvar_op, "check_var\t %r") \
|
||||||
save_pair_op,
|
f( save_pair_op, "save_pair\t%v") \
|
||||||
save_appl_op,
|
f( save_appl_op, "save_appl\t%v") \
|
||||||
mark_initialised_pvars_op,
|
f( mark_initialised_pvars_op, "pvar_bitmap\t%l,%b") \
|
||||||
mark_live_regs_op,
|
f( mark_live_regs_op, "pvar_live_regs\t%l,%b") \
|
||||||
fetch_args_vv_op,
|
f( fetch_args_vv_op, "fetch_reg1_reg2\t%N,%N") \
|
||||||
fetch_args_cv_op,
|
f( fetch_args_cv_op, "fetch_constant_reg\t%l,%N") \
|
||||||
fetch_args_vc_op,
|
f( fetch_args_vc_op, "fetch_reg_constant\t%l,%N") \
|
||||||
fetch_args_iv_op,
|
f( fetch_args_iv_op, "fetch_integer_reg\t%d,%N") \
|
||||||
fetch_args_vi_op,
|
f( fetch_args_vi_op, "fetch_reg_integer\t%d,%N") \
|
||||||
enter_profiling_op,
|
f( enter_profiling_op, "enter_profiling\t\t%g") \
|
||||||
retry_profiled_op,
|
f( retry_profiled_op, "retry_profiled\t\t%g") \
|
||||||
count_call_op,
|
f( count_call_op, "count_call_op\t\t%g") \
|
||||||
count_retry_op,
|
f( count_retry_op, "count_retry_op\t\t%g") \
|
||||||
restore_tmps_op,
|
f( restore_tmps_op, "restore_temps\t\t%l") \
|
||||||
restore_tmps_and_skip_op,
|
f( restore_tmps_and_skip_op, "restore_temps_and_skip\t\t%l") \
|
||||||
enter_lu_op,
|
f( enter_lu_op, "enter_lu") \
|
||||||
empty_call_op,
|
f( empty_call_op, "empty_call\t\t%l,%d") \
|
||||||
|
f( bccall_op, "binary_cfunc\t\t%v,%r,%2") \
|
||||||
|
f( blob_op, "blob\t%O") \
|
||||||
|
f( string_op, "string\t%O") \
|
||||||
|
f( label_ctl_op, "label_control\t")
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
sync_op,
|
#define mklist1(f) \
|
||||||
|
mklist0(f) \
|
||||||
|
f( sync_op, "sync")
|
||||||
|
#else
|
||||||
|
#define mklist1(f) mklist0(f)
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
table_new_answer_op,
|
#define mklist2(f) \
|
||||||
table_try_single_op,
|
mklist1(f) \
|
||||||
|
f( table_new_answer_op, "table_new_answer") \
|
||||||
|
f( table_try_single_op, "table_try_single\t%g\t%x")
|
||||||
|
#else
|
||||||
|
#define mklist2(f) mklist1(f)
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
#ifdef TABLING_INNER_CUTS
|
#ifdef TABLING_INNER_CUTS
|
||||||
clause_with_cut_op,
|
#define mklist3(f) \
|
||||||
|
mklist2(f) \
|
||||||
|
f( clause_with_cut_op, "clause_with_cut")
|
||||||
|
#else
|
||||||
|
#define mklist3(f) mklist2(f)
|
||||||
#endif /* TABLING_INNER_CUTS */
|
#endif /* TABLING_INNER_CUTS */
|
||||||
#ifdef BEAM
|
#ifdef BEAM
|
||||||
run_op,
|
#define mklist4(f) \
|
||||||
body_op,
|
mklist3(f) \
|
||||||
endgoal_op,
|
f( run_op, "run_op %1,%4") \
|
||||||
try_me_op,
|
f( body_op, "body_op %1") \
|
||||||
retry_me_op,
|
f( endgoal_op, "endgoal_op") \
|
||||||
trust_me_op,
|
f( try_me_op, "try_me_op %1,%4") \
|
||||||
only_1_clause_op,
|
f( retry_me_op, "retry_me_op %1,%4") \
|
||||||
create_first_box_op,
|
f( trust_me_op, "trust_me_op %1,%4") \
|
||||||
create_box_op,
|
f( only_1_clause_op, "only_1_clause_op %1,%4") \
|
||||||
create_last_box_op,
|
f( create_first_box_op, "create_first_box_op %1,%4") \
|
||||||
remove_box_op,
|
f( create_box_op, "create_box_op %1,%4") \
|
||||||
remove_last_box_op,
|
f( create_last_box_op, "create_last_box_op %1,%4") \
|
||||||
prepare_tries,
|
f( remove_box_op, "remove_box_op %1,%4") \
|
||||||
std_base_op,
|
f( remove_last_box_op, "remove_last_box_op %1,%4" ) \
|
||||||
direct_safe_call_op,
|
f( prepare_tries, "prepare_tries") \
|
||||||
commit_op,
|
f( std_base_op, "std_base_op %1,%4") \
|
||||||
skip_while_var_op,
|
f( direct_safe_call_op, "direct_safe_call") \
|
||||||
wait_while_var_op,
|
f( commit_op, ) \
|
||||||
force_wait_op,
|
f( skip_while_var_op, "skip_while_var_op") \
|
||||||
write_op,
|
f( wait_while_var_op, "wait_while_var_op") \
|
||||||
equal_op,
|
f( force_wait_op, "force_wait_op") \
|
||||||
exit_op,
|
f( is_op, "is_op") \
|
||||||
|
f( write_op, "write_op") \
|
||||||
|
f( equal_op, "equal_op") \
|
||||||
|
f( exit_op, "exit")
|
||||||
|
#else
|
||||||
|
#define mklist4(f) mklist3(f)
|
||||||
#endif
|
#endif
|
||||||
fetch_args_for_bccall_op,
|
|
||||||
bccall_op,
|
|
||||||
blob_op,
|
|
||||||
string_op,
|
|
||||||
label_ctl_op
|
|
||||||
#ifdef SFUNC
|
#ifdef SFUNC
|
||||||
,
|
#define mklist(f) \
|
||||||
get_s_f_op,
|
mklist4(f) \
|
||||||
put_s_f_op,
|
f( get_s_f_op, "get_s_f_op\t%f,%r") \
|
||||||
unify_s_f_op,
|
f( put_s_f_op, "put_s_f_op\t%f,%r") \
|
||||||
write_s_f_op,
|
f( unify_s_f_op, "unify_s_f_op\t%f") \
|
||||||
unify_s_var_op,
|
f( write_s_f_op, "write_s_f_op\t%f") \
|
||||||
write_s_var_op,
|
f( unify_s_var_op, "unify_s_var\t%v,%r") \
|
||||||
unify_s_val_op,
|
f( write_s_var_op, "write_s_var\t%v,%r") \
|
||||||
write_s_val_op,
|
f( unify_s_val_op, "unify_s_val\t%v,%r") \
|
||||||
unify_s_a_op,
|
f( write_s_val_op, "write_s_val\t%v,%r") \
|
||||||
write_s_a_op,
|
f( unify_s_a_op, "unify_s_a\t%a,%r") \
|
||||||
get_s_end_op,
|
f( write_s_a_op, "write_s_a\t%a,%r") \
|
||||||
put_s_end_op,
|
f( get_s_end_op, "get_s_end") \
|
||||||
unify_s_end_op,
|
f( put_s_end_op, "put_s_end") \
|
||||||
write_s_end_op,
|
f( unify_s_end_op, "unify_s_end") \
|
||||||
|
f( write_s_end_op, "write_s_end")
|
||||||
|
#else
|
||||||
|
#define mklist(f) mklist4(f)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} compiler_vm_op;
|
#define f_enum(x, y) x,
|
||||||
|
#define f_arr(x, y) y,
|
||||||
|
|
||||||
|
enum compiler_op { mklist(f_enum) };
|
||||||
|
|
||||||
|
typedef enum compiler_op compiler_vm_op;
|
||||||
|
|
||||||
|
|
||||||
typedef struct PSEUDO {
|
typedef struct PSEUDO {
|
||||||
struct PSEUDO *nextInst;
|
struct PSEUDO *nextInst;
|
||||||
@ -228,6 +253,10 @@ typedef struct PSEUDO {
|
|||||||
#define rnd2 ops.oprnd2
|
#define rnd2 ops.oprnd2
|
||||||
#define rnd3 ops.opseqt[1]
|
#define rnd3 ops.opseqt[1]
|
||||||
#define rnd4 ops.opseqt[2]
|
#define rnd4 ops.opseqt[2]
|
||||||
|
#define rnd5 ops.opseqt[3]
|
||||||
|
#define rnd6 ops.opseqt[4]
|
||||||
|
#define rnd7 ops.opseqt[5]
|
||||||
|
#define rnd8 ops.opseqt[6]
|
||||||
|
|
||||||
typedef struct VENTRY {
|
typedef struct VENTRY {
|
||||||
CELL SelfOfVE;
|
CELL SelfOfVE;
|
||||||
@ -325,8 +354,8 @@ typedef enum special_label_op_enum {
|
|||||||
#define save_appl_flag 0x10002
|
#define save_appl_flag 0x10002
|
||||||
#define save_pair_flag 0x10004
|
#define save_pair_flag 0x10004
|
||||||
#define f_flag 0x10008
|
#define f_flag 0x10008
|
||||||
#define bt1_flag 0x10010
|
#define bt_flag 0x10010
|
||||||
#define bt2_flag 0x10020
|
#define bt2_flag 0x10020 // unused
|
||||||
#define patch_b_flag 0x10040
|
#define patch_b_flag 0x10040
|
||||||
#define init_v_flag 0x10080
|
#define init_v_flag 0x10080
|
||||||
|
|
||||||
@ -340,6 +369,9 @@ yamop *Yap_assemble(int,Term,struct pred_entry *,int, struct intermediates *, U
|
|||||||
void Yap_emit(compiler_vm_op,Int,CELL, struct intermediates *);
|
void Yap_emit(compiler_vm_op,Int,CELL, struct intermediates *);
|
||||||
void Yap_emit_3ops(compiler_vm_op,CELL,CELL,CELL, struct intermediates *);
|
void Yap_emit_3ops(compiler_vm_op,CELL,CELL,CELL, struct intermediates *);
|
||||||
void Yap_emit_4ops(compiler_vm_op,CELL,CELL,CELL,CELL, struct intermediates *);
|
void Yap_emit_4ops(compiler_vm_op,CELL,CELL,CELL,CELL, struct intermediates *);
|
||||||
|
void Yap_emit_5ops(compiler_vm_op,CELL,CELL,CELL,CELL,CELL, struct intermediates *);
|
||||||
|
void Yap_emit_6ops(compiler_vm_op,CELL,CELL,CELL,CELL,CELL,CELL, struct intermediates *);
|
||||||
|
void Yap_emit_7ops(compiler_vm_op,CELL,CELL,CELL,CELL,CELL,CELL,CELL, struct intermediates *);
|
||||||
CELL *Yap_emit_extra_size(compiler_vm_op,CELL,int, struct intermediates *);
|
CELL *Yap_emit_extra_size(compiler_vm_op,CELL,int, struct intermediates *);
|
||||||
char *Yap_AllocCMem(UInt, struct intermediates *);
|
char *Yap_AllocCMem(UInt, struct intermediates *);
|
||||||
void Yap_ReleaseCMem(struct intermediates *);
|
void Yap_ReleaseCMem(struct intermediates *);
|
||||||
|
Reference in New Issue
Block a user