include declarations (small changes)

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1326 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
ricroc 2005-06-03 18:28:11 +00:00
parent e7dc1c2e36
commit c665fa8c11
9 changed files with 148 additions and 178 deletions

View File

@ -5,7 +5,7 @@
Copyright: R. Rocha and NCC - University of Porto, Portugal Copyright: R. Rocha and NCC - University of Porto, Portugal
File: opt.config.h File: opt.config.h
version: $Id: opt.config.h,v 1.5 2005-05-31 08:24:24 ricroc Exp $ version: $Id: opt.config.h,v 1.6 2005-06-03 18:28:11 ricroc Exp $
**********************************************************************/ **********************************************************************/
@ -13,6 +13,9 @@
** Configuration Parameters ** ** Configuration Parameters **
** ---------------------------------- */ ** ---------------------------------- */
/* --------------- **
** sizes **
** --------------- */
#define MAX_LENGTH_ANSWER 500 #define MAX_LENGTH_ANSWER 500
#define MAX_DEPTH 1000 #define MAX_DEPTH 1000
#define MAX_BEST_TIMES 21 #define MAX_BEST_TIMES 21
@ -20,85 +23,21 @@
#define TABLE_LOCK_BUCKETS 512 #define TABLE_LOCK_BUCKETS 512
#define TG_ANSWER_SLOTS 20 #define TG_ANSWER_SLOTS 20
/* ---------------------------- **
** memory (define one) **
** ---------------------------- */
#define MMAP_MEMORY_MAPPING_SCHEME 1
/* #define SHM_MEMORY_MAPPING_SCHEME 1 */
/* /* ------------------------------------- **
#define STATISTICS 1 ** freezing trail (define one) **
#define YAPOR_ERRORS 1 ** ------------------------------------- */
#define TABLING_ERRORS 1
*/
/* amiops.h - absmi.h */
#define BFZ_TRAIL_SCHEME 1 #define BFZ_TRAIL_SCHEME 1
/* /* #define BBREG_TRAIL_SCHEME 1 */
#define BBREG_TRAIL_SCHEME 1
*/
/* tab.tries.c */
/*
#define ALLOC_BEFORE_CHECK 1
*/
#define TABLE_LOCK_AT_WRITE_LEVEL 1
/*
#define TABLE_LOCK_AT_ENTRY_LEVEL 1
#define TABLE_LOCK_AT_NODE_LEVEL 1
*/
#define TABLING_INNER_CUTS 1
#define TIMESTAMP_CHECK 1
/* -------------------------- **
** Parameter Checks **
** -------------------------- */
#ifndef YAPOR
#undef YAPOR_ERRORS
#endif
#ifndef TABLING
#undef TABLING_ERRORS
#endif
#if defined(YAPOR_ERRORS) && defined(TABLING_ERRORS)
#define OPTYAP_ERRORS
#endif
#ifdef TABLING
#if !defined(BFZ_TRAIL_SCHEME) && !defined(BBREG_TRAIL_SCHEME)
#error Define a trail scheme
#endif
#if defined(BFZ_TRAIL_SCHEME) && defined(BBREG_TRAIL_SCHEME)
#error Do not define multiple trail schemes
#endif
#else
#undef BFZ_TRAIL_SCHEME
#undef BBREG_TRAIL_SCHEME
#endif
#if !defined(TABLING) || !defined(YAPOR)
#undef TABLING_INNER_CUTS
#endif
#if !defined(YAPOR) || !defined(TABLING)
#undef TIMESTAMP_CHECK
#endif
/* ------------------------------------------------------------------ ** /* ------------------------------------------------------------------ **
** ** ** locking tries (define one) **
** There are three lock schemes to access the table space. ** ** ------------------------------------------------------------------ **
** **
** The TABLE_LOCK_AT_ENTRY_LEVEL scheme locks the access to the table ** ** The TABLE_LOCK_AT_ENTRY_LEVEL scheme locks the access to the table **
** space in the entry data structure. It restricts the number of lock ** ** space in the entry data structure. It restricts the number of lock **
** operations needed to go through the table data structures. ** ** operations needed to go through the table data structures. **
@ -108,31 +47,96 @@
** accessing commom parts of the table space. ** ** accessing commom parts of the table space. **
** ** ** **
** The TABLE_LOCK_AT_WRITE_LEVEL scheme is an hibrid scheme, it only ** ** The TABLE_LOCK_AT_WRITE_LEVEL scheme is an hibrid scheme, it only **
** locks a table data structure when it is going to update it. ** ** locks a table data structure when it is going to update it. You **
** ** ** can use ALLOC_BEFORE_CHECK with this scheme to allocate a node **
** The TABLE_LOCK_AT_WRITE_LEVEL is the default scheme. ** ** before checking if it will be necessary. **
** **
** ------------------------------------------------------------------ */ ** ------------------------------------------------------------------ */
#define TABLE_LOCK_AT_WRITE_LEVEL 1
/* #define TABLE_LOCK_AT_ENTRY_LEVEL 1 */
/* #define TABLE_LOCK_AT_NODE_LEVEL 1 */
/* #define ALLOC_BEFORE_CHECK 1 */
/* ------------------------ **
** cuts (optional) **
** ------------------------ */
#define TABLING_INNER_CUTS 1
/* ------------------------------ **
** suspension (optional) **
** ------------------------------ */
#define TIMESTAMP_CHECK 1
/* ----------------------------- **
** debugging (optional) **
** ----------------------------- */
/* #define STATISTICS 1 */
/* #define YAPOR_ERRORS 1 */
/* #define TABLING_ERRORS 1 */
/* -------------------------- **
** Parameter Checks **
** -------------------------- */
#ifdef YAPOR
#ifdef i386 /* For i386 machines we use shared memory segments */
#undef MMAP_MEMORY_MAPPING_SCHEME
#define SHM_MEMORY_MAPPING_SCHEME
#endif /* i386 */
#if !defined(MMAP_MEMORY_MAPPING_SCHEME) && !defined(SHM_MEMORY_MAPPING_SCHEME)
#error Define a memory mapping scheme
#endif /* !MMAP_MEMORY_MAPPING_SCHEME && !SHM_MEMORY_MAPPING_SCHEME */
#if defined(MMAP_MEMORY_MAPPING_SCHEME) && defined(SHM_MEMORY_MAPPING_SCHEME)
#error Do not define multiple memory mapping schemes
#endif /* MMAP_MEMORY_MAPPING_SCHEME && SHM_MEMORY_MAPPING_SCHEME */
#endif /* YAPOR */
#ifdef TABLING
#if !defined(BFZ_TRAIL_SCHEME) && !defined(BBREG_TRAIL_SCHEME)
#error Define a trail scheme
#endif /* !BFZ_TRAIL_SCHEME && !BBREG_TRAIL_SCHEME */
#if defined(BFZ_TRAIL_SCHEME) && defined(BBREG_TRAIL_SCHEME)
#error Do not define multiple trail schemes
#endif /* BFZ_TRAIL_SCHEME && BBREG_TRAIL_SCHEME */
#else
#undef BFZ_TRAIL_SCHEME
#undef BBREG_TRAIL_SCHEME
#endif /* TABLING */
#if defined(YAPOR) && defined(TABLING) #if defined(YAPOR) && defined(TABLING)
#if !defined(TABLE_LOCK_AT_ENTRY_LEVEL) && !defined(TABLE_LOCK_AT_NODE_LEVEL) && !defined(TABLE_LOCK_AT_WRITE_LEVEL) #if !defined(TABLE_LOCK_AT_ENTRY_LEVEL) && !defined(TABLE_LOCK_AT_NODE_LEVEL) && !defined(TABLE_LOCK_AT_WRITE_LEVEL)
#error Define a table lock scheme #error Define a table lock scheme
#endif #endif /* !TABLE_LOCK_AT_ENTRY_LEVEL && !TABLE_LOCK_AT_NODE_LEVEL && !TABLE_LOCK_AT_WRITE_LEVEL */
#if defined(TABLE_LOCK_AT_ENTRY_LEVEL) #if defined(TABLE_LOCK_AT_ENTRY_LEVEL)
#if defined(TABLE_LOCK_AT_NODE_LEVEL) || defined(TABLE_LOCK_AT_WRITE_LEVEL) #if defined(TABLE_LOCK_AT_NODE_LEVEL) || defined(TABLE_LOCK_AT_WRITE_LEVEL)
#error Do not define multiple table lock schemes #error Do not define multiple table lock schemes
#endif #endif /* TABLE_LOCK_AT_NODE_LEVEL || TABLE_LOCK_AT_WRITE_LEVEL */
#endif #endif /* TABLE_LOCK_AT_ENTRY_LEVEL */
#if defined(TABLE_LOCK_AT_NODE_LEVEL) && defined(TABLE_LOCK_AT_WRITE_LEVEL) #if defined(TABLE_LOCK_AT_NODE_LEVEL) && defined(TABLE_LOCK_AT_WRITE_LEVEL)
#error Do not define multiple table lock schemes #error Do not define multiple table lock schemes
#endif #endif /* TABLE_LOCK_AT_NODE_LEVEL || TABLE_LOCK_AT_WRITE_LEVEL */
#ifndef TABLE_LOCK_AT_WRITE_LEVEL
#undef ALLOC_BEFORE_CHECK
#endif /* !TABLE_LOCK_AT_WRITE_LEVEL */
#else #else
#undef TABLE_LOCK_AT_ENTRY_LEVEL #undef TABLE_LOCK_AT_ENTRY_LEVEL
#undef TABLE_LOCK_AT_NODE_LEVEL #undef TABLE_LOCK_AT_NODE_LEVEL
#undef TABLE_LOCK_AT_WRITE_LEVEL #undef TABLE_LOCK_AT_WRITE_LEVEL
#undef ALLOC_BEFORE_CHECK
#endif /* YAPOR && TABLING */ #endif /* YAPOR && TABLING */
#if !defined(TABLING) || !defined(YAPOR)
#undef TABLING_INNER_CUTS
#undef TIMESTAMP_CHECK
#endif /* !TABLING || !YAPOR */
#ifndef TABLE_LOCK_AT_WRITE_LEVEL #ifndef YAPOR
#undef ALLOC_BEFORE_CHECK #undef YAPOR_ERRORS
#endif #endif /* !YAPOR */
#ifndef TABLING
#undef TABLING_ERRORS
#endif /* !TABLING */
#if defined(YAPOR_ERRORS) && defined(TABLING_ERRORS)
#define OPTYAP_ERRORS
#endif /* YAPOR_ERRORS && TABLING_ERRORS */

