From 2b366028bb5ebc833421544740b3c02f804d010b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bj=C3=B6rn=20Lindqvist?= Date: Sat, 8 Oct 2016 09:52:35 +0200 Subject: [PATCH] tools.image-analyzer.gc-info: updating vocab to work with new gc system --- .../gc-info/gc-info-docs.factor | 6 ++--- .../gc-info/gc-info-tests.factor | 22 +++++++++++------- .../image-analyzer/gc-info/gc-info.factor | 23 ++++++------------- 3 files changed, 24 insertions(+), 27 deletions(-) diff --git a/extra/tools/image-analyzer/gc-info/gc-info-docs.factor b/extra/tools/image-analyzer/gc-info/gc-info-docs.factor index bda105b9e6..35620adfb9 100644 --- a/extra/tools/image-analyzer/gc-info/gc-info-docs.factor +++ b/extra/tools/image-analyzer/gc-info/gc-info-docs.factor @@ -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 ;" "\\ word>gc-maps ." - "{ { 153 { { ?{ t } ?{ t t t } ?{ f t t t t } } { } } } }" + "{ { 155 { ?{ f t t t t } { } } } }" } } ; diff --git a/extra/tools/image-analyzer/gc-info/gc-info-tests.factor b/extra/tools/image-analyzer/gc-info/gc-info-tests.factor index 1cf9af4191..7a3b4f44b8 100644 --- a/extra/tools/image-analyzer/gc-info/gc-info-tests.factor +++ b/extra/tools/image-analyzer/gc-info/gc-info-tests.factor @@ -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: word>gc-maps empty? ] unit-test +cpu x86.64? [ + { + { { 155 { ?{ f t t t t } { } } } } + } [ + \ effects: 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 diff --git a/extra/tools/image-analyzer/gc-info/gc-info.factor b/extra/tools/image-analyzer/gc-info/gc-info.factor index 8ed51de257..85af8fb1d1 100644 --- a/extra/tools/image-analyzer/gc-info/gc-info.factor +++ b/extra/tools/image-analyzer/gc-info/gc-info.factor @@ -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 ) - cum-sum but-last ; - -: reshape-sequence ( seq counts times -- seqs ) - [ (cut-points) split-indices ] keep 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 ; -: 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 [ -- 2.34.1