Fri, 18 Mar 2011 16:00:34 -0700
7017732: move static fields into Class to prepare for perm gen removal
Reviewed-by: kvn, coleenp, twisti, stefank
duke@435 | 1 | /* |
jrose@2639 | 2 | * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 | * |
trims@1907 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 20 | * or visit www.oracle.com if you need additional information or have any |
trims@1907 | 21 | * questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
stefank@2314 | 25 | #ifndef SHARE_VM_CLASSFILE_JAVACLASSES_HPP |
stefank@2314 | 26 | #define SHARE_VM_CLASSFILE_JAVACLASSES_HPP |
stefank@2314 | 27 | |
stefank@2314 | 28 | #include "classfile/systemDictionary.hpp" |
stefank@2314 | 29 | #include "jvmtifiles/jvmti.h" |
stefank@2314 | 30 | #include "oops/oop.hpp" |
stefank@2314 | 31 | #include "runtime/os.hpp" |
stefank@2314 | 32 | #include "utilities/utf8.hpp" |
stefank@2314 | 33 | |
duke@435 | 34 | // Interface for manipulating the basic Java classes. |
duke@435 | 35 | // |
duke@435 | 36 | // All dependencies on layout of actual Java classes should be kept here. |
duke@435 | 37 | // If the layout of any of the classes above changes the offsets must be adjusted. |
duke@435 | 38 | // |
duke@435 | 39 | // For most classes we hardwire the offsets for performance reasons. In certain |
duke@435 | 40 | // cases (e.g. java.security.AccessControlContext) we compute the offsets at |
duke@435 | 41 | // startup since the layout here differs between JDK1.2 and JDK1.3. |
duke@435 | 42 | // |
duke@435 | 43 | // Note that fields (static and non-static) are arranged with oops before non-oops |
duke@435 | 44 | // on a per class basis. The offsets below have to reflect this ordering. |
duke@435 | 45 | // |
duke@435 | 46 | // When editing the layouts please update the check_offset verification code |
duke@435 | 47 | // correspondingly. The names in the enums must be identical to the actual field |
duke@435 | 48 | // names in order for the verification code to work. |
duke@435 | 49 | |
duke@435 | 50 | |
duke@435 | 51 | // Interface to java.lang.String objects |
duke@435 | 52 | |
duke@435 | 53 | class java_lang_String : AllStatic { |
duke@435 | 54 | private: |
duke@435 | 55 | enum { |
duke@435 | 56 | hc_value_offset = 0, |
jrose@567 | 57 | hc_offset_offset = 1 |
jrose@567 | 58 | //hc_count_offset = 2 -- not a word-scaled offset |
jrose@567 | 59 | //hc_hash_offset = 3 -- not a word-scaled offset |
duke@435 | 60 | }; |
duke@435 | 61 | |
duke@435 | 62 | static int value_offset; |
duke@435 | 63 | static int offset_offset; |
duke@435 | 64 | static int count_offset; |
duke@435 | 65 | static int hash_offset; |
duke@435 | 66 | |
duke@435 | 67 | static Handle basic_create(int length, bool tenured, TRAPS); |
duke@435 | 68 | static Handle basic_create_from_unicode(jchar* unicode, int length, bool tenured, TRAPS); |
duke@435 | 69 | |
duke@435 | 70 | static void set_value( oop string, typeArrayOop buffer) { string->obj_field_put(value_offset, (oop)buffer); } |
duke@435 | 71 | static void set_offset(oop string, int offset) { string->int_field_put(offset_offset, offset); } |
duke@435 | 72 | static void set_count( oop string, int count) { string->int_field_put(count_offset, count); } |
duke@435 | 73 | |
duke@435 | 74 | public: |
duke@435 | 75 | // Instance creation |
duke@435 | 76 | static Handle create_from_unicode(jchar* unicode, int len, TRAPS); |
duke@435 | 77 | static Handle create_tenured_from_unicode(jchar* unicode, int len, TRAPS); |
duke@435 | 78 | static oop create_oop_from_unicode(jchar* unicode, int len, TRAPS); |
duke@435 | 79 | static Handle create_from_str(const char* utf8_str, TRAPS); |
duke@435 | 80 | static oop create_oop_from_str(const char* utf8_str, TRAPS); |
coleenp@2497 | 81 | static Handle create_from_symbol(Symbol* symbol, TRAPS); |
duke@435 | 82 | static Handle create_from_platform_dependent_str(const char* str, TRAPS); |
duke@435 | 83 | static Handle char_converter(Handle java_string, jchar from_char, jchar to_char, TRAPS); |
duke@435 | 84 | |
duke@435 | 85 | static int value_offset_in_bytes() { return value_offset; } |
duke@435 | 86 | static int count_offset_in_bytes() { return count_offset; } |
duke@435 | 87 | static int offset_offset_in_bytes() { return offset_offset; } |
duke@435 | 88 | static int hash_offset_in_bytes() { return hash_offset; } |
duke@435 | 89 | |
duke@435 | 90 | // Accessors |
duke@435 | 91 | static typeArrayOop value(oop java_string) { |
duke@435 | 92 | assert(is_instance(java_string), "must be java_string"); |
duke@435 | 93 | return (typeArrayOop) java_string->obj_field(value_offset); |
duke@435 | 94 | } |
duke@435 | 95 | static int offset(oop java_string) { |
duke@435 | 96 | assert(is_instance(java_string), "must be java_string"); |
duke@435 | 97 | return java_string->int_field(offset_offset); |
duke@435 | 98 | } |
duke@435 | 99 | static int length(oop java_string) { |
duke@435 | 100 | assert(is_instance(java_string), "must be java_string"); |
duke@435 | 101 | return java_string->int_field(count_offset); |
duke@435 | 102 | } |
duke@435 | 103 | static int utf8_length(oop java_string); |
duke@435 | 104 | |
duke@435 | 105 | // String converters |
duke@435 | 106 | static char* as_utf8_string(oop java_string); |
sla@2331 | 107 | static char* as_utf8_string(oop java_string, char* buf, int buflen); |
duke@435 | 108 | static char* as_utf8_string(oop java_string, int start, int len); |
coleenp@457 | 109 | static char* as_platform_dependent_str(Handle java_string, TRAPS); |
duke@435 | 110 | static jchar* as_unicode_string(oop java_string, int& length); |
duke@435 | 111 | |
duke@435 | 112 | static bool equals(oop java_string, jchar* chars, int len); |
duke@435 | 113 | |
duke@435 | 114 | // Conversion between '.' and '/' formats |
duke@435 | 115 | static Handle externalize_classname(Handle java_string, TRAPS) { return char_converter(java_string, '/', '.', THREAD); } |
duke@435 | 116 | static Handle internalize_classname(Handle java_string, TRAPS) { return char_converter(java_string, '.', '/', THREAD); } |
duke@435 | 117 | |
duke@435 | 118 | // Conversion |
coleenp@2497 | 119 | static Symbol* as_symbol(Handle java_string, TRAPS); |
coleenp@2497 | 120 | static Symbol* as_symbol_or_null(oop java_string); |
duke@435 | 121 | |
duke@435 | 122 | // Testers |
duke@435 | 123 | static bool is_instance(oop obj) { |
never@1577 | 124 | return obj != NULL && obj->klass() == SystemDictionary::String_klass(); |
duke@435 | 125 | } |
duke@435 | 126 | |
duke@435 | 127 | // Debugging |
duke@435 | 128 | static void print(Handle java_string, outputStream* st); |
duke@435 | 129 | friend class JavaClasses; |
duke@435 | 130 | }; |
duke@435 | 131 | |
duke@435 | 132 | |
duke@435 | 133 | // Interface to java.lang.Class objects |
duke@435 | 134 | |
duke@435 | 135 | class java_lang_Class : AllStatic { |
duke@435 | 136 | friend class VMStructs; |
duke@435 | 137 | private: |
duke@435 | 138 | // The fake offsets are added by the class loader when java.lang.Class is loaded |
duke@435 | 139 | |
duke@435 | 140 | enum { |
never@2658 | 141 | hc_number_of_fake_oop_fields = 3, |
never@2658 | 142 | hc_number_of_fake_int_fields = 2 |
duke@435 | 143 | }; |
duke@435 | 144 | |
duke@435 | 145 | static int klass_offset; |
duke@435 | 146 | static int resolved_constructor_offset; |
duke@435 | 147 | static int array_klass_offset; |
duke@435 | 148 | static int number_of_fake_oop_fields; |
duke@435 | 149 | |
never@2658 | 150 | static int oop_size_offset; |
never@2658 | 151 | static int static_oop_field_count_offset; |
never@2658 | 152 | |
duke@435 | 153 | static void compute_offsets(); |
duke@435 | 154 | static bool offsets_computed; |
duke@435 | 155 | static int classRedefinedCount_offset; |
acorn@949 | 156 | static int parallelCapable_offset; |
duke@435 | 157 | |
duke@435 | 158 | public: |
duke@435 | 159 | // Instance creation |
duke@435 | 160 | static oop create_mirror(KlassHandle k, TRAPS); |
never@2658 | 161 | static void fixup_mirror(KlassHandle k, TRAPS); |
duke@435 | 162 | static oop create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS); |
duke@435 | 163 | // Conversion |
duke@435 | 164 | static klassOop as_klassOop(oop java_class); |
jrose@1100 | 165 | static BasicType as_BasicType(oop java_class, klassOop* reference_klass = NULL); |
jrose@1145 | 166 | static BasicType as_BasicType(oop java_class, KlassHandle* reference_klass) { |
jrose@1145 | 167 | klassOop refk_oop = NULL; |
jrose@1145 | 168 | BasicType result = as_BasicType(java_class, &refk_oop); |
jrose@1145 | 169 | (*reference_klass) = KlassHandle(refk_oop); |
jrose@1145 | 170 | return result; |
jrose@1145 | 171 | } |
coleenp@2497 | 172 | static Symbol* as_signature(oop java_class, bool intern_if_not_found, TRAPS); |
jrose@1100 | 173 | static void print_signature(oop java_class, outputStream *st); |
duke@435 | 174 | // Testing |
jrose@567 | 175 | static bool is_instance(oop obj) { |
never@1577 | 176 | return obj != NULL && obj->klass() == SystemDictionary::Class_klass(); |
jrose@567 | 177 | } |
duke@435 | 178 | static bool is_primitive(oop java_class); |
duke@435 | 179 | static BasicType primitive_type(oop java_class); |
duke@435 | 180 | static oop primitive_mirror(BasicType t); |
duke@435 | 181 | // JVM_NewInstance support |
duke@435 | 182 | static methodOop resolved_constructor(oop java_class); |
duke@435 | 183 | static void set_resolved_constructor(oop java_class, methodOop constructor); |
duke@435 | 184 | // JVM_NewArray support |
duke@435 | 185 | static klassOop array_klass(oop java_class); |
duke@435 | 186 | static void set_array_klass(oop java_class, klassOop klass); |
duke@435 | 187 | // compiler support for class operations |
duke@435 | 188 | static int klass_offset_in_bytes() { return klass_offset; } |
duke@435 | 189 | static int resolved_constructor_offset_in_bytes() { return resolved_constructor_offset; } |
duke@435 | 190 | static int array_klass_offset_in_bytes() { return array_klass_offset; } |
duke@435 | 191 | // Support for classRedefinedCount field |
duke@435 | 192 | static int classRedefinedCount(oop the_class_mirror); |
duke@435 | 193 | static void set_classRedefinedCount(oop the_class_mirror, int value); |
acorn@949 | 194 | // Support for parallelCapable field |
acorn@949 | 195 | static bool parallelCapable(oop the_class_mirror); |
never@2658 | 196 | |
never@2658 | 197 | static int oop_size(oop java_class); |
never@2658 | 198 | static void set_oop_size(oop java_class, int size); |
never@2658 | 199 | static int static_oop_field_count(oop java_class); |
never@2658 | 200 | static void set_static_oop_field_count(oop java_class, int size); |
never@2658 | 201 | |
duke@435 | 202 | // Debugging |
duke@435 | 203 | friend class JavaClasses; |
duke@435 | 204 | friend class instanceKlass; // verification code accesses offsets |
duke@435 | 205 | friend class ClassFileParser; // access to number_of_fake_fields |
duke@435 | 206 | }; |
duke@435 | 207 | |
duke@435 | 208 | // Interface to java.lang.Thread objects |
duke@435 | 209 | |
duke@435 | 210 | class java_lang_Thread : AllStatic { |
duke@435 | 211 | private: |
duke@435 | 212 | // Note that for this class the layout changed between JDK1.2 and JDK1.3, |
duke@435 | 213 | // so we compute the offsets at startup rather than hard-wiring them. |
duke@435 | 214 | static int _name_offset; |
duke@435 | 215 | static int _group_offset; |
duke@435 | 216 | static int _contextClassLoader_offset; |
duke@435 | 217 | static int _inheritedAccessControlContext_offset; |
duke@435 | 218 | static int _priority_offset; |
duke@435 | 219 | static int _eetop_offset; |
duke@435 | 220 | static int _daemon_offset; |
duke@435 | 221 | static int _stillborn_offset; |
duke@435 | 222 | static int _stackSize_offset; |
duke@435 | 223 | static int _tid_offset; |
duke@435 | 224 | static int _thread_status_offset; |
duke@435 | 225 | static int _park_blocker_offset; |
duke@435 | 226 | static int _park_event_offset ; |
duke@435 | 227 | |
duke@435 | 228 | static void compute_offsets(); |
duke@435 | 229 | |
duke@435 | 230 | public: |
duke@435 | 231 | // Instance creation |
duke@435 | 232 | static oop create(); |
duke@435 | 233 | // Returns the JavaThread associated with the thread obj |
duke@435 | 234 | static JavaThread* thread(oop java_thread); |
duke@435 | 235 | // Set JavaThread for instance |
duke@435 | 236 | static void set_thread(oop java_thread, JavaThread* thread); |
duke@435 | 237 | // Name |
duke@435 | 238 | static typeArrayOop name(oop java_thread); |
duke@435 | 239 | static void set_name(oop java_thread, typeArrayOop name); |
duke@435 | 240 | // Priority |
duke@435 | 241 | static ThreadPriority priority(oop java_thread); |
duke@435 | 242 | static void set_priority(oop java_thread, ThreadPriority priority); |
duke@435 | 243 | // Thread group |
duke@435 | 244 | static oop threadGroup(oop java_thread); |
duke@435 | 245 | // Stillborn |
duke@435 | 246 | static bool is_stillborn(oop java_thread); |
duke@435 | 247 | static void set_stillborn(oop java_thread); |
duke@435 | 248 | // Alive (NOTE: this is not really a field, but provides the correct |
duke@435 | 249 | // definition without doing a Java call) |
duke@435 | 250 | static bool is_alive(oop java_thread); |
duke@435 | 251 | // Daemon |
duke@435 | 252 | static bool is_daemon(oop java_thread); |
duke@435 | 253 | static void set_daemon(oop java_thread); |
duke@435 | 254 | // Context ClassLoader |
duke@435 | 255 | static oop context_class_loader(oop java_thread); |
duke@435 | 256 | // Control context |
duke@435 | 257 | static oop inherited_access_control_context(oop java_thread); |
duke@435 | 258 | // Stack size hint |
duke@435 | 259 | static jlong stackSize(oop java_thread); |
duke@435 | 260 | // Thread ID |
duke@435 | 261 | static jlong thread_id(oop java_thread); |
duke@435 | 262 | |
duke@435 | 263 | // Blocker object responsible for thread parking |
duke@435 | 264 | static oop park_blocker(oop java_thread); |
duke@435 | 265 | |
duke@435 | 266 | // Pointer to type-stable park handler, encoded as jlong. |
duke@435 | 267 | // Should be set when apparently null |
duke@435 | 268 | // For details, see unsafe.cpp Unsafe_Unpark |
duke@435 | 269 | static jlong park_event(oop java_thread); |
duke@435 | 270 | static bool set_park_event(oop java_thread, jlong ptr); |
duke@435 | 271 | |
duke@435 | 272 | // Java Thread Status for JVMTI and M&M use. |
duke@435 | 273 | // This thread status info is saved in threadStatus field of |
duke@435 | 274 | // java.lang.Thread java class. |
duke@435 | 275 | enum ThreadStatus { |
duke@435 | 276 | NEW = 0, |
duke@435 | 277 | RUNNABLE = JVMTI_THREAD_STATE_ALIVE + // runnable / running |
duke@435 | 278 | JVMTI_THREAD_STATE_RUNNABLE, |
duke@435 | 279 | SLEEPING = JVMTI_THREAD_STATE_ALIVE + // Thread.sleep() |
duke@435 | 280 | JVMTI_THREAD_STATE_WAITING + |
duke@435 | 281 | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT + |
duke@435 | 282 | JVMTI_THREAD_STATE_SLEEPING, |
duke@435 | 283 | IN_OBJECT_WAIT = JVMTI_THREAD_STATE_ALIVE + // Object.wait() |
duke@435 | 284 | JVMTI_THREAD_STATE_WAITING + |
duke@435 | 285 | JVMTI_THREAD_STATE_WAITING_INDEFINITELY + |
duke@435 | 286 | JVMTI_THREAD_STATE_IN_OBJECT_WAIT, |
duke@435 | 287 | IN_OBJECT_WAIT_TIMED = JVMTI_THREAD_STATE_ALIVE + // Object.wait(long) |
duke@435 | 288 | JVMTI_THREAD_STATE_WAITING + |
duke@435 | 289 | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT + |
duke@435 | 290 | JVMTI_THREAD_STATE_IN_OBJECT_WAIT, |
duke@435 | 291 | PARKED = JVMTI_THREAD_STATE_ALIVE + // LockSupport.park() |
duke@435 | 292 | JVMTI_THREAD_STATE_WAITING + |
duke@435 | 293 | JVMTI_THREAD_STATE_WAITING_INDEFINITELY + |
duke@435 | 294 | JVMTI_THREAD_STATE_PARKED, |
duke@435 | 295 | PARKED_TIMED = JVMTI_THREAD_STATE_ALIVE + // LockSupport.park(long) |
duke@435 | 296 | JVMTI_THREAD_STATE_WAITING + |
duke@435 | 297 | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT + |
duke@435 | 298 | JVMTI_THREAD_STATE_PARKED, |
duke@435 | 299 | BLOCKED_ON_MONITOR_ENTER = JVMTI_THREAD_STATE_ALIVE + // (re-)entering a synchronization block |
duke@435 | 300 | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER, |
duke@435 | 301 | TERMINATED = JVMTI_THREAD_STATE_TERMINATED |
duke@435 | 302 | }; |
duke@435 | 303 | // Write thread status info to threadStatus field of java.lang.Thread. |
duke@435 | 304 | static void set_thread_status(oop java_thread_oop, ThreadStatus status); |
duke@435 | 305 | // Read thread status info from threadStatus field of java.lang.Thread. |
duke@435 | 306 | static ThreadStatus get_thread_status(oop java_thread_oop); |
duke@435 | 307 | |
duke@435 | 308 | static const char* thread_status_name(oop java_thread_oop); |
duke@435 | 309 | |
duke@435 | 310 | // Debugging |
duke@435 | 311 | friend class JavaClasses; |
duke@435 | 312 | }; |
duke@435 | 313 | |
duke@435 | 314 | // Interface to java.lang.ThreadGroup objects |
duke@435 | 315 | |
duke@435 | 316 | class java_lang_ThreadGroup : AllStatic { |
duke@435 | 317 | private: |
duke@435 | 318 | static int _parent_offset; |
duke@435 | 319 | static int _name_offset; |
duke@435 | 320 | static int _threads_offset; |
duke@435 | 321 | static int _groups_offset; |
duke@435 | 322 | static int _maxPriority_offset; |
duke@435 | 323 | static int _destroyed_offset; |
duke@435 | 324 | static int _daemon_offset; |
duke@435 | 325 | static int _vmAllowSuspension_offset; |
duke@435 | 326 | static int _nthreads_offset; |
duke@435 | 327 | static int _ngroups_offset; |
duke@435 | 328 | |
duke@435 | 329 | static void compute_offsets(); |
duke@435 | 330 | |
duke@435 | 331 | public: |
duke@435 | 332 | // parent ThreadGroup |
duke@435 | 333 | static oop parent(oop java_thread_group); |
duke@435 | 334 | // name |
duke@435 | 335 | static typeArrayOop name(oop java_thread_group); |
duke@435 | 336 | // ("name as oop" accessor is not necessary) |
duke@435 | 337 | // Number of threads in group |
duke@435 | 338 | static int nthreads(oop java_thread_group); |
duke@435 | 339 | // threads |
duke@435 | 340 | static objArrayOop threads(oop java_thread_group); |
duke@435 | 341 | // Number of threads in group |
duke@435 | 342 | static int ngroups(oop java_thread_group); |
duke@435 | 343 | // groups |
duke@435 | 344 | static objArrayOop groups(oop java_thread_group); |
duke@435 | 345 | // maxPriority in group |
duke@435 | 346 | static ThreadPriority maxPriority(oop java_thread_group); |
duke@435 | 347 | // Destroyed |
duke@435 | 348 | static bool is_destroyed(oop java_thread_group); |
duke@435 | 349 | // Daemon |
duke@435 | 350 | static bool is_daemon(oop java_thread_group); |
duke@435 | 351 | // vmAllowSuspension |
duke@435 | 352 | static bool is_vmAllowSuspension(oop java_thread_group); |
duke@435 | 353 | // Debugging |
duke@435 | 354 | friend class JavaClasses; |
duke@435 | 355 | }; |
duke@435 | 356 | |
duke@435 | 357 | |
duke@435 | 358 | |
duke@435 | 359 | // Interface to java.lang.Throwable objects |
duke@435 | 360 | |
duke@435 | 361 | class java_lang_Throwable: AllStatic { |
duke@435 | 362 | friend class BacktraceBuilder; |
duke@435 | 363 | |
duke@435 | 364 | private: |
duke@435 | 365 | // Offsets |
duke@435 | 366 | enum { |
duke@435 | 367 | hc_backtrace_offset = 0, |
duke@435 | 368 | hc_detailMessage_offset = 1, |
duke@435 | 369 | hc_cause_offset = 2, // New since 1.4 |
duke@435 | 370 | hc_stackTrace_offset = 3 // New since 1.4 |
duke@435 | 371 | }; |
duke@435 | 372 | // Trace constants |
duke@435 | 373 | enum { |
duke@435 | 374 | trace_methods_offset = 0, |
duke@435 | 375 | trace_bcis_offset = 1, |
duke@435 | 376 | trace_next_offset = 2, |
duke@435 | 377 | trace_size = 3, |
duke@435 | 378 | trace_chunk_size = 32 |
duke@435 | 379 | }; |
duke@435 | 380 | |
duke@435 | 381 | static int backtrace_offset; |
duke@435 | 382 | static int detailMessage_offset; |
duke@435 | 383 | static int cause_offset; |
duke@435 | 384 | static int stackTrace_offset; |
duke@435 | 385 | |
duke@435 | 386 | // Printing |
duke@435 | 387 | static char* print_stack_element_to_buffer(methodOop method, int bci); |
duke@435 | 388 | static void print_to_stream(Handle stream, const char* str); |
duke@435 | 389 | // StackTrace (programmatic access, new since 1.4) |
duke@435 | 390 | static void clear_stacktrace(oop throwable); |
duke@435 | 391 | // No stack trace available |
duke@435 | 392 | static const char* no_stack_trace_message(); |
duke@435 | 393 | |
duke@435 | 394 | public: |
duke@435 | 395 | // Backtrace |
duke@435 | 396 | static oop backtrace(oop throwable); |
duke@435 | 397 | static void set_backtrace(oop throwable, oop value); |
duke@435 | 398 | // Needed by JVMTI to filter out this internal field. |
duke@435 | 399 | static int get_backtrace_offset() { return backtrace_offset;} |
duke@435 | 400 | static int get_detailMessage_offset() { return detailMessage_offset;} |
duke@435 | 401 | // Message |
duke@435 | 402 | static oop message(oop throwable); |
duke@435 | 403 | static oop message(Handle throwable); |
duke@435 | 404 | static void set_message(oop throwable, oop value); |
duke@435 | 405 | // Print stack trace stored in exception by call-back to Java |
duke@435 | 406 | // Note: this is no longer used in Merlin, but we still suppport |
duke@435 | 407 | // it for compatibility. |
duke@435 | 408 | static void print_stack_trace(oop throwable, oop print_stream); |
duke@435 | 409 | static void print_stack_element(Handle stream, methodOop method, int bci); |
duke@435 | 410 | static void print_stack_element(outputStream *st, methodOop method, int bci); |
duke@435 | 411 | static void print_stack_usage(Handle stream); |
duke@435 | 412 | |
duke@435 | 413 | // Allocate space for backtrace (created but stack trace not filled in) |
duke@435 | 414 | static void allocate_backtrace(Handle throwable, TRAPS); |
duke@435 | 415 | // Fill in current stack trace for throwable with preallocated backtrace (no GC) |
duke@435 | 416 | static void fill_in_stack_trace_of_preallocated_backtrace(Handle throwable); |
duke@435 | 417 | |
duke@435 | 418 | // Fill in current stack trace, can cause GC |
duke@435 | 419 | static void fill_in_stack_trace(Handle throwable, TRAPS); |
duke@435 | 420 | static void fill_in_stack_trace(Handle throwable); |
duke@435 | 421 | // Programmatic access to stack trace |
duke@435 | 422 | static oop get_stack_trace_element(oop throwable, int index, TRAPS); |
duke@435 | 423 | static int get_stack_trace_depth(oop throwable, TRAPS); |
duke@435 | 424 | // Printing |
duke@435 | 425 | static void print(oop throwable, outputStream* st); |
duke@435 | 426 | static void print(Handle throwable, outputStream* st); |
duke@435 | 427 | static void print_stack_trace(oop throwable, outputStream* st); |
duke@435 | 428 | // Debugging |
duke@435 | 429 | friend class JavaClasses; |
duke@435 | 430 | }; |
duke@435 | 431 | |
duke@435 | 432 | |
duke@435 | 433 | // Interface to java.lang.reflect.AccessibleObject objects |
duke@435 | 434 | |
duke@435 | 435 | class java_lang_reflect_AccessibleObject: AllStatic { |
duke@435 | 436 | private: |
duke@435 | 437 | // Note that to reduce dependencies on the JDK we compute these |
duke@435 | 438 | // offsets at run-time. |
duke@435 | 439 | static int override_offset; |
duke@435 | 440 | |
duke@435 | 441 | static void compute_offsets(); |
duke@435 | 442 | |
duke@435 | 443 | public: |
duke@435 | 444 | // Accessors |
duke@435 | 445 | static jboolean override(oop reflect); |
duke@435 | 446 | static void set_override(oop reflect, jboolean value); |
duke@435 | 447 | |
duke@435 | 448 | // Debugging |
duke@435 | 449 | friend class JavaClasses; |
duke@435 | 450 | }; |
duke@435 | 451 | |
duke@435 | 452 | |
duke@435 | 453 | // Interface to java.lang.reflect.Method objects |
duke@435 | 454 | |
duke@435 | 455 | class java_lang_reflect_Method : public java_lang_reflect_AccessibleObject { |
duke@435 | 456 | private: |
duke@435 | 457 | // Note that to reduce dependencies on the JDK we compute these |
duke@435 | 458 | // offsets at run-time. |
duke@435 | 459 | static int clazz_offset; |
duke@435 | 460 | static int name_offset; |
duke@435 | 461 | static int returnType_offset; |
duke@435 | 462 | static int parameterTypes_offset; |
duke@435 | 463 | static int exceptionTypes_offset; |
duke@435 | 464 | static int slot_offset; |
duke@435 | 465 | static int modifiers_offset; |
duke@435 | 466 | static int signature_offset; |
duke@435 | 467 | static int annotations_offset; |
duke@435 | 468 | static int parameter_annotations_offset; |
duke@435 | 469 | static int annotation_default_offset; |
duke@435 | 470 | |
duke@435 | 471 | static void compute_offsets(); |
duke@435 | 472 | |
duke@435 | 473 | public: |
duke@435 | 474 | // Allocation |
duke@435 | 475 | static Handle create(TRAPS); |
duke@435 | 476 | |
duke@435 | 477 | // Accessors |
duke@435 | 478 | static oop clazz(oop reflect); |
duke@435 | 479 | static void set_clazz(oop reflect, oop value); |
duke@435 | 480 | |
duke@435 | 481 | static oop name(oop method); |
duke@435 | 482 | static void set_name(oop method, oop value); |
duke@435 | 483 | |
duke@435 | 484 | static oop return_type(oop method); |
duke@435 | 485 | static void set_return_type(oop method, oop value); |
duke@435 | 486 | |
duke@435 | 487 | static oop parameter_types(oop method); |
duke@435 | 488 | static void set_parameter_types(oop method, oop value); |
duke@435 | 489 | |
duke@435 | 490 | static oop exception_types(oop method); |
duke@435 | 491 | static void set_exception_types(oop method, oop value); |
duke@435 | 492 | |
duke@435 | 493 | static int slot(oop reflect); |
duke@435 | 494 | static void set_slot(oop reflect, int value); |
duke@435 | 495 | |
duke@435 | 496 | static int modifiers(oop method); |
duke@435 | 497 | static void set_modifiers(oop method, int value); |
duke@435 | 498 | |
duke@435 | 499 | static bool has_signature_field(); |
duke@435 | 500 | static oop signature(oop method); |
duke@435 | 501 | static void set_signature(oop method, oop value); |
duke@435 | 502 | |
duke@435 | 503 | static bool has_annotations_field(); |
duke@435 | 504 | static oop annotations(oop method); |
duke@435 | 505 | static void set_annotations(oop method, oop value); |
duke@435 | 506 | |
duke@435 | 507 | static bool has_parameter_annotations_field(); |
duke@435 | 508 | static oop parameter_annotations(oop method); |
duke@435 | 509 | static void set_parameter_annotations(oop method, oop value); |
duke@435 | 510 | |
duke@435 | 511 | static bool has_annotation_default_field(); |
duke@435 | 512 | static oop annotation_default(oop method); |
duke@435 | 513 | static void set_annotation_default(oop method, oop value); |
duke@435 | 514 | |
duke@435 | 515 | // Debugging |
duke@435 | 516 | friend class JavaClasses; |
duke@435 | 517 | }; |
duke@435 | 518 | |
duke@435 | 519 | |
duke@435 | 520 | // Interface to java.lang.reflect.Constructor objects |
duke@435 | 521 | |
duke@435 | 522 | class java_lang_reflect_Constructor : public java_lang_reflect_AccessibleObject { |
duke@435 | 523 | private: |
duke@435 | 524 | // Note that to reduce dependencies on the JDK we compute these |
duke@435 | 525 | // offsets at run-time. |
duke@435 | 526 | static int clazz_offset; |
duke@435 | 527 | static int parameterTypes_offset; |
duke@435 | 528 | static int exceptionTypes_offset; |
duke@435 | 529 | static int slot_offset; |
duke@435 | 530 | static int modifiers_offset; |
duke@435 | 531 | static int signature_offset; |
duke@435 | 532 | static int annotations_offset; |
duke@435 | 533 | static int parameter_annotations_offset; |
duke@435 | 534 | |
duke@435 | 535 | static void compute_offsets(); |
duke@435 | 536 | |
duke@435 | 537 | public: |
duke@435 | 538 | // Allocation |
duke@435 | 539 | static Handle create(TRAPS); |
duke@435 | 540 | |
duke@435 | 541 | // Accessors |
duke@435 | 542 | static oop clazz(oop reflect); |
duke@435 | 543 | static void set_clazz(oop reflect, oop value); |
duke@435 | 544 | |
duke@435 | 545 | static oop parameter_types(oop constructor); |
duke@435 | 546 | static void set_parameter_types(oop constructor, oop value); |
duke@435 | 547 | |
duke@435 | 548 | static oop exception_types(oop constructor); |
duke@435 | 549 | static void set_exception_types(oop constructor, oop value); |
duke@435 | 550 | |
duke@435 | 551 | static int slot(oop reflect); |
duke@435 | 552 | static void set_slot(oop reflect, int value); |
duke@435 | 553 | |
duke@435 | 554 | static int modifiers(oop constructor); |
duke@435 | 555 | static void set_modifiers(oop constructor, int value); |
duke@435 | 556 | |
duke@435 | 557 | static bool has_signature_field(); |
duke@435 | 558 | static oop signature(oop constructor); |
duke@435 | 559 | static void set_signature(oop constructor, oop value); |
duke@435 | 560 | |
duke@435 | 561 | static bool has_annotations_field(); |
duke@435 | 562 | static oop annotations(oop constructor); |
duke@435 | 563 | static void set_annotations(oop constructor, oop value); |
duke@435 | 564 | |
duke@435 | 565 | static bool has_parameter_annotations_field(); |
duke@435 | 566 | static oop parameter_annotations(oop method); |
duke@435 | 567 | static void set_parameter_annotations(oop method, oop value); |
duke@435 | 568 | |
duke@435 | 569 | // Debugging |
duke@435 | 570 | friend class JavaClasses; |
duke@435 | 571 | }; |
duke@435 | 572 | |
duke@435 | 573 | |
duke@435 | 574 | // Interface to java.lang.reflect.Field objects |
duke@435 | 575 | |
duke@435 | 576 | class java_lang_reflect_Field : public java_lang_reflect_AccessibleObject { |
duke@435 | 577 | private: |
duke@435 | 578 | // Note that to reduce dependencies on the JDK we compute these |
duke@435 | 579 | // offsets at run-time. |
duke@435 | 580 | static int clazz_offset; |
duke@435 | 581 | static int name_offset; |
duke@435 | 582 | static int type_offset; |
duke@435 | 583 | static int slot_offset; |
duke@435 | 584 | static int modifiers_offset; |
duke@435 | 585 | static int signature_offset; |
duke@435 | 586 | static int annotations_offset; |
duke@435 | 587 | |
duke@435 | 588 | static void compute_offsets(); |
duke@435 | 589 | |
duke@435 | 590 | public: |
duke@435 | 591 | // Allocation |
duke@435 | 592 | static Handle create(TRAPS); |
duke@435 | 593 | |
duke@435 | 594 | // Accessors |
duke@435 | 595 | static oop clazz(oop reflect); |
duke@435 | 596 | static void set_clazz(oop reflect, oop value); |
duke@435 | 597 | |
duke@435 | 598 | static oop name(oop field); |
duke@435 | 599 | static void set_name(oop field, oop value); |
duke@435 | 600 | |
duke@435 | 601 | static oop type(oop field); |
duke@435 | 602 | static void set_type(oop field, oop value); |
duke@435 | 603 | |
duke@435 | 604 | static int slot(oop reflect); |
duke@435 | 605 | static void set_slot(oop reflect, int value); |
duke@435 | 606 | |
duke@435 | 607 | static int modifiers(oop field); |
duke@435 | 608 | static void set_modifiers(oop field, int value); |
duke@435 | 609 | |
duke@435 | 610 | static bool has_signature_field(); |
duke@435 | 611 | static oop signature(oop constructor); |
duke@435 | 612 | static void set_signature(oop constructor, oop value); |
duke@435 | 613 | |
duke@435 | 614 | static bool has_annotations_field(); |
duke@435 | 615 | static oop annotations(oop constructor); |
duke@435 | 616 | static void set_annotations(oop constructor, oop value); |
duke@435 | 617 | |
duke@435 | 618 | static bool has_parameter_annotations_field(); |
duke@435 | 619 | static oop parameter_annotations(oop method); |
duke@435 | 620 | static void set_parameter_annotations(oop method, oop value); |
duke@435 | 621 | |
duke@435 | 622 | static bool has_annotation_default_field(); |
duke@435 | 623 | static oop annotation_default(oop method); |
duke@435 | 624 | static void set_annotation_default(oop method, oop value); |
duke@435 | 625 | |
duke@435 | 626 | // Debugging |
duke@435 | 627 | friend class JavaClasses; |
duke@435 | 628 | }; |
duke@435 | 629 | |
duke@435 | 630 | // Interface to sun.reflect.ConstantPool objects |
duke@435 | 631 | class sun_reflect_ConstantPool { |
duke@435 | 632 | private: |
duke@435 | 633 | // Note that to reduce dependencies on the JDK we compute these |
duke@435 | 634 | // offsets at run-time. |
duke@435 | 635 | static int _cp_oop_offset; |
duke@435 | 636 | |
duke@435 | 637 | static void compute_offsets(); |
duke@435 | 638 | |
duke@435 | 639 | public: |
duke@435 | 640 | // Allocation |
duke@435 | 641 | static Handle create(TRAPS); |
duke@435 | 642 | |
duke@435 | 643 | // Accessors |
duke@435 | 644 | static oop cp_oop(oop reflect); |
duke@435 | 645 | static void set_cp_oop(oop reflect, oop value); |
duke@435 | 646 | static int cp_oop_offset() { |
duke@435 | 647 | return _cp_oop_offset; |
duke@435 | 648 | } |
duke@435 | 649 | |
duke@435 | 650 | // Debugging |
duke@435 | 651 | friend class JavaClasses; |
duke@435 | 652 | }; |
duke@435 | 653 | |
duke@435 | 654 | // Interface to sun.reflect.UnsafeStaticFieldAccessorImpl objects |
duke@435 | 655 | class sun_reflect_UnsafeStaticFieldAccessorImpl { |
duke@435 | 656 | private: |
duke@435 | 657 | static int _base_offset; |
duke@435 | 658 | static void compute_offsets(); |
duke@435 | 659 | |
duke@435 | 660 | public: |
duke@435 | 661 | static int base_offset() { |
duke@435 | 662 | return _base_offset; |
duke@435 | 663 | } |
duke@435 | 664 | |
duke@435 | 665 | // Debugging |
duke@435 | 666 | friend class JavaClasses; |
duke@435 | 667 | }; |
duke@435 | 668 | |
duke@435 | 669 | // Interface to java.lang primitive type boxing objects: |
duke@435 | 670 | // - java.lang.Boolean |
duke@435 | 671 | // - java.lang.Character |
duke@435 | 672 | // - java.lang.Float |
duke@435 | 673 | // - java.lang.Double |
duke@435 | 674 | // - java.lang.Byte |
duke@435 | 675 | // - java.lang.Short |
duke@435 | 676 | // - java.lang.Integer |
duke@435 | 677 | // - java.lang.Long |
duke@435 | 678 | |
duke@435 | 679 | // This could be separated out into 8 individual classes. |
duke@435 | 680 | |
duke@435 | 681 | class java_lang_boxing_object: AllStatic { |
duke@435 | 682 | private: |
duke@435 | 683 | enum { |
duke@435 | 684 | hc_value_offset = 0 |
duke@435 | 685 | }; |
duke@435 | 686 | static int value_offset; |
kvn@600 | 687 | static int long_value_offset; |
duke@435 | 688 | |
jrose@567 | 689 | static oop initialize_and_allocate(BasicType type, TRAPS); |
duke@435 | 690 | public: |
duke@435 | 691 | // Allocation. Returns a boxed value, or NULL for invalid type. |
duke@435 | 692 | static oop create(BasicType type, jvalue* value, TRAPS); |
duke@435 | 693 | // Accessors. Returns the basic type being boxed, or T_ILLEGAL for invalid oop. |
duke@435 | 694 | static BasicType get_value(oop box, jvalue* value); |
duke@435 | 695 | static BasicType set_value(oop box, jvalue* value); |
jrose@567 | 696 | static BasicType basic_type(oop box); |
jrose@567 | 697 | static bool is_instance(oop box) { return basic_type(box) != T_ILLEGAL; } |
jrose@567 | 698 | static bool is_instance(oop box, BasicType type) { return basic_type(box) == type; } |
jrose@1100 | 699 | static void print(oop box, outputStream* st) { jvalue value; print(get_value(box, &value), &value, st); } |
jrose@1100 | 700 | static void print(BasicType type, jvalue* value, outputStream* st); |
duke@435 | 701 | |
kvn@600 | 702 | static int value_offset_in_bytes(BasicType type) { |
kvn@600 | 703 | return ( type == T_LONG || type == T_DOUBLE ) ? long_value_offset : |
kvn@600 | 704 | value_offset; |
kvn@600 | 705 | } |
duke@435 | 706 | |
duke@435 | 707 | // Debugging |
duke@435 | 708 | friend class JavaClasses; |
duke@435 | 709 | }; |
duke@435 | 710 | |
duke@435 | 711 | |
duke@435 | 712 | |
duke@435 | 713 | // Interface to java.lang.ref.Reference objects |
duke@435 | 714 | |
duke@435 | 715 | class java_lang_ref_Reference: AllStatic { |
duke@435 | 716 | public: |
duke@435 | 717 | enum { |
duke@435 | 718 | hc_referent_offset = 0, |
duke@435 | 719 | hc_queue_offset = 1, |
duke@435 | 720 | hc_next_offset = 2, |
duke@435 | 721 | hc_discovered_offset = 3 // Is not last, see SoftRefs. |
duke@435 | 722 | }; |
duke@435 | 723 | enum { |
duke@435 | 724 | hc_static_lock_offset = 0, |
duke@435 | 725 | hc_static_pending_offset = 1 |
duke@435 | 726 | }; |
duke@435 | 727 | |
duke@435 | 728 | static int referent_offset; |
duke@435 | 729 | static int queue_offset; |
duke@435 | 730 | static int next_offset; |
duke@435 | 731 | static int discovered_offset; |
duke@435 | 732 | static int static_lock_offset; |
duke@435 | 733 | static int static_pending_offset; |
duke@435 | 734 | static int number_of_fake_oop_fields; |
duke@435 | 735 | |
duke@435 | 736 | // Accessors |
coleenp@548 | 737 | static oop referent(oop ref) { |
coleenp@548 | 738 | return ref->obj_field(referent_offset); |
coleenp@548 | 739 | } |
coleenp@548 | 740 | static void set_referent(oop ref, oop value) { |
coleenp@548 | 741 | ref->obj_field_put(referent_offset, value); |
coleenp@548 | 742 | } |
coleenp@548 | 743 | static void set_referent_raw(oop ref, oop value) { |
coleenp@548 | 744 | ref->obj_field_raw_put(referent_offset, value); |
coleenp@548 | 745 | } |
coleenp@548 | 746 | static HeapWord* referent_addr(oop ref) { |
coleenp@548 | 747 | return ref->obj_field_addr<HeapWord>(referent_offset); |
coleenp@548 | 748 | } |
coleenp@548 | 749 | static oop next(oop ref) { |
coleenp@548 | 750 | return ref->obj_field(next_offset); |
coleenp@548 | 751 | } |
coleenp@548 | 752 | static void set_next(oop ref, oop value) { |
coleenp@548 | 753 | ref->obj_field_put(next_offset, value); |
coleenp@548 | 754 | } |
coleenp@548 | 755 | static void set_next_raw(oop ref, oop value) { |
coleenp@548 | 756 | ref->obj_field_raw_put(next_offset, value); |
coleenp@548 | 757 | } |
coleenp@548 | 758 | static HeapWord* next_addr(oop ref) { |
coleenp@548 | 759 | return ref->obj_field_addr<HeapWord>(next_offset); |
coleenp@548 | 760 | } |
coleenp@548 | 761 | static oop discovered(oop ref) { |
coleenp@548 | 762 | return ref->obj_field(discovered_offset); |
coleenp@548 | 763 | } |
coleenp@548 | 764 | static void set_discovered(oop ref, oop value) { |
coleenp@548 | 765 | ref->obj_field_put(discovered_offset, value); |
coleenp@548 | 766 | } |
coleenp@548 | 767 | static void set_discovered_raw(oop ref, oop value) { |
coleenp@548 | 768 | ref->obj_field_raw_put(discovered_offset, value); |
coleenp@548 | 769 | } |
coleenp@548 | 770 | static HeapWord* discovered_addr(oop ref) { |
coleenp@548 | 771 | return ref->obj_field_addr<HeapWord>(discovered_offset); |
coleenp@548 | 772 | } |
coleenp@548 | 773 | // Accessors for statics |
coleenp@548 | 774 | static oop pending_list_lock(); |
coleenp@548 | 775 | static oop pending_list(); |
duke@435 | 776 | |
coleenp@548 | 777 | static HeapWord* pending_list_addr(); |
duke@435 | 778 | }; |
duke@435 | 779 | |
duke@435 | 780 | |
duke@435 | 781 | // Interface to java.lang.ref.SoftReference objects |
duke@435 | 782 | |
duke@435 | 783 | class java_lang_ref_SoftReference: public java_lang_ref_Reference { |
duke@435 | 784 | public: |
duke@435 | 785 | enum { |
duke@435 | 786 | // The timestamp is a long field and may need to be adjusted for alignment. |
kvn@600 | 787 | hc_timestamp_offset = hc_discovered_offset + 1 |
duke@435 | 788 | }; |
duke@435 | 789 | enum { |
duke@435 | 790 | hc_static_clock_offset = 0 |
duke@435 | 791 | }; |
duke@435 | 792 | |
duke@435 | 793 | static int timestamp_offset; |
duke@435 | 794 | static int static_clock_offset; |
duke@435 | 795 | |
duke@435 | 796 | // Accessors |
duke@435 | 797 | static jlong timestamp(oop ref); |
duke@435 | 798 | |
duke@435 | 799 | // Accessors for statics |
duke@435 | 800 | static jlong clock(); |
duke@435 | 801 | static void set_clock(jlong value); |
duke@435 | 802 | }; |
duke@435 | 803 | |
duke@435 | 804 | |
jrose@2639 | 805 | // Interface to java.lang.invoke.MethodHandle objects |
jrose@1145 | 806 | |
jrose@1145 | 807 | class MethodHandleEntry; |
jrose@1145 | 808 | |
jrose@2639 | 809 | class java_lang_invoke_MethodHandle: AllStatic { |
jrose@1145 | 810 | friend class JavaClasses; |
jrose@1145 | 811 | |
jrose@1145 | 812 | private: |
jrose@1145 | 813 | static int _vmentry_offset; // assembly code trampoline for MH |
jrose@1145 | 814 | static int _vmtarget_offset; // class-specific target reference |
jrose@1145 | 815 | static int _type_offset; // the MethodType of this MH |
jrose@1145 | 816 | static int _vmslots_offset; // OPTIONAL hoisted type.form.vmslots |
jrose@1145 | 817 | |
jrose@1145 | 818 | static void compute_offsets(); |
jrose@1145 | 819 | |
jrose@1145 | 820 | public: |
jrose@1145 | 821 | // Accessors |
jrose@1145 | 822 | static oop type(oop mh); |
jrose@1145 | 823 | static void set_type(oop mh, oop mtype); |
jrose@1145 | 824 | |
jrose@1145 | 825 | static oop vmtarget(oop mh); |
jrose@1145 | 826 | static void set_vmtarget(oop mh, oop target); |
jrose@1145 | 827 | |
jrose@1145 | 828 | static MethodHandleEntry* vmentry(oop mh); |
jrose@1145 | 829 | static void set_vmentry(oop mh, MethodHandleEntry* data); |
jrose@1145 | 830 | |
jrose@1145 | 831 | static int vmslots(oop mh); |
jrose@1145 | 832 | static void init_vmslots(oop mh); |
jrose@1145 | 833 | static int compute_vmslots(oop mh); |
jrose@1145 | 834 | |
jrose@1145 | 835 | // Testers |
jrose@1145 | 836 | static bool is_subclass(klassOop klass) { |
jrose@1145 | 837 | return Klass::cast(klass)->is_subclass_of(SystemDictionary::MethodHandle_klass()); |
jrose@1145 | 838 | } |
jrose@1145 | 839 | static bool is_instance(oop obj) { |
jrose@1145 | 840 | return obj != NULL && is_subclass(obj->klass()); |
jrose@1145 | 841 | } |
jrose@1145 | 842 | |
jrose@1145 | 843 | // Accessors for code generation: |
jrose@1145 | 844 | static int type_offset_in_bytes() { return _type_offset; } |
jrose@1145 | 845 | static int vmtarget_offset_in_bytes() { return _vmtarget_offset; } |
jrose@1145 | 846 | static int vmentry_offset_in_bytes() { return _vmentry_offset; } |
jrose@1145 | 847 | static int vmslots_offset_in_bytes() { return _vmslots_offset; } |
jrose@1145 | 848 | }; |
jrose@1145 | 849 | |
jrose@2639 | 850 | class java_lang_invoke_DirectMethodHandle: public java_lang_invoke_MethodHandle { |
jrose@1145 | 851 | friend class JavaClasses; |
jrose@1145 | 852 | |
jrose@1145 | 853 | private: |
jrose@1145 | 854 | // _vmtarget_offset; // method or class or interface |
jrose@1145 | 855 | static int _vmindex_offset; // negative or vtable idx or itable idx |
jrose@1145 | 856 | static void compute_offsets(); |
jrose@1145 | 857 | |
jrose@1145 | 858 | public: |
jrose@1145 | 859 | // Accessors |
jrose@1145 | 860 | static int vmindex(oop mh); |
jrose@1145 | 861 | static void set_vmindex(oop mh, int index); |
jrose@1145 | 862 | |
jrose@1145 | 863 | // Testers |
jrose@1145 | 864 | static bool is_subclass(klassOop klass) { |
jrose@1145 | 865 | return Klass::cast(klass)->is_subclass_of(SystemDictionary::DirectMethodHandle_klass()); |
jrose@1145 | 866 | } |
jrose@1145 | 867 | static bool is_instance(oop obj) { |
jrose@1145 | 868 | return obj != NULL && is_subclass(obj->klass()); |
jrose@1145 | 869 | } |
jrose@1145 | 870 | |
jrose@1145 | 871 | // Accessors for code generation: |
jrose@1145 | 872 | static int vmindex_offset_in_bytes() { return _vmindex_offset; } |
jrose@1145 | 873 | }; |
jrose@1145 | 874 | |
jrose@2639 | 875 | class java_lang_invoke_BoundMethodHandle: public java_lang_invoke_MethodHandle { |
jrose@1145 | 876 | friend class JavaClasses; |
jrose@1145 | 877 | |
jrose@1145 | 878 | private: |
jrose@1145 | 879 | static int _argument_offset; // argument value bound into this MH |
jrose@1145 | 880 | static int _vmargslot_offset; // relevant argument slot (<= vmslots) |
jrose@1145 | 881 | static void compute_offsets(); |
jrose@1145 | 882 | |
jrose@1145 | 883 | public: |
jrose@1145 | 884 | static oop argument(oop mh); |
jrose@1145 | 885 | static void set_argument(oop mh, oop ref); |
jrose@1145 | 886 | |
jrose@1145 | 887 | static jint vmargslot(oop mh); |
jrose@1145 | 888 | static void set_vmargslot(oop mh, jint slot); |
jrose@1145 | 889 | |
jrose@1145 | 890 | // Testers |
jrose@1145 | 891 | static bool is_subclass(klassOop klass) { |
jrose@1145 | 892 | return Klass::cast(klass)->is_subclass_of(SystemDictionary::BoundMethodHandle_klass()); |
jrose@1145 | 893 | } |
jrose@1145 | 894 | static bool is_instance(oop obj) { |
jrose@1145 | 895 | return obj != NULL && is_subclass(obj->klass()); |
jrose@1145 | 896 | } |
jrose@1145 | 897 | |
jrose@1145 | 898 | static int argument_offset_in_bytes() { return _argument_offset; } |
jrose@1145 | 899 | static int vmargslot_offset_in_bytes() { return _vmargslot_offset; } |
jrose@1145 | 900 | }; |
jrose@1145 | 901 | |
jrose@2639 | 902 | class java_lang_invoke_AdapterMethodHandle: public java_lang_invoke_BoundMethodHandle { |
jrose@1145 | 903 | friend class JavaClasses; |
jrose@1145 | 904 | |
jrose@1145 | 905 | private: |
jrose@1145 | 906 | static int _conversion_offset; // type of conversion to apply |
jrose@1145 | 907 | static void compute_offsets(); |
jrose@1145 | 908 | |
jrose@1145 | 909 | public: |
jrose@1145 | 910 | static int conversion(oop mh); |
jrose@1145 | 911 | static void set_conversion(oop mh, int conv); |
jrose@1145 | 912 | |
jrose@1145 | 913 | // Testers |
jrose@1145 | 914 | static bool is_subclass(klassOop klass) { |
jrose@1145 | 915 | return Klass::cast(klass)->is_subclass_of(SystemDictionary::AdapterMethodHandle_klass()); |
jrose@1145 | 916 | } |
jrose@1145 | 917 | static bool is_instance(oop obj) { |
jrose@1145 | 918 | return obj != NULL && is_subclass(obj->klass()); |
jrose@1145 | 919 | } |
jrose@1145 | 920 | |
jrose@1145 | 921 | // Relevant integer codes (keep these in synch. with MethodHandleNatives.Constants): |
jrose@1145 | 922 | enum { |
jrose@1145 | 923 | OP_RETYPE_ONLY = 0x0, // no argument changes; straight retype |
jrose@1474 | 924 | OP_RETYPE_RAW = 0x1, // straight retype, trusted (void->int, Object->T) |
jrose@1474 | 925 | OP_CHECK_CAST = 0x2, // ref-to-ref conversion; requires a Class argument |
jrose@1474 | 926 | OP_PRIM_TO_PRIM = 0x3, // converts from one primitive to another |
jrose@1474 | 927 | OP_REF_TO_PRIM = 0x4, // unboxes a wrapper to produce a primitive |
jrose@1474 | 928 | OP_PRIM_TO_REF = 0x5, // boxes a primitive into a wrapper (NYI) |
jrose@1474 | 929 | OP_SWAP_ARGS = 0x6, // swap arguments (vminfo is 2nd arg) |
jrose@1474 | 930 | OP_ROT_ARGS = 0x7, // rotate arguments (vminfo is displaced arg) |
jrose@1474 | 931 | OP_DUP_ARGS = 0x8, // duplicates one or more arguments (at TOS) |
jrose@1474 | 932 | OP_DROP_ARGS = 0x9, // remove one or more argument slots |
jrose@1474 | 933 | OP_COLLECT_ARGS = 0xA, // combine one or more arguments into a varargs (NYI) |
jrose@1474 | 934 | OP_SPREAD_ARGS = 0xB, // expand in place a varargs array (of known size) |
jrose@1474 | 935 | OP_FLYBY = 0xC, // operate first on reified argument list (NYI) |
jrose@1474 | 936 | OP_RICOCHET = 0xD, // run an adapter chain on the return value (NYI) |
jrose@1474 | 937 | CONV_OP_LIMIT = 0xE, // limit of CONV_OP enumeration |
jrose@1145 | 938 | |
jrose@1145 | 939 | CONV_OP_MASK = 0xF00, // this nybble contains the conversion op field |
jrose@1145 | 940 | CONV_VMINFO_MASK = 0x0FF, // LSB is reserved for JVM use |
jrose@1145 | 941 | CONV_VMINFO_SHIFT = 0, // position of bits in CONV_VMINFO_MASK |
jrose@1145 | 942 | CONV_OP_SHIFT = 8, // position of bits in CONV_OP_MASK |
jrose@1145 | 943 | CONV_DEST_TYPE_SHIFT = 12, // byte 2 has the adapter BasicType (if needed) |
jrose@1145 | 944 | CONV_SRC_TYPE_SHIFT = 16, // byte 2 has the source BasicType (if needed) |
jrose@1145 | 945 | CONV_STACK_MOVE_SHIFT = 20, // high 12 bits give signed SP change |
jrose@1145 | 946 | CONV_STACK_MOVE_MASK = (1 << (32 - CONV_STACK_MOVE_SHIFT)) - 1 |
jrose@1145 | 947 | }; |
jrose@1145 | 948 | |
jrose@1145 | 949 | static int conversion_offset_in_bytes() { return _conversion_offset; } |
jrose@1145 | 950 | }; |
jrose@1145 | 951 | |
jrose@1145 | 952 | |
jrose@2639 | 953 | // Interface to java.lang.invoke.MemberName objects |
jrose@1145 | 954 | // (These are a private interface for Java code to query the class hierarchy.) |
jrose@1145 | 955 | |
jrose@2639 | 956 | class java_lang_invoke_MemberName: AllStatic { |
jrose@1145 | 957 | friend class JavaClasses; |
jrose@1145 | 958 | |
jrose@1145 | 959 | private: |
jrose@2639 | 960 | // From java.lang.invoke.MemberName: |
jrose@1145 | 961 | // private Class<?> clazz; // class in which the method is defined |
jrose@1145 | 962 | // private String name; // may be null if not yet materialized |
jrose@1145 | 963 | // private Object type; // may be null if not yet materialized |
jrose@1145 | 964 | // private int flags; // modifier bits; see reflect.Modifier |
jrose@1145 | 965 | // private Object vmtarget; // VM-specific target value |
jrose@1145 | 966 | // private int vmindex; // method index within class or interface |
jrose@1145 | 967 | static int _clazz_offset; |
jrose@1145 | 968 | static int _name_offset; |
jrose@1145 | 969 | static int _type_offset; |
jrose@1145 | 970 | static int _flags_offset; |
jrose@1145 | 971 | static int _vmtarget_offset; |
jrose@1145 | 972 | static int _vmindex_offset; |
jrose@1145 | 973 | |
jrose@1145 | 974 | static void compute_offsets(); |
jrose@1145 | 975 | |
jrose@1145 | 976 | public: |
jrose@1145 | 977 | // Accessors |
jrose@1145 | 978 | static oop clazz(oop mname); |
jrose@1145 | 979 | static void set_clazz(oop mname, oop clazz); |
jrose@1145 | 980 | |
jrose@1145 | 981 | static oop type(oop mname); |
jrose@1145 | 982 | static void set_type(oop mname, oop type); |
jrose@1145 | 983 | |
jrose@1145 | 984 | static oop name(oop mname); |
jrose@1145 | 985 | static void set_name(oop mname, oop name); |
jrose@1145 | 986 | |
jrose@1145 | 987 | static int flags(oop mname); |
jrose@1145 | 988 | static void set_flags(oop mname, int flags); |
jrose@1145 | 989 | |
jrose@1145 | 990 | static int modifiers(oop mname) { return (u2) flags(mname); } |
jrose@1145 | 991 | static void set_modifiers(oop mname, int mods) |
jrose@1145 | 992 | { set_flags(mname, (flags(mname) &~ (u2)-1) | (u2)mods); } |
jrose@1145 | 993 | |
jrose@1145 | 994 | static oop vmtarget(oop mname); |
jrose@1145 | 995 | static void set_vmtarget(oop mname, oop target); |
jrose@1145 | 996 | |
jrose@1145 | 997 | static int vmindex(oop mname); |
jrose@1145 | 998 | static void set_vmindex(oop mname, int index); |
jrose@1145 | 999 | |
jrose@1145 | 1000 | // Testers |
jrose@1145 | 1001 | static bool is_subclass(klassOop klass) { |
jrose@1145 | 1002 | return Klass::cast(klass)->is_subclass_of(SystemDictionary::MemberName_klass()); |
jrose@1145 | 1003 | } |
jrose@1145 | 1004 | static bool is_instance(oop obj) { |
jrose@1145 | 1005 | return obj != NULL && is_subclass(obj->klass()); |
jrose@1145 | 1006 | } |
jrose@1145 | 1007 | |
jrose@1145 | 1008 | // Relevant integer codes (keep these in synch. with MethodHandleNatives.Constants): |
jrose@1145 | 1009 | enum { |
jrose@1145 | 1010 | MN_IS_METHOD = 0x00010000, // method (not constructor) |
jrose@1145 | 1011 | MN_IS_CONSTRUCTOR = 0x00020000, // constructor |
jrose@1145 | 1012 | MN_IS_FIELD = 0x00040000, // field |
jrose@1145 | 1013 | MN_IS_TYPE = 0x00080000, // nested type |
jrose@1145 | 1014 | MN_SEARCH_SUPERCLASSES = 0x00100000, // for MHN.getMembers |
jrose@1145 | 1015 | MN_SEARCH_INTERFACES = 0x00200000, // for MHN.getMembers |
jrose@1145 | 1016 | VM_INDEX_UNINITIALIZED = -99 |
jrose@1145 | 1017 | }; |
jrose@1145 | 1018 | |
jrose@1145 | 1019 | // Accessors for code generation: |
jrose@1145 | 1020 | static int clazz_offset_in_bytes() { return _clazz_offset; } |
jrose@1145 | 1021 | static int type_offset_in_bytes() { return _type_offset; } |
jrose@1145 | 1022 | static int name_offset_in_bytes() { return _name_offset; } |
jrose@1145 | 1023 | static int flags_offset_in_bytes() { return _flags_offset; } |
jrose@1145 | 1024 | static int vmtarget_offset_in_bytes() { return _vmtarget_offset; } |
jrose@1145 | 1025 | static int vmindex_offset_in_bytes() { return _vmindex_offset; } |
jrose@1145 | 1026 | }; |
jrose@1145 | 1027 | |
jrose@1145 | 1028 | |
jrose@2639 | 1029 | // Interface to java.lang.invoke.MethodType objects |
jrose@1145 | 1030 | |
jrose@2639 | 1031 | class java_lang_invoke_MethodType: AllStatic { |
jrose@1145 | 1032 | friend class JavaClasses; |
jrose@1145 | 1033 | |
jrose@1145 | 1034 | private: |
jrose@1145 | 1035 | static int _rtype_offset; |
jrose@1145 | 1036 | static int _ptypes_offset; |
jrose@1145 | 1037 | static int _form_offset; |
jrose@1145 | 1038 | |
jrose@1145 | 1039 | static void compute_offsets(); |
jrose@1145 | 1040 | |
jrose@1145 | 1041 | public: |
jrose@1145 | 1042 | // Accessors |
jrose@1145 | 1043 | static oop rtype(oop mt); |
jrose@1145 | 1044 | static objArrayOop ptypes(oop mt); |
jrose@1145 | 1045 | static oop form(oop mt); |
jrose@1145 | 1046 | |
jrose@1145 | 1047 | static oop ptype(oop mt, int index); |
twisti@1568 | 1048 | static int ptype_count(oop mt); |
jrose@1145 | 1049 | |
coleenp@2497 | 1050 | static Symbol* as_signature(oop mt, bool intern_if_not_found, TRAPS); |
jrose@1145 | 1051 | static void print_signature(oop mt, outputStream* st); |
jrose@1145 | 1052 | |
jrose@1145 | 1053 | static bool is_instance(oop obj) { |
jrose@1145 | 1054 | return obj != NULL && obj->klass() == SystemDictionary::MethodType_klass(); |
jrose@1145 | 1055 | } |
jrose@1145 | 1056 | |
jrose@1145 | 1057 | // Accessors for code generation: |
jrose@1145 | 1058 | static int rtype_offset_in_bytes() { return _rtype_offset; } |
jrose@1145 | 1059 | static int ptypes_offset_in_bytes() { return _ptypes_offset; } |
jrose@1145 | 1060 | static int form_offset_in_bytes() { return _form_offset; } |
jrose@1145 | 1061 | }; |
jrose@1145 | 1062 | |
jrose@2639 | 1063 | class java_lang_invoke_MethodTypeForm: AllStatic { |
jrose@1145 | 1064 | friend class JavaClasses; |
jrose@1145 | 1065 | |
jrose@1145 | 1066 | private: |
jrose@1145 | 1067 | static int _vmslots_offset; // number of argument slots needed |
jrose@1145 | 1068 | static int _erasedType_offset; // erasedType = canonical MethodType |
jrose@2148 | 1069 | static int _genericInvoker_offset; // genericInvoker = adapter for invokeGeneric |
jrose@1145 | 1070 | |
jrose@1145 | 1071 | static void compute_offsets(); |
jrose@1145 | 1072 | |
jrose@1145 | 1073 | public: |
jrose@1145 | 1074 | // Accessors |
jrose@1145 | 1075 | static int vmslots(oop mtform); |
jrose@1145 | 1076 | static oop erasedType(oop mtform); |
jrose@2148 | 1077 | static oop genericInvoker(oop mtform); |
jrose@1145 | 1078 | |
jrose@1145 | 1079 | // Accessors for code generation: |
jrose@1145 | 1080 | static int vmslots_offset_in_bytes() { return _vmslots_offset; } |
jrose@1145 | 1081 | static int erasedType_offset_in_bytes() { return _erasedType_offset; } |
jrose@2148 | 1082 | static int genericInvoker_offset_in_bytes() { return _genericInvoker_offset; } |
jrose@1145 | 1083 | }; |
jrose@1145 | 1084 | |
jrose@1145 | 1085 | |
jrose@2639 | 1086 | // Interface to java.lang.invoke.CallSite objects |
jrose@1161 | 1087 | |
jrose@2639 | 1088 | class java_lang_invoke_CallSite: AllStatic { |
jrose@1161 | 1089 | friend class JavaClasses; |
jrose@1161 | 1090 | |
jrose@1161 | 1091 | private: |
jrose@1161 | 1092 | static int _target_offset; |
jrose@1862 | 1093 | static int _caller_method_offset; |
jrose@1862 | 1094 | static int _caller_bci_offset; |
jrose@1161 | 1095 | |
jrose@1161 | 1096 | static void compute_offsets(); |
jrose@1161 | 1097 | |
jrose@1161 | 1098 | public: |
jrose@1161 | 1099 | // Accessors |
jrose@1161 | 1100 | static oop target(oop site); |
jrose@1161 | 1101 | static void set_target(oop site, oop target); |
jrose@1161 | 1102 | |
jrose@1862 | 1103 | static oop caller_method(oop site); |
jrose@1862 | 1104 | static void set_caller_method(oop site, oop ref); |
jrose@1862 | 1105 | |
jrose@1862 | 1106 | static jint caller_bci(oop site); |
jrose@1862 | 1107 | static void set_caller_bci(oop site, jint bci); |
jrose@1161 | 1108 | |
twisti@1570 | 1109 | // Testers |
twisti@1570 | 1110 | static bool is_subclass(klassOop klass) { |
twisti@1570 | 1111 | return Klass::cast(klass)->is_subclass_of(SystemDictionary::CallSite_klass()); |
twisti@1570 | 1112 | } |
twisti@1570 | 1113 | static bool is_instance(oop obj) { |
twisti@1570 | 1114 | return obj != NULL && is_subclass(obj->klass()); |
twisti@1570 | 1115 | } |
twisti@1570 | 1116 | |
jrose@1161 | 1117 | // Accessors for code generation: |
jrose@1161 | 1118 | static int target_offset_in_bytes() { return _target_offset; } |
jrose@1862 | 1119 | static int caller_method_offset_in_bytes() { return _caller_method_offset; } |
jrose@1862 | 1120 | static int caller_bci_offset_in_bytes() { return _caller_bci_offset; } |
jrose@1161 | 1121 | }; |
jrose@1145 | 1122 | |
jrose@1145 | 1123 | |
duke@435 | 1124 | // Interface to java.security.AccessControlContext objects |
duke@435 | 1125 | |
duke@435 | 1126 | class java_security_AccessControlContext: AllStatic { |
duke@435 | 1127 | private: |
duke@435 | 1128 | // Note that for this class the layout changed between JDK1.2 and JDK1.3, |
duke@435 | 1129 | // so we compute the offsets at startup rather than hard-wiring them. |
duke@435 | 1130 | static int _context_offset; |
duke@435 | 1131 | static int _privilegedContext_offset; |
duke@435 | 1132 | static int _isPrivileged_offset; |
duke@435 | 1133 | |
duke@435 | 1134 | static void compute_offsets(); |
duke@435 | 1135 | public: |
duke@435 | 1136 | static oop create(objArrayHandle context, bool isPrivileged, Handle privileged_context, TRAPS); |
duke@435 | 1137 | |
duke@435 | 1138 | // Debugging/initialization |
duke@435 | 1139 | friend class JavaClasses; |
duke@435 | 1140 | }; |
duke@435 | 1141 | |
duke@435 | 1142 | |
duke@435 | 1143 | // Interface to java.lang.ClassLoader objects |
duke@435 | 1144 | |
duke@435 | 1145 | class java_lang_ClassLoader : AllStatic { |
duke@435 | 1146 | private: |
duke@435 | 1147 | enum { |
duke@435 | 1148 | hc_parent_offset = 0 |
duke@435 | 1149 | }; |
duke@435 | 1150 | |
duke@435 | 1151 | static int parent_offset; |
duke@435 | 1152 | |
duke@435 | 1153 | public: |
duke@435 | 1154 | static oop parent(oop loader); |
duke@435 | 1155 | |
duke@435 | 1156 | static bool is_trusted_loader(oop loader); |
duke@435 | 1157 | |
duke@435 | 1158 | // Fix for 4474172 |
duke@435 | 1159 | static oop non_reflection_class_loader(oop loader); |
duke@435 | 1160 | |
duke@435 | 1161 | // Debugging |
duke@435 | 1162 | friend class JavaClasses; |
duke@435 | 1163 | }; |
duke@435 | 1164 | |
duke@435 | 1165 | |
duke@435 | 1166 | // Interface to java.lang.System objects |
duke@435 | 1167 | |
duke@435 | 1168 | class java_lang_System : AllStatic { |
duke@435 | 1169 | private: |
duke@435 | 1170 | enum { |
duke@435 | 1171 | hc_static_in_offset = 0, |
duke@435 | 1172 | hc_static_out_offset = 1, |
duke@435 | 1173 | hc_static_err_offset = 2 |
duke@435 | 1174 | }; |
duke@435 | 1175 | |
duke@435 | 1176 | static int static_in_offset; |
duke@435 | 1177 | static int static_out_offset; |
duke@435 | 1178 | static int static_err_offset; |
duke@435 | 1179 | |
duke@435 | 1180 | public: |
duke@435 | 1181 | static int in_offset_in_bytes(); |
duke@435 | 1182 | static int out_offset_in_bytes(); |
duke@435 | 1183 | static int err_offset_in_bytes(); |
duke@435 | 1184 | |
duke@435 | 1185 | // Debugging |
duke@435 | 1186 | friend class JavaClasses; |
duke@435 | 1187 | }; |
duke@435 | 1188 | |
duke@435 | 1189 | |
duke@435 | 1190 | // Interface to java.lang.StackTraceElement objects |
duke@435 | 1191 | |
duke@435 | 1192 | class java_lang_StackTraceElement: AllStatic { |
duke@435 | 1193 | private: |
duke@435 | 1194 | enum { |
duke@435 | 1195 | hc_declaringClass_offset = 0, |
duke@435 | 1196 | hc_methodName_offset = 1, |
duke@435 | 1197 | hc_fileName_offset = 2, |
duke@435 | 1198 | hc_lineNumber_offset = 3 |
duke@435 | 1199 | }; |
duke@435 | 1200 | |
duke@435 | 1201 | static int declaringClass_offset; |
duke@435 | 1202 | static int methodName_offset; |
duke@435 | 1203 | static int fileName_offset; |
duke@435 | 1204 | static int lineNumber_offset; |
duke@435 | 1205 | |
duke@435 | 1206 | public: |
duke@435 | 1207 | // Setters |
duke@435 | 1208 | static void set_declaringClass(oop element, oop value); |
duke@435 | 1209 | static void set_methodName(oop element, oop value); |
duke@435 | 1210 | static void set_fileName(oop element, oop value); |
duke@435 | 1211 | static void set_lineNumber(oop element, int value); |
duke@435 | 1212 | |
duke@435 | 1213 | // Create an instance of StackTraceElement |
duke@435 | 1214 | static oop create(methodHandle m, int bci, TRAPS); |
duke@435 | 1215 | |
duke@435 | 1216 | // Debugging |
duke@435 | 1217 | friend class JavaClasses; |
duke@435 | 1218 | }; |
duke@435 | 1219 | |
duke@435 | 1220 | |
duke@435 | 1221 | // Interface to java.lang.AssertionStatusDirectives objects |
duke@435 | 1222 | |
duke@435 | 1223 | class java_lang_AssertionStatusDirectives: AllStatic { |
duke@435 | 1224 | private: |
duke@435 | 1225 | enum { |
duke@435 | 1226 | hc_classes_offset, |
duke@435 | 1227 | hc_classEnabled_offset, |
duke@435 | 1228 | hc_packages_offset, |
duke@435 | 1229 | hc_packageEnabled_offset, |
duke@435 | 1230 | hc_deflt_offset |
duke@435 | 1231 | }; |
duke@435 | 1232 | |
duke@435 | 1233 | static int classes_offset; |
duke@435 | 1234 | static int classEnabled_offset; |
duke@435 | 1235 | static int packages_offset; |
duke@435 | 1236 | static int packageEnabled_offset; |
duke@435 | 1237 | static int deflt_offset; |
duke@435 | 1238 | |
duke@435 | 1239 | public: |
duke@435 | 1240 | // Setters |
duke@435 | 1241 | static void set_classes(oop obj, oop val); |
duke@435 | 1242 | static void set_classEnabled(oop obj, oop val); |
duke@435 | 1243 | static void set_packages(oop obj, oop val); |
duke@435 | 1244 | static void set_packageEnabled(oop obj, oop val); |
duke@435 | 1245 | static void set_deflt(oop obj, bool val); |
duke@435 | 1246 | // Debugging |
duke@435 | 1247 | friend class JavaClasses; |
duke@435 | 1248 | }; |
duke@435 | 1249 | |
duke@435 | 1250 | |
duke@435 | 1251 | class java_nio_Buffer: AllStatic { |
duke@435 | 1252 | private: |
duke@435 | 1253 | static int _limit_offset; |
duke@435 | 1254 | |
duke@435 | 1255 | public: |
duke@435 | 1256 | static int limit_offset(); |
duke@435 | 1257 | static void compute_offsets(); |
duke@435 | 1258 | }; |
duke@435 | 1259 | |
duke@435 | 1260 | class sun_misc_AtomicLongCSImpl: AllStatic { |
duke@435 | 1261 | private: |
duke@435 | 1262 | static int _value_offset; |
duke@435 | 1263 | |
duke@435 | 1264 | public: |
duke@435 | 1265 | static int value_offset(); |
duke@435 | 1266 | static void compute_offsets(); |
duke@435 | 1267 | }; |
duke@435 | 1268 | |
duke@435 | 1269 | class java_util_concurrent_locks_AbstractOwnableSynchronizer : AllStatic { |
duke@435 | 1270 | private: |
duke@435 | 1271 | static int _owner_offset; |
duke@435 | 1272 | public: |
duke@435 | 1273 | static void initialize(TRAPS); |
duke@435 | 1274 | static oop get_owner_threadObj(oop obj); |
duke@435 | 1275 | }; |
duke@435 | 1276 | |
duke@435 | 1277 | // Interface to hard-coded offset checking |
duke@435 | 1278 | |
duke@435 | 1279 | class JavaClasses : AllStatic { |
duke@435 | 1280 | private: |
duke@435 | 1281 | static bool check_offset(const char *klass_name, int offset, const char *field_name, const char* field_sig) PRODUCT_RETURN0; |
duke@435 | 1282 | static bool check_static_offset(const char *klass_name, int hardcoded_offset, const char *field_name, const char* field_sig) PRODUCT_RETURN0; |
jrose@567 | 1283 | static bool check_constant(const char *klass_name, int constant, const char *field_name, const char* field_sig) PRODUCT_RETURN0; |
duke@435 | 1284 | public: |
duke@435 | 1285 | static void compute_hard_coded_offsets(); |
duke@435 | 1286 | static void compute_offsets(); |
duke@435 | 1287 | static void check_offsets() PRODUCT_RETURN; |
duke@435 | 1288 | }; |
stefank@2314 | 1289 | |
stefank@2314 | 1290 | #endif // SHARE_VM_CLASSFILE_JAVACLASSES_HPP |