src/share/vm/classfile/javaClasses.hpp

Tue, 08 Aug 2017 15:57:29 +0800

author
aoqi
date
Tue, 08 Aug 2017 15:57:29 +0800
changeset 6876
710a3c8b516e
parent 6626
9428a0b94204
parent 0
f90c822e73f8
child 7535
7ae4e26cb1e0
permissions
-rw-r--r--

merge

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

mercurial