changeset in /hg/icedtea: 2009-03-13 Gary Benson <gbenson at redh...
Gary Benson
gbenson at redhat.com
Fri Mar 20 01:52:18 PDT 2009
changeset 1b78a216c47e in /hg/icedtea
details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=1b78a216c47e
description:
2009-03-13 Gary Benson <gbenson at redhat.com>
* ports/hotspot/src/share/vm/shark/sharkState.hpp
(SharkEntryState): Moved from sharkFunction.cpp.
(SharkPHIState): Moved from sharkTopLevelBlock.cpp.
* ports/hotspot/src/share/vm/shark/sharkState.hpp
(SharkEntryState::SharkEntryState): Moved from sharkFunction.cpp.
(SharkPHIState::SharkPHIState): Moved from sharkTopLevelBlock.cpp.
(SharkPHIState::add_incoming): Likewise.
* ports/hotspot/src/share/vm/shark/sharkFunction.cpp
(SharkEntryState): Removed.
* ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp
(SharkPHIState): Likewise.
(transplanted from 8ad9d28381c535b4c4a80aa08b14e7e556875ccf)
diffstat:
5 files changed, 199 insertions(+), 172 deletions(-)
ChangeLog | 15 +
ports/hotspot/src/share/vm/shark/sharkFunction.cpp | 59 -----
ports/hotspot/src/share/vm/shark/sharkState.cpp | 165 +++++++++++++++
ports/hotspot/src/share/vm/shark/sharkState.hpp | 19 +
ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp | 113 ----------
diffs (419 lines):
diff -r 80257489410d -r 1b78a216c47e ChangeLog
--- a/ChangeLog Fri Mar 13 05:07:05 2009 -0400
+++ b/ChangeLog Fri Mar 13 05:43:37 2009 -0400
@@ -1,3 +1,18 @@ 2009-03-13 Gary Benson <gbenson at redhat
+2009-03-13 Gary Benson <gbenson at redhat.com>
+
+ * ports/hotspot/src/share/vm/shark/sharkState.hpp
+ (SharkEntryState): Moved from sharkFunction.cpp.
+ (SharkPHIState): Moved from sharkTopLevelBlock.cpp.
+ * ports/hotspot/src/share/vm/shark/sharkState.hpp
+ (SharkEntryState::SharkEntryState): Moved from sharkFunction.cpp.
+ (SharkPHIState::SharkPHIState): Moved from sharkTopLevelBlock.cpp.
+ (SharkPHIState::add_incoming): Likewise.
+
+ * ports/hotspot/src/share/vm/shark/sharkFunction.cpp
+ (SharkEntryState): Removed.
+ * ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp
+ (SharkPHIState): Likewise.
+
2009-03-13 Gary Benson <gbenson at redhat.com>
* ports/hotspot/src/share/vm/shark/sharkValue.hpp
diff -r 80257489410d -r 1b78a216c47e ports/hotspot/src/share/vm/shark/sharkFunction.cpp
--- a/ports/hotspot/src/share/vm/shark/sharkFunction.cpp Fri Mar 13 05:07:05 2009 -0400
+++ b/ports/hotspot/src/share/vm/shark/sharkFunction.cpp Fri Mar 13 05:43:37 2009 -0400
@@ -89,65 +89,6 @@ class SharkEntryState : public SharkStat
}
};
-class SharkEntryState : public SharkState {
- public:
- SharkEntryState(SharkTopLevelBlock* block, llvm::Value* method)
- : SharkState(block, block->function(), method)
- {
- char name[18];
-
- // Local variables
- for (int i = 0; i < max_locals(); i++) {
- ciType *type = block->local_type_at_entry(i);
-
- SharkValue *value = NULL;
- switch (type->basic_type()) {
- case T_INT:
- case T_LONG:
- case T_FLOAT:
- case T_DOUBLE:
- case T_OBJECT:
- case T_ARRAY:
- if (i < function()->arg_size()) {
- snprintf(name, sizeof(name), "local_%d_", i);
- value = SharkValue::create_generic(
- type,
- builder()->CreateLoad(
- function()->CreateAddressOfFrameEntry(
- function()->locals_slots_offset()
- + max_locals() - type->size() - i,
- SharkType::to_stackType(type)),
- name));
- }
- else {
- Unimplemented();
- }
- break;
-
- case ciTypeFlow::StateVector::T_BOTTOM:
- break;
-
- case ciTypeFlow::StateVector::T_LONG2:
- case ciTypeFlow::StateVector::T_DOUBLE2:
- break;
-
- default:
- ShouldNotReachHere();
- }
- set_local(i, value);
- }
-
- // Non-static methods have a guaranteed non-null receiver
- if (!function()->target()->is_static()) {
- assert(local(0)->is_jobject(), "should be");
- local(0)->set_zero_checked(true);
- }
-
- // Expression stack
- assert(!block->stack_depth_at_entry(), "entry block shouldn't have stack");
- }
-};
-
void SharkFunction::initialize()
{
// Emit the entry point
diff -r 80257489410d -r 1b78a216c47e ports/hotspot/src/share/vm/shark/sharkState.cpp
--- a/ports/hotspot/src/share/vm/shark/sharkState.cpp Fri Mar 13 05:07:05 2009 -0400
+++ b/ports/hotspot/src/share/vm/shark/sharkState.cpp Fri Mar 13 05:43:37 2009 -0400
@@ -185,3 +185,168 @@ void SharkState::decache_for_trap()
assert(function() && method(), "you cannot decache here");
SharkTrapDecacher(function(), block()->bci()).scan(this);
}
+
+SharkEntryState::SharkEntryState(SharkTopLevelBlock* block, Value* method)
+ : SharkState(block, block->function(), method)
+{
+ char name[18];
+
+ // Local variables
+ for (int i = 0; i < max_locals(); i++) {
+ ciType *type = block->local_type_at_entry(i);
+
+ SharkValue *value = NULL;
+ switch (type->basic_type()) {
+ case T_INT:
+ case T_LONG:
+ case T_FLOAT:
+ case T_DOUBLE:
+ case T_OBJECT:
+ case T_ARRAY:
+ if (i < function()->arg_size()) {
+ snprintf(name, sizeof(name), "local_%d_", i);
+ value = SharkValue::create_generic(
+ type,
+ builder()->CreateLoad(
+ function()->CreateAddressOfFrameEntry(
+ function()->locals_slots_offset()
+ + max_locals() - type->size() - i,
+ SharkType::to_stackType(type)),
+ name));
+ }
+ else {
+ Unimplemented();
+ }
+ break;
+
+ case ciTypeFlow::StateVector::T_BOTTOM:
+ break;
+
+ case ciTypeFlow::StateVector::T_LONG2:
+ case ciTypeFlow::StateVector::T_DOUBLE2:
+ break;
+
+ default:
+ ShouldNotReachHere();
+ }
+ set_local(i, value);
+ }
+
+ // Non-static methods have a guaranteed non-null receiver
+ if (!function()->target()->is_static()) {
+ assert(local(0)->is_jobject(), "should be");
+ local(0)->set_zero_checked(true);
+ }
+
+ // Expression stack
+ assert(!block->stack_depth_at_entry(), "entry block shouldn't have stack");
+}
+
+SharkPHIState::SharkPHIState(SharkTopLevelBlock* block)
+ : SharkState(block, block->function())
+{
+ BasicBlock *saved_insert_point = builder()->GetInsertBlock();
+ builder()->SetInsertPoint(block->entry_block());
+ char name[18];
+
+ // Method
+ set_method(builder()->CreatePHI(SharkType::methodOop_type(), "method"));
+
+ // Local variables
+ for (int i = 0; i < max_locals(); i++) {
+ ciType *type = block->local_type_at_entry(i);
+ if (type->basic_type() == (BasicType) ciTypeFlow::StateVector::T_NULL) {
+ // XXX we could do all kinds of clever stuff here
+ type = ciType::make(T_OBJECT); // XXX what about T_ARRAY?
+ }
+
+ SharkValue *value = NULL;
+ switch (type->basic_type()) {
+ case T_INT:
+ case T_LONG:
+ case T_FLOAT:
+ case T_DOUBLE:
+ case T_OBJECT:
+ case T_ARRAY:
+ snprintf(name, sizeof(name), "local_%d_", i);
+ value = SharkValue::create_generic(
+ type, builder()->CreatePHI(SharkType::to_stackType(type), name));
+ break;
+
+ case T_ADDRESS:
+ value = SharkValue::address_constant(type->as_return_address()->bci());
+ break;
+
+ case ciTypeFlow::StateVector::T_BOTTOM:
+ break;
+
+ case ciTypeFlow::StateVector::T_LONG2:
+ case ciTypeFlow::StateVector::T_DOUBLE2:
+ break;
+
+ default:
+ ShouldNotReachHere();
+ }
+ set_local(i, value);
+ }
+
+ // Expression stack
+ for (int i = 0; i < block->stack_depth_at_entry(); i++) {
+ ciType *type = block->stack_type_at_entry(i);
+ if (type->basic_type() == (BasicType) ciTypeFlow::StateVector::T_NULL) {
+ // XXX we could do all kinds of clever stuff here
+ type = ciType::make(T_OBJECT); // XXX what about T_ARRAY?
+ }
+
+ SharkValue *value = NULL;
+ switch (type->basic_type()) {
+ case T_INT:
+ case T_LONG:
+ case T_FLOAT:
+ case T_DOUBLE:
+ case T_OBJECT:
+ case T_ARRAY:
+ snprintf(name, sizeof(name), "stack_%d_", i);
+ value = SharkValue::create_generic(
+ type, builder()->CreatePHI(SharkType::to_stackType(type), name));
+ break;
+
+ case T_ADDRESS:
+ value = SharkValue::address_constant(type->as_return_address()->bci());
+ break;
+
+ case ciTypeFlow::StateVector::T_LONG2:
+ case ciTypeFlow::StateVector::T_DOUBLE2:
+ break;
+
+ default:
+ ShouldNotReachHere();
+ }
+ push(value);
+ }
+
+ builder()->SetInsertPoint(saved_insert_point);
+}
+
+void SharkPHIState::add_incoming(SharkState* incoming_state)
+{
+ BasicBlock *predecessor = builder()->GetInsertBlock();
+
+ // Method
+ ((PHINode *) method())->addIncoming(incoming_state->method(), predecessor);
+
+ // Local variables
+ for (int i = 0; i < max_locals(); i++) {
+ if (local(i) != NULL)
+ local(i)->addIncoming(incoming_state->local(i), predecessor);
+ }
+
+ // Expression stack
+ int stack_depth = ((SharkTopLevelBlock *) block())->stack_depth_at_entry();
+ assert(stack_depth == incoming_state->stack_depth(), "should be");
+ for (int i = 0; i < stack_depth; i++) {
+ assert((stack(i) == NULL) == (incoming_state->stack(i) == NULL), "oops");
+ if (stack(i))
+ stack(i)->addIncoming(incoming_state->stack(i), predecessor);
+ }
+}
diff -r 80257489410d -r 1b78a216c47e ports/hotspot/src/share/vm/shark/sharkState.hpp
--- a/ports/hotspot/src/share/vm/shark/sharkState.hpp Fri Mar 13 05:07:05 2009 -0400
+++ b/ports/hotspot/src/share/vm/shark/sharkState.hpp Fri Mar 13 05:43:37 2009 -0400
@@ -25,6 +25,7 @@
class SharkBlock;
class SharkFunction;
+class SharkTopLevelBlock;
class SharkState : public ResourceObj {
public:
@@ -145,3 +146,21 @@ class SharkState : public ResourceObj {
void cache_after_VM_call();
void decache_for_trap();
};
+
+// SharkEntryState objects are used to manage the state
+// that the method will be entered with.
+class SharkEntryState : public SharkState {
+ public:
+ SharkEntryState(SharkTopLevelBlock* block, llvm::Value* method);
+};
+
+// SharkPHIState objects are used to manage the entry state
+// for blocks with more than one entry path or for blocks
+// entered from blocks that will be compiled later.
+class SharkPHIState : public SharkState {
+ public:
+ SharkPHIState(SharkTopLevelBlock* block);
+
+ public:
+ void add_incoming(SharkState* incoming_state);
+};
diff -r 80257489410d -r 1b78a216c47e ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp
--- a/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp Fri Mar 13 05:07:05 2009 -0400
+++ b/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp Fri Mar 13 05:43:37 2009 -0400
@@ -28,119 +28,6 @@
using namespace llvm;
-class SharkPHIState : public SharkState {
- public:
- SharkPHIState(SharkTopLevelBlock* block)
- : SharkState(block, block->function())
- {
- BasicBlock *saved_insert_point = builder()->GetInsertBlock();
- builder()->SetInsertPoint(block->entry_block());
- char name[18];
-
- // Method
- set_method(builder()->CreatePHI(SharkType::methodOop_type(), "method"));
-
- // Local variables
- for (int i = 0; i < max_locals(); i++) {
- ciType *type = block->local_type_at_entry(i);
- if (type->basic_type() == (BasicType) ciTypeFlow::StateVector::T_NULL) {
- // XXX we could do all kinds of clever stuff here
- type = ciType::make(T_OBJECT); // XXX what about T_ARRAY?
- }
-
- SharkValue *value = NULL;
- switch (type->basic_type()) {
- case T_INT:
- case T_LONG:
- case T_FLOAT:
- case T_DOUBLE:
- case T_OBJECT:
- case T_ARRAY:
- snprintf(name, sizeof(name), "local_%d_", i);
- value = SharkValue::create_generic(
- type, builder()->CreatePHI(SharkType::to_stackType(type), name));
- break;
-
- case T_ADDRESS:
- value = SharkValue::address_constant(type->as_return_address()->bci());
- break;
-
- case ciTypeFlow::StateVector::T_BOTTOM:
- break;
-
- case ciTypeFlow::StateVector::T_LONG2:
- case ciTypeFlow::StateVector::T_DOUBLE2:
- break;
-
- default:
- ShouldNotReachHere();
- }
- set_local(i, value);
- }
-
- // Expression stack
- for (int i = 0; i < block->stack_depth_at_entry(); i++) {
- ciType *type = block->stack_type_at_entry(i);
- if (type->basic_type() == (BasicType) ciTypeFlow::StateVector::T_NULL) {
- // XXX we could do all kinds of clever stuff here
- type = ciType::make(T_OBJECT); // XXX what about T_ARRAY?
- }
-
- SharkValue *value = NULL;
- switch (type->basic_type()) {
- case T_INT:
- case T_LONG:
- case T_FLOAT:
- case T_DOUBLE:
- case T_OBJECT:
- case T_ARRAY:
- snprintf(name, sizeof(name), "stack_%d_", i);
- value = SharkValue::create_generic(
- type, builder()->CreatePHI(SharkType::to_stackType(type), name));
- break;
-
- case T_ADDRESS:
- value = SharkValue::address_constant(type->as_return_address()->bci());
- break;
-
- case ciTypeFlow::StateVector::T_LONG2:
- case ciTypeFlow::StateVector::T_DOUBLE2:
- break;
-
- default:
- ShouldNotReachHere();
- }
- push(value);
- }
-
- builder()->SetInsertPoint(saved_insert_point);
- }
-
- public:
- void add_incoming(SharkState* incoming_state)
- {
- BasicBlock *predecessor = builder()->GetInsertBlock();
-
- // Method
- ((PHINode *) method())->addIncoming(incoming_state->method(), predecessor);
-
- // Local variables
- for (int i = 0; i < max_locals(); i++) {
- if (local(i) != NULL)
- local(i)->addIncoming(incoming_state->local(i), predecessor);
- }
-
- // Expression stack
- int stack_depth = ((SharkTopLevelBlock *) block())->stack_depth_at_entry();
- assert(stack_depth == incoming_state->stack_depth(), "should be");
- for (int i = 0; i < stack_depth; i++) {
- assert((stack(i) == NULL) == (incoming_state->stack(i) == NULL), "oops");
- if (stack(i))
- stack(i)->addIncoming(incoming_state->stack(i), predecessor);
- }
- }
-};
-
int SharkTopLevelBlock::scan_for_traps()
{
// If typeflow got one then we're already done
More information about the distro-pkg-dev
mailing list