From 2867b43f0654082499baa564920c715e3022488c Mon Sep 17 00:00:00 2001 From: vsc Date: Fri, 28 Nov 2003 01:26:53 +0000 Subject: [PATCH] absmi.c: no need to reload CACHED_A1() during expand, and doing so will destroy S and break RISC alloc.c: guarantee alignment by 8 for SPARC32 iopreds.c: get rid of unnecessary decl\ git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@938 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- C/absmi.c | 5 ++--- C/alloc.c | 11 ++++++++++- C/iopreds.c | 1 - m4/Yatom.h.m4 | 4 +++- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/C/absmi.c b/C/absmi.c index 314e16c25..71ab1f767 100644 --- a/C/absmi.c +++ b/C/absmi.c @@ -6389,12 +6389,11 @@ Yap_absmi(int inp) if (ASP > (CELL *) B) { ASP = (CELL *) B; } - saveregs(); + saveregs(); pt0 = Yap_ExpandIndex(pe); /* restart index */ setregs(); - PREG = pt0; - CACHED_A1() = ARG1; + PREG = pt0; JMPNext(); } ENDBOp(); diff --git a/C/alloc.c b/C/alloc.c index 9c0721633..e394a44bc 100644 --- a/C/alloc.c +++ b/C/alloc.c @@ -12,7 +12,7 @@ * Last rev: * * mods: * * comments: allocating space * -* version:$Id: alloc.c,v 1.41 2003-11-12 12:33:30 vsc Exp $ * +* version:$Id: alloc.c,v 1.42 2003-11-28 01:26:53 vsc Exp $ * *************************************************************************/ #ifdef SCCS static char SccsId[] = "%W% %G%"; @@ -255,6 +255,14 @@ AllocHeap(unsigned int size) #endif if (size < (sizeof(YAP_SEG_SIZE)+sizeof(BlockHeader))/sizeof(CELL)) size = (sizeof(YAP_SEG_SIZE)+sizeof(BlockHeader))/sizeof(CELL); +#if SIZEOF_INT_P==4 + /* + guarantee that the space seen by the user is always aligned at multiples + of a double word. This improves alignment, and guarantees correctness + for machines which require aligned 64 bits, such as SPARCs. + */ + if ((size & 1) == 0) size++; +#endif LOCK(FreeBlocksLock); if ((b = GetBlock(size))) { if (b->b_size >= size + 6 + 1) { @@ -1048,6 +1056,7 @@ InitHeap(void *heap_addr) HeapMax = HeapUsed = HeapTop-Yap_HeapBase; + /* notice that this forces odd addresses */ *((YAP_SEG_SIZE *) HeapTop) = InUseFlag; HeapTop = HeapTop + sizeof(YAP_SEG_SIZE); *((YAP_SEG_SIZE *) HeapTop) = InUseFlag; diff --git a/C/iopreds.c b/C/iopreds.c index dbec2919f..ce01ea512 100644 --- a/C/iopreds.c +++ b/C/iopreds.c @@ -132,7 +132,6 @@ STATIC_PROTO (Int p_current_input, (void)); STATIC_PROTO (Int p_current_output, (void)); STATIC_PROTO (Int p_write, (void)); STATIC_PROTO (Int p_write2, (void)); -STATIC_PROTO (Int p_inform_of_clause, (void)); STATIC_PROTO (Int p_set_read_error_handler, (void)); STATIC_PROTO (Int p_get_read_error_handler, (void)); STATIC_PROTO (Int p_read, (void)); diff --git a/m4/Yatom.h.m4 b/m4/Yatom.h.m4 index 70effb8e7..eb2b1f49d 100644 --- a/m4/Yatom.h.m4 +++ b/m4/Yatom.h.m4 @@ -229,7 +229,6 @@ typedef struct pred_entry { Int IndxId; /* Index for a certain key */ struct mfile *file_srcs; /* for multifile predicates */ } src; - struct pred_entry *NextPredOfModule; /* next pred for same module */ #if defined(YAPOR) || defined(THREADS) rwlock_t PRWLock; /* a simple lock to protect this entry */ #endif @@ -237,7 +236,10 @@ typedef struct pred_entry { tab_ent_ptr TableOfPred; #endif /* TABLING */ SMALLUNSGN ModuleOfPred; /* module for this definition */ + /* This must be at an odd number of cells, otherwise it + will not be aligned on RISC machines */ profile_data StatisticsForPred; /* enable profiling for predicate */ + struct pred_entry *NextPredOfModule; /* next pred for same module */ } PredEntry; #define PEProp ((PropFlags)(0x0000))