753 break;
754 case T_SHORT:
755 mirror()->short_field_put(fd->offset(), fd->int_initial_value());
756 break;
757 case T_INT:
758 mirror()->int_field_put(fd->offset(), fd->int_initial_value());
759 break;
760 case T_FLOAT:
761 mirror()->float_field_put(fd->offset(), fd->float_initial_value());
762 break;
763 case T_DOUBLE:
764 mirror()->double_field_put(fd->offset(), fd->double_initial_value());
765 break;
766 case T_LONG:
767 mirror()->long_field_put(fd->offset(), fd->long_initial_value());
768 break;
769 case T_OBJECT:
770 {
771 assert(fd->signature() == vmSymbols::string_signature(),
772 "just checking");
773 if (DumpSharedSpaces && MetaspaceShared::is_archive_object(mirror())) {
774 // Archive the String field and update the pointer.
775 oop s = mirror()->obj_field(fd->offset());
776 oop archived_s = StringTable::create_archived_string(s, CHECK);
777 mirror()->obj_field_put(fd->offset(), archived_s);
778 } else {
779 oop string = fd->string_initial_value(CHECK);
780 mirror()->obj_field_put(fd->offset(), string);
781 }
782 }
783 break;
784 default:
785 THROW_MSG(vmSymbols::java_lang_ClassFormatError(),
786 "Illegal ConstantValue attribute in class file");
787 }
788 }
789 }
790
791
792 void java_lang_Class::fixup_mirror(Klass* k, TRAPS) {
793 assert(InstanceMirrorKlass::offset_of_static_fields() != 0, "must have been computed already");
794
795 // If the offset was read from the shared archive, it was fixed up already
796 if (!k->is_shared()) {
797 if (k->is_instance_klass()) {
798 // During bootstrap, java.lang.Class wasn't loaded so static field
799 // offsets were computed without the size added it. Go back and
800 // update all the static field offsets to included the size.
801 for (JavaFieldStream fs(InstanceKlass::cast(k)); !fs.done(); fs.next()) {
|
753 break;
754 case T_SHORT:
755 mirror()->short_field_put(fd->offset(), fd->int_initial_value());
756 break;
757 case T_INT:
758 mirror()->int_field_put(fd->offset(), fd->int_initial_value());
759 break;
760 case T_FLOAT:
761 mirror()->float_field_put(fd->offset(), fd->float_initial_value());
762 break;
763 case T_DOUBLE:
764 mirror()->double_field_put(fd->offset(), fd->double_initial_value());
765 break;
766 case T_LONG:
767 mirror()->long_field_put(fd->offset(), fd->long_initial_value());
768 break;
769 case T_OBJECT:
770 {
771 assert(fd->signature() == vmSymbols::string_signature(),
772 "just checking");
773 #if INCLUDE_CDS_JAVA_HEAP
774 if (DumpSharedSpaces && MetaspaceShared::is_archive_object(mirror())) {
775 // Archive the String field and update the pointer.
776 oop s = mirror()->obj_field(fd->offset());
777 oop archived_s = StringTable::create_archived_string(s, CHECK);
778 mirror()->obj_field_put(fd->offset(), archived_s);
779 } else {
780 #endif
781 oop string = fd->string_initial_value(CHECK);
782 mirror()->obj_field_put(fd->offset(), string);
783 #if INCLUDE_CDS_JAVA_HEAP
784 }
785 #endif
786 }
787 break;
788 default:
789 THROW_MSG(vmSymbols::java_lang_ClassFormatError(),
790 "Illegal ConstantValue attribute in class file");
791 }
792 }
793 }
794
795
796 void java_lang_Class::fixup_mirror(Klass* k, TRAPS) {
797 assert(InstanceMirrorKlass::offset_of_static_fields() != 0, "must have been computed already");
798
799 // If the offset was read from the shared archive, it was fixed up already
800 if (!k->is_shared()) {
801 if (k->is_instance_klass()) {
802 // During bootstrap, java.lang.Class wasn't loaded so static field
803 // offsets were computed without the size added it. Go back and
804 // update all the static field offsets to included the size.
805 for (JavaFieldStream fs(InstanceKlass::cast(k)); !fs.done(); fs.next()) {
|