changeset 13437:8375e923b59d

8180627: gc/gctests/Steal/steal001: guarantee(cp->cache() == NULL) failed Summary: Clean up constant pool cache if class linking fails Reviewed-by: coleenp, gtriantafill
author hseigel
date Wed, 02 Aug 2017 08:19:09 -0400
parents d39244cf9127
children a77c680f1535
files src/share/vm/interpreter/rewriter.cpp
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/interpreter/rewriter.cpp	Wed Aug 02 00:15:52 2017 +0000
+++ b/src/share/vm/interpreter/rewriter.cpp	Wed Aug 02 08:19:09 2017 -0400
@@ -27,6 +27,7 @@
 #include "interpreter/bytecodes.hpp"
 #include "interpreter/interpreter.hpp"
 #include "interpreter/rewriter.hpp"
+#include "memory/metadataFactory.hpp"
 #include "memory/metaspaceShared.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/generateOopMap.hpp"
@@ -101,7 +102,13 @@
   // the above lines.
   _pool->initialize_resolved_references(loader_data, _resolved_references_map,
                                         _resolved_reference_limit,
-                                        CHECK);
+                                        THREAD);
+
+  // Clean up constant pool cache if initialize_resolved_references() failed.
+  if (HAS_PENDING_EXCEPTION) {
+    MetadataFactory::free_metadata(loader_data, cache);
+    _pool->set_cache(NULL);  // so the verifier isn't confused
+  }
 }