View File

@ -5,7 +5,7 @@
Copyright: R. Rocha and NCC - University of Porto, Portugal Copyright: R. Rocha and NCC - University of Porto, Portugal
File: opt.init.c File: opt.init.c
version: $Id: opt.init.c,v 1.6 2005-05-31 08:24:24 ricroc Exp $ version: $Id: opt.init.c,v 1.7 2005-06-03 18:28:11 ricroc Exp $
**********************************************************************/ **********************************************************************/
@ -14,10 +14,8 @@
** ------------------ */ ** ------------------ */
#include "Yap.h" #include "Yap.h"
#define OPT_MAVAR_STATIC
#if defined(YAPOR) || defined(TABLING) #if defined(YAPOR) || defined(TABLING)
#define OPT_MAVAR_STATIC
#include "Yatom.h" #include "Yatom.h"
#include "Heap.h" #include "Heap.h"
#include <unistd.h> #include <unistd.h>
@ -28,24 +26,16 @@
#ifdef TABLING #ifdef TABLING
#include "tab.macros.h" #include "tab.macros.h"
#endif /* TABLING */ #endif /* TABLING */
#if defined(TABLING) || !defined(ACOW) #if defined(TABLING) || !defined(ACOW)
#ifndef TABLING #ifndef TABLING
#include "opt.mavar.h" #include "opt.mavar.h"
#endif #endif /* !TABLING */
#ifdef MULTI_ASSIGNMENT_VARIABLES #ifdef MULTI_ASSIGNMENT_VARIABLES
ma_hash_entry ma_hash_table[MAVARS_HASH_SIZE]; ma_hash_entry ma_hash_table[MAVARS_HASH_SIZE];
UInt timestamp; /* an unsigned int */ UInt timestamp; /* an unsigned int */
ma_h_inner_struct *ma_h_top; ma_h_inner_struct *ma_h_top;
#endif /* MULTI_ASSIGNMENT_VARIABLES */ #endif /* MULTI_ASSIGNMENT_VARIABLES */
#endif #endif /* TABLING || !ACOW */
#ifdef ACOW #ifdef ACOW
#include "sys/wait.h" #include "sys/wait.h"
#endif /* ACOW */ #endif /* ACOW */

