fix global overfloow.

This commit is contained in:
Vitor Santos Costa 2019-05-03 01:03:22 +01:00
parent 644606d8bb
commit 91a79d778b
3 changed files with 18 additions and 9 deletions

View File

@ -1550,7 +1550,6 @@ static Int nb_queue(UInt arena_sz USES_REGS) {
cell_space_t cspace;
Term queue_arena, queue, ar[QUEUE_FUNCTOR_ARITY], *nar;
Term t = Deref(ARG1);
enter_cell_space(&cspace);
LOCAL_DepthArenas++;
if (!IsVarTerm(t)) {
if (!IsApplTerm(t)) {
@ -1565,13 +1564,14 @@ enter_cell_space(&cspace);
return FALSE;
if (arena_sz < 32 * 1024)
arena_sz = 32 * 1024;
enter_cell_space(&cspace);
queue_arena = NewArena(arena_sz, worker_id, 1, NULL, &cspace);
if (queue_arena == 0L) {
return FALSE;
}
nar = RepAppl(Deref(ARG1)) + 1;
nar[QUEUE_ARENA] = queue_arena;
return TRUE;
return true;
}
static Int p_nb_queue(USES_REGS1) {

View File

@ -46,22 +46,31 @@ extern const void *MallocExportAsRO(const void *blk);
/* Character types for tokenizer and write.c */
extern int AllocLevel(void);
#if 0
#define push_text_stack() \
( fprintf(stderr, " + *** %d %s:%s:%d\n", AllocLevel(), \
__FILE__, __FUNCTION__, __LINE__), \
push_text_stack__(PASS_REGS1))
extern int push_text_stack__(USES_REGS1);
#define pop_text_stack(lvl) \
#define pop_text_stack(lvl) \
( fprintf(stderr, " - *** %d %s:%s:%d\n", AllocLevel(), __FILE__, \
__FUNCTION__, __LINE__), \
pop_text_stack__(lvl))
extern int pop_text_stack__(int lvl USES_REGS);
pop_text_stack__(lvl PASS_REGS))
#define pop_output_text_stack(lvl,p) \
#define pop_output_text_stack(lvl,p) \
(fprintf(stderr, "-- *** %d %s:%s:%d\n", AllocLevel(), __FILE__, \
__FUNCTION__, __LINE__), \
pop_output_text_stack__(lvl,p))
#else
#define push_text_stack() push_text_stack__(PASS_REGS1)
#define pop_text_stack(lvl) pop_text_stack__(lvl PASS_REGS)
#define pop_output_text_stack(lvl,p) pop_output_text_stack__(lvl,p PASS_REGS)
#endif
extern int push_text_stack__(USES_REGS1);
extern int pop_text_stack__(int lvl USES_REGS);
extern void *pop_output_text_stack__(int lvl, const void *ox USES_REGS);
/****************** character definition table **************************/

View File

@ -334,7 +334,7 @@ prolog_file_name(File, PrologFileName) :-
system:true_file_name(File, PrologFileName).
prolog_file_name(File, PrologFileName) :-
'$do_error'(type_error(atom,File), prolog_file_name(File, PrologFileName)).
:- start_low_level_trace.
/**
@pred path(-Directories:list) is det,deprecated
@ -344,7 +344,7 @@ prolog_file_name(File, PrologFileName) :-
*/
path(Path) :-
findall(X,'$in_path'(X),Path).
:- stop_low_level_trace.
'$in_path'(X) :-
recorded('$path',Path,_),