From 0dd21aab718954f3510f99f91996fd96da04caec Mon Sep 17 00:00:00 2001 From: vsc Date: Tue, 1 Apr 2008 22:28:41 +0000 Subject: [PATCH] put YAPOR back to life. git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2187 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- C/alloc.c | 18 +++--------------- C/amasm.c | 31 +++++++++++++------------------ C/cdmgr.c | 11 ++++------- H/Heap.h | 10 +--------- configure | 5 ++++- configure.in | 5 ++++- 6 files changed, 29 insertions(+), 51 deletions(-) diff --git a/C/alloc.c b/C/alloc.c index d740ffc62..7b3c6bc5f 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.90 2008-03-25 16:45:52 vsc Exp $ * +* version:$Id: alloc.c,v 1.91 2008-04-01 22:28:41 vsc Exp $ * *************************************************************************/ #ifdef SCCS static char SccsId[] = "%W% %G%"; @@ -136,6 +136,8 @@ Yap_FreeAtomSpace(char *p) Yap_PrologMode &= ~MallocMode; } +#endif + /* If you need to dinamically allocate space from the heap, this is * the macro you should use */ ADDR @@ -199,8 +201,6 @@ Yap_ExpandPreAllocCodeSpace(UInt sz0, void *cip) return ptr; } -#endif - #if USE_SYSTEM_MALLOC struct various_codes *Yap_heap_regs; @@ -651,18 +651,6 @@ Yap_AllocCodeSpace(unsigned int size) return out; } -ADDR -Yap_ExpandPreAllocCodeSpace(UInt sz, void *cip) -{ - if (sz < SCRATCH_INC_SIZE) - sz = SCRATCH_INC_SIZE; - sz = AdjustLargePageSize(sz+sz/4); - if (!Yap_growheap((cip!=NULL), sz, cip)) { - Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage); - return NULL; - } - return Addr(HeapTop) + sizeof(CELL); -} #endif diff --git a/C/amasm.c b/C/amasm.c index f01f14aac..455efde0f 100644 --- a/C/amasm.c +++ b/C/amasm.c @@ -11,8 +11,11 @@ * File: amasm.c * * comments: abstract machine assembler * * * -* Last rev: $Date: 2008-03-25 16:45:52 $ * +* Last rev: $Date: 2008-04-01 22:28:41 $ * * $Log: not supported by cvs2svn $ +* Revision 1.100 2008/03/25 16:45:52 vsc +* make or-parallelism compile again +* * Revision 1.99 2008/01/23 17:57:44 vsc * valgrind it! * enable atom garbage collection. @@ -2705,8 +2708,8 @@ static yamop * do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp, int *clause_has_dbtermp, struct intermediates *cip, UInt size) { #ifdef YAPOR -#define EITHER_INST 50 - yamop *either_inst[EITHER_INST]; +#define MAX_DISJ_BRANCHES 256 + yamop *either_inst[MAX_DISJ_BRANCHES]; int either_cont = 0; #endif /* YAPOR */ int log_update; @@ -3086,10 +3089,6 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp break; case commit_b_op: code_p = a_v(_commit_b_x, code_p, pass_no, cip->cpc); -#ifdef YAPOR - if (pass_no) - PUT_YAMOP_CUT(*entry_codep); -#endif /* YAPOR */ break; case save_pair_op: code_p = a_uv((Ventry *) cip->cpc->rnd1, _save_pair_x, _save_pair_x_write, code_p, pass_no); @@ -3103,10 +3102,6 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp break; case cut_op: code_p = a_cut(&clinfo, code_p, pass_no, cip); -#ifdef YAPOR - if (pass_no) - PUT_YAMOP_CUT(*entry_codep); -#endif /* YAPOR */ break; case cutexit_op: code_p = a_cut(&clinfo, code_p, pass_no, cip); @@ -3114,17 +3109,13 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp (*clause_has_blobsp || *clause_has_dbtermp) && !clinfo.alloc_found) code_p = a_cle(_alloc_for_logical_pred, code_p, pass_no, cip); -#if THREADS +#if defined(THREADS) || defined(YAPOR) else if (cip->CurrentPred->PredFlags & LogUpdatePredFlag && !(cip->CurrentPred->PredFlags & ThreadLocalPredFlag)) code_p = a_e(_unlock_lu, code_p, pass_no); #endif code_p = a_pl(_procceed, cip->CurrentPred, code_p, pass_no); -#ifdef YAPOR - if (pass_no) - PUT_YAMOP_CUT(*entry_codep); -#endif /* YAPOR */ break; case allocate_op: clinfo.alloc_found = 2; @@ -3217,7 +3208,7 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp (*clause_has_blobsp || *clause_has_dbtermp) && !clinfo.alloc_found) code_p = a_cle(_alloc_for_logical_pred, code_p, pass_no, cip); -#if THREADS +#if defined(THREADS) || defined(YAPOR) else if (cip->CurrentPred->PredFlags & LogUpdatePredFlag && !(cip->CurrentPred->PredFlags & ThreadLocalPredFlag)) @@ -3229,7 +3220,7 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp code_p = a_p(_call, &clinfo, code_p, pass_no, cip); break; case execute_op: -#if THREADS +#if defined(THREADS) || defined(YAPOR) if (cip->CurrentPred->PredFlags & LogUpdatePredFlag && !(cip->CurrentPred->PredFlags & ThreadLocalPredFlag)) code_p = a_e(_unlock_lu, code_p, pass_no); @@ -3273,6 +3264,10 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp #ifdef YAPOR if (pass_no) either_inst[either_cont++] = code_p; + if (either_cont == MAX_DISJ_BRANCHES) { + Yap_Error(FATAL_ERROR,TermNil,"Too Many Branches in disjunction: please increase MAX_DISJ_BRANCHES in amasm.c\n"); + exit(1); + } code_p = a_either(_either, -Signed(RealEnvSize) - CELLSIZE * cip->cpc->rnd2, Unsigned(cip->code_addr) + cip->label_offset[cip->cpc->rnd1], 0, 0, code_p, pass_no, cip); diff --git a/C/cdmgr.c b/C/cdmgr.c index c28dd0180..479348c28 100644 --- a/C/cdmgr.c +++ b/C/cdmgr.c @@ -11,8 +11,11 @@ * File: cdmgr.c * * comments: Code manager * * * -* Last rev: $Date: 2008-04-01 08:42:45 $,$Author: vsc $ * +* Last rev: $Date: 2008-04-01 22:28:41 $,$Author: vsc $ * * $Log: not supported by cvs2svn $ +* Revision 1.225 2008/04/01 08:42:45 vsc +* fix restore and small VISTA thingies +* * Revision 1.224 2008/03/31 22:56:21 vsc * more fixes * @@ -1554,7 +1557,6 @@ add_first_static(PredEntry *p, yamop *cp, int spy_flag) #ifdef YAPOR if (SEQUENTIAL_IS_DEFAULT) { p->PredFlags |= SequentialPredFlag; - PUT_YAMOP_SEQ(pt); } #endif /* YAPOR */ #ifdef TABLING @@ -1585,7 +1587,6 @@ add_first_static(PredEntry *p, yamop *cp, int spy_flag) p->PredFlags &= ~ProfiledPredFlag; #ifdef YAPOR p->PredFlags |= SequentialPredFlag; - PUT_YAMOP_SEQ((yamop *)cp); #endif /* YAPOR */ if (spy_flag) { p->OpcodeOfPred = Yap_opcode(_spy_pred); @@ -1647,10 +1648,6 @@ add_first_dynamic(PredEntry *p, yamop *cp, int spy_flag) ncp->u.ld.s = p->ArityOfPE; ncp->u.ld.p = p; ncp->u.ld.d = cp; -#ifdef YAPOR - INIT_YAMOP_LTT(ncp, 1); - PUT_YAMOP_SEQ(ncp); -#endif /* YAPOR */ /* This is the point we enter the code */ p->cs.p_code.TrueCodeOfPred = p->CodeOfPred = ncp; p->cs.p_code.NOfClauses = 1; diff --git a/H/Heap.h b/H/Heap.h index 28cf8ad2b..e81efbaf2 100644 --- a/H/Heap.h +++ b/H/Heap.h @@ -10,7 +10,7 @@ * File: Heap.h * * mods: * * comments: Heap Init Structure * -* version: $Id: Heap.h,v 1.127 2008-03-25 22:03:13 vsc Exp $ * +* version: $Id: Heap.h,v 1.128 2008-04-01 22:28:41 vsc Exp $ * *************************************************************************/ /* information that can be stored in Code Space */ @@ -1030,7 +1030,6 @@ UInt STD_PROTO(Yap_givemallinfo, (void)); ADDR STD_PROTO(Yap_ExpandPreAllocCodeSpace, (UInt, void *)); #define Yap_ReleasePreAllocCodeSpace(x) -#if defined(USE_SYSTEM_MALLOC)||USE_DL_MALLOC ADDR STD_PROTO(Yap_InitPreAllocCodeSpace, (void)); EXTERN inline ADDR Yap_PreAllocCodeSpace(void) @@ -1039,13 +1038,6 @@ Yap_PreAllocCodeSpace(void) if (ptr) return ptr; return Yap_InitPreAllocCodeSpace(); } -#else -EXTERN inline ADDR -Yap_PreAllocCodeSpace(void) -{ - return Addr(HeapTop) + sizeof(CELL); -} -#endif #ifdef THREADS Prop STD_PROTO(Yap_NewThreadPred, (PredEntry *)); diff --git a/configure b/configure index 7ad2a3138..ebdd2a3fe 100755 --- a/configure +++ b/configure @@ -3084,7 +3084,7 @@ fi if test "$tabling" = yes -o "$orparallelism" = yes -o "$threads" = yes then cat >>confdefs.h <<\_ACEOF -#define MinHeapSpace (600*SIZEOF_INT_P) +#define MinHeapSpace (1000*SIZEOF_INT_P) _ACEOF cat >>confdefs.h <<\_ACEOF @@ -16112,10 +16112,13 @@ cat >>confdefs.h <<\_ACEOF #define GC_NO_TAGS 1 _ACEOF +if test "$orparallelism" != yes +then cat >>confdefs.h <<\_ACEOF #define USE_DL_MALLOC 1 _ACEOF +fi fi mkdir -p library/matrix diff --git a/configure.in b/configure.in index aefda0d0a..df70129d1 100644 --- a/configure.in +++ b/configure.in @@ -253,7 +253,7 @@ AC_ARG_WITH(max-workers, if test "$tabling" = yes -o "$orparallelism" = yes -o "$threads" = yes then - AC_DEFINE(MinHeapSpace, (600*SIZEOF_INT_P)) + AC_DEFINE(MinHeapSpace, (1000*SIZEOF_INT_P)) AC_DEFINE(MinStackSpace,(300*SIZEOF_INT_P)) AC_DEFINE(MinTrailSpace,( 48*SIZEOF_INT_P)) else @@ -1377,8 +1377,11 @@ dnl large memory configuration, don't trust Yap allocation routines if test "$maxmemory" = yes then AC_DEFINE(GC_NO_TAGS,1) +if test "$orparallelism" != yes +then AC_DEFINE(USE_DL_MALLOC,1) fi +fi mkdir -p library/matrix mkdir -p library/matlab