< prev index next >

src/share/vm/runtime/jfieldIDWorkaround.hpp

Print this page

        

*** 36,72 **** // // Another low-order bit is used to mark if an instance field // is accompanied by an indication of which class it applies to. // // Bit-format of a jfieldID (most significant first): ! // address:30 instance=0:1 checked=0:1 ! // offset:30 instance=1:1 checked=0:1 ! // klass:23 offset:7 instance=1:1 checked=1:1 // // If the offset does not fit in 7 bits, or if the fieldID is // not checked, then the checked bit is zero and the rest of // the word (30 bits) contains only the offset. // ! private: enum { checked_bits = 1, instance_bits = 1, ! address_bits = BitsPerWord - checked_bits - instance_bits, large_offset_bits = address_bits, // unioned with address small_offset_bits = 7, klass_bits = address_bits - small_offset_bits, checked_shift = 0, instance_shift = checked_shift + checked_bits, ! address_shift = instance_shift + instance_bits, offset_shift = address_shift, // unioned with address klass_shift = offset_shift + small_offset_bits, checked_mask_in_place = right_n_bits(checked_bits) << checked_shift, instance_mask_in_place = right_n_bits(instance_bits) << instance_shift, #ifndef _WIN64 large_offset_mask = right_n_bits(large_offset_bits), small_offset_mask = right_n_bits(small_offset_bits), klass_mask = right_n_bits(klass_bits) #endif --- 36,75 ---- // // Another low-order bit is used to mark if an instance field // is accompanied by an indication of which class it applies to. // // Bit-format of a jfieldID (most significant first): ! // address:29 final=0:1 instance=0:1 checked=0:1 ! // offset:29 final=0:1 instance=1:1 checked=0:1 ! // klass:22 offset:7 final=1:1 instance=1:1 checked=1:1 // // If the offset does not fit in 7 bits, or if the fieldID is // not checked, then the checked bit is zero and the rest of // the word (30 bits) contains only the offset. // ! public: enum { checked_bits = 1, instance_bits = 1, ! final_bits = 1, ! address_bits = BitsPerWord - checked_bits - instance_bits - final_bits, large_offset_bits = address_bits, // unioned with address small_offset_bits = 7, klass_bits = address_bits - small_offset_bits, checked_shift = 0, instance_shift = checked_shift + checked_bits, ! final_shift = instance_shift + instance_bits, ! address_shift = final_shift + final_bits, offset_shift = address_shift, // unioned with address klass_shift = offset_shift + small_offset_bits, checked_mask_in_place = right_n_bits(checked_bits) << checked_shift, instance_mask_in_place = right_n_bits(instance_bits) << instance_shift, + final_mask_in_place = right_n_bits(final_bits) << final_shift, #ifndef _WIN64 large_offset_mask = right_n_bits(large_offset_bits), small_offset_mask = right_n_bits(small_offset_bits), klass_mask = right_n_bits(klass_bits) #endif
*** 76,86 **** // These values are too big for Win64 const static uintptr_t large_offset_mask = right_n_bits(large_offset_bits); const static uintptr_t small_offset_mask = right_n_bits(small_offset_bits); const static uintptr_t klass_mask = right_n_bits(klass_bits); #endif ! // helper routines: static bool is_checked_jfieldID(jfieldID id) { uintptr_t as_uint = (uintptr_t) id; return ((as_uint & checked_mask_in_place) != 0); } --- 79,89 ---- // These values are too big for Win64 const static uintptr_t large_offset_mask = right_n_bits(large_offset_bits); const static uintptr_t small_offset_mask = right_n_bits(small_offset_bits); const static uintptr_t klass_mask = right_n_bits(klass_bits); #endif ! private: // helper routines: static bool is_checked_jfieldID(jfieldID id) { uintptr_t as_uint = (uintptr_t) id; return ((as_uint & checked_mask_in_place) != 0); }
*** 96,116 **** static void verify_instance_jfieldID(Klass* k, jfieldID id); public: static bool is_valid_jfieldID(Klass* k, jfieldID id); ! static bool is_instance_jfieldID(Klass* k, jfieldID id) { uintptr_t as_uint = (uintptr_t) id; return ((as_uint & instance_mask_in_place) != 0); } static bool is_static_jfieldID(jfieldID id) { uintptr_t as_uint = (uintptr_t) id; return ((as_uint & instance_mask_in_place) == 0); } ! static jfieldID to_instance_jfieldID(Klass* k, int offset) { intptr_t as_uint = ((offset & large_offset_mask) << offset_shift) | instance_mask_in_place; if (VerifyJNIFields) { as_uint |= encode_klass_hash(k, offset); } jfieldID result = (jfieldID) as_uint; #ifndef ASSERT --- 99,124 ---- static void verify_instance_jfieldID(Klass* k, jfieldID id); public: static bool is_valid_jfieldID(Klass* k, jfieldID id); ! static bool is_instance_jfieldID(jfieldID id) { uintptr_t as_uint = (uintptr_t) id; return ((as_uint & instance_mask_in_place) != 0); } static bool is_static_jfieldID(jfieldID id) { uintptr_t as_uint = (uintptr_t) id; return ((as_uint & instance_mask_in_place) == 0); } + static bool is_final_jfieldID(jfieldID id) { + uintptr_t as_uint = (uintptr_t) id; + return ((as_uint & final_mask_in_place) != 0); + } ! static jfieldID to_instance_jfieldID(Klass* k, int offset, bool is_final) { intptr_t as_uint = ((offset & large_offset_mask) << offset_shift) | instance_mask_in_place; + if (is_final) as_uint |= final_mask_in_place; if (VerifyJNIFields) { as_uint |= encode_klass_hash(k, offset); } jfieldID result = (jfieldID) as_uint; #ifndef ASSERT
*** 148,164 **** JNIid* result = (JNIid*) id; assert(result->is_static_field_id(), "to_JNIid, but not static field id"); return result; } ! static jfieldID to_jfieldID(instanceKlassHandle k, int offset, bool is_static) { if (is_static) { JNIid *id = k->jni_id_for(offset); debug_only(id->set_is_static_field_id()); return jfieldIDWorkaround::to_static_jfieldID(id); } else { ! return jfieldIDWorkaround::to_instance_jfieldID(k(), offset); } } }; #endif // SHARE_VM_RUNTIME_JFIELDIDWORKAROUND_HPP --- 156,172 ---- JNIid* result = (JNIid*) id; assert(result->is_static_field_id(), "to_JNIid, but not static field id"); return result; } ! static jfieldID to_jfieldID(instanceKlassHandle k, int offset, bool is_static, bool is_final) { if (is_static) { JNIid *id = k->jni_id_for(offset); debug_only(id->set_is_static_field_id()); return jfieldIDWorkaround::to_static_jfieldID(id); } else { ! return jfieldIDWorkaround::to_instance_jfieldID(k(), offset, is_final); } } }; #endif // SHARE_VM_RUNTIME_JFIELDIDWORKAROUND_HPP
< prev index next >