changeset in /hg/icedtea: 2009-03-11 Gary Benson <gbenson at redh...
Gary Benson
gbenson at redhat.com
Fri Mar 20 01:52:23 PDT 2009
changeset 1eeb14582f5a in /hg/icedtea
details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=1eeb14582f5a
description:
2009-03-11 Gary Benson <gbenson at redhat.com>
* ports/hotspot/src/share/vm/shark/sharkIntrinsics.hpp: New file.
* ports/hotspot/src/share/vm/shark/sharkIntrinsics.cpp: Likewise.
* ports/hotspot/src/share/vm/shark/shark_globals.hpp
(SharkPerformanceWarnings): New flag.
* ports/hotspot/src/share/vm/shark/sharkBuilder.hpp
(SharkBuilder::_llvm_cmpxchg_int_fn): New field.
(SharkBuilder::_llvm_sin_fn): Likewise.
(SharkBuilder::_llvm_cos_fn): Likewise.
(SharkBuilder::_llvm_sqrt_fn): Likewise.
(SharkBuilder::_llvm_log_fn): Likewise.
(SharkBuilder::_llvm_log10_fn): Likewise.
(SharkBuilder::_llvm_pow_fn): Likewise.
(SharkBuilder::_llvm_exp_fn): Likewise.
(SharkBuilder::set_llvm_cmpxchg_int_fn): New method.
(SharkBuilder::set_llvm_sin_fn): Likewise.
(SharkBuilder::set_llvm_cos_fn): Likewise.
(SharkBuilder::set_llvm_sqrt_fn): Likewise.
(SharkBuilder::set_llvm_log_fn): Likewise.
(SharkBuilder::set_llvm_log10_fn): Likewise.
(SharkBuilder::set_llvm_pow_fn): Likewise.
(SharkBuilder::set_llvm_exp_fn): Likewise.
(SharkBuilder::llvm_cmpxchg_int_fn): Likewise.
(SharkBuilder::llvm_sin_fn): Likewise.
(SharkBuilder::llvm_cos_fn): Likewise.
(SharkBuilder::llvm_sqrt_fn): Likewise.
(SharkBuilder::llvm_log_fn): Likewise.
(SharkBuilder::llvm_log10_fn): Likewise.
(SharkBuilder::llvm_pow_fn): Likewise.
(SharkBuilder::llvm_exp_fn): Likewise.
(SharkBuilder::CreateCmpxchgInt): Likewise.
* ports/hotspot/src/share/vm/shark/sharkBuilder.cpp
(SharkBuilder::init_external_functions): Initialize new fields.
(SharkBuilder::CreateCmpxchgInt): New method.
* ports/hotspot/src/share/vm/shark/sharkRuntime.hpp
(SharkRuntime::_current_time_millis): New field.
(SharkRuntime::_fabs): Likewise.
(SharkRuntime::_tan): Likewise.
(SharkRuntime::_atan2): Likewise.
(SharkRuntime::_unsafe_field_offset_to_byte_offset): Likewise.
(SharkRuntime::current_time_millis): New method.
(SharkRuntime::fabs): Likewise.
(SharkRuntime::tan): Likewise.
(SharkRuntime::atan2): Likewise.
(SharkRuntime::unsafe_field_offset_to_byte_offset): Likewise.
* ports/hotspot/src/share/vm/shark/sharkRuntime.cpp
(SharkRuntime::_current_time_millis): New field.
(SharkRuntime::_fabs): Likewise.
(SharkRuntime::_tan): Likewise.
(SharkRuntime::_atan2): Likewise.
(SharkRuntime::_unsafe_field_offset_to_byte_offset): Likewise.
(SharkRuntime::initialize): Initialize the above.
* ports/hotspot/src/share/vm/shark/sharkBlock.hpp
(SharkBlock::SharkBlock): New thread argument.
(SharkBlock::_thread): New field.
(SharkBlock::thread): New method.
* ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp
(SharkTopLevelBlock::SharkTopLevelBlock): Pass thread to super.
(SharkTopLevelBlock::thread): Removed method.
* ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp
(SharkTopLevelBlock::do_call): Pass thread to inliner.
* ports/hotspot/src/share/vm/shark/sharkFunction.cpp
(SharkFunction::initialize): Do the arguments before creating blocks.
* ports/hotspot/src/share/vm/shark/sharkInliner.hpp
(SharkInliner::attempt_inline): New thread argument.
* ports/hotspot/src/share/vm/shark/sharkInliner.cpp
(SharkInlineBlock::SharkInlineBlock): Pass thread to super.
(SharkInlinerHelper::SharkInlinerHelper): New thread argument.
(SharkInlinerHelper::_thread): New field.
(SharkInlinerHelper::thread): New method.
(SharkInlinerHelper::do_inline): Pass thread to block constructor.
(SharkInliner::attempt_inline): Attempt to inline intrinsics.
* ports/hotspot/src/share/vm/includeDB_shark: Updated.
diffstat:
15 files changed, 656 insertions(+), 29 deletions(-)
ChangeLog | 83 ++++
ports/hotspot/src/share/vm/includeDB_shark | 15
ports/hotspot/src/share/vm/shark/sharkBlock.hpp | 16
ports/hotspot/src/share/vm/shark/sharkBuilder.cpp | 32 +
ports/hotspot/src/share/vm/shark/sharkBuilder.hpp | 79 ++++
ports/hotspot/src/share/vm/shark/sharkFunction.cpp | 18
ports/hotspot/src/share/vm/shark/sharkInliner.cpp | 31 +
ports/hotspot/src/share/vm/shark/sharkInliner.hpp | 4
ports/hotspot/src/share/vm/shark/sharkIntrinsics.cpp | 284 +++++++++++++++
ports/hotspot/src/share/vm/shark/sharkIntrinsics.hpp | 41 ++
ports/hotspot/src/share/vm/shark/sharkRuntime.cpp | 41 ++
ports/hotspot/src/share/vm/shark/sharkRuntime.hpp | 25 +
ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp | 2
ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp | 11
ports/hotspot/src/share/vm/shark/shark_globals.hpp | 3
diffs (truncated from 966 to 500 lines):
diff -r b7948732adf2 -r 1eeb14582f5a ChangeLog
--- a/ChangeLog Mon Mar 09 12:36:47 2009 -0400
+++ b/ChangeLog Wed Mar 11 09:03:27 2009 -0400
@@ -1,3 +1,86 @@ 2009-03-09 Tomas Hurka <tomas.hurka at su
+2009-03-11 Gary Benson <gbenson at redhat.com>
+
+ * ports/hotspot/src/share/vm/shark/sharkIntrinsics.hpp: New file.
+ * ports/hotspot/src/share/vm/shark/sharkIntrinsics.cpp: Likewise.
+
+ * ports/hotspot/src/share/vm/shark/shark_globals.hpp
+ (SharkPerformanceWarnings): New flag.
+
+ * ports/hotspot/src/share/vm/shark/sharkBuilder.hpp
+ (SharkBuilder::_llvm_cmpxchg_int_fn): New field.
+ (SharkBuilder::_llvm_sin_fn): Likewise.
+ (SharkBuilder::_llvm_cos_fn): Likewise.
+ (SharkBuilder::_llvm_sqrt_fn): Likewise.
+ (SharkBuilder::_llvm_log_fn): Likewise.
+ (SharkBuilder::_llvm_log10_fn): Likewise.
+ (SharkBuilder::_llvm_pow_fn): Likewise.
+ (SharkBuilder::_llvm_exp_fn): Likewise.
+ (SharkBuilder::set_llvm_cmpxchg_int_fn): New method.
+ (SharkBuilder::set_llvm_sin_fn): Likewise.
+ (SharkBuilder::set_llvm_cos_fn): Likewise.
+ (SharkBuilder::set_llvm_sqrt_fn): Likewise.
+ (SharkBuilder::set_llvm_log_fn): Likewise.
+ (SharkBuilder::set_llvm_log10_fn): Likewise.
+ (SharkBuilder::set_llvm_pow_fn): Likewise.
+ (SharkBuilder::set_llvm_exp_fn): Likewise.
+ (SharkBuilder::llvm_cmpxchg_int_fn): Likewise.
+ (SharkBuilder::llvm_sin_fn): Likewise.
+ (SharkBuilder::llvm_cos_fn): Likewise.
+ (SharkBuilder::llvm_sqrt_fn): Likewise.
+ (SharkBuilder::llvm_log_fn): Likewise.
+ (SharkBuilder::llvm_log10_fn): Likewise.
+ (SharkBuilder::llvm_pow_fn): Likewise.
+ (SharkBuilder::llvm_exp_fn): Likewise.
+ (SharkBuilder::CreateCmpxchgInt): Likewise.
+ * ports/hotspot/src/share/vm/shark/sharkBuilder.cpp
+ (SharkBuilder::init_external_functions): Initialize new fields.
+ (SharkBuilder::CreateCmpxchgInt): New method.
+
+ * ports/hotspot/src/share/vm/shark/sharkRuntime.hpp
+ (SharkRuntime::_current_time_millis): New field.
+ (SharkRuntime::_fabs): Likewise.
+ (SharkRuntime::_tan): Likewise.
+ (SharkRuntime::_atan2): Likewise.
+ (SharkRuntime::_unsafe_field_offset_to_byte_offset): Likewise.
+ (SharkRuntime::current_time_millis): New method.
+ (SharkRuntime::fabs): Likewise.
+ (SharkRuntime::tan): Likewise.
+ (SharkRuntime::atan2): Likewise.
+ (SharkRuntime::unsafe_field_offset_to_byte_offset): Likewise.
+ * ports/hotspot/src/share/vm/shark/sharkRuntime.cpp
+ (SharkRuntime::_current_time_millis): New field.
+ (SharkRuntime::_fabs): Likewise.
+ (SharkRuntime::_tan): Likewise.
+ (SharkRuntime::_atan2): Likewise.
+ (SharkRuntime::_unsafe_field_offset_to_byte_offset): Likewise.
+ (SharkRuntime::initialize): Initialize the above.
+
+ * ports/hotspot/src/share/vm/shark/sharkBlock.hpp
+ (SharkBlock::SharkBlock): New thread argument.
+ (SharkBlock::_thread): New field.
+ (SharkBlock::thread): New method.
+
+ * ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp
+ (SharkTopLevelBlock::SharkTopLevelBlock): Pass thread to super.
+ (SharkTopLevelBlock::thread): Removed method.
+ * ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp
+ (SharkTopLevelBlock::do_call): Pass thread to inliner.
+
+ * ports/hotspot/src/share/vm/shark/sharkFunction.cpp
+ (SharkFunction::initialize): Do the arguments before creating blocks.
+
+ * ports/hotspot/src/share/vm/shark/sharkInliner.hpp
+ (SharkInliner::attempt_inline): New thread argument.
+ * ports/hotspot/src/share/vm/shark/sharkInliner.cpp
+ (SharkInlineBlock::SharkInlineBlock): Pass thread to super.
+ (SharkInlinerHelper::SharkInlinerHelper): New thread argument.
+ (SharkInlinerHelper::_thread): New field.
+ (SharkInlinerHelper::thread): New method.
+ (SharkInlinerHelper::do_inline): Pass thread to block constructor.
+ (SharkInliner::attempt_inline): Attempt to inline intrinsics.
+
+ * ports/hotspot/src/share/vm/includeDB_shark: Updated.
+
2009-03-09 Tomas Hurka <tomas.hurka at sun.com>
* Makefile.am: Updated visualvm to version 1.1.1.
diff -r b7948732adf2 -r 1eeb14582f5a ports/hotspot/src/share/vm/includeDB_shark
--- a/ports/hotspot/src/share/vm/includeDB_shark Mon Mar 09 12:36:47 2009 -0400
+++ b/ports/hotspot/src/share/vm/includeDB_shark Wed Mar 11 09:03:27 2009 -0400
@@ -191,12 +191,27 @@ sharkInliner.cpp
sharkInliner.cpp ciStreams.hpp
sharkInliner.cpp shark_globals.hpp
sharkInliner.cpp sharkInliner.hpp
+sharkInliner.cpp sharkIntrinsics.hpp
sharkInliner.cpp sharkState.inline.hpp
sharkInliner.cpp sharkValue.inline.hpp
sharkInliner.hpp allocation.hpp
sharkInliner.hpp ciMethod.hpp
+sharkInliner.hpp llvmHeaders.hpp
sharkInliner.hpp sharkState.inline.hpp
+
+sharkIntrinsics.cpp ciMethod.hpp
+sharkIntrinsics.cpp llvmHeaders.hpp
+sharkIntrinsics.cpp shark_globals.hpp
+sharkIntrinsics.cpp sharkIntrinsics.hpp
+sharkIntrinsics.cpp sharkRuntime.hpp
+sharkIntrinsics.cpp sharkState.inline.hpp
+sharkIntrinsics.cpp sharkValue.inline.hpp
+
+sharkIntrinsics.hpp allocation.hpp
+sharkIntrinsics.hpp ciMethod.hpp
+sharkIntrinsics.hpp llvmHeaders.hpp
+sharkIntrinsics.hpp sharkState.hpp
sharkMemoryManager.hpp llvmHeaders.hpp
sharkMemoryManager.hpp sharkEntry.hpp
diff -r b7948732adf2 -r 1eeb14582f5a ports/hotspot/src/share/vm/shark/sharkBlock.hpp
--- a/ports/hotspot/src/share/vm/shark/sharkBlock.hpp Mon Mar 09 12:36:47 2009 -0400
+++ b/ports/hotspot/src/share/vm/shark/sharkBlock.hpp Wed Mar 11 09:03:27 2009 -0400
@@ -27,14 +27,22 @@ class SharkState;
class SharkBlock : public ResourceObj {
public:
- SharkBlock(SharkBuilder* builder, ciMethod* target, ciBytecodeStream* iter)
- : _builder(builder),_target(target),_iter(iter),_current_state(NULL) {}
+ SharkBlock(SharkBuilder* builder,
+ ciMethod* target,
+ ciBytecodeStream* iter,
+ llvm::Value* thread)
+ : _builder(builder),
+ _target(target),
+ _iter(iter),
+ _current_state(NULL),
+ _thread(thread) {}
private:
SharkBuilder* _builder;
ciMethod* _target;
ciBytecodeStream* _iter;
SharkState* _current_state;
+ llvm::Value* _thread;
public:
SharkBuilder* builder() const
@@ -48,6 +56,10 @@ class SharkBlock : public ResourceObj {
ciBytecodeStream* iter() const
{
return _iter;
+ }
+ llvm::Value* thread() const
+ {
+ return _thread;
}
// Target properties
diff -r b7948732adf2 -r 1eeb14582f5a ports/hotspot/src/share/vm/shark/sharkBuilder.cpp
--- a/ports/hotspot/src/share/vm/shark/sharkBuilder.cpp Mon Mar 09 12:36:47 2009 -0400
+++ b/ports/hotspot/src/share/vm/shark/sharkBuilder.cpp Wed Mar 11 09:03:27 2009 -0400
@@ -76,6 +76,14 @@ void SharkBuilder::init_external_functio
set_llvm_memset_fn(module()->getOrInsertFunction("llvm.memset.i32", type));
params.clear();
+ params.push_back(PointerType::getUnqual(SharkType::jint_type()));
+ params.push_back(SharkType::jint_type());
+ params.push_back(SharkType::jint_type());
+ type = FunctionType::get(SharkType::jint_type(), params, false);
+ set_llvm_cmpxchg_int_fn(
+ module()->getOrInsertFunction("llvm.atomic.cmp.swap.i32", type));
+
+ params.clear();
params.push_back(PointerType::getUnqual(SharkType::intptr_type()));
params.push_back(SharkType::intptr_type());
params.push_back(SharkType::intptr_type());
@@ -90,6 +98,22 @@ void SharkBuilder::init_external_functio
type = FunctionType::get(Type::VoidTy, params, false);
set_llvm_memory_barrier_fn(
module()->getOrInsertFunction("llvm.memory.barrier", type));
+
+ params.clear();
+ params.push_back(SharkType::jdouble_type());
+ type = FunctionType::get(SharkType::jdouble_type(), params, false);
+ set_llvm_sin_fn (module()->getOrInsertFunction("llvm.sin.f64", type));
+ set_llvm_cos_fn (module()->getOrInsertFunction("llvm.cos.f64", type));
+ set_llvm_sqrt_fn (module()->getOrInsertFunction("llvm.sqrt.f64", type));
+ set_llvm_log_fn (module()->getOrInsertFunction("llvm.log.f64", type));
+ set_llvm_log10_fn(module()->getOrInsertFunction("llvm.log10.f64", type));
+ set_llvm_exp_fn (module()->getOrInsertFunction("llvm.exp.f64", type));
+
+ params.clear();
+ params.push_back(SharkType::jdouble_type());
+ params.push_back(SharkType::jdouble_type());
+ type = FunctionType::get(SharkType::jdouble_type(), params, false);
+ set_llvm_pow_fn(module()->getOrInsertFunction("llvm.pow.f64", type));
}
Function *SharkBuilder::CreateFunction(const char *name)
@@ -130,6 +154,14 @@ CallInst* SharkBuilder::CreateDump(llvm:
return CreateCall2(SharkRuntime::dump(), name, value);
}
+CallInst* SharkBuilder::CreateCmpxchgInt(Value* exchange_value,
+ Value* dst,
+ Value* compare_value)
+{
+ return CreateCall3(
+ llvm_cmpxchg_int_fn(), dst, compare_value, exchange_value);
+}
+
CallInst* SharkBuilder::CreateCmpxchgPtr(Value* exchange_value,
Value* dst,
Value* compare_value)
diff -r b7948732adf2 -r 1eeb14582f5a ports/hotspot/src/share/vm/shark/sharkBuilder.hpp
--- a/ports/hotspot/src/share/vm/shark/sharkBuilder.hpp Mon Mar 09 12:36:47 2009 -0400
+++ b/ports/hotspot/src/share/vm/shark/sharkBuilder.hpp Wed Mar 11 09:03:27 2009 -0400
@@ -197,10 +197,22 @@ class SharkBuilder : public llvm::IRBuil
// External functions (and intrinsics)
private:
+ llvm::Constant* _llvm_cmpxchg_int_fn;
llvm::Constant* _llvm_cmpxchg_ptr_fn;
llvm::Constant* _llvm_memory_barrier_fn;
llvm::Constant* _llvm_memset_fn;
-
+ llvm::Constant* _llvm_sin_fn;
+ llvm::Constant* _llvm_cos_fn;
+ llvm::Constant* _llvm_sqrt_fn;
+ llvm::Constant* _llvm_log_fn;
+ llvm::Constant* _llvm_log10_fn;
+ llvm::Constant* _llvm_pow_fn;
+ llvm::Constant* _llvm_exp_fn;
+
+ void set_llvm_cmpxchg_int_fn(llvm::Constant* llvm_cmpxchg_int_fn)
+ {
+ _llvm_cmpxchg_int_fn = llvm_cmpxchg_int_fn;
+ }
void set_llvm_cmpxchg_ptr_fn(llvm::Constant* llvm_cmpxchg_ptr_fn)
{
_llvm_cmpxchg_ptr_fn = llvm_cmpxchg_ptr_fn;
@@ -213,10 +225,42 @@ class SharkBuilder : public llvm::IRBuil
{
_llvm_memset_fn = llvm_memset_fn;
}
+ void set_llvm_sin_fn(llvm::Constant* llvm_sin_fn)
+ {
+ _llvm_sin_fn = llvm_sin_fn;
+ }
+ void set_llvm_cos_fn(llvm::Constant* llvm_cos_fn)
+ {
+ _llvm_cos_fn = llvm_cos_fn;
+ }
+ void set_llvm_sqrt_fn(llvm::Constant* llvm_sqrt_fn)
+ {
+ _llvm_sqrt_fn = llvm_sqrt_fn;
+ }
+ void set_llvm_log_fn(llvm::Constant* llvm_log_fn)
+ {
+ _llvm_log_fn = llvm_log_fn;
+ }
+ void set_llvm_log10_fn(llvm::Constant* llvm_log10_fn)
+ {
+ _llvm_log10_fn = llvm_log10_fn;
+ }
+ void set_llvm_pow_fn(llvm::Constant* llvm_pow_fn)
+ {
+ _llvm_pow_fn = llvm_pow_fn;
+ }
+ void set_llvm_exp_fn(llvm::Constant* llvm_exp_fn)
+ {
+ _llvm_exp_fn = llvm_exp_fn;
+ }
void init_external_functions();
protected:
+ llvm::Constant* llvm_cmpxchg_int_fn() const
+ {
+ return _llvm_cmpxchg_int_fn;
+ }
llvm::Constant* llvm_cmpxchg_ptr_fn() const
{
return _llvm_cmpxchg_ptr_fn;
@@ -228,6 +272,36 @@ class SharkBuilder : public llvm::IRBuil
llvm::Constant* llvm_memset_fn() const
{
return _llvm_memset_fn;
+ }
+
+ public:
+ llvm::Constant* llvm_sin_fn() const
+ {
+ return _llvm_sin_fn;
+ }
+ llvm::Constant* llvm_cos_fn() const
+ {
+ return _llvm_cos_fn;
+ }
+ llvm::Constant* llvm_sqrt_fn() const
+ {
+ return _llvm_sqrt_fn;
+ }
+ llvm::Constant* llvm_log_fn() const
+ {
+ return _llvm_log_fn;
+ }
+ llvm::Constant* llvm_log10_fn() const
+ {
+ return _llvm_log10_fn;
+ }
+ llvm::Constant* llvm_pow_fn() const
+ {
+ return _llvm_pow_fn;
+ }
+ llvm::Constant* llvm_exp_fn() const
+ {
+ return _llvm_exp_fn;
}
public:
@@ -236,6 +310,9 @@ class SharkBuilder : public llvm::IRBuil
llvm::Value* value,
llvm::Value* len,
llvm::Value* align);
+ llvm::CallInst* CreateCmpxchgInt(llvm::Value* exchange_value,
+ llvm::Value* dst,
+ llvm::Value* compare_value);
llvm::CallInst* CreateCmpxchgPtr(llvm::Value* exchange_value,
llvm::Value* dst,
llvm::Value* compare_value);
diff -r b7948732adf2 -r 1eeb14582f5a ports/hotspot/src/share/vm/shark/sharkFunction.cpp
--- a/ports/hotspot/src/share/vm/shark/sharkFunction.cpp Mon Mar 09 12:36:47 2009 -0400
+++ b/ports/hotspot/src/share/vm/shark/sharkFunction.cpp Wed Mar 11 09:03:27 2009 -0400
@@ -100,6 +100,15 @@ void SharkFunction::initialize()
entry->set_llvm_function(function());
compiler()->memory_manager()->set_entry_for_function(function(), entry);
+ // Get our arguments
+ Function::arg_iterator ai = function()->arg_begin();
+ Argument *method = ai++;
+ method->setName("method");
+ _base_pc = ai++;
+ _base_pc->setName("base_pc");
+ _thread = ai++;
+ _thread->setName("thread");
+
// Create the list of blocks
set_block_insertion_point(NULL);
_blocks = NEW_RESOURCE_ARRAY(SharkTopLevelBlock*, flow()->block_count());
@@ -132,15 +141,6 @@ void SharkFunction::initialize()
_monitor_count, block(i)->ciblock()->monitor_count());
}
- // Get our arguments
- Function::arg_iterator ai = function()->arg_begin();
- Argument *method = ai++;
- method->setName("method");
- _base_pc = ai++;
- _base_pc->setName("base_pc");
- _thread = ai++;
- _thread->setName("thread");
-
// Create the method preamble
set_block_insertion_point(&function()->front());
builder()->SetInsertPoint(CreateBlock());
diff -r b7948732adf2 -r 1eeb14582f5a ports/hotspot/src/share/vm/shark/sharkInliner.cpp
--- a/ports/hotspot/src/share/vm/shark/sharkInliner.cpp Mon Mar 09 12:36:47 2009 -0400
+++ b/ports/hotspot/src/share/vm/shark/sharkInliner.cpp Wed Mar 11 09:03:27 2009 -0400
@@ -32,8 +32,9 @@ class SharkInlineBlock : public SharkBlo
public:
SharkInlineBlock(ciMethod* target,
SharkState* state,
- ciBytecodeStream* iter)
- : SharkBlock(state->builder(), target, iter),
+ ciBytecodeStream* iter,
+ Value* thread)
+ : SharkBlock(state->builder(), target, iter, thread),
_outer_state(state),
_entry_state(new SharkState(this))
{
@@ -79,13 +80,17 @@ class SharkInlineBlock : public SharkBlo
class SharkInlinerHelper : public StackObj {
public:
- SharkInlinerHelper(ciMethod* target, SharkState* entry_state)
- : _target(target), _entry_state(entry_state), _iter(target) {}
+ SharkInlinerHelper(ciMethod* target, SharkState* entry_state, Value* thread)
+ : _target(target),
+ _entry_state(entry_state),
+ _iter(target),
+ _thread(thread) {}
private:
ciBytecodeStream _iter;
SharkState* _entry_state;
ciMethod* _target;
+ Value* _thread;
public:
ciBytecodeStream* iter()
@@ -99,6 +104,10 @@ class SharkInlinerHelper : public StackO
ciMethod* target() const
{
return _target;
+ }
+ Value* thread() const
+ {
+ return _thread;
}
public:
@@ -198,7 +207,8 @@ class SharkInlinerHelper : public StackO
public:
void do_inline()
{
- (new SharkInlineBlock(target(), entry_state(), iter()))->emit_IR();
+ (new SharkInlineBlock(
+ target(), entry_state(), iter(), thread()))->emit_IR();
}
};
@@ -756,10 +766,17 @@ bool SharkInlinerHelper::do_field_access
return true;
}
-bool SharkInliner::attempt_inline(ciMethod *target, SharkState *state)
+bool SharkInliner::attempt_inline(ciMethod* target,
+ SharkState* state,
+ Value* thread)
{
+ if (SharkIntrinsics::is_intrinsic(target)) {
+ SharkIntrinsics::inline_intrinsic(target, state, thread);
+ return true;
+ }
+
if (may_be_inlinable(target)) {
- SharkInlinerHelper inliner(target, state);
+ SharkInlinerHelper inliner(target, state, thread);
if (inliner.is_inlinable()) {
inliner.do_inline();
return true;
diff -r b7948732adf2 -r 1eeb14582f5a ports/hotspot/src/share/vm/shark/sharkInliner.hpp
--- a/ports/hotspot/src/share/vm/shark/sharkInliner.hpp Mon Mar 09 12:36:47 2009 -0400
+++ b/ports/hotspot/src/share/vm/shark/sharkInliner.hpp Wed Mar 11 09:03:27 2009 -0400
@@ -25,7 +25,9 @@
class SharkInliner : public AllStatic {
public:
- static bool attempt_inline(ciMethod* target, SharkState* state);
+ static bool attempt_inline(ciMethod* target,
+ SharkState* state,
+ llvm::Value* thread);
private:
static bool may_be_inlinable(ciMethod* target);
diff -r b7948732adf2 -r 1eeb14582f5a ports/hotspot/src/share/vm/shark/sharkIntrinsics.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ports/hotspot/src/share/vm/shark/sharkIntrinsics.cpp Wed Mar 11 09:03:27 2009 -0400
@@ -0,0 +1,284 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ */
+
+#include "incls/_precompiled.incl"
+#include "incls/_sharkIntrinsics.cpp.incl"
+
+using namespace llvm;
+
+bool SharkIntrinsics::is_intrinsic(ciMethod *target)
+{
+ switch (target->intrinsic_id()) {
+ case vmIntrinsics::_none:
+ return false;
+
+ // java.lang.Math
+ case vmIntrinsics::_min:
More information about the distro-pkg-dev
mailing list