tools.memory: moving the code-block types to the vm vocab

char-rename
Björn Lindqvist 2016-12-09 11:53:59 +01:00
parent 5a1cb3f81e
commit 515f7e5269
3 changed files with 13 additions and 18 deletions

View File

@ -1,5 +1,5 @@
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
@ -16,13 +16,9 @@ IN: tools.memory.tests
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

View File

@ -2,7 +2,7 @@
! 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
@ -203,8 +203,6 @@ SYMBOL: gc-events
{ "Data compaction time:" [ PHASE-DATA-COMPACTION sum-phase-times ] }
} object-table. ;
SINGLETONS: +unoptimized+ +optimized+ +pic+ ;
TUPLE: code-block
{ owner read-only }
{ parameters read-only }
@ -217,15 +215,12 @@ TUPLE: code-blocks { blocks groups } { cache hashtable } ;
<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
@ -287,9 +282,9 @@ INSTANCE: code-blocks immutable-sequence
: 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. ;

View File

@ -110,3 +110,7 @@ STRUCT: gc-info
{ 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