fix bug in reserving space for queues.

This commit is contained in:
Vitor Santos Costa 2008-11-14 14:52:00 +00:00
parent 7a21ccb009
commit 9296762791

View File

@ -1429,7 +1429,7 @@ p_nb_queue(void)
Term delay_queue_arena; Term delay_queue_arena;
#endif #endif
Term t = Deref(ARG1); Term t = Deref(ARG1);
UInt arena_sz = (H-H0)/16; UInt arena_sz = (ASP-H)/16;
if (arena_sz < MIN_ARENA_SIZE) if (arena_sz < MIN_ARENA_SIZE)
arena_sz = MIN_ARENA_SIZE; arena_sz = MIN_ARENA_SIZE;
@ -1449,17 +1449,19 @@ p_nb_queue(void)
if (!Yap_unify(queue,ARG1)) if (!Yap_unify(queue,ARG1))
return FALSE; return FALSE;
#if COROUTINING #if COROUTINING
arena_sz = ((attvar_record *)H0- DelayTop())/16; {
if (arena_sz <2) UInt delay_arena_sz = ((attvar_record *)H0- DelayTop())/16;
arena_sz = 2; if (delay_arena_sz <2)
if (arena_sz > 256) delay_arena_sz = 2;
arena_sz = 256; if (delay_arena_sz > 256)
delay_queue_arena = NewDelayArena(arena_sz); delay_arena_sz = 256;
if (delay_queue_arena == 0L) { delay_queue_arena = NewDelayArena(delay_arena_sz);
return FALSE; if (delay_queue_arena == 0L) {
return FALSE;
}
nar = RepAppl(Deref(ARG1))+1;
nar[QUEUE_DELAY_ARENA] = delay_queue_arena;
} }
nar = RepAppl(Deref(ARG1))+1;
nar[QUEUE_DELAY_ARENA] = delay_queue_arena;
#endif #endif
if (arena_sz < 4*1024) if (arena_sz < 4*1024)
arena_sz = 4*1024; arena_sz = 4*1024;