From 515f7e526915c2feb248b7a171263db480d21590 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindqvist?= Date: Fri, 9 Dec 2016 11:53:59 +0100 Subject: [PATCH] tools.memory: moving the code-block types to the vm vocab --- basis/tools/memory/memory-tests.factor | 12 ++++-------- basis/tools/memory/memory.factor | 15 +++++---------- basis/vm/vm.factor | 4 ++++ 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/basis/tools/memory/memory-tests.factor b/basis/tools/memory/memory-tests.factor index 5217fc8ff5..e1ba5c45d6 100644 --- a/basis/tools/memory/memory-tests.factor +++ b/basis/tools/memory/memory-tests.factor @@ -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 diff --git a/basis/tools/memory/memory.factor b/basis/tools/memory/memory.factor index 18065f3307..309ae605ad 100644 --- a/basis/tools/memory/memory.factor +++ b/basis/tools/memory/memory.factor @@ -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 } ; ( 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. ; diff --git a/basis/vm/vm.factor b/basis/vm/vm.factor index 0b7dbfe6bc..1122871c13 100644 --- a/basis/vm/vm.factor +++ b/basis/vm/vm.factor @@ -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