changeset in /hg/icedtea: Forwardport Shark.

Andrew John Hughes ahughes at redhat.com
Wed Jun 10 13:45:31 PDT 2009


changeset 348b533726b1 in /hg/icedtea
details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=348b533726b1
description:
	Forwardport Shark.

	2009-05-27  Gary Benson  <gbenson at redhat.com>

		* ports/hotspot/src/share/vm/shark/sharkFunction.hpp
		(SharkFunction::_monitor_count): Removed.
		(SharkFunction::_max_monitors): New field.
		(SharkFunction::monitor_count): Removed.
		(SharkFunction::max_monitors): New method.
		(SharkFunction::_exception_slot_offset): Removed.
		(SharkFunction::exception_slot): Likewise.
		(SharkFunction::_oop_tmp_slot_offset): New field.
		(SharkFunction::oop_tmp_slot_offset): New method.
		(SharkFunction::monitors_slots): Removed.
		(SharkFunction::monitors_slots_offset): Likewise.
		(SharkFunction::monitor_offset): New method.
		(SharkFunction::monitor_object_offset): Likewise.
		(SharkFunction::monitor_header_offset): Likewise.
		(SharkFunction::monitor_addr): Likewise.
		(SharkFunction::monitor_object_addr): Likewise.
		(SharkFunction::monitor_header_addr): Likewise.
		* ports/hotspot/src/share/vm/shark/sharkFunction.cpp
		(SharkFunction::initialize): Renamed _monitor_count as _max_monitors.
		(SharkFunction::CreateBuildFrame): Renamed _monitor_count as
		_max_monitors, remove monitor initialization, remove exception
		pointer and add temporary oop slot.
		(SharkFunction::monitor): Removed.

		* ports/hotspot/src/share/vm/shark/sharkState.hpp
		(SharkState::_num_monitors): New field.
		(SharkState::max_monitors): New method.
		(SharkState::num_monitors): Likewise.
		(SharkState::set_num_monitors): Likewise.
		(SharkState::_oop_tmp): New field.
		(SharkState::oop_tmp_addr): New method.
		(SharkState::oop_tmp): Likewise.
		(SharkState::set_oop_tmp): Likewise.
		* ports/hotspot/src/share/vm/shark/sharkState.inline.hpp
		(SharkState::max_monitors): New method.
		* ports/hotspot/src/share/vm/shark/sharkState.cpp
		(SharkState::SharkState): Initialize oop_tmp.
		(SharkState::initialize): Initialize num_monitors.
		(SharkPHIState::SharkPHIState): Likewise.
		(SharkState::equal_to): Also check oop_tmp and num_monitors.
		(SharkPHIState::add_incoming): Likewise.
		(SharkState::merge): Also merge oop_tmp and check num_monitors.

		* ports/hotspot/src/share/vm/shark/sharkStateScanner.hpp
		(SharkStateScanner::process_monitor): New argument.
		(SharkStateScanner::process_oop_tmp_slot): New method.
		(SharkStateScanner::process_exception_slot): Removed.
		* ports/hotspot/src/share/vm/shark/sharkStateScanner.cpp
		(SharkStateScanner::scan): Replace monitor scanning, remove
		exception slot, and add temporary oop slot.

	 	* ports/hotspot/src/share/vm/shark/sharkCacheDecache.hpp
		(SharkDecacher::process_monitor): New argument.
		(SharkDecacher::process_oop_tmp_slot): New method.
		(SharkCacher::process_oop_tmp_slot): Likewise.
		(SharkDecacher::process_exception_slot): Removed.
		* ports/hotspot/src/share/vm/shark/sharkCacheDecache.cpp
		(SharkDecacher::process_monitor): New argument.
		(SharkDecacher::process_oop_tmp_slot): New method.
		(SharkCacher::process_oop_tmp_slot): Likewise.
		(SharkDecacher::process_exception_slot): Removed.

		* ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp
		(SharkTopLevelBlock::set_oop_tmp): New method.
		(SharkTopLevelBlock::get_oop_tmp): Likewise.
		(SharkTopLevelBlock::num_monitors): Likewise.
		(SharkTopLevelBlock::set_num_monitors): Likewise.
		(SharkTopLevelBlock::release_method_lock): Removed.
		(SharkTopLevelBlock::release_locked_monitors): Likewise.
		(SharkTopLevelBlock::acquire_lock): New method.
		(SharkTopLevelBlock::release_lock): Likewise.
		* ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp
		(SharkTopLevelBlock::acquire_method_lock): Rewritten.
		(SharkTopLevelBlock::release_method_lock): Removed.
		(SharkTopLevelBlock::release_locked_monitors): Likewise.
		(SharkTopLevelBlock::handle_return): New monitor release code.
		(SharkTopLevelBlock::do_monitorenter): Rewritten.
		(SharkTopLevelBlock::do_monitorexit): Likewise.
		(SharkTopLevelBlock::acquire_lock): New method.
		(SharkTopLevelBlock::release_lock): Likewise.

		* ports/hotspot/src/cpu/zero/vm/sharkFrame_zero.hpp
		(SharkFrame::Layout): Replaced exception slot with oop_tmp slot.
	 	* ports/hotspot/src/cpu/zero/vm/stackPrinter_zero.hpp
		(ZeroStackPrinter::print_word): Likewise.

		* ports/hotspot/src/share/vm/shark/sharkMonitor.hpp: Removed.
		* ports/hotspot/src/share/vm/shark/sharkMonitor.cpp: Likewise.

		* ports/hotspot/src/share/vm/includeDB_shark: Updated.

		* patches/hotspot/default/icedtea-shark.patch
		(vframeArrayElement::fill_in): Remove workaround for
		unused but recorded monitors.
		(vframeArrayElement::unpack_on_stack): Likewise.

