]> gitweb.factorcode.org Git - factor.git/commitdiff
tools.image-analyzer.gc-info: updating vocab to work with new gc system
authorBjörn Lindqvist <bjourne@gmail.com>
Sat, 8 Oct 2016 07:52:35 +0000 (09:52 +0200)
committerBjörn Lindqvist <bjourne@gmail.com>
Sat, 8 Oct 2016 07:52:35 +0000 (09:52 +0200)
extra/tools/image-analyzer/gc-info/gc-info-docs.factor
extra/tools/image-analyzer/gc-info/gc-info-tests.factor
extra/tools/image-analyzer/gc-info/gc-info.factor

index bda105b9e611ce05aabb5848ca622882bf748cb6..35620adfb91e0e5de9ce83e6c4e6aace76083ce1 100644 (file)
@@ -8,11 +8,11 @@ HELP: word>gc-maps
 { $values { "word" word } { "gc-maps" assoc } }
 { $description "Main word of the vocab. Decodes the gc maps for a word into an assoc with the following format:"
   { $list
-    "Each key is the return addess of a gc callsite (delta relative to the start of the code block)."
+    "Each key is the return addess of a gc callsite (as an offset relative to the blocks entry point)."
     {
         "Each value is a two-tuple where:"
         { $list
-          "The first element is a three-tuple containing the scrub patterns for the datastack, retainstack and gc roots."
+          "The first element contains the scrub patterns for the gc roots."
           "The second element is a sequence of derived roots for the callsite."
         }
     }
@@ -22,7 +22,7 @@ HELP: word>gc-maps
   { $unchecked-example
     "USING: effects prettyprint ;"
     "\\ <effect> word>gc-maps ."
-    "{ { 153 { { ?{ t } ?{ t t t } ?{ f t t t t } } { } } } }"
+    "{ { 155 { ?{ f t t t t } { } } } }"
   }
 } ;
 
index 1cf9af4191984d4d0afb5b62c0a699cff44a00da..7a3b4f44b89f0c1398ec856956952f1ac5322a2c 100644 (file)
@@ -1,11 +1,10 @@
 USING: accessors alien.c-types alien.syntax arrays assocs bit-arrays
-classes.struct combinators combinators.short-circuit compiler compiler.cfg
-compiler.cfg.debugger compiler.cfg.instructions compiler.cfg.linearization
-compiler.cfg.stack-frame compiler.codegen.gc-maps compiler.units fry generic
-grouping io io.encodings.binary io.streams.byte-array kernel math namespaces
-random sequences sequences.generalizations
-tools.image-analyzer.gc-info tools.image-analyzer.utils tools.test vm
-vocabs words ;
+classes.struct combinators.short-circuit compiler compiler.cfg
+compiler.cfg.debugger compiler.cfg.instructions
+compiler.cfg.linearization compiler.codegen.gc-maps compiler.units fry
+generic grouping io io.encodings.binary io.streams.byte-array kernel
+math namespaces random sequences system tools.image-analyzer.gc-info
+tools.image-analyzer.utils tools.test vm vocabs words ;
 IN: tools.image-analyzer.gc-info.tests
 QUALIFIED: cpu.x86.features.private
 QUALIFIED: crypto.aes.utils
@@ -71,6 +70,14 @@ QUALIFIED: opencl
     \ effects:<effect> word>gc-maps empty?
 ] unit-test
 
+cpu x86.64? [
+    {
+        { { 155 { ?{ f t t t t } { } } } }
+    } [
+        \ effects:<effect> word>gc-maps
+    ] unit-test
+] when
+
 { f } [
     \ + word>gc-maps empty?
 ] unit-test
@@ -103,7 +110,6 @@ FUNCTION: void LLVMDisposeTypeHandle ( LLVMTypeHandleRef TypeHandle )
     [ base-pointer-groups-expected ] [ base-pointer-groups-decoded ] bi =
 ] unit-test
 
-
 ! Tough words #1227
 { t } [
     \ resolve-types
index 8ed51de2571674762db270e899b48bce51a88b6e..85af8fb1d1afd5d91491ed6b074289858516ce73 100644 (file)
@@ -1,7 +1,7 @@
-USING: accessors alien.c-types alien.data arrays assocs
-bit-arrays.private classes.struct fry grouping io io.encodings.binary
-io.streams.byte-array kernel math math.statistics sequences
-sequences.repeating splitting tools.image-analyzer.utils vm ;
+USING: accessors alien.c-types assocs bit-arrays.private
+classes.struct fry grouping io io.encodings.binary
+io.streams.byte-array kernel math sequences tools.image-analyzer.utils
+vm ;
 IN: tools.image-analyzer.gc-info
 
 ! Utils
@@ -11,12 +11,6 @@ IN: tools.image-analyzer.gc-info
 : read-bits ( bit-count -- bit-array )
     [ bits>bytes read byte-array>bit-array ] keep head ;
 
-: (cut-points) ( counts times -- seq )
-    <repeats> cum-sum but-last ;
-
-: reshape-sequence ( seq counts times -- seqs )
-    [ (cut-points) split-indices ] keep <groups> flip ;
-
 : read-struct-safe ( struct -- instance/f )
     dup heap-size read [ swap memory>struct ] [ drop f ] if* ;
 
@@ -28,15 +22,12 @@ IN: tools.image-analyzer.gc-info
     [ return-address-count>> ] keep derived-root-count>>
     '[ _ read-ints ] replicate <reversed> ;
 
-: bit-counts ( gc-info -- counts )
-    struct-slot-values 3 head ;
-
 : (read-scrub-bits) ( gc-info -- seq )
-    [ bit-counts sum ] [ return-address-count>> ] bi * read-bits ;
+    [ gc-root-count>> ] [ return-address-count>> ] bi * read-bits ;
 
 : scrub-bits ( gc-info -- seq )
-    [ (read-scrub-bits) ] [ bit-counts ] [ return-address-count>> ] tri
-    [ 2drop { } ] [ reshape-sequence ] if-zero ;
+    [ (read-scrub-bits) ] [ gc-root-count>> ] bi
+    [ drop { } ] [ group ] if-zero ;
 
 : byte-array>gc-maps ( byte-array -- gc-maps )
     binary <byte-reader> <backwards-reader> [