USING: arrays assocs kernel math memory namespaces parser sequences
-tools.memory tools.memory.private tools.test tools.time ;
+tools.memory tools.memory.private tools.test tools.time vm ;
IN: tools.memory.tests
{ } [ room. ] unit-test
gc-events get [ space-reclaimed 0 < ] any?
] unit-test
-{ +pic+ } [
- 2 code-block-type
-] unit-test
-
{ t t t } [
get-code-blocks code-block-stats nip
- [ +unoptimized+ of 0 > ]
- [ +optimized+ of 0 > ]
- [ +pic+ of 0 > ] tri
+ [ CODE-BLOCK-UNOPTIMIZED of 0 > ]
+ [ CODE-BLOCK-OPTIMIZED of 0 > ]
+ [ CODE-BLOCK-PIC of 0 > ] tri
] unit-test
! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays assocs binary-search classes classes.struct
combinators combinators.smart continuations fry grouping hashtables
-hints io io.styles kernel layouts math math.order math.parser
+hints io io.styles kernel layouts literals math math.order math.parser
math.statistics memory namespaces prettyprint sequences
sequences.generalizations sorting vm ;
IN: tools.memory
{ "Data compaction time:" [ PHASE-DATA-COMPACTION sum-phase-times ] }
} object-table. ;
-SINGLETONS: +unoptimized+ +optimized+ +pic+ ;
-
TUPLE: code-block
{ owner read-only }
{ parameters read-only }
<PRIVATE
-: code-block-type ( n -- type )
- { +unoptimized+ +optimized+ +pic+ } nth ;
-
: <code-block> ( seq -- code-block )
6 firstn-unsafe {
[ ]
[ ]
[ ]
- [ code-block-type ]
+ [ ]
[ ]
[ tag-bits get shift ]
} spread code-block boa ; inline
: code-block-table. ( counts sizes -- )
[
{
- { "Optimized code:" +optimized+ }
- { "Unoptimized code:" +unoptimized+ }
- { "Inline caches:" +pic+ }
+ ${ "Optimized code:" CODE-BLOCK-OPTIMIZED }
+ ${ "Unoptimized code:" CODE-BLOCK-UNOPTIMIZED }
+ ${ "Inline caches:" CODE-BLOCK-PIC }
}
] 2dip '[ _ _ code-block-table-row ] { } assoc>map
simple-table. ;
{ gc-root-count uint read-only }
{ derived-root-count uint read-only }
{ return-address-count uint read-only } ;
+
+CONSTANT: CODE-BLOCK-UNOPTIMIZED 0
+CONSTANT: CODE-BLOCK-OPTIMIZED 1
+CONSTANT: CODE-BLOCK-PIC 2