Fri, 06 Jun 2008 13:43:36 -0400
Merge
duke@435 | 1 | /* |
duke@435 | 2 | * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
duke@435 | 19 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
duke@435 | 20 | * CA 95054 USA or visit www.sun.com if you need additional information or |
duke@435 | 21 | * have any questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
duke@435 | 25 | // Interface for manipulating the basic Java classes. |
duke@435 | 26 | // |
duke@435 | 27 | // All dependencies on layout of actual Java classes should be kept here. |
duke@435 | 28 | // If the layout of any of the classes above changes the offsets must be adjusted. |
duke@435 | 29 | // |
duke@435 | 30 | // For most classes we hardwire the offsets for performance reasons. In certain |
duke@435 | 31 | // cases (e.g. java.security.AccessControlContext) we compute the offsets at |
duke@435 | 32 | // startup since the layout here differs between JDK1.2 and JDK1.3. |
duke@435 | 33 | // |
duke@435 | 34 | // Note that fields (static and non-static) are arranged with oops before non-oops |
duke@435 | 35 | // on a per class basis. The offsets below have to reflect this ordering. |
duke@435 | 36 | // |
duke@435 | 37 | // When editing the layouts please update the check_offset verification code |
duke@435 | 38 | // correspondingly. The names in the enums must be identical to the actual field |
duke@435 | 39 | // names in order for the verification code to work. |
duke@435 | 40 | |
duke@435 | 41 | |
duke@435 | 42 | // Interface to java.lang.String objects |
duke@435 | 43 | |
duke@435 | 44 | class java_lang_String : AllStatic { |
duke@435 | 45 | private: |
duke@435 | 46 | enum { |
duke@435 | 47 | hc_value_offset = 0, |
jrose@567 | 48 | hc_offset_offset = 1 |
jrose@567 | 49 | //hc_count_offset = 2 -- not a word-scaled offset |
jrose@567 | 50 | //hc_hash_offset = 3 -- not a word-scaled offset |
duke@435 | 51 | }; |
duke@435 | 52 | |
duke@435 | 53 | static int value_offset; |
duke@435 | 54 | static int offset_offset; |
duke@435 | 55 | static int count_offset; |
duke@435 | 56 | static int hash_offset; |
duke@435 | 57 | |
duke@435 | 58 | static Handle basic_create(int length, bool tenured, TRAPS); |
duke@435 | 59 | static Handle basic_create_from_unicode(jchar* unicode, int length, bool tenured, TRAPS); |
duke@435 | 60 | |
duke@435 | 61 | static void set_value( oop string, typeArrayOop buffer) { string->obj_field_put(value_offset, (oop)buffer); } |
duke@435 | 62 | static void set_offset(oop string, int offset) { string->int_field_put(offset_offset, offset); } |
duke@435 | 63 | static void set_count( oop string, int count) { string->int_field_put(count_offset, count); } |
duke@435 | 64 | |
duke@435 | 65 | public: |
duke@435 | 66 | // Instance creation |
duke@435 | 67 | static Handle create_from_unicode(jchar* unicode, int len, TRAPS); |
duke@435 | 68 | static Handle create_tenured_from_unicode(jchar* unicode, int len, TRAPS); |
duke@435 | 69 | static oop create_oop_from_unicode(jchar* unicode, int len, TRAPS); |
duke@435 | 70 | static Handle create_from_str(const char* utf8_str, TRAPS); |
duke@435 | 71 | static oop create_oop_from_str(const char* utf8_str, TRAPS); |
duke@435 | 72 | static Handle create_from_symbol(symbolHandle symbol, TRAPS); |
duke@435 | 73 | static Handle create_from_platform_dependent_str(const char* str, TRAPS); |
duke@435 | 74 | static Handle char_converter(Handle java_string, jchar from_char, jchar to_char, TRAPS); |
duke@435 | 75 | |
duke@435 | 76 | static int value_offset_in_bytes() { return value_offset; } |
duke@435 | 77 | static int count_offset_in_bytes() { return count_offset; } |
duke@435 | 78 | static int offset_offset_in_bytes() { return offset_offset; } |
duke@435 | 79 | static int hash_offset_in_bytes() { return hash_offset; } |
duke@435 | 80 | |
duke@435 | 81 | // Accessors |
duke@435 | 82 | static typeArrayOop value(oop java_string) { |
duke@435 | 83 | assert(is_instance(java_string), "must be java_string"); |
duke@435 | 84 | return (typeArrayOop) java_string->obj_field(value_offset); |
duke@435 | 85 | } |
duke@435 | 86 | static int offset(oop java_string) { |
duke@435 | 87 | assert(is_instance(java_string), "must be java_string"); |
duke@435 | 88 | return java_string->int_field(offset_offset); |
duke@435 | 89 | } |
duke@435 | 90 | static int length(oop java_string) { |
duke@435 | 91 | assert(is_instance(java_string), "must be java_string"); |
duke@435 | 92 | return java_string->int_field(count_offset); |
duke@435 | 93 | } |
duke@435 | 94 | static int utf8_length(oop java_string); |
duke@435 | 95 | |
duke@435 | 96 | // String converters |
duke@435 | 97 | static char* as_utf8_string(oop java_string); |
duke@435 | 98 | static char* as_utf8_string(oop java_string, int start, int len); |
coleenp@457 | 99 | static char* as_platform_dependent_str(Handle java_string, TRAPS); |
duke@435 | 100 | static jchar* as_unicode_string(oop java_string, int& length); |
duke@435 | 101 | |
duke@435 | 102 | static bool equals(oop java_string, jchar* chars, int len); |
duke@435 | 103 | |
duke@435 | 104 | // Conversion between '.' and '/' formats |
duke@435 | 105 | static Handle externalize_classname(Handle java_string, TRAPS) { return char_converter(java_string, '/', '.', THREAD); } |
duke@435 | 106 | static Handle internalize_classname(Handle java_string, TRAPS) { return char_converter(java_string, '.', '/', THREAD); } |
duke@435 | 107 | |
duke@435 | 108 | // Conversion |
duke@435 | 109 | static symbolHandle as_symbol(Handle java_string, TRAPS); |
duke@435 | 110 | |
duke@435 | 111 | // Testers |
duke@435 | 112 | static bool is_instance(oop obj) { |
duke@435 | 113 | return obj != NULL && obj->klass() == SystemDictionary::string_klass(); |
duke@435 | 114 | } |
duke@435 | 115 | |
duke@435 | 116 | // Debugging |
duke@435 | 117 | static void print(Handle java_string, outputStream* st); |
duke@435 | 118 | friend class JavaClasses; |
duke@435 | 119 | }; |
duke@435 | 120 | |
duke@435 | 121 | |
duke@435 | 122 | // Interface to java.lang.Class objects |
duke@435 | 123 | |
duke@435 | 124 | class java_lang_Class : AllStatic { |
duke@435 | 125 | friend class VMStructs; |
duke@435 | 126 | private: |
duke@435 | 127 | // The fake offsets are added by the class loader when java.lang.Class is loaded |
duke@435 | 128 | |
duke@435 | 129 | enum { |
duke@435 | 130 | hc_klass_offset = 0, |
duke@435 | 131 | hc_array_klass_offset = 1, |
duke@435 | 132 | hc_resolved_constructor_offset = 2, |
duke@435 | 133 | hc_number_of_fake_oop_fields = 3 |
duke@435 | 134 | }; |
duke@435 | 135 | |
duke@435 | 136 | static int klass_offset; |
duke@435 | 137 | static int resolved_constructor_offset; |
duke@435 | 138 | static int array_klass_offset; |
duke@435 | 139 | static int number_of_fake_oop_fields; |
duke@435 | 140 | |
duke@435 | 141 | static void compute_offsets(); |
duke@435 | 142 | static bool offsets_computed; |
duke@435 | 143 | static int classRedefinedCount_offset; |
duke@435 | 144 | |
duke@435 | 145 | public: |
duke@435 | 146 | // Instance creation |
duke@435 | 147 | static oop create_mirror(KlassHandle k, TRAPS); |
duke@435 | 148 | static oop create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS); |
duke@435 | 149 | // Conversion |
duke@435 | 150 | static klassOop as_klassOop(oop java_class); |
duke@435 | 151 | // Testing |
jrose@567 | 152 | static bool is_instance(oop obj) { |
jrose@567 | 153 | return obj != NULL && obj->klass() == SystemDictionary::class_klass(); |
jrose@567 | 154 | } |
duke@435 | 155 | static bool is_primitive(oop java_class); |
duke@435 | 156 | static BasicType primitive_type(oop java_class); |
duke@435 | 157 | static oop primitive_mirror(BasicType t); |
duke@435 | 158 | // JVM_NewInstance support |
duke@435 | 159 | static methodOop resolved_constructor(oop java_class); |
duke@435 | 160 | static void set_resolved_constructor(oop java_class, methodOop constructor); |
duke@435 | 161 | // JVM_NewArray support |
duke@435 | 162 | static klassOop array_klass(oop java_class); |
duke@435 | 163 | static void set_array_klass(oop java_class, klassOop klass); |
duke@435 | 164 | // compiler support for class operations |
duke@435 | 165 | static int klass_offset_in_bytes() { return klass_offset; } |
duke@435 | 166 | static int resolved_constructor_offset_in_bytes() { return resolved_constructor_offset; } |
duke@435 | 167 | static int array_klass_offset_in_bytes() { return array_klass_offset; } |
duke@435 | 168 | // Support for classRedefinedCount field |
duke@435 | 169 | static int classRedefinedCount(oop the_class_mirror); |
duke@435 | 170 | static void set_classRedefinedCount(oop the_class_mirror, int value); |
duke@435 | 171 | // Debugging |
duke@435 | 172 | friend class JavaClasses; |
duke@435 | 173 | friend class instanceKlass; // verification code accesses offsets |
duke@435 | 174 | friend class ClassFileParser; // access to number_of_fake_fields |
duke@435 | 175 | }; |
duke@435 | 176 | |
duke@435 | 177 | // Interface to java.lang.Thread objects |
duke@435 | 178 | |
duke@435 | 179 | class java_lang_Thread : AllStatic { |
duke@435 | 180 | private: |
duke@435 | 181 | // Note that for this class the layout changed between JDK1.2 and JDK1.3, |
duke@435 | 182 | // so we compute the offsets at startup rather than hard-wiring them. |
duke@435 | 183 | static int _name_offset; |
duke@435 | 184 | static int _group_offset; |
duke@435 | 185 | static int _contextClassLoader_offset; |
duke@435 | 186 | static int _inheritedAccessControlContext_offset; |
duke@435 | 187 | static int _priority_offset; |
duke@435 | 188 | static int _eetop_offset; |
duke@435 | 189 | static int _daemon_offset; |
duke@435 | 190 | static int _stillborn_offset; |
duke@435 | 191 | static int _stackSize_offset; |
duke@435 | 192 | static int _tid_offset; |
duke@435 | 193 | static int _thread_status_offset; |
duke@435 | 194 | static int _park_blocker_offset; |
duke@435 | 195 | static int _park_event_offset ; |
duke@435 | 196 | |
duke@435 | 197 | static void compute_offsets(); |
duke@435 | 198 | |
duke@435 | 199 | public: |
duke@435 | 200 | // Instance creation |
duke@435 | 201 | static oop create(); |
duke@435 | 202 | // Returns the JavaThread associated with the thread obj |
duke@435 | 203 | static JavaThread* thread(oop java_thread); |
duke@435 | 204 | // Set JavaThread for instance |
duke@435 | 205 | static void set_thread(oop java_thread, JavaThread* thread); |
duke@435 | 206 | // Name |
duke@435 | 207 | static typeArrayOop name(oop java_thread); |
duke@435 | 208 | static void set_name(oop java_thread, typeArrayOop name); |
duke@435 | 209 | // Priority |
duke@435 | 210 | static ThreadPriority priority(oop java_thread); |
duke@435 | 211 | static void set_priority(oop java_thread, ThreadPriority priority); |
duke@435 | 212 | // Thread group |
duke@435 | 213 | static oop threadGroup(oop java_thread); |
duke@435 | 214 | // Stillborn |
duke@435 | 215 | static bool is_stillborn(oop java_thread); |
duke@435 | 216 | static void set_stillborn(oop java_thread); |
duke@435 | 217 | // Alive (NOTE: this is not really a field, but provides the correct |
duke@435 | 218 | // definition without doing a Java call) |
duke@435 | 219 | static bool is_alive(oop java_thread); |
duke@435 | 220 | // Daemon |
duke@435 | 221 | static bool is_daemon(oop java_thread); |
duke@435 | 222 | static void set_daemon(oop java_thread); |
duke@435 | 223 | // Context ClassLoader |
duke@435 | 224 | static oop context_class_loader(oop java_thread); |
duke@435 | 225 | // Control context |
duke@435 | 226 | static oop inherited_access_control_context(oop java_thread); |
duke@435 | 227 | // Stack size hint |
duke@435 | 228 | static jlong stackSize(oop java_thread); |
duke@435 | 229 | // Thread ID |
duke@435 | 230 | static jlong thread_id(oop java_thread); |
duke@435 | 231 | |
duke@435 | 232 | // Blocker object responsible for thread parking |
duke@435 | 233 | static oop park_blocker(oop java_thread); |
duke@435 | 234 | |
duke@435 | 235 | // Pointer to type-stable park handler, encoded as jlong. |
duke@435 | 236 | // Should be set when apparently null |
duke@435 | 237 | // For details, see unsafe.cpp Unsafe_Unpark |
duke@435 | 238 | static jlong park_event(oop java_thread); |
duke@435 | 239 | static bool set_park_event(oop java_thread, jlong ptr); |
duke@435 | 240 | |
duke@435 | 241 | // Java Thread Status for JVMTI and M&M use. |
duke@435 | 242 | // This thread status info is saved in threadStatus field of |
duke@435 | 243 | // java.lang.Thread java class. |
duke@435 | 244 | enum ThreadStatus { |
duke@435 | 245 | NEW = 0, |
duke@435 | 246 | RUNNABLE = JVMTI_THREAD_STATE_ALIVE + // runnable / running |
duke@435 | 247 | JVMTI_THREAD_STATE_RUNNABLE, |
duke@435 | 248 | SLEEPING = JVMTI_THREAD_STATE_ALIVE + // Thread.sleep() |
duke@435 | 249 | JVMTI_THREAD_STATE_WAITING + |
duke@435 | 250 | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT + |
duke@435 | 251 | JVMTI_THREAD_STATE_SLEEPING, |
duke@435 | 252 | IN_OBJECT_WAIT = JVMTI_THREAD_STATE_ALIVE + // Object.wait() |
duke@435 | 253 | JVMTI_THREAD_STATE_WAITING + |
duke@435 | 254 | JVMTI_THREAD_STATE_WAITING_INDEFINITELY + |
duke@435 | 255 | JVMTI_THREAD_STATE_IN_OBJECT_WAIT, |
duke@435 | 256 | IN_OBJECT_WAIT_TIMED = JVMTI_THREAD_STATE_ALIVE + // Object.wait(long) |
duke@435 | 257 | JVMTI_THREAD_STATE_WAITING + |
duke@435 | 258 | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT + |
duke@435 | 259 | JVMTI_THREAD_STATE_IN_OBJECT_WAIT, |
duke@435 | 260 | PARKED = JVMTI_THREAD_STATE_ALIVE + // LockSupport.park() |
duke@435 | 261 | JVMTI_THREAD_STATE_WAITING + |
duke@435 | 262 | JVMTI_THREAD_STATE_WAITING_INDEFINITELY + |
duke@435 | 263 | JVMTI_THREAD_STATE_PARKED, |
duke@435 | 264 | PARKED_TIMED = JVMTI_THREAD_STATE_ALIVE + // LockSupport.park(long) |
duke@435 | 265 | JVMTI_THREAD_STATE_WAITING + |
duke@435 | 266 | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT + |
duke@435 | 267 | JVMTI_THREAD_STATE_PARKED, |
duke@435 | 268 | BLOCKED_ON_MONITOR_ENTER = JVMTI_THREAD_STATE_ALIVE + // (re-)entering a synchronization block |
duke@435 | 269 | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER, |
duke@435 | 270 | TERMINATED = JVMTI_THREAD_STATE_TERMINATED |
duke@435 | 271 | }; |
duke@435 | 272 | // Write thread status info to threadStatus field of java.lang.Thread. |
duke@435 | 273 | static void set_thread_status(oop java_thread_oop, ThreadStatus status); |
duke@435 | 274 | // Read thread status info from threadStatus field of java.lang.Thread. |
duke@435 | 275 | static ThreadStatus get_thread_status(oop java_thread_oop); |
duke@435 | 276 | |
duke@435 | 277 | static const char* thread_status_name(oop java_thread_oop); |
duke@435 | 278 | |
duke@435 | 279 | // Debugging |
duke@435 | 280 | friend class JavaClasses; |
duke@435 | 281 | }; |
duke@435 | 282 | |
duke@435 | 283 | // Interface to java.lang.ThreadGroup objects |
duke@435 | 284 | |
duke@435 | 285 | class java_lang_ThreadGroup : AllStatic { |
duke@435 | 286 | private: |
duke@435 | 287 | static int _parent_offset; |
duke@435 | 288 | static int _name_offset; |
duke@435 | 289 | static int _threads_offset; |
duke@435 | 290 | static int _groups_offset; |
duke@435 | 291 | static int _maxPriority_offset; |
duke@435 | 292 | static int _destroyed_offset; |
duke@435 | 293 | static int _daemon_offset; |
duke@435 | 294 | static int _vmAllowSuspension_offset; |
duke@435 | 295 | static int _nthreads_offset; |
duke@435 | 296 | static int _ngroups_offset; |
duke@435 | 297 | |
duke@435 | 298 | static void compute_offsets(); |
duke@435 | 299 | |
duke@435 | 300 | public: |
duke@435 | 301 | // parent ThreadGroup |
duke@435 | 302 | static oop parent(oop java_thread_group); |
duke@435 | 303 | // name |
duke@435 | 304 | static typeArrayOop name(oop java_thread_group); |
duke@435 | 305 | // ("name as oop" accessor is not necessary) |
duke@435 | 306 | // Number of threads in group |
duke@435 | 307 | static int nthreads(oop java_thread_group); |
duke@435 | 308 | // threads |
duke@435 | 309 | static objArrayOop threads(oop java_thread_group); |
duke@435 | 310 | // Number of threads in group |
duke@435 | 311 | static int ngroups(oop java_thread_group); |
duke@435 | 312 | // groups |
duke@435 | 313 | static objArrayOop groups(oop java_thread_group); |
duke@435 | 314 | // maxPriority in group |
duke@435 | 315 | static ThreadPriority maxPriority(oop java_thread_group); |
duke@435 | 316 | // Destroyed |
duke@435 | 317 | static bool is_destroyed(oop java_thread_group); |
duke@435 | 318 | // Daemon |
duke@435 | 319 | static bool is_daemon(oop java_thread_group); |
duke@435 | 320 | // vmAllowSuspension |
duke@435 | 321 | static bool is_vmAllowSuspension(oop java_thread_group); |
duke@435 | 322 | // Debugging |
duke@435 | 323 | friend class JavaClasses; |
duke@435 | 324 | }; |
duke@435 | 325 | |
duke@435 | 326 | |
duke@435 | 327 | |
duke@435 | 328 | // Interface to java.lang.Throwable objects |
duke@435 | 329 | |
duke@435 | 330 | class java_lang_Throwable: AllStatic { |
duke@435 | 331 | friend class BacktraceBuilder; |
duke@435 | 332 | |
duke@435 | 333 | private: |
duke@435 | 334 | // Offsets |
duke@435 | 335 | enum { |
duke@435 | 336 | hc_backtrace_offset = 0, |
duke@435 | 337 | hc_detailMessage_offset = 1, |
duke@435 | 338 | hc_cause_offset = 2, // New since 1.4 |
duke@435 | 339 | hc_stackTrace_offset = 3 // New since 1.4 |
duke@435 | 340 | }; |
duke@435 | 341 | // Trace constants |
duke@435 | 342 | enum { |
duke@435 | 343 | trace_methods_offset = 0, |
duke@435 | 344 | trace_bcis_offset = 1, |
duke@435 | 345 | trace_next_offset = 2, |
duke@435 | 346 | trace_size = 3, |
duke@435 | 347 | trace_chunk_size = 32 |
duke@435 | 348 | }; |
duke@435 | 349 | |
duke@435 | 350 | static int backtrace_offset; |
duke@435 | 351 | static int detailMessage_offset; |
duke@435 | 352 | static int cause_offset; |
duke@435 | 353 | static int stackTrace_offset; |
duke@435 | 354 | |
duke@435 | 355 | // Printing |
duke@435 | 356 | static char* print_stack_element_to_buffer(methodOop method, int bci); |
duke@435 | 357 | static void print_to_stream(Handle stream, const char* str); |
duke@435 | 358 | // StackTrace (programmatic access, new since 1.4) |
duke@435 | 359 | static void clear_stacktrace(oop throwable); |
duke@435 | 360 | // No stack trace available |
duke@435 | 361 | static const char* no_stack_trace_message(); |
duke@435 | 362 | |
duke@435 | 363 | public: |
duke@435 | 364 | // Backtrace |
duke@435 | 365 | static oop backtrace(oop throwable); |
duke@435 | 366 | static void set_backtrace(oop throwable, oop value); |
duke@435 | 367 | // Needed by JVMTI to filter out this internal field. |
duke@435 | 368 | static int get_backtrace_offset() { return backtrace_offset;} |
duke@435 | 369 | static int get_detailMessage_offset() { return detailMessage_offset;} |
duke@435 | 370 | // Message |
duke@435 | 371 | static oop message(oop throwable); |
duke@435 | 372 | static oop message(Handle throwable); |
duke@435 | 373 | static void set_message(oop throwable, oop value); |
duke@435 | 374 | // Print stack trace stored in exception by call-back to Java |
duke@435 | 375 | // Note: this is no longer used in Merlin, but we still suppport |
duke@435 | 376 | // it for compatibility. |
duke@435 | 377 | static void print_stack_trace(oop throwable, oop print_stream); |
duke@435 | 378 | static void print_stack_element(Handle stream, methodOop method, int bci); |
duke@435 | 379 | static void print_stack_element(outputStream *st, methodOop method, int bci); |
duke@435 | 380 | static void print_stack_usage(Handle stream); |
duke@435 | 381 | |
duke@435 | 382 | // Allocate space for backtrace (created but stack trace not filled in) |
duke@435 | 383 | static void allocate_backtrace(Handle throwable, TRAPS); |
duke@435 | 384 | // Fill in current stack trace for throwable with preallocated backtrace (no GC) |
duke@435 | 385 | static void fill_in_stack_trace_of_preallocated_backtrace(Handle throwable); |
duke@435 | 386 | |
duke@435 | 387 | // Fill in current stack trace, can cause GC |
duke@435 | 388 | static void fill_in_stack_trace(Handle throwable, TRAPS); |
duke@435 | 389 | static void fill_in_stack_trace(Handle throwable); |
duke@435 | 390 | // Programmatic access to stack trace |
duke@435 | 391 | static oop get_stack_trace_element(oop throwable, int index, TRAPS); |
duke@435 | 392 | static int get_stack_trace_depth(oop throwable, TRAPS); |
duke@435 | 393 | // Printing |
duke@435 | 394 | static void print(oop throwable, outputStream* st); |
duke@435 | 395 | static void print(Handle throwable, outputStream* st); |
duke@435 | 396 | static void print_stack_trace(oop throwable, outputStream* st); |
duke@435 | 397 | // Debugging |
duke@435 | 398 | friend class JavaClasses; |
duke@435 | 399 | }; |
duke@435 | 400 | |
duke@435 | 401 | |
duke@435 | 402 | // Interface to java.lang.reflect.AccessibleObject objects |
duke@435 | 403 | |
duke@435 | 404 | class java_lang_reflect_AccessibleObject: AllStatic { |
duke@435 | 405 | private: |
duke@435 | 406 | // Note that to reduce dependencies on the JDK we compute these |
duke@435 | 407 | // offsets at run-time. |
duke@435 | 408 | static int override_offset; |
duke@435 | 409 | |
duke@435 | 410 | static void compute_offsets(); |
duke@435 | 411 | |
duke@435 | 412 | public: |
duke@435 | 413 | // Accessors |
duke@435 | 414 | static jboolean override(oop reflect); |
duke@435 | 415 | static void set_override(oop reflect, jboolean value); |
duke@435 | 416 | |
duke@435 | 417 | // Debugging |
duke@435 | 418 | friend class JavaClasses; |
duke@435 | 419 | }; |
duke@435 | 420 | |
duke@435 | 421 | |
duke@435 | 422 | // Interface to java.lang.reflect.Method objects |
duke@435 | 423 | |
duke@435 | 424 | class java_lang_reflect_Method : public java_lang_reflect_AccessibleObject { |
duke@435 | 425 | private: |
duke@435 | 426 | // Note that to reduce dependencies on the JDK we compute these |
duke@435 | 427 | // offsets at run-time. |
duke@435 | 428 | static int clazz_offset; |
duke@435 | 429 | static int name_offset; |
duke@435 | 430 | static int returnType_offset; |
duke@435 | 431 | static int parameterTypes_offset; |
duke@435 | 432 | static int exceptionTypes_offset; |
duke@435 | 433 | static int slot_offset; |
duke@435 | 434 | static int modifiers_offset; |
duke@435 | 435 | static int signature_offset; |
duke@435 | 436 | static int annotations_offset; |
duke@435 | 437 | static int parameter_annotations_offset; |
duke@435 | 438 | static int annotation_default_offset; |
duke@435 | 439 | |
duke@435 | 440 | static void compute_offsets(); |
duke@435 | 441 | |
duke@435 | 442 | public: |
duke@435 | 443 | // Allocation |
duke@435 | 444 | static Handle create(TRAPS); |
duke@435 | 445 | |
duke@435 | 446 | // Accessors |
duke@435 | 447 | static oop clazz(oop reflect); |
duke@435 | 448 | static void set_clazz(oop reflect, oop value); |
duke@435 | 449 | |
duke@435 | 450 | static oop name(oop method); |
duke@435 | 451 | static void set_name(oop method, oop value); |
duke@435 | 452 | |
duke@435 | 453 | static oop return_type(oop method); |
duke@435 | 454 | static void set_return_type(oop method, oop value); |
duke@435 | 455 | |
duke@435 | 456 | static oop parameter_types(oop method); |
duke@435 | 457 | static void set_parameter_types(oop method, oop value); |
duke@435 | 458 | |
duke@435 | 459 | static oop exception_types(oop method); |
duke@435 | 460 | static void set_exception_types(oop method, oop value); |
duke@435 | 461 | |
duke@435 | 462 | static int slot(oop reflect); |
duke@435 | 463 | static void set_slot(oop reflect, int value); |
duke@435 | 464 | |
duke@435 | 465 | static int modifiers(oop method); |
duke@435 | 466 | static void set_modifiers(oop method, int value); |
duke@435 | 467 | |
duke@435 | 468 | static bool has_signature_field(); |
duke@435 | 469 | static oop signature(oop method); |
duke@435 | 470 | static void set_signature(oop method, oop value); |
duke@435 | 471 | |
duke@435 | 472 | static bool has_annotations_field(); |
duke@435 | 473 | static oop annotations(oop method); |
duke@435 | 474 | static void set_annotations(oop method, oop value); |
duke@435 | 475 | |
duke@435 | 476 | static bool has_parameter_annotations_field(); |
duke@435 | 477 | static oop parameter_annotations(oop method); |
duke@435 | 478 | static void set_parameter_annotations(oop method, oop value); |
duke@435 | 479 | |
duke@435 | 480 | static bool has_annotation_default_field(); |
duke@435 | 481 | static oop annotation_default(oop method); |
duke@435 | 482 | static void set_annotation_default(oop method, oop value); |
duke@435 | 483 | |
duke@435 | 484 | // Debugging |
duke@435 | 485 | friend class JavaClasses; |
duke@435 | 486 | }; |
duke@435 | 487 | |
duke@435 | 488 | |
duke@435 | 489 | // Interface to java.lang.reflect.Constructor objects |
duke@435 | 490 | |
duke@435 | 491 | class java_lang_reflect_Constructor : public java_lang_reflect_AccessibleObject { |
duke@435 | 492 | private: |
duke@435 | 493 | // Note that to reduce dependencies on the JDK we compute these |
duke@435 | 494 | // offsets at run-time. |
duke@435 | 495 | static int clazz_offset; |
duke@435 | 496 | static int parameterTypes_offset; |
duke@435 | 497 | static int exceptionTypes_offset; |
duke@435 | 498 | static int slot_offset; |
duke@435 | 499 | static int modifiers_offset; |
duke@435 | 500 | static int signature_offset; |
duke@435 | 501 | static int annotations_offset; |
duke@435 | 502 | static int parameter_annotations_offset; |
duke@435 | 503 | |
duke@435 | 504 | static void compute_offsets(); |
duke@435 | 505 | |
duke@435 | 506 | public: |
duke@435 | 507 | // Allocation |
duke@435 | 508 | static Handle create(TRAPS); |
duke@435 | 509 | |
duke@435 | 510 | // Accessors |
duke@435 | 511 | static oop clazz(oop reflect); |
duke@435 | 512 | static void set_clazz(oop reflect, oop value); |
duke@435 | 513 | |
duke@435 | 514 | static oop parameter_types(oop constructor); |
duke@435 | 515 | static void set_parameter_types(oop constructor, oop value); |
duke@435 | 516 | |
duke@435 | 517 | static oop exception_types(oop constructor); |
duke@435 | 518 | static void set_exception_types(oop constructor, oop value); |
duke@435 | 519 | |
duke@435 | 520 | static int slot(oop reflect); |
duke@435 | 521 | static void set_slot(oop reflect, int value); |
duke@435 | 522 | |
duke@435 | 523 | static int modifiers(oop constructor); |
duke@435 | 524 | static void set_modifiers(oop constructor, int value); |
duke@435 | 525 | |
duke@435 | 526 | static bool has_signature_field(); |
duke@435 | 527 | static oop signature(oop constructor); |
duke@435 | 528 | static void set_signature(oop constructor, oop value); |
duke@435 | 529 | |
duke@435 | 530 | static bool has_annotations_field(); |
duke@435 | 531 | static oop annotations(oop constructor); |
duke@435 | 532 | static void set_annotations(oop constructor, oop value); |
duke@435 | 533 | |
duke@435 | 534 | static bool has_parameter_annotations_field(); |
duke@435 | 535 | static oop parameter_annotations(oop method); |
duke@435 | 536 | static void set_parameter_annotations(oop method, oop value); |
duke@435 | 537 | |
duke@435 | 538 | // Debugging |
duke@435 | 539 | friend class JavaClasses; |
duke@435 | 540 | }; |
duke@435 | 541 | |
duke@435 | 542 | |
duke@435 | 543 | // Interface to java.lang.reflect.Field objects |
duke@435 | 544 | |
duke@435 | 545 | class java_lang_reflect_Field : public java_lang_reflect_AccessibleObject { |
duke@435 | 546 | private: |
duke@435 | 547 | // Note that to reduce dependencies on the JDK we compute these |
duke@435 | 548 | // offsets at run-time. |
duke@435 | 549 | static int clazz_offset; |
duke@435 | 550 | static int name_offset; |
duke@435 | 551 | static int type_offset; |
duke@435 | 552 | static int slot_offset; |
duke@435 | 553 | static int modifiers_offset; |
duke@435 | 554 | static int signature_offset; |
duke@435 | 555 | static int annotations_offset; |
duke@435 | 556 | |
duke@435 | 557 | static void compute_offsets(); |
duke@435 | 558 | |
duke@435 | 559 | public: |
duke@435 | 560 | // Allocation |
duke@435 | 561 | static Handle create(TRAPS); |
duke@435 | 562 | |
duke@435 | 563 | // Accessors |
duke@435 | 564 | static oop clazz(oop reflect); |
duke@435 | 565 | static void set_clazz(oop reflect, oop value); |
duke@435 | 566 | |
duke@435 | 567 | static oop name(oop field); |
duke@435 | 568 | static void set_name(oop field, oop value); |
duke@435 | 569 | |
duke@435 | 570 | static oop type(oop field); |
duke@435 | 571 | static void set_type(oop field, oop value); |
duke@435 | 572 | |
duke@435 | 573 | static int slot(oop reflect); |
duke@435 | 574 | static void set_slot(oop reflect, int value); |
duke@435 | 575 | |
duke@435 | 576 | static int modifiers(oop field); |
duke@435 | 577 | static void set_modifiers(oop field, int value); |
duke@435 | 578 | |
duke@435 | 579 | static bool has_signature_field(); |
duke@435 | 580 | static oop signature(oop constructor); |
duke@435 | 581 | static void set_signature(oop constructor, oop value); |
duke@435 | 582 | |
duke@435 | 583 | static bool has_annotations_field(); |
duke@435 | 584 | static oop annotations(oop constructor); |
duke@435 | 585 | static void set_annotations(oop constructor, oop value); |
duke@435 | 586 | |
duke@435 | 587 | static bool has_parameter_annotations_field(); |
duke@435 | 588 | static oop parameter_annotations(oop method); |
duke@435 | 589 | static void set_parameter_annotations(oop method, oop value); |
duke@435 | 590 | |
duke@435 | 591 | static bool has_annotation_default_field(); |
duke@435 | 592 | static oop annotation_default(oop method); |
duke@435 | 593 | static void set_annotation_default(oop method, oop value); |
duke@435 | 594 | |
duke@435 | 595 | // Debugging |
duke@435 | 596 | friend class JavaClasses; |
duke@435 | 597 | }; |
duke@435 | 598 | |
duke@435 | 599 | // Interface to sun.reflect.ConstantPool objects |
duke@435 | 600 | class sun_reflect_ConstantPool { |
duke@435 | 601 | private: |
duke@435 | 602 | // Note that to reduce dependencies on the JDK we compute these |
duke@435 | 603 | // offsets at run-time. |
duke@435 | 604 | static int _cp_oop_offset; |
duke@435 | 605 | |
duke@435 | 606 | static void compute_offsets(); |
duke@435 | 607 | |
duke@435 | 608 | public: |
duke@435 | 609 | // Allocation |
duke@435 | 610 | static Handle create(TRAPS); |
duke@435 | 611 | |
duke@435 | 612 | // Accessors |
duke@435 | 613 | static oop cp_oop(oop reflect); |
duke@435 | 614 | static void set_cp_oop(oop reflect, oop value); |
duke@435 | 615 | static int cp_oop_offset() { |
duke@435 | 616 | return _cp_oop_offset; |
duke@435 | 617 | } |
duke@435 | 618 | |
duke@435 | 619 | // Debugging |
duke@435 | 620 | friend class JavaClasses; |
duke@435 | 621 | }; |
duke@435 | 622 | |
duke@435 | 623 | // Interface to sun.reflect.UnsafeStaticFieldAccessorImpl objects |
duke@435 | 624 | class sun_reflect_UnsafeStaticFieldAccessorImpl { |
duke@435 | 625 | private: |
duke@435 | 626 | static int _base_offset; |
duke@435 | 627 | static void compute_offsets(); |
duke@435 | 628 | |
duke@435 | 629 | public: |
duke@435 | 630 | static int base_offset() { |
duke@435 | 631 | return _base_offset; |
duke@435 | 632 | } |
duke@435 | 633 | |
duke@435 | 634 | // Debugging |
duke@435 | 635 | friend class JavaClasses; |
duke@435 | 636 | }; |
duke@435 | 637 | |
duke@435 | 638 | // Interface to java.lang primitive type boxing objects: |
duke@435 | 639 | // - java.lang.Boolean |
duke@435 | 640 | // - java.lang.Character |
duke@435 | 641 | // - java.lang.Float |
duke@435 | 642 | // - java.lang.Double |
duke@435 | 643 | // - java.lang.Byte |
duke@435 | 644 | // - java.lang.Short |
duke@435 | 645 | // - java.lang.Integer |
duke@435 | 646 | // - java.lang.Long |
duke@435 | 647 | |
duke@435 | 648 | // This could be separated out into 8 individual classes. |
duke@435 | 649 | |
duke@435 | 650 | class java_lang_boxing_object: AllStatic { |
duke@435 | 651 | private: |
duke@435 | 652 | enum { |
duke@435 | 653 | hc_value_offset = 0 |
duke@435 | 654 | }; |
duke@435 | 655 | static int value_offset; |
kvn@600 | 656 | static int long_value_offset; |
duke@435 | 657 | |
jrose@567 | 658 | static oop initialize_and_allocate(BasicType type, TRAPS); |
duke@435 | 659 | public: |
duke@435 | 660 | // Allocation. Returns a boxed value, or NULL for invalid type. |
duke@435 | 661 | static oop create(BasicType type, jvalue* value, TRAPS); |
duke@435 | 662 | // Accessors. Returns the basic type being boxed, or T_ILLEGAL for invalid oop. |
duke@435 | 663 | static BasicType get_value(oop box, jvalue* value); |
duke@435 | 664 | static BasicType set_value(oop box, jvalue* value); |
jrose@567 | 665 | static BasicType basic_type(oop box); |
jrose@567 | 666 | static bool is_instance(oop box) { return basic_type(box) != T_ILLEGAL; } |
jrose@567 | 667 | static bool is_instance(oop box, BasicType type) { return basic_type(box) == type; } |
duke@435 | 668 | |
kvn@600 | 669 | static int value_offset_in_bytes(BasicType type) { |
kvn@600 | 670 | return ( type == T_LONG || type == T_DOUBLE ) ? long_value_offset : |
kvn@600 | 671 | value_offset; |
kvn@600 | 672 | } |
duke@435 | 673 | |
duke@435 | 674 | // Debugging |
duke@435 | 675 | friend class JavaClasses; |
duke@435 | 676 | }; |
duke@435 | 677 | |
duke@435 | 678 | |
duke@435 | 679 | |
duke@435 | 680 | // Interface to java.lang.ref.Reference objects |
duke@435 | 681 | |
duke@435 | 682 | class java_lang_ref_Reference: AllStatic { |
duke@435 | 683 | public: |
duke@435 | 684 | enum { |
duke@435 | 685 | hc_referent_offset = 0, |
duke@435 | 686 | hc_queue_offset = 1, |
duke@435 | 687 | hc_next_offset = 2, |
duke@435 | 688 | hc_discovered_offset = 3 // Is not last, see SoftRefs. |
duke@435 | 689 | }; |
duke@435 | 690 | enum { |
duke@435 | 691 | hc_static_lock_offset = 0, |
duke@435 | 692 | hc_static_pending_offset = 1 |
duke@435 | 693 | }; |
duke@435 | 694 | |
duke@435 | 695 | static int referent_offset; |
duke@435 | 696 | static int queue_offset; |
duke@435 | 697 | static int next_offset; |
duke@435 | 698 | static int discovered_offset; |
duke@435 | 699 | static int static_lock_offset; |
duke@435 | 700 | static int static_pending_offset; |
duke@435 | 701 | static int number_of_fake_oop_fields; |
duke@435 | 702 | |
duke@435 | 703 | // Accessors |
coleenp@548 | 704 | static oop referent(oop ref) { |
coleenp@548 | 705 | return ref->obj_field(referent_offset); |
coleenp@548 | 706 | } |
coleenp@548 | 707 | static void set_referent(oop ref, oop value) { |
coleenp@548 | 708 | ref->obj_field_put(referent_offset, value); |
coleenp@548 | 709 | } |
coleenp@548 | 710 | static void set_referent_raw(oop ref, oop value) { |
coleenp@548 | 711 | ref->obj_field_raw_put(referent_offset, value); |
coleenp@548 | 712 | } |
coleenp@548 | 713 | static HeapWord* referent_addr(oop ref) { |
coleenp@548 | 714 | return ref->obj_field_addr<HeapWord>(referent_offset); |
coleenp@548 | 715 | } |
coleenp@548 | 716 | static oop next(oop ref) { |
coleenp@548 | 717 | return ref->obj_field(next_offset); |
coleenp@548 | 718 | } |
coleenp@548 | 719 | static void set_next(oop ref, oop value) { |
coleenp@548 | 720 | ref->obj_field_put(next_offset, value); |
coleenp@548 | 721 | } |
coleenp@548 | 722 | static void set_next_raw(oop ref, oop value) { |
coleenp@548 | 723 | ref->obj_field_raw_put(next_offset, value); |
coleenp@548 | 724 | } |
coleenp@548 | 725 | static HeapWord* next_addr(oop ref) { |
coleenp@548 | 726 | return ref->obj_field_addr<HeapWord>(next_offset); |
coleenp@548 | 727 | } |
coleenp@548 | 728 | static oop discovered(oop ref) { |
coleenp@548 | 729 | return ref->obj_field(discovered_offset); |
coleenp@548 | 730 | } |
coleenp@548 | 731 | static void set_discovered(oop ref, oop value) { |
coleenp@548 | 732 | ref->obj_field_put(discovered_offset, value); |
coleenp@548 | 733 | } |
coleenp@548 | 734 | static void set_discovered_raw(oop ref, oop value) { |
coleenp@548 | 735 | ref->obj_field_raw_put(discovered_offset, value); |
coleenp@548 | 736 | } |
coleenp@548 | 737 | static HeapWord* discovered_addr(oop ref) { |
coleenp@548 | 738 | return ref->obj_field_addr<HeapWord>(discovered_offset); |
coleenp@548 | 739 | } |
coleenp@548 | 740 | // Accessors for statics |
coleenp@548 | 741 | static oop pending_list_lock(); |
coleenp@548 | 742 | static oop pending_list(); |
duke@435 | 743 | |
coleenp@548 | 744 | static HeapWord* pending_list_addr(); |
duke@435 | 745 | }; |
duke@435 | 746 | |
duke@435 | 747 | |
duke@435 | 748 | // Interface to java.lang.ref.SoftReference objects |
duke@435 | 749 | |
duke@435 | 750 | class java_lang_ref_SoftReference: public java_lang_ref_Reference { |
duke@435 | 751 | public: |
duke@435 | 752 | enum { |
duke@435 | 753 | // The timestamp is a long field and may need to be adjusted for alignment. |
kvn@600 | 754 | hc_timestamp_offset = hc_discovered_offset + 1 |
duke@435 | 755 | }; |
duke@435 | 756 | enum { |
duke@435 | 757 | hc_static_clock_offset = 0 |
duke@435 | 758 | }; |
duke@435 | 759 | |
duke@435 | 760 | static int timestamp_offset; |
duke@435 | 761 | static int static_clock_offset; |
duke@435 | 762 | |
duke@435 | 763 | // Accessors |
duke@435 | 764 | static jlong timestamp(oop ref); |
duke@435 | 765 | |
duke@435 | 766 | // Accessors for statics |
duke@435 | 767 | static jlong clock(); |
duke@435 | 768 | static void set_clock(jlong value); |
duke@435 | 769 | }; |
duke@435 | 770 | |
duke@435 | 771 | |
duke@435 | 772 | // Interface to java.security.AccessControlContext objects |
duke@435 | 773 | |
duke@435 | 774 | class java_security_AccessControlContext: AllStatic { |
duke@435 | 775 | private: |
duke@435 | 776 | // Note that for this class the layout changed between JDK1.2 and JDK1.3, |
duke@435 | 777 | // so we compute the offsets at startup rather than hard-wiring them. |
duke@435 | 778 | static int _context_offset; |
duke@435 | 779 | static int _privilegedContext_offset; |
duke@435 | 780 | static int _isPrivileged_offset; |
duke@435 | 781 | |
duke@435 | 782 | static void compute_offsets(); |
duke@435 | 783 | public: |
duke@435 | 784 | static oop create(objArrayHandle context, bool isPrivileged, Handle privileged_context, TRAPS); |
duke@435 | 785 | |
duke@435 | 786 | // Debugging/initialization |
duke@435 | 787 | friend class JavaClasses; |
duke@435 | 788 | }; |
duke@435 | 789 | |
duke@435 | 790 | |
duke@435 | 791 | // Interface to java.lang.ClassLoader objects |
duke@435 | 792 | |
duke@435 | 793 | class java_lang_ClassLoader : AllStatic { |
duke@435 | 794 | private: |
duke@435 | 795 | enum { |
duke@435 | 796 | hc_parent_offset = 0 |
duke@435 | 797 | }; |
duke@435 | 798 | |
duke@435 | 799 | static int parent_offset; |
duke@435 | 800 | |
duke@435 | 801 | public: |
duke@435 | 802 | static oop parent(oop loader); |
duke@435 | 803 | |
duke@435 | 804 | static bool is_trusted_loader(oop loader); |
duke@435 | 805 | |
duke@435 | 806 | // Fix for 4474172 |
duke@435 | 807 | static oop non_reflection_class_loader(oop loader); |
duke@435 | 808 | |
duke@435 | 809 | // Debugging |
duke@435 | 810 | friend class JavaClasses; |
duke@435 | 811 | }; |
duke@435 | 812 | |
duke@435 | 813 | |
duke@435 | 814 | // Interface to java.lang.System objects |
duke@435 | 815 | |
duke@435 | 816 | class java_lang_System : AllStatic { |
duke@435 | 817 | private: |
duke@435 | 818 | enum { |
duke@435 | 819 | hc_static_in_offset = 0, |
duke@435 | 820 | hc_static_out_offset = 1, |
duke@435 | 821 | hc_static_err_offset = 2 |
duke@435 | 822 | }; |
duke@435 | 823 | |
duke@435 | 824 | static int offset_of_static_fields; |
duke@435 | 825 | static int static_in_offset; |
duke@435 | 826 | static int static_out_offset; |
duke@435 | 827 | static int static_err_offset; |
duke@435 | 828 | |
duke@435 | 829 | static void compute_offsets(); |
duke@435 | 830 | |
duke@435 | 831 | public: |
duke@435 | 832 | static int in_offset_in_bytes(); |
duke@435 | 833 | static int out_offset_in_bytes(); |
duke@435 | 834 | static int err_offset_in_bytes(); |
duke@435 | 835 | |
duke@435 | 836 | // Debugging |
duke@435 | 837 | friend class JavaClasses; |
duke@435 | 838 | }; |
duke@435 | 839 | |
duke@435 | 840 | |
duke@435 | 841 | // Interface to java.lang.StackTraceElement objects |
duke@435 | 842 | |
duke@435 | 843 | class java_lang_StackTraceElement: AllStatic { |
duke@435 | 844 | private: |
duke@435 | 845 | enum { |
duke@435 | 846 | hc_declaringClass_offset = 0, |
duke@435 | 847 | hc_methodName_offset = 1, |
duke@435 | 848 | hc_fileName_offset = 2, |
duke@435 | 849 | hc_lineNumber_offset = 3 |
duke@435 | 850 | }; |
duke@435 | 851 | |
duke@435 | 852 | static int declaringClass_offset; |
duke@435 | 853 | static int methodName_offset; |
duke@435 | 854 | static int fileName_offset; |
duke@435 | 855 | static int lineNumber_offset; |
duke@435 | 856 | |
duke@435 | 857 | public: |
duke@435 | 858 | // Setters |
duke@435 | 859 | static void set_declaringClass(oop element, oop value); |
duke@435 | 860 | static void set_methodName(oop element, oop value); |
duke@435 | 861 | static void set_fileName(oop element, oop value); |
duke@435 | 862 | static void set_lineNumber(oop element, int value); |
duke@435 | 863 | |
duke@435 | 864 | // Create an instance of StackTraceElement |
duke@435 | 865 | static oop create(methodHandle m, int bci, TRAPS); |
duke@435 | 866 | |
duke@435 | 867 | // Debugging |
duke@435 | 868 | friend class JavaClasses; |
duke@435 | 869 | }; |
duke@435 | 870 | |
duke@435 | 871 | |
duke@435 | 872 | // Interface to java.lang.AssertionStatusDirectives objects |
duke@435 | 873 | |
duke@435 | 874 | class java_lang_AssertionStatusDirectives: AllStatic { |
duke@435 | 875 | private: |
duke@435 | 876 | enum { |
duke@435 | 877 | hc_classes_offset, |
duke@435 | 878 | hc_classEnabled_offset, |
duke@435 | 879 | hc_packages_offset, |
duke@435 | 880 | hc_packageEnabled_offset, |
duke@435 | 881 | hc_deflt_offset |
duke@435 | 882 | }; |
duke@435 | 883 | |
duke@435 | 884 | static int classes_offset; |
duke@435 | 885 | static int classEnabled_offset; |
duke@435 | 886 | static int packages_offset; |
duke@435 | 887 | static int packageEnabled_offset; |
duke@435 | 888 | static int deflt_offset; |
duke@435 | 889 | |
duke@435 | 890 | public: |
duke@435 | 891 | // Setters |
duke@435 | 892 | static void set_classes(oop obj, oop val); |
duke@435 | 893 | static void set_classEnabled(oop obj, oop val); |
duke@435 | 894 | static void set_packages(oop obj, oop val); |
duke@435 | 895 | static void set_packageEnabled(oop obj, oop val); |
duke@435 | 896 | static void set_deflt(oop obj, bool val); |
duke@435 | 897 | // Debugging |
duke@435 | 898 | friend class JavaClasses; |
duke@435 | 899 | }; |
duke@435 | 900 | |
duke@435 | 901 | |
duke@435 | 902 | class java_nio_Buffer: AllStatic { |
duke@435 | 903 | private: |
duke@435 | 904 | static int _limit_offset; |
duke@435 | 905 | |
duke@435 | 906 | public: |
duke@435 | 907 | static int limit_offset(); |
duke@435 | 908 | static void compute_offsets(); |
duke@435 | 909 | }; |
duke@435 | 910 | |
duke@435 | 911 | class sun_misc_AtomicLongCSImpl: AllStatic { |
duke@435 | 912 | private: |
duke@435 | 913 | static int _value_offset; |
duke@435 | 914 | |
duke@435 | 915 | public: |
duke@435 | 916 | static int value_offset(); |
duke@435 | 917 | static void compute_offsets(); |
duke@435 | 918 | }; |
duke@435 | 919 | |
duke@435 | 920 | class java_util_concurrent_locks_AbstractOwnableSynchronizer : AllStatic { |
duke@435 | 921 | private: |
duke@435 | 922 | static int _owner_offset; |
duke@435 | 923 | public: |
duke@435 | 924 | static void initialize(TRAPS); |
duke@435 | 925 | static oop get_owner_threadObj(oop obj); |
duke@435 | 926 | }; |
duke@435 | 927 | |
duke@435 | 928 | // Interface to hard-coded offset checking |
duke@435 | 929 | |
duke@435 | 930 | class JavaClasses : AllStatic { |
duke@435 | 931 | private: |
duke@435 | 932 | static bool check_offset(const char *klass_name, int offset, const char *field_name, const char* field_sig) PRODUCT_RETURN0; |
duke@435 | 933 | static bool check_static_offset(const char *klass_name, int hardcoded_offset, const char *field_name, const char* field_sig) PRODUCT_RETURN0; |
jrose@567 | 934 | static bool check_constant(const char *klass_name, int constant, const char *field_name, const char* field_sig) PRODUCT_RETURN0; |
duke@435 | 935 | public: |
duke@435 | 936 | static void compute_hard_coded_offsets(); |
duke@435 | 937 | static void compute_offsets(); |
duke@435 | 938 | static void check_offsets() PRODUCT_RETURN; |
duke@435 | 939 | }; |