tools.image-analyzer.*: fix the loading of the .32 and .64 vocabs
parent
4669c8a4eb
commit
dea0b49283
|
@ -1,15 +1,52 @@
|
||||||
USING: accessors arrays assocs classes classes.struct io
|
USING: accessors assocs classes classes.struct io locals
|
||||||
locals math.bitwise namespaces sequences tools.image-analyzer.utils
|
math.bitwise namespaces sequences system tools.image-analyzer.utils
|
||||||
tools.image-analyzer.vm vm ;
|
tools.image-analyzer.vm vm vocabs.parser ;
|
||||||
IN: tools.image-analyzer.data-heap-reader
|
IN: tools.image-analyzer.data-heap-reader
|
||||||
FROM: alien.c-types => char heap-size ;
|
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: layouts => data-alignment ;
|
||||||
FROM: math => + - * align neg shift ;
|
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 )
|
: object-tag ( object -- tag )
|
||||||
header>> 5 2 bit-range ;
|
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 )
|
GENERIC: read-payload ( rel-base struct -- tuple )
|
||||||
|
|
||||||
: remainder-padding ( payload-size object -- n )
|
: remainder-padding ( payload-size object -- n )
|
||||||
|
|
|
@ -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 ;
|
sequences system tools.deploy.backend tools.image-analyzer tools.test ;
|
||||||
IN: tools.image-analyzer.tests
|
IN: tools.image-analyzer.tests
|
||||||
|
|
||||||
|
: image-path ( arch -- path )
|
||||||
|
boot-image-name resource-path ;
|
||||||
|
|
||||||
: ?make-image ( arch -- )
|
: ?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 )
|
: loadable-images ( -- images )
|
||||||
images cpu name>> '[ _ tail? ] filter ;
|
images cpu name>> '[ _ tail? ] filter ;
|
||||||
|
@ -11,7 +14,7 @@ IN: tools.image-analyzer.tests
|
||||||
{ t } [
|
{ t } [
|
||||||
loadable-images [ [ ?make-image ] each ] [
|
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?
|
] map [ 0 = ] all?
|
||||||
] bi
|
] bi
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
USING: alien.c-types classes.struct vm ;
|
USING: alien.c-types classes.struct vm ;
|
||||||
IN: tools.image-analyzer.vm
|
IN: tools.image-analyzer.vm.32
|
||||||
|
|
||||||
STRUCT: boxed-float
|
STRUCT: boxed-float
|
||||||
{ header cell }
|
{ header cell }
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
USING: alien.c-types classes.struct vm ;
|
USING: alien.c-types classes.struct vm ;
|
||||||
IN: tools.image-analyzer.vm
|
IN: tools.image-analyzer.vm.64
|
||||||
|
|
||||||
STRUCT: boxed-float
|
STRUCT: boxed-float
|
||||||
{ header cell }
|
{ header cell }
|
||||||
|
|
|
@ -1,15 +1,6 @@
|
||||||
USING: alien.c-types assocs classes.struct kernel kernel.private system vm
|
USING: alien.c-types assocs classes.struct kernel kernel.private vm ;
|
||||||
vocabs.parser ;
|
|
||||||
IN: tools.image-analyzer.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
|
! These structs and words correspond to vm/image.hpp
|
||||||
STRUCT: image-header
|
STRUCT: image-header
|
||||||
{ magic cell }
|
{ magic cell }
|
||||||
|
@ -93,34 +84,6 @@ STRUCT: wrapper
|
||||||
{ header cell }
|
{ header cell }
|
||||||
{ object 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
|
! These structs and words correspond to vm/code_blocks.hpp
|
||||||
STRUCT: code-block
|
STRUCT: code-block
|
||||||
{ header cell }
|
{ header cell }
|
||||||
|
|
Loading…
Reference in New Issue