Symbols are compound defs now; SYMBOL: foo == : foo \ foo ;

db4
Slava Pestov 2007-12-25 22:55:17 -05:00
parent 73053ef230
commit 423c22e4ef
9 changed files with 9 additions and 27 deletions

View File

@ -393,8 +393,6 @@ M: compound infer-word
M: word apply-object apply-word ;
M: symbol apply-object apply-literal ;
TUPLE: recursive-declare-error word ;
: declared-infer ( word -- )

View File

@ -28,12 +28,14 @@ M: compound definer drop \ : \ ; ;
M: compound definition word-def ;
PREDICATE: compound symbol ( obj -- ? )
dup <wrapper> 1array swap word-def sequence= ;
M: symbol definer drop \ SYMBOL: f ;
M: symbol definition drop f ;
PREDICATE: word primitive ( obj -- ? ) word-def fixnum? ;
M: primitive definer drop \ PRIMITIVE: f ;
PREDICATE: word symbol ( obj -- ? ) word-def t eq? ;
M: symbol definer drop \ SYMBOL: f ;
: word-prop ( word name -- value ) swap word-props at ;
: remove-word-prop ( word name -- )
@ -97,9 +99,6 @@ M: compound redefined* ( word -- )
PRIVATE>
: define-symbol ( word -- )
t define ;
: define-compound ( word def -- )
[ ] like define ;
@ -119,6 +118,9 @@ PRIVATE>
: define-inline ( word quot -- )
dupd define-compound make-inline ;
: define-symbol ( word -- )
dup [ ] curry define-inline ;
: reset-word ( word -- )
{
"parsing" "inline" "foldable"

View File

@ -81,10 +81,6 @@ DEF(void,undefined,(CELL word)):
sub r1,sp,#4
b MANGLE(undefined_error)
DEF(void,dosym,(CELL word)):
str r0,[r5, #4]! /* push word to stack */
mov pc,lr /* return */
/* Here we have two entry points. The first one is taken when profiling is
enabled */
DEF(void,docol_profiling,(CELL word)):

View File

@ -8,7 +8,6 @@ register CELL rs asm("r6");
#define FRAME_RETURN_ADDRESS(frame) *(XT *)(frame_successor(frame) + 1)
void c_to_factor(CELL quot);
void dosym(CELL word);
void docol_profiling(CELL word);
void docol(CELL word);
void undefined(CELL word);

4
vm/cpu-ppc.S Normal file → Executable file
View File

@ -118,10 +118,6 @@ DEF(void,undefined,(CELL word)):
mr r4,r1
b MANGLE(undefined_error)
DEF(void,dosym,(CELL word)):
stwu r3,4(r14) /* push word to stack */
blr /* return */
/* Here we have two entry points. The first one is taken when profiling is
enabled */
DEF(void,docol_profiling,(CELL word)):

View File

@ -5,7 +5,6 @@ register CELL ds asm("r14");
register CELL rs asm("r15");
void c_to_factor(CELL quot);
void dosym(CELL word);
void docol_profiling(CELL word);
void docol(CELL word);
void undefined(CELL word);

5
vm/cpu-x86.S Normal file → Executable file
View File

@ -21,11 +21,6 @@ DEF(F_FASTCALL void,undefined,(CELL word)):
mov STACK_REG,ARG1 /* Pass callstack pointer */
jmp MANGLE(undefined_error) /* This throws an error */
DEF(F_FASTCALL void,dosym,(CELL word)):
add $CELL_SIZE,DS_REG /* Increment stack pointer */
mov ARG0,(DS_REG) /* Store word on stack */
ret
/* Here we have two entry points. The first one is taken when profiling is
enabled */
DEF(F_FASTCALL void,docol_profiling,(CELL word)):

View File

@ -5,7 +5,6 @@ INLINE void flush_icache(CELL start, CELL len) {}
F_FASTCALL void c_to_factor(CELL quot);
F_FASTCALL void throw_impl(CELL quot, F_STACK_FRAME *rewind_to);
F_FASTCALL void undefined(CELL word);
F_FASTCALL void dosym(CELL word);
F_FASTCALL void docol_profiling(CELL word);
F_FASTCALL void docol(CELL word);
F_FASTCALL void lazy_jit_compile(CELL quot);

4
vm/run.c Normal file → Executable file
View File

@ -265,9 +265,7 @@ DEFINE_PRIMITIVE(set_retainstack)
XT default_word_xt(F_WORD *word)
{
if(word->def == T)
return dosym;
else if(type_of(word->def) == QUOTATION_TYPE)
if(type_of(word->def) == QUOTATION_TYPE)
{
if(profiling_p())
return docol_profiling;