diffstat:

18 files changed, 488 insertions(+), 566 deletions(-)
ChangeLog                                               |   98 ++++
patches/hotspot/default/icedtea-shark.patch             |   27 -
ports/hotspot/src/cpu/zero/vm/sharkFrame_zero.hpp       |    4 
ports/hotspot/src/cpu/zero/vm/stackPrinter_zero.hpp     |    4 
ports/hotspot/src/share/vm/includeDB_shark              |   15 
ports/hotspot/src/share/vm/shark/sharkCacheDecache.cpp  |   48 +-
ports/hotspot/src/share/vm/shark/sharkCacheDecache.hpp  |    7 
ports/hotspot/src/share/vm/shark/sharkFunction.cpp      |   53 --
ports/hotspot/src/share/vm/shark/sharkFunction.hpp      |   87 ++--
ports/hotspot/src/share/vm/shark/sharkMonitor.cpp       |  170 -------
ports/hotspot/src/share/vm/shark/sharkMonitor.hpp       |   94 ----
ports/hotspot/src/share/vm/shark/sharkState.cpp         |   35 +
ports/hotspot/src/share/vm/shark/sharkState.hpp         |   29 +
ports/hotspot/src/share/vm/shark/sharkState.inline.hpp  |    5 
ports/hotspot/src/share/vm/shark/sharkStateScanner.cpp  |   13 
ports/hotspot/src/share/vm/shark/sharkStateScanner.hpp  |    6 
ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp |  320 ++++++++-------
ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp |   39 +

diffs (truncated from 1471 to 500 lines):

