From 5c7627a777fc2c16d9caa37da3e2ea89023dfe9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindqvist?= Date: Sat, 3 Dec 2016 15:50:55 +0100 Subject: [PATCH] stack-checker.dependencies: removing the add-depends-on- words --- basis/compiler/tree/cleanup/cleanup.factor | 4 +-- .../tree/finalization/finalization.factor | 2 +- .../tree/propagation/simple/simple.factor | 4 +-- basis/stack-checker/backend/backend.factor | 2 +- .../dependencies/dependencies.factor | 26 +++++-------------- basis/stack-checker/inlining/inlining.factor | 2 +- .../known-words/known-words.factor | 2 +- 7 files changed, 15 insertions(+), 27 deletions(-) diff --git a/basis/compiler/tree/cleanup/cleanup.factor b/basis/compiler/tree/cleanup/cleanup.factor index ac2426dda1..6572ce8dd0 100644 --- a/basis/compiler/tree/cleanup/cleanup.factor +++ b/basis/compiler/tree/cleanup/cleanup.factor @@ -51,7 +51,7 @@ GENERIC: cleanup-tree* ( node -- node/nodes ) : record-folding ( #call -- ) dup word>> predicate? [ record-predicate-folding ] - [ word>> add-depends-on-definition ] + [ word>> +definition+ depends-on ] if ; : cleanup-folding ( #call -- nodes ) @@ -68,7 +68,7 @@ GENERIC: cleanup-tree* ( node -- node/nodes ) : record-inlining ( #call -- ) dup method>> [ add-method-dependency ] - [ word>> add-depends-on-definition ] if ; + [ word>> +definition+ depends-on ] if ; : cleanup-inlining ( #call -- nodes ) [ record-inlining ] [ body>> cleanup-tree ] bi ; diff --git a/basis/compiler/tree/finalization/finalization.factor b/basis/compiler/tree/finalization/finalization.factor index 0ada655b80..13adc83218 100644 --- a/basis/compiler/tree/finalization/finalization.factor +++ b/basis/compiler/tree/finalization/finalization.factor @@ -15,7 +15,7 @@ GENERIC: finalize* ( node -- nodes ) : splice-final ( quot -- nodes ) splice-quot finalize ; : splice-predicate ( word -- nodes ) - [ add-depends-on-definition ] [ def>> splice-final ] bi ; + [ +definition+ depends-on ] [ def>> splice-final ] bi ; M: #copy finalize* drop f ; diff --git a/basis/compiler/tree/propagation/simple/simple.factor b/basis/compiler/tree/propagation/simple/simple.factor index 2692767f39..d9b208edb1 100644 --- a/basis/compiler/tree/propagation/simple/simple.factor +++ b/basis/compiler/tree/propagation/simple/simple.factor @@ -25,7 +25,7 @@ M: #push propagate-before GENERIC: add-depends-on-class ( obj -- ) M: class add-depends-on-class - add-depends-on-conditionally ; + +conditional+ depends-on ; M: maybe add-depends-on-class class>> add-depends-on-class ; @@ -118,7 +118,7 @@ ERROR: invalid-outputs #call infos ; : propagate-predicate ( #call word -- infos ) [ in-d>> first value-info ] [ "predicating" word-prop ] bi* - [ nip add-depends-on-conditionally ] + [ nip +conditional+ depends-on ] [ predicate-output-infos 1array ] 2bi ; : default-output-value-infos ( #call word -- infos ) diff --git a/basis/stack-checker/backend/backend.factor b/basis/stack-checker/backend/backend.factor index 19c2ac73af..cbcc4b095b 100644 --- a/basis/stack-checker/backend/backend.factor +++ b/basis/stack-checker/backend/backend.factor @@ -82,7 +82,7 @@ GENERIC: apply-object ( obj -- ) M: wrapper apply-object wrapped>> - [ dup word? [ add-depends-on-effect ] [ drop ] if ] + [ dup word? [ +effect+ depends-on ] [ drop ] if ] [ push-literal ] bi ; diff --git a/basis/stack-checker/dependencies/dependencies.factor b/basis/stack-checker/dependencies/dependencies.factor index 2bf4c48d19..8044796204 100644 --- a/basis/stack-checker/dependencies/dependencies.factor +++ b/basis/stack-checker/dependencies/dependencies.factor @@ -26,28 +26,18 @@ SYMBOLS: +effect+ +conditional+ +definition+ ; ] [ 3drop ] if ] if ; -: add-depends-on-effect ( word -- ) - +effect+ depends-on ; - -: add-depends-on-conditionally ( word -- ) - +conditional+ depends-on ; - -: add-depends-on-definition ( word -- ) - +definition+ depends-on ; - GENERIC: add-depends-on-c-type ( c-type -- ) M: void add-depends-on-c-type drop ; -M: c-type-word add-depends-on-c-type add-depends-on-definition ; +M: c-type-word add-depends-on-c-type +definition+ depends-on ; M: array add-depends-on-c-type - [ word? ] filter [ add-depends-on-definition ] each ; + [ word? ] filter [ +definition+ depends-on ] each ; M: pointer add-depends-on-c-type to>> add-depends-on-c-type ; -! Generic words that the current quotation depends on SYMBOL: generic-dependencies : ?class-or ( class class/f -- class' ) @@ -57,8 +47,6 @@ SYMBOL: generic-dependencies generic-dependencies get [ [ ?class-or ] change-at ] [ 2drop ] if* ; -! Conditional dependencies are re-evaluated when classes change; -! if any fail, the word is recompiled SYMBOL: conditional-dependencies GENERIC: satisfied? ( dependency -- ? ) @@ -93,7 +81,7 @@ M: depends-on-instance-predicate satisfied? TUPLE: depends-on-next-method class generic next-method ; : add-depends-on-next-method ( class generic next-method -- ) - over add-depends-on-conditionally + over +conditional+ depends-on depends-on-next-method add-conditional-dependency ; M: depends-on-next-method satisfied? @@ -105,7 +93,7 @@ M: depends-on-next-method satisfied? TUPLE: depends-on-method class generic method ; : add-depends-on-method ( class generic method -- ) - over add-depends-on-conditionally + over +conditional+ depends-on depends-on-method add-conditional-dependency ; M: depends-on-method satisfied? @@ -117,7 +105,7 @@ M: depends-on-method satisfied? TUPLE: depends-on-tuple-layout class layout ; : add-depends-on-tuple-layout ( class layout -- ) - [ drop add-depends-on-conditionally ] + [ drop +conditional+ depends-on ] [ depends-on-tuple-layout add-conditional-dependency ] 2bi ; M: depends-on-tuple-layout satisfied? @@ -126,7 +114,7 @@ M: depends-on-tuple-layout satisfied? TUPLE: depends-on-flushable word ; : add-depends-on-flushable ( word -- ) - [ add-depends-on-conditionally ] + [ +conditional+ depends-on ] [ depends-on-flushable add-conditional-dependency ] bi ; M: depends-on-flushable satisfied? @@ -135,7 +123,7 @@ M: depends-on-flushable satisfied? TUPLE: depends-on-final class ; : add-depends-on-final ( word -- ) - [ add-depends-on-conditionally ] + [ +conditional+ depends-on ] [ depends-on-final add-conditional-dependency ] bi ; M: depends-on-final satisfied? diff --git a/basis/stack-checker/inlining/inlining.factor b/basis/stack-checker/inlining/inlining.factor index 2d82a6262d..0cd39fc731 100644 --- a/basis/stack-checker/inlining/inlining.factor +++ b/basis/stack-checker/inlining/inlining.factor @@ -141,7 +141,7 @@ M: declared-effect (undeclared-known) known>> (undeclared-known) ; : inline-word ( word -- ) commit-literals - [ add-depends-on-definition ] + [ +definition+ depends-on ] [ declare-input-effects ] [ dup inline-recursive-label [ diff --git a/basis/stack-checker/known-words/known-words.factor b/basis/stack-checker/known-words/known-words.factor index edab7e2918..fab1354fe2 100644 --- a/basis/stack-checker/known-words/known-words.factor +++ b/basis/stack-checker/known-words/known-words.factor @@ -47,7 +47,7 @@ IN: stack-checker.known-words ( value -- ) apply-word/effect ; : non-inline-word ( word -- ) - dup add-depends-on-effect + dup +effect+ depends-on { { [ dup "shuffle" word-prop ] [ infer-shuffle-word ] } { [ dup "special" word-prop ] [ infer-special ] }