Merge branch 'master' of git://factorcode.org/git/factor
commit
09cd5b3446
|
@ -1,5 +1,5 @@
|
||||||
IN: alien.tests
|
IN: alien.tests
|
||||||
USING: alien alien.accessors alien.syntax byte-arrays arrays
|
USING: accessors alien alien.accessors alien.syntax byte-arrays arrays
|
||||||
kernel kernel.private namespaces tools.test sequences libc math
|
kernel kernel.private namespaces tools.test sequences libc math
|
||||||
system prettyprint layouts ;
|
system prettyprint layouts ;
|
||||||
|
|
||||||
|
@ -65,6 +65,10 @@ cell 8 = [
|
||||||
|
|
||||||
[ f ] [ 0 B{ 1 2 3 } <displaced-alien> pinned-c-ptr? ] unit-test
|
[ f ] [ 0 B{ 1 2 3 } <displaced-alien> pinned-c-ptr? ] unit-test
|
||||||
|
|
||||||
|
[ f ] [ 0 B{ 1 2 3 } <displaced-alien> 1 swap <displaced-alien> pinned-c-ptr? ] unit-test
|
||||||
|
|
||||||
|
[ t ] [ 0 B{ 1 2 3 } <displaced-alien> 1 swap <displaced-alien> underlying>> byte-array? ] unit-test
|
||||||
|
|
||||||
[ "( displaced alien )" ] [ 0 B{ 1 2 3 } <displaced-alien> unparse ] unit-test
|
[ "( displaced alien )" ] [ 0 B{ 1 2 3 } <displaced-alien> unparse ] unit-test
|
||||||
|
|
||||||
[ f ] [ DLL" fadfasdfsada" dll-valid? ] unit-test
|
[ f ] [ DLL" fadfasdfsada" dll-valid? ] unit-test
|
||||||
|
|
|
@ -2,20 +2,31 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors assocs words sequences arrays compiler
|
USING: accessors assocs words sequences arrays compiler
|
||||||
tools.time io.styles io prettyprint vocabs kernel sorting
|
tools.time io.styles io prettyprint vocabs kernel sorting
|
||||||
generator optimizer math math.order ;
|
generator optimizer math math.order math.statistics combinators ;
|
||||||
IN: report.optimizer
|
IN: report.optimizer
|
||||||
|
|
||||||
: count-optimization-passes ( nodes n -- n )
|
: count-optimization-passes ( nodes n -- n )
|
||||||
>r optimize-1
|
>r optimize-1
|
||||||
[ r> 1+ count-optimization-passes ] [ drop r> ] if ;
|
[ r> 1+ count-optimization-passes ] [ drop r> ] if ;
|
||||||
|
|
||||||
: results
|
: table. ( alist -- )
|
||||||
[ [ second ] prepose compare ] curry sort 20 tail*
|
20 short tail*
|
||||||
print
|
|
||||||
standard-table-style
|
standard-table-style
|
||||||
[
|
[
|
||||||
[ [ [ pprint-cell ] each ] with-row ] each
|
[ [ [ pprint-cell ] each ] with-row ] each
|
||||||
] tabular-output ; inline
|
] tabular-output ;
|
||||||
|
|
||||||
|
: results ( results quot title -- )
|
||||||
|
print
|
||||||
|
[ second ] prepose
|
||||||
|
[ [ compare ] curry sort table. ]
|
||||||
|
[
|
||||||
|
map
|
||||||
|
[ "Mean: " write mean >float . ]
|
||||||
|
[ "Median: " write median >float . ]
|
||||||
|
[ "Standard deviation: " write std >float . ]
|
||||||
|
tri
|
||||||
|
] 2bi ; inline
|
||||||
|
|
||||||
: optimizer-measurements ( -- alist )
|
: optimizer-measurements ( -- alist )
|
||||||
all-words [ compiled>> ] filter
|
all-words [ compiled>> ] filter
|
||||||
|
@ -26,8 +37,10 @@ IN: report.optimizer
|
||||||
] { } map>assoc ;
|
] { } map>assoc ;
|
||||||
|
|
||||||
: optimizer-measurements. ( alist -- )
|
: optimizer-measurements. ( alist -- )
|
||||||
[ [ first ] "Worst number of optimizer passes:" results ]
|
{
|
||||||
[ [ second ] "Worst compile times:" results ] bi ;
|
[ [ first ] "Optimizer passes:" results ]
|
||||||
|
[ [ second ] "Compile times:" results ]
|
||||||
|
} cleave ;
|
||||||
|
|
||||||
: optimizer-report ( -- )
|
: optimizer-report ( -- )
|
||||||
optimizer-measurements optimizer-measurements. ;
|
optimizer-measurements optimizer-measurements. ;
|
||||||
|
|
|
@ -62,7 +62,7 @@ CELL allot_alien(CELL delegate, CELL displacement)
|
||||||
{
|
{
|
||||||
F_ALIEN *delegate_alien = untag_object(delegate);
|
F_ALIEN *delegate_alien = untag_object(delegate);
|
||||||
displacement += delegate_alien->displacement;
|
displacement += delegate_alien->displacement;
|
||||||
alien->alien = F;
|
alien->alien = delegate_alien->alien;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
alien->alien = delegate;
|
alien->alien = delegate;
|
||||||
|
|
Loading…
Reference in New Issue