diff -r b49274854fdc -r 348b533726b1 ChangeLog
--- a/ChangeLog	Wed May 27 13:49:38 2009 +0100
+++ b/ChangeLog	Wed Jun 10 17:06:29 2009 +0100
@@ -1,3 +1,101 @@ 2009-05-27  Gary Benson  <gbenson at redhat
+2009-05-27  Gary Benson  <gbenson at redhat.com>
+
+	* ports/hotspot/src/share/vm/shark/sharkFunction.hpp
+	(SharkFunction::_monitor_count): Removed.
+	(SharkFunction::_max_monitors): New field.
+	(SharkFunction::monitor_count): Removed.
+	(SharkFunction::max_monitors): New method.
+	(SharkFunction::_exception_slot_offset): Removed.
+	(SharkFunction::exception_slot): Likewise.
+	(SharkFunction::_oop_tmp_slot_offset): New field.
+	(SharkFunction::oop_tmp_slot_offset): New method.
+	(SharkFunction::monitors_slots): Removed.
+	(SharkFunction::monitors_slots_offset): Likewise.
+	(SharkFunction::monitor_offset): New method.
+	(SharkFunction::monitor_object_offset): Likewise.
+	(SharkFunction::monitor_header_offset): Likewise.
+	(SharkFunction::monitor_addr): Likewise.
+	(SharkFunction::monitor_object_addr): Likewise.
+	(SharkFunction::monitor_header_addr): Likewise.
+	* ports/hotspot/src/share/vm/shark/sharkFunction.cpp
+	(SharkFunction::initialize): Renamed _monitor_count as _max_monitors.
+	(SharkFunction::CreateBuildFrame): Renamed _monitor_count as
+	_max_monitors, remove monitor initialization, remove exception
+	pointer and add temporary oop slot.
+	(SharkFunction::monitor): Removed.
+
+	* ports/hotspot/src/share/vm/shark/sharkState.hpp
+	(SharkState::_num_monitors): New field.
+	(SharkState::max_monitors): New method.
+	(SharkState::num_monitors): Likewise.
+	(SharkState::set_num_monitors): Likewise.
+	(SharkState::_oop_tmp): New field.
+	(SharkState::oop_tmp_addr): New method.
+	(SharkState::oop_tmp): Likewise.
+	(SharkState::set_oop_tmp): Likewise.
+	* ports/hotspot/src/share/vm/shark/sharkState.inline.hpp
+	(SharkState::max_monitors): New method.
+	* ports/hotspot/src/share/vm/shark/sharkState.cpp
+	(SharkState::SharkState): Initialize oop_tmp.
+	(SharkState::initialize): Initialize num_monitors.
+	(SharkPHIState::SharkPHIState): Likewise.
+	(SharkState::equal_to): Also check oop_tmp and num_monitors.
+	(SharkPHIState::add_incoming): Likewise.
+	(SharkState::merge): Also merge oop_tmp and check num_monitors.
+
+	* ports/hotspot/src/share/vm/shark/sharkStateScanner.hpp
+	(SharkStateScanner::process_monitor): New argument.
+	(SharkStateScanner::process_oop_tmp_slot): New method.
+	(SharkStateScanner::process_exception_slot): Removed.
+	* ports/hotspot/src/share/vm/shark/sharkStateScanner.cpp
+	(SharkStateScanner::scan): Replace monitor scanning, remove
+	exception slot, and add temporary oop slot.
+	
+ 	* ports/hotspot/src/share/vm/shark/sharkCacheDecache.hpp
+	(SharkDecacher::process_monitor): New argument.
+	(SharkDecacher::process_oop_tmp_slot): New method.
+	(SharkCacher::process_oop_tmp_slot): Likewise.
+	(SharkDecacher::process_exception_slot): Removed.
+	* ports/hotspot/src/share/vm/shark/sharkCacheDecache.cpp
+	(SharkDecacher::process_monitor): New argument.
+	(SharkDecacher::process_oop_tmp_slot): New method.
+	(SharkCacher::process_oop_tmp_slot): Likewise.
+	(SharkDecacher::process_exception_slot): Removed.
+
+	* ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp
+	(SharkTopLevelBlock::set_oop_tmp): New method.
+	(SharkTopLevelBlock::get_oop_tmp): Likewise.
+	(SharkTopLevelBlock::num_monitors): Likewise.
+	(SharkTopLevelBlock::set_num_monitors): Likewise.
+	(SharkTopLevelBlock::release_method_lock): Removed.
+	(SharkTopLevelBlock::release_locked_monitors): Likewise.
+	(SharkTopLevelBlock::acquire_lock): New method.
+	(SharkTopLevelBlock::release_lock): Likewise.
+	* ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp
+	(SharkTopLevelBlock::acquire_method_lock): Rewritten.
+	(SharkTopLevelBlock::release_method_lock): Removed.
+	(SharkTopLevelBlock::release_locked_monitors): Likewise.
+	(SharkTopLevelBlock::handle_return): New monitor release code.
+	(SharkTopLevelBlock::do_monitorenter): Rewritten.
+	(SharkTopLevelBlock::do_monitorexit): Likewise.
+	(SharkTopLevelBlock::acquire_lock): New method.
+	(SharkTopLevelBlock::release_lock): Likewise.
+
+	* ports/hotspot/src/cpu/zero/vm/sharkFrame_zero.hpp
+	(SharkFrame::Layout): Replaced exception slot with oop_tmp slot.
+ 	* ports/hotspot/src/cpu/zero/vm/stackPrinter_zero.hpp
+	(ZeroStackPrinter::print_word): Likewise.
+
+	* ports/hotspot/src/share/vm/shark/sharkMonitor.hpp: Removed.
+	* ports/hotspot/src/share/vm/shark/sharkMonitor.cpp: Likewise.
+
+	* ports/hotspot/src/share/vm/includeDB_shark: Updated.
+
+	* patches/hotspot/default/icedtea-shark.patch
+	(vframeArrayElement::fill_in): Remove workaround for
+	unused but recorded monitors.
+	(vframeArrayElement::unpack_on_stack): Likewise.
+
 2009-05-27  Gary Benson  <gbenson at redhat.com>
 
 	* ports/hotspot/src/share/vm/shark/sharkCacheDecache.hpp
