]> gitweb.factorcode.org Git - factor.git/blob - basis/vm/vm.factor
d6915f6b74d08286acb64386e67da1f9052315d0
[factor.git] / basis / vm / vm.factor
1 ! Copyright (C) 2009, 2010 Phil Dawes, Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: classes.struct alien.c-types alien.syntax ;
4 IN: vm
5
6 TYPEDEF: uintptr_t cell
7
8 STRUCT: context
9 { callstack-top void* }
10 { callstack-bottom void* }
11 { datastack cell }
12 { retainstack cell }
13 { callstack-save cell }
14 { datastack-region void* }
15 { retainstack-region void* }
16 { callstack-region void* }
17 { context-objects cell[10] } ;
18
19 : context-field-offset ( field -- offset ) context offset-of ; inline
20
21 STRUCT: zone
22 { start cell }
23 { here cell }
24 { size cell }
25 { end cell } ;
26
27 STRUCT: vm
28 { ctx context* }
29 { spare-ctx context* }
30 { nursery zone }
31 { cards-offset cell }
32 { decks-offset cell }
33 { special-objects cell[70] } ;
34
35 : vm-field-offset ( field -- offset ) vm offset-of ; inline
36
37 ENUM: f
38 collect-nursery-op
39 collect-aging-op
40 collect-to-tenured-op
41 collect-full-op
42 collect-compact-op
43 collect-growing-heap-op ;
44
45 STRUCT: copying-sizes
46 { size cell }
47 { occupied cell }
48 { free cell } ;
49
50 STRUCT: mark-sweep-sizes
51 { size cell }
52 { occupied cell }
53 { total-free cell }
54 { contiguous-free cell }
55 { free-block-count cell } ;
56
57 STRUCT: data-heap-room
58 { nursery copying-sizes }
59 { aging copying-sizes }
60 { tenured mark-sweep-sizes }
61 { cards cell }
62 { decks cell }
63 { mark-stack cell } ;
64
65 STRUCT: gc-event
66 { op uint }
67 { data-heap-before data-heap-room }
68 { code-heap-before mark-sweep-sizes }
69 { data-heap-after data-heap-room }
70 { code-heap-after mark-sweep-sizes }
71 { cards-scanned cell }
72 { decks-scanned cell }
73 { code-blocks-scanned cell }
74 { start-time ulonglong }
75 { total-time cell }
76 { card-scan-time cell }
77 { code-scan-time cell }
78 { data-sweep-time cell }
79 { code-sweep-time cell }
80 { compaction-time cell }
81 { temp-time ulonglong } ;
82
83 STRUCT: dispatch-statistics
84 { megamorphic-cache-hits cell }
85 { megamorphic-cache-misses cell }
86
87 { cold-call-to-ic-transitions cell }
88 { ic-to-pic-transitions cell }
89 { pic-to-mega-transitions cell }
90
91 { pic-tag-count cell }
92 { pic-tuple-count cell } ;