]> gitweb.factorcode.org Git - factor.git/blob - basis/vm/vm.factor
compiler.*: removing the check-d and check-r slots from gc-map and adjusting code...
[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 kernel.private ;
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[context-object-count] } ;
18
19 : context-field-offset ( field -- offset ) context offset-of ; inline
20
21 STRUCT: zone
22 { here cell }
23 { start cell }
24 { end cell }
25 { size cell } ;
26
27 STRUCT: vm
28 { ctx context* }
29 { spare-ctx context* }
30 { nursery zone }
31 { cards-offset cell }
32 { decks-offset cell }
33 { signal-handler-addr cell }
34 { faulting? cell }
35 { special-objects cell[special-object-count] } ;
36
37 : vm-field-offset ( field -- offset ) vm offset-of ; inline
38
39 CONSTANT: collect-nursery-op 0
40 CONSTANT: collect-aging-op 1
41 CONSTANT: collect-to-tenured-op 2
42 CONSTANT: collect-full-op 3
43 CONSTANT: collect-compact-op 4
44 CONSTANT: collect-growing-heap-op 5
45
46 STRUCT: copying-sizes
47 { size cell }
48 { occupied cell }
49 { free cell } ;
50
51 STRUCT: mark-sweep-sizes
52 { size cell }
53 { occupied cell }
54 { total-free cell }
55 { contiguous-free cell }
56 { free-block-count cell } ;
57
58 STRUCT: data-heap-room
59 { nursery copying-sizes }
60 { aging copying-sizes }
61 { tenured mark-sweep-sizes }
62 { cards cell }
63 { decks cell }
64 { mark-stack cell } ;
65
66 STRUCT: gc-event
67 { op uint }
68 { data-heap-before data-heap-room }
69 { code-heap-before mark-sweep-sizes }
70 { data-heap-after data-heap-room }
71 { code-heap-after mark-sweep-sizes }
72 { cards-scanned cell }
73 { decks-scanned cell }
74 { code-blocks-scanned cell }
75 { start-time ulonglong }
76 { total-time cell }
77 { card-scan-time cell }
78 { code-scan-time cell }
79 { data-sweep-time cell }
80 { code-sweep-time cell }
81 { compaction-time cell }
82 { temp-time ulonglong } ;
83
84 STRUCT: dispatch-statistics
85 { megamorphic-cache-hits cell }
86 { megamorphic-cache-misses cell }
87
88 { cold-call-to-ic-transitions cell }
89 { ic-to-pic-transitions cell }
90 { pic-to-mega-transitions cell }
91
92 { pic-tag-count cell }
93 { pic-tuple-count cell } ;
94
95 ! gc-info should be kept in sync with:
96 !   vm/gc_info.hpp
97 STRUCT: gc-info
98     { scrub-d-count uint read-only }
99     { scrub-r-count uint read-only }
100     { gc-root-count uint read-only }
101     { derived-root-count uint read-only }
102     { return-address-count uint read-only } ;