View File

@ -5,44 +5,16 @@
Copyright: R. Rocha and NCC - University of Porto, Portugal Copyright: R. Rocha and NCC - University of Porto, Portugal
File: opt.memory.c File: opt.memory.c
version: $Id: opt.memory.c,v 1.8 2005-05-31 08:24:24 ricroc Exp $ version: $Id: opt.memory.c,v 1.9 2005-06-03 18:28:11 ricroc Exp $
**********************************************************************/ **********************************************************************/
/* ------------------------------------------------------ **
** **
** By default we use mmap to map memory. **
** For i386 machines we use shared memory segments (shm). **
** **
** ------------------------------------------------------ */
#define MMAP_MEMORY_MAPPING_SCHEME
#ifdef i386
#undef MMAP_MEMORY_MAPPING_SCHEME
#define SHM_MEMORY_MAPPING_SCHEME
#endif /* i386 */
#if !defined(MMAP_MEMORY_MAPPING_SCHEME) && !defined(SHM_MEMORY_MAPPING_SCHEME)
#error Define a memory mapping scheme
#endif /* !MMAP_MEMORY_MAPPING_SCHEME && !SHM_MEMORY_MAPPING_SCHEME */
#if defined(MMAP_MEMORY_MAPPING_SCHEME) && defined(SHM_MEMORY_MAPPING_SCHEME)
#error Do not define multiple memory mapping schemes
#endif /* MMAP_MEMORY_MAPPING_SCHEME && SHM_MEMORY_MAPPING_SCHEME */
/* -------------------------------------- ** /* -------------------------------------- **
** Includes and local variables ** ** Includes and local variables **
** -------------------------------------- */ ** -------------------------------------- */
#include "Yap.h" #include "Yap.h"
#ifdef YAPOR #ifdef YAPOR
#include "Yatom.h"
#include "Heap.h"
#include "alloc.h"
#include "heapgc.h"
#include <signal.h> #include <signal.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
@ -52,6 +24,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <sys/shm.h> #include <sys/shm.h>
#include <sys/mman.h> #include <sys/mman.h>
#include "Yatom.h"
#include "Heap.h"
#include "alloc.h"
#include "heapgc.h"
#define KBYTES 1024 #define KBYTES 1024

