Mercurial > hg > truffle
annotate src/share/vm/classfile/javaClasses.hpp @ 6267:977007096840
7187290: nightly failures after JSR 292 lazy method handle update
Reviewed-by: kvn, twisti
author | twisti |
---|---|
date | Fri, 27 Jul 2012 16:14:15 -0700 |
parents | 1d7922586cf6 |
children | 957c266d8bc5 da91efe96a93 |
rev | line source |
---|---|
0 | 1 /* |
6057 | 2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1507
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1507
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1507
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_CLASSFILE_JAVACLASSES_HPP |
26 #define SHARE_VM_CLASSFILE_JAVACLASSES_HPP | |
27 | |
28 #include "classfile/systemDictionary.hpp" | |
29 #include "jvmtifiles/jvmti.h" | |
30 #include "oops/oop.hpp" | |
31 #include "runtime/os.hpp" | |
32 #include "utilities/utf8.hpp" | |
33 | |
0 | 34 // Interface for manipulating the basic Java classes. |
35 // | |
36 // All dependencies on layout of actual Java classes should be kept here. | |
37 // If the layout of any of the classes above changes the offsets must be adjusted. | |
38 // | |
39 // For most classes we hardwire the offsets for performance reasons. In certain | |
40 // cases (e.g. java.security.AccessControlContext) we compute the offsets at | |
41 // startup since the layout here differs between JDK1.2 and JDK1.3. | |
42 // | |
43 // Note that fields (static and non-static) are arranged with oops before non-oops | |
44 // on a per class basis. The offsets below have to reflect this ordering. | |
45 // | |
46 // When editing the layouts please update the check_offset verification code | |
47 // correspondingly. The names in the enums must be identical to the actual field | |
48 // names in order for the verification code to work. | |
49 | |
50 | |
51 // Interface to java.lang.String objects | |
52 | |
53 class java_lang_String : AllStatic { | |
54 private: | |
55 static int value_offset; | |
56 static int offset_offset; | |
57 static int count_offset; | |
58 static int hash_offset; | |
59 | |
6057 | 60 static bool initialized; |
61 | |
0 | 62 static Handle basic_create(int length, bool tenured, TRAPS); |
63 static Handle basic_create_from_unicode(jchar* unicode, int length, bool tenured, TRAPS); | |
64 | |
6057 | 65 static void set_value( oop string, typeArrayOop buffer) { |
66 assert(initialized, "Must be initialized"); | |
67 string->obj_field_put(value_offset, (oop)buffer); | |
68 } | |
69 static void set_offset(oop string, int offset) { | |
70 assert(initialized, "Must be initialized"); | |
71 if (offset_offset > 0) { | |
72 string->int_field_put(offset_offset, offset); | |
73 } | |
74 } | |
75 static void set_count( oop string, int count) { | |
76 assert(initialized, "Must be initialized"); | |
77 if (count_offset > 0) { | |
78 string->int_field_put(count_offset, count); | |
79 } | |
80 } | |
0 | 81 |
82 public: | |
6057 | 83 static void compute_offsets(); |
84 | |
0 | 85 // Instance creation |
86 static Handle create_from_unicode(jchar* unicode, int len, TRAPS); | |
87 static Handle create_tenured_from_unicode(jchar* unicode, int len, TRAPS); | |
88 static oop create_oop_from_unicode(jchar* unicode, int len, TRAPS); | |
89 static Handle create_from_str(const char* utf8_str, TRAPS); | |
90 static oop create_oop_from_str(const char* utf8_str, TRAPS); | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1989
diff
changeset
|
91 static Handle create_from_symbol(Symbol* symbol, TRAPS); |
0 | 92 static Handle create_from_platform_dependent_str(const char* str, TRAPS); |
93 static Handle char_converter(Handle java_string, jchar from_char, jchar to_char, TRAPS); | |
94 | |
6057 | 95 static bool has_offset_field() { |
96 assert(initialized, "Must be initialized"); | |
97 return (offset_offset > 0); | |
98 } | |
99 | |
100 static bool has_count_field() { | |
101 assert(initialized, "Must be initialized"); | |
102 return (count_offset > 0); | |
103 } | |
104 | |
105 static bool has_hash_field() { | |
106 assert(initialized, "Must be initialized"); | |
107 return (hash_offset > 0); | |
108 } | |
109 | |
110 static int value_offset_in_bytes() { | |
111 assert(initialized && (value_offset > 0), "Must be initialized"); | |
112 return value_offset; | |
113 } | |
114 static int count_offset_in_bytes() { | |
115 assert(initialized && (count_offset > 0), "Must be initialized"); | |
116 return count_offset; | |
117 } | |
118 static int offset_offset_in_bytes() { | |
119 assert(initialized && (offset_offset > 0), "Must be initialized"); | |
120 return offset_offset; | |
121 } | |
122 static int hash_offset_in_bytes() { | |
123 assert(initialized && (hash_offset > 0), "Must be initialized"); | |
124 return hash_offset; | |
125 } | |
0 | 126 |
127 // Accessors | |
128 static typeArrayOop value(oop java_string) { | |
6057 | 129 assert(initialized && (value_offset > 0), "Must be initialized"); |
0 | 130 assert(is_instance(java_string), "must be java_string"); |
131 return (typeArrayOop) java_string->obj_field(value_offset); | |
132 } | |
133 static int offset(oop java_string) { | |
6057 | 134 assert(initialized, "Must be initialized"); |
0 | 135 assert(is_instance(java_string), "must be java_string"); |
6057 | 136 if (offset_offset > 0) { |
137 return java_string->int_field(offset_offset); | |
138 } else { | |
139 return 0; | |
140 } | |
0 | 141 } |
142 static int length(oop java_string) { | |
6057 | 143 assert(initialized, "Must be initialized"); |
0 | 144 assert(is_instance(java_string), "must be java_string"); |
6057 | 145 if (count_offset > 0) { |
146 return java_string->int_field(count_offset); | |
147 } else { | |
148 return ((typeArrayOop)java_string->obj_field(value_offset))->length(); | |
149 } | |
0 | 150 } |
151 static int utf8_length(oop java_string); | |
152 | |
153 // String converters | |
154 static char* as_utf8_string(oop java_string); | |
1989
017cd8bce8a8
6539281: -Xcheck:jni should validate char* argument to ReleaseStringUTFChars
sla
parents:
1972
diff
changeset
|
155 static char* as_utf8_string(oop java_string, char* buf, int buflen); |
0 | 156 static char* as_utf8_string(oop java_string, int start, int len); |
22
90f5ddc7297b
6646946: Kernel installation failed on Japanese and Chinese XP SP2 (VM part)
coleenp
parents:
0
diff
changeset
|
157 static char* as_platform_dependent_str(Handle java_string, TRAPS); |
0 | 158 static jchar* as_unicode_string(oop java_string, int& length); |
159 | |
2418
352622fd140a
7032129: Native memory usage grow unexpectedly for vm/oom/*InternedString tests
never
parents:
2376
diff
changeset
|
160 // Compute the hash value for a java.lang.String object which would |
6162 | 161 // contain the characters passed in. |
2418
352622fd140a
7032129: Native memory usage grow unexpectedly for vm/oom/*InternedString tests
never
parents:
2376
diff
changeset
|
162 // |
6162 | 163 // As the hash value used by the String object itself, in |
164 // String.hashCode(). This value is normally calculated in Java code | |
165 // in the String.hashCode method(), but is precomputed for String | |
166 // objects in the shared archive file. | |
167 // hash P(31) from Kernighan & Ritchie | |
2418
352622fd140a
7032129: Native memory usage grow unexpectedly for vm/oom/*InternedString tests
never
parents:
2376
diff
changeset
|
168 // |
6162 | 169 // For this reason, THIS ALGORITHM MUST MATCH String.toHash(). |
170 template <typename T> static unsigned int to_hash(T* s, int len) { | |
2418
352622fd140a
7032129: Native memory usage grow unexpectedly for vm/oom/*InternedString tests
never
parents:
2376
diff
changeset
|
171 unsigned int h = 0; |
352622fd140a
7032129: Native memory usage grow unexpectedly for vm/oom/*InternedString tests
never
parents:
2376
diff
changeset
|
172 while (len-- > 0) { |
352622fd140a
7032129: Native memory usage grow unexpectedly for vm/oom/*InternedString tests
never
parents:
2376
diff
changeset
|
173 h = 31*h + (unsigned int) *s; |
352622fd140a
7032129: Native memory usage grow unexpectedly for vm/oom/*InternedString tests
never
parents:
2376
diff
changeset
|
174 s++; |
352622fd140a
7032129: Native memory usage grow unexpectedly for vm/oom/*InternedString tests
never
parents:
2376
diff
changeset
|
175 } |
352622fd140a
7032129: Native memory usage grow unexpectedly for vm/oom/*InternedString tests
never
parents:
2376
diff
changeset
|
176 return h; |
352622fd140a
7032129: Native memory usage grow unexpectedly for vm/oom/*InternedString tests
never
parents:
2376
diff
changeset
|
177 } |
6162 | 178 static unsigned int to_hash(oop java_string); |
179 | |
180 // This is the string hash code used by the StringTable, which may be | |
181 // the same as String.toHash or an alternate hash code. | |
2418
352622fd140a
7032129: Native memory usage grow unexpectedly for vm/oom/*InternedString tests
never
parents:
2376
diff
changeset
|
182 static unsigned int hash_string(oop java_string); |
352622fd140a
7032129: Native memory usage grow unexpectedly for vm/oom/*InternedString tests
never
parents:
2376
diff
changeset
|
183 |
0 | 184 static bool equals(oop java_string, jchar* chars, int len); |
185 | |
186 // Conversion between '.' and '/' formats | |
187 static Handle externalize_classname(Handle java_string, TRAPS) { return char_converter(java_string, '/', '.', THREAD); } | |
188 static Handle internalize_classname(Handle java_string, TRAPS) { return char_converter(java_string, '.', '/', THREAD); } | |
189 | |
190 // Conversion | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1989
diff
changeset
|
191 static Symbol* as_symbol(Handle java_string, TRAPS); |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1989
diff
changeset
|
192 static Symbol* as_symbol_or_null(oop java_string); |
0 | 193 |
194 // Testers | |
195 static bool is_instance(oop obj) { | |
1142 | 196 return obj != NULL && obj->klass() == SystemDictionary::String_klass(); |
0 | 197 } |
198 | |
199 // Debugging | |
200 static void print(Handle java_string, outputStream* st); | |
201 friend class JavaClasses; | |
202 }; | |
203 | |
204 | |
205 // Interface to java.lang.Class objects | |
206 | |
3938 | 207 #define CLASS_INJECTED_FIELDS(macro) \ |
208 macro(java_lang_Class, klass, object_signature, false) \ | |
209 macro(java_lang_Class, resolved_constructor, object_signature, false) \ | |
210 macro(java_lang_Class, array_klass, object_signature, false) \ | |
211 macro(java_lang_Class, oop_size, int_signature, false) \ | |
212 macro(java_lang_Class, static_oop_field_count, int_signature, false) | |
213 | |
0 | 214 class java_lang_Class : AllStatic { |
3938 | 215 friend class VMStructs; |
216 | |
0 | 217 private: |
218 // The fake offsets are added by the class loader when java.lang.Class is loaded | |
219 | |
3938 | 220 static int _klass_offset; |
221 static int _resolved_constructor_offset; | |
222 static int _array_klass_offset; | |
0 | 223 |
3938 | 224 static int _oop_size_offset; |
225 static int _static_oop_field_count_offset; | |
0 | 226 |
227 static bool offsets_computed; | |
228 static int classRedefinedCount_offset; | |
229 | |
230 public: | |
3938 | 231 static void compute_offsets(); |
232 | |
0 | 233 // Instance creation |
234 static oop create_mirror(KlassHandle k, TRAPS); | |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2357
diff
changeset
|
235 static void fixup_mirror(KlassHandle k, TRAPS); |
0 | 236 static oop create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS); |
237 // Conversion | |
238 static klassOop as_klassOop(oop java_class); | |
4009 | 239 static void set_klass(oop java_class, klassOop klass); |
665
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
579
diff
changeset
|
240 static BasicType as_BasicType(oop java_class, klassOop* reference_klass = NULL); |
710 | 241 static BasicType as_BasicType(oop java_class, KlassHandle* reference_klass) { |
242 klassOop refk_oop = NULL; | |
243 BasicType result = as_BasicType(java_class, &refk_oop); | |
244 (*reference_klass) = KlassHandle(refk_oop); | |
245 return result; | |
246 } | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1989
diff
changeset
|
247 static Symbol* as_signature(oop java_class, bool intern_if_not_found, TRAPS); |
665
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
579
diff
changeset
|
248 static void print_signature(oop java_class, outputStream *st); |
0 | 249 // Testing |
132
60b728ec77c1
6652736: well known classes in system dictionary are inefficiently processed
jrose
parents:
113
diff
changeset
|
250 static bool is_instance(oop obj) { |
1142 | 251 return obj != NULL && obj->klass() == SystemDictionary::Class_klass(); |
132
60b728ec77c1
6652736: well known classes in system dictionary are inefficiently processed
jrose
parents:
113
diff
changeset
|
252 } |
0 | 253 static bool is_primitive(oop java_class); |
254 static BasicType primitive_type(oop java_class); | |
255 static oop primitive_mirror(BasicType t); | |
256 // JVM_NewInstance support | |
257 static methodOop resolved_constructor(oop java_class); | |
258 static void set_resolved_constructor(oop java_class, methodOop constructor); | |
259 // JVM_NewArray support | |
260 static klassOop array_klass(oop java_class); | |
261 static void set_array_klass(oop java_class, klassOop klass); | |
262 // compiler support for class operations | |
3938 | 263 static int klass_offset_in_bytes() { return _klass_offset; } |
264 static int resolved_constructor_offset_in_bytes() { return _resolved_constructor_offset; } | |
265 static int array_klass_offset_in_bytes() { return _array_klass_offset; } | |
0 | 266 // Support for classRedefinedCount field |
267 static int classRedefinedCount(oop the_class_mirror); | |
268 static void set_classRedefinedCount(oop the_class_mirror, int value); | |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2357
diff
changeset
|
269 |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2357
diff
changeset
|
270 static int oop_size(oop java_class); |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2357
diff
changeset
|
271 static void set_oop_size(oop java_class, int size); |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2357
diff
changeset
|
272 static int static_oop_field_count(oop java_class); |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2357
diff
changeset
|
273 static void set_static_oop_field_count(oop java_class, int size); |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2357
diff
changeset
|
274 |
0 | 275 // Debugging |
276 friend class JavaClasses; | |
277 friend class instanceKlass; // verification code accesses offsets | |
278 friend class ClassFileParser; // access to number_of_fake_fields | |
279 }; | |
280 | |
281 // Interface to java.lang.Thread objects | |
282 | |
283 class java_lang_Thread : AllStatic { | |
284 private: | |
285 // Note that for this class the layout changed between JDK1.2 and JDK1.3, | |
286 // so we compute the offsets at startup rather than hard-wiring them. | |
287 static int _name_offset; | |
288 static int _group_offset; | |
289 static int _contextClassLoader_offset; | |
290 static int _inheritedAccessControlContext_offset; | |
291 static int _priority_offset; | |
292 static int _eetop_offset; | |
293 static int _daemon_offset; | |
294 static int _stillborn_offset; | |
295 static int _stackSize_offset; | |
296 static int _tid_offset; | |
297 static int _thread_status_offset; | |
298 static int _park_blocker_offset; | |
299 static int _park_event_offset ; | |
300 | |
301 static void compute_offsets(); | |
302 | |
303 public: | |
304 // Instance creation | |
305 static oop create(); | |
306 // Returns the JavaThread associated with the thread obj | |
307 static JavaThread* thread(oop java_thread); | |
308 // Set JavaThread for instance | |
309 static void set_thread(oop java_thread, JavaThread* thread); | |
310 // Name | |
311 static typeArrayOop name(oop java_thread); | |
312 static void set_name(oop java_thread, typeArrayOop name); | |
313 // Priority | |
314 static ThreadPriority priority(oop java_thread); | |
315 static void set_priority(oop java_thread, ThreadPriority priority); | |
316 // Thread group | |
317 static oop threadGroup(oop java_thread); | |
318 // Stillborn | |
319 static bool is_stillborn(oop java_thread); | |
320 static void set_stillborn(oop java_thread); | |
321 // Alive (NOTE: this is not really a field, but provides the correct | |
322 // definition without doing a Java call) | |
323 static bool is_alive(oop java_thread); | |
324 // Daemon | |
325 static bool is_daemon(oop java_thread); | |
326 static void set_daemon(oop java_thread); | |
327 // Context ClassLoader | |
328 static oop context_class_loader(oop java_thread); | |
329 // Control context | |
330 static oop inherited_access_control_context(oop java_thread); | |
331 // Stack size hint | |
332 static jlong stackSize(oop java_thread); | |
333 // Thread ID | |
334 static jlong thread_id(oop java_thread); | |
335 | |
336 // Blocker object responsible for thread parking | |
337 static oop park_blocker(oop java_thread); | |
338 | |
339 // Pointer to type-stable park handler, encoded as jlong. | |
340 // Should be set when apparently null | |
341 // For details, see unsafe.cpp Unsafe_Unpark | |
342 static jlong park_event(oop java_thread); | |
343 static bool set_park_event(oop java_thread, jlong ptr); | |
344 | |
345 // Java Thread Status for JVMTI and M&M use. | |
346 // This thread status info is saved in threadStatus field of | |
347 // java.lang.Thread java class. | |
348 enum ThreadStatus { | |
349 NEW = 0, | |
350 RUNNABLE = JVMTI_THREAD_STATE_ALIVE + // runnable / running | |
351 JVMTI_THREAD_STATE_RUNNABLE, | |
352 SLEEPING = JVMTI_THREAD_STATE_ALIVE + // Thread.sleep() | |
353 JVMTI_THREAD_STATE_WAITING + | |
354 JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT + | |
355 JVMTI_THREAD_STATE_SLEEPING, | |
356 IN_OBJECT_WAIT = JVMTI_THREAD_STATE_ALIVE + // Object.wait() | |
357 JVMTI_THREAD_STATE_WAITING + | |
358 JVMTI_THREAD_STATE_WAITING_INDEFINITELY + | |
359 JVMTI_THREAD_STATE_IN_OBJECT_WAIT, | |
360 IN_OBJECT_WAIT_TIMED = JVMTI_THREAD_STATE_ALIVE + // Object.wait(long) | |
361 JVMTI_THREAD_STATE_WAITING + | |
362 JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT + | |
363 JVMTI_THREAD_STATE_IN_OBJECT_WAIT, | |
364 PARKED = JVMTI_THREAD_STATE_ALIVE + // LockSupport.park() | |
365 JVMTI_THREAD_STATE_WAITING + | |
366 JVMTI_THREAD_STATE_WAITING_INDEFINITELY + | |
367 JVMTI_THREAD_STATE_PARKED, | |
368 PARKED_TIMED = JVMTI_THREAD_STATE_ALIVE + // LockSupport.park(long) | |
369 JVMTI_THREAD_STATE_WAITING + | |
370 JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT + | |
371 JVMTI_THREAD_STATE_PARKED, | |
372 BLOCKED_ON_MONITOR_ENTER = JVMTI_THREAD_STATE_ALIVE + // (re-)entering a synchronization block | |
373 JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER, | |
374 TERMINATED = JVMTI_THREAD_STATE_TERMINATED | |
375 }; | |
376 // Write thread status info to threadStatus field of java.lang.Thread. | |
377 static void set_thread_status(oop java_thread_oop, ThreadStatus status); | |
378 // Read thread status info from threadStatus field of java.lang.Thread. | |
379 static ThreadStatus get_thread_status(oop java_thread_oop); | |
380 | |
381 static const char* thread_status_name(oop java_thread_oop); | |
382 | |
383 // Debugging | |
384 friend class JavaClasses; | |
385 }; | |
386 | |
387 // Interface to java.lang.ThreadGroup objects | |
388 | |
389 class java_lang_ThreadGroup : AllStatic { | |
390 private: | |
391 static int _parent_offset; | |
392 static int _name_offset; | |
393 static int _threads_offset; | |
394 static int _groups_offset; | |
395 static int _maxPriority_offset; | |
396 static int _destroyed_offset; | |
397 static int _daemon_offset; | |
398 static int _vmAllowSuspension_offset; | |
399 static int _nthreads_offset; | |
400 static int _ngroups_offset; | |
401 | |
402 static void compute_offsets(); | |
403 | |
404 public: | |
405 // parent ThreadGroup | |
406 static oop parent(oop java_thread_group); | |
407 // name | |
408 static typeArrayOop name(oop java_thread_group); | |
409 // ("name as oop" accessor is not necessary) | |
410 // Number of threads in group | |
411 static int nthreads(oop java_thread_group); | |
412 // threads | |
413 static objArrayOop threads(oop java_thread_group); | |
414 // Number of threads in group | |
415 static int ngroups(oop java_thread_group); | |
416 // groups | |
417 static objArrayOop groups(oop java_thread_group); | |
418 // maxPriority in group | |
419 static ThreadPriority maxPriority(oop java_thread_group); | |
420 // Destroyed | |
421 static bool is_destroyed(oop java_thread_group); | |
422 // Daemon | |
423 static bool is_daemon(oop java_thread_group); | |
424 // vmAllowSuspension | |
425 static bool is_vmAllowSuspension(oop java_thread_group); | |
426 // Debugging | |
427 friend class JavaClasses; | |
428 }; | |
429 | |
430 | |
431 | |
432 // Interface to java.lang.Throwable objects | |
433 | |
434 class java_lang_Throwable: AllStatic { | |
435 friend class BacktraceBuilder; | |
436 | |
437 private: | |
438 // Offsets | |
439 enum { | |
440 hc_backtrace_offset = 0, | |
441 hc_detailMessage_offset = 1, | |
442 hc_cause_offset = 2, // New since 1.4 | |
443 hc_stackTrace_offset = 3 // New since 1.4 | |
444 }; | |
3820
0b80db433fcb
7046490: Preallocated OOME objects should obey Throwable stack trace protocol
dholmes
parents:
3785
diff
changeset
|
445 enum { |
0b80db433fcb
7046490: Preallocated OOME objects should obey Throwable stack trace protocol
dholmes
parents:
3785
diff
changeset
|
446 hc_static_unassigned_stacktrace_offset = 0 // New since 1.7 |
0b80db433fcb
7046490: Preallocated OOME objects should obey Throwable stack trace protocol
dholmes
parents:
3785
diff
changeset
|
447 }; |
0 | 448 // Trace constants |
449 enum { | |
450 trace_methods_offset = 0, | |
451 trace_bcis_offset = 1, | |
452 trace_next_offset = 2, | |
453 trace_size = 3, | |
454 trace_chunk_size = 32 | |
455 }; | |
456 | |
457 static int backtrace_offset; | |
458 static int detailMessage_offset; | |
459 static int cause_offset; | |
460 static int stackTrace_offset; | |
3820
0b80db433fcb
7046490: Preallocated OOME objects should obey Throwable stack trace protocol
dholmes
parents:
3785
diff
changeset
|
461 static int static_unassigned_stacktrace_offset; |
0 | 462 |
463 // Printing | |
464 static char* print_stack_element_to_buffer(methodOop method, int bci); | |
465 static void print_to_stream(Handle stream, const char* str); | |
466 // StackTrace (programmatic access, new since 1.4) | |
467 static void clear_stacktrace(oop throwable); | |
468 // No stack trace available | |
469 static const char* no_stack_trace_message(); | |
3820
0b80db433fcb
7046490: Preallocated OOME objects should obey Throwable stack trace protocol
dholmes
parents:
3785
diff
changeset
|
470 // Stacktrace (post JDK 1.7.0 to allow immutability protocol to be followed) |
0b80db433fcb
7046490: Preallocated OOME objects should obey Throwable stack trace protocol
dholmes
parents:
3785
diff
changeset
|
471 static void set_stacktrace(oop throwable, oop st_element_array); |
0b80db433fcb
7046490: Preallocated OOME objects should obey Throwable stack trace protocol
dholmes
parents:
3785
diff
changeset
|
472 static oop unassigned_stacktrace(); |
0 | 473 |
474 public: | |
475 // Backtrace | |
476 static oop backtrace(oop throwable); | |
477 static void set_backtrace(oop throwable, oop value); | |
478 // Needed by JVMTI to filter out this internal field. | |
479 static int get_backtrace_offset() { return backtrace_offset;} | |
480 static int get_detailMessage_offset() { return detailMessage_offset;} | |
481 // Message | |
482 static oop message(oop throwable); | |
483 static oop message(Handle throwable); | |
484 static void set_message(oop throwable, oop value); | |
485 // Print stack trace stored in exception by call-back to Java | |
486 // Note: this is no longer used in Merlin, but we still suppport | |
487 // it for compatibility. | |
488 static void print_stack_trace(oop throwable, oop print_stream); | |
489 static void print_stack_element(Handle stream, methodOop method, int bci); | |
490 static void print_stack_element(outputStream *st, methodOop method, int bci); | |
491 static void print_stack_usage(Handle stream); | |
492 | |
493 // Allocate space for backtrace (created but stack trace not filled in) | |
494 static void allocate_backtrace(Handle throwable, TRAPS); | |
495 // Fill in current stack trace for throwable with preallocated backtrace (no GC) | |
496 static void fill_in_stack_trace_of_preallocated_backtrace(Handle throwable); | |
497 // Fill in current stack trace, can cause GC | |
3272
01147d8aac1d
7009923: JSR 292: VM crash in JavaThread::last_frame
coleenp
parents:
2418
diff
changeset
|
498 static void fill_in_stack_trace(Handle throwable, methodHandle method, TRAPS); |
01147d8aac1d
7009923: JSR 292: VM crash in JavaThread::last_frame
coleenp
parents:
2418
diff
changeset
|
499 static void fill_in_stack_trace(Handle throwable, methodHandle method = methodHandle()); |
0 | 500 // Programmatic access to stack trace |
501 static oop get_stack_trace_element(oop throwable, int index, TRAPS); | |
502 static int get_stack_trace_depth(oop throwable, TRAPS); | |
503 // Printing | |
504 static void print(oop throwable, outputStream* st); | |
505 static void print(Handle throwable, outputStream* st); | |
506 static void print_stack_trace(oop throwable, outputStream* st); | |
507 // Debugging | |
508 friend class JavaClasses; | |
509 }; | |
510 | |
511 | |
512 // Interface to java.lang.reflect.AccessibleObject objects | |
513 | |
514 class java_lang_reflect_AccessibleObject: AllStatic { | |
515 private: | |
516 // Note that to reduce dependencies on the JDK we compute these | |
517 // offsets at run-time. | |
518 static int override_offset; | |
519 | |
520 static void compute_offsets(); | |
521 | |
522 public: | |
523 // Accessors | |
524 static jboolean override(oop reflect); | |
525 static void set_override(oop reflect, jboolean value); | |
526 | |
527 // Debugging | |
528 friend class JavaClasses; | |
529 }; | |
530 | |
531 | |
532 // Interface to java.lang.reflect.Method objects | |
533 | |
534 class java_lang_reflect_Method : public java_lang_reflect_AccessibleObject { | |
535 private: | |
536 // Note that to reduce dependencies on the JDK we compute these | |
537 // offsets at run-time. | |
538 static int clazz_offset; | |
539 static int name_offset; | |
540 static int returnType_offset; | |
541 static int parameterTypes_offset; | |
542 static int exceptionTypes_offset; | |
543 static int slot_offset; | |
544 static int modifiers_offset; | |
545 static int signature_offset; | |
546 static int annotations_offset; | |
547 static int parameter_annotations_offset; | |
548 static int annotation_default_offset; | |
549 | |
550 static void compute_offsets(); | |
551 | |
552 public: | |
553 // Allocation | |
554 static Handle create(TRAPS); | |
555 | |
556 // Accessors | |
557 static oop clazz(oop reflect); | |
558 static void set_clazz(oop reflect, oop value); | |
559 | |
560 static oop name(oop method); | |
561 static void set_name(oop method, oop value); | |
562 | |
563 static oop return_type(oop method); | |
564 static void set_return_type(oop method, oop value); | |
565 | |
566 static oop parameter_types(oop method); | |
567 static void set_parameter_types(oop method, oop value); | |
568 | |
569 static oop exception_types(oop method); | |
570 static void set_exception_types(oop method, oop value); | |
571 | |
572 static int slot(oop reflect); | |
573 static void set_slot(oop reflect, int value); | |
574 | |
575 static int modifiers(oop method); | |
576 static void set_modifiers(oop method, int value); | |
577 | |
578 static bool has_signature_field(); | |
579 static oop signature(oop method); | |
580 static void set_signature(oop method, oop value); | |
581 | |
582 static bool has_annotations_field(); | |
583 static oop annotations(oop method); | |
584 static void set_annotations(oop method, oop value); | |
585 | |
586 static bool has_parameter_annotations_field(); | |
587 static oop parameter_annotations(oop method); | |
588 static void set_parameter_annotations(oop method, oop value); | |
589 | |
590 static bool has_annotation_default_field(); | |
591 static oop annotation_default(oop method); | |
592 static void set_annotation_default(oop method, oop value); | |
593 | |
594 // Debugging | |
595 friend class JavaClasses; | |
596 }; | |
597 | |
598 | |
599 // Interface to java.lang.reflect.Constructor objects | |
600 | |
601 class java_lang_reflect_Constructor : public java_lang_reflect_AccessibleObject { | |
602 private: | |
603 // Note that to reduce dependencies on the JDK we compute these | |
604 // offsets at run-time. | |
605 static int clazz_offset; | |
606 static int parameterTypes_offset; | |
607 static int exceptionTypes_offset; | |
608 static int slot_offset; | |
609 static int modifiers_offset; | |
610 static int signature_offset; | |
611 static int annotations_offset; | |
612 static int parameter_annotations_offset; | |
613 | |
614 static void compute_offsets(); | |
615 | |
616 public: | |
617 // Allocation | |
618 static Handle create(TRAPS); | |
619 | |
620 // Accessors | |
621 static oop clazz(oop reflect); | |
622 static void set_clazz(oop reflect, oop value); | |
623 | |
624 static oop parameter_types(oop constructor); | |
625 static void set_parameter_types(oop constructor, oop value); | |
626 | |
627 static oop exception_types(oop constructor); | |
628 static void set_exception_types(oop constructor, oop value); | |
629 | |
630 static int slot(oop reflect); | |
631 static void set_slot(oop reflect, int value); | |
632 | |
633 static int modifiers(oop constructor); | |
634 static void set_modifiers(oop constructor, int value); | |
635 | |
636 static bool has_signature_field(); | |
637 static oop signature(oop constructor); | |
638 static void set_signature(oop constructor, oop value); | |
639 | |
640 static bool has_annotations_field(); | |
641 static oop annotations(oop constructor); | |
642 static void set_annotations(oop constructor, oop value); | |
643 | |
644 static bool has_parameter_annotations_field(); | |
645 static oop parameter_annotations(oop method); | |
646 static void set_parameter_annotations(oop method, oop value); | |
647 | |
648 // Debugging | |
649 friend class JavaClasses; | |
650 }; | |
651 | |
652 | |
653 // Interface to java.lang.reflect.Field objects | |
654 | |
655 class java_lang_reflect_Field : public java_lang_reflect_AccessibleObject { | |
656 private: | |
657 // Note that to reduce dependencies on the JDK we compute these | |
658 // offsets at run-time. | |
659 static int clazz_offset; | |
660 static int name_offset; | |
661 static int type_offset; | |
662 static int slot_offset; | |
663 static int modifiers_offset; | |
664 static int signature_offset; | |
665 static int annotations_offset; | |
666 | |
667 static void compute_offsets(); | |
668 | |
669 public: | |
670 // Allocation | |
671 static Handle create(TRAPS); | |
672 | |
673 // Accessors | |
674 static oop clazz(oop reflect); | |
675 static void set_clazz(oop reflect, oop value); | |
676 | |
677 static oop name(oop field); | |
678 static void set_name(oop field, oop value); | |
679 | |
680 static oop type(oop field); | |
681 static void set_type(oop field, oop value); | |
682 | |
683 static int slot(oop reflect); | |
684 static void set_slot(oop reflect, int value); | |
685 | |
686 static int modifiers(oop field); | |
687 static void set_modifiers(oop field, int value); | |
688 | |
689 static bool has_signature_field(); | |
690 static oop signature(oop constructor); | |
691 static void set_signature(oop constructor, oop value); | |
692 | |
693 static bool has_annotations_field(); | |
694 static oop annotations(oop constructor); | |
695 static void set_annotations(oop constructor, oop value); | |
696 | |
697 static bool has_parameter_annotations_field(); | |
698 static oop parameter_annotations(oop method); | |
699 static void set_parameter_annotations(oop method, oop value); | |
700 | |
701 static bool has_annotation_default_field(); | |
702 static oop annotation_default(oop method); | |
703 static void set_annotation_default(oop method, oop value); | |
704 | |
705 // Debugging | |
706 friend class JavaClasses; | |
707 }; | |
708 | |
709 // Interface to sun.reflect.ConstantPool objects | |
710 class sun_reflect_ConstantPool { | |
711 private: | |
712 // Note that to reduce dependencies on the JDK we compute these | |
713 // offsets at run-time. | |
714 static int _cp_oop_offset; | |
715 | |
716 static void compute_offsets(); | |
717 | |
718 public: | |
719 // Allocation | |
720 static Handle create(TRAPS); | |
721 | |
722 // Accessors | |
723 static oop cp_oop(oop reflect); | |
724 static void set_cp_oop(oop reflect, oop value); | |
725 static int cp_oop_offset() { | |
726 return _cp_oop_offset; | |
727 } | |
728 | |
729 // Debugging | |
730 friend class JavaClasses; | |
731 }; | |
732 | |
733 // Interface to sun.reflect.UnsafeStaticFieldAccessorImpl objects | |
734 class sun_reflect_UnsafeStaticFieldAccessorImpl { | |
735 private: | |
736 static int _base_offset; | |
737 static void compute_offsets(); | |
738 | |
739 public: | |
740 static int base_offset() { | |
741 return _base_offset; | |
742 } | |
743 | |
744 // Debugging | |
745 friend class JavaClasses; | |
746 }; | |
747 | |
748 // Interface to java.lang primitive type boxing objects: | |
749 // - java.lang.Boolean | |
750 // - java.lang.Character | |
751 // - java.lang.Float | |
752 // - java.lang.Double | |
753 // - java.lang.Byte | |
754 // - java.lang.Short | |
755 // - java.lang.Integer | |
756 // - java.lang.Long | |
757 | |
758 // This could be separated out into 8 individual classes. | |
759 | |
760 class java_lang_boxing_object: AllStatic { | |
761 private: | |
762 enum { | |
763 hc_value_offset = 0 | |
764 }; | |
765 static int value_offset; | |
165
437d03ea40b1
6703888: Compressed Oops: use the 32-bits gap after klass in a object
kvn
parents:
132
diff
changeset
|
766 static int long_value_offset; |
0 | 767 |
132
60b728ec77c1
6652736: well known classes in system dictionary are inefficiently processed
jrose
parents:
113
diff
changeset
|
768 static oop initialize_and_allocate(BasicType type, TRAPS); |
0 | 769 public: |
770 // Allocation. Returns a boxed value, or NULL for invalid type. | |
771 static oop create(BasicType type, jvalue* value, TRAPS); | |
772 // Accessors. Returns the basic type being boxed, or T_ILLEGAL for invalid oop. | |
773 static BasicType get_value(oop box, jvalue* value); | |
774 static BasicType set_value(oop box, jvalue* value); | |
132
60b728ec77c1
6652736: well known classes in system dictionary are inefficiently processed
jrose
parents:
113
diff
changeset
|
775 static BasicType basic_type(oop box); |
60b728ec77c1
6652736: well known classes in system dictionary are inefficiently processed
jrose
parents:
113
diff
changeset
|
776 static bool is_instance(oop box) { return basic_type(box) != T_ILLEGAL; } |
60b728ec77c1
6652736: well known classes in system dictionary are inefficiently processed
jrose
parents:
113
diff
changeset
|
777 static bool is_instance(oop box, BasicType type) { return basic_type(box) == type; } |
665
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
579
diff
changeset
|
778 static void print(oop box, outputStream* st) { jvalue value; print(get_value(box, &value), &value, st); } |
c89f86385056
6814659: separable cleanups and subroutines for 6655638
jrose
parents:
579
diff
changeset
|
779 static void print(BasicType type, jvalue* value, outputStream* st); |
0 | 780 |
165
437d03ea40b1
6703888: Compressed Oops: use the 32-bits gap after klass in a object
kvn
parents:
132
diff
changeset
|
781 static int value_offset_in_bytes(BasicType type) { |
437d03ea40b1
6703888: Compressed Oops: use the 32-bits gap after klass in a object
kvn
parents:
132
diff
changeset
|
782 return ( type == T_LONG || type == T_DOUBLE ) ? long_value_offset : |
437d03ea40b1
6703888: Compressed Oops: use the 32-bits gap after klass in a object
kvn
parents:
132
diff
changeset
|
783 value_offset; |
437d03ea40b1
6703888: Compressed Oops: use the 32-bits gap after klass in a object
kvn
parents:
132
diff
changeset
|
784 } |
0 | 785 |
786 // Debugging | |
787 friend class JavaClasses; | |
788 }; | |
789 | |
790 | |
791 | |
792 // Interface to java.lang.ref.Reference objects | |
793 | |
794 class java_lang_ref_Reference: AllStatic { | |
795 public: | |
796 enum { | |
797 hc_referent_offset = 0, | |
798 hc_queue_offset = 1, | |
799 hc_next_offset = 2, | |
800 hc_discovered_offset = 3 // Is not last, see SoftRefs. | |
801 }; | |
802 enum { | |
803 hc_static_lock_offset = 0, | |
804 hc_static_pending_offset = 1 | |
805 }; | |
806 | |
807 static int referent_offset; | |
808 static int queue_offset; | |
809 static int next_offset; | |
810 static int discovered_offset; | |
811 static int static_lock_offset; | |
812 static int static_pending_offset; | |
813 static int number_of_fake_oop_fields; | |
814 | |
815 // Accessors | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
816 static oop referent(oop ref) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
817 return ref->obj_field(referent_offset); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
818 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
819 static void set_referent(oop ref, oop value) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
820 ref->obj_field_put(referent_offset, value); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
821 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
822 static void set_referent_raw(oop ref, oop value) { |
3932
b0efc7ee3b31
7085860: JSR 292: implement CallSite.setTargetNormal and setTargetVolatile as native methods
twisti
parents:
3905
diff
changeset
|
823 ref->obj_field_put_raw(referent_offset, value); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
824 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
825 static HeapWord* referent_addr(oop ref) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
826 return ref->obj_field_addr<HeapWord>(referent_offset); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
827 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
828 static oop next(oop ref) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
829 return ref->obj_field(next_offset); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
830 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
831 static void set_next(oop ref, oop value) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
832 ref->obj_field_put(next_offset, value); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
833 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
834 static void set_next_raw(oop ref, oop value) { |
3932
b0efc7ee3b31
7085860: JSR 292: implement CallSite.setTargetNormal and setTargetVolatile as native methods
twisti
parents:
3905
diff
changeset
|
835 ref->obj_field_put_raw(next_offset, value); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
836 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
837 static HeapWord* next_addr(oop ref) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
838 return ref->obj_field_addr<HeapWord>(next_offset); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
839 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
840 static oop discovered(oop ref) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
841 return ref->obj_field(discovered_offset); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
842 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
843 static void set_discovered(oop ref, oop value) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
844 ref->obj_field_put(discovered_offset, value); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
845 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
846 static void set_discovered_raw(oop ref, oop value) { |
3932
b0efc7ee3b31
7085860: JSR 292: implement CallSite.setTargetNormal and setTargetVolatile as native methods
twisti
parents:
3905
diff
changeset
|
847 ref->obj_field_put_raw(discovered_offset, value); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
848 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
849 static HeapWord* discovered_addr(oop ref) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
850 return ref->obj_field_addr<HeapWord>(discovered_offset); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
851 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
852 // Accessors for statics |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
853 static oop pending_list_lock(); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
854 static oop pending_list(); |
0 | 855 |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
22
diff
changeset
|
856 static HeapWord* pending_list_addr(); |
0 | 857 }; |
858 | |
859 | |
860 // Interface to java.lang.ref.SoftReference objects | |
861 | |
862 class java_lang_ref_SoftReference: public java_lang_ref_Reference { | |
863 public: | |
864 enum { | |
865 // The timestamp is a long field and may need to be adjusted for alignment. | |
165
437d03ea40b1
6703888: Compressed Oops: use the 32-bits gap after klass in a object
kvn
parents:
132
diff
changeset
|
866 hc_timestamp_offset = hc_discovered_offset + 1 |
0 | 867 }; |
868 enum { | |
869 hc_static_clock_offset = 0 | |
870 }; | |
871 | |
872 static int timestamp_offset; | |
873 static int static_clock_offset; | |
874 | |
875 // Accessors | |
876 static jlong timestamp(oop ref); | |
877 | |
878 // Accessors for statics | |
879 static jlong clock(); | |
880 static void set_clock(jlong value); | |
881 }; | |
882 | |
883 | |
2357
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2177
diff
changeset
|
884 // Interface to java.lang.invoke.MethodHandle objects |
710 | 885 |
886 class MethodHandleEntry; | |
887 | |
2357
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2177
diff
changeset
|
888 class java_lang_invoke_MethodHandle: AllStatic { |
710 | 889 friend class JavaClasses; |
890 | |
891 private: | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
892 static int _type_offset; // the MethodType of this MH |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
893 static int _form_offset; // the LambdaForm of this MH |
710 | 894 |
895 static void compute_offsets(); | |
896 | |
897 public: | |
898 // Accessors | |
899 static oop type(oop mh); | |
900 static void set_type(oop mh, oop mtype); | |
901 | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
902 static oop form(oop mh); |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
903 static void set_form(oop mh, oop lform); |
710 | 904 |
905 // Testers | |
906 static bool is_subclass(klassOop klass) { | |
907 return Klass::cast(klass)->is_subclass_of(SystemDictionary::MethodHandle_klass()); | |
908 } | |
909 static bool is_instance(oop obj) { | |
910 return obj != NULL && is_subclass(obj->klass()); | |
911 } | |
912 | |
913 // Accessors for code generation: | |
914 static int type_offset_in_bytes() { return _type_offset; } | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
915 static int form_offset_in_bytes() { return _form_offset; } |
710 | 916 }; |
917 | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
918 // Interface to java.lang.invoke.LambdaForm objects |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
919 // (These are a private interface for managing adapter code generation.) |
3938 | 920 |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
921 class java_lang_invoke_LambdaForm: AllStatic { |
710 | 922 friend class JavaClasses; |
923 | |
924 private: | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
925 static int _vmentry_offset; // type is MemberName |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
926 |
710 | 927 static void compute_offsets(); |
928 | |
929 public: | |
930 // Accessors | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
931 static oop vmentry(oop lform); |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
932 static void set_vmentry(oop lform, oop invoker); |
710 | 933 |
934 // Testers | |
935 static bool is_subclass(klassOop klass) { | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
936 return SystemDictionary::LambdaForm_klass() != NULL && |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
937 Klass::cast(klass)->is_subclass_of(SystemDictionary::LambdaForm_klass()); |
710 | 938 } |
939 static bool is_instance(oop obj) { | |
940 return obj != NULL && is_subclass(obj->klass()); | |
941 } | |
942 | |
943 // Accessors for code generation: | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
944 static int vmentry_offset_in_bytes() { return _vmentry_offset; } |
710 | 945 }; |
946 | |
3905
c26de9aef2ed
7071307: MethodHandle bimorphic inlining should consider the frequency
never
parents:
3820
diff
changeset
|
947 |
2357
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2177
diff
changeset
|
948 // Interface to java.lang.invoke.MemberName objects |
710 | 949 // (These are a private interface for Java code to query the class hierarchy.) |
950 | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
951 #define MEMBERNAME_INJECTED_FIELDS(macro) \ |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
952 macro(java_lang_invoke_MemberName, vmindex, intptr_signature, false) \ |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
953 macro(java_lang_invoke_MemberName, vmtarget, object_signature, false) |
3938 | 954 |
2357
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2177
diff
changeset
|
955 class java_lang_invoke_MemberName: AllStatic { |
710 | 956 friend class JavaClasses; |
957 | |
958 private: | |
2357
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2177
diff
changeset
|
959 // From java.lang.invoke.MemberName: |
710 | 960 // private Class<?> clazz; // class in which the method is defined |
961 // private String name; // may be null if not yet materialized | |
962 // private Object type; // may be null if not yet materialized | |
963 // private int flags; // modifier bits; see reflect.Modifier | |
964 // private Object vmtarget; // VM-specific target value | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
965 // private intptr_t vmindex; // member index within class or interface |
710 | 966 static int _clazz_offset; |
967 static int _name_offset; | |
968 static int _type_offset; | |
969 static int _flags_offset; | |
970 static int _vmtarget_offset; | |
971 static int _vmindex_offset; | |
972 | |
973 static void compute_offsets(); | |
974 | |
975 public: | |
976 // Accessors | |
977 static oop clazz(oop mname); | |
978 static void set_clazz(oop mname, oop clazz); | |
979 | |
980 static oop type(oop mname); | |
981 static void set_type(oop mname, oop type); | |
982 | |
983 static oop name(oop mname); | |
984 static void set_name(oop mname, oop name); | |
985 | |
986 static int flags(oop mname); | |
987 static void set_flags(oop mname, int flags); | |
988 | |
989 static oop vmtarget(oop mname); | |
990 static void set_vmtarget(oop mname, oop target); | |
991 | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
992 static intptr_t vmindex(oop mname); |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
993 static void set_vmindex(oop mname, intptr_t index); |
710 | 994 |
995 // Testers | |
996 static bool is_subclass(klassOop klass) { | |
997 return Klass::cast(klass)->is_subclass_of(SystemDictionary::MemberName_klass()); | |
998 } | |
999 static bool is_instance(oop obj) { | |
1000 return obj != NULL && is_subclass(obj->klass()); | |
1001 } | |
1002 | |
1003 // Relevant integer codes (keep these in synch. with MethodHandleNatives.Constants): | |
1004 enum { | |
1005 MN_IS_METHOD = 0x00010000, // method (not constructor) | |
1006 MN_IS_CONSTRUCTOR = 0x00020000, // constructor | |
1007 MN_IS_FIELD = 0x00040000, // field | |
1008 MN_IS_TYPE = 0x00080000, // nested type | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
1009 MN_REFERENCE_KIND_SHIFT = 24, // refKind |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
1010 MN_REFERENCE_KIND_MASK = 0x0F000000 >> MN_REFERENCE_KIND_SHIFT, |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
1011 // The SEARCH_* bits are not for MN.flags but for the matchFlags argument of MHN.getMembers: |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
1012 MN_SEARCH_SUPERCLASSES = 0x00100000, // walk super classes |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
1013 MN_SEARCH_INTERFACES = 0x00200000 // walk implemented interfaces |
710 | 1014 }; |
1015 | |
1016 // Accessors for code generation: | |
1017 static int clazz_offset_in_bytes() { return _clazz_offset; } | |
1018 static int type_offset_in_bytes() { return _type_offset; } | |
1019 static int name_offset_in_bytes() { return _name_offset; } | |
1020 static int flags_offset_in_bytes() { return _flags_offset; } | |
1021 static int vmtarget_offset_in_bytes() { return _vmtarget_offset; } | |
1022 static int vmindex_offset_in_bytes() { return _vmindex_offset; } | |
1023 }; | |
1024 | |
1025 | |
2357
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2177
diff
changeset
|
1026 // Interface to java.lang.invoke.MethodType objects |
710 | 1027 |
2357
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2177
diff
changeset
|
1028 class java_lang_invoke_MethodType: AllStatic { |
710 | 1029 friend class JavaClasses; |
1030 | |
1031 private: | |
1032 static int _rtype_offset; | |
1033 static int _ptypes_offset; | |
1034 | |
1035 static void compute_offsets(); | |
1036 | |
1037 public: | |
1038 // Accessors | |
1039 static oop rtype(oop mt); | |
1040 static objArrayOop ptypes(oop mt); | |
1041 | |
1042 static oop ptype(oop mt, int index); | |
1133
aa62b9388fce
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
1059
diff
changeset
|
1043 static int ptype_count(oop mt); |
710 | 1044 |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
1045 static int ptype_slot_count(oop mt); // extra counts for long/double |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
1046 static int rtype_slot_count(oop mt); // extra counts for long/double |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
1047 |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1989
diff
changeset
|
1048 static Symbol* as_signature(oop mt, bool intern_if_not_found, TRAPS); |
710 | 1049 static void print_signature(oop mt, outputStream* st); |
1050 | |
1051 static bool is_instance(oop obj) { | |
1052 return obj != NULL && obj->klass() == SystemDictionary::MethodType_klass(); | |
1053 } | |
1054 | |
3785
ddd894528dbc
7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents:
3363
diff
changeset
|
1055 static bool equals(oop mt1, oop mt2); |
ddd894528dbc
7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents:
3363
diff
changeset
|
1056 |
710 | 1057 // Accessors for code generation: |
1058 static int rtype_offset_in_bytes() { return _rtype_offset; } | |
1059 static int ptypes_offset_in_bytes() { return _ptypes_offset; } | |
1060 }; | |
1061 | |
1062 | |
2357
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2177
diff
changeset
|
1063 // Interface to java.lang.invoke.CallSite objects |
726
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
1064 |
2357
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2177
diff
changeset
|
1065 class java_lang_invoke_CallSite: AllStatic { |
726
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
1066 friend class JavaClasses; |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
1067 |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
1068 private: |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
1069 static int _target_offset; |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
1070 |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
1071 static void compute_offsets(); |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
1072 |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
1073 public: |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
1074 // Accessors |
3932
b0efc7ee3b31
7085860: JSR 292: implement CallSite.setTargetNormal and setTargetVolatile as native methods
twisti
parents:
3905
diff
changeset
|
1075 static oop target( oop site) { return site->obj_field( _target_offset); } |
b0efc7ee3b31
7085860: JSR 292: implement CallSite.setTargetNormal and setTargetVolatile as native methods
twisti
parents:
3905
diff
changeset
|
1076 static void set_target( oop site, oop target) { site->obj_field_put( _target_offset, target); } |
b0efc7ee3b31
7085860: JSR 292: implement CallSite.setTargetNormal and setTargetVolatile as native methods
twisti
parents:
3905
diff
changeset
|
1077 |
b0efc7ee3b31
7085860: JSR 292: implement CallSite.setTargetNormal and setTargetVolatile as native methods
twisti
parents:
3905
diff
changeset
|
1078 static volatile oop target_volatile(oop site) { return site->obj_field_volatile( _target_offset); } |
b0efc7ee3b31
7085860: JSR 292: implement CallSite.setTargetNormal and setTargetVolatile as native methods
twisti
parents:
3905
diff
changeset
|
1079 static void set_target_volatile(oop site, oop target) { site->obj_field_put_volatile(_target_offset, target); } |
726
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
1080 |
1135
e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
1133
diff
changeset
|
1081 // Testers |
e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
1133
diff
changeset
|
1082 static bool is_subclass(klassOop klass) { |
e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
1133
diff
changeset
|
1083 return Klass::cast(klass)->is_subclass_of(SystemDictionary::CallSite_klass()); |
e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
1133
diff
changeset
|
1084 } |
e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
1133
diff
changeset
|
1085 static bool is_instance(oop obj) { |
e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
1133
diff
changeset
|
1086 return obj != NULL && is_subclass(obj->klass()); |
e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
1133
diff
changeset
|
1087 } |
e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
1133
diff
changeset
|
1088 |
726
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
1089 // Accessors for code generation: |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
1090 static int target_offset_in_bytes() { return _target_offset; } |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
710
diff
changeset
|
1091 }; |
710 | 1092 |
1093 | |
0 | 1094 // Interface to java.security.AccessControlContext objects |
1095 | |
1096 class java_security_AccessControlContext: AllStatic { | |
1097 private: | |
1098 // Note that for this class the layout changed between JDK1.2 and JDK1.3, | |
1099 // so we compute the offsets at startup rather than hard-wiring them. | |
1100 static int _context_offset; | |
1101 static int _privilegedContext_offset; | |
1102 static int _isPrivileged_offset; | |
1103 | |
1104 static void compute_offsets(); | |
1105 public: | |
1106 static oop create(objArrayHandle context, bool isPrivileged, Handle privileged_context, TRAPS); | |
1107 | |
1108 // Debugging/initialization | |
1109 friend class JavaClasses; | |
1110 }; | |
1111 | |
1112 | |
1113 // Interface to java.lang.ClassLoader objects | |
1114 | |
1115 class java_lang_ClassLoader : AllStatic { | |
1116 private: | |
1117 enum { | |
1118 hc_parent_offset = 0 | |
1119 }; | |
1120 | |
3938 | 1121 static bool offsets_computed; |
0 | 1122 static int parent_offset; |
3938 | 1123 static int parallelCapable_offset; |
1124 | |
1125 static void compute_offsets(); | |
0 | 1126 |
1127 public: | |
1128 static oop parent(oop loader); | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
1129 static bool isAncestor(oop loader, oop cl); |
0 | 1130 |
3938 | 1131 // Support for parallelCapable field |
1132 static bool parallelCapable(oop the_class_mirror); | |
1133 | |
0 | 1134 static bool is_trusted_loader(oop loader); |
1135 | |
1136 // Fix for 4474172 | |
1137 static oop non_reflection_class_loader(oop loader); | |
1138 | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
1139 // Testers |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
1140 static bool is_subclass(klassOop klass) { |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
1141 return Klass::cast(klass)->is_subclass_of(SystemDictionary::ClassLoader_klass()); |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
1142 } |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
1143 static bool is_instance(oop obj) { |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
1144 return obj != NULL && is_subclass(obj->klass()); |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
1145 } |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
1146 |
0 | 1147 // Debugging |
1148 friend class JavaClasses; | |
1149 }; | |
1150 | |
1151 | |
1152 // Interface to java.lang.System objects | |
1153 | |
1154 class java_lang_System : AllStatic { | |
1155 private: | |
1156 enum { | |
1157 hc_static_in_offset = 0, | |
1158 hc_static_out_offset = 1, | |
1159 hc_static_err_offset = 2 | |
1160 }; | |
1161 | |
1162 static int static_in_offset; | |
1163 static int static_out_offset; | |
1164 static int static_err_offset; | |
1165 | |
1166 public: | |
1167 static int in_offset_in_bytes(); | |
1168 static int out_offset_in_bytes(); | |
1169 static int err_offset_in_bytes(); | |
1170 | |
1171 // Debugging | |
1172 friend class JavaClasses; | |
1173 }; | |
1174 | |
1175 | |
1176 // Interface to java.lang.StackTraceElement objects | |
1177 | |
1178 class java_lang_StackTraceElement: AllStatic { | |
1179 private: | |
1180 enum { | |
1181 hc_declaringClass_offset = 0, | |
1182 hc_methodName_offset = 1, | |
1183 hc_fileName_offset = 2, | |
1184 hc_lineNumber_offset = 3 | |
1185 }; | |
1186 | |
1187 static int declaringClass_offset; | |
1188 static int methodName_offset; | |
1189 static int fileName_offset; | |
1190 static int lineNumber_offset; | |
1191 | |
1192 public: | |
1193 // Setters | |
1194 static void set_declaringClass(oop element, oop value); | |
1195 static void set_methodName(oop element, oop value); | |
1196 static void set_fileName(oop element, oop value); | |
1197 static void set_lineNumber(oop element, int value); | |
1198 | |
1199 // Create an instance of StackTraceElement | |
1200 static oop create(methodHandle m, int bci, TRAPS); | |
1201 | |
1202 // Debugging | |
1203 friend class JavaClasses; | |
1204 }; | |
1205 | |
1206 | |
1207 // Interface to java.lang.AssertionStatusDirectives objects | |
1208 | |
1209 class java_lang_AssertionStatusDirectives: AllStatic { | |
1210 private: | |
1211 enum { | |
1212 hc_classes_offset, | |
1213 hc_classEnabled_offset, | |
1214 hc_packages_offset, | |
1215 hc_packageEnabled_offset, | |
1216 hc_deflt_offset | |
1217 }; | |
1218 | |
1219 static int classes_offset; | |
1220 static int classEnabled_offset; | |
1221 static int packages_offset; | |
1222 static int packageEnabled_offset; | |
1223 static int deflt_offset; | |
1224 | |
1225 public: | |
1226 // Setters | |
1227 static void set_classes(oop obj, oop val); | |
1228 static void set_classEnabled(oop obj, oop val); | |
1229 static void set_packages(oop obj, oop val); | |
1230 static void set_packageEnabled(oop obj, oop val); | |
1231 static void set_deflt(oop obj, bool val); | |
1232 // Debugging | |
1233 friend class JavaClasses; | |
1234 }; | |
1235 | |
1236 | |
1237 class java_nio_Buffer: AllStatic { | |
1238 private: | |
1239 static int _limit_offset; | |
1240 | |
1241 public: | |
1242 static int limit_offset(); | |
1243 static void compute_offsets(); | |
1244 }; | |
1245 | |
1246 class java_util_concurrent_locks_AbstractOwnableSynchronizer : AllStatic { | |
1247 private: | |
1248 static int _owner_offset; | |
1249 public: | |
1250 static void initialize(TRAPS); | |
1251 static oop get_owner_threadObj(oop obj); | |
1252 }; | |
1253 | |
3938 | 1254 // Use to declare fields that need to be injected into Java classes |
1255 // for the JVM to use. The name_index and signature_index are | |
1256 // declared in vmSymbols. The may_be_java flag is used to declare | |
1257 // fields that might already exist in Java but should be injected if | |
1258 // they don't. Otherwise the field is unconditionally injected and | |
1259 // the JVM uses the injected one. This is to ensure that name | |
1260 // collisions don't occur. In general may_be_java should be false | |
1261 // unless there's a good reason. | |
1262 | |
1263 class InjectedField { | |
1264 public: | |
1265 const SystemDictionary::WKID klass_id; | |
1266 const vmSymbols::SID name_index; | |
1267 const vmSymbols::SID signature_index; | |
1268 const bool may_be_java; | |
1269 | |
1270 | |
1271 klassOop klass() const { return SystemDictionary::well_known_klass(klass_id); } | |
1272 Symbol* name() const { return lookup_symbol(name_index); } | |
1273 Symbol* signature() const { return lookup_symbol(signature_index); } | |
1274 | |
1275 int compute_offset(); | |
1276 | |
1277 // Find the Symbol for this index | |
1278 static Symbol* lookup_symbol(int symbol_index) { | |
1279 return vmSymbols::symbol_at((vmSymbols::SID)symbol_index); | |
1280 } | |
1281 }; | |
1282 | |
1283 #define DECLARE_INJECTED_FIELD_ENUM(klass, name, signature, may_be_java) \ | |
1284 klass##_##name##_enum, | |
1285 | |
1286 #define ALL_INJECTED_FIELDS(macro) \ | |
1287 CLASS_INJECTED_FIELDS(macro) \ | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6166
diff
changeset
|
1288 MEMBERNAME_INJECTED_FIELDS(macro) |
3938 | 1289 |
0 | 1290 // Interface to hard-coded offset checking |
1291 | |
1292 class JavaClasses : AllStatic { | |
1293 private: | |
3938 | 1294 |
1295 static InjectedField _injected_fields[]; | |
1296 | |
0 | 1297 static bool check_offset(const char *klass_name, int offset, const char *field_name, const char* field_sig) PRODUCT_RETURN0; |
1298 static bool check_static_offset(const char *klass_name, int hardcoded_offset, const char *field_name, const char* field_sig) PRODUCT_RETURN0; | |
132
60b728ec77c1
6652736: well known classes in system dictionary are inefficiently processed
jrose
parents:
113
diff
changeset
|
1299 static bool check_constant(const char *klass_name, int constant, const char *field_name, const char* field_sig) PRODUCT_RETURN0; |
3938 | 1300 |
0 | 1301 public: |
3938 | 1302 enum InjectedFieldID { |
1303 ALL_INJECTED_FIELDS(DECLARE_INJECTED_FIELD_ENUM) | |
1304 MAX_enum | |
1305 }; | |
1306 | |
1307 static int compute_injected_offset(InjectedFieldID id); | |
1308 | |
0 | 1309 static void compute_hard_coded_offsets(); |
1310 static void compute_offsets(); | |
1311 static void check_offsets() PRODUCT_RETURN; | |
3938 | 1312 |
1313 static InjectedField* get_injected(Symbol* class_name, int* field_count); | |
0 | 1314 }; |
1972 | 1315 |
3938 | 1316 #undef DECLARE_INJECTED_FIELD_ENUM |
1317 | |
1972 | 1318 #endif // SHARE_VM_CLASSFILE_JAVACLASSES_HPP |