]> gitweb.factorcode.org Git - factor.git/blob - extra/tools/image-analyzer/vm/vm.factor
tools.image-analyzer.*: fixes so that the vocab should work both on 32
[factor.git] / extra / tools / image-analyzer / vm / vm.factor
1 USING: alien.c-types assocs classes.struct kernel kernel.private system vm
2 vocabs.parser ;
3 IN: tools.image-analyzer.vm
4
5 <<
6 ! For the two annoying structs that differ on 32 and 64 bit.
7 cpu x86.32?
8 "tools.image-analyzer.vm.32"
9 "tools.image-analyzer.vm.64"
10 ? use-vocab
11 >>
12
13 ! These structs and words correspond to vm/image.hpp
14 STRUCT: image-header
15     { magic cell }
16     { version cell }
17     { data-relocation-base cell }
18     { data-size cell }
19     { code-relocation-base cell }
20     { code-size cell }
21     { true-object cell }
22     { bignum-zero cell }
23     { bignum-pos-one cell }
24     { bignum-neg-one cell }
25     { special-objects cell[special-object-count] } ;
26
27 ! These structs and words correspond to vm/layouts.hpp
28 STRUCT: object
29     { header cell } ;
30
31 STRUCT: alien
32     { header cell }
33     { base cell }
34     { expired cell }
35     { displacement cell }
36     { address cell } ;
37
38 STRUCT: array
39     { header cell }
40     { capacity cell } ;
41
42 STRUCT: bignum
43     { header cell }
44     { capacity cell } ;
45
46
47 STRUCT: callstack
48     { header cell }
49     { length cell } ;
50
51 STRUCT: dll
52     { header cell }
53     { path cell }
54     { handle void* } ;
55
56 STRUCT: quotation
57     { header cell }
58     { array cell }
59     { cached_effect cell }
60     { cache_counter cell }
61     { entry_point cell } ;
62
63 STRUCT: string
64     { header cell }
65     { length cell }
66     { aux cell }
67     { hashcode cell } ;
68
69 STRUCT: tuple
70     { header cell }
71     { layout cell } ;
72
73 STRUCT: tuple-layout
74     { header cell }
75     { capacity cell }
76     { klass cell }
77     { size cell }
78     { echelon cell } ;
79
80 STRUCT: word
81     { header cell }
82     { hashcode cell }
83     { name cell }
84     { vocabulary cell }
85     { def cell }
86     { props cell }
87     { pic_def cell }
88     { pic_tail_def cell }
89     { subprimitive cell }
90     { entry_point cell } ;
91
92 STRUCT: wrapper
93     { header cell }
94     { object cell } ;
95
96 UNION: no-payload
97     alien
98     boxed-float
99     dll
100     quotation
101     wrapper
102     word ;
103
104 UNION: array-payload
105     array
106     bignum ;
107
108 : tag>class ( tag -- class )
109     {
110         { 2 array }
111         { 3 boxed-float }
112         { 4 quotation }
113         { 5 bignum }
114         { 6 alien }
115         { 7 tuple }
116         { 8 wrapper }
117         { 9 byte-array }
118         { 10 callstack }
119         { 11 string }
120         { 12 word }
121         { 13 dll }
122     } at ;
123
124 ! These structs and words correspond to vm/code_blocks.hpp
125 STRUCT: code-block
126     { header cell }
127     { owner cell }
128     { parameters cell }
129     { relocation cell } ;