fix: size of quue went down.

This commit is contained in:
Vitor Santos Costa 2010-03-12 22:40:17 +00:00
parent c4b39d3ab9
commit 2908d4ccbd
3 changed files with 11 additions and 7 deletions

View File

@ -32,11 +32,15 @@ static char SccsId[] = "%W% %G%";
*/ */
#define QUEUE_FUNCTOR_ARITY 4
#define QUEUE_ARENA 0 #define QUEUE_ARENA 0
#define QUEUE_HEAD 1 #define QUEUE_HEAD 1
#define QUEUE_TAIL 2 #define QUEUE_TAIL 2
#define QUEUE_SIZE 3 #define QUEUE_SIZE 3
#define HEAP_FUNCTOR_MIN_ARITY
#define HEAP_SIZE 0 #define HEAP_SIZE 0
#define HEAP_MAX 1 #define HEAP_MAX 1
#define HEAP_ARENA 2 #define HEAP_ARENA 2
@ -1305,7 +1309,7 @@ p_nb_create2(void)
static Int static Int
nb_queue(UInt arena_sz) nb_queue(UInt arena_sz)
{ {
Term queue_arena, queue, ar[5], *nar; Term queue_arena, queue, ar[QUEUE_FUNCTOR_ARITY], *nar;
Term t = Deref(ARG1); Term t = Deref(ARG1);
DepthArenas++; DepthArenas++;
@ -1320,7 +1324,7 @@ nb_queue(UInt arena_sz)
ar[QUEUE_TAIL] = ar[QUEUE_TAIL] =
ar[QUEUE_SIZE] = ar[QUEUE_SIZE] =
MkIntTerm(0); MkIntTerm(0);
queue = Yap_MkApplTerm(FunctorNBQueue,5,ar); queue = Yap_MkApplTerm(FunctorNBQueue,QUEUE_FUNCTOR_ARITY,ar);
if (!Yap_unify(queue,ARG1)) if (!Yap_unify(queue,ARG1))
return FALSE; return FALSE;
if (arena_sz < 4*1024) if (arena_sz < 4*1024)
@ -1419,7 +1423,7 @@ p_nb_queue_close(void)
Term t = Deref(ARG1); Term t = Deref(ARG1);
Int out; Int out;
DepthArenas--; DepthArenas--;
if (!IsVarTerm(t)) { if (!IsVarTerm(t)) {
CELL *qp; CELL *qp;
@ -1907,7 +1911,7 @@ p_nb_beam(void)
hsize = IntegerOfTerm(tsize); hsize = IntegerOfTerm(tsize);
} }
while ((beam = MkZeroApplTerm(Yap_MkFunctor(AtomHeap,5*hsize+HEAP_START+1),5*hsize+HEAP_START+1)) == TermNil) { while ((beam = MkZeroApplTerm(Yap_MkFunctor(AtomHeap,5*hsize+HEAP_START+1),5*hsize+HEAP_START+1)) == TermNil) {
if (!Yap_gcl((5*hsize+HEAP_START+1)*sizeof(CELL), 2, ENV, P)) { if (!Yap_gcl((4*hsize+HEAP_START+1)*sizeof(CELL), 2, ENV, P)) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage); Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
return FALSE; return FALSE;
} }

View File

@ -374,7 +374,7 @@
FunctorMultiFileClause = Yap_MkFunctor(AtomMfClause,5); FunctorMultiFileClause = Yap_MkFunctor(AtomMfClause,5);
FunctorMutable = Yap_MkFunctor(AtomMutableVariable,(sizeof(timed_var)/sizeof(CELL))); FunctorMutable = Yap_MkFunctor(AtomMutableVariable,(sizeof(timed_var)/sizeof(CELL)));
FunctorNotImplemented = Yap_MkFunctor(AtomNotImplemented,2); FunctorNotImplemented = Yap_MkFunctor(AtomNotImplemented,2);
FunctorNBQueue = Yap_MkFunctor(AtomQueue,5); FunctorNBQueue = Yap_MkFunctor(AtomQueue,4);
FunctorNot = Yap_MkFunctor(AtomNot,1); FunctorNot = Yap_MkFunctor(AtomNot,1);
FunctorOr = Yap_MkFunctor(AtomSemic,2); FunctorOr = Yap_MkFunctor(AtomSemic,2);
FunctorPermissionError = Yap_MkFunctor(AtomPermissionError,3); FunctorPermissionError = Yap_MkFunctor(AtomPermissionError,3);

View File

@ -86,7 +86,7 @@ A DollarUndef F "$undef"
A DomainError N "domain_error" A DomainError N "domain_error"
A E N "e" A E N "e"
A EOFBeforeEOT N "end_of_file_found_before_end_of_term" A EOFBeforeEOT N "end_of_file_found_before_end_of_term"
A EQ N "=" A EQ N "="
A EmptyAtom N "" A EmptyAtom N ""
A EndOfStream N "$end_of_stream" A EndOfStream N "$end_of_stream"
A Eof N "end_of_file" A Eof N "end_of_file"
@ -383,7 +383,7 @@ F Module Colomn 2
F MultiFileClause MfClause 5 F MultiFileClause MfClause 5
F Mutable MutableVariable (sizeof(timed_var)/sizeof(CELL)) F Mutable MutableVariable (sizeof(timed_var)/sizeof(CELL))
F NotImplemented NotImplemented 2 F NotImplemented NotImplemented 2
F NBQueue Queue 5 F NBQueue Queue 4
F Not Not 1 F Not Not 1
F Or Semic 2 F Or Semic 2
F PermissionError PermissionError 3 F PermissionError PermissionError 3