8260169: LogCompilation: Unexpected method mismatch

Reviewed-by: kvn, vlivanov
This commit is contained in:
Eric Caspole 2021-01-25 14:11:33 +00:00
parent 6e03735427
commit d076977d03
2 changed files with 40 additions and 32 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -1000,10 +1000,13 @@ public class LogParser extends DefaultHandler implements ErrorHandler {
}
methods.put(id, m);
} else if (qname.equals("call")) {
if (scopes.peek() == null) {
Phase p = phaseStack.peek();
assert p != null && p.getName().equals("optimizer") : "should not be in parse here";
} else {
Phase p = phaseStack.peek();
if (scopes.peek() == null && p != null) {
// Do not process other phases when scopes is null
if (p.getName().equals("parse")) {
reportInternalError( "should not be in parse here:" + p.getName());
}
} else {
if (methodHandleSite != null) {
methodHandleSite = null;
}
@ -1054,9 +1057,12 @@ public class LogParser extends DefaultHandler implements ErrorHandler {
} else if (qname.equals("replace_string_concat")) {
expectStringConcatTrap = true;
} else if (qname.equals("inline_fail")) {
if (scopes.peek() == null) {
Phase p = phaseStack.peek();
assert p != null && p.getName().equals("optimizer") : "should not be in parse here";
Phase p = phaseStack.peek();
if (scopes.peek() == null && p != null) {
// Do not process other phases when scopes is null
if (p.getName().equals("parse")) {
reportInternalError( "should not be in parse here:" + p.getName());
}
} else {
if (methodHandleSite != null) {
scopes.peek().add(methodHandleSite);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,6 +25,7 @@ package com.sun.hotspot.tools.compiler;
import java.util.Arrays;
import java.util.Collection;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -125,13 +126,29 @@ public class TestLogCompilation {
this.logFile = logFile;
}
void doItOrFail(String[] args) {
try {
LogCompilation.main(args);
} catch (Throwable e) {
e.printStackTrace();
Assert.fail(e.getMessage());
}
}
@Test
public void testDefault() throws Exception {
String[] args = {
logFile
};
doItOrFail(args);
}
@Test
public void testDashi() throws Exception {
String[] args = {"-i",
logFile
};
LogCompilation.main(args);
doItOrFail(args);
}
@Test
@ -140,17 +157,7 @@ public class TestLogCompilation {
"-t",
logFile
};
LogCompilation.main(args);
}
@Test
public void testDefault() throws Exception {
String[] args = {
logFile
};
LogCompilation.main(args);
doItOrFail(args);
}
@Test
@ -158,8 +165,7 @@ public class TestLogCompilation {
String[] args = {"-S",
logFile
};
LogCompilation.main(args);
doItOrFail(args);
}
@Test
@ -167,8 +173,7 @@ public class TestLogCompilation {
String[] args = {"-U",
logFile
};
LogCompilation.main(args);
doItOrFail(args);
}
@Test
@ -176,8 +181,7 @@ public class TestLogCompilation {
String[] args = {"-e",
logFile
};
LogCompilation.main(args);
doItOrFail(args);
}
@Test
@ -185,8 +189,7 @@ public class TestLogCompilation {
String[] args = {"-n",
logFile
};
LogCompilation.main(args);
doItOrFail(args);
}
@Test
@ -194,7 +197,6 @@ public class TestLogCompilation {
String[] args = {"-z",
logFile
};
LogCompilation.main(args);
doItOrFail(args);
}
}