accurate type signature for make-tuple
parent
c0b441d49c
commit
99fde7534e
|
@ -15,7 +15,8 @@ hashtables errors sequences vectors ;
|
||||||
: make-tuple ( class size -- tuple )
|
: make-tuple ( class size -- tuple )
|
||||||
#! Internal allocation function. Do not call it directly,
|
#! Internal allocation function. Do not call it directly,
|
||||||
#! since you can fool the runtime and corrupt memory by
|
#! since you can fool the runtime and corrupt memory by
|
||||||
#! specifying an incorrect size.
|
#! specifying an incorrect size. Note that this word is also
|
||||||
|
#! handled specially by the compiler's type inferencer.
|
||||||
<tuple> [ 2 set-slot ] keep ;
|
<tuple> [ 2 set-slot ] keep ;
|
||||||
|
|
||||||
IN: generic
|
IN: generic
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
! Copyright (C) 2004, 2005 Slava Pestov.
|
! Copyright (C) 2004, 2005 Slava Pestov.
|
||||||
! See http://factor.sf.net/license.txt for BSD license.
|
! See http://factor.sf.net/license.txt for BSD license.
|
||||||
IN: inference
|
IN: inference
|
||||||
USING: generic hashtables kernel namespaces sequences vectors
|
USING: generic hashtables kernel kernel-internals namespaces
|
||||||
words ;
|
sequences vectors words ;
|
||||||
|
|
||||||
! Infer possible classes of values in a dataflow IR.
|
! Infer possible classes of values in a dataflow IR.
|
||||||
|
|
||||||
|
@ -85,11 +85,21 @@ M: node child-ties ( node -- seq )
|
||||||
2drop
|
2drop
|
||||||
] ifte ;
|
] ifte ;
|
||||||
|
|
||||||
|
\ make-tuple [
|
||||||
|
dup node-in-d first literal-value 1vector
|
||||||
|
] "output-classes" set-word-prop
|
||||||
|
|
||||||
|
: output-classes ( node -- seq )
|
||||||
|
dup node-param "output-classes" word-prop [
|
||||||
|
call
|
||||||
|
] [
|
||||||
|
node-param "infer-effect" word-prop second
|
||||||
|
] ?ifte ;
|
||||||
|
|
||||||
M: #call infer-classes* ( node -- )
|
M: #call infer-classes* ( node -- )
|
||||||
dup node-param [
|
dup node-param [
|
||||||
dup create-ties
|
dup create-ties
|
||||||
dup node-param "infer-effect" word-prop second
|
dup output-classes swap node-out-d intersect-classes
|
||||||
swap node-out-d intersect-classes
|
|
||||||
] [
|
] [
|
||||||
drop
|
drop
|
||||||
] ifte ;
|
] ifte ;
|
||||||
|
|
Loading…
Reference in New Issue