Print this page
Split |
Close |
Expand all |
Collapse all |
--- old/src/os/solaris/dtrace/generateJvmOffsets.cpp
+++ new/src/os/solaris/dtrace/generateJvmOffsets.cpp
1 1 /*
2 - * Copyright 2003-2009 Sun Microsystems, Inc. All Rights Reserved.
2 + * Copyright 2003-2010 Sun Microsystems, Inc. All Rights Reserved.
3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 4 *
5 5 * This code is free software; you can redistribute it and/or modify it
6 6 * under the terms of the GNU General Public License version 2 only, as
7 7 * published by the Free Software Foundation.
8 8 *
9 9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 12 * version 2 for more details (a copy is included in the LICENSE file that
13 13 * accompanied this code).
14 14 *
15 15 * You should have received a copy of the GNU General Public License version
16 16 * 2 along with this work; if not, write to the Free Software Foundation,
17 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 18 *
19 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 21 * have any questions.
22 22 *
23 23 */
24 24
25 25 /*
26 26 * This is to provide sanity check in jhelper.d which compares SCCS
27 27 * versions of generateJvmOffsets.cpp used to create and extract
28 28 * contents of __JvmOffsets[] table.
29 29 * The __JvmOffsets[] table is located in generated JvmOffsets.cpp.
30 30 *
31 31 * GENOFFS_SCCS_VER 34
32 32 */
33 33
34 34 #include "generateJvmOffsets.h"
35 35
36 36 /* A workaround for private and protected fields */
37 37 #define private public
38 38 #define protected public
39 39
40 40 #include <proc_service.h>
41 41 #include "incls/_precompiled.incl"
42 42 #include "incls/_vmStructs.cpp.incl"
43 43
44 44 #ifdef COMPILER1
45 45 #if defined(DEBUG) || defined(FASTDEBUG)
46 46
47 47 /*
48 48 * To avoid the most part of potential link errors
49 49 * we link this program with -z nodefs .
50 50 *
51 51 * But for 'debug1' and 'fastdebug1' we still have to provide
52 52 * a particular workaround for the following symbols bellow.
53 53 * It will be good to find out a generic way in the future.
54 54 */
55 55
56 56 #pragma weak tty
57 57 #pragma weak CMSExpAvgFactor
58 58
59 59 #if defined(i386) || defined(__i386) || defined(__amd64)
60 60 #pragma weak noreg
61 61 #endif /* i386 */
62 62
63 63 LIR_Opr LIR_OprFact::illegalOpr = (LIR_Opr) 0;
64 64
65 65 address StubRoutines::_call_stub_return_address = NULL;
66 66
67 67 StubQueue* AbstractInterpreter::_code = NULL;
68 68
69 69 #endif /* defined(DEBUG) || defined(FASTDEBUG) */
70 70 #endif /* COMPILER1 */
71 71
72 72 #define GEN_OFFS(Type,Name) \
73 73 switch(gen_variant) { \
74 74 case GEN_OFFSET: \
75 75 printf("#define OFFSET_%-33s %d\n", \
76 76 #Type #Name, offset_of(Type, Name)); \
77 77 break; \
78 78 case GEN_INDEX: \
79 79 printf("#define IDX_OFFSET_%-33s %d\n", \
80 80 #Type #Name, index++); \
81 81 break; \
82 82 case GEN_TABLE: \
83 83 printf("\tOFFSET_%s,\n", #Type #Name); \
84 84 break; \
85 85 }
86 86
87 87 #define GEN_SIZE(Type) \
88 88 switch(gen_variant) { \
89 89 case GEN_OFFSET: \
90 90 printf("#define SIZE_%-35s %d\n", \
91 91 #Type, sizeof(Type)); \
92 92 break; \
93 93 case GEN_INDEX: \
94 94 printf("#define IDX_SIZE_%-35s %d\n", \
95 95 #Type, index++); \
96 96 break; \
97 97 case GEN_TABLE: \
98 98 printf("\tSIZE_%s,\n", #Type); \
99 99 break; \
100 100 }
101 101
102 102 #define GEN_VALUE(String,Value) \
103 103 switch(gen_variant) { \
104 104 case GEN_OFFSET: \
105 105 printf("#define %-40s %d\n", #String, Value); \
106 106 break; \
107 107 case GEN_INDEX: \
108 108 printf("#define IDX_%-40s %d\n", #String, index++); \
109 109 break; \
110 110 case GEN_TABLE: \
111 111 printf("\t" #String ",\n"); \
112 112 break; \
113 113 }
114 114
115 115 void gen_prologue(GEN_variant gen_variant) {
116 116 const char *suffix;
117 117
118 118 switch(gen_variant) {
119 119 case GEN_OFFSET: suffix = ".h"; break;
120 120 case GEN_INDEX: suffix = "Index.h"; break;
121 121 case GEN_TABLE: suffix = ".cpp"; break;
122 122 }
123 123
124 124 printf("/*\n");
125 125 printf(" * JvmOffsets%s !!!DO NOT EDIT!!! \n", suffix);
126 126 printf(" * The generateJvmOffsets program generates this file!\n");
127 127 printf(" */\n\n");
128 128 switch(gen_variant) {
129 129
130 130 case GEN_OFFSET:
131 131 case GEN_INDEX:
132 132 break;
133 133
134 134 case GEN_TABLE:
135 135 printf("#include \"JvmOffsets.h\"\n");
136 136 printf("\n");
137 137 printf("int __JvmOffsets[] = {\n");
138 138 break;
139 139 }
140 140 }
141 141
142 142 void gen_epilogue(GEN_variant gen_variant) {
143 143 if (gen_variant != GEN_TABLE) {
144 144 return;
145 145 }
146 146 printf("};\n\n");
147 147 return;
148 148 }
149 149
150 150 int generateJvmOffsets(GEN_variant gen_variant) {
151 151 int index = 0; /* It is used to generate JvmOffsetsIndex.h */
152 152 int pointer_size = sizeof(void *);
153 153 int data_model = (pointer_size == 4) ? PR_MODEL_ILP32 : PR_MODEL_LP64;
154 154
155 155 gen_prologue(gen_variant);
156 156
157 157 GEN_VALUE(DATA_MODEL, data_model);
158 158 GEN_VALUE(POINTER_SIZE, pointer_size);
159 159 #if defined(TIERED)
160 160 GEN_VALUE(COMPILER, 3);
161 161 #elif COMPILER1
162 162 GEN_VALUE(COMPILER, 1);
163 163 #elif COMPILER2
164 164 GEN_VALUE(COMPILER, 2);
165 165 #else
166 166 GEN_VALUE(COMPILER, 0);
167 167 #endif // COMPILER1 && COMPILER2
168 168 printf("\n");
169 169
170 170 GEN_OFFS(CollectedHeap, _reserved);
171 171 GEN_OFFS(MemRegion, _start);
172 172 GEN_OFFS(MemRegion, _word_size);
173 173 GEN_SIZE(HeapWord);
174 174 printf("\n");
175 175
176 176 GEN_OFFS(VMStructEntry, typeName);
177 177 GEN_OFFS(VMStructEntry, fieldName);
178 178 GEN_OFFS(VMStructEntry, address);
179 179 GEN_SIZE(VMStructEntry);
180 180 printf("\n");
181 181
182 182 GEN_VALUE(MAX_METHOD_CODE_SIZE, max_method_code_size);
183 183 #if defined(sparc) || defined(__sparc)
184 184 GEN_VALUE(OFFSET_interpreter_frame_method, 2 * pointer_size); /* L2 in saved window */
185 185 GEN_VALUE(OFFSET_interpreter_frame_sender_sp, 13 * pointer_size); /* I5 in saved window */
186 186 // Fake value for consistency. It is not going to be used.
187 187 GEN_VALUE(OFFSET_interpreter_frame_bcx_offset, 0xFFFF);
188 188 #elif defined(i386) || defined(__i386) || defined(__amd64)
189 189 GEN_VALUE(OFFSET_interpreter_frame_sender_sp, -1 * pointer_size);
190 190 GEN_VALUE(OFFSET_interpreter_frame_method, -3 * pointer_size);
191 191 GEN_VALUE(OFFSET_interpreter_frame_bcx_offset, -7 * pointer_size);
192 192 #endif
193 193
194 194 GEN_OFFS(Klass, _name);
195 195 GEN_OFFS(constantPoolOopDesc, _pool_holder);
196 196 printf("\n");
197 197
198 198 GEN_VALUE(OFFSET_HeapBlockHeader_used, offset_of(HeapBlock::Header, _used));
199 199 GEN_OFFS(oopDesc, _metadata);
200 200 printf("\n");
201 201
202 202 GEN_VALUE(AccessFlags_NATIVE, JVM_ACC_NATIVE);
203 203 GEN_VALUE(constMethodOopDesc_has_linenumber_table, constMethodOopDesc::_has_linenumber_table);
204 204 GEN_OFFS(AccessFlags, _flags);
205 205 GEN_OFFS(symbolOopDesc, _length);
206 206 GEN_OFFS(symbolOopDesc, _body);
207 207 printf("\n");
208 208
209 209 GEN_OFFS(methodOopDesc, _constMethod);
210 210 GEN_OFFS(methodOopDesc, _constants);
211 211 GEN_OFFS(methodOopDesc, _access_flags);
212 212 printf("\n");
213 213
214 214 GEN_OFFS(constMethodOopDesc, _flags);
215 215 GEN_OFFS(constMethodOopDesc, _code_size);
216 216 GEN_OFFS(constMethodOopDesc, _name_index);
217 217 GEN_OFFS(constMethodOopDesc, _signature_index);
218 218 printf("\n");
219 219
220 220 GEN_OFFS(CodeHeap, _memory);
221 221 GEN_OFFS(CodeHeap, _segmap);
222 222 GEN_OFFS(CodeHeap, _log2_segment_size);
223 223 printf("\n");
224 224
↓ open down ↓ |
212 lines elided |
↑ open up ↑ |
225 225 GEN_OFFS(VirtualSpace, _low_boundary);
226 226 GEN_OFFS(VirtualSpace, _high_boundary);
227 227 GEN_OFFS(VirtualSpace, _low);
228 228 GEN_OFFS(VirtualSpace, _high);
229 229 printf("\n");
230 230
231 231 GEN_OFFS(CodeBlob, _name);
232 232 GEN_OFFS(CodeBlob, _header_size);
233 233 GEN_OFFS(CodeBlob, _instructions_offset);
234 234 GEN_OFFS(CodeBlob, _data_offset);
235 - GEN_OFFS(CodeBlob, _oops_offset);
236 - GEN_OFFS(CodeBlob, _oops_length);
237 235 GEN_OFFS(CodeBlob, _frame_size);
238 236 printf("\n");
239 237
240 238 GEN_OFFS(nmethod, _method);
239 + GEN_OFFS(nmethod, _oops_offset);
241 240 GEN_OFFS(nmethod, _scopes_data_offset);
242 241 GEN_OFFS(nmethod, _scopes_pcs_offset);
243 242 GEN_OFFS(nmethod, _handler_table_offset);
244 243 GEN_OFFS(nmethod, _deoptimize_offset);
245 244 GEN_OFFS(nmethod, _orig_pc_offset);
246 245
247 246 GEN_OFFS(PcDesc, _pc_offset);
248 247 GEN_OFFS(PcDesc, _scope_decode_offset);
249 248
250 249 printf("\n");
251 250
252 251 GEN_OFFS(NarrowOopStruct, _base);
253 252 GEN_OFFS(NarrowOopStruct, _shift);
254 253 printf("\n");
255 254
256 255 GEN_VALUE(SIZE_HeapBlockHeader, sizeof(HeapBlock::Header));
257 256 GEN_SIZE(oopDesc);
258 257 GEN_SIZE(constantPoolOopDesc);
259 258 printf("\n");
260 259
261 260 GEN_SIZE(PcDesc);
262 261 GEN_SIZE(methodOopDesc);
263 262 GEN_SIZE(constMethodOopDesc);
264 263 GEN_SIZE(nmethod);
265 264 GEN_SIZE(CodeBlob);
266 265 GEN_SIZE(BufferBlob);
267 266 GEN_SIZE(SingletonBlob);
268 267 GEN_SIZE(RuntimeStub);
269 268 GEN_SIZE(SafepointBlob);
270 269
271 270 gen_epilogue(gen_variant);
272 271 printf("\n");
273 272
274 273 fflush(stdout);
275 274 return 0;
276 275 }
↓ open down ↓ |
26 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX