diff --git a/H/findclause.h b/H/findclause.h index b8600b307..2b5eefa45 100644 --- a/H/findclause.h +++ b/H/findclause.h @@ -630,75 +630,75 @@ cl = NEXTOP(cl,xi); break; case _p_atom_x: + if (cl->u.xl.F != FAILCODE) { + clause->Tag = (CELL)NULL; + return; + } if (is_regcopy(myregs, nofregs, cl->u.xl.x)) { clause->Tag = (_atom+1)*sizeof(CELL); clause->u.t_ptr = (CELL)NULL; return; } + cl = NEXTOP(cl,xl); + break; + case _p_atomic_x: if (cl->u.xl.F != FAILCODE) { clause->Tag = (CELL)NULL; return; } - cl = NEXTOP(cl,xl); - break; - case _p_atomic_x: if (is_regcopy(myregs, nofregs, cl->u.xl.x)) { clause->Tag = (_atomic+1)*sizeof(CELL); clause->u.t_ptr = (CELL)NULL; return; } + cl = NEXTOP(cl,xl); + break; + case _p_compound_x: if (cl->u.xl.F != FAILCODE) { clause->Tag = (CELL)NULL; return; } - cl = NEXTOP(cl,xl); - break; - case _p_compound_x: if (is_regcopy(myregs, nofregs, cl->u.xl.x)) { clause->Tag = (_compound+1)*sizeof(CELL); clause->u.t_ptr = (CELL)NULL; return; } + cl = NEXTOP(cl,xl); + break; + case _p_db_ref_x: if (cl->u.xl.F != FAILCODE) { clause->Tag = (CELL)NULL; return; } - cl = NEXTOP(cl,xl); - break; - case _p_db_ref_x: if (is_regcopy(myregs, nofregs, cl->u.xl.x)) { clause->Tag = AbsAppl((CELL *)FunctorDBRef); clause->u.t_ptr = (CELL)NULL; return; } + cl = NEXTOP(cl,xl); + break; + case _p_float_x: if (cl->u.xl.F != FAILCODE) { clause->Tag = (CELL)NULL; return; } - cl = NEXTOP(cl,xl); - break; - case _p_float_x: if (is_regcopy(myregs, nofregs, cl->u.xl.x)) { clause->Tag = AbsAppl((CELL *)FunctorDouble); clause->u.t_ptr = (CELL)NULL; return; } - if (cl->u.xl.F != FAILCODE) { - clause->Tag = (CELL)NULL; - return; - } cl = NEXTOP(cl,xl); break; case _p_integer_x: + if (cl->u.xl.F != FAILCODE) { + clause->Tag = (CELL)NULL; + return; + } if (is_regcopy(myregs, nofregs, cl->u.xl.x)) { clause->Tag = (_integer+1)*sizeof(CELL); clause->u.t_ptr = (CELL)NULL; return; } - if (cl->u.xl.F != FAILCODE) { - clause->Tag = (CELL)NULL; - return; - } cl = NEXTOP(cl,xl); break; case _p_nonvar_x: @@ -709,39 +709,39 @@ cl = NEXTOP(cl,xl); break; case _p_number_x: + if (cl->u.xl.F != FAILCODE) { + clause->Tag = (CELL)NULL; + return; + } if (is_regcopy(myregs, nofregs, cl->u.xl.x)) { clause->Tag = (_number+1)*sizeof(CELL); clause->u.t_ptr = (CELL)NULL; return; } + cl = NEXTOP(cl,xl); + break; + case _p_primitive_x: if (cl->u.xl.F != FAILCODE) { clause->Tag = (CELL)NULL; return; } - cl = NEXTOP(cl,xl); - break; - case _p_primitive_x: if (is_regcopy(myregs, nofregs, cl->u.xl.x)) { clause->Tag = (_primitive+1)*sizeof(CELL); clause->u.t_ptr = (CELL)NULL; return; } - if (cl->u.xl.F != FAILCODE) { - clause->Tag = (CELL)NULL; - return; - } cl = NEXTOP(cl,xl); break; case _p_var_x: + if (cl->u.xl.F != FAILCODE) { + clause->Tag = (CELL)NULL; + return; + } if (is_regcopy(myregs, nofregs, cl->u.xl.x)) { clause->Tag = (_var+1)*sizeof(CELL); clause->u.t_ptr = (CELL)NULL; return; } - if (cl->u.xl.F != FAILCODE) { - clause->Tag = (CELL)NULL; - return; - } cl = NEXTOP(cl,xl); break; case _get_x_val: @@ -1011,75 +1011,75 @@ cl = NEXTOP(cl,y); break; case _p_atom_y: + if (cl->u.yl.F != FAILCODE) { + clause->Tag = (CELL)NULL; + return; + } if (is_regcopy(myregs, nofregs, cl->u.yl.y)) { clause->Tag = (_atom+1)*sizeof(CELL); clause->u.t_ptr = (CELL)NULL; return; } + cl = NEXTOP(cl,yl); + break; + case _p_atomic_y: if (cl->u.yl.F != FAILCODE) { clause->Tag = (CELL)NULL; return; } - cl = NEXTOP(cl,yl); - break; - case _p_atomic_y: if (is_regcopy(myregs, nofregs, cl->u.yl.y)) { clause->Tag = (_atomic+1)*sizeof(CELL); clause->u.t_ptr = (CELL)NULL; return; } + cl = NEXTOP(cl,yl); + break; + case _p_compound_y: if (cl->u.yl.F != FAILCODE) { clause->Tag = (CELL)NULL; return; } - cl = NEXTOP(cl,yl); - break; - case _p_compound_y: if (is_regcopy(myregs, nofregs, cl->u.yl.y)) { clause->Tag = (_compound+1)*sizeof(CELL); clause->u.t_ptr = (CELL)NULL; return; } + cl = NEXTOP(cl,yl); + break; + case _p_db_ref_y: if (cl->u.yl.F != FAILCODE) { clause->Tag = (CELL)NULL; return; } - cl = NEXTOP(cl,yl); - break; - case _p_db_ref_y: if (is_regcopy(myregs, nofregs, cl->u.yl.y)) { clause->Tag = AbsAppl((CELL *)FunctorDBRef); clause->u.t_ptr = (CELL)NULL; return; } + cl = NEXTOP(cl,yl); + break; + case _p_float_y: if (cl->u.yl.F != FAILCODE) { clause->Tag = (CELL)NULL; return; } - cl = NEXTOP(cl,yl); - break; - case _p_float_y: if (is_regcopy(myregs, nofregs, cl->u.yl.y)) { clause->Tag = AbsAppl((CELL *)FunctorDouble); clause->u.t_ptr = (CELL)NULL; return; } - if (cl->u.yl.F != FAILCODE) { - clause->Tag = (CELL)NULL; - return; - } cl = NEXTOP(cl,yl); break; case _p_integer_y: + if (cl->u.yl.F != FAILCODE) { + clause->Tag = (CELL)NULL; + return; + } if (is_regcopy(myregs, nofregs, cl->u.yl.y)) { clause->Tag = (_integer+1)*sizeof(CELL); clause->u.t_ptr = (CELL)NULL; return; } - if (cl->u.yl.F != FAILCODE) { - clause->Tag = (CELL)NULL; - return; - } cl = NEXTOP(cl,yl); break; case _p_nonvar_y: @@ -1090,39 +1090,39 @@ cl = NEXTOP(cl,yl); break; case _p_number_y: + if (cl->u.yl.F != FAILCODE) { + clause->Tag = (CELL)NULL; + return; + } if (is_regcopy(myregs, nofregs, cl->u.yl.y)) { clause->Tag = (_number+1)*sizeof(CELL); clause->u.t_ptr = (CELL)NULL; return; } + cl = NEXTOP(cl,yl); + break; + case _p_primitive_y: if (cl->u.yl.F != FAILCODE) { clause->Tag = (CELL)NULL; return; } - cl = NEXTOP(cl,yl); - break; - case _p_primitive_y: if (is_regcopy(myregs, nofregs, cl->u.yl.y)) { clause->Tag = (_primitive+1)*sizeof(CELL); clause->u.t_ptr = (CELL)NULL; return; } - if (cl->u.yl.F != FAILCODE) { - clause->Tag = (CELL)NULL; - return; - } cl = NEXTOP(cl,yl); break; case _p_var_y: + if (cl->u.yl.F != FAILCODE) { + clause->Tag = (CELL)NULL; + return; + } if (is_regcopy(myregs, nofregs, cl->u.yl.y)) { clause->Tag = (_var+1)*sizeof(CELL); clause->u.t_ptr = (CELL)NULL; return; } - if (cl->u.yl.F != FAILCODE) { - clause->Tag = (CELL)NULL; - return; - } cl = NEXTOP(cl,yl); break; case _get_y_val: diff --git a/misc/buildops b/misc/buildops index db8bcd984..f2ef4069f 100644 --- a/misc/buildops +++ b/misc/buildops @@ -760,24 +760,27 @@ clean_statements(["unsigned"|Statements0], StatementsF) :- !, clean_statements(Statements0, StatementsF). clean_statements(Statements, Statements). -opinfo("p_number_x",[body,bind("x","(_number+1)*sizeof(CELL)",t_ptr=[]),ifthenelse]). -opinfo("p_number_y",[body,bind("y","(_number+1)*sizeof(CELL)",t_ptr=[]),ifthenelse]). -opinfo("p_atomic_x",[body,bind("x","(_atomic+1)*sizeof(CELL)",t_ptr=[]),ifthenelse]). -opinfo("p_atomic_y",[body,bind("y","(_atomic+1)*sizeof(CELL)",t_ptr=[]),ifthenelse]). -opinfo("p_primitive_x",[body,bind("x","(_primitive+1)*sizeof(CELL)",t_ptr=[]),ifthenelse]). -opinfo("p_primitive_y",[body,bind("y","(_primitive+1)*sizeof(CELL)",t_ptr=[]),ifthenelse]). -opinfo("p_compound_x",[body,bind("x","(_compound+1)*sizeof(CELL)",t_ptr=[]),ifthenelse]). -opinfo("p_compound_y",[body,bind("y","(_compound+1)*sizeof(CELL)",t_ptr=[]),ifthenelse]). -opinfo("p_atom_x",[body,bind("x","(_atom+1)*sizeof(CELL)",t_ptr=[]),ifthenelse]). -opinfo("p_atom_y",[body,bind("y","(_atom+1)*sizeof(CELL)",t_ptr=[]),ifthenelse]). -opinfo("p_integer_x",[body,bind("x","(_integer+1)*sizeof(CELL)",t_ptr=[]),ifthenelse]). -opinfo("p_integer_y",[body,bind("y","(_integer+1)*sizeof(CELL)",t_ptr=[]),ifthenelse]). -opinfo("p_float_x",[body,bind("x","AbsAppl((CELL *)FunctorDouble)",t_ptr=[]),ifthenelse]). -opinfo("p_float_y",[body,bind("y","AbsAppl((CELL *)FunctorDouble)",t_ptr=[]),ifthenelse]). -opinfo("p_db_ref_x",[body,bind("x","AbsAppl((CELL *)FunctorDBRef)",t_ptr=[]),ifthenelse]). -opinfo("p_db_ref_y",[body,bind("y","AbsAppl((CELL *)FunctorDBRef)",t_ptr=[]),ifthenelse]). -opinfo("p_var_x",[body,bind("x","(_var+1)*sizeof(CELL)",t_ptr=[]),ifthenelse]). -opinfo("p_var_y",[body,bind("y","(_var+1)*sizeof(CELL)",t_ptr=[]),ifthenelse]). +% +% Notice that order matters: for example ifthenelse should be tested before a bind +% +opinfo("p_number_x",[body,ifthenelse,bind("x","(_number+1)*sizeof(CELL)",t_ptr=[])]). +opinfo("p_number_y",[body,ifthenelse,bind("y","(_number+1)*sizeof(CELL)",t_ptr=[])]). +opinfo("p_atomic_x",[body,ifthenelse,bind("x","(_atomic+1)*sizeof(CELL)",t_ptr=[])]). +opinfo("p_atomic_y",[body,ifthenelse,bind("y","(_atomic+1)*sizeof(CELL)",t_ptr=[])]). +opinfo("p_primitive_x",[body,ifthenelse,bind("x","(_primitive+1)*sizeof(CELL)",t_ptr=[])]). +opinfo("p_primitive_y",[body,ifthenelse,bind("y","(_primitive+1)*sizeof(CELL)",t_ptr=[])]). +opinfo("p_compound_x",[body,ifthenelse,bind("x","(_compound+1)*sizeof(CELL)",t_ptr=[])]). +opinfo("p_compound_y",[body,ifthenelse,bind("y","(_compound+1)*sizeof(CELL)",t_ptr=[])]). +opinfo("p_atom_x",[body,ifthenelse,bind("x","(_atom+1)*sizeof(CELL)",t_ptr=[])]). +opinfo("p_atom_y",[body,ifthenelse,bind("y","(_atom+1)*sizeof(CELL)",t_ptr=[])]). +opinfo("p_integer_x",[body,ifthenelse,bind("x","(_integer+1)*sizeof(CELL)",t_ptr=[])]). +opinfo("p_integer_y",[body,ifthenelse,bind("y","(_integer+1)*sizeof(CELL)",t_ptr=[])]). +opinfo("p_float_x",[body,ifthenelse,bind("x","AbsAppl((CELL *)FunctorDouble)",t_ptr=[])]). +opinfo("p_float_y",[body,ifthenelse,bind("y","AbsAppl((CELL *)FunctorDouble)",t_ptr=[])]). +opinfo("p_db_ref_x",[body,ifthenelse,bind("x","AbsAppl((CELL *)FunctorDBRef)",t_ptr=[])]). +opinfo("p_db_ref_y",[body,ifthenelse,bind("y","AbsAppl((CELL *)FunctorDBRef)",t_ptr=[])]). +opinfo("p_var_x",[body,ifthenelse,bind("x","(_var+1)*sizeof(CELL)",t_ptr=[])]). +opinfo("p_var_y",[body,ifthenelse,bind("y","(_var+1)*sizeof(CELL)",t_ptr=[])]). opinfo("p_nonvar_x",[body,ifthenelse]). opinfo("p_nonvar_y",[body,ifthenelse]). opinfo("save_b_x",[body,new("x")]).