changeset 1614:fbfa0d5fa7d3

PR icedtea/353 * ports/hotspot/src/share/vm/shark/llvmHeaders.hpp Include llvm/Support/Threading.h and llvm/Target/TargetSelect.h used by llvm_start_multithreaded() and InitializeNativeTarget() when llvm version are 2.6 or later. * ports/hotspot/src/share/vm/shark/llvmValue.hpp (jfloat_constant): Return llvm::Constant* when llvm version are 2.6 or later to handle llvm r73431 API change. (jdouble_constant): Likewise. * ports/hotspot/src/share/vm/shark/sharkBlock.cpp (SharkBlock::parse_bytecode): Updated to use CreateFAdd CreateFSub, CreateFMul and CreateFNeg for jfloat and jdouble when llvm version are 2.6 or later. * ports/hotspot/src/share/vm/shark/sharkCompiler.cpp (SharkCompiler::SharkCompiler): Call InitializeNativeTarget() to link in native target when llvm version are 2.6 or later. * ports/hotspot/src/share/vm/shark/sharkFunction.cpp (SharkFunction::initialize): Call llvm_start_multithreaded() to initialize llvm mutex guards when llvm version are 2.6 or later.
author Xerxes R?nby <xerxes@zafena.se>
date Tue, 23 Jun 2009 12:40:50 +0200
parents 0d70559fe534
children 46341fc21171
files ChangeLog ports/hotspot/src/share/vm/shark/llvmHeaders.hpp ports/hotspot/src/share/vm/shark/llvmValue.hpp ports/hotspot/src/share/vm/shark/sharkBlock.cpp ports/hotspot/src/share/vm/shark/sharkCompiler.cpp ports/hotspot/src/share/vm/shark/sharkFunction.cpp
diffstat 6 files changed, 78 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Jun 19 11:59:37 2009 -0400
+++ b/ChangeLog	Tue Jun 23 12:40:50 2009 +0200
@@ -1,3 +1,25 @@
+2009-06-23  Xerxes RĂ„nby  <xerxes@zafena.se>
+
+	PR icedtea/353
+	* ports/hotspot/src/share/vm/shark/llvmHeaders.hpp
+	Include llvm/Support/Threading.h and llvm/Target/TargetSelect.h
+	used by llvm_start_multithreaded() and InitializeNativeTarget()
+	when llvm version are 2.6 or later.
+	* ports/hotspot/src/share/vm/shark/llvmValue.hpp
+	(jfloat_constant): Return llvm::Constant* when llvm
+	version are 2.6 or later to handle llvm r73431 API change.
+	(jdouble_constant): Likewise.
+	* ports/hotspot/src/share/vm/shark/sharkBlock.cpp
+	(SharkBlock::parse_bytecode): Updated to use CreateFAdd
+	CreateFSub, CreateFMul and CreateFNeg for jfloat and jdouble
+	when llvm version are 2.6 or later.
+	* ports/hotspot/src/share/vm/shark/sharkCompiler.cpp
+	(SharkCompiler::SharkCompiler): Call InitializeNativeTarget() to
+	link in native target when llvm version are 2.6 or later.
+	* ports/hotspot/src/share/vm/shark/sharkFunction.cpp
+	(SharkFunction::initialize): Call llvm_start_multithreaded() to
+	initialize llvm mutex guards when llvm version are 2.6 or later.
+
 2009-06-19  Lillian Angel  <langel@redhat.com>
 
 	* patches/icedtea-toolkit.patch: Updated, as per Anthony Petrov's
--- a/ports/hotspot/src/share/vm/shark/llvmHeaders.hpp	Fri Jun 19 11:59:37 2009 -0400
+++ b/ports/hotspot/src/share/vm/shark/llvmHeaders.hpp	Tue Jun 23 12:40:50 2009 +0200
@@ -35,6 +35,10 @@
 #include <llvm/Module.h>
 #include <llvm/ModuleProvider.h>
 #include <llvm/Support/IRBuilder.h>
+#if SHARK_LLVM_VERSION >= 26
+#include <llvm/Support/Threading.h>
+#include <llvm/Target/TargetSelect.h>
+#endif
 #include <llvm/Type.h>
 #include <llvm/ExecutionEngine/JITMemoryManager.h>
 #include <llvm/Support/CommandLine.h>
--- a/ports/hotspot/src/share/vm/shark/llvmValue.hpp	Fri Jun 19 11:59:37 2009 -0400
+++ b/ports/hotspot/src/share/vm/shark/llvmValue.hpp	Tue Jun 23 12:40:50 2009 +0200
@@ -37,11 +37,19 @@
   {
     return llvm::ConstantInt::get(SharkType::jlong_type(), value, true);
   }
