From: Doug Coleman Date: Thu, 13 Aug 2015 17:11:59 +0000 (-0700) Subject: core: callstack is a builtin type and a class name. rename the *stack words that... X-Git-Tag: unmaintained~2092 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=c21a1540564b66ec0574f4e91d7e2d2661f0745e core: callstack is a builtin type and a class name. rename the *stack words that grab the current stack get-foostack to avoid the callstack builtin conflict and for better symmetry with set-foostack. --- diff --git a/basis/compiler/tests/simple.factor b/basis/compiler/tests/simple.factor index 5406072f10..1847c1a33d 100644 --- a/basis/compiler/tests/simple.factor +++ b/basis/compiler/tests/simple.factor @@ -66,7 +66,7 @@ IN: compiler.tests.simple ! Regression -[ ] [ [ callstack ] compile-call drop ] unit-test +[ ] [ [ get-callstack ] compile-call drop ] unit-test ! Regression diff --git a/basis/inspector/inspector.factor b/basis/inspector/inspector.factor index 444b7ed0ba..5e6050bb32 100644 --- a/basis/inspector/inspector.factor +++ b/basis/inspector/inspector.factor @@ -55,7 +55,7 @@ M: tuple error. describe ; '[ dup _ assoc-stack ] H{ } map>assoc ; : .vars ( -- ) - namestack vars-in-scope describe ; + get-namestack vars-in-scope describe ; : :vars ( -- ) error-continuation get name>> vars-in-scope describe ; diff --git a/basis/prettyprint/prettyprint.factor b/basis/prettyprint/prettyprint.factor index 7128def247..b5b8ba2e67 100644 --- a/basis/prettyprint/prettyprint.factor +++ b/basis/prettyprint/prettyprint.factor @@ -49,8 +49,8 @@ IN: prettyprint ] recover ] each ; -: .s ( -- ) datastack stack. ; -: .r ( -- ) retainstack stack. ; +: .s ( -- ) get-datastack stack. ; +: .r ( -- ) get-retainstack stack. ; callstack>array 3 { { table-gap { 5 5 } } } [ [ callframe. ] each ] tabular-output nl ; -: .c ( -- ) callstack callstack. ; +: .c ( -- ) get-callstack callstack. ; : pprint-cell ( obj -- ) [ pprint-short ] with-cell ; diff --git a/basis/stack-checker/known-words/known-words.factor b/basis/stack-checker/known-words/known-words.factor index c3a0cc490e..aa7c8d07ac 100644 --- a/basis/stack-checker/known-words/known-words.factor +++ b/basis/stack-checker/known-words/known-words.factor @@ -346,7 +346,7 @@ M: object infer-call* \ call bad-macro-input ; \ bits>double { integer } { float } define-primitive \ bits>double make-foldable \ bits>float { integer } { float } define-primitive \ bits>float make-foldable \ both-fixnums? { object object } { object } define-primitive -\ callstack { } { callstack } define-primitive \ callstack make-flushable +\ get-callstack { } { callstack } define-primitive \ get-callstack make-flushable \ callstack-bounds { } { alien alien } define-primitive \ callstack-bounds make-flushable \ callstack-for { c-ptr } { callstack } define-primitive \ callstack make-flushable \ callstack>array { callstack } { array } define-primitive \ callstack>array make-flushable @@ -359,7 +359,7 @@ M: object infer-call* \ call bad-macro-input ; \ current-callback { } { fixnum } define-primitive \ current-callback make-flushable \ (callback-room) { } { byte-array } define-primitive \ (callback-room) make-flushable \ (data-room) { } { byte-array } define-primitive \ (data-room) make-flushable -\ datastack { } { array } define-primitive \ datastack make-flushable +\ get-datastack { } { array } define-primitive \ get-datastack make-flushable \ datastack-for { c-ptr } { array } define-primitive \ datastack-for make-flushable \ die { } { } define-primitive \ disable-gc-events { } { object } define-primitive @@ -438,7 +438,7 @@ M: object infer-call* \ call bad-macro-input ; \ resize-array { integer array } { array } define-primitive \ resize-byte-array { integer byte-array } { byte-array } define-primitive \ resize-string { integer string } { string } define-primitive -\ retainstack { } { array } define-primitive \ retainstack make-flushable +\ get-retainstack { } { array } define-primitive \ get-retainstack make-flushable \ retainstack-for { c-ptr } { array } define-primitive \ retainstack-for make-flushable \ set-alien-cell { c-ptr c-ptr integer } { } define-primitive \ set-alien-double { float c-ptr integer } { } define-primitive diff --git a/basis/threads/threads.factor b/basis/threads/threads.factor index d93ff65c92..ac23f04035 100644 --- a/basis/threads/threads.factor +++ b/basis/threads/threads.factor @@ -228,7 +228,7 @@ M: real sleep >integer nano-count + sleep-until ; : (spawn) ( thread -- ) - [ register-thread ] [ [ namestack ] dip resume-with ] bi ; + [ register-thread ] [ [ get-namestack ] dip resume-with ] bi ; : spawn ( quot name -- thread ) [ (spawn) ] keep ; @@ -237,7 +237,7 @@ M: real sleep [ '[ _ loop ] ] dip spawn ; : in-thread ( quot -- ) - [ datastack ] dip + [ get-datastack ] dip '[ _ set-datastack @ ] "Thread" spawn drop ; diff --git a/basis/tools/continuations/continuations.factor b/basis/tools/continuations/continuations.factor index bc64fea98d..4d7c8fea55 100644 --- a/basis/tools/continuations/continuations.factor +++ b/basis/tools/continuations/continuations.factor @@ -21,7 +21,7 @@ PRIVATE> SYMBOL: break-hook : break ( -- ) - current-continuation callstack >>call + current-continuation get-callstack >>call break-hook get call( continuation -- continuation' ) after-break ; @@ -63,7 +63,7 @@ M: object add-breakpoint ; \ (step-into-execute) t "step-into?" set-word-prop : (step-into-continuation) ( -- ) - current-continuation callstack >>call break ; + current-continuation get-callstack >>call break ; : (step-into-call-next-method) ( method -- ) next-method-quot (step-into-quotation) ; diff --git a/core/bootstrap/primitives.factor b/core/bootstrap/primitives.factor index e7a0bbed7d..a7205fd1ea 100755 --- a/core/bootstrap/primitives.factor +++ b/core/bootstrap/primitives.factor @@ -451,11 +451,11 @@ tuple { "fwrite" "io.streams.c" "primitive_fwrite" ( data length alien -- ) } { "(clone)" "kernel" "primitive_clone" ( obj -- newobj ) } { "" "kernel" "primitive_wrapper" ( obj -- wrapper ) } - { "callstack" "kernel" "primitive_callstack" ( -- callstack ) } + { "get-callstack" "kernel" "primitive_callstack" ( -- callstack ) } { "callstack>array" "kernel" "primitive_callstack_to_array" ( callstack -- array ) } - { "datastack" "kernel" "primitive_datastack" ( -- array ) } + { "get-datastack" "kernel" "primitive_datastack" ( -- array ) } { "die" "kernel" "primitive_die" ( -- ) } - { "retainstack" "kernel" "primitive_retainstack" ( -- array ) } + { "get-retainstack" "kernel" "primitive_retainstack" ( -- array ) } { "(identity-hashcode)" "kernel.private" "primitive_identity_hashcode" ( obj -- code ) } { "become" "kernel.private" "primitive_become" ( old new -- ) } { "callstack-bounds" "kernel.private" "primitive_callstack_bounds" ( -- start end ) } diff --git a/core/combinators/combinators-tests.factor b/core/combinators/combinators-tests.factor index 39c50f8479..dee0e2cec2 100644 --- a/core/combinators/combinators-tests.factor +++ b/core/combinators/combinators-tests.factor @@ -6,7 +6,7 @@ IN: combinators.tests { 3 } [ 1 2 [ + ] call( x y -- z ) ] unit-test [ 1 2 [ + ] call( -- z ) ] must-fail [ 1 2 [ + ] call( x y -- z a ) ] must-fail -{ 1 2 3 { 1 2 3 4 } } [ 1 2 3 4 [ datastack nip ] call( x -- y ) ] unit-test +{ 1 2 3 { 1 2 3 4 } } [ 1 2 3 4 [ get-datastack nip ] call( x -- y ) ] unit-test [ [ + ] call( x y -- z ) ] must-infer { 3 } [ 1 2 \ + execute( x y -- z ) ] unit-test diff --git a/core/combinators/combinators.factor b/core/combinators/combinators.factor index ef855bfd37..9d43d4c7e4 100644 --- a/core/combinators/combinators.factor +++ b/core/combinators/combinators.factor @@ -32,7 +32,7 @@ SLOT: terminated? ! Don't use fancy combinators here, since this word always ! runs unoptimized 2dup [ - [ [ datastack ] dip dip ] dip + [ [ get-datastack ] dip dip ] dip dup terminated?>> [ 2drop f ] [ dup in>> length swap out>> length check-datastack diff --git a/core/continuations/continuations-docs.factor b/core/continuations/continuations-docs.factor index ca58087a12..4132bacc1f 100644 --- a/core/continuations/continuations-docs.factor +++ b/core/continuations/continuations-docs.factor @@ -71,15 +71,15 @@ ARTICLE: "continuations.private" "Continuation implementation details" } "The five stacks can be read and written:" { $subsections - datastack + get-datastack set-datastack - retainstack + get-retainstack set-retainstack - callstack + get-callstack set-callstack - namestack + get-namestack set-namestack - catchstack + get-catchstack set-catchstack } ; @@ -112,7 +112,7 @@ HELP: catchstack* { $values { "catchstack" "a vector of continuations" } } { $description "Outputs the current catchstack." } ; -HELP: catchstack +HELP: get-catchstack { $values { "catchstack" "a vector of continuations" } } { $description "Outputs a copy of the current catchstack." } ; diff --git a/core/continuations/continuations-tests.factor b/core/continuations/continuations-tests.factor index 371c546142..dea2c40ae7 100644 --- a/core/continuations/continuations-tests.factor +++ b/core/continuations/continuations-tests.factor @@ -75,7 +75,7 @@ os windows? [ ] unless : don't-compile-me ( -- ) ; -: foo ( -- ) callstack "c" set don't-compile-me ; +: foo ( -- ) get-callstack "c" set don't-compile-me ; : bar ( -- a b ) 1 foo 2 ; << { don't-compile-me foo bar } [ t "no-compile" set-word-prop ] each >> diff --git a/core/continuations/continuations.factor b/core/continuations/continuations.factor index 8e43e48669..78911cea79 100644 --- a/core/continuations/continuations.factor +++ b/core/continuations/continuations.factor @@ -6,8 +6,8 @@ IN: continuations : with-datastack ( stack quot -- new-stack ) [ - [ [ datastack ] dip swap [ { } like set-datastack ] dip ] dip - swap [ call datastack ] dip + [ [ get-datastack ] dip swap [ { } like set-datastack ] dip ] dip + swap [ call get-datastack ] dip swap [ set-datastack ] dip ] ( stack quot -- new-stack ) call-effect-unsafe ; @@ -26,7 +26,7 @@ SYMBOL: restarts : dummy-1 ( -- obj ) f ; : dummy-2 ( obj -- obj ) ; -: catchstack ( -- catchstack ) catchstack* clone ; inline +: get-catchstack ( -- catchstack ) catchstack* clone ; inline : (set-catchstack) ( catchstack -- ) CONTEXT-OBJ-CATCHSTACK set-context-object ; inline @@ -44,7 +44,7 @@ TUPLE: continuation data call retain name catch ; C: continuation : current-continuation ( -- continuation ) - datastack callstack retainstack namestack catchstack + get-datastack get-callstack get-retainstack get-namestack get-catchstack ; > ; M: standard-generic effective-method - [ datastack ] dip [ "combination" word-prop #>> swap nth ] keep + [ get-datastack ] dip [ "combination" word-prop #>> swap nth ] keep method-for-object ; : inline-cache-quot ( word methods miss-word -- quot ) diff --git a/core/kernel/kernel-docs.factor b/core/kernel/kernel-docs.factor index 6d35f6193a..3389d9727c 100644 --- a/core/kernel/kernel-docs.factor +++ b/core/kernel/kernel-docs.factor @@ -26,7 +26,7 @@ HELP: -rot $complex-shuffle ; HELP: dupd $complex-shuffle ; HELP: swapd $complex-shuffle ; -HELP: datastack +HELP: get-datastack { $values { "array" array } } { $description "Outputs an array containing a copy of the data stack contents right before the call to this word, with the top of the stack at the end of the array." } ; @@ -34,7 +34,7 @@ HELP: set-datastack { $values { "array" array } } { $description "Replaces the data stack contents with a copy of an array. The end of the array becomes the top of the stack." } ; -HELP: retainstack +HELP: get-retainstack { $values { "array" array } } { $description "Outputs an array containing a copy of the retain stack contents right before the call to this word, with the top of the stack at the end of the array." } ; @@ -42,7 +42,7 @@ HELP: set-retainstack { $values { "array" array } } { $description "Replaces the retain stack contents with a copy of an array. The end of the array becomes the top of the stack." } ; -HELP: callstack +HELP: get-callstack { $values { "callstack" callstack } } { $description "Outputs a copy of the call stack contents, with the top of the stack at the end of the vector. The stack frame of the caller word is " { $emphasis "not" } " included. Each group of three elements in the callstack is frame:" { $list diff --git a/core/kernel/kernel-tests.factor b/core/kernel/kernel-tests.factor index 1898b63dcc..8442eb3a09 100644 --- a/core/kernel/kernel-tests.factor +++ b/core/kernel/kernel-tests.factor @@ -129,9 +129,9 @@ os windows? [ { 6 2 } [ 1 2 [ 5 + ] dip ] unit-test -{ } [ callstack set-callstack ] unit-test +{ } [ get-callstack set-callstack ] unit-test -[ 3drop datastack ] must-fail +[ 3drop get-datastack ] must-fail { } [ :c ] unit-test ! Doesn't compile; important diff --git a/core/kernel/kernel.factor b/core/kernel/kernel.factor index 50a0bededf..09d2f69bad 100644 --- a/core/kernel/kernel.factor +++ b/core/kernel/kernel.factor @@ -28,9 +28,9 @@ PRIMITIVE: 4dup ( w x y z -- w x y z w x y z ) PRIMITIVE: (clone) ( obj -- newobj ) PRIMITIVE: eq? ( obj1 obj2 -- ? ) PRIMITIVE: ( obj -- wrapper ) -PRIMITIVE: callstack ( -- callstack ) -PRIMITIVE: datastack ( -- array ) -PRIMITIVE: retainstack ( -- array ) +PRIMITIVE: get-datastack ( -- array ) +PRIMITIVE: get-callstack ( -- callstack ) +PRIMITIVE: get-retainstack ( -- array ) PRIMITIVE: die ( -- ) PRIMITIVE: callstack>array ( callstack -- array ) diff --git a/core/namespaces/namespaces-docs.factor b/core/namespaces/namespaces-docs.factor index 6e38bac6c3..66aaf1738e 100644 --- a/core/namespaces/namespaces-docs.factor +++ b/core/namespaces/namespaces-docs.factor @@ -33,7 +33,7 @@ ARTICLE: "namespaces-global" "Global variables" ARTICLE: "namespaces.private" "Namespace implementation details" "The namestack holds namespaces." { $subsections - namestack + get-namestack set-namestack namespace } @@ -169,7 +169,7 @@ HELP: namestack* { $values { "namestack" "a vector of assocs" } } { $description "Outputs the current name stack." } ; -HELP: namestack +HELP: get-namestack { $values { "namestack" "a vector of assocs" } } { $description "Outputs a copy of the current name stack." } ; diff --git a/core/namespaces/namespaces.factor b/core/namespaces/namespaces.factor index 6d20f1010f..5b54de0e6f 100644 --- a/core/namespaces/namespaces.factor +++ b/core/namespaces/namespaces.factor @@ -41,7 +41,7 @@ PRIVATE> : global ( -- g ) OBJ-GLOBAL special-object { global-hashtable } declare ; foldable : namespace ( -- namespace ) namestack* last ; inline -: namestack ( -- namestack ) namestack* clone ; +: get-namestack ( -- namestack ) namestack* clone ; : set-namestack ( namestack -- ) >vector CONTEXT-OBJ-NAMESTACK set-context-object ; : init-namespaces ( -- ) global 1array set-namestack ;