From 423c22e4ef183f6c154d7299c4417574f0d51834 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 25 Dec 2007 22:55:17 -0500 Subject: [PATCH] Symbols are compound defs now; SYMBOL: foo == : foo \ foo ; --- core/inference/backend/backend.factor | 2 -- core/words/words.factor | 14 ++++++++------ vm/cpu-arm.S | 4 ---- vm/cpu-arm.h | 1 - vm/cpu-ppc.S | 4 ---- vm/cpu-ppc.h | 1 - vm/cpu-x86.S | 5 ----- vm/cpu-x86.h | 1 - vm/run.c | 4 +--- 9 files changed, 9 insertions(+), 27 deletions(-) mode change 100644 => 100755 vm/cpu-ppc.S mode change 100644 => 100755 vm/cpu-x86.S mode change 100644 => 100755 vm/run.c diff --git a/core/inference/backend/backend.factor b/core/inference/backend/backend.factor index f65d637b02..e5f282a8d1 100755 --- a/core/inference/backend/backend.factor +++ b/core/inference/backend/backend.factor @@ -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 -- ) diff --git a/core/words/words.factor b/core/words/words.factor index 97027313a6..972262675f 100755 --- a/core/words/words.factor +++ b/core/words/words.factor @@ -28,12 +28,14 @@ M: compound definer drop \ : \ ; ; M: compound definition word-def ; +PREDICATE: compound symbol ( obj -- ? ) + dup 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" diff --git a/vm/cpu-arm.S b/vm/cpu-arm.S index 35740f9c45..d98c033a4f 100755 --- a/vm/cpu-arm.S +++ b/vm/cpu-arm.S @@ -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)): diff --git a/vm/cpu-arm.h b/vm/cpu-arm.h index 8402824579..7da77e5e02 100755 --- a/vm/cpu-arm.h +++ b/vm/cpu-arm.h @@ -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); diff --git a/vm/cpu-ppc.S b/vm/cpu-ppc.S old mode 100644 new mode 100755 index 3c90fabca2..25b0ff0bd2 --- a/vm/cpu-ppc.S +++ b/vm/cpu-ppc.S @@ -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)): diff --git a/vm/cpu-ppc.h b/vm/cpu-ppc.h index 88bbde5661..da870d156c 100755 --- a/vm/cpu-ppc.h +++ b/vm/cpu-ppc.h @@ -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); diff --git a/vm/cpu-x86.S b/vm/cpu-x86.S old mode 100644 new mode 100755 index e912c65df6..f4fb5f5d31 --- a/vm/cpu-x86.S +++ b/vm/cpu-x86.S @@ -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)): diff --git a/vm/cpu-x86.h b/vm/cpu-x86.h index 7983c139af..fe9c0f12db 100755 --- a/vm/cpu-x86.h +++ b/vm/cpu-x86.h @@ -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); diff --git a/vm/run.c b/vm/run.c old mode 100644 new mode 100755 index 802ff4e8cc..afd50ec783 --- a/vm/run.c +++ b/vm/run.c @@ -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;