executing global was not GC'd

cvs
Slava Pestov 2004-12-31 07:38:58 +00:00
parent 6159c82407
commit 6ac8fdb22f
7 changed files with 23 additions and 13 deletions

View File

@ -121,7 +121,7 @@ void dump_stacks(void)
print_obj(callframe); print_obj(callframe);
fprintf(stderr,"\n"); fprintf(stderr,"\n");
fprintf(stderr,"*** Executing:\n"); fprintf(stderr,"*** Executing:\n");
print_word(executing); print_obj(executing);
fprintf(stderr,"\n"); fprintf(stderr,"\n");
fflush(stderr); fflush(stderr);
} }

View File

@ -21,6 +21,7 @@ void collect_roots(void)
/* the bignum 0 1 -1 constants must be the next three */ /* the bignum 0 1 -1 constants must be the next three */
copy_bignum_constants(); copy_bignum_constants();
copy_object(&callframe); copy_object(&callframe);
copy_object(&executing);
for(ptr = ds_bot; ptr <= ds; ptr += CELLS) for(ptr = ds_bot; ptr <= ds; ptr += CELLS)
copy_object((void*)ptr); copy_object((void*)ptr);

View File

@ -77,7 +77,9 @@ void allot_profile_step(CELL a)
untag_word(obj)->allot_count += a; untag_word(obj)->allot_count += a;
} }
executing->allot_count += a; if(in_zone(&prior,executing))
critical_error("executing in prior zone",executing);
untag_word_fast(executing)->allot_count += a;
} }
void flip_zones() void flip_zones()

View File

@ -6,9 +6,10 @@ void clear_environment(void)
for(i = 0; i < USER_ENV; i++) for(i = 0; i < USER_ENV; i++)
userenv[i] = F; userenv[i] = F;
profile_depth = 0; profile_depth = 0;
executing = F;
} }
#define EXECUTE(w) ((XT)(w->xt))() #define EXECUTE(w) ((XT)(untag_word_fast(w)->xt))()
void run(void) void run(void)
{ {
@ -54,7 +55,7 @@ void run(void)
if(TAG(next) == WORD_TYPE) if(TAG(next) == WORD_TYPE)
{ {
executing = (F_WORD*)UNTAG(next); executing = next;
EXECUTE(executing); EXECUTE(executing);
} }
else else
@ -74,24 +75,25 @@ void run(void)
/* XT of deferred words */ /* XT of deferred words */
void undefined() void undefined()
{ {
general_error(ERROR_UNDEFINED_WORD,tag_word(executing)); general_error(ERROR_UNDEFINED_WORD,executing);
} }
/* XT of compound definitions */ /* XT of compound definitions */
void docol(void) void docol(void)
{ {
call(executing->parameter); call(untag_word_fast(executing)->parameter);
} }
/* pushes word parameter */ /* pushes word parameter */
void dosym(void) void dosym(void)
{ {
dpush(executing->parameter); dpush(untag_word_fast(executing)->parameter);
} }
void primitive_execute(void) void primitive_execute(void)
{ {
executing = untag_word(dpop()); type_check(WORD_TYPE,dpeek());
executing = dpop();
EXECUTE(executing); EXECUTE(executing);
} }

View File

@ -29,8 +29,8 @@ sigjmp_buf toplevel;
/* TAGGED currently executing quotation */ /* TAGGED currently executing quotation */
CELL callframe; CELL callframe;
/* raw pointer to currently executing word */ /* TAGGED pointer to currently executing word */
F_WORD* executing; CELL executing;
/* TAGGED user environment data; see getenv/setenv prims */ /* TAGGED user environment data; see getenv/setenv prims */
CELL userenv[USER_ENV]; CELL userenv[USER_ENV];
@ -80,7 +80,7 @@ INLINE void call(CELL quot)
/* tail call optimization */ /* tail call optimization */
if(callframe != F) if(callframe != F)
{ {
cpush(tag_word(executing)); cpush(executing);
cpush(callframe); cpush(callframe);
} }
callframe = quot; callframe = quot;

View File

@ -33,7 +33,7 @@ void call_profiling_step(int signal, siginfo_t* siginfo, void* uap)
untag_word(obj)->call_count++; untag_word(obj)->call_count++;
} }
executing->call_count++; untag_word_fast(executing)->call_count++;
} }
void init_signals(void) void init_signals(void)

View File

@ -19,10 +19,15 @@ typedef struct {
CELL allot_count; CELL allot_count;
} F_WORD; } F_WORD;
INLINE F_WORD* untag_word_fast(CELL tagged)
{
return (F_WORD*)UNTAG(tagged);
}
INLINE F_WORD* untag_word(CELL tagged) INLINE F_WORD* untag_word(CELL tagged)
{ {
type_check(WORD_TYPE,tagged); type_check(WORD_TYPE,tagged);
return (F_WORD*)UNTAG(tagged); return untag_word_fast(tagged);
} }
INLINE CELL tag_word(F_WORD* word) INLINE CELL tag_word(F_WORD* word)