diff --git a/core/alien/alien-tests.factor b/core/alien/alien-tests.factor index 9be2885888..5a880fa5a9 100755 --- a/core/alien/alien-tests.factor +++ b/core/alien/alien-tests.factor @@ -1,5 +1,5 @@ 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 system prettyprint layouts ; @@ -65,6 +65,10 @@ cell 8 = [ [ f ] [ 0 B{ 1 2 3 } pinned-c-ptr? ] unit-test +[ f ] [ 0 B{ 1 2 3 } 1 swap pinned-c-ptr? ] unit-test + +[ t ] [ 0 B{ 1 2 3 } 1 swap underlying>> byte-array? ] unit-test + [ "( displaced alien )" ] [ 0 B{ 1 2 3 } unparse ] unit-test [ f ] [ DLL" fadfasdfsada" dll-valid? ] unit-test diff --git a/extra/reports/optimizer/optimizer.factor b/extra/reports/optimizer/optimizer.factor index 5016371052..ec3668b83b 100755 --- a/extra/reports/optimizer/optimizer.factor +++ b/extra/reports/optimizer/optimizer.factor @@ -2,20 +2,31 @@ ! See http://factorcode.org/license.txt for BSD license. USING: accessors assocs words sequences arrays compiler 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 : count-optimization-passes ( nodes n -- n ) >r optimize-1 [ r> 1+ count-optimization-passes ] [ drop r> ] if ; -: results - [ [ second ] prepose compare ] curry sort 20 tail* - print +: table. ( alist -- ) + 20 short tail* standard-table-style [ [ [ [ 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 ) all-words [ compiled>> ] filter @@ -26,8 +37,10 @@ IN: report.optimizer ] { } map>assoc ; : 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-measurements optimizer-measurements. ; diff --git a/vm/alien.c b/vm/alien.c index 7fdf9ccdb2..5b4ff3b832 100755 --- a/vm/alien.c +++ b/vm/alien.c @@ -62,7 +62,7 @@ CELL allot_alien(CELL delegate, CELL displacement) { F_ALIEN *delegate_alien = untag_object(delegate); displacement += delegate_alien->displacement; - alien->alien = F; + alien->alien = delegate_alien->alien; } else alien->alien = delegate;