src/share/vm/ci/ciMethodData.cpp

changeset 4267
bd7a7ce2e264
parent 4037
da91efe96a93
child 4531
fcc9e7681d63
equal deleted inserted replaced
4260:3be318ecfae5 4267:bd7a7ce2e264
23 */ 23 */
24 24
25 #include "precompiled.hpp" 25 #include "precompiled.hpp"
26 #include "ci/ciMetadata.hpp" 26 #include "ci/ciMetadata.hpp"
27 #include "ci/ciMethodData.hpp" 27 #include "ci/ciMethodData.hpp"
28 #include "ci/ciReplay.hpp"
28 #include "ci/ciUtilities.hpp" 29 #include "ci/ciUtilities.hpp"
29 #include "memory/allocation.inline.hpp" 30 #include "memory/allocation.inline.hpp"
30 #include "memory/resourceArea.hpp" 31 #include "memory/resourceArea.hpp"
31 #include "runtime/deoptimization.hpp" 32 #include "runtime/deoptimization.hpp"
32 #include "utilities/copy.hpp" 33 #include "utilities/copy.hpp"
113 114
114 _eflags = mdo->eflags(); 115 _eflags = mdo->eflags();
115 _arg_local = mdo->arg_local(); 116 _arg_local = mdo->arg_local();
116 _arg_stack = mdo->arg_stack(); 117 _arg_stack = mdo->arg_stack();
117 _arg_returned = mdo->arg_returned(); 118 _arg_returned = mdo->arg_returned();
119 #ifndef PRODUCT
120 if (ReplayCompiles) {
121 ciReplay::initialize(this);
122 }
123 #endif
118 } 124 }
119 125
120 void ciReceiverTypeData::translate_receiver_data_from(ProfileData* data) { 126 void ciReceiverTypeData::translate_receiver_data_from(ProfileData* data) {
121 for (uint row = 0; row < row_limit(); row++) { 127 for (uint row = 0; row < row_limit(); row++) {
122 Klass* k = data->as_ReceiverTypeData()->receiver(row); 128 Klass* k = data->as_ReceiverTypeData()->receiver(row);
364 // Implementation of the print method. 370 // Implementation of the print method.
365 void ciMethodData::print_impl(outputStream* st) { 371 void ciMethodData::print_impl(outputStream* st) {
366 ciMetadata::print_impl(st); 372 ciMetadata::print_impl(st);
367 } 373 }
368 374
375 void ciMethodData::dump_replay_data(outputStream* out) {
376 ASSERT_IN_VM;
377 MethodData* mdo = get_MethodData();
378 Method* method = mdo->method();
379 Klass* holder = method->method_holder();
380 out->print("ciMethodData %s %s %s %d %d",
381 holder->name()->as_quoted_ascii(),
382 method->name()->as_quoted_ascii(),
383 method->signature()->as_quoted_ascii(),
384 _state,
385 current_mileage());
386
387 // dump the contents of the MDO header as raw data
388 unsigned char* orig = (unsigned char*)&_orig;
389 int length = sizeof(_orig);
390 out->print(" orig %d", length);
391 for (int i = 0; i < length; i++) {
392 out->print(" %d", orig[i]);
393 }
394
395 // dump the MDO data as raw data
396 int elements = data_size() / sizeof(intptr_t);
397 out->print(" data %d", elements);
398 for (int i = 0; i < elements; i++) {
399 // We could use INTPTR_FORMAT here but that's a zero justified
400 // which makes comparing it with the SA version of this output
401 // harder.
402 #ifdef _LP64
403 out->print(" 0x%" FORMAT64_MODIFIER "x", data()[i]);
404 #else
405 out->print(" 0x%x", data()[i]);
406 #endif
407 }
408
409 // The MDO contained oop references as ciObjects, so scan for those
410 // and emit pairs of offset and klass name so that they can be
411 // reconstructed at runtime. The first round counts the number of
412 // oop references and the second actually emits them.
413 int count = 0;
414 for (int round = 0; round < 2; round++) {
415 if (round == 1) out->print(" oops %d", count);
416 ProfileData* pdata = first_data();
417 for ( ; is_valid(pdata); pdata = next_data(pdata)) {
418 if (pdata->is_ReceiverTypeData()) {
419 ciReceiverTypeData* vdata = (ciReceiverTypeData*)pdata;
420 for (uint i = 0; i < vdata->row_limit(); i++) {
421 ciKlass* k = vdata->receiver(i);
422 if (k != NULL) {
423 if (round == 0) {
424 count++;
425 } else {
426 out->print(" %d %s", dp_to_di(vdata->dp() + in_bytes(vdata->receiver_offset(i))) / sizeof(intptr_t), k->name()->as_quoted_ascii());
427 }
428 }
429 }
430 } else if (pdata->is_VirtualCallData()) {
431 ciVirtualCallData* vdata = (ciVirtualCallData*)pdata;
432 for (uint i = 0; i < vdata->row_limit(); i++) {
433 ciKlass* k = vdata->receiver(i);
434 if (k != NULL) {
435 if (round == 0) {
436 count++;
437 } else {
438 out->print(" %d %s", dp_to_di(vdata->dp() + in_bytes(vdata->receiver_offset(i))) / sizeof(intptr_t), k->name()->as_quoted_ascii());
439 }
440 }
441 }
442 }
443 }
444 }
445 out->cr();
446 }
447
369 #ifndef PRODUCT 448 #ifndef PRODUCT
370 void ciMethodData::print() { 449 void ciMethodData::print() {
371 print_data_on(tty); 450 print_data_on(tty);
372 } 451 }
373 452

mercurial