changeset 23371:a657931445ab

Fix Symbol* leak (JDK-8155735).
author Roland Schatz <roland.schatz@oracle.com>
date Mon, 02 May 2016 15:19:08 +0200
parents 858e9beeeda6
children 1c7bac3f1f20
files src/share/vm/jvmci/jvmciRuntime.cpp
diffstat 1 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/jvmci/jvmciRuntime.cpp	Mon May 02 08:05:08 2016 +0200
+++ b/src/share/vm/jvmci/jvmciRuntime.cpp	Mon May 02 15:19:08 2016 +0200
@@ -412,21 +412,27 @@
 JRT_END
 
 JRT_ENTRY(void, JVMCIRuntime::throw_and_post_jvmti_exception(JavaThread* thread, const char* exception, const char* message))
-  Symbol* symbol = SymbolTable::lookup(exception, strlen(exception), thread);
-  SharedRuntime::throw_and_post_jvmti_exception(thread, symbol, message);
+  TempNewSymbol symbol = SymbolTable::new_symbol(exception, thread);
+  if (!HAS_PENDING_EXCEPTION) {
+    SharedRuntime::throw_and_post_jvmti_exception(thread, symbol, message);
+  }
 JRT_END
 
 JRT_ENTRY(void, JVMCIRuntime::throw_klass_external_name_exception(JavaThread* thread, const char* exception, Klass* klass))
   ResourceMark rm(thread);
-  Symbol* symbol = SymbolTable::lookup(exception, strlen(exception), thread);
-  SharedRuntime::throw_and_post_jvmti_exception(thread, symbol, klass->external_name());
+  TempNewSymbol symbol = SymbolTable::new_symbol(exception, thread);
+  if (!HAS_PENDING_EXCEPTION) {
+    SharedRuntime::throw_and_post_jvmti_exception(thread, symbol, klass->external_name());
+  }
 JRT_END
 
 JRT_ENTRY(void, JVMCIRuntime::throw_class_cast_exception(JavaThread* thread, const char* exception, Klass* caster_klass, Klass* target_klass))
   ResourceMark rm(thread);
   const char* message = SharedRuntime::generate_class_cast_message(caster_klass->external_name(), target_klass->external_name());
-  Symbol* symbol = SymbolTable::lookup(exception, strlen(exception), thread);
-  SharedRuntime::throw_and_post_jvmti_exception(thread, symbol, message);
+  TempNewSymbol symbol = SymbolTable::lookup(exception, strlen(exception), thread);
+  if (!HAS_PENDING_EXCEPTION) {
+    SharedRuntime::throw_and_post_jvmti_exception(thread, symbol, message);
+  }
 JRT_END
 
 JRT_LEAF(void, JVMCIRuntime::log_object(JavaThread* thread, oopDesc* obj, bool as_string, bool newline))