< prev index next >

src/hotspot/share/ci/ciReplay.cpp

Print this page

  24 
  25 #include "ci/ciKlass.hpp"
  26 #include "ci/ciMethodData.hpp"
  27 #include "ci/ciReplay.hpp"
  28 #include "ci/ciSymbol.hpp"
  29 #include "ci/ciUtilities.inline.hpp"
  30 #include "classfile/javaClasses.hpp"
  31 #include "classfile/symbolTable.hpp"
  32 #include "classfile/systemDictionary.hpp"
  33 #include "compiler/compilationPolicy.hpp"
  34 #include "compiler/compileBroker.hpp"
  35 #include "compiler/compilerDefinitions.inline.hpp"
  36 #include "interpreter/linkResolver.hpp"
  37 #include "jvm.h"
  38 #include "memory/allocation.inline.hpp"
  39 #include "memory/oopFactory.hpp"
  40 #include "memory/resourceArea.hpp"
  41 #include "oops/constantPool.inline.hpp"
  42 #include "oops/cpCache.inline.hpp"
  43 #include "oops/fieldStreams.inline.hpp"

  44 #include "oops/klass.inline.hpp"
  45 #include "oops/method.inline.hpp"
  46 #include "oops/oop.inline.hpp"
  47 #include "oops/resolvedIndyEntry.hpp"
  48 #include "prims/jvmtiExport.hpp"
  49 #include "prims/methodHandles.hpp"
  50 #include "runtime/fieldDescriptor.inline.hpp"
  51 #include "runtime/globals_extension.hpp"
  52 #include "runtime/handles.inline.hpp"
  53 #include "runtime/java.hpp"
  54 #include "runtime/jniHandles.inline.hpp"
  55 #include "runtime/threads.hpp"
  56 #include "utilities/copy.hpp"
  57 #include "utilities/macros.hpp"
  58 #include "utilities/utf8.hpp"
  59 
  60 // ciReplay
  61 
  62 typedef struct _ciMethodDataRecord {
  63   const char* _klass_name;

 494         return nullptr;
 495       }
 496       if (strcmp(field, ";") == 0) {
 497         break;
 498       }
 499       // raw Method*
 500       if (strcmp(field, "<vmtarget>") == 0) {
 501         Method* vmtarget = java_lang_invoke_MemberName::vmtarget(obj);
 502         k = (vmtarget == nullptr) ? nullptr : vmtarget->method_holder();
 503         if (k == nullptr) {
 504           report_error("null vmtarget found");
 505           return nullptr;
 506         }
 507         if (!parse_terminator()) {
 508           report_error("missing terminator");
 509           return nullptr;
 510         }
 511         return k;
 512       }
 513       obj = ciReplay::obj_field(obj, field);
 514       // array
 515       if (obj != nullptr && obj->is_objArray()) {
 516         objArrayOop arr = (objArrayOop)obj;
 517         int index = parse_int("index");
 518         if (index >= arr->length()) {
 519           report_error("bad array index");
 520           return nullptr;
 521         }
 522         obj = arr->obj_at(index);
 523       }
 524     } while (obj != nullptr);
 525     if (obj == nullptr) {
 526       report_error("null field found");
 527       return nullptr;
 528     }
 529     k = obj->klass();
 530     return k;
 531   }
 532 
 533   // Parse a valid klass name and look it up
 534   // syntax: <name>

 944     ConstantPool* cp = k->constants();
 945     if (length != cp->length()) {
 946       report_error("constant pool length mismatch: wrong class files?");
 947       return;
 948     }
 949 
 950     int parsed_two_word = 0;
 951     for (int i = 1; i < length; i++) {
 952       int tag = parse_int("tag");
 953       if (had_error()) {
 954         return;
 955       }
 956       switch (cp->tag_at(i).value()) {
 957         case JVM_CONSTANT_UnresolvedClass: {
 958           if (tag == JVM_CONSTANT_Class) {
 959             tty->print_cr("Resolving klass %s at %d", cp->klass_name_at(i)->as_utf8(), i);
 960             Klass* k = cp->klass_at(i, CHECK);
 961           }
 962           break;
 963         }

 964         case JVM_CONSTANT_Long:
 965         case JVM_CONSTANT_Double:
 966           parsed_two_word = i + 1;
 967 
 968         case JVM_CONSTANT_ClassIndex:
 969         case JVM_CONSTANT_StringIndex:
 970         case JVM_CONSTANT_String:
 971         case JVM_CONSTANT_UnresolvedClassInError:
 972         case JVM_CONSTANT_Fieldref:
 973         case JVM_CONSTANT_Methodref:
 974         case JVM_CONSTANT_InterfaceMethodref:
 975         case JVM_CONSTANT_NameAndType:
 976         case JVM_CONSTANT_Utf8:
 977         case JVM_CONSTANT_Integer:
 978         case JVM_CONSTANT_Float:
 979         case JVM_CONSTANT_MethodHandle:
 980         case JVM_CONSTANT_MethodType:
 981         case JVM_CONSTANT_Dynamic:
 982         case JVM_CONSTANT_InvokeDynamic:
 983           if (tag != cp->tag_at(i).value()) {

 990           if (tag == JVM_CONSTANT_UnresolvedClass) {
 991             Klass* k = cp->klass_at(i, CHECK);
 992             tty->print_cr("Warning: entry was unresolved in the replay data: %s", k->name()->as_utf8());
 993           } else if (tag != JVM_CONSTANT_Class) {
 994             report_error("Unexpected tag");
 995             return;
 996           }
 997           break;
 998 
 999         case 0:
1000           if (parsed_two_word == i) continue;
1001 
1002         default:
1003           fatal("Unexpected tag: %d", cp->tag_at(i).value());
1004           break;
1005       }
1006 
1007     }
1008   }
1009 
1010   // staticfield <klass> <name> <signature> <value>
1011   //
1012   // Initialize a class and fill in the value for a static field.
1013   // This is useful when the compile was dependent on the value of
1014   // static fields but it's impossible to properly rerun the static
1015   // initializer.
1016   void process_staticfield(TRAPS) {
1017     InstanceKlass* k = (InstanceKlass *)parse_klass(CHECK);
1018 
1019     if (k == nullptr || ReplaySuppressInitializers == 0 ||
1020         (ReplaySuppressInitializers == 2 && k->class_loader() == nullptr)) {
1021       skip_remaining();
1022       return;
1023     }
1024 
1025     assert(k->is_initialized(), "must be");
1026 
1027     const char* field_name = parse_escaped_string();
1028     const char* field_signature = parse_string();
1029     fieldDescriptor fd;
1030     Symbol* name = SymbolTable::new_symbol(field_name);
1031     Symbol* sig = SymbolTable::new_symbol(field_signature);
1032     if (!k->find_local_field(name, sig, &fd) ||
1033         !fd.is_static() ||
1034         fd.has_initial_value()) {
1035       report_error(field_name);
1036       return;




















































1037     }

1038 
1039     oop java_mirror = k->java_mirror();
1040     if (field_signature[0] == JVM_SIGNATURE_ARRAY) {
1041       int length = parse_int("array length");
1042       oop value = nullptr;
1043 
1044       if (length != -1) {
1045         if (field_signature[1] == JVM_SIGNATURE_ARRAY) {
1046           // multi dimensional array
1047           ArrayKlass* kelem = (ArrayKlass *)parse_klass(CHECK);
1048           if (kelem == nullptr) {
1049             return;
1050           }
1051           int rank = 0;
1052           while (field_signature[rank] == JVM_SIGNATURE_ARRAY) {
1053             rank++;
1054           }
1055           jint* dims = NEW_RESOURCE_ARRAY(jint, rank);
1056           dims[0] = length;
1057           for (int i = 1; i < rank; i++) {
1058             dims[i] = 1; // These aren't relevant to the compiler
1059           }
1060           value = kelem->multi_allocate(rank, dims, CHECK);
1061         } else {
1062           if (strcmp(field_signature, "[B") == 0) {
1063             value = oopFactory::new_byteArray(length, CHECK);
1064           } else if (strcmp(field_signature, "[Z") == 0) {
1065             value = oopFactory::new_boolArray(length, CHECK);
1066           } else if (strcmp(field_signature, "[C") == 0) {
1067             value = oopFactory::new_charArray(length, CHECK);
1068           } else if (strcmp(field_signature, "[S") == 0) {
1069             value = oopFactory::new_shortArray(length, CHECK);
1070           } else if (strcmp(field_signature, "[F") == 0) {
1071             value = oopFactory::new_floatArray(length, CHECK);
1072           } else if (strcmp(field_signature, "[D") == 0) {
1073             value = oopFactory::new_doubleArray(length, CHECK);
1074           } else if (strcmp(field_signature, "[I") == 0) {
1075             value = oopFactory::new_intArray(length, CHECK);
1076           } else if (strcmp(field_signature, "[J") == 0) {
1077             value = oopFactory::new_longArray(length, CHECK);
1078           } else if (field_signature[0] == JVM_SIGNATURE_ARRAY &&
1079                      field_signature[1] == JVM_SIGNATURE_CLASS) {
1080             Klass* actual_array_klass = parse_klass(CHECK);

1081             Klass* kelem = ObjArrayKlass::cast(actual_array_klass)->element_klass();
1082             value = oopFactory::new_objArray(kelem, length, CHECK);
1083           } else {
1084             report_error("unhandled array staticfield");
1085           }
1086         }














1087       }












































































1088       java_mirror->obj_field_put(fd.offset(), value);
1089     } else {
1090       const char* string_value = parse_escaped_string();
1091       if (strcmp(field_signature, "I") == 0) {
1092         int value = atoi(string_value);
1093         java_mirror->int_field_put(fd.offset(), value);
1094       } else if (strcmp(field_signature, "B") == 0) {
1095         int value = atoi(string_value);
1096         java_mirror->byte_field_put(fd.offset(), value);
1097       } else if (strcmp(field_signature, "C") == 0) {
1098         int value = atoi(string_value);
1099         java_mirror->char_field_put(fd.offset(), value);
1100       } else if (strcmp(field_signature, "S") == 0) {
1101         int value = atoi(string_value);
1102         java_mirror->short_field_put(fd.offset(), value);
1103       } else if (strcmp(field_signature, "Z") == 0) {
1104         int value = atoi(string_value);
1105         java_mirror->bool_field_put(fd.offset(), value);
1106       } else if (strcmp(field_signature, "J") == 0) {
1107         jlong value;
1108         if (sscanf(string_value, JLONG_FORMAT, &value) != 1) {
1109           fprintf(stderr, "Error parsing long: %s\n", string_value);
1110           return;
1111         }
1112         java_mirror->long_field_put(fd.offset(), value);
1113       } else if (strcmp(field_signature, "F") == 0) {
1114         float value = atof(string_value);
1115         java_mirror->float_field_put(fd.offset(), value);
1116       } else if (strcmp(field_signature, "D") == 0) {
1117         double value = atof(string_value);
1118         java_mirror->double_field_put(fd.offset(), value);
1119       } else if (strcmp(field_signature, "Ljava/lang/String;") == 0) {
1120         Handle value = java_lang_String::create_from_str(string_value, CHECK);
1121         java_mirror->obj_field_put(fd.offset(), value());
1122       } else if (field_signature[0] == JVM_SIGNATURE_CLASS) {
1123         oop value = nullptr;
1124         if (string_value != nullptr) {
1125           Klass* k = resolve_klass(string_value, CHECK);
1126           value = InstanceKlass::cast(k)->allocate_instance(CHECK);
1127         }
1128         java_mirror->obj_field_put(fd.offset(), value);
1129       } else {
1130         report_error("unhandled staticfield");
1131       }
1132     }
1133   }
1134 
1135 #if INCLUDE_JVMTI
1136   // JvmtiExport <field> <value>
1137   void process_JvmtiExport(TRAPS) {
1138     const char* field = parse_string();
1139     bool value = parse_int("JvmtiExport flag") != 0;
1140     if (strcmp(field, "can_access_local_variables") == 0) {
1141       JvmtiExport::set_can_access_local_variables(value);
1142     } else if (strcmp(field, "can_hotswap_or_post_breakpoint") == 0) {
1143       JvmtiExport::set_can_hotswap_or_post_breakpoint(value);
1144     } else if (strcmp(field, "can_post_on_exceptions") == 0) {
1145       JvmtiExport::set_can_post_on_exceptions(value);
1146     } else {
1147       report_error("Unrecognized JvmtiExport directive");
1148     }
1149   }

  24 
  25 #include "ci/ciKlass.hpp"
  26 #include "ci/ciMethodData.hpp"
  27 #include "ci/ciReplay.hpp"
  28 #include "ci/ciSymbol.hpp"
  29 #include "ci/ciUtilities.inline.hpp"
  30 #include "classfile/javaClasses.hpp"
  31 #include "classfile/symbolTable.hpp"
  32 #include "classfile/systemDictionary.hpp"
  33 #include "compiler/compilationPolicy.hpp"
  34 #include "compiler/compileBroker.hpp"
  35 #include "compiler/compilerDefinitions.inline.hpp"
  36 #include "interpreter/linkResolver.hpp"
  37 #include "jvm.h"
  38 #include "memory/allocation.inline.hpp"
  39 #include "memory/oopFactory.hpp"
  40 #include "memory/resourceArea.hpp"
  41 #include "oops/constantPool.inline.hpp"
  42 #include "oops/cpCache.inline.hpp"
  43 #include "oops/fieldStreams.inline.hpp"
  44 #include "oops/inlineKlass.inline.hpp"
  45 #include "oops/klass.inline.hpp"
  46 #include "oops/method.inline.hpp"
  47 #include "oops/oop.inline.hpp"
  48 #include "oops/resolvedIndyEntry.hpp"
  49 #include "prims/jvmtiExport.hpp"
  50 #include "prims/methodHandles.hpp"
  51 #include "runtime/fieldDescriptor.inline.hpp"
  52 #include "runtime/globals_extension.hpp"
  53 #include "runtime/handles.inline.hpp"
  54 #include "runtime/java.hpp"
  55 #include "runtime/jniHandles.inline.hpp"
  56 #include "runtime/threads.hpp"
  57 #include "utilities/copy.hpp"
  58 #include "utilities/macros.hpp"
  59 #include "utilities/utf8.hpp"
  60 
  61 // ciReplay
  62 
  63 typedef struct _ciMethodDataRecord {
  64   const char* _klass_name;

 495         return nullptr;
 496       }
 497       if (strcmp(field, ";") == 0) {
 498         break;
 499       }
 500       // raw Method*
 501       if (strcmp(field, "<vmtarget>") == 0) {
 502         Method* vmtarget = java_lang_invoke_MemberName::vmtarget(obj);
 503         k = (vmtarget == nullptr) ? nullptr : vmtarget->method_holder();
 504         if (k == nullptr) {
 505           report_error("null vmtarget found");
 506           return nullptr;
 507         }
 508         if (!parse_terminator()) {
 509           report_error("missing terminator");
 510           return nullptr;
 511         }
 512         return k;
 513       }
 514       obj = ciReplay::obj_field(obj, field);
 515       // TODO 8350865 I think we need to handle null-free/flat arrays here
 516       if (obj != nullptr && obj->is_objArray()) {
 517         objArrayOop arr = (objArrayOop)obj;
 518         int index = parse_int("index");
 519         if (index >= arr->length()) {
 520           report_error("bad array index");
 521           return nullptr;
 522         }
 523         obj = arr->obj_at(index);
 524       }
 525     } while (obj != nullptr);
 526     if (obj == nullptr) {
 527       report_error("null field found");
 528       return nullptr;
 529     }
 530     k = obj->klass();
 531     return k;
 532   }
 533 
 534   // Parse a valid klass name and look it up
 535   // syntax: <name>

 945     ConstantPool* cp = k->constants();
 946     if (length != cp->length()) {
 947       report_error("constant pool length mismatch: wrong class files?");
 948       return;
 949     }
 950 
 951     int parsed_two_word = 0;
 952     for (int i = 1; i < length; i++) {
 953       int tag = parse_int("tag");
 954       if (had_error()) {
 955         return;
 956       }
 957       switch (cp->tag_at(i).value()) {
 958         case JVM_CONSTANT_UnresolvedClass: {
 959           if (tag == JVM_CONSTANT_Class) {
 960             tty->print_cr("Resolving klass %s at %d", cp->klass_name_at(i)->as_utf8(), i);
 961             Klass* k = cp->klass_at(i, CHECK);
 962           }
 963           break;
 964         }
 965 
 966         case JVM_CONSTANT_Long:
 967         case JVM_CONSTANT_Double:
 968           parsed_two_word = i + 1;
 969 
 970         case JVM_CONSTANT_ClassIndex:
 971         case JVM_CONSTANT_StringIndex:
 972         case JVM_CONSTANT_String:
 973         case JVM_CONSTANT_UnresolvedClassInError:
 974         case JVM_CONSTANT_Fieldref:
 975         case JVM_CONSTANT_Methodref:
 976         case JVM_CONSTANT_InterfaceMethodref:
 977         case JVM_CONSTANT_NameAndType:
 978         case JVM_CONSTANT_Utf8:
 979         case JVM_CONSTANT_Integer:
 980         case JVM_CONSTANT_Float:
 981         case JVM_CONSTANT_MethodHandle:
 982         case JVM_CONSTANT_MethodType:
 983         case JVM_CONSTANT_Dynamic:
 984         case JVM_CONSTANT_InvokeDynamic:
 985           if (tag != cp->tag_at(i).value()) {

 992           if (tag == JVM_CONSTANT_UnresolvedClass) {
 993             Klass* k = cp->klass_at(i, CHECK);
 994             tty->print_cr("Warning: entry was unresolved in the replay data: %s", k->name()->as_utf8());
 995           } else if (tag != JVM_CONSTANT_Class) {
 996             report_error("Unexpected tag");
 997             return;
 998           }
 999           break;
1000 
1001         case 0:
1002           if (parsed_two_word == i) continue;
1003 
1004         default:
1005           fatal("Unexpected tag: %d", cp->tag_at(i).value());
1006           break;
1007       }
1008 
1009     }
1010   }
1011 
1012   class InlineTypeFieldInitializer : public FieldClosure {
1013     oop _vt;
1014     CompileReplay* _replay;
1015   public:
1016     InlineTypeFieldInitializer(oop vt, CompileReplay* replay)
1017   : _vt(vt), _replay(replay) {}
1018 
1019     void do_field(fieldDescriptor* fd) {
1020       BasicType bt = fd->field_type();
1021       const char* string_value = fd->is_null_free_inline_type() ? nullptr : _replay->parse_escaped_string();
1022       switch (bt) {
1023       case T_BYTE: {
1024         int value = atoi(string_value);
1025         _vt->byte_field_put(fd->offset(), value);
1026         break;
1027       }
1028       case T_BOOLEAN: {
1029         int value = atoi(string_value);
1030         _vt->bool_field_put(fd->offset(), value);
1031         break;
1032       }
1033       case T_SHORT: {
1034         int value = atoi(string_value);
1035         _vt->short_field_put(fd->offset(), value);
1036         break;
1037       }
1038       case T_CHAR: {
1039         int value = atoi(string_value);
1040         _vt->char_field_put(fd->offset(), value);
1041         break;
1042       }
1043       case T_INT: {
1044         int value = atoi(string_value);
1045         _vt->int_field_put(fd->offset(), value);
1046         break;
1047       }
1048       case T_LONG: {
1049         jlong value;
1050         if (sscanf(string_value, JLONG_FORMAT, &value) != 1) {
1051           fprintf(stderr, "Error parsing long: %s\n", string_value);
1052           break;
1053         }
1054         _vt->long_field_put(fd->offset(), value);
1055         break;
1056       }
1057       case T_FLOAT: {
1058         float value = atof(string_value);
1059         _vt->float_field_put(fd->offset(), value);
1060         break;
1061       }
1062       case T_DOUBLE: {
1063         double value = atof(string_value);
1064         _vt->double_field_put(fd->offset(), value);
1065         break;
1066       }
1067       case T_ARRAY:
1068       case T_OBJECT:
1069         if (!fd->is_null_free_inline_type()) {
1070           JavaThread* THREAD = JavaThread::current();
1071           bool res = _replay->process_staticfield_reference(string_value, _vt, fd, THREAD);
1072           assert(res, "should succeed for arrays & objects");
1073           break;
1074         } else {
1075           InlineKlass* vk = InlineKlass::cast(fd->field_holder()->get_inline_type_field_klass(fd->index()));
1076           if (fd->is_flat()) {
1077             int field_offset = fd->offset() - vk->payload_offset();
1078             oop obj = cast_to_oop(cast_from_oop<address>(_vt) + field_offset);
1079             InlineTypeFieldInitializer init_fields(obj, _replay);
1080             vk->do_nonstatic_fields(&init_fields);
1081           } else {
1082             oop value = vk->allocate_instance(JavaThread::current());
1083             _vt->obj_field_put(fd->offset(), value);
1084           }
1085           break;
1086         }
1087       default: {
1088         fatal("Unhandled type: %s", type2name(bt));
1089       }
1090       }
1091     }
1092   };
1093 
1094   bool process_staticfield_reference(const char* field_signature, oop java_mirror, fieldDescriptor* fd, TRAPS) {
1095     if (field_signature[0] == JVM_SIGNATURE_ARRAY) {
1096       int length = parse_int("array length");
1097       oop value = nullptr;
1098 
1099       if (length != -1) {
1100         if (field_signature[1] == JVM_SIGNATURE_ARRAY) {
1101           // multi dimensional array
1102           Klass* k = resolve_klass(field_signature, CHECK_(true));
1103           ArrayKlass* kelem = (ArrayKlass *)k;


1104           int rank = 0;
1105           while (field_signature[rank] == JVM_SIGNATURE_ARRAY) {
1106             rank++;
1107           }
1108           jint* dims = NEW_RESOURCE_ARRAY(jint, rank);
1109           dims[0] = length;
1110           for (int i = 1; i < rank; i++) {
1111             dims[i] = 1; // These aren't relevant to the compiler
1112           }
1113           value = kelem->multi_allocate(rank, dims, CHECK_(true));
1114         } else {
1115           if (strcmp(field_signature, "[B") == 0) {
1116             value = oopFactory::new_byteArray(length, CHECK_(true));
1117           } else if (strcmp(field_signature, "[Z") == 0) {
1118             value = oopFactory::new_boolArray(length, CHECK_(true));
1119           } else if (strcmp(field_signature, "[C") == 0) {
1120             value = oopFactory::new_charArray(length, CHECK_(true));
1121           } else if (strcmp(field_signature, "[S") == 0) {
1122             value = oopFactory::new_shortArray(length, CHECK_(true));
1123           } else if (strcmp(field_signature, "[F") == 0) {
1124             value = oopFactory::new_floatArray(length, CHECK_(true));
1125           } else if (strcmp(field_signature, "[D") == 0) {
1126             value = oopFactory::new_doubleArray(length, CHECK_(true));
1127           } else if (strcmp(field_signature, "[I") == 0) {
1128             value = oopFactory::new_intArray(length, CHECK_(true));
1129           } else if (strcmp(field_signature, "[J") == 0) {
1130             value = oopFactory::new_longArray(length, CHECK_(true));
1131           } else if (field_signature[0] == JVM_SIGNATURE_ARRAY &&
1132                      field_signature[1] == JVM_SIGNATURE_CLASS) {
1133             Klass* actual_array_klass = parse_klass(CHECK_(true));
1134             // TODO 8350865 I think we need to handle null-free/flat arrays here
1135             Klass* kelem = ObjArrayKlass::cast(actual_array_klass)->element_klass();
1136             value = oopFactory::new_objArray(kelem, length, CHECK_(true));
1137           } else {
1138             report_error("unhandled array staticfield");
1139           }
1140         }
1141         java_mirror->obj_field_put(fd->offset(), value);
1142         return true;
1143       }
1144     } else if (strcmp(field_signature, "Ljava/lang/String;") == 0) {
1145       const char* string_value = parse_escaped_string();
1146       Handle value = java_lang_String::create_from_str(string_value, CHECK_(true));
1147       java_mirror->obj_field_put(fd->offset(), value());
1148       return true;
1149     } else if (field_signature[0] == JVM_SIGNATURE_CLASS) {
1150       const char* instance = parse_escaped_string();
1151       oop value = nullptr;
1152       if (instance != nullptr) {
1153         Klass* k = resolve_klass(instance, CHECK_(true));
1154         value = InstanceKlass::cast(k)->allocate_instance(CHECK_(true));
1155       }
1156       java_mirror->obj_field_put(fd->offset(), value);
1157       return true;
1158     }
1159     return false;
1160   }
1161 
1162   // Initialize a class and fill in the value for a static field.
1163   // This is useful when the compile was dependent on the value of
1164   // static fields but it's impossible to properly rerun the static
1165   // initializer.
1166   void process_staticfield(TRAPS) {
1167     InstanceKlass* k = (InstanceKlass *)parse_klass(CHECK);
1168 
1169     if (k == nullptr || ReplaySuppressInitializers == 0 ||
1170         (ReplaySuppressInitializers == 2 && k->class_loader() == nullptr)) {
1171         skip_remaining();
1172       return;
1173     }
1174 
1175     assert(k->is_initialized(), "must be");
1176 
1177     const char* field_name = parse_escaped_string();
1178     const char* field_signature = parse_string();
1179     fieldDescriptor fd;
1180     Symbol* name = SymbolTable::new_symbol(field_name);
1181     Symbol* sig = SymbolTable::new_symbol(field_signature);
1182     if (!k->find_local_field(name, sig, &fd) ||
1183         !fd.is_static() ||
1184         fd.has_initial_value()) {
1185       report_error(field_name);
1186       return;
1187     }
1188 
1189     oop java_mirror = k->java_mirror();
1190     if (strcmp(field_signature, "I") == 0) {
1191       const char* string_value = parse_escaped_string();
1192       int value = atoi(string_value);
1193       java_mirror->int_field_put(fd.offset(), value);
1194     } else if (strcmp(field_signature, "B") == 0) {
1195       const char* string_value = parse_escaped_string();
1196       int value = atoi(string_value);
1197       java_mirror->byte_field_put(fd.offset(), value);
1198     } else if (strcmp(field_signature, "C") == 0) {
1199       const char* string_value = parse_escaped_string();
1200       int value = atoi(string_value);
1201       java_mirror->char_field_put(fd.offset(), value);
1202     } else if (strcmp(field_signature, "S") == 0) {
1203       const char* string_value = parse_escaped_string();
1204       int value = atoi(string_value);
1205       java_mirror->short_field_put(fd.offset(), value);
1206     } else if (strcmp(field_signature, "Z") == 0) {
1207       const char* string_value = parse_escaped_string();
1208       int value = atoi(string_value);
1209       java_mirror->bool_field_put(fd.offset(), value);
1210     } else if (strcmp(field_signature, "J") == 0) {
1211       const char* string_value = parse_escaped_string();
1212       jlong value;
1213       if (sscanf(string_value, JLONG_FORMAT, &value) != 1) {
1214         fprintf(stderr, "Error parsing long: %s\n", string_value);
1215         return;
1216       }
1217       java_mirror->long_field_put(fd.offset(), value);
1218     } else if (strcmp(field_signature, "F") == 0) {
1219       const char* string_value = parse_escaped_string();
1220       float value = atof(string_value);
1221       java_mirror->float_field_put(fd.offset(), value);
1222     } else if (strcmp(field_signature, "D") == 0) {
1223       const char* string_value = parse_escaped_string();
1224       double value = atof(string_value);
1225       java_mirror->double_field_put(fd.offset(), value);
1226     } else if (fd.is_null_free_inline_type()) {
1227       Klass* kelem = resolve_klass(field_signature, CHECK);
1228       InlineKlass* vk = InlineKlass::cast(kelem);
1229       oop value = vk->allocate_instance(CHECK);
1230       InlineTypeFieldInitializer init_fields(value, this);
1231       vk->do_nonstatic_fields(&init_fields);
1232       java_mirror->obj_field_put(fd.offset(), value);
1233     } else {
1234       bool res = process_staticfield_reference(field_signature, java_mirror, &fd, CHECK);
1235       if (!res)  {






































1236         report_error("unhandled staticfield");
1237       }
1238     }
1239   }
1240 
1241 #if INCLUDE_JVMTI
1242   // JvmtiExport <field> <value>
1243   void process_JvmtiExport(TRAPS) {
1244     const char* field = parse_string();
1245     bool value = parse_int("JvmtiExport flag") != 0;
1246     if (strcmp(field, "can_access_local_variables") == 0) {
1247       JvmtiExport::set_can_access_local_variables(value);
1248     } else if (strcmp(field, "can_hotswap_or_post_breakpoint") == 0) {
1249       JvmtiExport::set_can_hotswap_or_post_breakpoint(value);
1250     } else if (strcmp(field, "can_post_on_exceptions") == 0) {
1251       JvmtiExport::set_can_post_on_exceptions(value);
1252     } else {
1253       report_error("Unrecognized JvmtiExport directive");
1254     }
1255   }
< prev index next >