< prev index next >

src/share/vm/ci/ciReplay.cpp

Print this page
rev 10535 : incremental inlining fixes

*** 30,39 **** --- 30,40 ---- #include "compiler/compileBroker.hpp" #include "memory/allocation.inline.hpp" #include "memory/oopFactory.hpp" #include "memory/resourceArea.hpp" #include "oops/oop.inline.hpp" + #include "oops/valueKlass.hpp" #include "utilities/copy.hpp" #include "utilities/macros.hpp" #ifndef PRODUCT
*** 735,744 **** --- 736,823 ---- } } } + class ValueTypeFieldInitializer : public FieldClosure { + oop _vt; + CompileReplay* _replay; + public: + ValueTypeFieldInitializer(oop vt, CompileReplay* replay) + : _vt(vt), _replay(replay) {} + + void do_field(fieldDescriptor* fd) { + BasicType bt = fd->field_type(); + const char* string_value = bt != T_VALUETYPE ? _replay->parse_escaped_string() : NULL; + switch (bt) { + case T_BYTE: { + int value = atoi(string_value); + _vt->byte_field_put(fd->offset(), value); + break; + } + case T_BOOLEAN: { + int value = atoi(string_value); + _vt->bool_field_put(fd->offset(), value); + break; + } + case T_SHORT: { + int value = atoi(string_value); + _vt->short_field_put(fd->offset(), value); + break; + } + case T_CHAR: { + int value = atoi(string_value); + _vt->char_field_put(fd->offset(), value); + break; + } + case T_INT: { + int value = atoi(string_value); + _vt->int_field_put(fd->offset(), value); + break; + } + case T_LONG: { + jlong value; + if (sscanf(string_value, JLONG_FORMAT, &value) != 1) { + fprintf(stderr, "Error parsing long: %s\n", string_value); + break; + } + _vt->long_field_put(fd->offset(), value); + break; + } + case T_FLOAT: { + float value = atof(string_value); + _vt->float_field_put(fd->offset(), value); + break; + } + case T_DOUBLE: { + double value = atof(string_value); + _vt->double_field_put(fd->offset(), value); + break; + } + case T_ARRAY: + _replay->report_error("Array in value type unsupported"); + break; + case T_OBJECT: + _replay->report_error("Object in value type unsupported"); + break; + case T_VALUETYPE: { + Thread* THREAD = Thread::current(); + SignatureStream ss(fd->signature(), false); + InstanceKlass* holder = fd->field_holder(); + Klass* k = ss.as_klass(Handle(holder->class_loader()), Handle(holder->protection_domain()), SignatureStream::ReturnNull, THREAD); + assert(k != NULL && !HAS_PENDING_EXCEPTION, "can resolve klass?"); + ValueKlass* vk = ValueKlass::cast(k); + int field_offset = fd->offset() - vk->first_field_offset(); + oop obj = (oop)((address)_vt + field_offset); + ValueTypeFieldInitializer init_fields(obj, _replay); + vk->do_nonstatic_fields(&init_fields); + break; + } + } + } + }; + // Initialize a class and fill in the value for a static field. // This is useful when the compile was dependent on the value of // static fields but it's impossible to properly rerun the static // initiailizer. void process_staticfield(TRAPS) {
*** 749,759 **** return; } assert(k->is_initialized(), "must be"); ! const char* field_name = parse_escaped_string();; const char* field_signature = parse_string(); fieldDescriptor fd; Symbol* name = SymbolTable::lookup(field_name, (int)strlen(field_name), CHECK); Symbol* sig = SymbolTable::lookup(field_signature, (int)strlen(field_signature), CHECK); if (!k->find_local_field(name, sig, &fd) || --- 828,838 ---- return; } assert(k->is_initialized(), "must be"); ! const char* field_name = parse_escaped_string(); const char* field_signature = parse_string(); fieldDescriptor fd; Symbol* name = SymbolTable::lookup(field_name, (int)strlen(field_name), CHECK); Symbol* sig = SymbolTable::lookup(field_signature, (int)strlen(field_signature), CHECK); if (!k->find_local_field(name, sig, &fd) ||
*** 805,815 **** report_error("unhandled array staticfield"); } } java_mirror->obj_field_put(fd.offset(), value); } else { ! const char* string_value = parse_escaped_string(); if (strcmp(field_signature, "I") == 0) { int value = atoi(string_value); java_mirror->int_field_put(fd.offset(), value); } else if (strcmp(field_signature, "B") == 0) { int value = atoi(string_value); --- 884,894 ---- report_error("unhandled array staticfield"); } } java_mirror->obj_field_put(fd.offset(), value); } else { ! const char* string_value = field_signature[0] != 'Q' ? parse_escaped_string() : NULL; if (strcmp(field_signature, "I") == 0) { int value = atoi(string_value); java_mirror->int_field_put(fd.offset(), value); } else if (strcmp(field_signature, "B") == 0) { int value = atoi(string_value);
*** 842,851 **** --- 921,938 ---- } else if (field_signature[0] == 'L') { Symbol* klass_name = SymbolTable::lookup(field_signature, (int)strlen(field_signature), CHECK); KlassHandle kelem = resolve_klass(field_signature, CHECK); oop value = InstanceKlass::cast(kelem())->allocate_instance(CHECK); java_mirror->obj_field_put(fd.offset(), value); + } else if (field_signature[0] == 'Q') { + Symbol* klass_name = SymbolTable::lookup(field_signature, (int)strlen(field_signature), CHECK); + KlassHandle kelem = resolve_klass(field_signature, CHECK); + ValueKlass* vk = ValueKlass::cast(kelem()); + oop value = vk->allocate_instance(CHECK); + ValueTypeFieldInitializer init_fields(value, this); + vk->do_nonstatic_fields(&init_fields); + java_mirror->obj_field_put(fd.offset(), value); } else { report_error("unhandled staticfield"); } } }
< prev index next >