Fix 'become'

db4
Slava Pestov 2009-04-21 00:05:39 -05:00
parent cb6205e9d4
commit 461ddfac1a
3 changed files with 10 additions and 1 deletions

View File

@ -3,6 +3,8 @@ sequences tools.test words namespaces layouts classes
classes.builtin arrays quotations io.launcher system ; classes.builtin arrays quotations io.launcher system ;
IN: memory.tests IN: memory.tests
[ ] [ { } { } become ] unit-test
! LOL ! LOL
[ ] [ [ ] [
vm vm

View File

@ -564,6 +564,8 @@ void primitive_clear_gc_stats(void)
clear_gc_stats(); clear_gc_stats();
} }
/* classes.tuple uses this to reshape tuples; tools.deploy.shaker uses this
to coalesce equal but distinct quotations and wrappers. */
void primitive_become(void) void primitive_become(void)
{ {
F_ARRAY *new_objects = untag_array(dpop()); F_ARRAY *new_objects = untag_array(dpop());
@ -585,5 +587,9 @@ void primitive_become(void)
gc(); gc();
/* If a word's definition quotation was in old_objects and the
quotation in new_objects is not compiled, we might leak memory
by referencing the old quotation unless we recompile all
unoptimized words. */
compile_all_words(); compile_all_words();
} }

View File

@ -532,6 +532,7 @@ void compile_all_words(void)
{ {
F_WORD *word = untag_word(array_nth(untag_array(words),i)); F_WORD *word = untag_word(array_nth(untag_array(words),i));
REGISTER_UNTAGGED(word); REGISTER_UNTAGGED(word);
if(word->optimizedp == F)
jit_compile_word(word,word->def,false); jit_compile_word(word,word->def,false);
UNREGISTER_UNTAGGED(word); UNREGISTER_UNTAGGED(word);
update_word_xt(word); update_word_xt(word);