< prev index next >

src/hotspot/share/runtime/jfieldIDWorkaround.hpp

Print this page

        

*** 44,72 **** // // 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 --- 44,78 ---- // // 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. // + + friend class JNI_FastGetField; + private: enum { checked_bits = 1, instance_bits = 1, ! flattened_bits = 1, ! address_bits = BitsPerWord - checked_bits - instance_bits - flattened_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, ! flattened_shift = instance_shift + instance_bits, ! address_shift = flattened_shift + flattened_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, + flattened_mask_in_place = right_n_bits(flattened_bits) << flattened_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
*** 105,116 **** 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 --- 111,129 ---- 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_flattened_field(jfieldID id) { ! uintptr_t as_uint = (uintptr_t) id; ! return ((as_uint & flattened_mask_in_place) != 0); ! } ! ! static jfieldID to_instance_jfieldID(Klass* k, int offset, bool flattened) { ! intptr_t as_uint = ((offset & large_offset_mask) << offset_shift) | ! (flattened ? flattened_mask_in_place : 0) | ! instance_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(InstanceKlass* 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_RUNTIME_JFIELDIDWORKAROUND_HPP --- 161,177 ---- JNIid* result = (JNIid*) id; assert(result->is_static_field_id(), "to_JNIid, but not static field id"); return result; } ! static jfieldID to_jfieldID(InstanceKlass* k, int offset, bool is_static, bool is_flattened) { 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_flattened); } } }; #endif // SHARE_RUNTIME_JFIELDIDWORKAROUND_HPP
< prev index next >