View File

@ -5,7 +5,7 @@
Copyright: R. Rocha and NCC - University of Porto, Portugal Copyright: R. Rocha and NCC - University of Porto, Portugal
File: opt.misc.c File: opt.misc.c
version: $Id: opt.misc.c,v 1.10 2005-05-31 08:24:24 ricroc Exp $ version: $Id: opt.misc.c,v 1.11 2005-06-03 18:28:11 ricroc Exp $
**********************************************************************/ **********************************************************************/
@ -18,14 +18,14 @@
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "Yatom.h"
#include "yapio.h"
#if HAVE_UNISTD_H #if HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif /* HAVE_UNISTD_H */
#if HAVE_STDARG_H #if HAVE_STDARG_H
#include <stdarg.h> #include <stdarg.h>
#endif #endif /* HAVE_STDARG_H */
#include "Yatom.h"
#include "yapio.h"
@ -89,5 +89,4 @@ void error_message(const char *mesg, ...) {
return; return;
} }
#endif /* YAPOR_ERRORS || TABLING_ERRORS */ #endif /* YAPOR_ERRORS || TABLING_ERRORS */
#endif /* YAPOR || TABLING */ #endif /* YAPOR || TABLING */

View File

@ -5,7 +5,7 @@
Copyright: R. Rocha and NCC - University of Porto, Portugal Copyright: R. Rocha and NCC - University of Porto, Portugal
File: opt.preds.c File: opt.preds.c
version: $Id: opt.preds.c,v 1.16 2005-06-03 08:19:17 ricroc Exp $ version: $Id: opt.preds.c,v 1.17 2005-06-03 18:28:11 ricroc Exp $
**********************************************************************/ **********************************************************************/
@ -16,16 +16,16 @@
#include "Yap.h" #include "Yap.h"
#if defined(YAPOR) || defined(TABLING) #if defined(YAPOR) || defined(TABLING)
#include <stdio.h> #include <stdio.h>
#if HAVE_STRING_H
#include <string.h>
#endif /* HAVE_STRING_H */
#include "Yatom.h" #include "Yatom.h"
#include "Heap.h" #include "Heap.h"
#include "yapio.h" #include "yapio.h"
#if HAVE_STRING_H
#include <string.h>
#endif
#ifdef YAPOR #ifdef YAPOR
#if HAVE_SYS_TIME_H #if HAVE_SYS_TIME_H
#include <sys/time.h> #include <sys/time.h>
#endif #endif /* HAVE_SYS_TIME_H */
#include "or.macros.h" #include "or.macros.h"
#endif /* YAPOR */ #endif /* YAPOR */
#ifdef TABLING #ifdef TABLING

