-
Notifications
You must be signed in to change notification settings - Fork 5
/
defines.hpp
executable file
·173 lines (144 loc) · 4.6 KB
/
defines.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/*
* defines.hpp
*
* Created on: 2013-09-04
* Author: GarCoSim
*/
#ifndef _DEFINES_HPP_
#define _DEFINES_HPP_
#ifndef TRACEFILESIM_VERSION
/* TraceFileSim Version Number Information
*
* Follows Semantic Versioning: http://semver.org/spec/v2.0.0.html
*
* TRACEFILESIM_VERSION % 100 is the patch level
* TRACEFILESIM_VERSION / 100 % 1000 is the minor version
* TRACEFILESIM_VERSION / 100000 is the major version
*
* TRACEFILESIM_VERSION: Major Version: [x] Minor Version: [xxx] Patch Level: [xx]
*/
#define TRACEFILESIM_VERSION 500000
#endif
#ifndef NUM_THREADS
#define NUM_THREADS 50
#endif
#ifndef ROOTSET_SIZE
#define ROOTSET_SIZE 50
#endif
#ifndef VISUALIZE_GCS
#define VISUALIZE_GCS 1
#endif
#ifndef OBJECT_HEADER_SIZE
#define OBJECT_HEADER_SIZE 16
#endif
#define MAGNITUDE_CONVERSION 1024
//DEBUGGING FLAGS
#ifndef DEBUG_MODE
#define DEBUG_MODE 0
#endif
#ifndef WRITE_DETAILED_LOG
#define WRITE_DETAILED_LOG 0
#endif
#ifndef WRITE_HEAPMAP
#define WRITE_HEAPMAP 0
#endif
#ifndef WRITE_ALLOCATION_INFO
#define WRITE_ALLOCATION_INFO 0
#endif
#ifndef FINAL_GC
#define FINAL_GC 0 //Trigger a GC after the last line in the trace file
#endif
//END DEBUGGING FLAGS
//TRACE FILE LINE DEFINES
#ifndef TRACE_FILE_LINE_SIZE
#define TRACE_FILE_LINE_SIZE unsigned long long
#define TRACE_FILE_LINE_FORMAT "%lld"
#endif
//END TRACE FILE LINE DEFINES
//ERROR HANDLING
#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
#define ERRMSG(...) { \
fprintf(stderr, "ERROR: %s:%d %s - ", __FILENAME__, __LINE__, __FUNCTION__);\
fprintf(stderr, __VA_ARGS__);\
fprintf(stderr, "\n");\
fflush(stderr);\
}
//GENERATIONAL GC
#define GENERATIONS 1
#define GEN_DEBUG 0
#define GENRATIO 0.3
#define PROMOTIONAGE 3
#define PROMOTIONAGEFACTOR 0
#define SHIFTING 1
#define SHIFTINGFACTOR 2
//RECYCLER
#define BLACK 1
#define GREY 2
#define PURPLE 3
#define WHITE 4
#define ZOMBIE 0
//BALANCED GC
//#define MINREGIONSIZE 512000 //in case of change, also change REGIONEXPONENT appropriately
//#define REGIONEXPONENT 9 //9 results in MINREGINOSIZE of 512KB; 2^9 = 512KB
#define MINREGIONSIZE 2000 //in case of change, also change REGIONEXPONENT appropriately
#define REGIONEXPONENT 1 //2 results in MINREGINOSIZE of 512KB; 2^1 = 2KB
#define MINREGIONS 1024
#define MAXREGIONS 2047
#define EDENREGIONS 25 //% of the whole heap
#define MAXREGIONAGE 23
#define DEAD_SPACE 1 //Consider space occupied by dead objects when selecting collection set regions
#define DEAD_SPACE_THRESHOLD 10 //Percent dead space a region must have to be selected, 0 to select regions with highest percent
enum allocationTypeEnum{
allocationTypeObject = 0,
allocationTypeContiguousIndexable,
allocationTypeDiscontiguousIndexable
};
enum traversalEnum {
breadthFirst = 0,
depthFirst,
hierarchical
};
enum collectorEnum {
markSweepGC = 0,
traversalGC,
recyclerGC,
balanced,
markSweepTB
};
#define HIER_DEPTH_DEFAULT 2
enum allocatorEnum {
basicAlloc = 0,
nextFitAlloc,
regionBased,
threadBased
};
enum gcReason {
reasonStatistics = 0,
reasonFailedAlloc,
reasonHighWatermark,
reasonDebug,
reasonShift,
reasonEval,
reasonForced
};
enum writebarriersEnum {
recycler = 0,
referenceCounting,
disabled
};
// create some fancy strings for debug output
#define TRAVERSAL_STRING (traversal == (int)breadthFirst ? "breadthFirst" : "depthFirst")
#define COLLECTOR_STRING (collector == (int)traversalGC ? "traversal" : (collector == (int)markSweepGC ? "markSweep" : (collector == (int)recyclerGC ? "recycler" : (collector == (int)balanced ? "balanced" : (collector == (int)markSweepTB ? "mark-sweep (thread-based)" : "copying")))))
#define ALLOCATOR_STRING (allocator == (int)basicAlloc ? "basic" : (allocator == (int)regionBased ? "regionBased" : (allocator == (int)threadBased ? "threadBased" : "nextFit")))
#define WRITEBARRIER_STRING (writebarrier == (int)recycler ? "recycler" : (writebarrier == (int)referenceCounting ? "referenceCounting" : "disabled"))
#define FINALGC_STRING (finalGC == 1 ? "enabled" : "disabled")
#define ZOMBIES_STRING (catchZombies == 1 ? "enabled" : "disabled")
#define TRAVERSALDEPTH_STRING (countTraversalDepth == 1 ? "enabled" : "disabled")
#define LOCKING_STRING (lockingStats == 1 ? "enabled" : "disabled")
#define COUNTROOTS_STRING (countRoots == 1 ? "enabled" : "disabled")
//added by Tristan
#define MAX64BIT 0xFFFFFFFFFFFFFFFF //18446744073709551615
#define MAX32BIT 0xFFFFFFFF //4294967295
#define MAX16BIT 0xFFFF //65535
#define MAX8BIT 0xFF //255
#endif