;
MACRO: (simple-local-allot) ( c-type -- quot )
- [ depends-on-c-type ]
+ [ add-depends-on-c-type ]
[ dup '[ _ heap-size _ c-type-align (local-allot) ] ] bi ;
: [hairy-local-allot] ( c-type initial -- quot )
drop [ >c-ptr ] ;
MACRO: read-struct-slot ( slot -- )
- dup type>> depends-on-c-type
+ dup type>> add-depends-on-c-type
(reader-quot) ;
MACRO: write-struct-slot ( slot -- )
- dup type>> depends-on-c-type
+ dup type>> add-depends-on-c-type
(writer-quot) ;
PRIVATE>
: record-predicate-folding ( #call -- )
>predicate-folding< pick literal?>>
- [ [ literal>> ] 2dip depends-on-instance-predicate ]
- [ [ class>> ] 2dip depends-on-class-predicate ]
+ [ [ literal>> ] 2dip add-depends-on-instance-predicate ]
+ [ [ class>> ] 2dip add-depends-on-class-predicate ]
if ;
: record-folding ( #call -- )
dup word>> predicate?
[ record-predicate-folding ]
- [ word>> depends-on-definition ]
+ [ word>> add-depends-on-definition ]
if ;
: cleanup-folding ( #call -- nodes )
! Method inlining
: add-method-dependency ( #call -- )
dup method>> word? [
- [ [ class>> ] [ word>> ] bi depends-on-generic ]
- [ [ class>> ] [ word>> ] [ method>> ] tri depends-on-method ]
+ [ [ class>> ] [ word>> ] bi add-depends-on-generic ]
+ [ [ class>> ] [ word>> ] [ method>> ] tri add-depends-on-method ]
bi
] [ drop ] if ;
: record-inlining ( #call -- )
dup method>>
[ add-method-dependency ]
- [ word>> depends-on-definition ] if ;
+ [ word>> add-depends-on-definition ] if ;
: cleanup-inlining ( #call -- nodes )
[ record-inlining ] [ body>> cleanup ] bi ;
] [ drop f ] if ;
: remove-flushable-call ( #call -- node )
- [ word>> depends-on-flushable ]
+ [ word>> add-depends-on-flushable ]
[ in-d>> <#drop> remove-dead-code* ]
bi ;
: splice-final ( quot -- nodes ) splice-quot finalize ;
: splice-predicate ( word -- nodes )
- [ depends-on-definition ] [ def>> splice-final ] bi ;
+ [ add-depends-on-definition ] [ def>> splice-final ] bi ;
M: #copy finalize* drop f ;
dup literal>> classoid?
[
literal>>
- [ depends-on-class ]
+ [ add-depends-on-class ]
[ predicate-output-infos ]
bi
] [ 2drop object-info ] if
: set-value-infos ( infos values -- )
[ set-value-info ] 2each ;
-GENERIC: depends-on-class ( obj -- )
+GENERIC: add-depends-on-class ( obj -- )
-M: class depends-on-class
- depends-on-conditionally ;
+M: class add-depends-on-class
+ add-depends-on-conditionally ;
-M: maybe depends-on-class
- class>> depends-on-class ;
+M: maybe add-depends-on-class
+ class>> add-depends-on-class ;
-M: anonymous-union depends-on-class
- members>> [ depends-on-class ] each ;
+M: anonymous-union add-depends-on-class
+ members>> [ add-depends-on-class ] each ;
-M: anonymous-intersection depends-on-class
- participants>> [ depends-on-class ] each ;
+M: anonymous-intersection add-depends-on-class
+ participants>> [ add-depends-on-class ] each ;
M: #declare propagate-before
#! We need to force the caller word to recompile when the
#! classes mentioned in the declaration are redefined, since
#! now we're making assumptions but their definitions.
declaration>> [
- [ depends-on-class ]
+ [ add-depends-on-class ]
[ <class-info> swap refine-value-info ]
bi
] assoc-each ;
#! class definition itself.
[ in-d>> first value-info ]
[ "predicating" word-prop ] bi*
- [ nip depends-on-conditionally ]
+ [ nip add-depends-on-conditionally ]
[ predicate-output-infos 1array ] 2bi ;
: default-output-value-infos ( #call word -- infos )
: inline-new ( class -- quot/f )
dup tuple-class? [
dup tuple-layout
- [ depends-on-tuple-layout ]
+ [ add-depends-on-tuple-layout ]
[ drop all-slots [ initial>> literalize ] [ ] map-as ]
[ nip ]
2tri
! We want to constant-fold calls to heap-size, and recompile those
! calls when a C type is redefined
\ heap-size [
- [ depends-on-c-type ] [ heap-size '[ _ ] ] bi
+ [ add-depends-on-c-type ] [ heap-size '[ _ ] ] bi
] 1 define-partial-eval
! Eliminates a few redundant checks here and there
return-prep-quot infer-quot-here ;
: pop-return ( params -- params )
- pop-literal [ depends-on-c-type ] [ nip >>return ] bi ;
+ pop-literal [ add-depends-on-c-type ] [ nip >>return ] bi ;
: pop-library ( params -- params )
pop-literal nip >>library ;
pop-literal nip >>function ;
: pop-params ( params -- params )
- pop-literal [ [ depends-on-c-type ] each ] [ nip >>parameters ] bi ;
+ pop-literal [ [ add-depends-on-c-type ] each ] [ nip >>parameters ] bi ;
: pop-abi ( params -- params )
pop-literal nip >>abi ;
M: wrapper apply-object
wrapped>>
- [ dup word? [ depends-on-effect ] [ drop ] if ]
+ [ dup word? [ add-depends-on-effect ] [ drop ] if ]
[ push-literal ]
bi ;
] [ 3drop ] if
] if ;
-: depends-on-effect ( word -- )
+: add-depends-on-effect ( word -- )
effect-dependency depends-on ;
-: depends-on-conditionally ( word -- )
+: add-depends-on-conditionally ( word -- )
conditional-dependency depends-on ;
-: depends-on-definition ( word -- )
+: add-depends-on-definition ( word -- )
definition-dependency depends-on ;
-GENERIC: depends-on-c-type ( c-type -- )
+GENERIC: add-depends-on-c-type ( c-type -- )
-M: void depends-on-c-type drop ;
+M: void add-depends-on-c-type drop ;
-M: c-type-word depends-on-c-type depends-on-definition ;
+M: c-type-word add-depends-on-c-type add-depends-on-definition ;
-M: array depends-on-c-type
- [ word? ] filter [ depends-on-definition ] each ;
+M: array add-depends-on-c-type
+ [ word? ] filter [ add-depends-on-definition ] each ;
-M: pointer depends-on-c-type
- to>> depends-on-c-type ;
+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' )
[ class-or ] when* ;
-: depends-on-generic ( class generic -- )
+: add-depends-on-generic ( class generic -- )
generic-dependencies get dup
[ [ ?class-or ] change-at ] [ 3drop ] if ;
TUPLE: depends-on-class-predicate class1 class2 result ;
-: depends-on-class-predicate ( class1 class2 result -- )
+: add-depends-on-class-predicate ( class1 class2 result -- )
\ depends-on-class-predicate add-conditional-dependency ;
M: depends-on-class-predicate satisfied?
TUPLE: depends-on-instance-predicate object class result ;
-: depends-on-instance-predicate ( object class result -- )
+: add-depends-on-instance-predicate ( object class result -- )
\ depends-on-instance-predicate add-conditional-dependency ;
M: depends-on-instance-predicate satisfied?
TUPLE: depends-on-next-method class generic next-method ;
-: depends-on-next-method ( class generic next-method -- )
- over depends-on-conditionally
+: add-depends-on-next-method ( class generic next-method -- )
+ over add-depends-on-conditionally
\ depends-on-next-method add-conditional-dependency ;
M: depends-on-next-method satisfied?
TUPLE: depends-on-method class generic method ;
-: depends-on-method ( class generic method -- )
- over depends-on-conditionally
+: add-depends-on-method ( class generic method -- )
+ over add-depends-on-conditionally
\ depends-on-method add-conditional-dependency ;
M: depends-on-method satisfied?
TUPLE: depends-on-tuple-layout class layout ;
-: depends-on-tuple-layout ( class layout -- )
- [ drop depends-on-conditionally ]
+: add-depends-on-tuple-layout ( class layout -- )
+ [ drop add-depends-on-conditionally ]
[ \ depends-on-tuple-layout add-conditional-dependency ] 2bi ;
M: depends-on-tuple-layout satisfied?
TUPLE: depends-on-flushable word ;
-: depends-on-flushable ( word -- )
- [ depends-on-conditionally ]
+: add-depends-on-flushable ( word -- )
+ [ add-depends-on-conditionally ]
[ \ depends-on-flushable add-conditional-dependency ] bi ;
M: depends-on-flushable satisfied?
TUPLE: depends-on-final class ;
-: depends-on-final ( word -- )
- [ depends-on-conditionally ]
+: add-depends-on-final ( word -- )
+ [ add-depends-on-conditionally ]
[ \ depends-on-final add-conditional-dependency ] bi ;
M: depends-on-final satisfied?
: inline-word ( word -- )
commit-literals
- [ depends-on-definition ]
+ [ add-depends-on-definition ]
[ declare-input-effects ]
[
dup inline-recursive-label [
( value -- ) apply-word/effect ;
: non-inline-word ( word -- )
- dup depends-on-effect
+ dup add-depends-on-effect
{
{ [ dup "shuffle" word-prop ] [ infer-shuffle-word ] }
{ [ dup "special" word-prop ] [ infer-special ] }
[ "method-class" word-prop ]
[ "method-generic" word-prop ] bi
2dup next-method
- depends-on-next-method ;
+ add-depends-on-next-method ;
\ (call-next-method) [
[ add-next-method-dependency ]
\ boa [
dup tuple-class? [
dup tuple-layout
- [ depends-on-tuple-layout ]
+ [ add-depends-on-tuple-layout ]
[ [ "boa-check" word-prop [ ] or ] dip ] 2bi
'[ @ _ <tuple-boa> ]
] [
: typed-stack-effect? ( effect -- ? )
[ object = ] all? not ;
-: depends-on-unboxing ( class -- )
- [ dup tuple-layout depends-on-tuple-layout ]
- [ depends-on-final ]
+: add-depends-on-unboxing ( class -- )
+ [ dup tuple-layout add-depends-on-tuple-layout ]
+ [ add-depends-on-final ]
bi ;
: (unboxer) ( type -- quot )
dup unboxable-tuple-class? [
- dup depends-on-unboxing
+ dup add-depends-on-unboxing
all-slots [
[ name>> reader-word 1quotation ]
[ class>> (unboxer) ] bi compose
: (unboxed-types) ( type -- types )
dup unboxable-tuple-class?
[
- dup depends-on-unboxing
+ dup add-depends-on-unboxing
all-slots [ class>> (unboxed-types) ] map concat
]
[ 1array ] if ;
: boxer ( type -- quot )
dup unboxable-tuple-class?
[
- dup depends-on-unboxing
+ dup add-depends-on-unboxing
[ all-slots [ class>> ] map make-boxer ]
[ [ boa ] curry ]
bi compose