Date: Tue, 13 Jun 2023 12:19:03 +0800
Subject: [PATCH 58/59] Fix CodelistTest.java Failed to Execute CodelistTest.java Using -Xcomp

---
 hotspot/src/share/vm/code/codeCache.cpp | 4 +--
 1 file changed, 2 insertion(+), 3 deletions(-)

diff --git a/hotspot/src/share/vm/code/codeCache.cpp b/hotspot/src/share/vm/code/codeCache.cpp
index 8df29d608..37f24b5e9 100644
--- a/hotspot/src/share/vm/code/codeCache.cpp
+++ b/hotspot/src/share/vm/code/codeCache.cpp
@@ -263,7 +263,6 @@ void CodeCache::flush() {
 #define FOR_ALL_BLOBS(var)       for (CodeBlob *var =       first() ; var != NULL; var =       next(var) )
 #define FOR_ALL_ALIVE_BLOBS(var) for (CodeBlob *var = alive(first()); var != NULL; var = alive(next(var)))
 #define FOR_ALL_ALIVE_NMETHODS(var) for (nmethod *var = alive_nmethod(first()); var != NULL; var = alive_nmethod(next(var)))
-#define FOR_ALL_NMETHODS(var) for (nmethod *var = first_nmethod(); var != NULL; var = next_nmethod(var))


 bool CodeCache::contains(void *p) {
@@ -1011,10 +1010,10 @@ void CodeCache::print_summary(outputStream* st, bool detailed) {
 void CodeCache::print_codelist(outputStream* st) {
   assert_locked_or_safepoint(CodeCache_lock);

-  FOR_ALL_NMETHODS(p) {
+  FOR_ALL_ALIVE_NMETHODS(p) {
     ResourceMark rm;
     char *method_name = p->method()->name_and_sig_as_C_string();
-    st->print_cr("%d %d %s ["INTPTR_FORMAT", "INTPTR_FORMAT" - "INTPTR_FORMAT"]",
+    st->print_cr("%d %d %s [" INTPTR_FORMAT ", " INTPTR_FORMAT " - " INTPTR_FORMAT "]",
                  p->compile_id(), p->comp_level(), method_name, (intptr_t)p->header_begin(),
                  (intptr_t)p->code_begin(), (intptr_t)p->code_end());
   }
-- 
2.22.0

