annotate src/share/vm/classfile/javaClasses.hpp @ 12297:48fce55afe71

6479237: (cl) Add support for classloader names Reviewed-by: alanb, bchristi, coleenp, dfuchs, lfoltan, psandoz, sspitsyn
author mchung
date Thu, 03 Nov 2016 18:08:02 -0700
parents b48a9e9bfd73
children 36223b379545
rev   line source
duke@0 1 /*
goetz@9952 2 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
duke@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0 4 *
duke@0 5 * This code is free software; you can redistribute it and/or modify it
duke@0 6 * under the terms of the GNU General Public License version 2 only, as
duke@0 7 * published by the Free Software Foundation.
duke@0 8 *
duke@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@0 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@0 13 * accompanied this code).
duke@0 14 *
duke@0 15 * You should have received a copy of the GNU General Public License version
duke@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0 18 *
trims@1472 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1472 20 * or visit www.oracle.com if you need additional information or have any
trims@1472 21 * questions.
duke@0 22 *
duke@0 23 */
duke@0 24
stefank@1879 25 #ifndef SHARE_VM_CLASSFILE_JAVACLASSES_HPP
stefank@1879 26 #define SHARE_VM_CLASSFILE_JAVACLASSES_HPP
stefank@1879 27
stefank@1879 28 #include "classfile/systemDictionary.hpp"
stefank@1879 29 #include "jvmtifiles/jvmti.h"
stefank@1879 30 #include "oops/oop.hpp"
stefank@1879 31 #include "runtime/os.hpp"
stefank@1879 32 #include "utilities/utf8.hpp"
stefank@1879 33
duke@0 34 // Interface for manipulating the basic Java classes.
duke@0 35 //
duke@0 36 // All dependencies on layout of actual Java classes should be kept here.
duke@0 37 // If the layout of any of the classes above changes the offsets must be adjusted.
duke@0 38 //
duke@0 39 // For most classes we hardwire the offsets for performance reasons. In certain
duke@0 40 // cases (e.g. java.security.AccessControlContext) we compute the offsets at
duke@0 41 // startup since the layout here differs between JDK1.2 and JDK1.3.
duke@0 42 //
duke@0 43 // Note that fields (static and non-static) are arranged with oops before non-oops
duke@0 44 // on a per class basis. The offsets below have to reflect this ordering.
duke@0 45 //
duke@0 46 // When editing the layouts please update the check_offset verification code
duke@0 47 // correspondingly. The names in the enums must be identical to the actual field
duke@0 48 // names in order for the verification code to work.
duke@0 49
duke@0 50
duke@0 51 // Interface to java.lang.String objects
duke@0 52
duke@0 53 class java_lang_String : AllStatic {
duke@0 54 private:
duke@0 55 static int value_offset;
duke@0 56 static int hash_offset;
thartmann@9282 57 static int coder_offset;
duke@0 58
kvn@3325 59 static bool initialized;
kvn@3325 60
thartmann@9282 61 static Handle basic_create(int length, bool byte_arr, TRAPS);
duke@0 62
goetz@9952 63 static inline void set_coder(oop string, jbyte coder);
duke@0 64
duke@0 65 public:
thartmann@9282 66
thartmann@9282 67 // Coders
thartmann@9282 68 enum Coder {
thartmann@9282 69 CODER_LATIN1 = 0,
thartmann@9282 70 CODER_UTF16 = 1
thartmann@9282 71 };
thartmann@9282 72
kvn@3325 73 static void compute_offsets();
kvn@3325 74
duke@0 75 // Instance creation
duke@0 76 static Handle create_from_unicode(jchar* unicode, int len, TRAPS);
duke@0 77 static oop create_oop_from_unicode(jchar* unicode, int len, TRAPS);
duke@0 78 static Handle create_from_str(const char* utf8_str, TRAPS);
duke@0 79 static oop create_oop_from_str(const char* utf8_str, TRAPS);
coleenp@2062 80 static Handle create_from_symbol(Symbol* symbol, TRAPS);
duke@0 81 static Handle create_from_platform_dependent_str(const char* str, TRAPS);
duke@0 82 static Handle char_converter(Handle java_string, jchar from_char, jchar to_char, TRAPS);
duke@0 83
kvn@3325 84 static bool has_hash_field() {
kvn@3325 85 assert(initialized, "Must be initialized");
kvn@3325 86 return (hash_offset > 0);
kvn@3325 87 }
thartmann@9282 88 static bool has_coder_field() {
thartmann@9282 89 assert(initialized, "Must be initialized");
thartmann@9282 90 return (coder_offset > 0);
thartmann@9282 91 }
thartmann@9282 92
thartmann@9282 93 static void set_compact_strings(bool value);
kvn@3325 94
kvn@3325 95 static int value_offset_in_bytes() {
kvn@3325 96 assert(initialized && (value_offset > 0), "Must be initialized");
kvn@3325 97 return value_offset;
kvn@3325 98 }
kvn@3325 99 static int hash_offset_in_bytes() {
kvn@3325 100 assert(initialized && (hash_offset > 0), "Must be initialized");
kvn@3325 101 return hash_offset;
kvn@3325 102 }
thartmann@9282 103 static int coder_offset_in_bytes() {
thartmann@9282 104 assert(initialized && (coder_offset > 0), "Must be initialized");
thartmann@9282 105 return coder_offset;
thartmann@9282 106 }
duke@0 107
goetz@9952 108 static inline void set_value_raw(oop string, typeArrayOop buffer);
goetz@9952 109 static inline void set_value(oop string, typeArrayOop buffer);
goetz@9952 110 static inline void set_hash(oop string, unsigned int hash);
pliden@6157 111
duke@0 112 // Accessors
goetz@9952 113 static inline typeArrayOop value(oop java_string);
goetz@9952 114 static inline unsigned int hash(oop java_string);
goetz@9952 115 static inline bool is_latin1(oop java_string);
goetz@9952 116 static inline int length(oop java_string);
duke@0 117 static int utf8_length(oop java_string);
duke@0 118
duke@0 119 // String converters
duke@0 120 static char* as_utf8_string(oop java_string);
sla@1896 121 static char* as_utf8_string(oop java_string, char* buf, int buflen);
duke@0 122 static char* as_utf8_string(oop java_string, int start, int len);
mgerdin@6347 123 static char* as_utf8_string(oop java_string, int start, int len, char* buf, int buflen);
coleenp@22 124 static char* as_platform_dependent_str(Handle java_string, TRAPS);
hseigel@4552 125 static jchar* as_unicode_string(oop java_string, int& length, TRAPS);
minqi@3832 126 // produce an ascii string with all other values quoted using \u####
minqi@3832 127 static char* as_quoted_ascii(oop java_string);
duke@0 128
never@2265 129 // Compute the hash value for a java.lang.String object which would
coleenp@3430 130 // contain the characters passed in.
never@2265 131 //
coleenp@3430 132 // As the hash value used by the String object itself, in
coleenp@3430 133 // String.hashCode(). This value is normally calculated in Java code
coleenp@3430 134 // in the String.hashCode method(), but is precomputed for String
coleenp@3430 135 // objects in the shared archive file.
coleenp@3430 136 // hash P(31) from Kernighan & Ritchie
never@2265 137 //
brutisso@3900 138 // For this reason, THIS ALGORITHM MUST MATCH String.hashCode().
thartmann@9282 139 static unsigned int hash_code(const jchar* s, int len) {
never@2265 140 unsigned int h = 0;
never@2265 141 while (len-- > 0) {
never@2265 142 h = 31*h + (unsigned int) *s;
never@2265 143 s++;
never@2265 144 }
never@2265 145 return h;
never@2265 146 }
thartmann@9282 147
thartmann@9282 148 static unsigned int hash_code(const jbyte* s, int len) {
thartmann@9282 149 unsigned int h = 0;
thartmann@9282 150 while (len-- > 0) {
thartmann@9282 151 h = 31*h + (((unsigned int) *s) & 0xFF);
thartmann@9282 152 s++;
thartmann@9282 153 }
thartmann@9282 154 return h;
thartmann@9282 155 }
thartmann@9282 156
brutisso@3900 157 static unsigned int hash_code(oop java_string);
never@2265 158
duke@0 159 static bool equals(oop java_string, jchar* chars, int len);
dcubed@5308 160 static bool equals(oop str1, oop str2);
duke@0 161
duke@0 162 // Conversion between '.' and '/' formats
duke@0 163 static Handle externalize_classname(Handle java_string, TRAPS) { return char_converter(java_string, '/', '.', THREAD); }
duke@0 164 static Handle internalize_classname(Handle java_string, TRAPS) { return char_converter(java_string, '.', '/', THREAD); }
duke@0 165
duke@0 166 // Conversion
coleenp@2062 167 static Symbol* as_symbol(Handle java_string, TRAPS);
coleenp@2062 168 static Symbol* as_symbol_or_null(oop java_string);
duke@0 169
duke@0 170 // Testers
stefank@7863 171 static bool is_instance(oop obj);
goetz@9952 172 static inline bool is_instance_inlined(oop obj);
duke@0 173
duke@0 174 // Debugging
stefank@6043 175 static void print(oop java_string, outputStream* st);
duke@0 176 friend class JavaClasses;
jiangli@8542 177 friend class StringTable;
duke@0 178 };
duke@0 179
duke@0 180
duke@0 181 // Interface to java.lang.Class objects
duke@0 182
never@2702 183 #define CLASS_INJECTED_FIELDS(macro) \
coleenp@3602 184 macro(java_lang_Class, klass, intptr_signature, false) \
coleenp@3602 185 macro(java_lang_Class, array_klass, intptr_signature, false) \
never@2702 186 macro(java_lang_Class, oop_size, int_signature, false) \
coleenp@4741 187 macro(java_lang_Class, static_oop_field_count, int_signature, false) \
coleenp@4741 188 macro(java_lang_Class, protection_domain, object_signature, false) \
coleenp@4741 189 macro(java_lang_Class, signers, object_signature, false)
never@2702 190
duke@0 191 class java_lang_Class : AllStatic {
never@2702 192 friend class VMStructs;
twisti@9788 193 friend class JVMCIVMStructs;
never@2702 194
duke@0 195 private:
duke@0 196 // The fake offsets are added by the class loader when java.lang.Class is loaded
duke@0 197
never@2702 198 static int _klass_offset;
never@2702 199 static int _array_klass_offset;
duke@0 200
never@2702 201 static int _oop_size_offset;
never@2702 202 static int _static_oop_field_count_offset;
duke@0 203
coleenp@4741 204 static int _protection_domain_offset;
coleenp@4741 205 static int _init_lock_offset;
coleenp@4741 206 static int _signers_offset;
coleenp@6618 207 static int _class_loader_offset;
alanb@10487 208 static int _module_offset;
coleenp@6679 209 static int _component_mirror_offset;
coleenp@4741 210
duke@0 211 static bool offsets_computed;
duke@0 212 static int classRedefinedCount_offset;
coleenp@6618 213
coleenp@3602 214 static GrowableArray<Klass*>* _fixup_mirror_list;
alanb@10487 215 static GrowableArray<Klass*>* _fixup_module_field_list;
duke@0 216
coleenp@4741 217 static void set_init_lock(oop java_class, oop init_lock);
hseigel@4937 218 static void set_protection_domain(oop java_class, oop protection_domain);
coleenp@6618 219 static void set_class_loader(oop java_class, oop class_loader);
coleenp@6679 220 static void set_component_mirror(oop java_class, oop comp_mirror);
coleenp@6272 221 static void initialize_mirror_fields(KlassHandle k, Handle mirror, Handle protection_domain, TRAPS);
lfoltan@12014 222 static void set_mirror_module_field(KlassHandle K, Handle mirror, Handle module, TRAPS);
duke@0 223 public:
never@2702 224 static void compute_offsets();
never@2702 225
duke@0 226 // Instance creation
alanb@10487 227 static void create_mirror(KlassHandle k, Handle class_loader, Handle module,
coleenp@6618 228 Handle protection_domain, TRAPS);
never@2223 229 static void fixup_mirror(KlassHandle k, TRAPS);
duke@0 230 static oop create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS);
alanb@10487 231
alanb@10487 232 static void fixup_module_field(KlassHandle k, Handle module);
alanb@10487 233
duke@0 234 // Conversion
coleenp@3602 235 static Klass* as_Klass(oop java_class);
coleenp@3602 236 static void set_klass(oop java_class, Klass* klass);
coleenp@3602 237 static BasicType as_BasicType(oop java_class, Klass** reference_klass = NULL);
jrose@710 238 static BasicType as_BasicType(oop java_class, KlassHandle* reference_klass) {
coleenp@3602 239 Klass* refk_oop = NULL;
jrose@710 240 BasicType result = as_BasicType(java_class, &refk_oop);
jrose@710 241 (*reference_klass) = KlassHandle(refk_oop);
jrose@710 242 return result;
jrose@710 243 }
coleenp@2062 244 static Symbol* as_signature(oop java_class, bool intern_if_not_found, TRAPS);
jrose@665 245 static void print_signature(oop java_class, outputStream *st);
vkempik@8752 246 static const char* as_external_name(oop java_class);
duke@0 247 // Testing
stefank@7863 248 static bool is_instance(oop obj);
stefank@7863 249
duke@0 250 static bool is_primitive(oop java_class);
duke@0 251 static BasicType primitive_type(oop java_class);
duke@0 252 static oop primitive_mirror(BasicType t);
duke@0 253 // JVM_NewArray support
coleenp@3602 254 static Klass* array_klass(oop java_class);
coleenp@3602 255 static void set_array_klass(oop java_class, Klass* klass);
duke@0 256 // compiler support for class operations
never@2702 257 static int klass_offset_in_bytes() { return _klass_offset; }
never@2702 258 static int array_klass_offset_in_bytes() { return _array_klass_offset; }
duke@0 259 // Support for classRedefinedCount field
duke@0 260 static int classRedefinedCount(oop the_class_mirror);
duke@0 261 static void set_classRedefinedCount(oop the_class_mirror, int value);
never@2223 262
coleenp@4741 263 // Support for embedded per-class oops
coleenp@4741 264 static oop protection_domain(oop java_class);
coleenp@4741 265 static oop init_lock(oop java_class);
coleenp@6679 266 static oop component_mirror(oop java_class);
coleenp@4741 267 static objArrayOop signers(oop java_class);
coleenp@4741 268 static void set_signers(oop java_class, objArrayOop signers);
coleenp@4741 269
coleenp@6618 270 static oop class_loader(oop java_class);
alanb@10487 271 static void set_module(oop java_class, oop module);
alanb@10487 272 static oop module(oop java_class);
coleenp@6618 273
never@2223 274 static int oop_size(oop java_class);
never@2223 275 static void set_oop_size(oop java_class, int size);
never@2223 276 static int static_oop_field_count(oop java_class);
never@2223 277 static void set_static_oop_field_count(oop java_class, int size);
never@2223 278
coleenp@3602 279 static GrowableArray<Klass*>* fixup_mirror_list() {
coleenp@3602 280 return _fixup_mirror_list;
coleenp@3602 281 }
coleenp@3602 282 static void set_fixup_mirror_list(GrowableArray<Klass*>* v) {
coleenp@3602 283 _fixup_mirror_list = v;
coleenp@3602 284 }
alanb@10487 285
alanb@10487 286 static GrowableArray<Klass*>* fixup_module_field_list() {
alanb@10487 287 return _fixup_module_field_list;
alanb@10487 288 }
alanb@10487 289 static void set_fixup_module_field_list(GrowableArray<Klass*>* v) {
alanb@10487 290 _fixup_module_field_list = v;
alanb@10487 291 }
alanb@10487 292
duke@0 293 // Debugging
duke@0 294 friend class JavaClasses;
coleenp@3602 295 friend class InstanceKlass; // verification code accesses offsets
duke@0 296 friend class ClassFileParser; // access to number_of_fake_fields
duke@0 297 };
duke@0 298
duke@0 299 // Interface to java.lang.Thread objects
duke@0 300
duke@0 301 class java_lang_Thread : AllStatic {
duke@0 302 private:
duke@0 303 // Note that for this class the layout changed between JDK1.2 and JDK1.3,
duke@0 304 // so we compute the offsets at startup rather than hard-wiring them.
duke@0 305 static int _name_offset;
duke@0 306 static int _group_offset;
duke@0 307 static int _contextClassLoader_offset;
duke@0 308 static int _inheritedAccessControlContext_offset;
duke@0 309 static int _priority_offset;
duke@0 310 static int _eetop_offset;
duke@0 311 static int _daemon_offset;
duke@0 312 static int _stillborn_offset;
duke@0 313 static int _stackSize_offset;
duke@0 314 static int _tid_offset;
duke@0 315 static int _thread_status_offset;
duke@0 316 static int _park_blocker_offset;
duke@0 317 static int _park_event_offset ;
duke@0 318
duke@0 319 static void compute_offsets();
duke@0 320
duke@0 321 public:
duke@0 322 // Instance creation
duke@0 323 static oop create();
duke@0 324 // Returns the JavaThread associated with the thread obj
duke@0 325 static JavaThread* thread(oop java_thread);
duke@0 326 // Set JavaThread for instance
duke@0 327 static void set_thread(oop java_thread, JavaThread* thread);
duke@0 328 // Name
shade@7393 329 static oop name(oop java_thread);
shade@7393 330 static void set_name(oop java_thread, oop name);
duke@0 331 // Priority
duke@0 332 static ThreadPriority priority(oop java_thread);
duke@0 333 static void set_priority(oop java_thread, ThreadPriority priority);
duke@0 334 // Thread group
duke@0 335 static oop threadGroup(oop java_thread);
duke@0 336 // Stillborn
duke@0 337 static bool is_stillborn(oop java_thread);
duke@0 338 static void set_stillborn(oop java_thread);
duke@0 339 // Alive (NOTE: this is not really a field, but provides the correct
duke@0 340 // definition without doing a Java call)
duke@0 341 static bool is_alive(oop java_thread);
duke@0 342 // Daemon
duke@0 343 static bool is_daemon(oop java_thread);
duke@0 344 static void set_daemon(oop java_thread);
duke@0 345 // Context ClassLoader
duke@0 346 static oop context_class_loader(oop java_thread);
duke@0 347 // Control context
duke@0 348 static oop inherited_access_control_context(oop java_thread);
duke@0 349 // Stack size hint
duke@0 350 static jlong stackSize(oop java_thread);
duke@0 351 // Thread ID
duke@0 352 static jlong thread_id(oop java_thread);
duke@0 353
duke@0 354 // Blocker object responsible for thread parking
duke@0 355 static oop park_blocker(oop java_thread);
duke@0 356
duke@0 357 // Pointer to type-stable park handler, encoded as jlong.
duke@0 358 // Should be set when apparently null
duke@0 359 // For details, see unsafe.cpp Unsafe_Unpark
duke@0 360 static jlong park_event(oop java_thread);
duke@0 361 static bool set_park_event(oop java_thread, jlong ptr);
duke@0 362
duke@0 363 // Java Thread Status for JVMTI and M&M use.
duke@0 364 // This thread status info is saved in threadStatus field of
duke@0 365 // java.lang.Thread java class.
duke@0 366 enum ThreadStatus {
duke@0 367 NEW = 0,
duke@0 368 RUNNABLE = JVMTI_THREAD_STATE_ALIVE + // runnable / running
duke@0 369 JVMTI_THREAD_STATE_RUNNABLE,
duke@0 370 SLEEPING = JVMTI_THREAD_STATE_ALIVE + // Thread.sleep()
duke@0 371 JVMTI_THREAD_STATE_WAITING +
duke@0 372 JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT +
duke@0 373 JVMTI_THREAD_STATE_SLEEPING,
duke@0 374 IN_OBJECT_WAIT = JVMTI_THREAD_STATE_ALIVE + // Object.wait()
duke@0 375 JVMTI_THREAD_STATE_WAITING +
duke@0 376 JVMTI_THREAD_STATE_WAITING_INDEFINITELY +
duke@0 377 JVMTI_THREAD_STATE_IN_OBJECT_WAIT,
duke@0 378 IN_OBJECT_WAIT_TIMED = JVMTI_THREAD_STATE_ALIVE + // Object.wait(long)
duke@0 379 JVMTI_THREAD_STATE_WAITING +
duke@0 380 JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT +
duke@0 381 JVMTI_THREAD_STATE_IN_OBJECT_WAIT,
duke@0 382 PARKED = JVMTI_THREAD_STATE_ALIVE + // LockSupport.park()
duke@0 383 JVMTI_THREAD_STATE_WAITING +
duke@0 384 JVMTI_THREAD_STATE_WAITING_INDEFINITELY +
duke@0 385 JVMTI_THREAD_STATE_PARKED,
duke@0 386 PARKED_TIMED = JVMTI_THREAD_STATE_ALIVE + // LockSupport.park(long)
duke@0 387 JVMTI_THREAD_STATE_WAITING +
duke@0 388 JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT +
duke@0 389 JVMTI_THREAD_STATE_PARKED,
duke@0 390 BLOCKED_ON_MONITOR_ENTER = JVMTI_THREAD_STATE_ALIVE + // (re-)entering a synchronization block
duke@0 391 JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER,
duke@0 392 TERMINATED = JVMTI_THREAD_STATE_TERMINATED
duke@0 393 };
duke@0 394 // Write thread status info to threadStatus field of java.lang.Thread.
duke@0 395 static void set_thread_status(oop java_thread_oop, ThreadStatus status);
duke@0 396 // Read thread status info from threadStatus field of java.lang.Thread.
duke@0 397 static ThreadStatus get_thread_status(oop java_thread_oop);
duke@0 398
duke@0 399 static const char* thread_status_name(oop java_thread_oop);
duke@0 400
duke@0 401 // Debugging
duke@0 402 friend class JavaClasses;
duke@0 403 };
duke@0 404
duke@0 405 // Interface to java.lang.ThreadGroup objects
duke@0 406
duke@0 407 class java_lang_ThreadGroup : AllStatic {
duke@0 408 private:
duke@0 409 static int _parent_offset;
duke@0 410 static int _name_offset;
duke@0 411 static int _threads_offset;
duke@0 412 static int _groups_offset;
duke@0 413 static int _maxPriority_offset;
duke@0 414 static int _destroyed_offset;
duke@0 415 static int _daemon_offset;
duke@0 416 static int _nthreads_offset;
duke@0 417 static int _ngroups_offset;
duke@0 418
duke@0 419 static void compute_offsets();
duke@0 420
duke@0 421 public:
duke@0 422 // parent ThreadGroup
duke@0 423 static oop parent(oop java_thread_group);
duke@0 424 // name
thartmann@9282 425 static const char* name(oop java_thread_group);
duke@0 426 // ("name as oop" accessor is not necessary)
duke@0 427 // Number of threads in group
duke@0 428 static int nthreads(oop java_thread_group);
duke@0 429 // threads
duke@0 430 static objArrayOop threads(oop java_thread_group);
duke@0 431 // Number of threads in group
duke@0 432 static int ngroups(oop java_thread_group);
duke@0 433 // groups
duke@0 434 static objArrayOop groups(oop java_thread_group);
duke@0 435 // maxPriority in group
duke@0 436 static ThreadPriority maxPriority(oop java_thread_group);
duke@0 437 // Destroyed
duke@0 438 static bool is_destroyed(oop java_thread_group);
duke@0 439 // Daemon
duke@0 440 static bool is_daemon(oop java_thread_group);
duke@0 441 // Debugging
duke@0 442 friend class JavaClasses;
duke@0 443 };
duke@0 444
duke@0 445
duke@0 446
duke@0 447 // Interface to java.lang.Throwable objects
duke@0 448
duke@0 449 class java_lang_Throwable: AllStatic {
duke@0 450 friend class BacktraceBuilder;
coleenp@10577 451 friend class BacktraceIterator;
duke@0 452
duke@0 453 private:
duke@0 454 // Offsets
duke@0 455 enum {
duke@0 456 hc_backtrace_offset = 0,
duke@0 457 hc_detailMessage_offset = 1,
duke@0 458 hc_cause_offset = 2, // New since 1.4
duke@0 459 hc_stackTrace_offset = 3 // New since 1.4
duke@0 460 };
dholmes@2583 461 enum {
dholmes@2583 462 hc_static_unassigned_stacktrace_offset = 0 // New since 1.7
dholmes@2583 463 };
duke@0 464 // Trace constants
duke@0 465 enum {
duke@0 466 trace_methods_offset = 0,
duke@0 467 trace_bcis_offset = 1,
coleenp@3602 468 trace_mirrors_offset = 2,
sspitsyn@8091 469 trace_cprefs_offset = 3,
sspitsyn@8091 470 trace_next_offset = 4,
sspitsyn@8091 471 trace_size = 5,
duke@0 472 trace_chunk_size = 32
duke@0 473 };
duke@0 474
duke@0 475 static int backtrace_offset;
duke@0 476 static int detailMessage_offset;
duke@0 477 static int stackTrace_offset;
coleenp@10577 478 static int depth_offset;
dholmes@2583 479 static int static_unassigned_stacktrace_offset;
duke@0 480
duke@0 481 // StackTrace (programmatic access, new since 1.4)
duke@0 482 static void clear_stacktrace(oop throwable);
dholmes@2583 483 // Stacktrace (post JDK 1.7.0 to allow immutability protocol to be followed)
dholmes@2583 484 static void set_stacktrace(oop throwable, oop st_element_array);
dholmes@2583 485 static oop unassigned_stacktrace();
duke@0 486
duke@0 487 public:
duke@0 488 // Backtrace
duke@0 489 static oop backtrace(oop throwable);
duke@0 490 static void set_backtrace(oop throwable, oop value);
coleenp@10577 491 static int depth(oop throwable);
coleenp@10577 492 static void set_depth(oop throwable, int value);
duke@0 493 // Needed by JVMTI to filter out this internal field.
duke@0 494 static int get_backtrace_offset() { return backtrace_offset;}
duke@0 495 static int get_detailMessage_offset() { return detailMessage_offset;}
duke@0 496 // Message
duke@0 497 static oop message(Handle throwable);
duke@0 498 static void set_message(oop throwable, oop value);
coleenp@6726 499 static Symbol* detail_message(oop throwable);
coleenp@9247 500 static void print_stack_element(outputStream *st, const methodHandle& method, int bci);
duke@0 501 static void print_stack_usage(Handle stream);
duke@0 502
coleenp@10577 503 static void compute_offsets();
coleenp@10577 504
duke@0 505 // Allocate space for backtrace (created but stack trace not filled in)
duke@0 506 static void allocate_backtrace(Handle throwable, TRAPS);
duke@0 507 // Fill in current stack trace for throwable with preallocated backtrace (no GC)
duke@0 508 static void fill_in_stack_trace_of_preallocated_backtrace(Handle throwable);
duke@0 509 // Fill in current stack trace, can cause GC
coleenp@9247 510 static void fill_in_stack_trace(Handle throwable, const methodHandle& method, TRAPS);
coleenp@9247 511 static void fill_in_stack_trace(Handle throwable, const methodHandle& method = methodHandle());
duke@0 512 // Programmatic access to stack trace
coleenp@10577 513 static void get_stack_trace_elements(Handle throwable, objArrayHandle stack_trace, TRAPS);
duke@0 514 // Printing
duke@0 515 static void print(Handle throwable, outputStream* st);
twisti@9808 516 static void print_stack_trace(Handle throwable, outputStream* st);
twisti@10011 517 static void java_printStackTrace(Handle throwable, TRAPS);
duke@0 518 // Debugging
duke@0 519 friend class JavaClasses;
duke@0 520 };
duke@0 521
duke@0 522
duke@0 523 // Interface to java.lang.reflect.AccessibleObject objects
duke@0 524
duke@0 525 class java_lang_reflect_AccessibleObject: AllStatic {
duke@0 526 private:
duke@0 527 // Note that to reduce dependencies on the JDK we compute these
duke@0 528 // offsets at run-time.
duke@0 529 static int override_offset;
duke@0 530
duke@0 531 static void compute_offsets();
duke@0 532
duke@0 533 public:
duke@0 534 // Accessors
duke@0 535 static jboolean override(oop reflect);
duke@0 536 static void set_override(oop reflect, jboolean value);
duke@0 537
duke@0 538 // Debugging
duke@0 539 friend class JavaClasses;
duke@0 540 };
duke@0 541
duke@0 542
duke@0 543 // Interface to java.lang.reflect.Method objects
duke@0 544
duke@0 545 class java_lang_reflect_Method : public java_lang_reflect_AccessibleObject {
duke@0 546 private:
duke@0 547 // Note that to reduce dependencies on the JDK we compute these
duke@0 548 // offsets at run-time.
duke@0 549 static int clazz_offset;
duke@0 550 static int name_offset;
duke@0 551 static int returnType_offset;
duke@0 552 static int parameterTypes_offset;
duke@0 553 static int exceptionTypes_offset;
duke@0 554 static int slot_offset;
duke@0 555 static int modifiers_offset;
duke@0 556 static int signature_offset;
duke@0 557 static int annotations_offset;
duke@0 558 static int parameter_annotations_offset;
duke@0 559 static int annotation_default_offset;
stefank@3958 560 static int type_annotations_offset;
duke@0 561
duke@0 562 static void compute_offsets();
duke@0 563
duke@0 564 public:
duke@0 565 // Allocation
duke@0 566 static Handle create(TRAPS);
duke@0 567
duke@0 568 // Accessors
duke@0 569 static oop clazz(oop reflect);
duke@0 570 static void set_clazz(oop reflect, oop value);
duke@0 571
duke@0 572 static oop name(oop method);
duke@0 573 static void set_name(oop method, oop value);
duke@0 574
duke@0 575 static oop return_type(oop method);
duke@0 576 static void set_return_type(oop method, oop value);
duke@0 577
duke@0 578 static oop parameter_types(oop method);
duke@0 579 static void set_parameter_types(oop method, oop value);
duke@0 580
duke@0 581 static oop exception_types(oop method);
duke@0 582 static void set_exception_types(oop method, oop value);
duke@0 583
duke@0 584 static int slot(oop reflect);
duke@0 585 static void set_slot(oop reflect, int value);
duke@0 586
duke@0 587 static int modifiers(oop method);
duke@0 588 static void set_modifiers(oop method, int value);
duke@0 589
duke@0 590 static bool has_signature_field();
duke@0 591 static oop signature(oop method);
duke@0 592 static void set_signature(oop method, oop value);
duke@0 593
duke@0 594 static bool has_annotations_field();
duke@0 595 static oop annotations(oop method);
duke@0 596 static void set_annotations(oop method, oop value);
duke@0 597
duke@0 598 static bool has_parameter_annotations_field();
duke@0 599 static oop parameter_annotations(oop method);
duke@0 600 static void set_parameter_annotations(oop method, oop value);
duke@0 601
duke@0 602 static bool has_annotation_default_field();
duke@0 603 static oop annotation_default(oop method);
duke@0 604 static void set_annotation_default(oop method, oop value);
duke@0 605
stefank@3958 606 static bool has_type_annotations_field();
stefank@3958 607 static oop type_annotations(oop method);
stefank@3958 608 static void set_type_annotations(oop method, oop value);
stefank@3958 609
duke@0 610 // Debugging
duke@0 611 friend class JavaClasses;
duke@0 612 };
duke@0 613
duke@0 614
duke@0 615 // Interface to java.lang.reflect.Constructor objects
duke@0 616
duke@0 617 class java_lang_reflect_Constructor : public java_lang_reflect_AccessibleObject {
duke@0 618 private:
duke@0 619 // Note that to reduce dependencies on the JDK we compute these
duke@0 620 // offsets at run-time.
duke@0 621 static int clazz_offset;
duke@0 622 static int parameterTypes_offset;
duke@0 623 static int exceptionTypes_offset;
duke@0 624 static int slot_offset;
duke@0 625 static int modifiers_offset;
duke@0 626 static int signature_offset;
duke@0 627 static int annotations_offset;
duke@0 628 static int parameter_annotations_offset;
stefank@3958 629 static int type_annotations_offset;
duke@0 630
duke@0 631 static void compute_offsets();
duke@0 632
duke@0 633 public:
duke@0 634 // Allocation
duke@0 635 static Handle create(TRAPS);
duke@0 636
duke@0 637 // Accessors
duke@0 638 static oop clazz(oop reflect);
duke@0 639 static void set_clazz(oop reflect, oop value);
duke@0 640
duke@0 641 static oop parameter_types(oop constructor);
duke@0 642 static void set_parameter_types(oop constructor, oop value);
duke@0 643
duke@0 644 static oop exception_types(oop constructor);
duke@0 645 static void set_exception_types(oop constructor, oop value);
duke@0 646
duke@0 647 static int slot(oop reflect);
duke@0 648 static void set_slot(oop reflect, int value);
duke@0 649
duke@0 650 static int modifiers(oop constructor);
duke@0 651 static void set_modifiers(oop constructor, int value);
duke@0 652
duke@0 653 static bool has_signature_field();
duke@0 654 static oop signature(oop constructor);
duke@0 655 static void set_signature(oop constructor, oop value);
duke@0 656
duke@0 657 static bool has_annotations_field();
duke@0 658 static oop annotations(oop constructor);
duke@0 659 static void set_annotations(oop constructor, oop value);
duke@0 660
duke@0 661 static bool has_parameter_annotations_field();
duke@0 662 static oop parameter_annotations(oop method);
duke@0 663 static void set_parameter_annotations(oop method, oop value);
duke@0 664
stefank@3958 665 static bool has_type_annotations_field();
stefank@3958 666 static oop type_annotations(oop constructor);
stefank@3958 667 static void set_type_annotations(oop constructor, oop value);
stefank@3958 668
duke@0 669 // Debugging
duke@0 670 friend class JavaClasses;
duke@0 671 };
duke@0 672
duke@0 673
duke@0 674 // Interface to java.lang.reflect.Field objects
duke@0 675
duke@0 676 class java_lang_reflect_Field : public java_lang_reflect_AccessibleObject {
duke@0 677 private:
duke@0 678 // Note that to reduce dependencies on the JDK we compute these
duke@0 679 // offsets at run-time.
duke@0 680 static int clazz_offset;
duke@0 681 static int name_offset;
duke@0 682 static int type_offset;
duke@0 683 static int slot_offset;
duke@0 684 static int modifiers_offset;
duke@0 685 static int signature_offset;
duke@0 686 static int annotations_offset;
stefank@3958 687 static int type_annotations_offset;
duke@0 688
duke@0 689 static void compute_offsets();
duke@0 690
duke@0 691 public:
duke@0 692 // Allocation
duke@0 693 static Handle create(TRAPS);
duke@0 694
duke@0 695 // Accessors
duke@0 696 static oop clazz(oop reflect);
duke@0 697 static void set_clazz(oop reflect, oop value);
duke@0 698
duke@0 699 static oop name(oop field);
duke@0 700 static void set_name(oop field, oop value);
duke@0 701
duke@0 702 static oop type(oop field);
duke@0 703 static void set_type(oop field, oop value);
duke@0 704
duke@0 705 static int slot(oop reflect);
duke@0 706 static void set_slot(oop reflect, int value);
duke@0 707
duke@0 708 static int modifiers(oop field);
duke@0 709 static void set_modifiers(oop field, int value);
duke@0 710
duke@0 711 static bool has_signature_field();
duke@0 712 static oop signature(oop constructor);
duke@0 713 static void set_signature(oop constructor, oop value);
duke@0 714
duke@0 715 static bool has_annotations_field();
duke@0 716 static oop annotations(oop constructor);
duke@0 717 static void set_annotations(oop constructor, oop value);
duke@0 718
duke@0 719 static bool has_parameter_annotations_field();
duke@0 720 static oop parameter_annotations(oop method);
duke@0 721 static void set_parameter_annotations(oop method, oop value);
duke@0 722
duke@0 723 static bool has_annotation_default_field();
duke@0 724 static oop annotation_default(oop method);
duke@0 725 static void set_annotation_default(oop method, oop value);
duke@0 726
stefank@3958 727 static bool has_type_annotations_field();
stefank@3958 728 static oop type_annotations(oop field);
stefank@3958 729 static void set_type_annotations(oop field, oop value);
stefank@3958 730
duke@0 731 // Debugging
duke@0 732 friend class JavaClasses;
duke@0 733 };
duke@0 734
coleenp@3963 735 class java_lang_reflect_Parameter {
coleenp@3963 736 private:
coleenp@3963 737 // Note that to reduce dependencies on the JDK we compute these
coleenp@3963 738 // offsets at run-time.
coleenp@3963 739 static int name_offset;
coleenp@3963 740 static int modifiers_offset;
coleenp@3963 741 static int index_offset;
coleenp@3963 742 static int executable_offset;
coleenp@3963 743
coleenp@3963 744 static void compute_offsets();
coleenp@3963 745
coleenp@3963 746 public:
coleenp@3963 747 // Allocation
coleenp@3963 748 static Handle create(TRAPS);
coleenp@3963 749
coleenp@3963 750 // Accessors
coleenp@3963 751 static oop name(oop field);
coleenp@3963 752 static void set_name(oop field, oop value);
coleenp@3963 753
coleenp@3963 754 static int index(oop reflect);
coleenp@3963 755 static void set_index(oop reflect, int value);
coleenp@3963 756
coleenp@3963 757 static int modifiers(oop reflect);
coleenp@3963 758 static void set_modifiers(oop reflect, int value);
coleenp@3963 759
coleenp@3963 760 static oop executable(oop constructor);
coleenp@3963 761 static void set_executable(oop constructor, oop value);
coleenp@3963 762
coleenp@3963 763 friend class JavaClasses;
coleenp@3963 764 };
coleenp@3963 765
alanb@10487 766 #define MODULE_INJECTED_FIELDS(macro) \
alanb@10487 767 macro(java_lang_reflect_Module, module_entry, intptr_signature, false)
alanb@10487 768
alanb@10487 769 class java_lang_reflect_Module {
alanb@10487 770 private:
alanb@10487 771 static int loader_offset;
alanb@10487 772 static int name_offset;
alanb@10487 773 static int _module_entry_offset;
alanb@10487 774 static void compute_offsets();
alanb@10487 775
alanb@10487 776 public:
alanb@10487 777 // Allocation
alanb@10487 778 static Handle create(Handle loader, Handle module_name, TRAPS);
alanb@10487 779
alanb@10487 780 // Testers
alanb@10487 781 static bool is_instance(oop obj);
alanb@10487 782
alanb@10487 783 // Accessors
alanb@10487 784 static oop loader(oop module);
alanb@10487 785 static void set_loader(oop module, oop value);
alanb@10487 786
alanb@10487 787 static oop name(oop module);
alanb@10487 788 static void set_name(oop module, oop value);
alanb@10487 789
alanb@10487 790 static ModuleEntry* module_entry(oop module, TRAPS);
alanb@10487 791 static void set_module_entry(oop module, ModuleEntry* module_entry);
alanb@10487 792
alanb@10487 793 friend class JavaClasses;
alanb@10487 794 };
alanb@10487 795
chegar@10815 796 // Interface to jdk.internal.reflect.ConstantPool objects
chegar@10815 797 class reflect_ConstantPool {
duke@0 798 private:
duke@0 799 // Note that to reduce dependencies on the JDK we compute these
duke@0 800 // offsets at run-time.
coleenp@3602 801 static int _oop_offset;
duke@0 802
duke@0 803 static void compute_offsets();
duke@0 804
duke@0 805 public:
duke@0 806 // Allocation
duke@0 807 static Handle create(TRAPS);
duke@0 808
duke@0 809 // Accessors
coleenp@3602 810 static void set_cp(oop reflect, ConstantPool* value);
coleenp@3602 811 static int oop_offset() {
coleenp@3602 812 return _oop_offset;
duke@0 813 }
duke@0 814
coleenp@3602 815 static ConstantPool* get_cp(oop reflect);
coleenp@3602 816
duke@0 817 // Debugging
duke@0 818 friend class JavaClasses;
duke@0 819 };
duke@0 820
chegar@10815 821 // Interface to jdk.internal.reflect.UnsafeStaticFieldAccessorImpl objects
chegar@10815 822 class reflect_UnsafeStaticFieldAccessorImpl {
duke@0 823 private:
duke@0 824 static int _base_offset;
duke@0 825 static void compute_offsets();
duke@0 826
duke@0 827 public:
duke@0 828 static int base_offset() {
duke@0 829 return _base_offset;
duke@0 830 }
duke@0 831
duke@0 832 // Debugging
duke@0 833 friend class JavaClasses;
duke@0 834 };
duke@0 835
duke@0 836 // Interface to java.lang primitive type boxing objects:
duke@0 837 // - java.lang.Boolean
duke@0 838 // - java.lang.Character
duke@0 839 // - java.lang.Float
duke@0 840 // - java.lang.Double
duke@0 841 // - java.lang.Byte
duke@0 842 // - java.lang.Short
duke@0 843 // - java.lang.Integer
duke@0 844 // - java.lang.Long
duke@0 845
duke@0 846 // This could be separated out into 8 individual classes.
duke@0 847
duke@0 848 class java_lang_boxing_object: AllStatic {
duke@0 849 private:
duke@0 850 enum {
duke@0 851 hc_value_offset = 0
duke@0 852 };
duke@0 853 static int value_offset;
kvn@165 854 static int long_value_offset;
duke@0 855
jrose@132 856 static oop initialize_and_allocate(BasicType type, TRAPS);
duke@0 857 public:
duke@0 858 // Allocation. Returns a boxed value, or NULL for invalid type.
duke@0 859 static oop create(BasicType type, jvalue* value, TRAPS);
duke@0 860 // Accessors. Returns the basic type being boxed, or T_ILLEGAL for invalid oop.
duke@0 861 static BasicType get_value(oop box, jvalue* value);
duke@0 862 static BasicType set_value(oop box, jvalue* value);
jrose@132 863 static BasicType basic_type(oop box);
jrose@132 864 static bool is_instance(oop box) { return basic_type(box) != T_ILLEGAL; }
jrose@132 865 static bool is_instance(oop box, BasicType type) { return basic_type(box) == type; }
jrose@665 866 static void print(oop box, outputStream* st) { jvalue value; print(get_value(box, &value), &value, st); }
jrose@665 867 static void print(BasicType type, jvalue* value, outputStream* st);
duke@0 868
kvn@165 869 static int value_offset_in_bytes(BasicType type) {
kvn@165 870 return ( type == T_LONG || type == T_DOUBLE ) ? long_value_offset :
kvn@165 871 value_offset;
kvn@165 872 }
duke@0 873
duke@0 874 // Debugging
duke@0 875 friend class JavaClasses;
duke@0 876 };
duke@0 877
duke@0 878
duke@0 879
duke@0 880 // Interface to java.lang.ref.Reference objects
duke@0 881
duke@0 882 class java_lang_ref_Reference: AllStatic {
duke@0 883 public:
duke@0 884 enum {
duke@0 885 hc_referent_offset = 0,
duke@0 886 hc_queue_offset = 1,
duke@0 887 hc_next_offset = 2,
duke@0 888 hc_discovered_offset = 3 // Is not last, see SoftRefs.
duke@0 889 };
duke@0 890
duke@0 891 static int referent_offset;
duke@0 892 static int queue_offset;
duke@0 893 static int next_offset;
duke@0 894 static int discovered_offset;
duke@0 895 static int number_of_fake_oop_fields;
duke@0 896
duke@0 897 // Accessors
goetz@9952 898 static inline oop referent(oop ref);
goetz@9952 899 static inline void set_referent(oop ref, oop value);
goetz@9952 900 static inline void set_referent_raw(oop ref, oop value);
goetz@9952 901 static inline HeapWord* referent_addr(oop ref);
goetz@9952 902 static inline oop next(oop ref);
goetz@9952 903 static inline void set_next(oop ref, oop value);
goetz@9952 904 static inline void set_next_raw(oop ref, oop value);
goetz@9952 905 static inline HeapWord* next_addr(oop ref);
goetz@9952 906 static inline oop discovered(oop ref);
goetz@9952 907 static inline void set_discovered(oop ref, oop value);
goetz@9952 908 static inline void set_discovered_raw(oop ref, oop value);
goetz@9952 909 static inline HeapWord* discovered_addr(oop ref);
duke@0 910 };
duke@0 911
duke@0 912
duke@0 913 // Interface to java.lang.ref.SoftReference objects
duke@0 914
duke@0 915 class java_lang_ref_SoftReference: public java_lang_ref_Reference {
duke@0 916 public:
duke@0 917 enum {
duke@0 918 // The timestamp is a long field and may need to be adjusted for alignment.
kvn@165 919 hc_timestamp_offset = hc_discovered_offset + 1
duke@0 920 };
duke@0 921 enum {
duke@0 922 hc_static_clock_offset = 0
duke@0 923 };
duke@0 924
duke@0 925 static int timestamp_offset;
duke@0 926 static int static_clock_offset;
duke@0 927
duke@0 928 // Accessors
duke@0 929 static jlong timestamp(oop ref);
duke@0 930
duke@0 931 // Accessors for statics
duke@0 932 static jlong clock();
duke@0 933 static void set_clock(jlong value);
duke@0 934 };
duke@0 935
jrose@2204 936 // Interface to java.lang.invoke.MethodHandle objects
jrose@710 937
jrose@710 938 class MethodHandleEntry;
jrose@710 939
jrose@2204 940 class java_lang_invoke_MethodHandle: AllStatic {
jrose@710 941 friend class JavaClasses;
jrose@710 942
jrose@710 943 private:
twisti@3534 944 static int _type_offset; // the MethodType of this MH
twisti@3534 945 static int _form_offset; // the LambdaForm of this MH
jrose@710 946
jrose@710 947 static void compute_offsets();
jrose@710 948
jrose@710 949 public:
jrose@710 950 // Accessors
jrose@710 951 static oop type(oop mh);
jrose@710 952 static void set_type(oop mh, oop mtype);
jrose@710 953
twisti@3534 954 static oop form(oop mh);
twisti@3534 955 static void set_form(oop mh, oop lform);
jrose@710 956
jrose@710 957 // Testers
coleenp@3602 958 static bool is_subclass(Klass* klass) {
hseigel@3843 959 return klass->is_subclass_of(SystemDictionary::MethodHandle_klass());
jrose@710 960 }
stefank@7863 961 static bool is_instance(oop obj);
jrose@710 962
jrose@710 963 // Accessors for code generation:
jrose@710 964 static int type_offset_in_bytes() { return _type_offset; }
twisti@3534 965 static int form_offset_in_bytes() { return _form_offset; }
jrose@710 966 };
jrose@710 967
sspitsyn@5061 968 // Interface to java.lang.invoke.DirectMethodHandle objects
sspitsyn@5061 969
sspitsyn@5061 970 class java_lang_invoke_DirectMethodHandle: AllStatic {
sspitsyn@5061 971 friend class JavaClasses;
sspitsyn@5061 972
sspitsyn@5061 973 private:
sspitsyn@5061 974 static int _member_offset; // the MemberName of this DMH
sspitsyn@5061 975
sspitsyn@5061 976 static void compute_offsets();
sspitsyn@5061 977
sspitsyn@5061 978 public:
sspitsyn@5061 979 // Accessors
sspitsyn@5061 980 static oop member(oop mh);
sspitsyn@5061 981
sspitsyn@5061 982 // Testers
sspitsyn@5061 983 static bool is_subclass(Klass* klass) {
sspitsyn@5061 984 return klass->is_subclass_of(SystemDictionary::DirectMethodHandle_klass());
sspitsyn@5061 985 }
stefank@7863 986 static bool is_instance(oop obj);
sspitsyn@5061 987
sspitsyn@5061 988 // Accessors for code generation:
sspitsyn@5061 989 static int member_offset_in_bytes() { return _member_offset; }
sspitsyn@5061 990 };
sspitsyn@5061 991
twisti@3534 992 // Interface to java.lang.invoke.LambdaForm objects
twisti@3534 993 // (These are a private interface for managing adapter code generation.)
never@2702 994
twisti@3534 995 class java_lang_invoke_LambdaForm: AllStatic {
jrose@710 996 friend class JavaClasses;
jrose@710 997
jrose@710 998 private:
twisti@3534 999 static int _vmentry_offset; // type is MemberName
twisti@3534 1000
jrose@710 1001 static void compute_offsets();
jrose@710 1002
jrose@710 1003 public:
jrose@710 1004 // Accessors
twisti@3534 1005 static oop vmentry(oop lform);
twisti@3534 1006 static void set_vmentry(oop lform, oop invoker);
jrose@710 1007
jrose@710 1008 // Testers
coleenp@3602 1009 static bool is_subclass(Klass* klass) {
twisti@3534 1010 return SystemDictionary::LambdaForm_klass() != NULL &&
hseigel@3843 1011 klass->is_subclass_of(SystemDictionary::LambdaForm_klass());
jrose@710 1012 }
stefank@7863 1013 static bool is_instance(oop obj);
jrose@710 1014
jrose@710 1015 // Accessors for code generation:
twisti@3534 1016 static int vmentry_offset_in_bytes() { return _vmentry_offset; }
jrose@710 1017 };
jrose@710 1018
never@2670 1019
jrose@2204 1020 // Interface to java.lang.invoke.MemberName objects
jrose@710 1021 // (These are a private interface for Java code to query the class hierarchy.)
jrose@710 1022
twisti@3534 1023 #define MEMBERNAME_INJECTED_FIELDS(macro) \
coleenp@3602 1024 macro(java_lang_invoke_MemberName, vmloader, object_signature, false) \
twisti@3534 1025 macro(java_lang_invoke_MemberName, vmindex, intptr_signature, false) \
coleenp@3602 1026 macro(java_lang_invoke_MemberName, vmtarget, intptr_signature, false)
never@2702 1027
jrose@2204 1028 class java_lang_invoke_MemberName: AllStatic {
jrose@710 1029 friend class JavaClasses;
jrose@710 1030
jrose@710 1031 private:
jrose@2204 1032 // From java.lang.invoke.MemberName:
jrose@710 1033 // private Class<?> clazz; // class in which the method is defined
jrose@710 1034 // private String name; // may be null if not yet materialized
jrose@710 1035 // private Object type; // may be null if not yet materialized
jrose@710 1036 // private int flags; // modifier bits; see reflect.Modifier
coleenp@3602 1037 // private intptr vmtarget; // VM-specific target value
twisti@3534 1038 // private intptr_t vmindex; // member index within class or interface
jrose@710 1039 static int _clazz_offset;
jrose@710 1040 static int _name_offset;
jrose@710 1041 static int _type_offset;
jrose@710 1042 static int _flags_offset;
jrose@710 1043 static int _vmtarget_offset;
coleenp@3602 1044 static int _vmloader_offset;
jrose@710 1045 static int _vmindex_offset;
jrose@710 1046
jrose@710 1047 static void compute_offsets();
jrose@710 1048
jrose@710 1049 public:
jrose@710 1050 // Accessors
jrose@710 1051 static oop clazz(oop mname);
jrose@710 1052 static void set_clazz(oop mname, oop clazz);
jrose@710 1053
jrose@710 1054 static oop type(oop mname);
jrose@710 1055 static void set_type(oop mname, oop type);
jrose@710 1056
jrose@710 1057 static oop name(oop mname);
jrose@710 1058 static void set_name(oop mname, oop name);
jrose@710 1059
jrose@710 1060 static int flags(oop mname);
jrose@710 1061 static void set_flags(oop mname, int flags);
jrose@710 1062
coleenp@3602 1063 static Metadata* vmtarget(oop mname);
coleenp@3602 1064 static void set_vmtarget(oop mname, Metadata* target);
jrose@710 1065
twisti@3534 1066 static intptr_t vmindex(oop mname);
twisti@3534 1067 static void set_vmindex(oop mname, intptr_t index);
jrose@710 1068
jrose@710 1069 // Testers
coleenp@3602 1070 static bool is_subclass(Klass* klass) {
hseigel@3843 1071 return klass->is_subclass_of(SystemDictionary::MemberName_klass());
jrose@710 1072 }
stefank@7863 1073 static bool is_instance(oop obj);
jrose@710 1074
coleenp@7413 1075 static bool is_method(oop obj);
coleenp@7413 1076
jrose@710 1077 // Relevant integer codes (keep these in synch. with MethodHandleNatives.Constants):
jrose@710 1078 enum {
twisti@4431 1079 MN_IS_METHOD = 0x00010000, // method (not constructor)
twisti@4431 1080 MN_IS_CONSTRUCTOR = 0x00020000, // constructor
twisti@4431 1081 MN_IS_FIELD = 0x00040000, // field
twisti@4431 1082 MN_IS_TYPE = 0x00080000, // nested type
twisti@4431 1083 MN_CALLER_SENSITIVE = 0x00100000, // @CallerSensitive annotation detected
twisti@3534 1084 MN_REFERENCE_KIND_SHIFT = 24, // refKind
twisti@4431 1085 MN_REFERENCE_KIND_MASK = 0x0F000000 >> MN_REFERENCE_KIND_SHIFT,
twisti@3534 1086 // The SEARCH_* bits are not for MN.flags but for the matchFlags argument of MHN.getMembers:
twisti@4431 1087 MN_SEARCH_SUPERCLASSES = 0x00100000, // walk super classes
twisti@4431 1088 MN_SEARCH_INTERFACES = 0x00200000 // walk implemented interfaces
jrose@710 1089 };
jrose@710 1090
jrose@710 1091 // Accessors for code generation:
jrose@710 1092 static int clazz_offset_in_bytes() { return _clazz_offset; }
jrose@710 1093 static int type_offset_in_bytes() { return _type_offset; }
jrose@710 1094 static int name_offset_in_bytes() { return _name_offset; }
jrose@710 1095 static int flags_offset_in_bytes() { return _flags_offset; }
jrose@710 1096 static int vmtarget_offset_in_bytes() { return _vmtarget_offset; }
jrose@710 1097 static int vmindex_offset_in_bytes() { return _vmindex_offset; }
jrose@710 1098 };
jrose@710 1099
jrose@710 1100
jrose@2204 1101 // Interface to java.lang.invoke.MethodType objects
jrose@710 1102
jrose@2204 1103 class java_lang_invoke_MethodType: AllStatic {
jrose@710 1104 friend class JavaClasses;
jrose@710 1105
jrose@710 1106 private:
jrose@710 1107 static int _rtype_offset;
jrose@710 1108 static int _ptypes_offset;
jrose@710 1109
jrose@710 1110 static void compute_offsets();
jrose@710 1111
jrose@710 1112 public:
jrose@710 1113 // Accessors
jrose@710 1114 static oop rtype(oop mt);
jrose@710 1115 static objArrayOop ptypes(oop mt);
jrose@710 1116
jrose@710 1117 static oop ptype(oop mt, int index);
twisti@1133 1118 static int ptype_count(oop mt);
jrose@710 1119
twisti@3534 1120 static int ptype_slot_count(oop mt); // extra counts for long/double
twisti@3534 1121 static int rtype_slot_count(oop mt); // extra counts for long/double
twisti@3534 1122
coleenp@2062 1123 static Symbol* as_signature(oop mt, bool intern_if_not_found, TRAPS);
jrose@710 1124 static void print_signature(oop mt, outputStream* st);
jrose@710 1125
stefank@7863 1126 static bool is_instance(oop obj);
jrose@710 1127
jrose@2547 1128 static bool equals(oop mt1, oop mt2);
jrose@2547 1129
jrose@710 1130 // Accessors for code generation:
jrose@710 1131 static int rtype_offset_in_bytes() { return _rtype_offset; }
jrose@710 1132 static int ptypes_offset_in_bytes() { return _ptypes_offset; }
jrose@710 1133 };
jrose@710 1134
jrose@710 1135
jrose@2204 1136 // Interface to java.lang.invoke.CallSite objects
jrose@726 1137
jrose@2204 1138 class java_lang_invoke_CallSite: AllStatic {
jrose@726 1139 friend class JavaClasses;
jrose@726 1140
jrose@726 1141 private:
jrose@726 1142 static int _target_offset;
vlivanov@8280 1143 static int _context_offset;
jrose@726 1144
jrose@726 1145 static void compute_offsets();
jrose@726 1146
jrose@726 1147 public:
jrose@726 1148 // Accessors
vlivanov@8280 1149 static oop target( oop site);
vlivanov@8280 1150 static void set_target( oop site, oop target);
vlivanov@8280 1151 static void set_target_volatile( oop site, oop target);
vlivanov@8280 1152
vlivanov@8483 1153 static oop context(oop site);
jrose@1427 1154
twisti@1135 1155 // Testers
coleenp@3602 1156 static bool is_subclass(Klass* klass) {
hseigel@3843 1157 return klass->is_subclass_of(SystemDictionary::CallSite_klass());
twisti@1135 1158 }
stefank@7863 1159 static bool is_instance(oop obj);
twisti@1135 1160
jrose@726 1161 // Accessors for code generation:
jrose@726 1162 static int target_offset_in_bytes() { return _target_offset; }
jrose@726 1163 };
jrose@710 1164
vlivanov@8483 1165 // Interface to java.lang.invoke.MethodHandleNatives$CallSiteContext objects
vlivanov@8483 1166
vlivanov@8483 1167 #define CALLSITECONTEXT_INJECTED_FIELDS(macro) \
vlivanov@8483 1168 macro(java_lang_invoke_MethodHandleNatives_CallSiteContext, vmdependencies, intptr_signature, false)
vlivanov@8483 1169
vlivanov@9457 1170 class DependencyContext;
vlivanov@9457 1171
vlivanov@8483 1172 class java_lang_invoke_MethodHandleNatives_CallSiteContext : AllStatic {
vlivanov@8483 1173 friend class JavaClasses;
vlivanov@8483 1174
vlivanov@8483 1175 private:
vlivanov@8483 1176 static int _vmdependencies_offset;
vlivanov@8483 1177
vlivanov@8483 1178 static void compute_offsets();
vlivanov@8483 1179
vlivanov@8483 1180 public:
vlivanov@8483 1181 // Accessors
vlivanov@9457 1182 static DependencyContext vmdependencies(oop context);
vlivanov@8483 1183
vlivanov@8483 1184 // Testers
vlivanov@8483 1185 static bool is_subclass(Klass* klass) {
vlivanov@8483 1186 return klass->is_subclass_of(SystemDictionary::Context_klass());
vlivanov@8483 1187 }
vlivanov@8483 1188 static bool is_instance(oop obj);
vlivanov@8483 1189 };
vlivanov@8483 1190
duke@0 1191 // Interface to java.security.AccessControlContext objects
duke@0 1192
duke@0 1193 class java_security_AccessControlContext: AllStatic {
duke@0 1194 private:
duke@0 1195 // Note that for this class the layout changed between JDK1.2 and JDK1.3,
duke@0 1196 // so we compute the offsets at startup rather than hard-wiring them.
duke@0 1197 static int _context_offset;
duke@0 1198 static int _privilegedContext_offset;
duke@0 1199 static int _isPrivileged_offset;
mullan@4807 1200 static int _isAuthorized_offset;
duke@0 1201
duke@0 1202 static void compute_offsets();
duke@0 1203 public:
duke@0 1204 static oop create(objArrayHandle context, bool isPrivileged, Handle privileged_context, TRAPS);
duke@0 1205
mullan@4807 1206 static bool is_authorized(Handle context);
mullan@4807 1207
duke@0 1208 // Debugging/initialization
duke@0 1209 friend class JavaClasses;
duke@0 1210 };
duke@0 1211
duke@0 1212
duke@0 1213 // Interface to java.lang.ClassLoader objects
duke@0 1214
coleenp@3602 1215 #define CLASSLOADER_INJECTED_FIELDS(macro) \
coleenp@3869 1216 macro(java_lang_ClassLoader, loader_data, intptr_signature, false)
coleenp@3602 1217
duke@0 1218 class java_lang_ClassLoader : AllStatic {
duke@0 1219 private:
coleenp@3602 1220 // The fake offsets are added by the class loader when java.lang.Class is loaded
duke@0 1221 enum {
duke@0 1222 hc_parent_offset = 0
duke@0 1223 };
coleenp@3602 1224 static int _loader_data_offset;
never@2702 1225 static bool offsets_computed;
duke@0 1226 static int parent_offset;
never@2702 1227 static int parallelCapable_offset;
mchung@12297 1228 static int name_offset;
alanb@10487 1229 static int unnamedModule_offset;
never@2702 1230
coleenp@3602 1231 public:
never@2702 1232 static void compute_offsets();
duke@0 1233
coleenp@3602 1234 static ClassLoaderData** loader_data_addr(oop loader);
coleenp@3602 1235 static ClassLoaderData* loader_data(oop loader);
coleenp@3602 1236
duke@0 1237 static oop parent(oop loader);
mchung@12297 1238 static oop name(oop loader);
twisti@3534 1239 static bool isAncestor(oop loader, oop cl);
duke@0 1240
never@2702 1241 // Support for parallelCapable field
never@2702 1242 static bool parallelCapable(oop the_class_mirror);
never@2702 1243
duke@0 1244 static bool is_trusted_loader(oop loader);
duke@0 1245
duke@0 1246 // Fix for 4474172
duke@0 1247 static oop non_reflection_class_loader(oop loader);
duke@0 1248
twisti@3534 1249 // Testers
coleenp@3602 1250 static bool is_subclass(Klass* klass) {
hseigel@3843 1251 return klass->is_subclass_of(SystemDictionary::ClassLoader_klass());
twisti@3534 1252 }
stefank@7863 1253 static bool is_instance(oop obj);
twisti@3534 1254
alanb@10487 1255 static oop unnamedModule(oop loader);
alanb@10487 1256
duke@0 1257 // Debugging
duke@0 1258 friend class JavaClasses;
coleenp@3602 1259 friend class ClassFileParser; // access to number_of_fake_fields
duke@0 1260 };
duke@0 1261
duke@0 1262
duke@0 1263 // Interface to java.lang.System objects
duke@0 1264
duke@0 1265 class java_lang_System : AllStatic {
duke@0 1266 private:
duke@0 1267 enum {
duke@0 1268 hc_static_in_offset = 0,
duke@0 1269 hc_static_out_offset = 1,
mullan@4807 1270 hc_static_err_offset = 2,
mullan@4807 1271 hc_static_security_offset = 3
duke@0 1272 };
duke@0 1273
duke@0 1274 static int static_in_offset;
duke@0 1275 static int static_out_offset;
duke@0 1276 static int static_err_offset;
mullan@4807 1277 static int static_security_offset;
duke@0 1278
duke@0 1279 public:
duke@0 1280 static int in_offset_in_bytes();
duke@0 1281 static int out_offset_in_bytes();
duke@0 1282 static int err_offset_in_bytes();
duke@0 1283
mullan@4807 1284 static bool has_security_manager();
mullan@4807 1285
duke@0 1286 // Debugging
duke@0 1287 friend class JavaClasses;
duke@0 1288 };
duke@0 1289
duke@0 1290
duke@0 1291 // Interface to java.lang.StackTraceElement objects
duke@0 1292
duke@0 1293 class java_lang_StackTraceElement: AllStatic {
duke@0 1294 private:
duke@0 1295 enum {
mchung@12297 1296 hc_classOrLoaderModuleClassName_offset = 0,
mchung@12297 1297 hc_classLoaderName_offset = 1,
mchung@12297 1298 hc_moduleName_offset = 2,
mchung@12297 1299 hc_moduleVersion_offset = 3,
mchung@12297 1300 hc_declaringClass_offset = 4,
mchung@12297 1301 hc_methodName_offset = 5,
mchung@12297 1302 hc_fileName_offset = 6,
mchung@12297 1303 hc_lineNumber_offset = 7
duke@0 1304 };
duke@0 1305
mchung@12297 1306 static int classOrLoaderModuleClassName_offset;
mchung@12297 1307 static int classLoaderName_offset;
alanb@10487 1308 static int moduleName_offset;
alanb@10487 1309 static int moduleVersion_offset;
duke@0 1310 static int declaringClass_offset;
duke@0 1311 static int methodName_offset;
duke@0 1312 static int fileName_offset;
duke@0 1313 static int lineNumber_offset;
duke@0 1314
duke@0 1315 // Setters
mchung@12297 1316 static void set_classLoaderName(oop element, oop value);
alanb@10487 1317 static void set_moduleName(oop element, oop value);
alanb@10487 1318 static void set_moduleVersion(oop element, oop value);
duke@0 1319 static void set_declaringClass(oop element, oop value);
duke@0 1320 static void set_methodName(oop element, oop value);
duke@0 1321 static void set_fileName(oop element, oop value);
duke@0 1322 static void set_lineNumber(oop element, int value);
mchung@12297 1323 static void set_declaringClassObject(oop element, oop value);
duke@0 1324
coleenp@10577 1325 public:
duke@0 1326 // Create an instance of StackTraceElement
coleenp@9247 1327 static oop create(const methodHandle& method, int bci, TRAPS);
duke@0 1328
coleenp@10577 1329 static void fill_in(Handle element, InstanceKlass* holder, const methodHandle& method,
coleenp@10577 1330 int version, int bci, int cpref, TRAPS);
coleenp@10577 1331
duke@0 1332 // Debugging
duke@0 1333 friend class JavaClasses;
duke@0 1334 };
duke@0 1335
duke@0 1336
mchung@9542 1337 class Backtrace: AllStatic {
mchung@9542 1338 public:
mchung@9542 1339 // Helper backtrace functions to store bci|version together.
mchung@9542 1340 static int merge_bci_and_version(int bci, int version);
mchung@9542 1341 static int merge_mid_and_cpref(int mid, int cpref);
mchung@9542 1342 static int bci_at(unsigned int merged);
mchung@9542 1343 static int version_at(unsigned int merged);
mchung@9542 1344 static int mid_at(unsigned int merged);
mchung@9542 1345 static int cpref_at(unsigned int merged);
mchung@9542 1346 static int get_line_number(const methodHandle& method, int bci);
mchung@9542 1347 static Symbol* get_source_file_name(InstanceKlass* holder, int version);
mchung@9542 1348
mchung@9542 1349 // Debugging
mchung@9542 1350 friend class JavaClasses;
mchung@9542 1351 };
mchung@9542 1352
mchung@9542 1353 // Interface to java.lang.StackFrameInfo objects
mchung@9542 1354
mchung@9542 1355 #define STACKFRAMEINFO_INJECTED_FIELDS(macro) \
bchristi@10842 1356 macro(java_lang_StackFrameInfo, version, short_signature, false)
mchung@9542 1357
mchung@9542 1358 class java_lang_StackFrameInfo: AllStatic {
mchung@9542 1359 private:
mchung@9542 1360 static int _declaringClass_offset;
mchung@9542 1361 static int _memberName_offset;
mchung@9542 1362 static int _bci_offset;
mchung@9542 1363 static int _version_offset;
mchung@9542 1364
mchung@9542 1365 static Method* get_method(Handle stackFrame, InstanceKlass* holder, TRAPS);
mchung@9542 1366
mchung@9542 1367 public:
mchung@9542 1368 // Setters
mchung@9542 1369 static void set_declaringClass(oop info, oop value);
mchung@9542 1370 static void set_method_and_bci(Handle stackFrame, const methodHandle& method, int bci);
mchung@9542 1371 static void set_bci(oop info, int value);
mchung@9542 1372
mchung@9542 1373 static void set_version(oop info, short value);
mchung@9542 1374
mchung@9542 1375 static void compute_offsets();
mchung@9542 1376
bchristi@10842 1377 static void to_stack_trace_element(Handle stackFrame, Handle stack_trace_element, TRAPS);
bchristi@10842 1378
mchung@9542 1379 // Debugging
mchung@9542 1380 friend class JavaClasses;
mchung@9542 1381 };
mchung@9542 1382
mchung@9542 1383 class java_lang_LiveStackFrameInfo: AllStatic {
mchung@9542 1384 private:
mchung@9542 1385 static int _monitors_offset;
mchung@9542 1386 static int _locals_offset;
mchung@9542 1387 static int _operands_offset;
mchung@9542 1388
mchung@9542 1389 public:
mchung@9542 1390 static void set_monitors(oop info, oop value);
mchung@9542 1391 static void set_locals(oop info, oop value);
mchung@9542 1392 static void set_operands(oop info, oop value);
mchung@9542 1393
mchung@9542 1394 static void compute_offsets();
mchung@9542 1395
mchung@9542 1396 // Debugging
mchung@9542 1397 friend class JavaClasses;
mchung@9542 1398 };
mchung@9542 1399
duke@0 1400 // Interface to java.lang.AssertionStatusDirectives objects
duke@0 1401
duke@0 1402 class java_lang_AssertionStatusDirectives: AllStatic {
duke@0 1403 private:
duke@0 1404 enum {
duke@0 1405 hc_classes_offset,
duke@0 1406 hc_classEnabled_offset,
duke@0 1407 hc_packages_offset,
duke@0 1408 hc_packageEnabled_offset,
duke@0 1409 hc_deflt_offset
duke@0 1410 };
duke@0 1411
duke@0 1412 static int classes_offset;
duke@0 1413 static int classEnabled_offset;
duke@0 1414 static int packages_offset;
duke@0 1415 static int packageEnabled_offset;
duke@0 1416 static int deflt_offset;
duke@0 1417
duke@0 1418 public:
duke@0 1419 // Setters
duke@0 1420 static void set_classes(oop obj, oop val);
duke@0 1421 static void set_classEnabled(oop obj, oop val);
duke@0 1422 static void set_packages(oop obj, oop val);
duke@0 1423 static void set_packageEnabled(oop obj, oop val);
duke@0 1424 static void set_deflt(oop obj, bool val);
duke@0 1425 // Debugging
duke@0 1426 friend class JavaClasses;
duke@0 1427 };
duke@0 1428
duke@0 1429
duke@0 1430 class java_nio_Buffer: AllStatic {
duke@0 1431 private:
duke@0 1432 static int _limit_offset;
duke@0 1433
duke@0 1434 public:
duke@0 1435 static int limit_offset();
duke@0 1436 static void compute_offsets();
duke@0 1437 };
duke@0 1438
duke@0 1439 class java_util_concurrent_locks_AbstractOwnableSynchronizer : AllStatic {
duke@0 1440 private:
duke@0 1441 static int _owner_offset;
duke@0 1442 public:
duke@0 1443 static void initialize(TRAPS);
duke@0 1444 static oop get_owner_threadObj(oop obj);
duke@0 1445 };
duke@0 1446
never@2702 1447 // Use to declare fields that need to be injected into Java classes
never@2702 1448 // for the JVM to use. The name_index and signature_index are
never@2702 1449 // declared in vmSymbols. The may_be_java flag is used to declare
never@2702 1450 // fields that might already exist in Java but should be injected if
never@2702 1451 // they don't. Otherwise the field is unconditionally injected and
never@2702 1452 // the JVM uses the injected one. This is to ensure that name
never@2702 1453 // collisions don't occur. In general may_be_java should be false
never@2702 1454 // unless there's a good reason.
never@2702 1455
never@2702 1456 class InjectedField {
never@2702 1457 public:
never@2702 1458 const SystemDictionary::WKID klass_id;
never@2702 1459 const vmSymbols::SID name_index;
never@2702 1460 const vmSymbols::SID signature_index;
never@2702 1461 const bool may_be_java;
never@2702 1462
never@2702 1463
coleenp@3602 1464 Klass* klass() const { return SystemDictionary::well_known_klass(klass_id); }
never@2702 1465 Symbol* name() const { return lookup_symbol(name_index); }
never@2702 1466 Symbol* signature() const { return lookup_symbol(signature_index); }
never@2702 1467
never@2702 1468 int compute_offset();
never@2702 1469
never@2702 1470 // Find the Symbol for this index
never@2702 1471 static Symbol* lookup_symbol(int symbol_index) {
never@2702 1472 return vmSymbols::symbol_at((vmSymbols::SID)symbol_index);
never@2702 1473 }
never@2702 1474 };
never@2702 1475
never@2702 1476 #define DECLARE_INJECTED_FIELD_ENUM(klass, name, signature, may_be_java) \
never@2702 1477 klass##_##name##_enum,
never@2702 1478
never@2702 1479 #define ALL_INJECTED_FIELDS(macro) \
never@2702 1480 CLASS_INJECTED_FIELDS(macro) \
coleenp@3602 1481 CLASSLOADER_INJECTED_FIELDS(macro) \
vlivanov@8483 1482 MEMBERNAME_INJECTED_FIELDS(macro) \
mchung@9542 1483 CALLSITECONTEXT_INJECTED_FIELDS(macro) \
alanb@10487 1484 STACKFRAMEINFO_INJECTED_FIELDS(macro) \
alanb@10487 1485 MODULE_INJECTED_FIELDS(macro)
never@2702 1486
duke@0 1487 // Interface to hard-coded offset checking
duke@0 1488
duke@0 1489 class JavaClasses : AllStatic {
duke@0 1490 private:
never@2702 1491
never@2702 1492 static InjectedField _injected_fields[];
never@2702 1493
duke@0 1494 static bool check_offset(const char *klass_name, int offset, const char *field_name, const char* field_sig) PRODUCT_RETURN0;
duke@0 1495 static bool check_static_offset(const char *klass_name, int hardcoded_offset, const char *field_name, const char* field_sig) PRODUCT_RETURN0;
jrose@132 1496 static bool check_constant(const char *klass_name, int constant, const char *field_name, const char* field_sig) PRODUCT_RETURN0;
never@2702 1497
duke@0 1498 public:
never@2702 1499 enum InjectedFieldID {
never@2702 1500 ALL_INJECTED_FIELDS(DECLARE_INJECTED_FIELD_ENUM)
never@2702 1501 MAX_enum
never@2702 1502 };
never@2702 1503
never@2702 1504 static int compute_injected_offset(InjectedFieldID id);
never@2702 1505
duke@0 1506 static void compute_hard_coded_offsets();
duke@0 1507 static void compute_offsets();
duke@0 1508 static void check_offsets() PRODUCT_RETURN;
never@2702 1509
never@2702 1510 static InjectedField* get_injected(Symbol* class_name, int* field_count);
duke@0 1511 };
stefank@1879 1512
never@2702 1513 #undef DECLARE_INJECTED_FIELD_ENUM
never@2702 1514
stefank@1879 1515 #endif // SHARE_VM_CLASSFILE_JAVACLASSES_HPP