src/share/vm/classfile/javaClasses.hpp

Thu, 12 Oct 2017 21:27:07 +0800

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

mercurial