Fix method redefinition bug
parent
9660a9c2d6
commit
de8b804abe
|
@ -78,7 +78,7 @@ nl
|
||||||
[ compiled-usages recompile ] recompile-hook set-global ;
|
[ compiled-usages recompile ] recompile-hook set-global ;
|
||||||
|
|
||||||
: disable-compiler ( -- )
|
: disable-compiler ( -- )
|
||||||
[ [ f ] { } map>assoc modify-code-heap ] recompile-hook set-global ;
|
[ default-recompile-hook ] recompile-hook set-global ;
|
||||||
|
|
||||||
enable-compiler
|
enable-compiler
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,9 @@ IN: compiler
|
||||||
H{ } clone compiled set
|
H{ } clone compiled set
|
||||||
[ queue-compile ] each
|
[ queue-compile ] each
|
||||||
compile-queue get compile-loop
|
compile-queue get compile-loop
|
||||||
compiled get >alist modify-code-heap
|
compiled get >alist
|
||||||
|
dup [ drop crossref? ] assoc-contains?
|
||||||
|
modify-code-heap
|
||||||
] with-scope ; inline
|
] with-scope ; inline
|
||||||
|
|
||||||
: compile ( words -- )
|
: compile ( words -- )
|
||||||
|
@ -70,4 +72,4 @@ IN: compiler
|
||||||
[ all-words recompile ] with-compiler-errors ;
|
[ all-words recompile ] with-compiler-errors ;
|
||||||
|
|
||||||
: decompile ( word -- )
|
: decompile ( word -- )
|
||||||
f 2array 1array modify-code-heap ;
|
f 2array 1array t modify-code-heap ;
|
||||||
|
|
|
@ -77,6 +77,11 @@ GENERIC: definitions-changed ( assoc obj -- )
|
||||||
[ ] cleanup
|
[ ] cleanup
|
||||||
] with-scope ; inline
|
] with-scope ; inline
|
||||||
|
|
||||||
|
: default-recompile-hook
|
||||||
|
[ f ] { } map>assoc
|
||||||
|
dup [ drop crossref? ] assoc-contains?
|
||||||
|
modify-code-heap ;
|
||||||
|
|
||||||
recompile-hook global
|
recompile-hook global
|
||||||
[ [ [ f ] { } map>assoc modify-code-heap ] or ]
|
[ [ default-recompile-hook ] or ]
|
||||||
change-at
|
change-at
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
! Copyright (C) 2004, 2007 Slava Pestov.
|
! Copyright (C) 2004, 2008 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: arrays definitions generic hashtables inspector io kernel
|
USING: arrays definitions generic hashtables inspector io kernel
|
||||||
math namespaces prettyprint sequences assocs sequences.private
|
math namespaces prettyprint sequences assocs sequences.private
|
||||||
strings io.styles vectors words system splitting math.parser
|
strings io.styles vectors words system splitting math.parser
|
||||||
tuples continuations continuations.private combinators
|
tuples continuations continuations.private combinators
|
||||||
generic.math io.streams.duplex classes compiler.units
|
generic.math io.streams.duplex classes compiler.units
|
||||||
generic.standard ;
|
generic.standard vocabs ;
|
||||||
IN: debugger
|
IN: debugger
|
||||||
|
|
||||||
GENERIC: error. ( error -- )
|
GENERIC: error. ( error -- )
|
||||||
|
@ -254,3 +254,6 @@ M: no-compilation-unit error.
|
||||||
"Attempting to define " write
|
"Attempting to define " write
|
||||||
no-compilation-unit-definition pprint
|
no-compilation-unit-definition pprint
|
||||||
" outside of a compilation unit" print ;
|
" outside of a compilation unit" print ;
|
||||||
|
|
||||||
|
M: no-vocab summary
|
||||||
|
drop "Vocabulary does not exist" ;
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespaces.private parser prettyprint quotations
|
||||||
quotations.private sbufs sbufs.private sequences
|
quotations.private sbufs sbufs.private sequences
|
||||||
sequences.private slots.private strings strings.private system
|
sequences.private slots.private strings strings.private system
|
||||||
threads.private tuples tuples.private vectors vectors.private
|
threads.private tuples tuples.private vectors vectors.private
|
||||||
words words.private assocs inspector ;
|
words words.private assocs inspector compiler.units ;
|
||||||
IN: inference.known-words
|
IN: inference.known-words
|
||||||
|
|
||||||
! Shuffle words
|
! Shuffle words
|
||||||
|
@ -598,3 +598,5 @@ set-primitive-effect
|
||||||
\ do-primitive [ \ do-primitive no-effect ] "infer" set-word-prop
|
\ do-primitive [ \ do-primitive no-effect ] "infer" set-word-prop
|
||||||
|
|
||||||
\ dll-valid? { object } { object } <effect> set-primitive-effect
|
\ dll-valid? { object } { object } <effect> set-primitive-effect
|
||||||
|
|
||||||
|
\ modify-code-heap { array object } { } <effect> set-primitive-effect
|
||||||
|
|
|
@ -48,7 +48,14 @@ M: duplex-stream stream-read-quot
|
||||||
|
|
||||||
: listen ( -- )
|
: listen ( -- )
|
||||||
listener-hook get call prompt.
|
listener-hook get call prompt.
|
||||||
[ read-quot [ call ] [ bye ] if* ] try ;
|
[ read-quot [ try ] [ bye ] if* ]
|
||||||
|
[
|
||||||
|
dup parse-error? [
|
||||||
|
error-hook get call
|
||||||
|
] [
|
||||||
|
rethrow
|
||||||
|
] if
|
||||||
|
] recover ;
|
||||||
|
|
||||||
: until-quit ( -- )
|
: until-quit ( -- )
|
||||||
quit-flag get
|
quit-flag get
|
||||||
|
|
|
@ -63,6 +63,7 @@ DEFER: (flat-length)
|
||||||
|
|
||||||
: inline-standard-method ( node word -- node )
|
: inline-standard-method ( node word -- node )
|
||||||
2dup dispatching-class dup [
|
2dup dispatching-class dup [
|
||||||
|
over +inlined+ depends-on
|
||||||
swap method method-word 1quotation f splice-quot
|
swap method method-word 1quotation f splice-quot
|
||||||
] [
|
] [
|
||||||
3drop t
|
3drop t
|
||||||
|
|
|
@ -7,7 +7,7 @@ IN: temporary
|
||||||
[ ] [ foo ] unit-test
|
[ ] [ foo ] unit-test
|
||||||
|
|
||||||
! erg's bug
|
! erg's bug
|
||||||
GENERIC: some-generic
|
GENERIC: some-generic ( a -- b )
|
||||||
|
|
||||||
M: integer some-generic 1+ ;
|
M: integer some-generic 1+ ;
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ void *get_rel_symbol(F_REL *rel, CELL literals_start)
|
||||||
|
|
||||||
if(type_of(symbol) == BYTE_ARRAY_TYPE)
|
if(type_of(symbol) == BYTE_ARRAY_TYPE)
|
||||||
{
|
{
|
||||||
F_CHAR *name = alien_offset(symbol);
|
F_SYMBOL *name = alien_offset(symbol);
|
||||||
void *sym = ffi_dlsym(dll,name);
|
void *sym = ffi_dlsym(dll,name);
|
||||||
|
|
||||||
if(sym)
|
if(sym)
|
||||||
|
@ -40,7 +40,7 @@ void *get_rel_symbol(F_REL *rel, CELL literals_start)
|
||||||
F_ARRAY *names = untag_object(symbol);
|
F_ARRAY *names = untag_object(symbol);
|
||||||
for(i = 0; i < array_capacity(names); i++)
|
for(i = 0; i < array_capacity(names); i++)
|
||||||
{
|
{
|
||||||
F_CHAR *name = alien_offset(array_nth(names,i));
|
F_SYMBOL *name = alien_offset(array_nth(names,i));
|
||||||
void *sym = ffi_dlsym(dll,name);
|
void *sym = ffi_dlsym(dll,name);
|
||||||
|
|
||||||
if(sym)
|
if(sym)
|
||||||
|
@ -318,10 +318,9 @@ void default_word_code(F_WORD *word, bool relocate)
|
||||||
|
|
||||||
DEFINE_PRIMITIVE(modify_code_heap)
|
DEFINE_PRIMITIVE(modify_code_heap)
|
||||||
{
|
{
|
||||||
|
bool rescan_code_heap = to_boolean(dpop());
|
||||||
F_ARRAY *alist = untag_array(dpop());
|
F_ARRAY *alist = untag_array(dpop());
|
||||||
|
|
||||||
bool rescan_code_heap = false;
|
|
||||||
|
|
||||||
CELL count = untag_fixnum_fast(alist->capacity);
|
CELL count = untag_fixnum_fast(alist->capacity);
|
||||||
CELL i;
|
CELL i;
|
||||||
for(i = 0; i < count; i++)
|
for(i = 0; i < count; i++)
|
||||||
|
@ -330,9 +329,6 @@ DEFINE_PRIMITIVE(modify_code_heap)
|
||||||
|
|
||||||
F_WORD *word = untag_word(array_nth(pair,0));
|
F_WORD *word = untag_word(array_nth(pair,0));
|
||||||
|
|
||||||
if(word->vocabulary != F)
|
|
||||||
rescan_code_heap = true;
|
|
||||||
|
|
||||||
CELL data = array_nth(pair,1);
|
CELL data = array_nth(pair,1);
|
||||||
|
|
||||||
if(data == F)
|
if(data == F)
|
||||||
|
|
Loading…
Reference in New Issue