author | attila |
Wed, 20 Dec 2017 17:36:50 +0100 | |
changeset 48354 | c96d4c720995 |
parent 47216 | 71c04702a3d5 |
child 49124 | 6abbc1f5c2a1 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
38133
78b95467b9f1
8151956: Support non-continuous CodeBlobs in HotSpot
rbackman
parents:
32192
diff
changeset
|
2 |
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
25 |
/* |
|
26 |
* This is to provide sanity check in jhelper.d which compares SCCS |
|
27 |
* versions of generateJvmOffsets.cpp used to create and extract |
|
28 |
* contents of __JvmOffsets[] table. |
|
29 |
* The __JvmOffsets[] table is located in generated JvmOffsets.cpp. |
|
30 |
* |
|
31 |
* GENOFFS_SCCS_VER 34 |
|
32 |
*/ |
|
33 |
||
34 |
#include "generateJvmOffsets.h" |
|
35 |
||
36 |
/* A workaround for private and protected fields */ |
|
37 |
#define private public |
|
38 |
#define protected public |
|
39 |
||
40 |
#include <proc_service.h> |
|
7397 | 41 |
#include "code/codeBlob.hpp" |
42 |
#include "code/nmethod.hpp" |
|
43 |
#include "code/pcDesc.hpp" |
|
30764 | 44 |
#include "gc/shared/collectedHeap.hpp" |
7397 | 45 |
#include "memory/heap.hpp" |
46 |
#include "memory/memRegion.hpp" |
|
47 |
#include "memory/universe.hpp" |
|
30291
54cdc5c1a9cb
8068352: Move virtualspace.* out of src/share/vm/runtime to memory directory
coleenp
parents:
26809
diff
changeset
|
48 |
#include "memory/virtualspace.hpp" |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12937
diff
changeset
|
49 |
#include "oops/constMethod.hpp" |
7397 | 50 |
#include "oops/klass.hpp" |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12937
diff
changeset
|
51 |
#include "oops/method.hpp" |
7397 | 52 |
#include "oops/oop.hpp" |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
53 |
#include "oops/symbol.hpp" |
7397 | 54 |
#include "runtime/vmStructs.hpp" |
55 |
#include "utilities/accessFlags.hpp" |
|
56 |
#include "utilities/globalDefinitions.hpp" |
|
1 | 57 |
#ifdef COMPILER1 |
17006 | 58 |
#ifdef ASSERT |
1 | 59 |
|
60 |
/* |
|
61 |
* To avoid the most part of potential link errors |
|
62 |
* we link this program with -z nodefs . |
|
63 |
* |
|
64 |
* But for 'debug1' and 'fastdebug1' we still have to provide |
|
17006 | 65 |
* a particular workaround for the following symbols below. |
1 | 66 |
* It will be good to find out a generic way in the future. |
67 |
*/ |
|
68 |
||
69 |
#pragma weak tty |
|
70 |
#pragma weak CMSExpAvgFactor |
|
71 |
||
72 |
#if defined(i386) || defined(__i386) || defined(__amd64) |
|
73 |
#pragma weak noreg |
|
74 |
#endif /* i386 */ |
|
75 |
||
76 |
LIR_Opr LIR_OprFact::illegalOpr = (LIR_Opr) 0; |
|
77 |
||
78 |
address StubRoutines::_call_stub_return_address = NULL; |
|
79 |
||
80 |
StubQueue* AbstractInterpreter::_code = NULL; |
|
81 |
||
17006 | 82 |
#endif /* ASSERT */ |
1 | 83 |
#endif /* COMPILER1 */ |
84 |
||
26796 | 85 |
#define GEN_OFFS_NAME(Type,Name,OutputType) \ |
1 | 86 |
switch(gen_variant) { \ |
87 |
case GEN_OFFSET: \ |
|
32191
9666860cbf22
8033577: [parfait] warnings from b128 for hotspot/src/os/solaris/dtrace: Unportable format string argument mismatch
sspitsyn
parents:
30764
diff
changeset
|
88 |
printf("#define OFFSET_%-33s %ld\n", \ |
26796 | 89 |
#OutputType #Name, offset_of(Type, Name)); \ |
1 | 90 |
break; \ |
91 |
case GEN_INDEX: \ |
|
92 |
printf("#define IDX_OFFSET_%-33s %d\n", \ |
|
26796 | 93 |
#OutputType #Name, index++); \ |
1 | 94 |
break; \ |
95 |
case GEN_TABLE: \ |
|
26796 | 96 |
printf("\tOFFSET_%s,\n", #OutputType #Name); \ |
1 | 97 |
break; \ |
98 |
} |
|
99 |
||
26796 | 100 |
#define GEN_OFFS(Type,Name) \ |
101 |
GEN_OFFS_NAME(Type,Name,Type) |
|
102 |
||
1 | 103 |
#define GEN_SIZE(Type) \ |
104 |
switch(gen_variant) { \ |
|
105 |
case GEN_OFFSET: \ |
|
32191
9666860cbf22
8033577: [parfait] warnings from b128 for hotspot/src/os/solaris/dtrace: Unportable format string argument mismatch
sspitsyn
parents:
30764
diff
changeset
|
106 |
printf("#define SIZE_%-35s %ld\n", \ |
1 | 107 |
#Type, sizeof(Type)); \ |
108 |
break; \ |
|
109 |
case GEN_INDEX: \ |
|
110 |
printf("#define IDX_SIZE_%-35s %d\n", \ |
|
111 |
#Type, index++); \ |
|
112 |
break; \ |
|
113 |
case GEN_TABLE: \ |
|
114 |
printf("\tSIZE_%s,\n", #Type); \ |
|
115 |
break; \ |
|
116 |
} |
|
117 |
||
118 |
#define GEN_VALUE(String,Value) \ |
|
119 |
switch(gen_variant) { \ |
|
120 |
case GEN_OFFSET: \ |
|
121 |
printf("#define %-40s %d\n", #String, Value); \ |
|
122 |
break; \ |
|
123 |
case GEN_INDEX: \ |
|
124 |
printf("#define IDX_%-40s %d\n", #String, index++); \ |
|
125 |
break; \ |
|
126 |
case GEN_TABLE: \ |
|
127 |
printf("\t" #String ",\n"); \ |
|
128 |
break; \ |
|
129 |
} |
|
130 |
||
131 |
void gen_prologue(GEN_variant gen_variant) { |
|
32192
147f23238b67
8080401: Uninitialised variable in hotspot/src/os/solaris/dtrace/
sspitsyn
parents:
32191
diff
changeset
|
132 |
const char *suffix = "Undefined-Suffix"; |
1 | 133 |
|
134 |
switch(gen_variant) { |
|
135 |
case GEN_OFFSET: suffix = ".h"; break; |
|
136 |
case GEN_INDEX: suffix = "Index.h"; break; |
|
137 |
case GEN_TABLE: suffix = ".cpp"; break; |
|
138 |
} |
|
139 |
||
140 |
printf("/*\n"); |
|
141 |
printf(" * JvmOffsets%s !!!DO NOT EDIT!!! \n", suffix); |
|
142 |
printf(" * The generateJvmOffsets program generates this file!\n"); |
|
143 |
printf(" */\n\n"); |
|
144 |
switch(gen_variant) { |
|
145 |
||
146 |
case GEN_OFFSET: |
|
147 |
case GEN_INDEX: |
|
148 |
break; |
|
149 |
||
150 |
case GEN_TABLE: |
|
151 |
printf("#include \"JvmOffsets.h\"\n"); |
|
152 |
printf("\n"); |
|
153 |
printf("int __JvmOffsets[] = {\n"); |
|
154 |
break; |
|
155 |
} |
|
156 |
} |
|
157 |
||
158 |
void gen_epilogue(GEN_variant gen_variant) { |
|
159 |
if (gen_variant != GEN_TABLE) { |
|
160 |
return; |
|
161 |
} |
|
162 |
printf("};\n\n"); |
|
163 |
return; |
|
164 |
} |
|
165 |
||
166 |
int generateJvmOffsets(GEN_variant gen_variant) { |
|
167 |
int index = 0; /* It is used to generate JvmOffsetsIndex.h */ |
|
168 |
int pointer_size = sizeof(void *); |
|
169 |
int data_model = (pointer_size == 4) ? PR_MODEL_ILP32 : PR_MODEL_LP64; |
|
170 |
||
171 |
gen_prologue(gen_variant); |
|
172 |
||
173 |
GEN_VALUE(DATA_MODEL, data_model); |
|
174 |
GEN_VALUE(POINTER_SIZE, pointer_size); |
|
175 |
#if defined(TIERED) |
|
176 |
GEN_VALUE(COMPILER, 3); |
|
177 |
#elif COMPILER1 |
|
178 |
GEN_VALUE(COMPILER, 1); |
|
179 |
#elif COMPILER2 |
|
180 |
GEN_VALUE(COMPILER, 2); |
|
181 |
#else |
|
182 |
GEN_VALUE(COMPILER, 0); |
|
183 |
#endif // COMPILER1 && COMPILER2 |
|
184 |
printf("\n"); |
|
185 |
||
186 |
GEN_OFFS(CollectedHeap, _reserved); |
|
187 |
GEN_OFFS(MemRegion, _start); |
|
188 |
GEN_OFFS(MemRegion, _word_size); |
|
189 |
GEN_SIZE(HeapWord); |
|
190 |
printf("\n"); |
|
191 |
||
192 |
GEN_OFFS(VMStructEntry, typeName); |
|
193 |
GEN_OFFS(VMStructEntry, fieldName); |
|
194 |
GEN_OFFS(VMStructEntry, address); |
|
195 |
GEN_SIZE(VMStructEntry); |
|
196 |
printf("\n"); |
|
197 |
||
198 |
GEN_VALUE(MAX_METHOD_CODE_SIZE, max_method_code_size); |
|
199 |
#if defined(sparc) || defined(__sparc) |
|
200 |
GEN_VALUE(OFFSET_interpreter_frame_method, 2 * pointer_size); /* L2 in saved window */ |
|
201 |
GEN_VALUE(OFFSET_interpreter_frame_sender_sp, 13 * pointer_size); /* I5 in saved window */ |
|
202 |
// Fake value for consistency. It is not going to be used. |
|
25714
87fa6860b5ae
8004128: NPG: remove stackwalking in Threads::gc_prologue and gc_epilogue code
coleenp
parents:
17006
diff
changeset
|
203 |
GEN_VALUE(OFFSET_interpreter_frame_bcp_offset, 0xFFFF); |
1 | 204 |
#elif defined(i386) || defined(__i386) || defined(__amd64) |
205 |
GEN_VALUE(OFFSET_interpreter_frame_sender_sp, -1 * pointer_size); |
|
206 |
GEN_VALUE(OFFSET_interpreter_frame_method, -3 * pointer_size); |
|
25714
87fa6860b5ae
8004128: NPG: remove stackwalking in Threads::gc_prologue and gc_epilogue code
coleenp
parents:
17006
diff
changeset
|
207 |
GEN_VALUE(OFFSET_interpreter_frame_bcp_offset, -7 * pointer_size); |
1 | 208 |
#endif |
209 |
||
210 |
GEN_OFFS(Klass, _name); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12937
diff
changeset
|
211 |
GEN_OFFS(ConstantPool, _pool_holder); |
1 | 212 |
printf("\n"); |
213 |
||
32191
9666860cbf22
8033577: [parfait] warnings from b128 for hotspot/src/os/solaris/dtrace: Unportable format string argument mismatch
sspitsyn
parents:
30764
diff
changeset
|
214 |
GEN_VALUE(OFFSET_HeapBlockHeader_used, (int) offset_of(HeapBlock::Header, _used)); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
215 |
GEN_OFFS(oopDesc, _metadata); |
1 | 216 |
printf("\n"); |
217 |
||
218 |
GEN_VALUE(AccessFlags_NATIVE, JVM_ACC_NATIVE); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12937
diff
changeset
|
219 |
GEN_VALUE(ConstMethod_has_linenumber_table, ConstMethod::_has_linenumber_table); |
1 | 220 |
GEN_OFFS(AccessFlags, _flags); |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
221 |
GEN_OFFS(Symbol, _length); |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
222 |
GEN_OFFS(Symbol, _body); |
1 | 223 |
printf("\n"); |
224 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12937
diff
changeset
|
225 |
GEN_OFFS(Method, _constMethod); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12937
diff
changeset
|
226 |
GEN_OFFS(Method, _access_flags); |
1 | 227 |
printf("\n"); |
228 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12937
diff
changeset
|
229 |
GEN_OFFS(ConstMethod, _constants); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12937
diff
changeset
|
230 |
GEN_OFFS(ConstMethod, _flags); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12937
diff
changeset
|
231 |
GEN_OFFS(ConstMethod, _code_size); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12937
diff
changeset
|
232 |
GEN_OFFS(ConstMethod, _name_index); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12937
diff
changeset
|
233 |
GEN_OFFS(ConstMethod, _signature_index); |
1 | 234 |
printf("\n"); |
235 |
||
236 |
GEN_OFFS(CodeHeap, _memory); |
|
237 |
GEN_OFFS(CodeHeap, _segmap); |
|
238 |
GEN_OFFS(CodeHeap, _log2_segment_size); |
|
239 |
printf("\n"); |
|
240 |
||
241 |
GEN_OFFS(VirtualSpace, _low_boundary); |
|
242 |
GEN_OFFS(VirtualSpace, _high_boundary); |
|
243 |
GEN_OFFS(VirtualSpace, _low); |
|
244 |
GEN_OFFS(VirtualSpace, _high); |
|
245 |
printf("\n"); |
|
246 |
||
26796 | 247 |
/* We need to use different names here because of the template parameter */ |
248 |
GEN_OFFS_NAME(GrowableArray<CodeHeap*>, _data, GrowableArray_CodeHeap); |
|
249 |
GEN_OFFS_NAME(GrowableArray<CodeHeap*>, _len, GrowableArray_CodeHeap); |
|
250 |
printf("\n"); |
|
251 |
||
1 | 252 |
GEN_OFFS(CodeBlob, _name); |
253 |
GEN_OFFS(CodeBlob, _header_size); |
|
38133
78b95467b9f1
8151956: Support non-continuous CodeBlobs in HotSpot
rbackman
parents:
32192
diff
changeset
|
254 |
GEN_OFFS(CodeBlob, _content_begin); |
78b95467b9f1
8151956: Support non-continuous CodeBlobs in HotSpot
rbackman
parents:
32192
diff
changeset
|
255 |
GEN_OFFS(CodeBlob, _code_begin); |
78b95467b9f1
8151956: Support non-continuous CodeBlobs in HotSpot
rbackman
parents:
32192
diff
changeset
|
256 |
GEN_OFFS(CodeBlob, _code_end); |
1 | 257 |
GEN_OFFS(CodeBlob, _data_offset); |
258 |
GEN_OFFS(CodeBlob, _frame_size); |
|
259 |
printf("\n"); |
|
260 |
||
261 |
GEN_OFFS(nmethod, _method); |
|
26686
d7bc560b0ee9
8054174: minor buglet in computation of end of pc descs in libjvm_db.c
dsamersoff
parents:
25714
diff
changeset
|
262 |
GEN_OFFS(nmethod, _dependencies_offset); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12937
diff
changeset
|
263 |
GEN_OFFS(nmethod, _metadata_offset); |
38133
78b95467b9f1
8151956: Support non-continuous CodeBlobs in HotSpot
rbackman
parents:
32192
diff
changeset
|
264 |
GEN_OFFS(nmethod, _scopes_data_begin); |
1 | 265 |
GEN_OFFS(nmethod, _scopes_pcs_offset); |
266 |
GEN_OFFS(nmethod, _handler_table_offset); |
|
38133
78b95467b9f1
8151956: Support non-continuous CodeBlobs in HotSpot
rbackman
parents:
32192
diff
changeset
|
267 |
GEN_OFFS(nmethod, _deopt_handler_begin); |
1 | 268 |
GEN_OFFS(nmethod, _orig_pc_offset); |
269 |
||
270 |
GEN_OFFS(PcDesc, _pc_offset); |
|
271 |
GEN_OFFS(PcDesc, _scope_decode_offset); |
|
272 |
||
273 |
printf("\n"); |
|
274 |
||
13969
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13728
diff
changeset
|
275 |
GEN_OFFS(NarrowPtrStruct, _base); |
d2a189b83b87
7054512: Compress class pointers after perm gen removal
roland
parents:
13728
diff
changeset
|
276 |
GEN_OFFS(NarrowPtrStruct, _shift); |
2254
f13dda645a4b
6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents:
670
diff
changeset
|
277 |
printf("\n"); |
f13dda645a4b
6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents:
670
diff
changeset
|
278 |
|
32191
9666860cbf22
8033577: [parfait] warnings from b128 for hotspot/src/os/solaris/dtrace: Unportable format string argument mismatch
sspitsyn
parents:
30764
diff
changeset
|
279 |
GEN_VALUE(SIZE_HeapBlockHeader, (int) sizeof(HeapBlock::Header)); |
1 | 280 |
GEN_SIZE(oopDesc); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12937
diff
changeset
|
281 |
GEN_SIZE(ConstantPool); |
1 | 282 |
printf("\n"); |
283 |
||
284 |
GEN_SIZE(PcDesc); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12937
diff
changeset
|
285 |
GEN_SIZE(Method); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12937
diff
changeset
|
286 |
GEN_SIZE(ConstMethod); |
1 | 287 |
GEN_SIZE(nmethod); |
288 |
GEN_SIZE(CodeBlob); |
|
289 |
GEN_SIZE(BufferBlob); |
|
290 |
GEN_SIZE(SingletonBlob); |
|
291 |
GEN_SIZE(RuntimeStub); |
|
292 |
GEN_SIZE(SafepointBlob); |
|
293 |
||
294 |
gen_epilogue(gen_variant); |
|
295 |
printf("\n"); |
|
296 |
||
297 |
fflush(stdout); |
|
298 |
return 0; |
|
299 |
} |