RFR: 6830717: replay of compilations would help with debugging

Christian Thalinger christian.thalinger at oracle.com
Mon Aug 13 17:02:36 PDT 2012


On Aug 6, 2012, at 2:40 PM, yumin.qi at oracle.com wrote:

> Hi,
> 
>  Please give your comments of the changes about
>  6830717: replay of compilations would help with debugging.
> http://monaco.sfbay.sun.com/detail.jsf?cr=6830717
> 
>  Sometime jvm crashes in the process of compilation or in compiled method. To reproduce the compilation process in debug JVM is helpful for quickly identifying root cause.
>  To do recompilation, we collect data by using of SA (Serviceability Agent) to extract application and system class data from core file. Those information includes nmethod, methodOop, methodDataOop, instanceKlass and corresponding ci counterparts.
>  With reconfiguring similar (not exactly same) compiling environment as in the core file, try to compile again the failed java methods.
> 
>  contributed by Tom R (never).   webrev:
> 
> http://cr.openjdk.java.net/~minqi/6830717/ <http://cr.openjdk.java.net/%7Eminqi/6830717/>

src/share/vm/ci/ciReplay.cpp:

 603         if (strcmp(field_signature, "[B") == 0) {
 604           oop value = oopFactory::new_byteArray(length, CHECK);
 605           java_mirror->obj_field_put(fd.offset(), value);
 606         } else if (strcmp(field_signature, "[Z") == 0) {
 607           oop value = oopFactory::new_boolArray(length, CHECK);
 608           java_mirror->obj_field_put(fd.offset(), value);
 609         } else if (strcmp(field_signature, "[C") == 0) {
 610           oop value = oopFactory::new_charArray(length, CHECK);
 611           java_mirror->obj_field_put(fd.offset(), value);
 612         } else if (strcmp(field_signature, "[S") == 0) {
 613           oop value = oopFactory::new_shortArray(length, CHECK);
 614           java_mirror->obj_field_put(fd.offset(), value);
 615         } else if (strcmp(field_signature, "[F") == 0) {
 616           oop value = oopFactory::new_singleArray(length, CHECK);
 617           java_mirror->obj_field_put(fd.offset(), value);
 618         } else if (strcmp(field_signature, "[D") == 0) {
 619           oop value = oopFactory::new_doubleArray(length, CHECK);
 620           java_mirror->obj_field_put(fd.offset(), value);
 621         } else if (strcmp(field_signature, "[I") == 0) {
 622           oop value = oopFactory::new_intArray(length, CHECK);
 623           java_mirror->obj_field_put(fd.offset(), value);
 624         } else if (strcmp(field_signature, "[J") == 0) {
 625           oop value = oopFactory::new_longArray(length, CHECK);
 626           java_mirror->obj_field_put(fd.offset(), value);
 627         } else if (field_signature[0] == '[' && field_signature[1] == 'L') {

Can't we switch on the second character?  And move this call:

 630           java_mirror->obj_field_put(fd.offset(), value);

out of the switch?

 637       if (strcmp(field_signature, "I") == 0) {
 638         int value = atoi(string_value);
 639         java_mirror->int_field_put(fd.offset(), value);
 640       } else if (strcmp(field_signature, "B") == 0) {
 641         int value = atoi(string_value);
 642         java_mirror->byte_field_put(fd.offset(), value);
 643       } else if (strcmp(field_signature, "C") == 0) {
 644         int value = atoi(string_value);
 645         java_mirror->char_field_put(fd.offset(), value);
 646       } else if (strcmp(field_signature, "S") == 0) {
 647         int value = atoi(string_value);
 648         java_mirror->short_field_put(fd.offset(), value);
 649       } else if (strcmp(field_signature, "Z") == 0) {
 650         int value = atol(string_value);
 651         java_mirror->bool_field_put(fd.offset(), value);
 652       } else if (strcmp(field_signature, "J") == 0) {
 653         jlong value;
 654         if (sscanf(string_value, INT64_FORMAT, &value) != 1) {
 655           fprintf(stderr, "Error parsing long: %s\n", string_value);
 656           return;
 657         }
 658         java_mirror->long_field_put(fd.offset(), value);
 659       } else if (strcmp(field_signature, "F") == 0) {
 660         float value = atof(string_value);
 661         java_mirror->float_field_put(fd.offset(), value);
 662       } else if (strcmp(field_signature, "D") == 0) {
 663         double value = atof(string_value);
 664         java_mirror->double_field_put(fd.offset(), value);
 665       } else if (strcmp(field_signature, "Ljava/lang/String;") == 0) {
 666         Handle value = java_lang_String::create_from_str(string_value, CHECK);
 667         java_mirror->obj_field_put(fd.offset(), value());
 668       } else if (field_signature[0] == 'L') {

Same here (not the put though)?

Otherwise it looks good.

-- Chris

> 
> Thanks
> Yumin



More information about the serviceability-dev mailing list