void ciMethodData::load_data() { MethodData* mdo = get_MethodData(); if (mdo == NULL) { return; } // To do: don't copy the data if it is not "ripe" -- require a minimum # // of invocations. // Snapshot the data -- actually, take an approximate snapshot of // the data. Any concurrently executing threads may be changing the // data as we copy it. Copy::disjoint_words((HeapWord*) mdo, (HeapWord*) &_orig, sizeof(_orig) / HeapWordSize); Arena* arena = CURRENT_ENV->arena(); _data_size = mdo->data_size(); _extra_data_size = mdo->extra_data_size(); int total_size = _data_size + _extra_data_size; _data = (intptr_t *) arena->Amalloc(total_size); Copy::disjoint_words((HeapWord*) mdo->data_base(), (HeapWord*) _data, total_size / HeapWordSize); // Traverse the profile data, translating any oops into their // ci equivalents. ResourceMark rm; ciProfileData* ci_data = first_data(); ProfileData* data = mdo->first_data(); while (is_valid(ci_data)) { ci_data->translate_from(data); ci_data = next_data(ci_data); data = mdo->next_data(data); } if (mdo->parameters_type_data() != NULL) { _parameters = data_layout_at(mdo->parameters_type_data_di()); ciParametersTypeData* parameters = new ciParametersTypeData(_parameters); parameters->translate_from(mdo->parameters_type_data()); } load_extra_data(); // Note: Extra data are all BitData, and do not need translation. _current_mileage = MethodData::mileage_of(mdo->method()); _invocation_counter = mdo->invocation_count(); _backedge_counter = mdo->backedge_count(); _state = mdo->is_mature()? mature_state: immature_state; _eflags = mdo->eflags(); _arg_local = mdo->arg_local(); _arg_stack = mdo->arg_stack(); _arg_returned = mdo->arg_returned(); #ifndef PRODUCT if (ReplayCompiles) { ciReplay::initialize(this); } #endif }
// copy our escape info to the MethodData* if it exists void ciMethodData::update_escape_info() { VM_ENTRY_MARK; MethodData* mdo = get_MethodData(); if ( mdo != NULL) { mdo->set_eflags(_eflags); mdo->set_arg_local(_arg_local); mdo->set_arg_stack(_arg_stack); mdo->set_arg_returned(_arg_returned); int arg_count = mdo->method()->size_of_parameters(); for (int i = 0; i < arg_count; i++) { mdo->set_arg_modified(i, arg_modified(i)); } } }
void ciMethodData::dump_replay_data(outputStream* out) { ResourceMark rm; MethodData* mdo = get_MethodData(); Method* method = mdo->method(); Klass* holder = method->method_holder(); out->print("ciMethodData %s %s %s %d %d", holder->name()->as_quoted_ascii(), method->name()->as_quoted_ascii(), method->signature()->as_quoted_ascii(), _state, current_mileage()); // dump the contents of the MDO header as raw data unsigned char* orig = (unsigned char*)&_orig; int length = sizeof(_orig); out->print(" orig %d", length); for (int i = 0; i < length; i++) { out->print(" %d", orig[i]); } // dump the MDO data as raw data int elements = (data_size() + extra_data_size()) / sizeof(intptr_t); out->print(" data %d", elements); for (int i = 0; i < elements; i++) { // We could use INTPTR_FORMAT here but that's a zero justified // which makes comparing it with the SA version of this output // harder. #ifdef _LP64 out->print(" 0x%" FORMAT64_MODIFIER "x", data()[i]); #else out->print(" 0x%x", data()[i]); #endif } // The MDO contained oop references as ciObjects, so scan for those // and emit pairs of offset and klass name so that they can be // reconstructed at runtime. The first round counts the number of // oop references and the second actually emits them. ciParametersTypeData* parameters = parameters_type_data(); for (int count = 0, round = 0; round < 2; round++) { if (round == 1) out->print(" oops %d", count); ProfileData* pdata = first_data(); for ( ; is_valid(pdata); pdata = next_data(pdata)) { if (pdata->is_VirtualCallData()) { ciVirtualCallData* vdata = (ciVirtualCallData*)pdata; dump_replay_data_receiver_type_helper<ciVirtualCallData>(out, round, count, vdata); if (pdata->is_VirtualCallTypeData()) { ciVirtualCallTypeData* call_type_data = (ciVirtualCallTypeData*)pdata; dump_replay_data_call_type_helper<ciVirtualCallTypeData>(out, round, count, call_type_data); } } else if (pdata->is_ReceiverTypeData()) { ciReceiverTypeData* vdata = (ciReceiverTypeData*)pdata; dump_replay_data_receiver_type_helper<ciReceiverTypeData>(out, round, count, vdata); } else if (pdata->is_CallTypeData()) { ciCallTypeData* call_type_data = (ciCallTypeData*)pdata; dump_replay_data_call_type_helper<ciCallTypeData>(out, round, count, call_type_data); } } if (parameters != NULL) { for (int i = 0; i < parameters->number_of_parameters(); i++) { dump_replay_data_type_helper(out, round, count, parameters, ParametersTypeData::type_offset(i), parameters->valid_parameter_type(i)); } } } for (int count = 0, round = 0; round < 2; round++) { if (round == 1) out->print(" methods %d", count); dump_replay_data_extra_data_helper(out, round, count); } out->cr(); }