diff -r b49274854fdc -r 348b533726b1 patches/hotspot/default/icedtea-shark.patch
--- a/patches/hotspot/default/icedtea-shark.patch	Wed May 27 13:49:38 2009 +0100
+++ b/patches/hotspot/default/icedtea-shark.patch	Wed Jun 10 17:06:29 2009 +0100
@@ -371,33 +371,6 @@ diff -Nru openjdk.orig/hotspot/src/share
  define_pd_global(bool, BackgroundCompilation,        false);
  define_pd_global(bool, UseTLAB,                      false);
  define_pd_global(bool, CICompileOSR,                 false);
-diff -Nru openjdk.orig/hotspot/src/share/vm/runtime/vframeArray.cpp openjdk/hotspot/src/share/vm/runtime/vframeArray.cpp
---- openjdk.orig/hotspot/src/share/vm/runtime/vframeArray.cpp	2009-05-14 18:57:58.000000000 +0100
-+++ openjdk/hotspot/src/share/vm/runtime/vframeArray.cpp	2009-05-19 16:07:37.000000000 +0100
-@@ -64,6 +64,11 @@
-       assert(monitor->owner() == NULL || (!monitor->owner()->is_unlocked() && !monitor->owner()->has_bias_pattern()), "object must be null or locked, and unbiased");
-       BasicObjectLock* dest = _monitors->at(index);
-       dest->set_obj(monitor->owner());
-+#ifdef SHARK
-+      // XXX This can be removed when Shark knows
-+      // which monitors are in use.
-+      if (monitor->owner())
-+#endif // SHARK
-       monitor->lock()->move_to(monitor->owner(), dest->lock());
-     }
-   }
-@@ -262,6 +267,11 @@
-     top = iframe()->previous_monitor_in_interpreter_frame(top);
-     BasicObjectLock* src = _monitors->at(index);
-     top->set_obj(src->obj());
-+#ifdef SHARK
-+    // XXX This can be removed when Shark knows
-+    // which monitors are in use.
-+    if (src->obj())
-+#endif // SHARK    
-     src->lock()->move_to(src->obj(), top->lock());
-   }
-   if (ProfileInterpreter) {
 diff -Nru openjdk.orig/hotspot/src/share/vm/runtime/vm_version.cpp openjdk/hotspot/src/share/vm/runtime/vm_version.cpp
 --- openjdk.orig/hotspot/src/share/vm/runtime/vm_version.cpp	2009-05-19 01:11:05.000000000 +0100
 +++ openjdk/hotspot/src/share/vm/runtime/vm_version.cpp	2009-05-19 16:07:37.000000000 +0100
diff -r b49274854fdc -r 348b533726b1 ports/hotspot/src/cpu/zero/vm/sharkFrame_zero.hpp
--- a/ports/hotspot/src/cpu/zero/vm/sharkFrame_zero.hpp	Wed May 27 13:49:38 2009 +0100
+++ b/ports/hotspot/src/cpu/zero/vm/sharkFrame_zero.hpp	Wed Jun 10 17:06:29 2009 +0100
@@ -31,7 +31,7 @@
 // | monitor m-1        |
 // |  ...               |
 // | monitor 0          |
-// | exception          |
+// | oop_tmp            |
 // | method             |
 // | unextended_sp      |
 // | pc                 |
@@ -55,7 +55,7 @@ class SharkFrame : public ZeroFrame {
     pc_off = jf_header_words,
     unextended_sp_off,
     method_off,
-    exception_off,
+    oop_tmp_off,
     header_words
   };
 
diff -r b49274854fdc -r 348b533726b1 ports/hotspot/src/cpu/zero/vm/stackPrinter_zero.hpp
--- a/ports/hotspot/src/cpu/zero/vm/stackPrinter_zero.hpp	Wed May 27 13:49:38 2009 +0100
+++ b/ports/hotspot/src/cpu/zero/vm/stackPrinter_zero.hpp	Wed Jun 10 17:06:29 2009 +0100
@@ -222,8 +222,8 @@ class ZeroStackPrinter {
           if (method->is_oop())
             value = method->name_and_sig_as_C_string(_buf, _buflen);
         }
-        else if (word == SharkFrame::exception_off) {
-          field = "exception";
+        else if (word == SharkFrame::oop_tmp_off) {
+          field = "oop_tmp";
         }
         else {
           SharkFrame *sf = (SharkFrame *) frame;
diff -r b49274854fdc -r 348b533726b1 ports/hotspot/src/share/vm/includeDB_shark
--- a/ports/hotspot/src/share/vm/includeDB_shark	Wed May 27 13:49:38 2009 +0100
+++ b/ports/hotspot/src/share/vm/includeDB_shark	Wed Jun 10 17:06:29 2009 +0100
@@ -193,7 +193,6 @@ sharkFunction.cpp                       
 sharkFunction.cpp                       sharkBuilder.hpp
 sharkFunction.cpp                       sharkEntry.hpp
 sharkFunction.cpp                       sharkFunction.hpp
-sharkFunction.cpp                       sharkMonitor.hpp
 sharkFunction.cpp                       sharkState.inline.hpp
 sharkFunction.cpp                       sharkTopLevelBlock.hpp
 
@@ -240,19 +239,6 @@ sharkMemoryManager.cpp                  
 sharkMemoryManager.cpp                  llvmHeaders.hpp
 sharkMemoryManager.cpp                  sharkEntry.hpp
 sharkMemoryManager.cpp                  sharkMemoryManager.hpp
-
-sharkMonitor.cpp                        llvmHeaders.hpp
-sharkMonitor.cpp                        llvmValue.hpp
-sharkMonitor.cpp                        sharkMonitor.hpp
-sharkMonitor.cpp                        sharkRuntime.hpp
-sharkMonitor.cpp                        sharkState.inline.hpp
-sharkMonitor.cpp                        sharkTopLevelBlock.hpp
-
-sharkMonitor.hpp                        allocation.hpp
-sharkMonitor.hpp                        llvmHeaders.hpp
-sharkMonitor.hpp                        llvmValue.hpp
-sharkMonitor.hpp                        sharkBuilder.hpp
-sharkMonitor.hpp                        sharkFunction.hpp
 
 sharkRuntime.cpp                        biasedLocking.hpp
 sharkRuntime.cpp                        deoptimization.hpp
@@ -326,7 +312,6 @@ sharkTopLevelBlock.hpp                  
 sharkTopLevelBlock.hpp                  sharkBlock.hpp
 sharkTopLevelBlock.hpp                  sharkBuilder.hpp
 sharkTopLevelBlock.hpp                  sharkFunction.hpp
-sharkTopLevelBlock.hpp                  sharkMonitor.hpp
 sharkTopLevelBlock.hpp                  sharkState.inline.hpp
 sharkTopLevelBlock.hpp                  sharkValue.hpp
 
diff -r b49274854fdc -r 348b533726b1 ports/hotspot/src/share/vm/shark/sharkCacheDecache.cpp
--- a/ports/hotspot/src/share/vm/shark/sharkCacheDecache.cpp	Wed May 27 13:49:38 2009 +0100
+++ b/ports/hotspot/src/share/vm/shark/sharkCacheDecache.cpp	Wed Jun 10 17:06:29 2009 +0100
@@ -82,11 +82,8 @@ void SharkDecacher::start_monitors(int n
   _monarray = new GrowableArray<MonitorValue*>(num_monitors);
 }
 
-void SharkDecacher::process_monitor(int index, int box_offset)
-{
-  int obj_offset =
-    box_offset + (BasicObjectLock::obj_offset_in_bytes() >> LogBytesPerWord);
-
+void SharkDecacher::process_monitor(int index, int box_offset, int obj_offset)
+{
   oopmap()->set_oop(slot2reg(obj_offset));
 
   monarray()->append(new MonitorValue(
@@ -94,13 +91,20 @@ void SharkDecacher::process_monitor(int 
     slot2loc(box_offset, Location::normal)));
 }
 
-void SharkDecacher::process_exception_slot(int offset)
-{
-  // Record the exception slot
-  oopmap()->set_oop(slot2reg(offset));
-}
-
-void SharkDecacher::process_method_slot(llvm::Value** value, int offset)
+void SharkDecacher::process_oop_tmp_slot(Value** value, int offset)
+{
+  // Decache the temporary oop slot
+  if (*value) {
+    write_value_to_frame(
+      SharkType::oop_type(),
+      *value,
+      offset);
+
+    oopmap()->set_oop(slot2reg(offset));
+  }
+}
+
+void SharkDecacher::process_method_slot(Value** value, int offset)
 {
   // Decache the method pointer
   write_value_to_frame(
@@ -182,14 +186,20 @@ void SharkCacher::process_stack_slot(int
   }
 }
 
-void SharkCacher::process_method_slot(llvm::Value** value, int offset)
+void SharkCacher::process_oop_tmp_slot(Value** value, int offset)
+{
+  // Cache the temporary oop
+  if (*value)
+    *value = read_value_from_frame(SharkType::oop_type(), offset);
+}
+
+void SharkCacher::process_method_slot(Value** value, int offset)
 {
   // Cache the method pointer
   *value = read_value_from_frame(SharkType::methodOop_type(), offset);
 }
 
-void SharkFunctionEntryCacher::process_method_slot(llvm::Value** value,
-                                                   int           offset)
+void SharkFunctionEntryCacher::process_method_slot(Value** value, int offset)
 {
   // "Cache" the method pointer
   *value = method();
@@ -212,9 +222,9 @@ void SharkCacher::process_local_slot(int
   }
 }
 
-void SharkDecacher::write_value_to_frame(const llvm::Type* type,
-                                         llvm::Value*      value,
-                                         int               offset)
+void SharkDecacher::write_value_to_frame(const Type* type,
+                                         Value*      value,
+                                         int         offset)
 {
   if (frame_cache()->value(offset) != value) {
     builder()->CreateStore(
@@ -223,7 +233,7 @@ void SharkDecacher::write_value_to_frame
   }
 }
 
-Value* SharkCacher::read_value_from_frame(const llvm::Type* type, int offset)
+Value* SharkCacher::read_value_from_frame(const Type* type, int offset)
 {
   Value *result = builder()->CreateLoad(
     function()->CreateAddressOfFrameEntry(offset, type));
diff -r b49274854fdc -r 348b533726b1 ports/hotspot/src/share/vm/shark/sharkCacheDecache.hpp
--- a/ports/hotspot/src/share/vm/shark/sharkCacheDecache.hpp	Wed May 27 13:49:38 2009 +0100
+++ b/ports/hotspot/src/share/vm/shark/sharkCacheDecache.hpp	Wed Jun 10 17:06:29 2009 +0100
@@ -122,9 +122,9 @@ class SharkDecacher : public SharkCacher
   void process_stack_slot(int index, SharkValue** value, int offset);
 
   void start_monitors(int num_monitors);
-  void process_monitor(int index, int offset);
-
-  void process_exception_slot(int offset);
+  void process_monitor(int index, int box_offset, int obj_offset);
+
+  void process_oop_tmp_slot(llvm::Value** value, int offset);
   void process_method_slot(llvm::Value** value, int offset);
   void process_pc_slot(int offset);
   
@@ -354,6 +354,7 @@ class SharkCacher : public SharkCacherDe
  protected:
   void process_stack_slot(int index, SharkValue** value, int offset);
 
+  void process_oop_tmp_slot(llvm::Value** value, int offset);
   virtual void process_method_slot(llvm::Value** value, int offset);
 
   void process_local_slot(int index, SharkValue** value, int offset);
diff -r b49274854fdc -r 348b533726b1 ports/hotspot/src/share/vm/shark/sharkFunction.cpp
--- a/ports/hotspot/src/share/vm/shark/sharkFunction.cpp	Wed May 27 13:49:38 2009 +0100
+++ b/ports/hotspot/src/share/vm/shark/sharkFunction.cpp	Wed Jun 10 17:06:29 2009 +0100
@@ -53,15 +53,16 @@ void SharkFunction::initialize()
   // Create the list of blocks
   set_block_insertion_point(NULL);
   _blocks = NEW_RESOURCE_ARRAY(SharkTopLevelBlock*, flow()->block_count());
-  for (int i = 0; i < block_count(); i++)
-    {
-      ciTypeFlow::Block *b = flow()->pre_order_at(i);
-      // Work around a bug in pre_order_at() that does not return the
-      // correct pre-ordering.  If pre_order_at() were correct this
-      // line could simply be:
-      // _blocks[i] = new SharkTopLevelBlock(this, b);
-      _blocks[b->pre_order()] = new SharkTopLevelBlock(this, b);
-    }
+  for (int i = 0; i < block_count(); i++) {
+    ciTypeFlow::Block *b = flow()->pre_order_at(i);
+
+    // Work around a bug in pre_order_at() that does not return
+    // the correct pre-ordering.  If pre_order_at() were correct
+    // this line could simply be:
+    // _blocks[i] = new SharkTopLevelBlock(this, b);
+    _blocks[b->pre_order()] = new SharkTopLevelBlock(this, b);
+  }
+
   // Walk the tree from the start block to determine which
   // blocks are entered and which blocks require phis
   SharkTopLevelBlock *start_block = block(0);
@@ -75,11 +76,11 @@ void SharkFunction::initialize()
   }
 
   // Initialize the monitors
-  _monitor_count = 0;  
+  _max_monitors = 0;  
   if (target()->is_synchronized() || target()->uses_monitors()) {
     for (int i = 0; i < block_count(); i++)
-      _monitor_count = MAX2(
-        _monitor_count, block(i)->ciblock()->monitor_count());
+      _max_monitors = MAX2(
+        _max_monitors, block(i)->ciblock()->monitor_count());
   }
   
   // Create the method preamble
@@ -216,7 +217,7 @@ Value* SharkFunction::CreateBuildFrame()
   int locals_words  = max_locals();
   int extra_locals  = locals_words - arg_size();
   int header_words  = SharkFrame::header_words;
-  int monitor_words = monitor_count()*frame::interpreter_frame_monitor_size();
+  int monitor_words = max_monitors()*frame::interpreter_frame_monitor_size();
   int stack_words   = max_stack();
   int frame_words   = header_words + monitor_words + stack_words;
 
@@ -242,19 +243,11 @@ Value* SharkFunction::CreateBuildFrame()
   offset += stack_words;
 
   // Monitors
-  if (monitor_count()) {
-    _monitors_slots_offset = offset; 
-
-    for (int i = 0; i < monitor_count(); i++) {
-      if (i != 0 || !target()->is_synchronized())
-        monitor(i)->mark_free();
-    }
-  }
+  _monitors_slots_offset = offset; 
   offset += monitor_words;
 
-  // Exception pointer
-  _exception_slot_offset = offset++;
-  builder()->CreateStore(LLVMValue::null(), exception_slot());
+  // Temporary oop slot
+  _oop_tmp_slot_offset = offset++;
 
   // Method pointer
   _method_slot_offset = offset++;
@@ -295,18 +288,6 @@ Value* SharkFunction::CreateAddressOfFra
       result, PointerType::getUnqual(type), name);
   }
   return result;
-}
-
-SharkMonitor* SharkFunction::monitor(Value *index) const
-{
-  Value *indexes[] = {
-    LLVMValue::jint_constant(0),
-    builder()->CreateSub(
-      LLVMValue::jint_constant(monitor_count() - 1), index),
-  };
-  return new SharkMonitor(
-    this,
-    builder()->CreateGEP(monitors_slots(), indexes, indexes + 2));
 }
 
 class DeferredZeroCheck : public ResourceObj {
diff -r b49274854fdc -r 348b533726b1 ports/hotspot/src/share/vm/shark/sharkFunction.hpp
--- a/ports/hotspot/src/share/vm/shark/sharkFunction.hpp	Wed May 27 13:49:38 2009 +0100
+++ b/ports/hotspot/src/share/vm/shark/sharkFunction.hpp	Wed Jun 10 17:06:29 2009 +0100
@@ -23,7 +23,6 @@
  *
  */
 
-class SharkMonitor;
 class SharkTopLevelBlock;
 
 class DeferredZeroCheck;
@@ -55,7 +54,7 @@ class SharkFunction : public StackObj {
   SharkTopLevelBlock**              _blocks;
   llvm::Value*                      _base_pc;
   llvm::Value*                      _thread;
-  int                               _monitor_count;
+  int                               _max_monitors;
   GrowableArray<DeferredZeroCheck*> _deferred_zero_checks;
 
  public:  
@@ -95,9 +94,9 @@ class SharkFunction : public StackObj {
   {
     return _thread;
   }
-  int monitor_count() const
-  {
-    return _monitor_count;
+  int max_monitors() const
+  {
+    return _max_monitors;
   }
   GrowableArray<DeferredZeroCheck*>* deferred_zero_checks()
   {
@@ -215,29 +214,6 @@ class SharkFunction : public StackObj {
   llvm::Value* CreateAddressOfFrameEntry(int               offset,
                                          const llvm::Type* type = NULL,
                                          const char*       name = "") const;
- public:
-  llvm::Value* exception_slot() const
-  {
-    return CreateAddressOfFrameEntry(
-      exception_slot_offset(),
-      SharkType::oop_type(),
-      "exception_slot");
-  }
-  llvm::Value* monitors_slots() const
-  {
-    return CreateAddressOfFrameEntry(
-      monitors_slots_offset(),
-      llvm::ArrayType::get(SharkType::monitor_type(), monitor_count()),
-      "monitors");
-  }
-
- public:
-  SharkMonitor* monitor(int index) const
-  {
-    return monitor(LLVMValue::jint_constant(index));
-  }
-  SharkMonitor* monitor(llvm::Value* index) const;
-
  private:
   llvm::Value* CreateBuildFrame();
 
@@ -256,7 +232,7 @@ class SharkFunction : public StackObj {
   int _extended_frame_size;
   int _stack_slots_offset;
   int _monitors_slots_offset;
-  int _exception_slot_offset;
+  int _oop_tmp_slot_offset;
   int _method_slot_offset;
   int _pc_slot_offset;
   int _locals_slots_offset;
@@ -274,13 +250,9 @@ class SharkFunction : public StackObj {
   {



More information about the distro-pkg-dev mailing list