]> gitweb.factorcode.org Git - factor.git/commitdiff
tools.image-analyzer.*: fix the loading of the .32 and .64 vocabs 1383/head
authorBjörn Lindqvist <bjourne@gmail.com>
Fri, 10 Jul 2015 00:23:16 +0000 (02:23 +0200)
committerBjörn Lindqvist <bjourne@gmail.com>
Fri, 10 Jul 2015 00:25:12 +0000 (02:25 +0200)
extra/tools/image-analyzer/data-heap-reader/data-heap-reader.factor
extra/tools/image-analyzer/image-analyzer-tests.factor
extra/tools/image-analyzer/vm/32/32.factor
extra/tools/image-analyzer/vm/64/64.factor
extra/tools/image-analyzer/vm/vm.factor

index 0087dcd7a956df946e1bb6b732c1488801f3d51b..bf8fa64440bf2ace86aded90caf95e3561e42641 100644 (file)
@@ -1,15 +1,52 @@
-USING: accessors  arrays assocs classes classes.struct io
-locals math.bitwise namespaces sequences tools.image-analyzer.utils
-tools.image-analyzer.vm vm ;
+USING: accessors assocs classes classes.struct io locals
+math.bitwise namespaces sequences system tools.image-analyzer.utils
+tools.image-analyzer.vm vm vocabs.parser ;
 IN: tools.image-analyzer.data-heap-reader
 FROM: alien.c-types => char heap-size ;
-FROM: kernel => bi dup keep nip swap ;
+FROM: arrays => 2array ;
+FROM: kernel => ? bi dup keep nip swap ;
 FROM: layouts => data-alignment ;
 FROM: math => + - * align neg shift ;
 
+<<
+! For the two annoying structs that differ on 32 and 64 bit.
+cpu x86.32?
+"tools.image-analyzer.vm.32"
+"tools.image-analyzer.vm.64"
+? use-vocab
+>>
+
+: tag>class ( tag -- class )
+    {
+        { 2 array }
+        { 3 boxed-float }
+        { 4 quotation }
+        { 5 bignum }
+        { 6 alien }
+        { 7 tuple }
+        { 8 wrapper }
+        { 9 byte-array }
+        { 10 callstack }
+        { 11 string }
+        { 12 word }
+        { 13 dll }
+    } at ;
+
 : object-tag ( object -- tag )
     header>> 5 2 bit-range ;
 
+UNION: no-payload
+    alien
+    boxed-float
+    dll
+    quotation
+    wrapper
+    word ;
+
+UNION: array-payload
+    array
+    bignum ;
+
 GENERIC: read-payload ( rel-base struct -- tuple )
 
 : remainder-padding ( payload-size object -- n )
index c0b5eb44601d61b1a3fda1bf515ff99f85d02da6..bcff120ee2622b379663c66b722fab2210109f1f 100644 (file)
@@ -2,8 +2,11 @@ USING: accessors bootstrap.image fry grouping io.files io.pathnames kernel
 sequences system tools.deploy.backend tools.image-analyzer tools.test ;
 IN: tools.image-analyzer.tests
 
+: image-path ( arch -- path )
+    boot-image-name resource-path ;
+
 : ?make-image ( arch -- )
-    dup boot-image-name resource-path exists? [ drop ] [ make-image ] if ;
+    dup image-path exists? [ drop ] [ make-image ] if ;
 
 : loadable-images ( -- images )
     images cpu name>> '[ _ tail? ] filter ;
@@ -11,7 +14,7 @@ IN: tools.image-analyzer.tests
 { t } [
     loadable-images [ [ ?make-image ] each ] [
         [
-            boot-image-name resource-path load-image 2drop code-size>>
+            image-path load-image 2drop code-size>>
         ] map [ 0 = ] all?
     ] bi
 ] unit-test
index 2c97bfe202d44473a8aff6af006a395d741a07a6..184e9ab657c6e3ec005daba2787e96d9161956a4 100644 (file)
@@ -1,5 +1,5 @@
 USING: alien.c-types classes.struct vm ;
-IN: tools.image-analyzer.vm
+IN: tools.image-analyzer.vm.32
 
 STRUCT: boxed-float
     { header cell }
index 00fc13ad459f56bbc12a4a0181434a4649e29258..ffd25f56569a4593dd9bcf5c092854fa2ac723de 100644 (file)
@@ -1,5 +1,5 @@
 USING: alien.c-types classes.struct vm ;
-IN: tools.image-analyzer.vm
+IN: tools.image-analyzer.vm.64
 
 STRUCT: boxed-float
     { header cell }
index c2a7959fd42d43a209d420541f54eb5850f594ed..d6ce7299f428a0bf9faba6dbff233aa753c36b7c 100644 (file)
@@ -1,15 +1,6 @@
-USING: alien.c-types assocs classes.struct kernel kernel.private system vm
-vocabs.parser ;
+USING: alien.c-types assocs classes.struct kernel kernel.private vm ;
 IN: tools.image-analyzer.vm
 
-<<
-! For the two annoying structs that differ on 32 and 64 bit.
-cpu x86.32?
-"tools.image-analyzer.vm.32"
-"tools.image-analyzer.vm.64"
-? use-vocab
->>
-
 ! These structs and words correspond to vm/image.hpp
 STRUCT: image-header
     { magic cell }
@@ -93,34 +84,6 @@ STRUCT: wrapper
     { header cell }
     { object cell } ;
 
-UNION: no-payload
-    alien
-    boxed-float
-    dll
-    quotation
-    wrapper
-    word ;
-
-UNION: array-payload
-    array
-    bignum ;
-
-: tag>class ( tag -- class )
-    {
-        { 2 array }
-        { 3 boxed-float }
-        { 4 quotation }
-        { 5 bignum }
-        { 6 alien }
-        { 7 tuple }
-        { 8 wrapper }
-        { 9 byte-array }
-        { 10 callstack }
-        { 11 string }
-        { 12 word }
-        { 13 dll }
-    } at ;
-
 ! These structs and words correspond to vm/code_blocks.hpp
 STRUCT: code-block
     { header cell }