View File

@ -21,12 +21,13 @@
#include "Yap.h" #include "Yap.h"
#ifdef ACOW #ifdef ACOW
#include "Yatom.h"
#include "Heap.h"
#include "or.macros.h"
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#include <stdio.h> #include <stdio.h>
#include "Yatom.h"
#include "Heap.h"
#include "or.macros.h"

View File

@ -5,7 +5,7 @@
Copyright: R. Rocha and NCC - University of Porto, Portugal Copyright: R. Rocha and NCC - University of Porto, Portugal
File: or.engine.c File: or.engine.c
version: $Id: or.engine.c,v 1.9 2005-05-31 08:24:24 ricroc Exp $ version: $Id: or.engine.c,v 1.10 2005-06-03 18:28:11 ricroc Exp $
**********************************************************************/ **********************************************************************/
@ -15,12 +15,12 @@
#include "Yap.h" #include "Yap.h"
#ifdef ENV_COPY #ifdef ENV_COPY
#ifdef HAVE_STRING_H
#include <string.h>
#endif /* HAVE_STRING_H */
#include "Yatom.h" #include "Yatom.h"
#include "Heap.h" #include "Heap.h"
#include "or.macros.h" #include "or.macros.h"
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef TABLING #ifdef TABLING
#include "tab.macros.h" #include "tab.macros.h"
#else #else

View File

@ -21,12 +21,14 @@
#include "Yap.h" #include "Yap.h"
#ifdef SBA #ifdef SBA
#include <stdio.h>
#include "Yatom.h" #include "Yatom.h"
#include "Heap.h" #include "Heap.h"
#include "or.macros.h" #include "or.macros.h"
#include <stdio.h>
#include "opt.mavar.h" #include "opt.mavar.h"
/* ------------------------------------- ** /* ------------------------------------- **
** Local functions declaration ** ** Local functions declaration **
** ------------------------------------- */ ** ------------------------------------- */
@ -340,5 +342,4 @@ void share_private_nodes(int worker_q) {
/* update load and return */ /* update load and return */
REMOTE_load(worker_q) = LOCAL_load = 0; REMOTE_load(worker_q) = LOCAL_load = 0;
} }
#endif /* SBA */ #endif /* SBA */

View File

@ -5,40 +5,39 @@
Copyright: R. Rocha and NCC - University of Porto, Portugal Copyright: R. Rocha and NCC - University of Porto, Portugal
File: tab.tries.insts.i File: tab.tries.insts.i
version: $Id: tab.tries.insts.i,v 1.7 2005-06-03 08:19:18 ricroc Exp $ version: $Id: tab.tries.insts.i,v 1.8 2005-06-03 18:28:11 ricroc Exp $
**********************************************************************/ **********************************************************************/
/* ----------------------------------------------- ** /* ----------------------------------------------- **
** Trie instructions: stack organization ** ** Trie instructions: stack organization **
** ----------------------------------------------- **
-------------------
| ha = heap_arity |
------------------- --
| heap ptr 1 | |
------------------- |
| ... | -- heap_arity
------------------- |
| heap ptr ha | |
------------------- --
| va = vars_arity |
-------------------
| sa = subs_arity |
------------------- --
| subs ptr sa | |
------------------- |
| ... | -- subs_arity
------------------- |
| subs ptr 1 | |
------------------- --
| var ptr va | |
------------------- |
| ... | -- vars_arity
------------------- |
| var ptr 1 | |
------------------- --
** ----------------------------------------------- */ ** ----------------------------------------------- */
/*
** -------------------
** | ha = heap_arity |
** ------------------- --
** | heap ptr 1 | |
** ------------------- |
** | ... | -- heap_arity
** ------------------- |
** | heap ptr ha | |
** ------------------- --
** | va = vars_arity |
** -------------------
** | sa = subs_arity |
** ------------------- --
** | subs ptr sa | |
** ------------------- |
** | ... | -- subs_arity
** ------------------- |
** | subs ptr 1 | |
** ------------------- --
** | var ptr va | |
** ------------------- |
** | ... | -- vars_arity
** ------------------- |
** | var ptr 1 | |
** ------------------- --
*/