add -A flag to ask for more attributed stack.

This commit is contained in:
Vitor Santos Costa 2009-03-27 15:15:54 +00:00
parent 901161a413
commit 2aa5aa3a26
7 changed files with 32 additions and 18 deletions

View File

@ -1932,7 +1932,7 @@ X_API Int
YAP_Init(YAP_init_args *yap_init)
{
int restore_result;
CELL Trail = 0, Stack = 0, Heap = 0;
CELL Trail = 0, Stack = 0, Heap = 0, Atts = 0;
Yap_argv = yap_init->Argv;
Yap_argc = yap_init->Argc;
@ -1956,6 +1956,7 @@ YAP_Init(YAP_init_args *yap_init)
} else {
Trail = yap_init->TrailSize;
}
Atts = yap_init->AttsSize;
if (yap_init->StackSize == 0) {
if (Stack == 0)
Stack = DefStackSpace;
@ -1970,7 +1971,7 @@ YAP_Init(YAP_init_args *yap_init)
}
/* tell the system who should cope with interruptions */
Yap_PrologShouldHandleInterrupts = yap_init->PrologShouldHandleInterrupts;
Yap_InitWorkspace(Heap, Stack, Trail,
Yap_InitWorkspace(Heap, Stack, Trail, Atts,
yap_init->MaxTableSpaceSize,
yap_init->NumberWorkers,
yap_init->SchedulerLoop,
@ -2093,6 +2094,10 @@ YAP_Init(YAP_init_args *yap_init)
yap_init->ErrorCause = Yap_ErrorMessage;
return YAP_BOOT_FROM_SAVED_ERROR;
}
if (Atts && Atts > 2048*sizeof(CELL))
Yap_AttsSize = Atts;
else
Yap_AttsSize = 2048*sizeof(CELL);
if (restore_result == DO_ONLY_CODE) {
return YAP_BOOT_FROM_SAVED_CODE;
} else {
@ -2109,6 +2114,7 @@ YAP_FastInit(char saved_state[])
Int out;
init_args.SavedState = saved_state;
init_args.AttsSize = 0;
init_args.HeapSize = 0;
init_args.StackSize = 0;
init_args.TrailSize = 0;

View File

@ -1507,11 +1507,10 @@ Yap_InitYaamRegs(void)
#endif /* PUSH_REGS */
Yap_PutValue (AtomBreak, MkIntTerm (0));
TR = (tr_fr_ptr)Yap_TrailBase;
#ifdef COROUTINING
H = H0 = ((CELL *) Yap_GlobalBase)+ 2048;
#else
H = H0 = (CELL *) Yap_GlobalBase;
#endif
if (Yap_AttsSize > (Yap_LocalBase-Yap_GlobalBase)/8)
Yap_AttsSize = (Yap_LocalBase-Yap_GlobalBase)/8;
fprintf(stderr, "Atts=%ld\n",Yap_AttsSize);
H = H0 = ((CELL *) Yap_GlobalBase)+ Yap_AttsSize/sizeof(CELL);
LCL0 = ASP = (CELL *) Yap_LocalBase;
/* notice that an initial choice-point and environment
*must* be created since for the garbage collector to work */

View File

@ -1289,7 +1289,7 @@ InitVersion(void)
void
Yap_InitWorkspace(UInt Heap, UInt Stack, UInt Trail, UInt max_table_size,
Yap_InitWorkspace(UInt Heap, UInt Stack, UInt Trail, UInt Atts, UInt max_table_size,
int n_workers, int sch_loop, int delay_load)
{
int i;
@ -1337,10 +1337,11 @@ Yap_InitWorkspace(UInt Heap, UInt Stack, UInt Trail, UInt max_table_size,
#else /* SBA */
INFORMATION_MESSAGE("YapOr: sba model with %d worker%s", n_workers, n_workers == 1 ? "":"s");
#endif /* ENV_COPY - ACOW - SBA */
map_memory(Heap, Stack, Trail, n_workers);
map_memory(Heap, Stack+Atts, Trail, n_workers);
#else
Yap_InitMemory (Trail, Heap, Stack);
Yap_InitMemory (Trail, Heap, Stack+Atts);
#endif /* YAPOR */
Yap_AttsSize = 2048*sizeof(CELL);
Yap_ClauseSpace = 0;
Yap_IndexSpace_Tree = 0;
Yap_IndexSpace_EXT = 0;

View File

@ -224,6 +224,7 @@ typedef struct various_codes {
UInt hole_size;
struct malloc_state *av_;
UInt atts_size;
UInt clause_space, index_space_Tree, index_space_EXT, index_space_SW;
UInt lu_clause_space, lu_index_space_Tree, lu_index_space_CP, lu_index_space_EXT, lu_index_space_SW;
#if USE_DL_MALLOC
@ -470,6 +471,7 @@ extern struct various_codes *Yap_heap_regs;
#define Yap_HoleSize Yap_heap_regs->hole_size
#define Yap_av Yap_heap_regs->av_
#define Yap_AttsSize Yap_heap_regs->atts_size
#define Yap_ClauseSpace Yap_heap_regs->clause_space
#define Yap_IndexSpace_Tree Yap_heap_regs->index_space_Tree
#define Yap_IndexSpace_EXT Yap_heap_regs->index_space_EXT

View File

@ -221,7 +221,7 @@ void STD_PROTO(Yap_InitCPredBack,(char *, unsigned long int, unsigned int, CPred
void STD_PROTO(Yap_InitCPredBackCut,(char *, unsigned long int, unsigned int, CPredicate,CPredicate,CPredicate,int));
void STD_PROTO(Yap_InitCPredBack_,(char *, unsigned long int, unsigned int, CPredicate,CPredicate,CPredicate,int));
#endif
void STD_PROTO(Yap_InitWorkspace,(UInt,UInt,UInt,UInt,int,int,int));
void STD_PROTO(Yap_InitWorkspace,(UInt,UInt,UInt,UInt,UInt,int,int,int));
#if defined(YAPOR) || defined(THREADS)
void STD_PROTO(Yap_KillStacks,(int));

View File

@ -305,7 +305,7 @@ parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap)
#ifdef MYDDAS_MYSQL
char *myddas_temp;
#endif
int *ssize;
unsigned long int *ssize;
while (--argc > 0)
{
p = *++argv;
@ -434,6 +434,10 @@ parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap)
}
#endif /* ENV_COPY || ACOW || SBA */
goto GetSize;
case 'a':
case 'A':
ssize = &(iap->AttsSize);
goto GetSize;
case 't':
case 'T':
ssize = &(iap->TrailSize);
@ -455,7 +459,7 @@ parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap)
}
}
{
int i = 0, ch;
unsigned long int i = 0, ch;
while ((ch = *p++) >= '0' && ch <= '9')
i = i * 10 + ch - '0';
switch(ch) {
@ -497,7 +501,7 @@ parse_yap_arguments(int argc, char *argv[], YAP_init_args *iap)
}
}
{
int i = 0, ch;
unsigned long int i = 0, ch;
while ((ch = *p++) >= '0' && ch <= '9')
i = i * 10 + ch - '0';
switch(ch) {

View File

@ -73,11 +73,13 @@ typedef struct {
/* if NON-NULL, path where we can find the saved state */
char *SavedState;
/* if NON-0, minimal size for Heap or Code Area */
int HeapSize;
unsigned long int HeapSize;
/* if NON-0, minimal size for Local+Global Stack */
int StackSize;
unsigned long int StackSize;
/* if NON-0, minimal size for Trail */
int TrailSize;
unsigned long int TrailSize;
/* if NON-0, minimal size for AttributeVarStack */
unsigned long int AttsSize;
/* if NON-NULL, value for YAPLIBDIR */
char *YapLibDir;
/* if NON-NULL, name for a Prolog file to use when booting */
@ -98,7 +100,7 @@ typedef struct {
int FastBoot;
/* the next field only interest YAPTAB */
/* if NON-0, maximum size for Table Space */
int MaxTableSpaceSize;
unsigned long int MaxTableSpaceSize;
/* the next three fields only interest YAPOR, but we keep them so that
users don't need to recompile DLL in order to use YAPOR */
/* if NON-0, number of workers we want to have (default=1) */