diff --git a/C/absmi.c b/C/absmi.c index c2e94a374..a028faca1 100755 --- a/C/absmi.c +++ b/C/absmi.c @@ -526,8 +526,8 @@ static int interrupt_execute(USES_REGS1) { } if (PP) UNLOCKPE(1, PP); - PP = P->y_u.pp.p0; - if ((P->y_u.pp.p->PredFlags & (NoTracePredFlag | HiddenPredFlag)) && + PP = P->y_u.Osbpp.p0; + if ((P->y_u.Osbpp.p->PredFlags & (NoTracePredFlag | HiddenPredFlag)) && Yap_only_has_signal(YAP_CREEP_SIGNAL)) { return 2; } @@ -535,11 +535,11 @@ static int interrupt_execute(USES_REGS1) { if ((v = code_overflow(YENV PASS_REGS)) >= 0) { return v; } - if ((v = stack_overflow(P->y_u.pp.p, ENV, CP, - P->y_u.pp.p->ArityOfPE PASS_REGS)) >= 0) { + if ((v = stack_overflow(P->y_u.Osbpp.p, ENV, CP, + P->y_u.Osbpp.p->ArityOfPE PASS_REGS)) >= 0) { return v; } - return interrupt_handler(P->y_u.pp.p PASS_REGS); + return interrupt_handler(P->y_u.Osbpp.p PASS_REGS); } static int interrupt_call(USES_REGS1) { @@ -864,8 +864,8 @@ static int interrupt_dexecute(USES_REGS1) { #endif if (PP) UNLOCKPE(1, PP); - PP = P->y_u.pp.p0; - pe = P->y_u.pp.p; + PP = P->y_u.Osbpp.p0; + pe = P->y_u.Osbpp.p; if ((pe->PredFlags & (NoTracePredFlag | HiddenPredFlag)) && Yap_only_has_signal(YAP_CREEP_SIGNAL)) { return 2; @@ -877,8 +877,8 @@ static int interrupt_dexecute(USES_REGS1) { if ((v = code_overflow(YENV PASS_REGS)) >= 0) { return v; } - if ((v = stack_overflow(P->y_u.pp.p, (CELL *)YENV[E_E], (yamop *)YENV[E_CP], - P->y_u.pp.p->ArityOfPE PASS_REGS)) >= 0) { + if ((v = stack_overflow(P->y_u.Osbpp.p, (CELL *)YENV[E_E], (yamop *)YENV[E_CP], + P->y_u.Osbpp.p->ArityOfPE PASS_REGS)) >= 0) { return v; } /* first, deallocate */ diff --git a/C/amasm.c b/C/amasm.c index ca67e65af..076c908f0 100755 --- a/C/amasm.c +++ b/C/amasm.c @@ -1434,10 +1434,12 @@ a_p(op_numbers opcode, clause_info *clinfo, yamop *code_p, int pass_no, if (Flags & CPredFlag) { code_p->opc = emit_op(_execute_cpred); } - code_p->y_u.pp.p = RepPredProp(fe); - code_p->y_u.pp.p0 = clinfo->CurrentPred; + code_p->y_u.Osbpp.p = RepPredProp(fe); + code_p->y_u.Osbpp.p0 = clinfo->CurrentPred; + code_p->y_u.Osbpp.s = 0; + code_p->y_u.Osbpp.bmap = NULL; } - GONEXT(pp); + GONEXT(Osbpp); } else { if (pass_no) code_p->y_u.p.p = RepPredProp(fe); @@ -3901,7 +3903,7 @@ yamop *Yap_InitCommaContinuation(PredEntry *pe) { GONEXT(Osbmp); for (i = 0; i < arity; i++) GONEXT(yx); - GONEXT(pp); + GONEXT(Osbmp); pe->MetaEntryOfPred = code_p = Yap_AllocCodeSpace((size_t)code_p); code_p->opc = opcode(_call); @@ -3917,8 +3919,8 @@ Yap_AllocCodeSpace((size_t)code_p); GONEXT(yx); } code_p->opc = opcode(_dexecute); - code_p->y_u.pp.p0 = PredMetaCall; - code_p->y_u.pp.p = pe; - GONEXT(pp); + code_p->y_u.Osbpp.p0 = PredMetaCall; + code_p->y_u.Osbpp.p = pe; + GONEXT(Osbpp); return pe->MetaEntryOfPred; } diff --git a/C/control_absmi_insts.h b/C/control_absmi_insts.h index ba532782d..29dbfcdcf 100644 --- a/C/control_absmi_insts.h +++ b/C/control_absmi_insts.h @@ -194,18 +194,18 @@ /* Macros for stack trimming */ /* execute Label */ - BOp(execute, pp); + BOp(execute, Osbpp); { PredEntry *pt0; CACHE_Y_AS_ENV(YREG); - pt0 = PREG->y_u.pp.p; + pt0 = PREG->y_u.Osbpp.p; #ifndef NO_CHECKING check_stack(NoStackExecute, HR); goto skip_do_execute; #endif do_execute: FETCH_Y_FROM_ENV(YREG); - pt0 = PREG->y_u.pp.p; + pt0 = PREG->y_u.Osbpp.p; skip_do_execute: #ifdef LOW_LEVEL_TRACER if (Yap_do_low_level_trace) { @@ -244,17 +244,17 @@ /* dexecute Label */ /* joint deallocate and execute */ - BOp(dexecute, pp); + BOp(dexecute, Osbpp); #ifdef LOW_LEVEL_TRACER if (Yap_do_low_level_trace) - low_level_trace(enter_pred,PREG->y_u.pp.p,XREGS+1); + low_level_trace(enter_pred,PREG->y_u.Osbpp.p,XREGS+1); #endif /* LOW_LEVEL_TRACER */ CACHE_Y_AS_ENV(YREG); { PredEntry *pt0; CACHE_A1(); - pt0 = PREG->y_u.pp.p; + pt0 = PREG->y_u.Osbpp.p; #ifndef NO_CHECKING /* check stacks */ check_stack(NoStackDExecute, HR); @@ -262,7 +262,7 @@ #endif continue_dexecute: FETCH_Y_FROM_ENV(YREG); - pt0 = PREG->y_u.pp.p; + pt0 = PREG->y_u.Osbpp.p; skip_dexecute: #ifdef DEPTH_LIMIT if (DEPTH <= MkIntTerm(1)) {/* I assume Module==0 is primitives */ diff --git a/C/errors.c b/C/errors.c index 766ed7558..9fdee843b 100755 --- a/C/errors.c +++ b/C/errors.c @@ -130,14 +130,27 @@ bool Yap_HandleError__(const char *file, const char *function, int lineno, yap_error_number err = LOCAL_Error_TYPE; const char *serr; + arity_t arity = 2; + if (LOCAL_ErrorMessage) { serr = LOCAL_ErrorMessage; } else { serr = s; } + if (P->opc == Yap_opcode(_try_c) || + P->opc == Yap_opcode(_try_userc) || + P->opc == Yap_opcode(_retry_c) || + P->opc == Yap_opcode(_retry_userc)) { + + arity = P->y_u.OtapFs.p->ArityOfPE; + } else { + arity = PREVOP(P,Osbpp)->y_u.Osbpp.p->ArityOfPE; + } + + switch (err) { case RESOURCE_ERROR_STACK: - if (!Yap_gc(2, ENV, gc_P(P, CP))) { + if (!Yap_gc(arity, ENV, gc_P(P, CP))) { Yap_Error__(file, function, lineno, RESOURCE_ERROR_STACK, ARG1, serr); return false; } diff --git a/C/fli_absmi_insts.h b/C/fli_absmi_insts.h index 8d4a3e0f0..4b95f9a85 100644 --- a/C/fli_absmi_insts.h +++ b/C/fli_absmi_insts.h @@ -74,7 +74,7 @@ ENDBOp(); /* execute Label */ - BOp(execute_cpred, pp); + BOp(execute_cpred, Osbpp); check_trail(TR); { PredEntry *pt0; @@ -103,7 +103,7 @@ SET_ASP(YREG, E_CB * sizeof(CELL)); /* for slots to work */ #endif /* FROZEN_STACKS */ - pt0 = PREG->y_u.pp.p; + pt0 = PREG->y_u.Osbpp.p; #ifdef LOW_LEVEL_TRACER if (Yap_do_low_level_trace) { low_level_trace(enter_pred, pt0, XREGS + 1); @@ -131,7 +131,7 @@ #endif /* DEPTH_LIMIT */ /* now call C-Code */ { - CPredicate f = PREG->y_u.pp.p->cs.f_code; + CPredicate f = PREG->y_u.Osbpp.p->cs.f_code; yamop *oldPREG = PREG; saveregs(); d0 = f(PASS_REGS1); diff --git a/C/gprof.c b/C/gprof.c index 2e7d74758..3a8b64dec 100755 --- a/C/gprof.c +++ b/C/gprof.c @@ -973,7 +973,7 @@ prof_alrm(int signo, siginfo_t *si, void *scv) current_p = PREVOP(P,Osbpp)->y_u.Osbpp.p->CodeOfPred; } else if ((oop = Yap_op_from_opcode(P->opc)) == _execute_cpred) { /* doing C-code */ - current_p = P->y_u.pp.p->CodeOfPred; + current_p = P->y_u.Osbpp.p->CodeOfPred; } else { current_p = P; } diff --git a/C/stack.c b/C/stack.c index 497b539b2..f320b69f6 100644 --- a/C/stack.c +++ b/C/stack.c @@ -789,9 +789,9 @@ static PredEntry *found_ystop(yamop *pc, int clause_code, void **startp, void ** return pp; } if (!pp) { - yamop *o = PREVOP(pc,pp); + yamop *o = PREVOP(pc,Osbpp); if (o->opc ==Yap_opcode(_execute_cpred)) { - pp = o->y_u.pp.p0; + pp = o->y_u.Osbpp.p0; } else { /* must be an index */ PredEntry **pep = (PredEntry **)pc->y_u.l.l; diff --git a/H/YapCompile.h b/H/YapCompile.h index 520ef48f7..9ce8f27ba 100644 --- a/H/YapCompile.h +++ b/H/YapCompile.h @@ -1,305 +1,245 @@ /************************************************************************* -* * -* YAP Prolog %W% %G% * -* * -* Yap Prolog was developed at NCCUP - Universidade do Porto * -* * -* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 * -* * +* * +* YAP Prolog %W% %G% * +* * +*Yap Prolog was developed at NCCUP - Universidade do Porto * +* * +* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 * +* * ************************************************************************** -* * -* File: YapCompile.h * -* Last rev: * -* mods: * -* comments: compiler data structures and routines * -* * +* * +* File:YapCompile.h * +* Last rev: * +* mods: * +* comments:compiler data structures and routines * +* * *************************************************************************/ /* consult stack management */ -/* virtual machine instruction op-codes */ -#define mklist0(f) \ - f(nop_op, "nop") f(get_var_op, "get_var\t\t%v,%r") f(put_var_op, "put_" \ - "var\t\t%" \ - "v,%r") f( \ - get_val_op, "get_val\t\t%v,%r") f(put_val_op, \ - "put_val\t\t%v,%r") f(get_atom_op, \ - "get_atom\t%a,%" \ - "r") f(put_atom_op, \ - "put_" \ - "atom\t%" \ - "a,%r") \ - f(get_num_op, "get_num\t\t%n,%r") f(put_num_op, "put_num\t\t%n,%r") f( \ - get_float_op, \ - "get_float\t\t%w,%r") f(put_float_op, \ - "put_float\t\t%w,%r") f(get_dbterm_op, \ - "get_dbterm\t%w,%r") \ - f(put_dbterm_op, "put_dbterm\t%w,%r") f(get_longint_op, "get_" \ - "longint\t" \ - "\t%w,%r") f( \ - put_longint_op, \ - "put_longint\t\t%w,%r") f(get_string_op, \ - "get_string\t\t%w,%S") f(put_string_op, \ - "put_" \ - "string\t\t%" \ - "w,%S") \ - f(get_bigint_op, "get_bigint\t\t%l,%r") f(put_bigint_op, "put_" \ - "bigin" \ - "t\t\t" \ - "%l,%" \ - "r") f( \ - get_list_op, \ - "get_list\t%r") f(put_list_op, \ - "put_list\t%r") f(get_struct_op, \ - "get_struct\t%f,%r") \ - f(put_struct_op, "put_struct\t%f,%r") f(put_unsafe_op, "put" \ - "_un" \ - "saf" \ - "e\t" \ - "%v," \ - "%r") f( \ - unify_var_op, \ - "unify_var\t%v") f(write_var_op, \ - "write_var\t%v") f(unify_val_op, \ - "unify_val\t%v") \ - f(write_val_op, "write_val\t%v") f(unify_atom_op, "unif" \ - "y_" \ - "atom" \ - "\t%" \ - "a") f( \ - write_atom_op, \ - "write_atom\t%a") f(unify_num_op, \ - "unify_num\t%n") f(write_num_op, \ - "write_" \ - "num\t%n") \ - f(unify_float_op, "unify_float\t%w") f( \ - write_float_op, \ - "write_float\t%w") f(unify_dbterm_op, \ - "unify_dbterm\t%w") \ - f(write_dbterm_op, "write_dbterm\t%w") f( \ - unify_longint_op, \ - "unify_longint\t%w") f(write_longint_op, \ - "write_longint\t%w") \ - f(unify_string_op, "unify_string\t%S") f( \ - write_string_op, \ - "write_string\t%S") f(unify_bigint_op, \ - "unify_bigint\t%" \ - "l") f(write_bigint_op, \ - "write_" \ - "bigint\t%" \ - "l") \ - f(unify_list_op, "unify_list") f( \ - write_list_op, \ - "write_list") f(unify_struct_op, \ - "unify_struct\t%f") \ - f(write_struct_op, "write_struct\t%" \ - "f") f( \ - write_unsafe_op, \ - "write_unsafe\t%v") f(unify_local_op, \ - "unify_" \ - "local\t%" \ - "v") \ - f(write_local_op, "write " \ - "local\t%v") f( \ - unify_last_list_op, \ - "unify_last_list") \ - f(write_last_list_op, "writ" \ - "e_" \ - "last" \ - "_lis" \ - "t") f( \ - unify_last_struct_op, \ - "unify_last_struct\t%f") \ - f(write_last_struct_op, \ - "write_last_struct\t%" \ - "f") f(unify_last_var_op, \ - "unify_last_" \ - "var\t%v") \ - f( \ - unify_last_val_op, \ - "unify_last_" \ - "val\t%v") f(unify_last_local_op, \ - "u" \ - "n" \ - "i" \ - "f" \ - "y" \ - "_" \ - "l" \ - "a" \ - "s" \ - "t" \ - "_" \ - "l" \ - "o" \ - "c" \ - "a" \ - "l" \ - "\t%v") f(unify_last_atom_op, \ - "unify_last_atom\t%a") f(unify_last_num_op, "unify_last_num\t%n") f(unify_last_float_op, "unify_last_float\t%w") f(unify_last_dbterm_op, "unify_last_dbterm\t%w") f(unify_last_longint_op, "unify_last_longint\t%w") f(unify_last_string_op, "unify_last_string\t%S") f(unify_last_bigint_op, "unify_last_bigint\t%l") f(ensure_space_op, \ - "ensure_space") f(native_op, \ - "native_code") f(f_var_op, "function_to_var\t%v,%B") f(f_val_op, "function_to_val\t%v,%B") f(f_0_op, "function_to_0\t%B") f(align_float_op, \ - "align_float") f(fail_op, "fail") f(cut_op, "cut") f(cutexit_op, \ - "cutexit") f(allocate_op, \ - "allocate") f(deallocate_op, \ - "deallocate") f(tryme_op, \ - "try_me_else\t\t%l\t%x") f(jump_op, \ - "jump\t\t%l") f(jumpi_op, \ - "jump_in_indexing\t\t%i") f(procceed_op, "proceed") f(call_op, "call\t\t%p,%d,%z") f(execute_op, "execute\t\t%p") f(safe_call_op, "sys\t\t%p") f(label_op, \ - "%l:") f(name_op, "name\t\t%m,%d") f(pop_op, \ - "pop\t\t%l") f(retryme_op, \ - "retry_me_else\t\t%l\t%x") f(trustme_op, \ - "trust_me_else_fail\t%x") f(either_op, "either_me\t\t%l,%d,%z") f(orelse_op, "or_else\t\t%l,%z") f(orlast_op, \ - "or_last") f(push_or_op, "push_or") f(pushpop_or_op, "pushpop_or") f(pop_or_op, "pop_or") f(save_b_op, "save_by\t\t%v") f(commit_b_op, \ - "commit_by\t\t%v") f(patch_b_op, "patch_by\t\t%v") f(try_op, \ - "try\t\t%g\t%x") f(retry_op, "retry\t\t%g\t%x") f(trust_op, \ - "trust\t\t%g\t%x") f(try_in_op, \ - "try_in\t\t%g\t%x") f(jump_v_op, \ - "jump_if_var\t\t%g") f(jump_nv_op, "jump_if_nonvar\t\t%g") f(cache_arg_op, "cache_arg\t%r") f(cache_sub_arg_op, "cache_sub_arg\t%d") f(user_switch_op, \ - "user_switch") f(switch_on_type_op, "switch_on_type\t%h\t%h\t%h\t%h") f(switch_c_op, \ - "switch_on_constant\t%i\n%c") f(if_c_op, \ - "if_constant\t%i\n%c") f(switch_f_op, \ - "switch_on_functor\t%i\n%e") f(if_f_op, "if_functor\t%i\n%e") f(if_not_op, "if_not_then\t%i\t%h\t%h\t%h") \ - f(index_dbref_op, \ - "index_on_" \ - "dbref") f(index_blob_op, \ - "i" \ - "n" \ - "d" \ - "e" \ - "x" \ - "_" \ - "o" \ - "n" \ - "_" \ - "b" \ - "l" \ - "o" \ - "b") f(index_string_op, "index_on_string") \ - f(index_long_op, "index_on_blob") f( \ - if_nonvar_op, \ - "check_" \ - "var\t " \ - "%r") f(save_pair_op, "save_pair\t%v") \ - f(save_appl_op, "save_appl\t%v") f( \ - mark_initialized_pvars_op, \ - "pv" \ - "ar" \ - "_b" \ - "it" \ - "ma" \ - "p" \ - "\t" \ - "%l" \ - ",%" \ - "b") f(mark_live_regs_op, \ - "pvar_live_regs\t%l,%b") \ - f(fetch_args_vv_op, "fetch_reg1_reg2\t%N,%N") f( \ - fetch_args_cv_op, \ - "fetch_constant_reg\t%l,%N") f(fetch_args_vc_op, \ - "fetch_reg_constant\t%l,%N") \ - f(fetch_args_iv_op, "fetch_integer_reg\t%d,%N") f( \ - fetch_args_vi_op, \ - "fetch_reg_integer\t%d,%N") f(enter_profiling_op, \ - "enter_profiling\t\t%g") \ - f(retry_profiled_op, "retry_profiled\t\t%g") f( \ - count_call_op, \ - "count_call_op\t\t%g") f(count_retry_op, \ - "count_retry_op\t\t%g") \ - f(restore_tmps_op, "restore_temps\t\t%l") f( \ - restore_tmps_and_skip_op, \ - "restore_temps_and_skip\t\t%l") \ - f(enter_lu_op, "enter_lu") 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 -#define mklist1(f) mklist0(f) f(sync_op, "sync") +#undef COMPILER_OPS +#undef COMPILER_OPS_END +#undef f + +#ifdef COMPILER_NAMES + +#define COMPILER_OPS() char *opDesc[] = +#define COMPILER_OPS_END() +#define f(x,y) y + #else -#define mklist1(f) mklist0(f) + +#define COMPILER_OPS() typedef enum compiler_op +#define COMPILER_OPS_END() compiler_vm_op +#define f(x,y) x + +#endif + +/* virtual machine instruction op-codes*/ +COMPILER_OPS() { + f(nop_op, "nop"), + f(get_var_op, "get_var\t\t %v,%r"), + f(put_var_op, "put_var\t\t %v,%r"), + f( get_val_op, "get_val\t\t %v,%r"), + f(put_val_op, "put_val\t\t %v,%r"), + f(get_atom_op, "get_atom\t %a,%r"), + f(put_atom_op, "put_atom\t %a,%r"), + f(get_num_op, "get_num\t\t %n,%r"), + f(put_num_op, "put_num\t\t %n,%r"), + f( get_float_op, "get_float\t\t %w,%r"), + f(put_float_op, "put_float\t\t %w,%r"), + f(get_dbterm_op, "get_dbterm\t %w,%r"), + f(put_dbterm_op, "put_dbterm\t %w,%r"), + f(get_longint_op, "get_longint\t\t %w,%r"), + f( put_longint_op, "put_longint\t\t %w,%r"), + f(get_string_op, "get_string\t\t %w,%S"), + f(put_string_op, "put_string\t\t %w,%S"), + f(get_bigint_op, "get_bigint\t\t %l,%r"), + f(put_bigint_op, "put_bigint\t\t %l,%r"), + f( get_list_op, "get_list\t %r"), + f(put_list_op, "put_list\t %r"), + f(get_struct_op, "get_struct\t %f,%r"), + f(put_struct_op, "put_struct\t %f,%r"), + f(put_unsafe_op, "put_unsafe\t %v,%r"), + f( unify_var_op, "unify_var\t %v"), + f(write_var_op, "write_var\t %v"), + f(unify_val_op, "unify_val\t %v"), + f(write_val_op, "write_val\t %v"), + f(unify_atom_op, "unify_atom\t %a"), + f( write_atom_op, "write_atom\t %a"), + f(unify_num_op, "unify_num\t %n"), + f(write_num_op, "write_num\t %n"), + f(unify_float_op, "unify_float\t %w"), + f( write_float_op, "write_float\t %w"), + f(unify_dbterm_op, "unify_dbterm\t %w"), + f(write_dbterm_op, "write_dbterm\t %w"), + f( unify_longint_op, "unify_longint\t %w"), + f(write_longint_op, "write_longint\t %w"), + f(unify_string_op, "unify_string\t %S"), + f( write_string_op, "write_string\t %S"), + f(unify_bigint_op, "unify_bigint\t %l"), + f(write_bigint_op, "write_bigint\t %l"), + f(unify_list_op, "unify_list"), + f( write_list_op, "write_list"), + f(unify_struct_op, "unify_struct\t %f"), + f(write_struct_op, "write_struct\t %f"), + f( write_unsafe_op, "write_unsafe\t %v"), + f(unify_local_op, "unify_local\t %v"), + f(write_local_op, "write local\t %v"), + f( unify_last_list_op, "unify_last_list"), + f(write_last_list_op, "write_last_list"), + f( unify_last_struct_op, "unify_last_struct\t %f"), + f(write_last_struct_op, "write_last_struct\t %f"), + f(unify_last_var_op, "unify_last_var\t %v"), + f( unify_last_val_op, "unify_last_val\t %v"), + f(unify_last_local_op, "unify_last_local\t %v"), + f(unify_last_atom_op, "unify_last_atom\t %a"), + f(unify_last_num_op, "unify_last_num\t %n"), + f(unify_last_float_op, "unify_last_float\t %w"), + f(unify_last_dbterm_op, "unify_last_dbterm\t %w"), + f(unify_last_longint_op, "unify_last_longint\t %w"), + f(unify_last_string_op, "unify_last_string\t %S"), + f(unify_last_bigint_op, "unify_last_bigint\t %l"), + f(ensure_space_op, "ensure_space"), + f(native_op, "native_code"), + f(f_var_op, "function_to_var\t %v,%B"), + f(f_val_op, "function_to_val\t %v,%B"), + f(f_0_op, "function_to_0\t %B"), + f(align_float_op, "align_float"), + f(fail_op, "fail"), + f(cut_op, "cut"), + f(cutexit_op, "cutexit"), + f(allocate_op, "allocate"), + f(deallocate_op, "deallocate"), + f(tryme_op, "try_me_else\t\t %l\t %x"), + f(jump_op, "jump\t\t %l"), + f(jumpi_op, "jump_in_indexing\t\t %i"), + f(procceed_op, "proceed"), + f(call_op, "call\t\t %p,%d,%z"), + f(execute_op, "execute\t\t %p"), + f(safe_call_op, "sys\t\t %p"), + f(label_op, "%l:"), + f(name_op, "name\t\t %m,%d"), + f(pop_op, "pop\t\t %l"), + f(retryme_op, "retry_me_else\t\t %l\t %x"), + f(trustme_op, "trust_me_else_fail\t %x"), + f(either_op, "either_me\t\t %l,%d,%z"), + f(orelse_op, "or_else\t\t %l,%z"), + f(orlast_op, "or_last"), + f(push_or_op, "push_or"), + f(pushpop_or_op, "pushpop_or"), + f(pop_or_op, "pop_or"), + f(save_b_op, "save_by\t\t %v"), + f(commit_b_op, "commit_by\t\t %v"), + f(patch_b_op, "patch_by\t\t %v"), + f(try_op, "try\t\t %g\t %x"), + f(retry_op, "retry\t\t %g\t %x"), + f(trust_op, "trust\t\t %g\t %x"), + f(try_in_op, "try_in\t\t %g\t %x"), + f(jump_v_op, "jump_if_var\t\t %g"), + f(jump_nv_op, "jump_if_nonvar\t\t %g"), + f(cache_arg_op, "cache_arg\t %r"), + f(cache_sub_arg_op, "cache_sub_arg\t %d"), + f(user_switch_op, "user_switch"), + f(switch_on_type_op, "switch_on_type\t %h\t %h\t %h\t %h"), + f(switch_c_op, "switch_on_constant\t %i,n%c"), + f(if_c_op, "if_constant\t %i,n%c"), + f(switch_f_op, "switch_on_functor\t %i,n%e"), + f(if_f_op, "if_functor\t %i,n%e"), + f(if_not_op, "if_not_then\t %i\t %h\t %h\t %h"), + f(index_dbref_op, "index_on_dbref"), + f(index_blob_op, "index_on_blob"), + f(index_string_op, "index_on_string"), + f(index_long_op, "index_on_blob"), + f( if_nonvar_op, "check_var\t %r"), + f(save_pair_op, "save_pair\t %v"), + f(save_appl_op, "save_appl\t %v"), + f( mark_initialized_pvars_op, "pvar_bitmap\t %l,%b"), + f(mark_live_regs_op, "pvar_live_regs\t %l,%b"), + f(fetch_args_vv_op, "fetch_reg1_reg2\t %N,%N"), + f( fetch_args_cv_op, "fetch_constant_reg\t %l,%N"), + f(fetch_args_vc_op, "fetch_reg_constant\t %l,%N"), + f(fetch_args_iv_op, "fetch_integer_reg\t %d,%N"), + f( fetch_args_vi_op, "fetch_reg_integer\t %d,%N"), + f(enter_profiling_op, "enter_profiling\t\t %g"), + f(retry_profiled_op, "retry_profiled\t\t %g"), + f( count_call_op, "count_call_op\t\t %g"), + f(count_retry_op, "count_retry_op\t\t %g"), + f(restore_tmps_op, "restore_temps\t\t %l"), + f( restore_tmps_and_skip_op, "restore_temps_and_skip\t\t %l"), + f(enter_lu_op, "enter_lu"), + 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 + f(sync_op, "sync"), #endif /* YAPOR */ #ifdef TABLING -#define mklist2(f) \ - 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 */ + f(table_new_answer_op, "table_new_answer"), + f(table_try_single_op, "table_try_single\t %g\t %x"), #ifdef TABLING_INNER_CUTS -#define mklist3(f) mklist2(f) f(clause_with_cut_op, "clause_with_cut") -#else -#define mklist3(f) mklist2(f) + f(clause_with_cut_op, "clause_with_cut"), #endif /* TABLING_INNER_CUTS */ + #endif #ifdef BEAM -#define mklist4(f) \ - mklist3(f) f(run_op, "run_op %1,%4") f(body_op, "body_op %1") f( \ - endgoal_op, "endgoal_op") f(try_me_op, "try_me_op %1,%4") \ - f(retry_me_op, "retry_me_op %1,%4") f(trust_me_op, "trust_me_op %1,%4") \ - f(only_1_clause_op, "only_1_clause_op %1,%4") f( \ - create_first_box_op, "create_first_box_op %1,%4") \ - f(create_box_op, "create_box_op %1,%4") f( \ - create_last_box_op, "create_last_box_op %1,%4") \ - f(remove_box_op, "remove_box_op %1,%4") f( \ - remove_last_box_op, "remove_last_box_op %1,%4") \ - f(prepare_tries, "prepare_tries") f(std_base_op, \ - "std_base_op %1,%4") \ - f(direct_safe_call_op, "direct_safe_call") \ - f(commit_op, ) f(skip_while_var_op, \ - "skip_while_var_op") \ - f(wait_while_var_op, "wait_while_var_op") \ - f(force_wait_op, "force_wait_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) + f(run_op, "run_op %1,%4"), + f(body_op, "body_op %1"), + f( endgoal_op, "endgoal_op"), + f(try_me_op, "try_me_op %1,%4"), + f(retry_me_op, "retry_me_op %1,%4"), + f(trust_me_op, "trust_me_op %1,%4"), + f(only_1_clause_op, "only_1_clause_op %1,%4"), + f( create_first_box_op, "create_first_box_op %1,%4"), + f(create_box_op, "create_box_op %1,%4"), + f( create_last_box_op, "create_last_box_op %1,%4"), + f(remove_box_op, "remove_box_op %1,%4"), + f( remove_last_box_op, "remove_last_box_op %1,%4"), + f(prepare_tries, "prepare_tries"), + f(std_base_op, "std_base_op %1,%4"), + f(direct_safe_call_op, "direct_safe_call"), + f(commit_op, ), + f(skip_while_var_op, "skip_while_var_op"), + f(wait_while_var_op, "wait_while_var_op"), + f(force_wait_op, "force_wait_op"), + f(is_op, "is_op"), + f(write_op, "write_op"), + f(equal_op, "equal_op"), + f(exit_op, "exit"), #endif #ifdef SFUNC -#define mklist(f) \ - mklist4(f) f(get_s_f_op, "get_s_f_op\t%f,%r") \ - f(put_s_f_op, "put_s_f_op\t%f,%r") f(unify_s_f_op, "unify_s_f_op\t%f") \ - f(write_s_f_op, "write_s_f_op\t%f") \ - f(unify_s_var_op, "unify_s_var\t%v,%r") f(write_s_var_op, \ - "write_s_var\t%v,%r") \ - f(unify_s_val_op, "unify_s_val\t%v,%r") \ - f(write_s_val_op, "write_s_val\t%v,%r") \ - f(unify_s_a_op, "unify_s_a\t%a,%r") \ - f(write_s_a_op, "write_s_a\t%a,%r") \ - f(get_s_end_op, "get_s_end") \ - f(put_s_end_op, "put_s_end") \ - f(unify_s_end_op, "unify_s_end") \ - f(write_s_end_op, "write_s_end") -#else -#define mklist(f) mklist4(f) + f(get_s_f_op, "get_s_f_op\t %f,%r"), + f(put_s_f_op, "put_s_f_op\t %f,%r"), + f(unify_s_f_op, "unify_s_f_op\t %f"), + f(write_s_f_op, "write_s_f_op\t %f"), + f(unify_s_var_op, "unify_s_var\t %v,%r"), + f(write_s_var_op, "write_s_var\t %v,%r"), + f(unify_s_val_op, "unify_s_val\t %v,%r"), + f(write_s_val_op, "write_s_val\t %v,%r"), + f(unify_s_a_op, "unify_s_a\t %a,%r"), + f(write_s_a_op, "write_s_a\t %a,%r"), + f(get_s_end_op, "get_s_end"), + f(put_s_end_op, "put_s_end"), + f(unify_s_end_op, "unify_s_end"), + f(write_s_end_op, "write_s_end"), #endif + } COMPILER_OPS_END(); -#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; +#ifndef COMPILER_NAMES typedef struct PSEUDO { - struct PSEUDO *nextInst; - enum compiler_op op; - CELL rnd1; - union { - Int oprnd2; + struct PSEUDO *nextInst; + enum compiler_op op; + CELL rnd1; + union { + Int oprnd2; #if MIN_ARRAY == 0 - CELL opseqt[MIN_ARRAY]; + CELL opseqt[MIN_ARRAY]; #else - CELL opseqt[1]; + CELL opseqt[1]; #endif - } ops; + } ops; } PInstr; #define arnds ops.opseqt @@ -312,26 +252,26 @@ typedef struct PSEUDO { #define rnd8 ops.opseqt[6] typedef struct VENTRY { - CELL SelfOfVE; - Term AdrsOfVE; - Int KindOfVE; - CELL NoOfVE; - PInstr *FirstOpForV; - PInstr *LastOpForV; - BITS16 AgeOfVE; - BITS16 BranchOfVE; - BITS16 LastBranchOfVE; - BITS16 FirstOfVE; - BITS16 RCountOfVE; - BITS16 FlagsOfVE; - struct VENTRY *NextOfVE; + CELL SelfOfVE; + Term AdrsOfVE; + Int KindOfVE; + CELL NoOfVE; + PInstr *FirstOpForV; + PInstr *LastOpForV; + BITS16 AgeOfVE; + BITS16 BranchOfVE; + BITS16 LastBranchOfVE; + BITS16 FirstOfVE; + BITS16 RCountOfVE; + BITS16 FlagsOfVE; + struct VENTRY *NextOfVE; } Ventry; typedef struct CEXPENTRY { - Term TermOfCE; - PInstr *CodeOfCE; - Term VarOfCE; - struct CEXPENTRY *NextCE; + Term TermOfCE; + PInstr *CodeOfCE; + Term VarOfCE; + struct CEXPENTRY *NextCE; } CExpEntry; #define COMPILER_ERR_BOTCH 1 @@ -342,48 +282,48 @@ typedef struct CEXPENTRY { #define OUT_OF_TRAIL_BOTCH 6 typedef struct intermediates { - char *freep; - char *freep0; - struct mem_blk *blks; - char *blk_cur, *blk_top; - struct PSEUDO *cpc; - struct PSEUDO *CodeStart; - struct PSEUDO *icpc; - struct PSEUDO *BlobsStart; - struct dbterm_list *dbterml; - Int *label_offset; - Int *uses; - Term *contents; - struct pred_entry *CurrentPred; - sigjmp_buf CompilerBotch; - yamop *code_addr; - yamop *expand_block; - UInt i_labelno; - UInt exception_handler, success_handler, failure_handler; - /* for expanding code */ - yamop **current_try_lab, **current_trust_lab; - yamop *try_instructions; - struct StructClauseDef *cls; - int clause_has_cut; - UInt term_depth, last_index_at_depth; - UInt last_index_new_depth, last_depth_size; - /* for expanding code */ - union { - struct static_index *si; - struct logic_upd_index *lui; - } current_cl; + char *freep; + char *freep0; + struct mem_blk *blks; + char *blk_cur, *blk_top; + struct PSEUDO *cpc; + struct PSEUDO *CodeStart; + struct PSEUDO *icpc; + struct PSEUDO *BlobsStart; + struct dbterm_list *dbterml; + Int *label_offset; + Int *uses; + Term *contents; + struct pred_entry *CurrentPred; + sigjmp_buf CompilerBotch; + yamop *code_addr; + yamop *expand_block; + UInt i_labelno; + UInt exception_handler, success_handler, failure_handler; + /* for expanding code */ + yamop **current_try_lab, **current_trust_lab; + yamop *try_instructions; + struct StructClauseDef *cls; + int clause_has_cut; + UInt term_depth, last_index_at_depth; + UInt last_index_new_depth, last_depth_size; + /* for expanding code */ + union { + struct static_index *si; + struct logic_upd_index *lui; + } current_cl; } CIntermediates; typedef enum special_label_id_enum { - SPECIAL_LABEL_SUCCESS = 0, - SPECIAL_LABEL_FAILURE = 1, - SPECIAL_LABEL_EXCEPTION = 2 + SPECIAL_LABEL_SUCCESS = 0, + SPECIAL_LABEL_FAILURE = 1, + SPECIAL_LABEL_EXCEPTION = 2 } special_label_id; typedef enum special_label_op_enum { - SPECIAL_LABEL_INIT = 0, - SPECIAL_LABEL_SET = 1, - SPECIAL_LABEL_CLEAR = 2 + SPECIAL_LABEL_INIT = 0, + SPECIAL_LABEL_SET = 1, + SPECIAL_LABEL_CLEAR = 2 } special_label_op; #define SafeVar 0x01 @@ -415,23 +355,20 @@ typedef enum special_label_op_enum { #define One 1 #define Two 2 -extern yamop *Yap_assemble(int, Term, struct pred_entry *, int, - struct intermediates *, UInt); -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_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 *); -char *Yap_AllocCMem(UInt, struct intermediates *); -void Yap_ReleaseCMem(struct intermediates *); -int Yap_is_a_test_pred(Term, Term); -void Yap_bip_name(Int, char *); +extern yamop *Yap_assemble(int, Term, struct pred_entry *, int, struct intermediates *, UInt); +extern void Yap_emit(compiler_vm_op, Int, CELL, struct intermediates *); +extern void Yap_emit_3ops(compiler_vm_op, CELL, CELL, CELL, struct intermediates *); +extern void Yap_emit_4ops(compiler_vm_op, CELL, CELL, CELL, CELL, struct intermediates *); +extern void Yap_emit_5ops(compiler_vm_op, CELL, CELL, CELL, CELL, CELL,struct intermediates *); +extern void Yap_emit_6ops(compiler_vm_op, CELL, CELL, CELL, CELL, CELL, CELL,struct intermediates *); +extern void Yap_emit_7ops(compiler_vm_op, CELL, CELL, CELL, CELL, CELL, CELL, CELL, struct intermediates *); +extern CELL *Yap_emit_extra_size(compiler_vm_op, CELL, int, struct intermediates *); +extern char *Yap_AllocCMem(UInt, struct intermediates *); +extern void Yap_ReleaseCMem(struct intermediates *); +extern int Yap_is_a_test_pred(Term, Term); +extern void Yap_bip_name(Int, char *); #ifdef DEBUG -void Yap_ShowCode(struct intermediates *); +extern void Yap_ShowCode(struct intermediates *); #endif /* DEBUG */ + +#endif diff --git a/H/YapOpcodes.h b/H/YapOpcodes.h index 4a3336e5c..7cb06d047 100644 --- a/H/YapOpcodes.h +++ b/H/YapOpcodes.h @@ -6,6 +6,26 @@ OPCODE(Nstop ,e), #ifdef YAP_JIT OPCODE(jit_handler ,J), +#endif + OPCODE(cut ,s), + OPCODE(cut_t ,s), + OPCODE(cut_e ,s), + OPCODE(save_b_x ,x), + OPCODE(save_b_y ,y), + OPCODE(commit_b_x ,xps), + OPCODE(commit_b_y ,yps), + OPCODE(execute ,Osbpp), + OPCODE(dexecute ,Osbpp), + OPCODE(fcall ,Osbpp), + OPCODE(call ,Osbpp), + OPCODE(procceed ,p), + OPCODE(allocate ,e), + OPCODE(deallocate ,p), +#ifdef BEAM + OPCODE(retry_eam ,e), +#endif +#ifdef BEAM + OPCODE(run_eam ,os), #endif OPCODE(try_me ,Otapl), OPCODE(retry_me ,Otapl), @@ -43,6 +63,44 @@ OPCODE(retry4 ,l), OPCODE(trust ,Otapl), OPCODE(try_in ,l), + OPCODE(trust_fail ,e), + OPCODE(op_fail ,e), + OPCODE(call_cpred ,Osbpp), + OPCODE(execute_cpred ,Osbpp), + OPCODE(call_usercpred ,Osbpp), + OPCODE(call_c_wfail ,slpp), + OPCODE(try_c ,OtapFs), + OPCODE(retry_c ,OtapFs), + OPCODE(cut_c ,OtapFs), + OPCODE(try_userc ,OtapFs), + OPCODE(retry_userc ,OtapFs), + OPCODE(cut_userc ,OtapFs), + OPCODE(lock_pred ,e), + OPCODE(index_pred ,e), +#ifdef THREADS + OPCODE(thread_local ,e), +#endif + OPCODE(expand_index ,e), + OPCODE(expand_clauses ,sssllp), + OPCODE(undef_p ,e), + OPCODE(spy_pred ,e), + OPCODE(user_switch ,lp), + OPCODE(switch_on_type ,llll), + OPCODE(switch_list_nl ,ollll), + OPCODE(switch_on_arg_type ,xllll), + OPCODE(switch_on_sub_arg_type ,sllll), + OPCODE(jump_if_var ,l), + OPCODE(jump_if_nonvar ,xll), + OPCODE(if_not_then ,clll), + OPCODE(switch_on_func ,sssl), + OPCODE(switch_on_cons ,sssl), + OPCODE(go_on_func ,sssl), + OPCODE(go_on_cons ,sssl), + OPCODE(if_func ,sssl), + OPCODE(if_cons ,sssl), + OPCODE(index_dbref ,e), + OPCODE(index_blob ,e), + OPCODE(index_long ,e), OPCODE(enter_lu_pred ,Illss), OPCODE(profiled_retry_logical ,OtaLl), OPCODE(profiled_trust_logical ,OtILl), @@ -56,28 +114,94 @@ OPCODE(alloc_for_logical_pred ,L), OPCODE(copy_idb_term ,e), OPCODE(unify_idb_term ,e), - OPCODE(trust_fail ,e), - OPCODE(op_fail ,e), - OPCODE(cut ,s), - OPCODE(cut_t ,s), - OPCODE(cut_e ,s), - OPCODE(save_b_x ,x), - OPCODE(save_b_y ,y), - OPCODE(commit_b_x ,xps), - OPCODE(commit_b_y ,yps), - OPCODE(execute ,pp), - OPCODE(dexecute ,pp), - OPCODE(fcall ,Osbpp), - OPCODE(call ,Osbpp), - OPCODE(procceed ,p), - OPCODE(allocate ,e), - OPCODE(deallocate ,p), -#ifdef BEAM - OPCODE(retry_eam ,e), -#endif -#ifdef BEAM - OPCODE(run_eam ,os), -#endif + OPCODE(p_execute_tail ,Osbmp), + OPCODE(p_execute2 ,Osbpp), + OPCODE(p_execute ,Osbmp), + OPCODE(jump ,l), + OPCODE(move_back ,l), + OPCODE(skip ,l), + OPCODE(either ,Osblp), + OPCODE(or_else ,Osblp), + OPCODE(pop_n ,s), + OPCODE(pop ,e), + OPCODE(p_plus_vv ,xxx), + OPCODE(p_plus_vc ,xxn), + OPCODE(p_plus_y_vv ,yxx), + OPCODE(p_plus_y_vc ,yxn), + OPCODE(p_minus_vv ,xxx), + OPCODE(p_minus_cv ,xxn), + OPCODE(p_minus_y_vv ,yxx), + OPCODE(p_minus_y_cv ,yxn), + OPCODE(p_times_vv ,xxx), + OPCODE(p_times_vc ,xxn), + OPCODE(p_times_y_vv ,yxx), + OPCODE(p_times_y_vc ,yxn), + OPCODE(p_div_vv ,xxx), + OPCODE(p_div_vc ,xxn), + OPCODE(p_div_cv ,xxn), + OPCODE(p_div_y_vv ,yxx), + OPCODE(p_div_y_vc ,yxn), + OPCODE(p_div_y_cv ,yxn), + OPCODE(p_and_vv ,xxx), + OPCODE(p_and_vc ,xxn), + OPCODE(p_and_y_vv ,yxx), + OPCODE(p_and_y_vc ,yxn), + OPCODE(p_or_vv ,xxx), + OPCODE(p_or_vc ,xxn), + OPCODE(p_or_y_vv ,yxx), + OPCODE(p_or_y_vc ,yxn), + OPCODE(p_sll_vv ,xxx), + OPCODE(p_sll_vc ,xxn), + OPCODE(p_sll_cv ,xxn), + OPCODE(p_sll_y_vv ,yxx), + OPCODE(p_sll_y_vc ,yxn), + OPCODE(p_sll_y_cv ,yxn), + OPCODE(p_slr_vv ,xxx), + OPCODE(p_slr_vc ,xxn), + OPCODE(p_slr_cv ,xxn), + OPCODE(p_slr_y_vv ,yxx), + OPCODE(p_slr_y_vc ,yxn), + OPCODE(p_slr_y_cv ,yxn), + OPCODE(call_bfunc_xx ,plxxs), + OPCODE(call_bfunc_yx ,plxys), + OPCODE(call_bfunc_xy ,plxys), + OPCODE(call_bfunc_yy ,plyys), + OPCODE(p_equal ,e), + OPCODE(p_arg_vv ,xxx), + OPCODE(p_arg_cv ,xxn), + OPCODE(p_arg_y_vv ,yxx), + OPCODE(p_arg_y_cv ,yxn), + OPCODE(p_func2s_vv ,xxx), + OPCODE(p_func2s_cv ,xxc), + OPCODE(p_func2s_vc ,xxn), + OPCODE(p_func2s_y_vv ,yxx), + OPCODE(p_func2s_y_cv ,yxc), + OPCODE(p_func2s_y_vc ,yxn), + OPCODE(p_func2f_xx ,xxx), + OPCODE(p_func2f_xy ,xxy), + OPCODE(p_func2f_yx ,yxx), + OPCODE(p_func2f_yy ,yyx), + OPCODE(p_functor ,e), + OPCODE(p_atom_x ,xl), + OPCODE(p_atom_y ,yl), + OPCODE(p_atomic_x ,xl), + OPCODE(p_atomic_y ,yl), + OPCODE(p_integer_x ,xl), + OPCODE(p_integer_y ,yl), + OPCODE(p_nonvar_x ,xl), + OPCODE(p_nonvar_y ,yl), + OPCODE(p_number_x ,xl), + OPCODE(p_number_y ,yl), + OPCODE(p_var_x ,xl), + OPCODE(p_var_y ,yl), + OPCODE(p_db_ref_x ,xl), + OPCODE(p_db_ref_y ,yl), + OPCODE(p_primitive_x ,xl), + OPCODE(p_primitive_y ,yl), + OPCODE(p_compound_x ,xl), + OPCODE(p_compound_y ,yl), + OPCODE(p_float_x ,xl), + OPCODE(p_float_y ,yl), OPCODE(get_x_var ,xx), OPCODE(get_y_var ,yx), OPCODE(get_yy_var ,yyxx), @@ -207,134 +331,6 @@ OPCODE(save_appl_x_write ,ox), OPCODE(save_appl_y ,oy), OPCODE(save_appl_y_write ,oy), - OPCODE(call_cpred ,Osbpp), - OPCODE(execute_cpred ,pp), - OPCODE(call_usercpred ,Osbpp), - OPCODE(call_c_wfail ,slpp), - OPCODE(try_c ,OtapFs), - OPCODE(retry_c ,OtapFs), - OPCODE(cut_c ,OtapFs), - OPCODE(try_userc ,OtapFs), - OPCODE(retry_userc ,OtapFs), - OPCODE(cut_userc ,OtapFs), - OPCODE(lock_pred ,e), - OPCODE(index_pred ,e), -#ifdef THREADS - OPCODE(thread_local ,e), -#endif - OPCODE(expand_index ,e), - OPCODE(expand_clauses ,sssllp), - OPCODE(undef_p ,e), - OPCODE(spy_pred ,e), - OPCODE(jump ,l), - OPCODE(move_back ,l), - OPCODE(skip ,l), - OPCODE(either ,Osblp), - OPCODE(or_else ,Osblp), - OPCODE(pop_n ,s), - OPCODE(pop ,e), - OPCODE(user_switch ,lp), - OPCODE(switch_on_type ,llll), - OPCODE(switch_list_nl ,ollll), - OPCODE(switch_on_arg_type ,xllll), - OPCODE(switch_on_sub_arg_type ,sllll), - OPCODE(jump_if_var ,l), - OPCODE(jump_if_nonvar ,xll), - OPCODE(if_not_then ,clll), - OPCODE(switch_on_func ,sssl), - OPCODE(switch_on_cons ,sssl), - OPCODE(go_on_func ,sssl), - OPCODE(go_on_cons ,sssl), - OPCODE(if_func ,sssl), - OPCODE(if_cons ,sssl), - OPCODE(index_dbref ,e), - OPCODE(index_blob ,e), - OPCODE(index_long ,e), - OPCODE(p_atom_x ,xl), - OPCODE(p_atom_y ,yl), - OPCODE(p_atomic_x ,xl), - OPCODE(p_atomic_y ,yl), - OPCODE(p_integer_x ,xl), - OPCODE(p_integer_y ,yl), - OPCODE(p_nonvar_x ,xl), - OPCODE(p_nonvar_y ,yl), - OPCODE(p_number_x ,xl), - OPCODE(p_number_y ,yl), - OPCODE(p_var_x ,xl), - OPCODE(p_var_y ,yl), - OPCODE(p_db_ref_x ,xl), - OPCODE(p_db_ref_y ,yl), - OPCODE(p_primitive_x ,xl), - OPCODE(p_primitive_y ,yl), - OPCODE(p_compound_x ,xl), - OPCODE(p_compound_y ,yl), - OPCODE(p_float_x ,xl), - OPCODE(p_float_y ,yl), - OPCODE(p_plus_vv ,xxx), - OPCODE(p_plus_vc ,xxn), - OPCODE(p_plus_y_vv ,yxx), - OPCODE(p_plus_y_vc ,yxn), - OPCODE(p_minus_vv ,xxx), - OPCODE(p_minus_cv ,xxn), - OPCODE(p_minus_y_vv ,yxx), - OPCODE(p_minus_y_cv ,yxn), - OPCODE(p_times_vv ,xxx), - OPCODE(p_times_vc ,xxn), - OPCODE(p_times_y_vv ,yxx), - OPCODE(p_times_y_vc ,yxn), - OPCODE(p_div_vv ,xxx), - OPCODE(p_div_vc ,xxn), - OPCODE(p_div_cv ,xxn), - OPCODE(p_div_y_vv ,yxx), - OPCODE(p_div_y_vc ,yxn), - OPCODE(p_div_y_cv ,yxn), - OPCODE(p_and_vv ,xxx), - OPCODE(p_and_vc ,xxn), - OPCODE(p_and_y_vv ,yxx), - OPCODE(p_and_y_vc ,yxn), - OPCODE(p_or_vv ,xxx), - OPCODE(p_or_vc ,xxn), - OPCODE(p_or_y_vv ,yxx), - OPCODE(p_or_y_vc ,yxn), - OPCODE(p_sll_vv ,xxx), - OPCODE(p_sll_vc ,xxn), - OPCODE(p_sll_cv ,xxn), - OPCODE(p_sll_y_vv ,yxx), - OPCODE(p_sll_y_vc ,yxn), - OPCODE(p_sll_y_cv ,yxn), - OPCODE(p_slr_vv ,xxx), - OPCODE(p_slr_vc ,xxn), - OPCODE(p_slr_cv ,xxn), - OPCODE(p_slr_y_vv ,yxx), - OPCODE(p_slr_y_vc ,yxn), - OPCODE(p_slr_y_cv ,yxn), - OPCODE(call_bfunc_xx ,plxxs), - OPCODE(call_bfunc_yx ,plxys), - OPCODE(call_bfunc_xy ,plxys), - OPCODE(call_bfunc_yy ,plyys), - OPCODE(p_equal ,e), -#if INLINE_BIG_COMPARISONS - OPCODE(p_dif ,l), - OPCODE(p_eq ,l), -#endif - OPCODE(p_arg_vv ,xxx), - OPCODE(p_arg_cv ,xxn), - OPCODE(p_arg_y_vv ,yxx), - OPCODE(p_arg_y_cv ,yxn), - OPCODE(p_func2s_vv ,xxx), - OPCODE(p_func2s_cv ,xxc), - OPCODE(p_func2s_vc ,xxn), - OPCODE(p_func2s_y_vv ,yxx), - OPCODE(p_func2s_y_cv ,yxc), - OPCODE(p_func2s_y_vc ,yxn), - OPCODE(p_func2f_xx ,xxx), - OPCODE(p_func2f_xy ,xxy), - OPCODE(p_func2f_yx ,yxx), - OPCODE(p_func2f_yy ,yyx), - OPCODE(p_functor ,e), - OPCODE(p_execute_tail ,Osbmp), - OPCODE(p_execute2 ,Osbpp), - OPCODE(p_execute ,Osbmp), #ifdef YAPOR OPCODE(getwork_first_time ,e), OPCODE(getwork ,Otapl), diff --git a/H/amidefs.h b/H/amidefs.h index e7ef7e159..4550a1e7d 100644 --- a/H/amidefs.h +++ b/H/amidefs.h @@ -557,11 +557,6 @@ typedef struct yami { struct pred_entry *p; CELL next; } p; - struct { - struct pred_entry *p; - struct pred_entry *p0; - CELL next; - } pp; struct { COUNT s; CELL next; diff --git a/H/rclause.h b/H/rclause.h index 986e76d6b..3e77956b0 100644 --- a/H/rclause.h +++ b/H/rclause.h @@ -255,10 +255,6 @@ restore_opcodes(yamop *pc, yamop *max USES_REGS) case _jump: case _jump_if_var: case _move_back: -#if INLINE_BIG_COMPARISONS - case _p_dif: - case _p_eq: -#endif case _retry2: case _retry3: case _retry4: diff --git a/H/saveclause.h b/H/saveclause.h index 8df1b2cea..0ed5273b6 100644 --- a/H/saveclause.h +++ b/H/saveclause.h @@ -78,6 +78,9 @@ case _call: case _call_cpred: case _call_usercpred: + case _dexecute: + case _execute: + case _execute_cpred: case _fcall: case _p_execute2: #ifdef YAPOR @@ -273,8 +276,6 @@ case _jump: case _jump_if_var: case _move_back: - case _p_dif: - case _p_eq: case _retry2: case _retry3: case _retry4: @@ -498,14 +499,6 @@ CHECK(save_Constant(stream, pc->y_u.plyys.flags)); pc = NEXTOP(pc,plyys); break; - /* instructions type pp */ - case _dexecute: - case _execute: - case _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 _cut: case _cut_e: diff --git a/H/walkclause.h b/H/walkclause.h index 0252df004..8f97eef76 100644 --- a/H/walkclause.h +++ b/H/walkclause.h @@ -1,746 +1,739 @@ -/* This file was generated automatically by "yap -L misc/buildops" + + /* This file was generated automatically by "yap -L misc/buildops" please do not update */ -while (TRUE) { - op_numbers op; - op = Yap_op_from_opcode(pc->opc); - /* C-code, maybe indexing */ - switch (op) { - /* instructions type D */ - case _write_dbterm: - pc = NEXTOP(pc, D); - break; - /* instructions type Illss */ - case _enter_lu_pred: - return walk_got_lu_block(pc->y_u.Illss.I, startp, endp); -/* instructions type J */ + while (TRUE) { + op_numbers op; + + op = Yap_op_from_opcode(pc->opc); + /* C-code, maybe indexing */ + switch (op) { + /* instructions type D */ + case _write_dbterm: + pc = NEXTOP(pc,D); + break; + /* instructions type Illss */ + case _enter_lu_pred: + return walk_got_lu_block(pc->y_u.Illss.I, startp, endp); + /* instructions type J */ #ifdef YAP_JIT - case _jit_handler: + case _jit_handler: #endif - pc = NEXTOP(pc, J); - break; - /* instructions type L */ - case _alloc_for_logical_pred: - return walk_got_lu_clause(pc->y_u.L.ClBase, startp, endp); - /* instructions type N */ - case _write_bigint: - pc = NEXTOP(pc, N); - break; - /* instructions type Osblp */ - case _either: - case _or_else: - clause_code = TRUE; - pp = pc->y_u.Osblp.p0; - pc = NEXTOP(pc, Osblp); - break; - /* instructions type Osbmp */ - case _p_execute: - case _p_execute_tail: - pc = NEXTOP(pc, Osbmp); - break; - /* instructions type Osbpa */ - case _ensure_space: - pc = NEXTOP(pc, Osbpa); - break; - /* instructions type Osbpp */ - case _call_cpred: - pp = pc->y_u.Osbpp.p; - return walk_found_c_pred(pp, startp, endp); - case _call_usercpred: - pp = pc->y_u.Osbpp.p; - return walk_found_c_pred(pp, startp, endp); - case _p_execute2: - return found_meta_call(startp, endp); - case _call: - case _fcall: - clause_code = TRUE; - pp = pc->y_u.Osbpp.p0; - pc = NEXTOP(pc, Osbpp); - break; - /* instructions type OtILl */ - case _count_trust_logical: - case _profiled_trust_logical: - case _trust_logical: - return walk_got_lu_block(pc->y_u.OtILl.block, startp, endp); - /* instructions type OtaLl */ - case _count_retry_logical: - case _profiled_retry_logical: - case _retry_logical: - case _try_logical: - pc = pc->y_u.OtaLl.n; - break; - /* instructions type OtapFs */ - case _cut_c: - case _cut_userc: - case _retry_c: - case _retry_userc: - case _try_c: - case _try_userc: - clause_code = TRUE; - pp = pc->y_u.OtapFs.p; - pc = NEXTOP(pc, OtapFs); - break; - /* instructions type Otapl */ - case _count_retry_and_mark: - case _count_retry_me: - case _count_trust_me: - case _profiled_retry_and_mark: - case _profiled_retry_me: - case _profiled_trust_me: - case _retry: - case _retry_and_mark: - case _retry_me: - case _spy_or_trymark: - case _trust: - case _trust_me: - case _try_and_mark: - case _try_clause: - case _try_me: - clause_code = FALSE; - pp = pc->y_u.Otapl.p; - pc = NEXTOP(pc, Otapl); - break; - /* instructions type c */ - case _write_atom: - pc = NEXTOP(pc, c); - break; - /* instructions type cc */ - case _get_2atoms: - pc = NEXTOP(pc, cc); - break; - /* instructions type ccc */ - case _get_3atoms: - pc = NEXTOP(pc, ccc); - break; - /* instructions type cccc */ - case _get_4atoms: - pc = NEXTOP(pc, cccc); - break; - /* instructions type ccccc */ - case _get_5atoms: - pc = NEXTOP(pc, ccccc); - break; - /* instructions type cccccc */ - case _get_6atoms: - pc = NEXTOP(pc, cccccc); - break; - /* instructions type clll */ - case _if_not_then: - pc = NEXTOP(pc, clll); - break; - /* instructions type d */ - case _write_float: - pc = NEXTOP(pc, d); - break; - /* instructions type e */ - case _Nstop: - return NULL; - case _copy_idb_term: - return found_idb_clause(pc, startp, endp); - case _expand_index: - return found_expand(pc, startp, endp PASS_REGS); - case _index_pred: - return found_owner_op(pc, startp, endp PASS_REGS); - case _lock_pred: - return found_owner_op(pc, startp, endp PASS_REGS); - case _op_fail: - if (codeptr == FAILCODE) - return found_fail(pc, startp, endp PASS_REGS); - pc = NEXTOP(pc, e); - break; - case _spy_pred: - return found_owner_op(pc, startp, endp PASS_REGS); - case _trust_fail: - if (codeptr == TRUSTFAILCODE) - return found_fail(pc, startp, endp PASS_REGS); - pc = NEXTOP(pc, e); - break; - case _undef_p: - return found_owner_op(pc, startp, endp PASS_REGS); - case _unify_idb_term: - return found_idb_clause(pc, startp, endp); - case _allocate: - case _enter_exo: - case _index_blob: - case _index_dbref: - case _index_long: - case _p_equal: - case _p_functor: - case _pop: + pc = NEXTOP(pc,J); + break; + /* instructions type L */ + case _alloc_for_logical_pred: + return walk_got_lu_clause(pc->y_u.L.ClBase, startp, endp); + /* instructions type N */ + case _write_bigint: + pc = NEXTOP(pc,N); + break; + /* instructions type Osblp */ + case _either: + case _or_else: + clause_code = TRUE; + pp = pc->y_u.Osblp.p0; + pc = NEXTOP(pc,Osblp); + break; + /* instructions type Osbmp */ + case _p_execute: + case _p_execute_tail: + pc = NEXTOP(pc,Osbmp); + break; + /* instructions type Osbpa */ + case _ensure_space: + pc = NEXTOP(pc,Osbpa); + break; + /* instructions type Osbpp */ + case _call_cpred: + pp = pc->y_u.Osbpp.p; + return walk_found_c_pred(pp, startp, endp); + case _call_usercpred: + pp = pc->y_u.Osbpp.p; + return walk_found_c_pred(pp, startp, endp); + case _execute_cpred: + pp = pc->y_u.Osbpp.p; + return walk_found_c_pred(pp, startp, endp); + case _p_execute2: + return found_meta_call(startp, endp); + case _call: + case _dexecute: + case _execute: + case _fcall: + clause_code = TRUE; + pp = pc->y_u.Osbpp.p0; + pc = NEXTOP(pc,Osbpp); + break; + /* instructions type OtILl */ + case _count_trust_logical: + case _profiled_trust_logical: + case _trust_logical: + return walk_got_lu_block(pc->y_u.OtILl.block, startp, endp); + /* instructions type OtaLl */ + case _count_retry_logical: + case _profiled_retry_logical: + case _retry_logical: + case _try_logical: + pc = pc->y_u.OtaLl.n; + break; + /* instructions type OtapFs */ + case _cut_c: + case _cut_userc: + case _retry_c: + case _retry_userc: + case _try_c: + case _try_userc: + clause_code = TRUE; + pp = pc->y_u.OtapFs.p; + pc = NEXTOP(pc,OtapFs); + break; + /* instructions type Otapl */ + case _count_retry_and_mark: + case _count_retry_me: + case _count_trust_me: + case _profiled_retry_and_mark: + case _profiled_retry_me: + case _profiled_trust_me: + case _retry: + case _retry_and_mark: + case _retry_me: + case _spy_or_trymark: + case _trust: + case _trust_me: + case _try_and_mark: + case _try_clause: + case _try_me: + clause_code = FALSE; + pp = pc->y_u.Otapl.p; + pc = NEXTOP(pc,Otapl); + break; + /* instructions type c */ + case _write_atom: + pc = NEXTOP(pc,c); + break; + /* instructions type cc */ + case _get_2atoms: + pc = NEXTOP(pc,cc); + break; + /* instructions type ccc */ + case _get_3atoms: + pc = NEXTOP(pc,ccc); + break; + /* instructions type cccc */ + case _get_4atoms: + pc = NEXTOP(pc,cccc); + break; + /* instructions type ccccc */ + case _get_5atoms: + pc = NEXTOP(pc,ccccc); + break; + /* instructions type cccccc */ + case _get_6atoms: + pc = NEXTOP(pc,cccccc); + break; + /* instructions type clll */ + case _if_not_then: + pc = NEXTOP(pc,clll); + break; + /* instructions type d */ + case _write_float: + pc = NEXTOP(pc,d); + break; + /* instructions type e */ + case _Nstop: + return NULL; + case _copy_idb_term: + return found_idb_clause(pc, startp, endp); + case _expand_index: + return found_expand(pc, startp, endp PASS_REGS); + case _index_pred: + return found_owner_op(pc, startp, endp PASS_REGS); + case _lock_pred: + return found_owner_op(pc, startp, endp PASS_REGS); + case _op_fail: + if (codeptr == FAILCODE) + return found_fail(pc, startp, endp PASS_REGS); + pc = NEXTOP(pc,e); + break; + case _spy_pred: + return found_owner_op(pc, startp, endp PASS_REGS); + case _trust_fail: + if (codeptr == TRUSTFAILCODE) + return found_fail(pc, startp, endp PASS_REGS); + pc = NEXTOP(pc,e); + break; + case _undef_p: + return found_owner_op(pc, startp, endp PASS_REGS); + case _unify_idb_term: + return found_idb_clause(pc, startp, endp); + case _allocate: + case _enter_exo: + case _index_blob: + case _index_dbref: + case _index_long: + case _p_equal: + case _p_functor: + case _pop: #ifdef BEAM - case _retry_eam: + case _retry_eam: #endif #ifdef THREADS - case _thread_local: + case _thread_local: #endif - case _unlock_lu: - case _write_l_list: - case _write_list: - case _write_void: - pc = NEXTOP(pc, e); - break; - /* instructions type fa */ - case _write_l_struc: - case _write_struct: - pc = NEXTOP(pc, fa); - break; - /* instructions type i */ - case _write_longint: - pc = NEXTOP(pc, i); - break; - /* instructions type l */ - case _Ystop: - return found_ystop(pc, clause_code, startp, endp, pp PASS_REGS); - case _jump: - case _jump_if_var: - case _move_back: -#if INLINE_BIG_COMPARISONS - case _p_dif: - case _p_eq: -#endif - case _retry2: - case _retry3: - case _retry4: - case _skip: - case _try_clause2: - case _try_clause3: - case _try_clause4: - case _try_in: - pc = NEXTOP(pc, l); - break; - /* instructions type llll */ - case _switch_on_type: - pc = NEXTOP(pc, llll); - break; - /* instructions type lp */ - case _retry_all_exo: - case _retry_exo: - case _retry_exo_udi: - case _try_all_exo: - case _try_exo: - case _try_exo_udi: - case _user_switch: - pc = NEXTOP(pc, lp); - break; - /* instructions type o */ - case _unify_l_list: - case _unify_l_list_write: - case _unify_l_void: - case _unify_l_void_write: - case _unify_list: - case _unify_list_write: - case _unify_void: - case _unify_void_write: - pc = NEXTOP(pc, o); - break; - /* instructions type oD */ - case _unify_dbterm: - case _unify_l_dbterm: - pc = NEXTOP(pc, oD); - break; - /* instructions type oN */ - case _unify_bigint: - case _unify_l_bigint: - pc = NEXTOP(pc, oN); - break; - /* instructions type oc */ - case _unify_atom: - case _unify_atom_write: - case _unify_l_atom: - case _unify_l_atom_write: - pc = NEXTOP(pc, oc); - break; - /* instructions type od */ - case _unify_float: - case _unify_float_write: - case _unify_l_float: - case _unify_l_float_write: - pc = NEXTOP(pc, od); - break; - /* instructions type ofa */ - case _unify_l_struc: - case _unify_l_struc_write: - case _unify_struct: - case _unify_struct_write: - pc = NEXTOP(pc, ofa); - break; - /* instructions type oi */ - case _unify_l_longint: - case _unify_l_longint_write: - case _unify_longint: - case _unify_longint_write: - pc = NEXTOP(pc, oi); - break; - /* instructions type ollll */ - case _switch_list_nl: - pc = NEXTOP(pc, ollll); - break; -/* instructions type os */ + case _unlock_lu: + case _write_l_list: + case _write_list: + case _write_void: + pc = NEXTOP(pc,e); + break; + /* instructions type fa */ + case _write_l_struc: + case _write_struct: + pc = NEXTOP(pc,fa); + break; + /* instructions type i */ + case _write_longint: + pc = NEXTOP(pc,i); + break; + /* instructions type l */ + case _Ystop: + return found_ystop(pc, clause_code, startp, endp, pp PASS_REGS); + case _jump: + case _jump_if_var: + case _move_back: + case _retry2: + case _retry3: + case _retry4: + case _skip: + case _try_clause2: + case _try_clause3: + case _try_clause4: + case _try_in: + pc = NEXTOP(pc,l); + break; + /* instructions type llll */ + case _switch_on_type: + pc = NEXTOP(pc,llll); + break; + /* instructions type lp */ + case _retry_all_exo: + case _retry_exo: + case _retry_exo_udi: + case _try_all_exo: + case _try_exo: + case _try_exo_udi: + case _user_switch: + pc = NEXTOP(pc,lp); + break; + /* instructions type o */ + case _unify_l_list: + case _unify_l_list_write: + case _unify_l_void: + case _unify_l_void_write: + case _unify_list: + case _unify_list_write: + case _unify_void: + case _unify_void_write: + pc = NEXTOP(pc,o); + break; + /* instructions type oD */ + case _unify_dbterm: + case _unify_l_dbterm: + pc = NEXTOP(pc,oD); + break; + /* instructions type oN */ + case _unify_bigint: + case _unify_l_bigint: + pc = NEXTOP(pc,oN); + break; + /* instructions type oc */ + case _unify_atom: + case _unify_atom_write: + case _unify_l_atom: + case _unify_l_atom_write: + pc = NEXTOP(pc,oc); + break; + /* instructions type od */ + case _unify_float: + case _unify_float_write: + case _unify_l_float: + case _unify_l_float_write: + pc = NEXTOP(pc,od); + break; + /* instructions type ofa */ + case _unify_l_struc: + case _unify_l_struc_write: + case _unify_struct: + case _unify_struct_write: + pc = NEXTOP(pc,ofa); + break; + /* instructions type oi */ + case _unify_l_longint: + case _unify_l_longint_write: + case _unify_longint: + case _unify_longint_write: + pc = NEXTOP(pc,oi); + break; + /* instructions type ollll */ + case _switch_list_nl: + pc = NEXTOP(pc,ollll); + break; + /* instructions type os */ #ifdef BEAM - case _run_eam: + case _run_eam: #endif - case _unify_l_n_voids: - case _unify_l_n_voids_write: - case _unify_n_voids: - case _unify_n_voids_write: - pc = NEXTOP(pc, os); - break; - /* instructions type osc */ - case _unify_n_atoms: - case _unify_n_atoms_write: - pc = NEXTOP(pc, osc); - break; - /* instructions type ou */ - case _unify_l_string: - case _unify_string: - pc = NEXTOP(pc, ou); - break; - /* instructions type ox */ - case _save_appl_x: - case _save_appl_x_write: - case _save_pair_x: - case _save_pair_x_write: - case _unify_l_x_loc: - case _unify_l_x_loc_write: - case _unify_l_x_val: - case _unify_l_x_val_write: - case _unify_l_x_var: - case _unify_l_x_var_write: - case _unify_x_loc: - case _unify_x_loc_write: - case _unify_x_val: - case _unify_x_val_write: - case _unify_x_var: - case _unify_x_var_write: - pc = NEXTOP(pc, ox); - break; - /* instructions type oxx */ - case _unify_l_x_var2: - case _unify_l_x_var2_write: - case _unify_x_var2: - case _unify_x_var2_write: - pc = NEXTOP(pc, oxx); - break; - /* instructions type oy */ - case _save_appl_y: - case _save_appl_y_write: - case _save_pair_y: - case _save_pair_y_write: - case _unify_l_y_loc: - case _unify_l_y_loc_write: - case _unify_l_y_val: - case _unify_l_y_val_write: - case _unify_l_y_var: - case _unify_l_y_var_write: - case _unify_y_loc: - case _unify_y_loc_write: - case _unify_y_val: - case _unify_y_val_write: - case _unify_y_var: - case _unify_y_var_write: - pc = NEXTOP(pc, oy); - break; - /* instructions type p */ - case _lock_lu: - case _procceed: - pp = pc->y_u.p.p; - if (pp->PredFlags & MegaClausePredFlag) - return found_mega_clause(pp, startp, endp); - clause_code = TRUE; - pc = NEXTOP(pc, p); - break; - case _count_call: - case _count_retry: - case _deallocate: - case _enter_profiling: - case _retry_profiled: - case _retry_udi: - case _try_udi: - pc = NEXTOP(pc, p); - break; - /* instructions type plxxs */ - case _call_bfunc_xx: - pc = NEXTOP(pc, plxxs); - break; - /* instructions type plxys */ - case _call_bfunc_xy: - case _call_bfunc_yx: - pc = NEXTOP(pc, plxys); - break; - /* instructions type plyys */ - case _call_bfunc_yy: - pc = NEXTOP(pc, plyys); - break; - /* instructions type pp */ - case _execute_cpred: - pp = pc->y_u.pp.p; - return walk_found_c_pred(pp, startp, endp); - case _dexecute: - case _execute: - clause_code = TRUE; - pp = pc->y_u.pp.p0; - pc = NEXTOP(pc, pp); - break; - /* instructions type s */ - case _cut: - case _cut_e: - case _cut_t: - case _pop_n: - case _write_n_voids: - pc = NEXTOP(pc, s); - break; - /* instructions type sc */ - case _write_n_atoms: - pc = NEXTOP(pc, sc); - break; - /* instructions type sllll */ - case _switch_on_sub_arg_type: - pc = NEXTOP(pc, sllll); - break; - /* instructions type slpp */ - case _call_c_wfail: - pp = pc->y_u.slpp.p; - return walk_found_c_pred(pp, startp, endp); - /* instructions type sssl */ - case _go_on_cons: - case _go_on_func: - case _if_cons: - case _if_func: - case _switch_on_cons: - case _switch_on_func: - pc = NEXTOP(pc, sssl); - break; - /* instructions type sssllp */ - case _expand_clauses: - return found_expand_index(pc, startp, endp, codeptr PASS_REGS); - pc = NEXTOP(pc, sssllp); - break; - /* instructions type x */ - case _get_atom_exo: - case _get_list: - case _put_list: - case _save_b_x: - case _write_x_loc: - case _write_x_val: - case _write_x_var: - pc = NEXTOP(pc, x); - break; - /* instructions type xD */ - case _get_dbterm: - case _put_dbterm: - pc = NEXTOP(pc, xD); - break; - /* instructions type xN */ - case _get_bigint: - case _put_bigint: - pc = NEXTOP(pc, xN); - break; - /* instructions type xc */ - case _get_atom: - case _put_atom: - pc = NEXTOP(pc, xc); - break; - /* instructions type xd */ - case _get_float: - case _put_float: - pc = NEXTOP(pc, xd); - break; - /* instructions type xfa */ - case _get_struct: - case _put_struct: - pc = NEXTOP(pc, xfa); - break; - /* instructions type xi */ - case _get_longint: - case _put_longint: - pc = NEXTOP(pc, xi); - break; - /* instructions type xl */ - case _p_atom_x: - case _p_atomic_x: - case _p_compound_x: - case _p_db_ref_x: - case _p_float_x: - case _p_integer_x: - case _p_nonvar_x: - case _p_number_x: - case _p_primitive_x: - case _p_var_x: - pc = NEXTOP(pc, xl); - break; - /* instructions type xll */ - case _jump_if_nonvar: - pc = NEXTOP(pc, xll); - break; - /* instructions type xllll */ - case _switch_on_arg_type: - pc = NEXTOP(pc, xllll); - break; - /* instructions type xps */ - case _commit_b_x: - pc = NEXTOP(pc, xps); - break; - /* instructions type xu */ - case _get_string: - pc = NEXTOP(pc, xu); - break; - /* instructions type xx */ - case _get_x_val: - case _get_x_var: - case _gl_void_valx: - case _gl_void_varx: - case _glist_valx: - case _put_x_val: - case _put_x_var: - pc = NEXTOP(pc, xx); - break; - /* instructions type xxc */ - case _p_func2s_cv: - pc = NEXTOP(pc, xxc); - break; - /* instructions type xxn */ - case _p_and_vc: - case _p_arg_cv: - case _p_div_cv: - case _p_div_vc: - case _p_func2s_vc: - case _p_minus_cv: - case _p_or_vc: - case _p_plus_vc: - case _p_sll_cv: - case _p_sll_vc: - case _p_slr_cv: - case _p_slr_vc: - case _p_times_vc: - pc = NEXTOP(pc, xxn); - break; - /* instructions type xxx */ - case _p_and_vv: - case _p_arg_vv: - case _p_div_vv: - case _p_func2f_xx: - case _p_func2s_vv: - case _p_minus_vv: - case _p_or_vv: - case _p_plus_vv: - case _p_sll_vv: - case _p_slr_vv: - case _p_times_vv: - pc = NEXTOP(pc, xxx); - break; - /* instructions type xxxx */ - case _put_xx_val: - pc = NEXTOP(pc, xxxx); - break; - /* instructions type xxy */ - case _p_func2f_xy: - pc = NEXTOP(pc, xxy); - break; - /* instructions type y */ - case _save_b_y: - case _write_y_loc: - case _write_y_val: - case _write_y_var: - pc = NEXTOP(pc, y); - break; - /* instructions type yl */ - case _p_atom_y: - case _p_atomic_y: - case _p_compound_y: - case _p_db_ref_y: - case _p_float_y: - case _p_integer_y: - case _p_nonvar_y: - case _p_number_y: - case _p_primitive_y: - case _p_var_y: - pc = NEXTOP(pc, yl); - break; - /* instructions type yps */ - case _commit_b_y: - pc = NEXTOP(pc, yps); - break; - /* instructions type yx */ - case _get_y_val: - case _get_y_var: - case _gl_void_valy: - case _gl_void_vary: - case _glist_valy: - case _put_unsafe: - case _put_y_val: - case _put_y_var: - pc = NEXTOP(pc, yx); - break; - /* instructions type yxc */ - case _p_func2s_y_cv: - pc = NEXTOP(pc, yxc); - break; - /* instructions type yxn */ - case _p_and_y_vc: - case _p_arg_y_cv: - case _p_div_y_cv: - case _p_div_y_vc: - case _p_func2s_y_vc: - case _p_minus_y_cv: - case _p_or_y_vc: - case _p_plus_y_vc: - case _p_sll_y_cv: - case _p_sll_y_vc: - case _p_slr_y_cv: - case _p_slr_y_vc: - case _p_times_y_vc: - pc = NEXTOP(pc, yxn); - break; - /* instructions type yxx */ - case _p_and_y_vv: - case _p_arg_y_vv: - case _p_div_y_vv: - case _p_func2f_yx: - case _p_func2s_y_vv: - case _p_minus_y_vv: - case _p_or_y_vv: - case _p_plus_y_vv: - case _p_sll_y_vv: - case _p_slr_y_vv: - case _p_times_y_vv: - pc = NEXTOP(pc, yxx); - break; - /* instructions type yyx */ - case _p_func2f_yy: - pc = NEXTOP(pc, yyx); - break; - /* instructions type yyxx */ - case _get_yy_var: - case _put_y_vals: - pc = NEXTOP(pc, yyxx); - break; + case _unify_l_n_voids: + case _unify_l_n_voids_write: + case _unify_n_voids: + case _unify_n_voids_write: + pc = NEXTOP(pc,os); + break; + /* instructions type osc */ + case _unify_n_atoms: + case _unify_n_atoms_write: + pc = NEXTOP(pc,osc); + break; + /* instructions type ou */ + case _unify_l_string: + case _unify_string: + pc = NEXTOP(pc,ou); + break; + /* instructions type ox */ + case _save_appl_x: + case _save_appl_x_write: + case _save_pair_x: + case _save_pair_x_write: + case _unify_l_x_loc: + case _unify_l_x_loc_write: + case _unify_l_x_val: + case _unify_l_x_val_write: + case _unify_l_x_var: + case _unify_l_x_var_write: + case _unify_x_loc: + case _unify_x_loc_write: + case _unify_x_val: + case _unify_x_val_write: + case _unify_x_var: + case _unify_x_var_write: + pc = NEXTOP(pc,ox); + break; + /* instructions type oxx */ + case _unify_l_x_var2: + case _unify_l_x_var2_write: + case _unify_x_var2: + case _unify_x_var2_write: + pc = NEXTOP(pc,oxx); + break; + /* instructions type oy */ + case _save_appl_y: + case _save_appl_y_write: + case _save_pair_y: + case _save_pair_y_write: + case _unify_l_y_loc: + case _unify_l_y_loc_write: + case _unify_l_y_val: + case _unify_l_y_val_write: + case _unify_l_y_var: + case _unify_l_y_var_write: + case _unify_y_loc: + case _unify_y_loc_write: + case _unify_y_val: + case _unify_y_val_write: + case _unify_y_var: + case _unify_y_var_write: + pc = NEXTOP(pc,oy); + break; + /* instructions type p */ + case _lock_lu: + case _procceed: + pp = pc->y_u.p.p; + if (pp->PredFlags & MegaClausePredFlag) + return found_mega_clause(pp, startp, endp); + clause_code = TRUE; + pc = NEXTOP(pc,p); + break; + case _count_call: + case _count_retry: + case _deallocate: + case _enter_profiling: + case _retry_profiled: + case _retry_udi: + case _try_udi: + pc = NEXTOP(pc,p); + break; + /* instructions type plxxs */ + case _call_bfunc_xx: + pc = NEXTOP(pc,plxxs); + break; + /* instructions type plxys */ + case _call_bfunc_xy: + case _call_bfunc_yx: + pc = NEXTOP(pc,plxys); + break; + /* instructions type plyys */ + case _call_bfunc_yy: + pc = NEXTOP(pc,plyys); + break; + /* instructions type s */ + case _cut: + case _cut_e: + case _cut_t: + case _pop_n: + case _write_n_voids: + pc = NEXTOP(pc,s); + break; + /* instructions type sc */ + case _write_n_atoms: + pc = NEXTOP(pc,sc); + break; + /* instructions type sllll */ + case _switch_on_sub_arg_type: + pc = NEXTOP(pc,sllll); + break; + /* instructions type slpp */ + case _call_c_wfail: + pp = pc->y_u.slpp.p; + return walk_found_c_pred(pp, startp, endp); + /* instructions type sssl */ + case _go_on_cons: + case _go_on_func: + case _if_cons: + case _if_func: + case _switch_on_cons: + case _switch_on_func: + pc = NEXTOP(pc,sssl); + break; + /* instructions type sssllp */ + case _expand_clauses: + return found_expand_index(pc, startp, endp, codeptr PASS_REGS); + pc = NEXTOP(pc,sssllp); + break; + /* instructions type x */ + case _get_atom_exo: + case _get_list: + case _put_list: + case _save_b_x: + case _write_x_loc: + case _write_x_val: + case _write_x_var: + pc = NEXTOP(pc,x); + break; + /* instructions type xD */ + case _get_dbterm: + case _put_dbterm: + pc = NEXTOP(pc,xD); + break; + /* instructions type xN */ + case _get_bigint: + case _put_bigint: + pc = NEXTOP(pc,xN); + break; + /* instructions type xc */ + case _get_atom: + case _put_atom: + pc = NEXTOP(pc,xc); + break; + /* instructions type xd */ + case _get_float: + case _put_float: + pc = NEXTOP(pc,xd); + break; + /* instructions type xfa */ + case _get_struct: + case _put_struct: + pc = NEXTOP(pc,xfa); + break; + /* instructions type xi */ + case _get_longint: + case _put_longint: + pc = NEXTOP(pc,xi); + break; + /* instructions type xl */ + case _p_atom_x: + case _p_atomic_x: + case _p_compound_x: + case _p_db_ref_x: + case _p_float_x: + case _p_integer_x: + case _p_nonvar_x: + case _p_number_x: + case _p_primitive_x: + case _p_var_x: + pc = NEXTOP(pc,xl); + break; + /* instructions type xll */ + case _jump_if_nonvar: + pc = NEXTOP(pc,xll); + break; + /* instructions type xllll */ + case _switch_on_arg_type: + pc = NEXTOP(pc,xllll); + break; + /* instructions type xps */ + case _commit_b_x: + pc = NEXTOP(pc,xps); + break; + /* instructions type xu */ + case _get_string: + pc = NEXTOP(pc,xu); + break; + /* instructions type xx */ + case _get_x_val: + case _get_x_var: + case _gl_void_valx: + case _gl_void_varx: + case _glist_valx: + case _put_x_val: + case _put_x_var: + pc = NEXTOP(pc,xx); + break; + /* instructions type xxc */ + case _p_func2s_cv: + pc = NEXTOP(pc,xxc); + break; + /* instructions type xxn */ + case _p_and_vc: + case _p_arg_cv: + case _p_div_cv: + case _p_div_vc: + case _p_func2s_vc: + case _p_minus_cv: + case _p_or_vc: + case _p_plus_vc: + case _p_sll_cv: + case _p_sll_vc: + case _p_slr_cv: + case _p_slr_vc: + case _p_times_vc: + pc = NEXTOP(pc,xxn); + break; + /* instructions type xxx */ + case _p_and_vv: + case _p_arg_vv: + case _p_div_vv: + case _p_func2f_xx: + case _p_func2s_vv: + case _p_minus_vv: + case _p_or_vv: + case _p_plus_vv: + case _p_sll_vv: + case _p_slr_vv: + case _p_times_vv: + pc = NEXTOP(pc,xxx); + break; + /* instructions type xxxx */ + case _put_xx_val: + pc = NEXTOP(pc,xxxx); + break; + /* instructions type xxy */ + case _p_func2f_xy: + pc = NEXTOP(pc,xxy); + break; + /* instructions type y */ + case _save_b_y: + case _write_y_loc: + case _write_y_val: + case _write_y_var: + pc = NEXTOP(pc,y); + break; + /* instructions type yl */ + case _p_atom_y: + case _p_atomic_y: + case _p_compound_y: + case _p_db_ref_y: + case _p_float_y: + case _p_integer_y: + case _p_nonvar_y: + case _p_number_y: + case _p_primitive_y: + case _p_var_y: + pc = NEXTOP(pc,yl); + break; + /* instructions type yps */ + case _commit_b_y: + pc = NEXTOP(pc,yps); + break; + /* instructions type yx */ + case _get_y_val: + case _get_y_var: + case _gl_void_valy: + case _gl_void_vary: + case _glist_valy: + case _put_unsafe: + case _put_y_val: + case _put_y_var: + pc = NEXTOP(pc,yx); + break; + /* instructions type yxc */ + case _p_func2s_y_cv: + pc = NEXTOP(pc,yxc); + break; + /* instructions type yxn */ + case _p_and_y_vc: + case _p_arg_y_cv: + case _p_div_y_cv: + case _p_div_y_vc: + case _p_func2s_y_vc: + case _p_minus_y_cv: + case _p_or_y_vc: + case _p_plus_y_vc: + case _p_sll_y_cv: + case _p_sll_y_vc: + case _p_slr_y_cv: + case _p_slr_y_vc: + case _p_times_y_vc: + pc = NEXTOP(pc,yxn); + break; + /* instructions type yxx */ + case _p_and_y_vv: + case _p_arg_y_vv: + case _p_div_y_vv: + case _p_func2f_yx: + case _p_func2s_y_vv: + case _p_minus_y_vv: + case _p_or_y_vv: + case _p_plus_y_vv: + case _p_sll_y_vv: + case _p_slr_y_vv: + case _p_times_y_vv: + pc = NEXTOP(pc,yxx); + break; + /* instructions type yyx */ + case _p_func2f_yy: + pc = NEXTOP(pc,yyx); + break; + /* instructions type yyxx */ + case _get_yy_var: + case _put_y_vals: + pc = NEXTOP(pc,yyxx); + break; #ifdef YAPOR - /* instructions type Otapl */ - case _getwork: - case _getwork_seq: - case _sync: - clause_code = FALSE; - pp = pc->y_u.Otapl.p; - pc = NEXTOP(pc, Otapl); - break; - /* instructions type e */ - case _getwork_first_time: - pc = NEXTOP(pc, e); - break; + /* instructions type Otapl */ + case _getwork: + case _getwork_seq: + case _sync: + clause_code = FALSE; + pp = pc->y_u.Otapl.p; + pc = NEXTOP(pc,Otapl); + break; + /* instructions type e */ + case _getwork_first_time: + pc = NEXTOP(pc,e); + break; #endif #ifdef TABLING - /* instructions type Otapl */ - case _table_answer_resolution: + /* instructions type Otapl */ + case _table_answer_resolution: #ifdef THREADS_CONSUMER_SHARING - case _table_answer_resolution_completion: + case _table_answer_resolution_completion: #endif - case _table_completion: - case _table_load_answer: - case _table_retry: - case _table_retry_me: - case _table_trust: - case _table_trust_me: - case _table_try: - case _table_try_answer: - case _table_try_me: - case _table_try_single: - clause_code = FALSE; - pp = pc->y_u.Otapl.p; - pc = NEXTOP(pc, Otapl); - break; -/* instructions type e */ + case _table_completion: + case _table_load_answer: + case _table_retry: + case _table_retry_me: + case _table_trust: + case _table_trust_me: + case _table_try: + case _table_try_answer: + case _table_try_me: + case _table_try_single: + clause_code = FALSE; + pp = pc->y_u.Otapl.p; + pc = NEXTOP(pc,Otapl); + break; + /* instructions type e */ #ifdef TABLING_INNER_CUTS - case _clause_with_cut: + case _clause_with_cut: #endif - pc = NEXTOP(pc, e); - break; - /* instructions type s */ - case _table_new_answer: - pc = NEXTOP(pc, s); - break; - /* instructions type e */ - case _trie_do_appl: - case _trie_do_appl_in_pair: - case _trie_do_atom: - case _trie_do_atom_in_pair: - case _trie_do_bigint: - case _trie_do_double: - case _trie_do_extension: - case _trie_do_gterm: - case _trie_do_longint: - case _trie_do_null: - case _trie_do_null_in_pair: - case _trie_do_pair: - case _trie_do_val: - case _trie_do_val_in_pair: - case _trie_do_var: - case _trie_do_var_in_pair: - case _trie_retry_appl: - case _trie_retry_appl_in_pair: - case _trie_retry_atom: - case _trie_retry_atom_in_pair: - case _trie_retry_bigint: - case _trie_retry_double: - case _trie_retry_extension: - case _trie_retry_gterm: - case _trie_retry_longint: - case _trie_retry_null: - case _trie_retry_null_in_pair: - case _trie_retry_pair: - case _trie_retry_val: - case _trie_retry_val_in_pair: - case _trie_retry_var: - case _trie_retry_var_in_pair: - case _trie_trust_appl: - case _trie_trust_appl_in_pair: - case _trie_trust_atom: - case _trie_trust_atom_in_pair: - case _trie_trust_bigint: - case _trie_trust_double: - case _trie_trust_extension: - case _trie_trust_gterm: - case _trie_trust_longint: - case _trie_trust_null: - case _trie_trust_null_in_pair: - case _trie_trust_pair: - case _trie_trust_val: - case _trie_trust_val_in_pair: - case _trie_trust_var: - case _trie_trust_var_in_pair: - case _trie_try_appl: - case _trie_try_appl_in_pair: - case _trie_try_atom: - case _trie_try_atom_in_pair: - case _trie_try_bigint: - case _trie_try_double: - case _trie_try_extension: - case _trie_try_gterm: - case _trie_try_longint: - case _trie_try_null: - case _trie_try_null_in_pair: - case _trie_try_pair: - case _trie_try_val: - case _trie_try_val_in_pair: - case _trie_try_var: - case _trie_try_var_in_pair: - pc = NEXTOP(pc, e); - break; + pc = NEXTOP(pc,e); + break; + /* instructions type s */ + case _table_new_answer: + pc = NEXTOP(pc,s); + break; + /* instructions type e */ + case _trie_do_appl: + case _trie_do_appl_in_pair: + case _trie_do_atom: + case _trie_do_atom_in_pair: + case _trie_do_bigint: + case _trie_do_double: + case _trie_do_extension: + case _trie_do_gterm: + case _trie_do_longint: + case _trie_do_null: + case _trie_do_null_in_pair: + case _trie_do_pair: + case _trie_do_val: + case _trie_do_val_in_pair: + case _trie_do_var: + case _trie_do_var_in_pair: + case _trie_retry_appl: + case _trie_retry_appl_in_pair: + case _trie_retry_atom: + case _trie_retry_atom_in_pair: + case _trie_retry_bigint: + case _trie_retry_double: + case _trie_retry_extension: + case _trie_retry_gterm: + case _trie_retry_longint: + case _trie_retry_null: + case _trie_retry_null_in_pair: + case _trie_retry_pair: + case _trie_retry_val: + case _trie_retry_val_in_pair: + case _trie_retry_var: + case _trie_retry_var_in_pair: + case _trie_trust_appl: + case _trie_trust_appl_in_pair: + case _trie_trust_atom: + case _trie_trust_atom_in_pair: + case _trie_trust_bigint: + case _trie_trust_double: + case _trie_trust_extension: + case _trie_trust_gterm: + case _trie_trust_longint: + case _trie_trust_null: + case _trie_trust_null_in_pair: + case _trie_trust_pair: + case _trie_trust_val: + case _trie_trust_val_in_pair: + case _trie_trust_var: + case _trie_trust_var_in_pair: + case _trie_try_appl: + case _trie_try_appl_in_pair: + case _trie_try_atom: + case _trie_try_atom_in_pair: + case _trie_try_bigint: + case _trie_try_double: + case _trie_try_extension: + case _trie_try_gterm: + case _trie_try_longint: + case _trie_try_null: + case _trie_try_null_in_pair: + case _trie_try_pair: + case _trie_try_val: + case _trie_try_val_in_pair: + case _trie_try_var: + case _trie_try_var_in_pair: + pc = NEXTOP(pc,e); + break; #endif - /* this instruction is hardwired */ - case _or_last: + /* this instruction is hardwired */ + case _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); + 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); + 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 + } } -}