Mercurial > hg > truffle
comparison src/share/vm/ci/ciReplay.cpp @ 11963:1b6395189726
8012263: ciReplay: gracefully exit & report meaningful error when replay data parsing fails
Summary: find_method could return NULL so need explicitly check if there is error after parse_method, exit on error to avoid crash.
Reviewed-by: kvn, twisti
Contributed-by: yumin.qi@oracle.com
author | minqi |
---|---|
date | Fri, 19 Jul 2013 14:43:45 -0700 |
parents | f9be75d21404 |
children | c775af091fe9 |
comparison
equal
deleted
inserted
replaced
11156:060ae9b7ffea | 11963:1b6395189726 |
---|---|
297 InstanceKlass* k = (InstanceKlass*)parse_klass(CHECK_NULL); | 297 InstanceKlass* k = (InstanceKlass*)parse_klass(CHECK_NULL); |
298 Symbol* method_name = parse_symbol(CHECK_NULL); | 298 Symbol* method_name = parse_symbol(CHECK_NULL); |
299 Symbol* method_signature = parse_symbol(CHECK_NULL); | 299 Symbol* method_signature = parse_symbol(CHECK_NULL); |
300 Method* m = k->find_method(method_name, method_signature); | 300 Method* m = k->find_method(method_name, method_signature); |
301 if (m == NULL) { | 301 if (m == NULL) { |
302 report_error("can't find method"); | 302 report_error("Can't find method"); |
303 } | 303 } |
304 return m; | 304 return m; |
305 } | 305 } |
306 | 306 |
307 // Process each line of the replay file executing each command until | 307 // Process each line of the replay file executing each command until |
396 return true; | 396 return true; |
397 } | 397 } |
398 | 398 |
399 // compile <klass> <name> <signature> <entry_bci> <comp_level> | 399 // compile <klass> <name> <signature> <entry_bci> <comp_level> |
400 void process_compile(TRAPS) { | 400 void process_compile(TRAPS) { |
401 // methodHandle method; | |
402 Method* method = parse_method(CHECK); | 401 Method* method = parse_method(CHECK); |
402 if (had_error()) return; | |
403 int entry_bci = parse_int("entry_bci"); | 403 int entry_bci = parse_int("entry_bci"); |
404 const char* comp_level_label = "comp_level"; | 404 const char* comp_level_label = "comp_level"; |
405 int comp_level = parse_int(comp_level_label); | 405 int comp_level = parse_int(comp_level_label); |
406 // old version w/o comp_level | 406 // old version w/o comp_level |
407 if (had_error() && (error_message() == comp_level_label)) { | 407 if (had_error() && (error_message() == comp_level_label)) { |
438 // ciMethod <klass> <name> <signature> <invocation_counter> <backedge_counter> <interpreter_invocation_count> <interpreter_throwout_count> <instructions_size> | 438 // ciMethod <klass> <name> <signature> <invocation_counter> <backedge_counter> <interpreter_invocation_count> <interpreter_throwout_count> <instructions_size> |
439 // | 439 // |
440 // | 440 // |
441 void process_ciMethod(TRAPS) { | 441 void process_ciMethod(TRAPS) { |
442 Method* method = parse_method(CHECK); | 442 Method* method = parse_method(CHECK); |
443 if (had_error()) return; | |
443 ciMethodRecord* rec = new_ciMethod(method); | 444 ciMethodRecord* rec = new_ciMethod(method); |
444 rec->invocation_counter = parse_int("invocation_counter"); | 445 rec->invocation_counter = parse_int("invocation_counter"); |
445 rec->backedge_counter = parse_int("backedge_counter"); | 446 rec->backedge_counter = parse_int("backedge_counter"); |
446 rec->interpreter_invocation_count = parse_int("interpreter_invocation_count"); | 447 rec->interpreter_invocation_count = parse_int("interpreter_invocation_count"); |
447 rec->interpreter_throwout_count = parse_int("interpreter_throwout_count"); | 448 rec->interpreter_throwout_count = parse_int("interpreter_throwout_count"); |
449 } | 450 } |
450 | 451 |
451 // ciMethodData <klass> <name> <signature> <state> <current mileage> orig <length> # # ... data <length> # # ... oops <length> | 452 // ciMethodData <klass> <name> <signature> <state> <current mileage> orig <length> # # ... data <length> # # ... oops <length> |
452 void process_ciMethodData(TRAPS) { | 453 void process_ciMethodData(TRAPS) { |
453 Method* method = parse_method(CHECK); | 454 Method* method = parse_method(CHECK); |
455 if (had_error()) return; | |
454 /* jsut copied from Method, to build interpret data*/ | 456 /* jsut copied from Method, to build interpret data*/ |
455 if (InstanceRefKlass::owns_pending_list_lock((JavaThread*)THREAD)) { | 457 if (InstanceRefKlass::owns_pending_list_lock((JavaThread*)THREAD)) { |
456 return; | 458 return; |
457 } | 459 } |
458 // methodOopDesc::build_interpreter_method_data(method, CHECK); | 460 // methodOopDesc::build_interpreter_method_data(method, CHECK); |