Merge branch 'master' of git://factorcode.org/git/factor
Conflicts: extra/io/serial/unix/termios/linux/linux.factordb4
commit
761e6a7bf8
|
@ -218,13 +218,13 @@ M: c-type-name unbox-return c-type unbox-return ;
|
|||
|
||||
: little-endian? ( -- ? ) 1 <int> *char 1 = ; foldable
|
||||
|
||||
GENERIC: heap-size ( name -- size ) foldable
|
||||
GENERIC: heap-size ( name -- size )
|
||||
|
||||
M: c-type-name heap-size c-type heap-size ;
|
||||
|
||||
M: abstract-c-type heap-size size>> ;
|
||||
|
||||
GENERIC: stack-size ( name -- size ) foldable
|
||||
GENERIC: stack-size ( name -- size )
|
||||
|
||||
M: c-type-name stack-size c-type stack-size ;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2008, 2009 Slava Pestov, Daniel Ehrenberg.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: kernel sequences words fry generic accessors
|
||||
USING: alien.c-types kernel sequences words fry generic accessors
|
||||
classes.tuple classes classes.algebra definitions
|
||||
stack-checker.dependencies quotations classes.tuple.private math
|
||||
math.partial-dispatch math.private math.intervals sets.private
|
||||
|
@ -8,6 +8,7 @@ math.floats.private math.integers.private layouts math.order
|
|||
vectors hashtables combinators effects generalizations assocs
|
||||
sets combinators.short-circuit sequences.private locals growable
|
||||
stack-checker namespaces compiler.tree.propagation.info ;
|
||||
FROM: math => float ;
|
||||
IN: compiler.tree.propagation.transforms
|
||||
|
||||
\ equal? [
|
||||
|
@ -307,3 +308,11 @@ CONSTANT: lookup-table-at-max 256
|
|||
in-d>> second value-info class>> growable class<=
|
||||
[ \ push def>> ] [ f ] if
|
||||
] "custom-inlining" set-word-prop
|
||||
|
||||
! We want to constant-fold calls to heap-size, and recompile those
|
||||
! calls when a C type is redefined
|
||||
\ heap-size [
|
||||
dup word? [
|
||||
[ inlined-dependency depends-on ] [ heap-size '[ _ ] ] bi
|
||||
] [ drop f ] if
|
||||
] 1 define-partial-eval
|
||||
|
|
|
@ -153,3 +153,22 @@ SPECIALIZED-ARRAY: __does_not_exist__
|
|||
__does_not_exist__ specialized-array-vocab forget-vocab
|
||||
] with-compilation-unit
|
||||
] unit-test
|
||||
|
||||
STRUCT: struct-resize-test { x int } ;
|
||||
|
||||
SPECIALIZED-ARRAY: struct-resize-test
|
||||
|
||||
[ 40 ] [ 10 <struct-resize-test-array> byte-length ] unit-test
|
||||
|
||||
: struct-resize-test-usage ( seq -- seq )
|
||||
[ struct-resize-test <struct> swap >>x ] map
|
||||
>struct-resize-test-array
|
||||
[ x>> ] { } map-as ;
|
||||
|
||||
[ { 10 20 30 } ] [ { 10 20 30 } struct-resize-test-usage ] unit-test
|
||||
|
||||
[ ] [ "IN: specialized-arrays.tests USE: classes.struct USE: alien.c-types STRUCT: struct-resize-test { x int } { y int } ;" eval( -- ) ] unit-test
|
||||
|
||||
[ 80 ] [ 10 <struct-resize-test-array> byte-length ] unit-test
|
||||
|
||||
[ { 10 20 30 } ] [ { 10 20 30 } struct-resize-test-usage ] unit-test
|
||||
|
|
Loading…
Reference in New Issue