216 } |
216 } |
217 }; |
217 }; |
218 |
218 |
219 void java_lang_String::set_compact_strings(bool value) { |
219 void java_lang_String::set_compact_strings(bool value) { |
220 CompactStringsFixup fix(value); |
220 CompactStringsFixup fix(value); |
221 InstanceKlass::cast(SystemDictionary::String_klass())->do_local_static_fields(&fix); |
221 SystemDictionary::String_klass()->do_local_static_fields(&fix); |
222 } |
222 } |
223 |
223 |
224 Handle java_lang_String::basic_create(int length, bool is_latin1, TRAPS) { |
224 Handle java_lang_String::basic_create(int length, bool is_latin1, TRAPS) { |
225 assert(initialized, "Must be initialized"); |
225 assert(initialized, "Must be initialized"); |
226 assert(CompactStrings || !is_latin1, "Must be UTF16 without CompactStrings"); |
226 assert(CompactStrings || !is_latin1, "Must be UTF16 without CompactStrings"); |
3988 #endif |
3988 #endif |
3989 |
3989 |
3990 int java_lang_System::in_offset_in_bytes() { return static_in_offset; } |
3990 int java_lang_System::in_offset_in_bytes() { return static_in_offset; } |
3991 int java_lang_System::out_offset_in_bytes() { return static_out_offset; } |
3991 int java_lang_System::out_offset_in_bytes() { return static_out_offset; } |
3992 int java_lang_System::err_offset_in_bytes() { return static_err_offset; } |
3992 int java_lang_System::err_offset_in_bytes() { return static_err_offset; } |
|
3993 |
|
3994 // Support for jdk_internal_misc_UnsafeConstants |
|
3995 // |
|
3996 class UnsafeConstantsFixup : public FieldClosure { |
|
3997 private: |
|
3998 int _address_size; |
|
3999 int _page_size; |
|
4000 bool _big_endian; |
|
4001 bool _use_unaligned_access; |
|
4002 public: |
|
4003 UnsafeConstantsFixup() { |
|
4004 // round up values for all static final fields |
|
4005 _address_size = sizeof(void*); |
|
4006 _page_size = os::vm_page_size(); |
|
4007 _big_endian = LITTLE_ENDIAN_ONLY(false) BIG_ENDIAN_ONLY(true); |
|
4008 _use_unaligned_access = UseUnalignedAccesses; |
|
4009 } |
|
4010 |
|
4011 void do_field(fieldDescriptor* fd) { |
|
4012 oop mirror = fd->field_holder()->java_mirror(); |
|
4013 assert(mirror != NULL, "UnsafeConstants must have mirror already"); |
|
4014 assert(fd->field_holder() == SystemDictionary::UnsafeConstants_klass(), "Should be UnsafeConstants"); |
|
4015 assert(fd->is_final(), "fields of UnsafeConstants must be final"); |
|
4016 assert(fd->is_static(), "fields of UnsafeConstants must be static"); |
|
4017 if (fd->name() == vmSymbols::address_size_name()) { |
|
4018 mirror->int_field_put(fd->offset(), _address_size); |
|
4019 } else if (fd->name() == vmSymbols::page_size_name()) { |
|
4020 mirror->int_field_put(fd->offset(), _page_size); |
|
4021 } else if (fd->name() == vmSymbols::big_endian_name()) { |
|
4022 mirror->bool_field_put(fd->offset(), _big_endian); |
|
4023 } else if (fd->name() == vmSymbols::use_unaligned_access_name()) { |
|
4024 mirror->bool_field_put(fd->offset(), _use_unaligned_access); |
|
4025 } else { |
|
4026 assert(false, "unexpected UnsafeConstants field"); |
|
4027 } |
|
4028 } |
|
4029 }; |
|
4030 |
|
4031 void jdk_internal_misc_UnsafeConstants::set_unsafe_constants() { |
|
4032 UnsafeConstantsFixup fixup; |
|
4033 SystemDictionary::UnsafeConstants_klass()->do_local_static_fields(&fixup); |
|
4034 } |
3993 |
4035 |
3994 int java_lang_Class::_klass_offset; |
4036 int java_lang_Class::_klass_offset; |
3995 int java_lang_Class::_array_klass_offset; |
4037 int java_lang_Class::_array_klass_offset; |
3996 int java_lang_Class::_oop_size_offset; |
4038 int java_lang_Class::_oop_size_offset; |
3997 int java_lang_Class::_static_oop_field_count_offset; |
4039 int java_lang_Class::_static_oop_field_count_offset; |