8183151: DCmd Compiler.codelist should print all compiled methods
Summary: Add support for AOT methods in codelist dcmd
Reviewed-by: neliasso, kvn
Contributed-by: cthalinger@twitter.com
--- a/hotspot/src/share/vm/code/codeCache.cpp Thu Jul 06 09:31:01 2017 -0400
+++ b/hotspot/src/share/vm/code/codeCache.cpp Mon Jul 03 11:41:19 2017 +0200
@@ -1609,14 +1609,15 @@
void CodeCache::print_codelist(outputStream* st) {
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
- NMethodIterator iter;
- while(iter.next_alive()) {
- nmethod* nm = iter.method();
+ CompiledMethodIterator iter;
+ while (iter.next_alive()) {
+ CompiledMethod* cm = iter.method();
ResourceMark rm;
- char *method_name = nm->method()->name_and_sig_as_C_string();
- st->print_cr("%d %d %s [" INTPTR_FORMAT ", " INTPTR_FORMAT " - " INTPTR_FORMAT "]",
- nm->compile_id(), nm->comp_level(), method_name, (intptr_t)nm->header_begin(),
- (intptr_t)nm->code_begin(), (intptr_t)nm->code_end());
+ char* method_name = cm->method()->name_and_sig_as_C_string();
+ st->print_cr("%d %d %d %s [" INTPTR_FORMAT ", " INTPTR_FORMAT " - " INTPTR_FORMAT "]",
+ cm->compile_id(), cm->comp_level(), cm->get_state(),
+ method_name,
+ (intptr_t)cm->header_begin(), (intptr_t)cm->code_begin(), (intptr_t)cm->code_end());
}
}
--- a/hotspot/test/serviceability/dcmd/compiler/CodelistTest.java Thu Jul 06 09:31:01 2017 -0400
+++ b/hotspot/test/serviceability/dcmd/compiler/CodelistTest.java Mon Jul 03 11:41:19 2017 +0200
@@ -118,9 +118,17 @@
if (line.contains("CodelistTest.testcaseMethod")) {
String[] parts = line.split(" ");
int compileID = Integer.parseInt(parts[0]);
+ Assert.assertTrue(compileID > 0, "CompileID must be positive");
+
int compileLevel = Integer.parseInt(parts[1]);
- String str = parts[2];
+ Assert.assertTrue(compileLevel >= -1, "CompileLevel must be at least -1 (AOT)");
+ Assert.assertTrue(compileLevel <= 4, "CompileLevel must be at most 4 (C2)");
+ int codeState = Integer.parseInt(parts[2]);
+ Assert.assertTrue(codeState >= 0, "CodeState must be at least 0 (In Use)");
+ Assert.assertTrue(codeState <= 4, "CodeState must be at most 4 (Unloaded)");
+
+ String str = parts[3];
for (TestCase testcase : testcases) {
if (str.contains(testcase.methodName)) {
Assert.assertFalse(testcase.check, "Must not be found or already found.");