src/share/vm/classfile/javaClasses.hpp

Thu, 24 May 2018 18:41:44 +0800

author
aoqi
date
Thu, 24 May 2018 18:41:44 +0800
changeset 8856
ac27a9c85bea
parent 8721
575f637864df
parent 8604
04d83ba48607
child 9122
024be04bb151
permissions
-rw-r--r--

Merge

aoqi@0 1 /*
kevinw@8721 2 * Copyright (c) 1997, 2017, 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);
vkempik@8060 273 static const char* as_external_name(oop java_class);
aoqi@0 274 // Testing
aoqi@0 275 static bool is_instance(oop obj) {
aoqi@0 276 return obj != NULL && obj->klass() == SystemDictionary::Class_klass();
aoqi@0 277 }
aoqi@0 278 static bool is_primitive(oop java_class);
aoqi@0 279 static BasicType primitive_type(oop java_class);
aoqi@0 280 static oop primitive_mirror(BasicType t);
aoqi@0 281 // JVM_NewArray support
aoqi@0 282 static Klass* array_klass(oop java_class);
aoqi@0 283 static void set_array_klass(oop java_class, Klass* klass);
aoqi@0 284 // compiler support for class operations
aoqi@0 285 static int klass_offset_in_bytes() { return _klass_offset; }
aoqi@0 286 static int array_klass_offset_in_bytes() { return _array_klass_offset; }
aoqi@0 287 // Support for classRedefinedCount field
aoqi@0 288 static int classRedefinedCount(oop the_class_mirror);
aoqi@0 289 static void set_classRedefinedCount(oop the_class_mirror, int value);
aoqi@0 290
aoqi@0 291 // Support for embedded per-class oops
aoqi@0 292 static oop protection_domain(oop java_class);
aoqi@0 293 static oop init_lock(oop java_class);
aoqi@0 294 static objArrayOop signers(oop java_class);
aoqi@0 295 static void set_signers(oop java_class, objArrayOop signers);
aoqi@0 296
coleenp@7129 297 static oop class_loader(oop java_class);
coleenp@7129 298
aoqi@0 299 static int oop_size(oop java_class);
aoqi@0 300 static void set_oop_size(oop java_class, int size);
aoqi@0 301 static int static_oop_field_count(oop java_class);
aoqi@0 302 static void set_static_oop_field_count(oop java_class, int size);
aoqi@0 303
aoqi@0 304 static GrowableArray<Klass*>* fixup_mirror_list() {
aoqi@0 305 return _fixup_mirror_list;
aoqi@0 306 }
aoqi@0 307 static void set_fixup_mirror_list(GrowableArray<Klass*>* v) {
aoqi@0 308 _fixup_mirror_list = v;
aoqi@0 309 }
aoqi@0 310 // Debugging
aoqi@0 311 friend class JavaClasses;
aoqi@0 312 friend class InstanceKlass; // verification code accesses offsets
aoqi@0 313 friend class ClassFileParser; // access to number_of_fake_fields
aoqi@0 314 };
aoqi@0 315
aoqi@0 316 // Interface to java.lang.Thread objects
aoqi@0 317
aoqi@0 318 class java_lang_Thread : AllStatic {
aoqi@0 319 private:
aoqi@0 320 // Note that for this class the layout changed between JDK1.2 and JDK1.3,
aoqi@0 321 // so we compute the offsets at startup rather than hard-wiring them.
aoqi@0 322 static int _name_offset;
aoqi@0 323 static int _group_offset;
aoqi@0 324 static int _contextClassLoader_offset;
aoqi@0 325 static int _inheritedAccessControlContext_offset;
aoqi@0 326 static int _priority_offset;
aoqi@0 327 static int _eetop_offset;
aoqi@0 328 static int _daemon_offset;
aoqi@0 329 static int _stillborn_offset;
aoqi@0 330 static int _stackSize_offset;
aoqi@0 331 static int _tid_offset;
aoqi@0 332 static int _thread_status_offset;
aoqi@0 333 static int _park_blocker_offset;
aoqi@0 334 static int _park_event_offset ;
aoqi@0 335
aoqi@0 336 static void compute_offsets();
aoqi@0 337
aoqi@0 338 public:
aoqi@0 339 // Instance creation
aoqi@0 340 static oop create();
aoqi@0 341 // Returns the JavaThread associated with the thread obj
aoqi@0 342 static JavaThread* thread(oop java_thread);
aoqi@0 343 // Set JavaThread for instance
aoqi@0 344 static void set_thread(oop java_thread, JavaThread* thread);
aoqi@0 345 // Name
shade@8288 346 static oop name(oop java_thread);
shade@8288 347 static void set_name(oop java_thread, oop name);
aoqi@0 348 // Priority
aoqi@0 349 static ThreadPriority priority(oop java_thread);
aoqi@0 350 static void set_priority(oop java_thread, ThreadPriority priority);
aoqi@0 351 // Thread group
aoqi@0 352 static oop threadGroup(oop java_thread);
aoqi@0 353 // Stillborn
aoqi@0 354 static bool is_stillborn(oop java_thread);
aoqi@0 355 static void set_stillborn(oop java_thread);
aoqi@0 356 // Alive (NOTE: this is not really a field, but provides the correct
aoqi@0 357 // definition without doing a Java call)
aoqi@0 358 static bool is_alive(oop java_thread);
aoqi@0 359 // Daemon
aoqi@0 360 static bool is_daemon(oop java_thread);
aoqi@0 361 static void set_daemon(oop java_thread);
aoqi@0 362 // Context ClassLoader
aoqi@0 363 static oop context_class_loader(oop java_thread);
aoqi@0 364 // Control context
aoqi@0 365 static oop inherited_access_control_context(oop java_thread);
aoqi@0 366 // Stack size hint
aoqi@0 367 static jlong stackSize(oop java_thread);
aoqi@0 368 // Thread ID
aoqi@0 369 static jlong thread_id(oop java_thread);
aoqi@0 370
aoqi@0 371 // Blocker object responsible for thread parking
aoqi@0 372 static oop park_blocker(oop java_thread);
aoqi@0 373
aoqi@0 374 // Pointer to type-stable park handler, encoded as jlong.
aoqi@0 375 // Should be set when apparently null
aoqi@0 376 // For details, see unsafe.cpp Unsafe_Unpark
aoqi@0 377 static jlong park_event(oop java_thread);
aoqi@0 378 static bool set_park_event(oop java_thread, jlong ptr);
aoqi@0 379
aoqi@0 380 // Java Thread Status for JVMTI and M&M use.
aoqi@0 381 // This thread status info is saved in threadStatus field of
aoqi@0 382 // java.lang.Thread java class.
aoqi@0 383 enum ThreadStatus {
aoqi@0 384 NEW = 0,
aoqi@0 385 RUNNABLE = JVMTI_THREAD_STATE_ALIVE + // runnable / running
aoqi@0 386 JVMTI_THREAD_STATE_RUNNABLE,
aoqi@0 387 SLEEPING = JVMTI_THREAD_STATE_ALIVE + // Thread.sleep()
aoqi@0 388 JVMTI_THREAD_STATE_WAITING +
aoqi@0 389 JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT +
aoqi@0 390 JVMTI_THREAD_STATE_SLEEPING,
aoqi@0 391 IN_OBJECT_WAIT = JVMTI_THREAD_STATE_ALIVE + // Object.wait()
aoqi@0 392 JVMTI_THREAD_STATE_WAITING +
aoqi@0 393 JVMTI_THREAD_STATE_WAITING_INDEFINITELY +
aoqi@0 394 JVMTI_THREAD_STATE_IN_OBJECT_WAIT,
aoqi@0 395 IN_OBJECT_WAIT_TIMED = JVMTI_THREAD_STATE_ALIVE + // Object.wait(long)
aoqi@0 396 JVMTI_THREAD_STATE_WAITING +
aoqi@0 397 JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT +
aoqi@0 398 JVMTI_THREAD_STATE_IN_OBJECT_WAIT,
aoqi@0 399 PARKED = JVMTI_THREAD_STATE_ALIVE + // LockSupport.park()
aoqi@0 400 JVMTI_THREAD_STATE_WAITING +
aoqi@0 401 JVMTI_THREAD_STATE_WAITING_INDEFINITELY +
aoqi@0 402 JVMTI_THREAD_STATE_PARKED,
aoqi@0 403 PARKED_TIMED = JVMTI_THREAD_STATE_ALIVE + // LockSupport.park(long)
aoqi@0 404 JVMTI_THREAD_STATE_WAITING +
aoqi@0 405 JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT +
aoqi@0 406 JVMTI_THREAD_STATE_PARKED,
aoqi@0 407 BLOCKED_ON_MONITOR_ENTER = JVMTI_THREAD_STATE_ALIVE + // (re-)entering a synchronization block
aoqi@0 408 JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER,
aoqi@0 409 TERMINATED = JVMTI_THREAD_STATE_TERMINATED
aoqi@0 410 };
aoqi@0 411 // Write thread status info to threadStatus field of java.lang.Thread.
aoqi@0 412 static void set_thread_status(oop java_thread_oop, ThreadStatus status);
aoqi@0 413 // Read thread status info from threadStatus field of java.lang.Thread.
aoqi@0 414 static ThreadStatus get_thread_status(oop java_thread_oop);
aoqi@0 415
aoqi@0 416 static const char* thread_status_name(oop java_thread_oop);
aoqi@0 417
aoqi@0 418 // Debugging
aoqi@0 419 friend class JavaClasses;
aoqi@0 420 };
aoqi@0 421
aoqi@0 422 // Interface to java.lang.ThreadGroup objects
aoqi@0 423
aoqi@0 424 class java_lang_ThreadGroup : AllStatic {
aoqi@0 425 private:
aoqi@0 426 static int _parent_offset;
aoqi@0 427 static int _name_offset;
aoqi@0 428 static int _threads_offset;
aoqi@0 429 static int _groups_offset;
aoqi@0 430 static int _maxPriority_offset;
aoqi@0 431 static int _destroyed_offset;
aoqi@0 432 static int _daemon_offset;
aoqi@0 433 static int _vmAllowSuspension_offset;
aoqi@0 434 static int _nthreads_offset;
aoqi@0 435 static int _ngroups_offset;
aoqi@0 436
aoqi@0 437 static void compute_offsets();
aoqi@0 438
aoqi@0 439 public:
aoqi@0 440 // parent ThreadGroup
aoqi@0 441 static oop parent(oop java_thread_group);
aoqi@0 442 // name
aoqi@0 443 static typeArrayOop name(oop java_thread_group);
aoqi@0 444 // ("name as oop" accessor is not necessary)
aoqi@0 445 // Number of threads in group
aoqi@0 446 static int nthreads(oop java_thread_group);
aoqi@0 447 // threads
aoqi@0 448 static objArrayOop threads(oop java_thread_group);
aoqi@0 449 // Number of threads in group
aoqi@0 450 static int ngroups(oop java_thread_group);
aoqi@0 451 // groups
aoqi@0 452 static objArrayOop groups(oop java_thread_group);
aoqi@0 453 // maxPriority in group
aoqi@0 454 static ThreadPriority maxPriority(oop java_thread_group);
aoqi@0 455 // Destroyed
aoqi@0 456 static bool is_destroyed(oop java_thread_group);
aoqi@0 457 // Daemon
aoqi@0 458 static bool is_daemon(oop java_thread_group);
aoqi@0 459 // vmAllowSuspension
aoqi@0 460 static bool is_vmAllowSuspension(oop java_thread_group);
aoqi@0 461 // Debugging
aoqi@0 462 friend class JavaClasses;
aoqi@0 463 };
aoqi@0 464
aoqi@0 465
aoqi@0 466
aoqi@0 467 // Interface to java.lang.Throwable objects
aoqi@0 468
aoqi@0 469 class java_lang_Throwable: AllStatic {
aoqi@0 470 friend class BacktraceBuilder;
aoqi@0 471
aoqi@0 472 private:
aoqi@0 473 // Offsets
aoqi@0 474 enum {
aoqi@0 475 hc_backtrace_offset = 0,
aoqi@0 476 hc_detailMessage_offset = 1,
aoqi@0 477 hc_cause_offset = 2, // New since 1.4
aoqi@0 478 hc_stackTrace_offset = 3 // New since 1.4
aoqi@0 479 };
aoqi@0 480 enum {
aoqi@0 481 hc_static_unassigned_stacktrace_offset = 0 // New since 1.7
aoqi@0 482 };
aoqi@0 483 // Trace constants
aoqi@0 484 enum {
aoqi@0 485 trace_methods_offset = 0,
aoqi@0 486 trace_bcis_offset = 1,
aoqi@0 487 trace_mirrors_offset = 2,
sspitsyn@7683 488 trace_cprefs_offset = 3,
sspitsyn@7683 489 trace_next_offset = 4,
sspitsyn@7683 490 trace_size = 5,
aoqi@0 491 trace_chunk_size = 32
aoqi@0 492 };
aoqi@0 493
aoqi@0 494 static int backtrace_offset;
aoqi@0 495 static int detailMessage_offset;
aoqi@0 496 static int cause_offset;
aoqi@0 497 static int stackTrace_offset;
aoqi@0 498 static int static_unassigned_stacktrace_offset;
aoqi@0 499
aoqi@0 500 // Printing
sspitsyn@7683 501 static char* print_stack_element_to_buffer(Handle mirror, int method, int version, int bci, int cpref);
aoqi@0 502 // StackTrace (programmatic access, new since 1.4)
aoqi@0 503 static void clear_stacktrace(oop throwable);
aoqi@0 504 // No stack trace available
aoqi@0 505 static const char* no_stack_trace_message();
aoqi@0 506 // Stacktrace (post JDK 1.7.0 to allow immutability protocol to be followed)
aoqi@0 507 static void set_stacktrace(oop throwable, oop st_element_array);
aoqi@0 508 static oop unassigned_stacktrace();
aoqi@0 509
aoqi@0 510 public:
aoqi@0 511 // Backtrace
aoqi@0 512 static oop backtrace(oop throwable);
aoqi@0 513 static void set_backtrace(oop throwable, oop value);
aoqi@0 514 // Needed by JVMTI to filter out this internal field.
aoqi@0 515 static int get_backtrace_offset() { return backtrace_offset;}
aoqi@0 516 static int get_detailMessage_offset() { return detailMessage_offset;}
aoqi@0 517 // Message
aoqi@0 518 static oop message(oop throwable);
aoqi@0 519 static oop message(Handle throwable);
aoqi@0 520 static void set_message(oop throwable, oop value);
aoqi@0 521 static void print_stack_element(outputStream *st, Handle mirror, int method,
sspitsyn@7683 522 int version, int bci, int cpref);
aoqi@0 523 static void print_stack_element(outputStream *st, methodHandle method, int bci);
aoqi@0 524 static void print_stack_usage(Handle stream);
aoqi@0 525
aoqi@0 526 // Allocate space for backtrace (created but stack trace not filled in)
aoqi@0 527 static void allocate_backtrace(Handle throwable, TRAPS);
aoqi@0 528 // Fill in current stack trace for throwable with preallocated backtrace (no GC)
aoqi@0 529 static void fill_in_stack_trace_of_preallocated_backtrace(Handle throwable);
aoqi@0 530 // Fill in current stack trace, can cause GC
aoqi@0 531 static void fill_in_stack_trace(Handle throwable, methodHandle method, TRAPS);
aoqi@0 532 static void fill_in_stack_trace(Handle throwable, methodHandle method = methodHandle());
aoqi@0 533 // Programmatic access to stack trace
aoqi@0 534 static oop get_stack_trace_element(oop throwable, int index, TRAPS);
aoqi@0 535 static int get_stack_trace_depth(oop throwable, TRAPS);
aoqi@0 536 // Printing
aoqi@0 537 static void print(oop throwable, outputStream* st);
aoqi@0 538 static void print(Handle throwable, outputStream* st);
aoqi@0 539 static void print_stack_trace(oop throwable, outputStream* st);
aoqi@0 540 // Debugging
aoqi@0 541 friend class JavaClasses;
aoqi@0 542 };
aoqi@0 543
aoqi@0 544
aoqi@0 545 // Interface to java.lang.reflect.AccessibleObject objects
aoqi@0 546
aoqi@0 547 class java_lang_reflect_AccessibleObject: AllStatic {
aoqi@0 548 private:
aoqi@0 549 // Note that to reduce dependencies on the JDK we compute these
aoqi@0 550 // offsets at run-time.
aoqi@0 551 static int override_offset;
aoqi@0 552
aoqi@0 553 static void compute_offsets();
aoqi@0 554
aoqi@0 555 public:
aoqi@0 556 // Accessors
aoqi@0 557 static jboolean override(oop reflect);
aoqi@0 558 static void set_override(oop reflect, jboolean value);
aoqi@0 559
aoqi@0 560 // Debugging
aoqi@0 561 friend class JavaClasses;
aoqi@0 562 };
aoqi@0 563
aoqi@0 564
aoqi@0 565 // Interface to java.lang.reflect.Method objects
aoqi@0 566
aoqi@0 567 class java_lang_reflect_Method : public java_lang_reflect_AccessibleObject {
aoqi@0 568 private:
aoqi@0 569 // Note that to reduce dependencies on the JDK we compute these
aoqi@0 570 // offsets at run-time.
aoqi@0 571 static int clazz_offset;
aoqi@0 572 static int name_offset;
aoqi@0 573 static int returnType_offset;
aoqi@0 574 static int parameterTypes_offset;
aoqi@0 575 static int exceptionTypes_offset;
aoqi@0 576 static int slot_offset;
aoqi@0 577 static int modifiers_offset;
aoqi@0 578 static int signature_offset;
aoqi@0 579 static int annotations_offset;
aoqi@0 580 static int parameter_annotations_offset;
aoqi@0 581 static int annotation_default_offset;
aoqi@0 582 static int type_annotations_offset;
aoqi@0 583
aoqi@0 584 static void compute_offsets();
aoqi@0 585
aoqi@0 586 public:
aoqi@0 587 // Allocation
aoqi@0 588 static Handle create(TRAPS);
aoqi@0 589
aoqi@0 590 // Accessors
aoqi@0 591 static oop clazz(oop reflect);
aoqi@0 592 static void set_clazz(oop reflect, oop value);
aoqi@0 593
aoqi@0 594 static oop name(oop method);
aoqi@0 595 static void set_name(oop method, oop value);
aoqi@0 596
aoqi@0 597 static oop return_type(oop method);
aoqi@0 598 static void set_return_type(oop method, oop value);
aoqi@0 599
aoqi@0 600 static oop parameter_types(oop method);
aoqi@0 601 static void set_parameter_types(oop method, oop value);
aoqi@0 602
aoqi@0 603 static oop exception_types(oop method);
aoqi@0 604 static void set_exception_types(oop method, oop value);
aoqi@0 605
aoqi@0 606 static int slot(oop reflect);
aoqi@0 607 static void set_slot(oop reflect, int value);
aoqi@0 608
aoqi@0 609 static int modifiers(oop method);
aoqi@0 610 static void set_modifiers(oop method, int value);
aoqi@0 611
aoqi@0 612 static bool has_signature_field();
aoqi@0 613 static oop signature(oop method);
aoqi@0 614 static void set_signature(oop method, oop value);
aoqi@0 615
aoqi@0 616 static bool has_annotations_field();
aoqi@0 617 static oop annotations(oop method);
aoqi@0 618 static void set_annotations(oop method, oop value);
aoqi@0 619
aoqi@0 620 static bool has_parameter_annotations_field();
aoqi@0 621 static oop parameter_annotations(oop method);
aoqi@0 622 static void set_parameter_annotations(oop method, oop value);
aoqi@0 623
aoqi@0 624 static bool has_annotation_default_field();
aoqi@0 625 static oop annotation_default(oop method);
aoqi@0 626 static void set_annotation_default(oop method, oop value);
aoqi@0 627
aoqi@0 628 static bool has_type_annotations_field();
aoqi@0 629 static oop type_annotations(oop method);
aoqi@0 630 static void set_type_annotations(oop method, oop value);
aoqi@0 631
aoqi@0 632 // Debugging
aoqi@0 633 friend class JavaClasses;
aoqi@0 634 };
aoqi@0 635
aoqi@0 636
aoqi@0 637 // Interface to java.lang.reflect.Constructor objects
aoqi@0 638
aoqi@0 639 class java_lang_reflect_Constructor : public java_lang_reflect_AccessibleObject {
aoqi@0 640 private:
aoqi@0 641 // Note that to reduce dependencies on the JDK we compute these
aoqi@0 642 // offsets at run-time.
aoqi@0 643 static int clazz_offset;
aoqi@0 644 static int parameterTypes_offset;
aoqi@0 645 static int exceptionTypes_offset;
aoqi@0 646 static int slot_offset;
aoqi@0 647 static int modifiers_offset;
aoqi@0 648 static int signature_offset;
aoqi@0 649 static int annotations_offset;
aoqi@0 650 static int parameter_annotations_offset;
aoqi@0 651 static int type_annotations_offset;
aoqi@0 652
aoqi@0 653 static void compute_offsets();
aoqi@0 654
aoqi@0 655 public:
aoqi@0 656 // Allocation
aoqi@0 657 static Handle create(TRAPS);
aoqi@0 658
aoqi@0 659 // Accessors
aoqi@0 660 static oop clazz(oop reflect);
aoqi@0 661 static void set_clazz(oop reflect, oop value);
aoqi@0 662
aoqi@0 663 static oop parameter_types(oop constructor);
aoqi@0 664 static void set_parameter_types(oop constructor, oop value);
aoqi@0 665
aoqi@0 666 static oop exception_types(oop constructor);
aoqi@0 667 static void set_exception_types(oop constructor, oop value);
aoqi@0 668
aoqi@0 669 static int slot(oop reflect);
aoqi@0 670 static void set_slot(oop reflect, int value);
aoqi@0 671
aoqi@0 672 static int modifiers(oop constructor);
aoqi@0 673 static void set_modifiers(oop constructor, int value);
aoqi@0 674
aoqi@0 675 static bool has_signature_field();
aoqi@0 676 static oop signature(oop constructor);
aoqi@0 677 static void set_signature(oop constructor, oop value);
aoqi@0 678
aoqi@0 679 static bool has_annotations_field();
aoqi@0 680 static oop annotations(oop constructor);
aoqi@0 681 static void set_annotations(oop constructor, oop value);
aoqi@0 682
aoqi@0 683 static bool has_parameter_annotations_field();
aoqi@0 684 static oop parameter_annotations(oop method);
aoqi@0 685 static void set_parameter_annotations(oop method, oop value);
aoqi@0 686
aoqi@0 687 static bool has_type_annotations_field();
aoqi@0 688 static oop type_annotations(oop constructor);
aoqi@0 689 static void set_type_annotations(oop constructor, oop value);
aoqi@0 690
aoqi@0 691 // Debugging
aoqi@0 692 friend class JavaClasses;
aoqi@0 693 };
aoqi@0 694
aoqi@0 695
aoqi@0 696 // Interface to java.lang.reflect.Field objects
aoqi@0 697
aoqi@0 698 class java_lang_reflect_Field : public java_lang_reflect_AccessibleObject {
aoqi@0 699 private:
aoqi@0 700 // Note that to reduce dependencies on the JDK we compute these
aoqi@0 701 // offsets at run-time.
aoqi@0 702 static int clazz_offset;
aoqi@0 703 static int name_offset;
aoqi@0 704 static int type_offset;
aoqi@0 705 static int slot_offset;
aoqi@0 706 static int modifiers_offset;
aoqi@0 707 static int signature_offset;
aoqi@0 708 static int annotations_offset;
aoqi@0 709 static int type_annotations_offset;
aoqi@0 710
aoqi@0 711 static void compute_offsets();
aoqi@0 712
aoqi@0 713 public:
aoqi@0 714 // Allocation
aoqi@0 715 static Handle create(TRAPS);
aoqi@0 716
aoqi@0 717 // Accessors
aoqi@0 718 static oop clazz(oop reflect);
aoqi@0 719 static void set_clazz(oop reflect, oop value);
aoqi@0 720
aoqi@0 721 static oop name(oop field);
aoqi@0 722 static void set_name(oop field, oop value);
aoqi@0 723
aoqi@0 724 static oop type(oop field);
aoqi@0 725 static void set_type(oop field, oop value);
aoqi@0 726
aoqi@0 727 static int slot(oop reflect);
aoqi@0 728 static void set_slot(oop reflect, int value);
aoqi@0 729
aoqi@0 730 static int modifiers(oop field);
aoqi@0 731 static void set_modifiers(oop field, int value);
aoqi@0 732
aoqi@0 733 static bool has_signature_field();
aoqi@0 734 static oop signature(oop constructor);
aoqi@0 735 static void set_signature(oop constructor, oop value);
aoqi@0 736
aoqi@0 737 static bool has_annotations_field();
aoqi@0 738 static oop annotations(oop constructor);
aoqi@0 739 static void set_annotations(oop constructor, oop value);
aoqi@0 740
aoqi@0 741 static bool has_parameter_annotations_field();
aoqi@0 742 static oop parameter_annotations(oop method);
aoqi@0 743 static void set_parameter_annotations(oop method, oop value);
aoqi@0 744
aoqi@0 745 static bool has_annotation_default_field();
aoqi@0 746 static oop annotation_default(oop method);
aoqi@0 747 static void set_annotation_default(oop method, oop value);
aoqi@0 748
aoqi@0 749 static bool has_type_annotations_field();
aoqi@0 750 static oop type_annotations(oop field);
aoqi@0 751 static void set_type_annotations(oop field, oop value);
aoqi@0 752
aoqi@0 753 // Debugging
aoqi@0 754 friend class JavaClasses;
aoqi@0 755 };
aoqi@0 756
aoqi@0 757 class java_lang_reflect_Parameter {
aoqi@0 758 private:
aoqi@0 759 // Note that to reduce dependencies on the JDK we compute these
aoqi@0 760 // offsets at run-time.
aoqi@0 761 static int name_offset;
aoqi@0 762 static int modifiers_offset;
aoqi@0 763 static int index_offset;
aoqi@0 764 static int executable_offset;
aoqi@0 765
aoqi@0 766 static void compute_offsets();
aoqi@0 767
aoqi@0 768 public:
aoqi@0 769 // Allocation
aoqi@0 770 static Handle create(TRAPS);
aoqi@0 771
aoqi@0 772 // Accessors
aoqi@0 773 static oop name(oop field);
aoqi@0 774 static void set_name(oop field, oop value);
aoqi@0 775
aoqi@0 776 static int index(oop reflect);
aoqi@0 777 static void set_index(oop reflect, int value);
aoqi@0 778
aoqi@0 779 static int modifiers(oop reflect);
aoqi@0 780 static void set_modifiers(oop reflect, int value);
aoqi@0 781
aoqi@0 782 static oop executable(oop constructor);
aoqi@0 783 static void set_executable(oop constructor, oop value);
aoqi@0 784
aoqi@0 785 friend class JavaClasses;
aoqi@0 786 };
aoqi@0 787
aoqi@0 788 // Interface to sun.reflect.ConstantPool objects
aoqi@0 789 class sun_reflect_ConstantPool {
aoqi@0 790 private:
aoqi@0 791 // Note that to reduce dependencies on the JDK we compute these
aoqi@0 792 // offsets at run-time.
aoqi@0 793 static int _oop_offset;
aoqi@0 794
aoqi@0 795 static void compute_offsets();
aoqi@0 796
aoqi@0 797 public:
aoqi@0 798 // Allocation
aoqi@0 799 static Handle create(TRAPS);
aoqi@0 800
aoqi@0 801 // Accessors
aoqi@0 802 static void set_cp(oop reflect, ConstantPool* value);
aoqi@0 803 static int oop_offset() {
aoqi@0 804 return _oop_offset;
aoqi@0 805 }
aoqi@0 806
aoqi@0 807 static ConstantPool* get_cp(oop reflect);
aoqi@0 808
aoqi@0 809 // Debugging
aoqi@0 810 friend class JavaClasses;
aoqi@0 811 };
aoqi@0 812
aoqi@0 813 // Interface to sun.reflect.UnsafeStaticFieldAccessorImpl objects
aoqi@0 814 class sun_reflect_UnsafeStaticFieldAccessorImpl {
aoqi@0 815 private:
aoqi@0 816 static int _base_offset;
aoqi@0 817 static void compute_offsets();
aoqi@0 818
aoqi@0 819 public:
aoqi@0 820 static int base_offset() {
aoqi@0 821 return _base_offset;
aoqi@0 822 }
aoqi@0 823
aoqi@0 824 // Debugging
aoqi@0 825 friend class JavaClasses;
aoqi@0 826 };
aoqi@0 827
aoqi@0 828 // Interface to java.lang primitive type boxing objects:
aoqi@0 829 // - java.lang.Boolean
aoqi@0 830 // - java.lang.Character
aoqi@0 831 // - java.lang.Float
aoqi@0 832 // - java.lang.Double
aoqi@0 833 // - java.lang.Byte
aoqi@0 834 // - java.lang.Short
aoqi@0 835 // - java.lang.Integer
aoqi@0 836 // - java.lang.Long
aoqi@0 837
aoqi@0 838 // This could be separated out into 8 individual classes.
aoqi@0 839
aoqi@0 840 class java_lang_boxing_object: AllStatic {
aoqi@0 841 private:
aoqi@0 842 enum {
aoqi@0 843 hc_value_offset = 0
aoqi@0 844 };
aoqi@0 845 static int value_offset;
aoqi@0 846 static int long_value_offset;
aoqi@0 847
aoqi@0 848 static oop initialize_and_allocate(BasicType type, TRAPS);
aoqi@0 849 public:
aoqi@0 850 // Allocation. Returns a boxed value, or NULL for invalid type.
aoqi@0 851 static oop create(BasicType type, jvalue* value, TRAPS);
aoqi@0 852 // Accessors. Returns the basic type being boxed, or T_ILLEGAL for invalid oop.
aoqi@0 853 static BasicType get_value(oop box, jvalue* value);
aoqi@0 854 static BasicType set_value(oop box, jvalue* value);
aoqi@0 855 static BasicType basic_type(oop box);
aoqi@0 856 static bool is_instance(oop box) { return basic_type(box) != T_ILLEGAL; }
aoqi@0 857 static bool is_instance(oop box, BasicType type) { return basic_type(box) == type; }
aoqi@0 858 static void print(oop box, outputStream* st) { jvalue value; print(get_value(box, &value), &value, st); }
aoqi@0 859 static void print(BasicType type, jvalue* value, outputStream* st);
aoqi@0 860
aoqi@0 861 static int value_offset_in_bytes(BasicType type) {
aoqi@0 862 return ( type == T_LONG || type == T_DOUBLE ) ? long_value_offset :
aoqi@0 863 value_offset;
aoqi@0 864 }
aoqi@0 865
aoqi@0 866 // Debugging
aoqi@0 867 friend class JavaClasses;
aoqi@0 868 };
aoqi@0 869
aoqi@0 870
aoqi@0 871
aoqi@0 872 // Interface to java.lang.ref.Reference objects
aoqi@0 873
aoqi@0 874 class java_lang_ref_Reference: AllStatic {
aoqi@0 875 public:
aoqi@0 876 enum {
aoqi@0 877 hc_referent_offset = 0,
aoqi@0 878 hc_queue_offset = 1,
aoqi@0 879 hc_next_offset = 2,
aoqi@0 880 hc_discovered_offset = 3 // Is not last, see SoftRefs.
aoqi@0 881 };
aoqi@0 882 enum {
aoqi@0 883 hc_static_lock_offset = 0,
aoqi@0 884 hc_static_pending_offset = 1
aoqi@0 885 };
aoqi@0 886
aoqi@0 887 static int referent_offset;
aoqi@0 888 static int queue_offset;
aoqi@0 889 static int next_offset;
aoqi@0 890 static int discovered_offset;
aoqi@0 891 static int static_lock_offset;
aoqi@0 892 static int static_pending_offset;
aoqi@0 893 static int number_of_fake_oop_fields;
aoqi@0 894
aoqi@0 895 // Accessors
aoqi@0 896 static oop referent(oop ref) {
aoqi@0 897 return ref->obj_field(referent_offset);
aoqi@0 898 }
aoqi@0 899 static void set_referent(oop ref, oop value) {
aoqi@0 900 ref->obj_field_put(referent_offset, value);
aoqi@0 901 }
aoqi@0 902 static void set_referent_raw(oop ref, oop value) {
aoqi@0 903 ref->obj_field_put_raw(referent_offset, value);
aoqi@0 904 }
aoqi@0 905 static HeapWord* referent_addr(oop ref) {
aoqi@0 906 return ref->obj_field_addr<HeapWord>(referent_offset);
aoqi@0 907 }
aoqi@0 908 static oop next(oop ref) {
aoqi@0 909 return ref->obj_field(next_offset);
aoqi@0 910 }
aoqi@0 911 static void set_next(oop ref, oop value) {
aoqi@0 912 ref->obj_field_put(next_offset, value);
aoqi@0 913 }
aoqi@0 914 static void set_next_raw(oop ref, oop value) {
aoqi@0 915 ref->obj_field_put_raw(next_offset, value);
aoqi@0 916 }
aoqi@0 917 static HeapWord* next_addr(oop ref) {
aoqi@0 918 return ref->obj_field_addr<HeapWord>(next_offset);
aoqi@0 919 }
aoqi@0 920 static oop discovered(oop ref) {
aoqi@0 921 return ref->obj_field(discovered_offset);
aoqi@0 922 }
aoqi@0 923 static void set_discovered(oop ref, oop value) {
aoqi@0 924 ref->obj_field_put(discovered_offset, value);
aoqi@0 925 }
aoqi@0 926 static void set_discovered_raw(oop ref, oop value) {
aoqi@0 927 ref->obj_field_put_raw(discovered_offset, value);
aoqi@0 928 }
aoqi@0 929 static HeapWord* discovered_addr(oop ref) {
aoqi@0 930 return ref->obj_field_addr<HeapWord>(discovered_offset);
aoqi@0 931 }
aoqi@0 932 // Accessors for statics
aoqi@0 933 static oop pending_list_lock();
aoqi@0 934 static oop pending_list();
aoqi@0 935
aoqi@0 936 static HeapWord* pending_list_lock_addr();
aoqi@0 937 static HeapWord* pending_list_addr();
aoqi@0 938 };
aoqi@0 939
aoqi@0 940
aoqi@0 941 // Interface to java.lang.ref.SoftReference objects
aoqi@0 942
aoqi@0 943 class java_lang_ref_SoftReference: public java_lang_ref_Reference {
aoqi@0 944 public:
aoqi@0 945 enum {
aoqi@0 946 // The timestamp is a long field and may need to be adjusted for alignment.
aoqi@0 947 hc_timestamp_offset = hc_discovered_offset + 1
aoqi@0 948 };
aoqi@0 949 enum {
aoqi@0 950 hc_static_clock_offset = 0
aoqi@0 951 };
aoqi@0 952
aoqi@0 953 static int timestamp_offset;
aoqi@0 954 static int static_clock_offset;
aoqi@0 955
aoqi@0 956 // Accessors
aoqi@0 957 static jlong timestamp(oop ref);
aoqi@0 958
aoqi@0 959 // Accessors for statics
aoqi@0 960 static jlong clock();
aoqi@0 961 static void set_clock(jlong value);
aoqi@0 962 };
aoqi@0 963
aoqi@0 964
aoqi@0 965 // Interface to java.lang.invoke.MethodHandle objects
aoqi@0 966
aoqi@0 967 class MethodHandleEntry;
aoqi@0 968
aoqi@0 969 class java_lang_invoke_MethodHandle: AllStatic {
aoqi@0 970 friend class JavaClasses;
aoqi@0 971
aoqi@0 972 private:
aoqi@0 973 static int _type_offset; // the MethodType of this MH
aoqi@0 974 static int _form_offset; // the LambdaForm of this MH
aoqi@0 975
aoqi@0 976 static void compute_offsets();
aoqi@0 977
aoqi@0 978 public:
aoqi@0 979 // Accessors
aoqi@0 980 static oop type(oop mh);
aoqi@0 981 static void set_type(oop mh, oop mtype);
aoqi@0 982
aoqi@0 983 static oop form(oop mh);
aoqi@0 984 static void set_form(oop mh, oop lform);
aoqi@0 985
aoqi@0 986 // Testers
aoqi@0 987 static bool is_subclass(Klass* klass) {
aoqi@0 988 return klass->is_subclass_of(SystemDictionary::MethodHandle_klass());
aoqi@0 989 }
aoqi@0 990 static bool is_instance(oop obj) {
aoqi@0 991 return obj != NULL && is_subclass(obj->klass());
aoqi@0 992 }
aoqi@0 993
aoqi@0 994 // Accessors for code generation:
aoqi@0 995 static int type_offset_in_bytes() { return _type_offset; }
aoqi@0 996 static int form_offset_in_bytes() { return _form_offset; }
aoqi@0 997 };
aoqi@0 998
aoqi@0 999 // Interface to java.lang.invoke.DirectMethodHandle objects
aoqi@0 1000
aoqi@0 1001 class java_lang_invoke_DirectMethodHandle: AllStatic {
aoqi@0 1002 friend class JavaClasses;
aoqi@0 1003
aoqi@0 1004 private:
aoqi@0 1005 static int _member_offset; // the MemberName of this DMH
aoqi@0 1006
aoqi@0 1007 static void compute_offsets();
aoqi@0 1008
aoqi@0 1009 public:
aoqi@0 1010 // Accessors
aoqi@0 1011 static oop member(oop mh);
aoqi@0 1012
aoqi@0 1013 // Testers
aoqi@0 1014 static bool is_subclass(Klass* klass) {
aoqi@0 1015 return klass->is_subclass_of(SystemDictionary::DirectMethodHandle_klass());
aoqi@0 1016 }
aoqi@0 1017 static bool is_instance(oop obj) {
aoqi@0 1018 return obj != NULL && is_subclass(obj->klass());
aoqi@0 1019 }
aoqi@0 1020
aoqi@0 1021 // Accessors for code generation:
aoqi@0 1022 static int member_offset_in_bytes() { return _member_offset; }
aoqi@0 1023 };
aoqi@0 1024
aoqi@0 1025 // Interface to java.lang.invoke.LambdaForm objects
aoqi@0 1026 // (These are a private interface for managing adapter code generation.)
aoqi@0 1027
aoqi@0 1028 class java_lang_invoke_LambdaForm: AllStatic {
aoqi@0 1029 friend class JavaClasses;
aoqi@0 1030
aoqi@0 1031 private:
aoqi@0 1032 static int _vmentry_offset; // type is MemberName
aoqi@0 1033
aoqi@0 1034 static void compute_offsets();
aoqi@0 1035
aoqi@0 1036 public:
aoqi@0 1037 // Accessors
aoqi@0 1038 static oop vmentry(oop lform);
aoqi@0 1039 static void set_vmentry(oop lform, oop invoker);
aoqi@0 1040
aoqi@0 1041 // Testers
aoqi@0 1042 static bool is_subclass(Klass* klass) {
aoqi@0 1043 return SystemDictionary::LambdaForm_klass() != NULL &&
aoqi@0 1044 klass->is_subclass_of(SystemDictionary::LambdaForm_klass());
aoqi@0 1045 }
aoqi@0 1046 static bool is_instance(oop obj) {
aoqi@0 1047 return obj != NULL && is_subclass(obj->klass());
aoqi@0 1048 }
aoqi@0 1049
aoqi@0 1050 // Accessors for code generation:
aoqi@0 1051 static int vmentry_offset_in_bytes() { return _vmentry_offset; }
aoqi@0 1052 };
aoqi@0 1053
aoqi@0 1054
aoqi@0 1055 // Interface to java.lang.invoke.MemberName objects
aoqi@0 1056 // (These are a private interface for Java code to query the class hierarchy.)
aoqi@0 1057
aoqi@0 1058 #define MEMBERNAME_INJECTED_FIELDS(macro) \
aoqi@0 1059 macro(java_lang_invoke_MemberName, vmloader, object_signature, false) \
aoqi@0 1060 macro(java_lang_invoke_MemberName, vmindex, intptr_signature, false) \
aoqi@0 1061 macro(java_lang_invoke_MemberName, vmtarget, intptr_signature, false)
aoqi@0 1062
aoqi@0 1063 class java_lang_invoke_MemberName: AllStatic {
aoqi@0 1064 friend class JavaClasses;
aoqi@0 1065
aoqi@0 1066 private:
aoqi@0 1067 // From java.lang.invoke.MemberName:
aoqi@0 1068 // private Class<?> clazz; // class in which the method is defined
aoqi@0 1069 // private String name; // may be null if not yet materialized
aoqi@0 1070 // private Object type; // may be null if not yet materialized
aoqi@0 1071 // private int flags; // modifier bits; see reflect.Modifier
aoqi@0 1072 // private intptr vmtarget; // VM-specific target value
aoqi@0 1073 // private intptr_t vmindex; // member index within class or interface
aoqi@0 1074 static int _clazz_offset;
aoqi@0 1075 static int _name_offset;
aoqi@0 1076 static int _type_offset;
aoqi@0 1077 static int _flags_offset;
aoqi@0 1078 static int _vmtarget_offset;
aoqi@0 1079 static int _vmloader_offset;
aoqi@0 1080 static int _vmindex_offset;
aoqi@0 1081
aoqi@0 1082 static void compute_offsets();
aoqi@0 1083
aoqi@0 1084 public:
aoqi@0 1085 // Accessors
aoqi@0 1086 static oop clazz(oop mname);
aoqi@0 1087 static void set_clazz(oop mname, oop clazz);
aoqi@0 1088
aoqi@0 1089 static oop type(oop mname);
aoqi@0 1090 static void set_type(oop mname, oop type);
aoqi@0 1091
aoqi@0 1092 static oop name(oop mname);
aoqi@0 1093 static void set_name(oop mname, oop name);
aoqi@0 1094
aoqi@0 1095 static int flags(oop mname);
aoqi@0 1096 static void set_flags(oop mname, int flags);
aoqi@0 1097
aoqi@0 1098 static Metadata* vmtarget(oop mname);
aoqi@0 1099 static void set_vmtarget(oop mname, Metadata* target);
aoqi@0 1100
aoqi@0 1101 static intptr_t vmindex(oop mname);
aoqi@0 1102 static void set_vmindex(oop mname, intptr_t index);
aoqi@0 1103
aoqi@0 1104 // Testers
aoqi@0 1105 static bool is_subclass(Klass* klass) {
aoqi@0 1106 return klass->is_subclass_of(SystemDictionary::MemberName_klass());
aoqi@0 1107 }
aoqi@0 1108 static bool is_instance(oop obj) {
aoqi@0 1109 return obj != NULL && is_subclass(obj->klass());
aoqi@0 1110 }
aoqi@0 1111
coleenp@7391 1112 static bool is_method(oop obj);
coleenp@7391 1113
aoqi@0 1114 // Relevant integer codes (keep these in synch. with MethodHandleNatives.Constants):
aoqi@0 1115 enum {
aoqi@0 1116 MN_IS_METHOD = 0x00010000, // method (not constructor)
aoqi@0 1117 MN_IS_CONSTRUCTOR = 0x00020000, // constructor
aoqi@0 1118 MN_IS_FIELD = 0x00040000, // field
aoqi@0 1119 MN_IS_TYPE = 0x00080000, // nested type
aoqi@0 1120 MN_CALLER_SENSITIVE = 0x00100000, // @CallerSensitive annotation detected
aoqi@0 1121 MN_REFERENCE_KIND_SHIFT = 24, // refKind
aoqi@0 1122 MN_REFERENCE_KIND_MASK = 0x0F000000 >> MN_REFERENCE_KIND_SHIFT,
aoqi@0 1123 // The SEARCH_* bits are not for MN.flags but for the matchFlags argument of MHN.getMembers:
aoqi@0 1124 MN_SEARCH_SUPERCLASSES = 0x00100000, // walk super classes
aoqi@0 1125 MN_SEARCH_INTERFACES = 0x00200000 // walk implemented interfaces
aoqi@0 1126 };
aoqi@0 1127
aoqi@0 1128 // Accessors for code generation:
aoqi@0 1129 static int clazz_offset_in_bytes() { return _clazz_offset; }
aoqi@0 1130 static int type_offset_in_bytes() { return _type_offset; }
aoqi@0 1131 static int name_offset_in_bytes() { return _name_offset; }
aoqi@0 1132 static int flags_offset_in_bytes() { return _flags_offset; }
aoqi@0 1133 static int vmtarget_offset_in_bytes() { return _vmtarget_offset; }
aoqi@0 1134 static int vmindex_offset_in_bytes() { return _vmindex_offset; }
kevinw@8721 1135
kevinw@8721 1136 static bool equals(oop mt1, oop mt2);
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
sspitsyn@7683 1329 static oop create(Handle mirror, int method, int version, int bci, int cpref, 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