8257518: LogCompilation: java.lang.InternalError with JFR turned on

Reviewed-by: kvn, redestad
This commit is contained in:
Eric Caspole 2020-12-09 15:55:33 +00:00
parent 6c69eca380
commit cf62b0ad86
3 changed files with 67 additions and 4 deletions

View File

@ -716,7 +716,12 @@ public class LogParser extends DefaultHandler implements ErrorHandler {
Compilation c = log.compiles.get(ble.getId());
if (c == null) {
if (!(ble instanceof NMethod)) {
throw new InternalError("only nmethods should have a null compilation, here's a " + ble.getClass());
if (ble instanceof MakeNotEntrantEvent && ((MakeNotEntrantEvent) ble).getCompileKind().equals("c2n")) {
// this is ok for c2n
assert ((MakeNotEntrantEvent) ble).getLevel().equals("0") : "Should be level 0";
} else {
throw new InternalError("only nmethods should have a null compilation, here's a " + ble.getClass());
}
}
continue;
}
@ -1071,8 +1076,12 @@ public class LogParser extends DefaultHandler implements ErrorHandler {
String id = makeId(atts);
NMethod nm = nmethods.get(id);
if (nm == null) reportInternalError("nm == null");
LogEvent e = new MakeNotEntrantEvent(Double.parseDouble(search(atts, "stamp")), id,
MakeNotEntrantEvent e = new MakeNotEntrantEvent(Double.parseDouble(search(atts, "stamp")), id,
atts.getValue("zombie") != null, nm);
String compileKind = atts.getValue("compile_kind");
e.setCompileKind(compileKind);
String level = atts.getValue("level");
e.setLevel(level);
events.add(e);
} else if (qname.equals("uncommon_trap")) {
String id = atts.getValue("compile_id");

View File

@ -42,6 +42,16 @@ class MakeNotEntrantEvent extends BasicLogEvent {
*/
private NMethod nmethod;
/**
* The compilation level.
*/
private String level;
/**
* The compile kind.
*/
private String compileKind;
MakeNotEntrantEvent(double s, String i, boolean z, NMethod nm) {
super(s, i);
zombie = z;
@ -63,4 +73,37 @@ class MakeNotEntrantEvent extends BasicLogEvent {
public boolean isZombie() {
return zombie;
}
/**
* @return the level
*/
public String getLevel() {
return level;
}
/**
* @param level the level to set
*/
public void setLevel(String level) {
this.level = level;
}
/**
* @return the compileKind
*/
public String getCompileKind() {
return compileKind;
}
/**
* @param compileKind the compileKind to set
*/
public void setCompileKind(String compileKind) {
this.compileKind = compileKind;
}
public String toString() {
return "MakeNotEntrantEvent zombie:" + isZombie() + ", id:" + getId() + ", kind:" + getCompileKind();
}
}

View File

@ -76,12 +76,22 @@ public class TestLogCompilation {
"-Xbatch"
};
static final String setupArgsJFR[] = {
"java",
"-XX:+IgnoreUnrecognizedVMOptions",
"-XX:+UnlockDiagnosticVMOptions",
"-XX:+LogCompilation",
"-XX:LogFile=target/jfr.log",
"-XX:StartFlightRecording=dumponexit=true,filename=rwrecording.jfr"
};
static final String allSetupArgs[][] = {
setupArgsTieredVersion,
setupArgsTiered,
setupArgsTieredBatch,
setupArgsNoTiered,
setupArgsNoTieredBatch
setupArgsNoTieredBatch,
setupArgsJFR
};
@Parameters
@ -92,7 +102,8 @@ public class TestLogCompilation {
{"./target/tiered_short.log"},
{"./target/tiered_short_batch.log"},
{"./target/no_tiered_short.log"},
{"./target/no_tiered_short_batch.log"}
{"./target/no_tiered_short_batch.log"},
{"./target/jfr.log"},
};
assert data.length == allSetupArgs.length : "Files dont match args.";
return Arrays.asList(data);