]> gitweb.factorcode.org Git - factor.git/blob - basis/vm/vm.factor
Remove ENUM: f and replace uses with CONSTANTs.
[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 CONSTANT: collect-nursery-op 0
38 CONSTANT: collect-aging-op 1
39 CONSTANT: collect-to-tenured-op 2
40 CONSTANT: collect-full-op 3
41 CONSTANT: collect-compact-op 4
42 CONSTANT: collect-growing-heap-op 5
43
44 STRUCT: copying-sizes
45 { size cell }
46 { occupied cell }
47 { free cell } ;
48
49 STRUCT: mark-sweep-sizes
50 { size cell }
51 { occupied cell }
52 { total-free cell }
53 { contiguous-free cell }
54 { free-block-count cell } ;
55
56 STRUCT: data-heap-room
57 { nursery copying-sizes }
58 { aging copying-sizes }
59 { tenured mark-sweep-sizes }
60 { cards cell }
61 { decks cell }
62 { mark-stack cell } ;
63
64 STRUCT: gc-event
65 { op uint }
66 { data-heap-before data-heap-room }
67 { code-heap-before mark-sweep-sizes }
68 { data-heap-after data-heap-room }
69 { code-heap-after mark-sweep-sizes }
70 { cards-scanned cell }
71 { decks-scanned cell }
72 { code-blocks-scanned cell }
73 { start-time ulonglong }
74 { total-time cell }
75 { card-scan-time cell }
76 { code-scan-time cell }
77 { data-sweep-time cell }
78 { code-sweep-time cell }
79 { compaction-time cell }
80 { temp-time ulonglong } ;
81
82 STRUCT: dispatch-statistics
83 { megamorphic-cache-hits cell }
84 { megamorphic-cache-misses cell }
85
86 { cold-call-to-ic-transitions cell }
87 { ic-to-pic-transitions cell }
88 { pic-to-mega-transitions cell }
89
90 { pic-tag-count cell }
91 { pic-tuple-count cell } ;