From 8f69c35e7f06a62bc670b64da28dc0be5aaa06a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Mon, 1 Sep 2008 16:48:05 +0100 Subject: [PATCH] optime access to execute_cpred --- C/cdmgr.c | 18 +++++++++--------- C/exec.c | 2 +- C/init.c | 1 + H/Heap.h | 3 ++- H/rheap.h | 1 + 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/C/cdmgr.c b/C/cdmgr.c index 2037864f8..ae9180113 100644 --- a/C/cdmgr.c +++ b/C/cdmgr.c @@ -4975,7 +4975,7 @@ fetch_next_lu_clause(PredEntry *pe, yamop *i_code, Term th, Term tb, Term tr, ya } /* don't need no ENV */ if (first_time && - P->opc != Yap_opcode(_execute_cpred)) { + P->opc != EXECUTE_CPRED_OP_CODE) { CP = P; ENV = YENV; YENV = ASP; @@ -5046,7 +5046,7 @@ p_log_update_clause(void) Int ret; yamop *new_cp; - if (P->opc == Yap_opcode(_execute_cpred)) { + if (P->opc == EXECUTE_CPRED_OP_CODE) { new_cp = CP; } else { new_cp = P; @@ -5116,7 +5116,7 @@ fetch_next_lu_clause_erase(PredEntry *pe, yamop *i_code, Term th, Term tb, Term } /* don't need no ENV */ if (first_time && - P->opc != Yap_opcode(_execute_cpred)) { + P->opc != EXECUTE_CPRED_OP_CODE) { CP = P; ENV = YENV; YENV = ASP; @@ -5191,7 +5191,7 @@ p_log_update_clause_erase(void) Int ret; yamop *new_cp; - if (P->opc == Yap_opcode(_execute_cpred)) { + if (P->opc == EXECUTE_CPRED_OP_CODE) { new_cp = CP; } else { new_cp = P; @@ -5247,7 +5247,7 @@ fetch_next_lu_clause0(PredEntry *pe, yamop *i_code, Term th, Term tb, yamop *cp_ } /* don't need no ENV */ if (first_time && - P->opc != Yap_opcode(_execute_cpred)) { + P->opc != EXECUTE_CPRED_OP_CODE) { CP = P; ENV = YENV; YENV = ASP; @@ -5301,7 +5301,7 @@ p_log_update_clause0(void) Int ret; yamop *new_cp; - if (P->opc == Yap_opcode(_execute_cpred)) { + if (P->opc == EXECUTE_CPRED_OP_CODE) { new_cp = CP; } else { new_cp = P; @@ -5529,7 +5529,7 @@ fetch_next_static_clause(PredEntry *pe, yamop *i_code, Term th, Term tb, Term tr XREGS[i+1] = pt[i]; } /* don't need no ENV */ - if (first_time && P->opc != Yap_opcode(_execute_cpred)) { + if (first_time && P->opc != EXECUTE_CPRED_OP_CODE) { CP = P; ENV = YENV; YENV = ASP; @@ -5555,7 +5555,7 @@ fetch_next_static_clause(PredEntry *pe, yamop *i_code, Term th, Term tb, Term tr } /* don't need no ENV */ if (first_time && - P->opc != Yap_opcode(_execute_cpred)) { + P->opc != EXECUTE_CPRED_OP_CODE) { CP = P; ENV = YENV; YENV = ASP; @@ -5632,7 +5632,7 @@ p_static_clause(void) Term t1 = Deref(ARG1); yamop * new_cp; - if (P->opc == Yap_opcode(_execute_cpred)) { + if (P->opc == EXECUTE_CPRED_OP_CODE) { new_cp = CP; } else { new_cp = P; diff --git a/C/exec.c b/C/exec.c index 9e62c0f76..30335a1f0 100644 --- a/C/exec.c +++ b/C/exec.c @@ -69,7 +69,7 @@ CallPredicate(PredEntry *pen, choiceptr cut_pt, yamop *code) { } else if (pen->ModuleOfPred) DEPTH -= MkIntConstant(2); #endif /* DEPTH_LIMIT */ - if (P->opc != Yap_opcode(_execute_cpred)) { + if (P->opc != EXECUTE_CPRED_OP_CODE) { CP = P; ENV = YENV; YENV = ASP; diff --git a/C/init.c b/C/init.c index cca200073..94ad867cc 100644 --- a/C/init.c +++ b/C/init.c @@ -927,6 +927,7 @@ InitCodes(void) INIT_YAMOP_LTT(&(Yap_heap_regs->table_answer_resolution_code), 0); #endif /* YAPOR */ #endif /* TABLING */ + Yap_heap_regs->execute_cpred_op_code = Yap_opcode(_execute_cpred); Yap_heap_regs->expand_op_code = Yap_opcode(_expand_index); INIT_LOCK(Yap_heap_regs->expand_clauses_list_lock); #ifdef LOW_LEVEL_TRACER diff --git a/H/Heap.h b/H/Heap.h index ba5c18972..d5bea8205 100644 --- a/H/Heap.h +++ b/H/Heap.h @@ -251,7 +251,7 @@ typedef struct various_codes { yamop table_answer_resolution_code; yamop table_completion_code; #endif /* TABLING */ - OPCODE expand_op_code; + OPCODE execute_cpred_op_code, expand_op_code; yamop *expand_clauses_first, *expand_clauses_last; UInt expand_clauses; #if defined(YAPOR) || defined(THREADS) @@ -629,6 +629,7 @@ extern struct various_codes *Yap_heap_regs; #define ANSWER_RESOLUTION ((yamop *)&(Yap_heap_regs->table_answer_resolution_code)) #define COMPLETION ((yamop *)&(Yap_heap_regs->table_completion_code)) #endif /* TABLING */ +#define EXECUTE_CPRED_OP_CODE Yap_heap_regs->execute_cpred_op_code #define EXPAND_OP_CODE Yap_heap_regs->expand_op_code #define ExpandClausesFirst Yap_heap_regs->expand_clauses_first #define ExpandClausesLast Yap_heap_regs->expand_clauses_last diff --git a/H/rheap.h b/H/rheap.h index dff0822e9..deab29360 100644 --- a/H/rheap.h +++ b/H/rheap.h @@ -623,6 +623,7 @@ restore_codes(void) INIT_YAMOP_LTT(&(Yap_heap_regs->table_answer_resolution_code), 0); #endif /* YAPOR */ #endif /* TABLING */ + Yap_heap_regs->execute_cpred_op_code = Yap_opcode(_execute_cpred); Yap_heap_regs->expand_op_code = Yap_opcode(_expand_index); if (Yap_heap_regs->expand_clauses_first) Yap_heap_regs->expand_clauses_first = PtoOpAdjust(Yap_heap_regs->expand_clauses_first);