changeset 1177:74930fcb28d8

Merge
author Gary Benson <gbenson@redhat.com>
date Tue, 04 Nov 2008 11:32:33 -0500
parents f9592f3296d6 (current diff) 1fa9f674cf4d (diff)
children 681168881142 63303252f297
files ChangeLog
diffstat 5 files changed, 85 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Nov 04 11:00:50 2008 -0500
+++ b/ChangeLog	Tue Nov 04 11:32:33 2008 -0500
@@ -1,3 +1,25 @@
+2008-11-04  Gary Benson  <gbenson@redhat.com>
+
+	* ports/hotspot/src/share/vm/shark/sharkRuntime.hpp
+	(SharkRuntime::_f2i): New constant.
+	(SharkRuntime::_f2l): Likewise.
+	(SharkRuntime::_d2i): Likewise.
+	(SharkRuntime::_d2l): Likewise.
+	(SharkRuntime::f2i): New accessor.
+	(SharkRuntime::f2l): Likewise.
+	(SharkRuntime::d2i): Likewise.
+	(SharkRuntime::d2l): Likewise.
+	* ports/hotspot/src/share/vm/shark/sharkRuntime.cpp
+	(SharkRuntime::_f2i): New constant.
+	(SharkRuntime::_f2l): Likewise.
+	(SharkRuntime::_d2i): Likewise.
+	(SharkRuntime::_d2l): Likewise.
+	(SharkRuntime::initialize): Initialize the above.
+	* ports/hotspot/src/share/vm/shark/sharkBlock.hpp
+	(SharkBlock::call_vm_leaf): New method.
+	* ports/hotspot/src/share/vm/shark/sharkBlock.cpp
+	(SharkBlock::parse): Use runtime calls for f2i, f2l, d2i and d2l.
+
 2008-11-04  Omair Majid  <omajid@redhat.com>
 
 	* Makefile.am (stamps/pulse-java.stamp): Link in libpulse.so after all
--- a/ports/hotspot/src/share/vm/shark/sharkBlock.cpp	Tue Nov 04 11:00:50 2008 -0500
+++ b/ports/hotspot/src/share/vm/shark/sharkBlock.cpp	Tue Nov 04 11:32:33 2008 -0500
@@ -742,13 +742,11 @@
 
     case Bytecodes::_f2i:
       push(SharkValue::create_jint(
-        builder()->CreateFPToSI(
-          pop()->jfloat_value(), SharkType::jint_type())));
+        call_vm_leaf(SharkRuntime::f2i(), pop()->jfloat_value())));
       break;
     case Bytecodes::_f2l:
       push(SharkValue::create_jlong(
-        builder()->CreateFPToSI(
-          pop()->jfloat_value(), SharkType::jlong_type())));
+        call_vm_leaf(SharkRuntime::f2l(), pop()->jfloat_value())));
       break;
     case Bytecodes::_f2d:
       push(SharkValue::create_jdouble(
@@ -758,13 +756,11 @@
 
     case Bytecodes::_d2i:
       push(SharkValue::create_jint(
-        builder()->CreateFPToSI(
-          pop()->jdouble_value(), SharkType::jint_type())));
+        call_vm_leaf(SharkRuntime::d2i(), pop()->jdouble_value())));
       break;
     case Bytecodes::_d2l:
       push(SharkValue::create_jlong(
-        builder()->CreateFPToSI(
-          pop()->jdouble_value(), SharkType::jlong_type())));
+        call_vm_leaf(SharkRuntime::d2l(), pop()->jdouble_value())));
       break;
     case Bytecodes::_d2f:
       push(SharkValue::create_jfloat(
--- a/ports/hotspot/src/share/vm/shark/sharkBlock.hpp	Tue Nov 04 11:00:50 2008 -0500
+++ b/ports/hotspot/src/share/vm/shark/sharkBlock.hpp	Tue Nov 04 11:32:33 2008 -0500
@@ -371,6 +371,12 @@
     return call_vm_nocheck(callee, args, args + 4);
   }
 
+  llvm::CallInst* call_vm_leaf(llvm::Constant* callee,
+                               llvm::Value*    arg1)
+  {
+    return builder()->CreateCall(callee, arg1);
+  }
+
   // Whole-method synchronization
  public:
   void acquire_method_lock();  
--- a/ports/hotspot/src/share/vm/shark/sharkRuntime.cpp	Tue Nov 04 11:00:50 2008 -0500
+++ b/ports/hotspot/src/share/vm/shark/sharkRuntime.cpp	Tue Nov 04 11:32:33 2008 -0500
@@ -43,6 +43,11 @@
 Constant* SharkRuntime::_throw_NullPointerException;
 Constant* SharkRuntime::_trace_bytecode;
 
+Constant* SharkRuntime::_f2i;
+Constant* SharkRuntime::_f2l;
+Constant* SharkRuntime::_d2i;
+Constant* SharkRuntime::_d2l;
+
 Constant* SharkRuntime::_dump;
 Constant* SharkRuntime::_is_subtype_of;
 Constant* SharkRuntime::_should_not_reach_here;
@@ -158,6 +163,29 @@
     FunctionType::get(Type::VoidTy, params, false),
     "SharkRuntime__trace_bytecode");
 
+  // Leaf calls
+  params.clear();
+  params.push_back(SharkType::jfloat_type());
+  _f2i = builder->make_function(
+    (intptr_t) SharedRuntime::f2i,
+    FunctionType::get(SharkType::jint_type(), params, false),
+    "SharedRuntime__f2i");  
+  _f2l = builder->make_function(
+    (intptr_t) SharedRuntime::f2l,
+    FunctionType::get(SharkType::jlong_type(), params, false),
+    "SharedRuntime__f2l");  
+
+  params.clear();
+  params.push_back(SharkType::jdouble_type());
+  _d2i = builder->make_function(
+    (intptr_t) SharedRuntime::d2i,
+    FunctionType::get(SharkType::jint_type(), params, false),
+    "SharedRuntime__d2i");  
+  _d2l = builder->make_function(
+    (intptr_t) SharedRuntime::d2l,
+    FunctionType::get(SharkType::jlong_type(), params, false),
+    "SharedRuntime__d2l");  
+  
   // Non-VM calls
   params.clear();
   params.push_back(SharkType::intptr_type());
--- a/ports/hotspot/src/share/vm/shark/sharkRuntime.hpp	Tue Nov 04 11:00:50 2008 -0500
+++ b/ports/hotspot/src/share/vm/shark/sharkRuntime.hpp	Tue Nov 04 11:32:33 2008 -0500
@@ -162,6 +162,31 @@
     return *(thread->zero_stack()->sp() + offset);
   }  
 
+  // Leaf calls
+ private:
+  static llvm::Constant* _f2i;
+  static llvm::Constant* _f2l;
+  static llvm::Constant* _d2i;
+  static llvm::Constant* _d2l;
+
+ public:
+  static llvm::Constant* f2i()
+  {
+    return _f2i;
+  }  
+  static llvm::Constant* f2l()
+  {
+    return _f2l;
+  }  
+  static llvm::Constant* d2i()
+  {
+    return _d2i;
+  }  
+  static llvm::Constant* d2l()
+  {
+    return _d2l;
+  }  
+  
   // Non-VM calls
  private:
   static llvm::Constant* _dump;