changeset 1622:9247751a966e

2009-06-26 Gary Benson <gbenson@redhat.com> * ports/hotspot/src/share/vm/shark/sharkCompiler.cpp (SharkCompiler::SharkCompiler): Moved LLVM multithreading initialization from SharkFunction::initialize. * ports/hotspot/src/share/vm/shark/sharkFunction.cpp (SharkFunction::initialize): Moved LLVM multithreading initialization to SharkCompiler::SharkCompiler.
author Gary Benson <gbenson@redhat.com>
date Fri, 26 Jun 2009 04:51:17 -0400
parents 1541cc6b4e0d
children 308c172cd230
files ChangeLog ports/hotspot/src/share/vm/shark/sharkCompiler.cpp ports/hotspot/src/share/vm/shark/sharkFunction.cpp
diffstat 3 files changed, 18 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Jun 25 11:40:43 2009 +0100
+++ b/ChangeLog	Fri Jun 26 04:51:17 2009 -0400
@@ -1,3 +1,12 @@
+2009-06-26  Gary Benson  <gbenson@redhat.com>
+
+	* ports/hotspot/src/share/vm/shark/sharkCompiler.cpp
+	(SharkCompiler::SharkCompiler): Moved LLVM multithreading
+	initialization from SharkFunction::initialize.
+	* ports/hotspot/src/share/vm/shark/sharkFunction.cpp
+	(SharkFunction::initialize): Moved LLVM multithreading
+	initialization to SharkCompiler::SharkCompiler.
+
 2009-06-25  Gary Benson  <gbenson@redhat.com>
 
 	* ports/hotspot/src/share/vm/shark/sharkRuntime.cpp
--- a/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp	Thu Jun 25 11:40:43 2009 +0100
+++ b/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp	Fri Jun 26 04:51:17 2009 -0400
@@ -33,6 +33,15 @@
 SharkCompiler::SharkCompiler()
   : AbstractCompiler()
 {
+#if SHARK_LLVM_VERSION >= 26
+  // Make LLVM safe for multithreading.  We only make LLVM calls from
+  // the compiler thread, but if LLVM leaves stubs to be rewritten on
+  // execution then it's possible for Java threads to be making LLVM
+  // calls at the same time we are.
+  if (!llvm_start_multithreaded()) 
+    warning("llvm_start_multithreaded() failed");
+#endif
+
   // Create a module to build our functions into
   _module = new Module("shark");
 
--- a/ports/hotspot/src/share/vm/shark/sharkFunction.cpp	Thu Jun 25 11:40:43 2009 +0100
+++ b/ports/hotspot/src/share/vm/shark/sharkFunction.cpp	Fri Jun 26 04:51:17 2009 -0400
@@ -30,12 +30,6 @@
 
 void SharkFunction::initialize(const char *name)
 {
-
-#if SHARK_LLVM_VERSION >= 26
-  // Initialize llvm mutex guards
-  llvm_start_multithreaded();
-#endif
-
   // Create the function
   _function = Function::Create(
     SharkType::entry_point_type(),