]> gitweb.factorcode.org Git - factor.git/commitdiff
tools.memory: moving the code-block types to the vm vocab
authorBjörn Lindqvist <bjourne@gmail.com>
Fri, 9 Dec 2016 10:53:59 +0000 (11:53 +0100)
committerBjörn Lindqvist <bjourne@gmail.com>
Fri, 9 Dec 2016 10:53:59 +0000 (11:53 +0100)
basis/tools/memory/memory-tests.factor
basis/tools/memory/memory.factor
basis/vm/vm.factor

index 5217fc8ff5dcae53dd5ead6895bc347e61e0e816..e1ba5c45d6ce96c9bdb42b9b24c66de50482ad0c 100644 (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
index 18065f330756106afc7fa99fdc626e60bd8559cc..309ae605ad1b1ae405a94321281a2cc8290cbec3 100644 (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. ;
index 0b7dbfe6bc9eff5ab30b55bd267714f71debdda6..1122871c131d4fa31b8898609c5bf008d780fc83 100644 (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