+#if SHARK_LLVM_VERSION >= 26
+  static llvm::Constant* jfloat_constant(jfloat value)
+#else
   static llvm::ConstantFP* jfloat_constant(jfloat value)
+#endif
   {
     return llvm::ConstantFP::get(SharkType::jfloat_type(), value);
   }
+#if SHARK_LLVM_VERSION >= 26
+  static llvm::Constant* jdouble_constant(jdouble value)
+#else
   static llvm::ConstantFP* jdouble_constant(jdouble value)
+#endif
   {
     return llvm::ConstantFP::get(SharkType::jdouble_type(), value);
   }
--- a/ports/hotspot/src/share/vm/shark/sharkBlock.cpp	Fri Jun 19 11:59:37 2009 -0400
+++ b/ports/hotspot/src/share/vm/shark/sharkBlock.cpp	Tue Jun 23 12:40:50 2009 +0200
@@ -532,19 +532,31 @@
       b = pop();
       a = pop();
       push(SharkValue::create_jfloat(
+#if SHARK_LLVM_VERSION >= 26
+        builder()->CreateFAdd(a->jfloat_value(), b->jfloat_value())));
+#else
         builder()->CreateAdd(a->jfloat_value(), b->jfloat_value())));
+#endif
       break;
     case Bytecodes::_fsub:
       b = pop();
       a = pop();
       push(SharkValue::create_jfloat(
+#if SHARK_LLVM_VERSION >= 26
+        builder()->CreateFSub(a->jfloat_value(), b->jfloat_value())));
+#else
         builder()->CreateSub(a->jfloat_value(), b->jfloat_value())));
+#endif
       break;
     case Bytecodes::_fmul:
       b = pop();
       a = pop();
       push(SharkValue::create_jfloat(
+#if SHARK_LLVM_VERSION >= 26
+        builder()->CreateFMul(a->jfloat_value(), b->jfloat_value())));
+#else
         builder()->CreateMul(a->jfloat_value(), b->jfloat_value())));
+#endif
       break;
     case Bytecodes::_fdiv:
       b = pop();
@@ -561,26 +573,42 @@
     case Bytecodes::_fneg:
       a = pop();      
       push(SharkValue::create_jfloat(
+#if SHARK_LLVM_VERSION >= 26
+        builder()->CreateFNeg(a->jfloat_value())));
+#else
         builder()->CreateNeg(a->jfloat_value())));
+#endif
       break;
 
     case Bytecodes::_dadd:
       b = pop();
       a = pop();
       push(SharkValue::create_jdouble(
+#if SHARK_LLVM_VERSION >= 26
+        builder()->CreateFAdd(a->jdouble_value(), b->jdouble_value())));
+#else
         builder()->CreateAdd(a->jdouble_value(), b->jdouble_value())));
+#endif
       break;
     case Bytecodes::_dsub:
       b = pop();
       a = pop();
       push(SharkValue::create_jdouble(
+#if SHARK_LLVM_VERSION >= 26
+        builder()->CreateFSub(a->jdouble_value(), b->jdouble_value())));
+#else
         builder()->CreateSub(a->jdouble_value(), b->jdouble_value())));
+#endif
       break;
     case Bytecodes::_dmul:
       b = pop();
       a = pop();
       push(SharkValue::create_jdouble(
+#if SHARK_LLVM_VERSION >= 26
+        builder()->CreateFMul(a->jdouble_value(), b->jdouble_value())));
+#else
         builder()->CreateMul(a->jdouble_value(), b->jdouble_value())));
+#endif
       break;
     case Bytecodes::_ddiv:
       b = pop();
@@ -597,7 +625,11 @@
     case Bytecodes::_dneg:
       a = pop();      
       push(SharkValue::create_jdouble(
+#if SHARK_LLVM_VERSION >= 26
+        builder()->CreateFNeg(a->jdouble_value())));
+#else
         builder()->CreateNeg(a->jdouble_value())));
+#endif
       break;
 
     case Bytecodes::_iinc:
--- a/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp	Fri Jun 19 11:59:37 2009 -0400
+++ b/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp	Tue Jun 23 12:40:50 2009 +0200
@@ -38,6 +38,12 @@
 
   // Create the builder to build our functions
   _builder = new SharkBuilder(this);
+
+#if SHARK_LLVM_VERSION >= 26
+  // If we have a native target, initialize it to ensure it is linked in and
+  // usable by the JIT.
+  InitializeNativeTarget();
+#endif
   
   // Create the JIT
   ModuleProvider *module_provider = new ExistingModuleProvider(module());
--- a/ports/hotspot/src/share/vm/shark/sharkFunction.cpp	Fri Jun 19 11:59:37 2009 -0400
+++ b/ports/hotspot/src/share/vm/shark/sharkFunction.cpp	Tue Jun 23 12:40:50 2009 +0200
@@ -30,6 +30,12 @@
 
 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(),