changeset in /hg/icedtea6: 2009-06-02 Gary Benson <gbenson at red...

Gary Benson gbenson at redhat.com
Tue Jun 2 07:12:59 PDT 2009


changeset b7825ac40fd9 in /hg/icedtea6
details: http://icedtea.classpath.org/hg/icedtea6?cmd=changeset;node=b7825ac40fd9
description:
	2009-06-02  Gary Benson  <gbenson at redhat.com>

		* ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp
		(SharkTopLevelBlock::ExceptionAction): Replaced with...
		(SharkTopLevelBlock::ExceptionActionMask): New enum.
		(SharkTopLevelBlock::check_pending_exception): Changed type
		of action argument from ExceptionAction to int.
		(SharkTopLevelBlock::handle_exception): Likewise.
		(SharkTopLevelBlock::call_vm): Likewise.
		(SharkTopLevelBlock::acquire_lock): Likewise.
		(SharkTopLevelBlock::release_lock): Likewise.
		* ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp
		(SharkTopLevelBlock::check_pending_exception): Changed type
		of action argument from ExceptionAction to int, and added
		monitor-fudging support.
		(SharkTopLevelBlock::handle_exception): Changed type of
		action argument from ExceptionAction to int.
		(SharkTopLevelBlock::acquire_lock): Changed type of action
		argument from ExceptionAction to int, and added monitor-
		fudging to the VM call.
		(SharkTopLevelBlock::release_lock): Likewise.

diffstat:

3 files changed, 71 insertions(+), 32 deletions(-)
ChangeLog                                               |   22 +++++++
ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp |   35 +++++++----
ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp |   46 ++++++++-------

diffs (213 lines):

diff -r 6b95c888541f -r b7825ac40fd9 ChangeLog
--- a/ChangeLog	Fri May 29 12:13:53 2009 -0400
+++ b/ChangeLog	Tue Jun 02 15:14:15 2009 +0100
@@ -1,3 +1,25 @@ 2009-05-29  Omair Majid  <omajid at redhat.
+2009-06-02  Gary Benson  <gbenson at redhat.com>
+
+	* ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp
+	(SharkTopLevelBlock::ExceptionAction): Replaced with...
+	(SharkTopLevelBlock::ExceptionActionMask): New enum.
+	(SharkTopLevelBlock::check_pending_exception): Changed type
+	of action argument from ExceptionAction to int.
+	(SharkTopLevelBlock::handle_exception): Likewise.
+	(SharkTopLevelBlock::call_vm): Likewise.
+	(SharkTopLevelBlock::acquire_lock): Likewise.
+	(SharkTopLevelBlock::release_lock): Likewise.
+	* ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp
+	(SharkTopLevelBlock::check_pending_exception): Changed type
+	of action argument from ExceptionAction to int, and added
+	monitor-fudging support.
+	(SharkTopLevelBlock::handle_exception): Changed type of
+	action argument from ExceptionAction to int.
+	(SharkTopLevelBlock::acquire_lock): Changed type of action
+	argument from ExceptionAction to int, and added monitor-
+	fudging to the VM call.
+	(SharkTopLevelBlock::release_lock): Likewise.
+
 2009-05-29  Omair Majid  <omajid at redhat.com>
 
 	* rt/net/sourceforge/jnlp/JREDesc.java:
diff -r 6b95c888541f -r b7825ac40fd9 ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp
--- a/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp	Fri May 29 12:13:53 2009 -0400
+++ b/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp	Tue Jun 02 15:14:15 2009 +0100
@@ -331,9 +331,9 @@ void SharkTopLevelBlock::check_bounds(Sh
   builder()->SetInsertPoint(in_bounds);
 }
 
-void SharkTopLevelBlock::check_pending_exception(ExceptionAction action)
-{
-  assert(action != EX_CHECK_NONE, "shouldn't be");
+void SharkTopLevelBlock::check_pending_exception(int action)
+{
+  assert(action & EAM_CHECK, "should be");
 
   BasicBlock *exception    = function()->CreateBlock("exception");
   BasicBlock *no_exception = function()->CreateBlock("no_exception");
@@ -349,16 +349,23 @@ void SharkTopLevelBlock::check_pending_e
   builder()->SetInsertPoint(exception);
   builder()->CreateStore(LLVMValue::null(), pending_exception_addr);
   SharkState *saved_state = current_state()->copy();
-  handle_exception(pending_exception, action);
+  if (action & EAM_MONITOR_FUDGE) {
+    // The top monitor is marked live, but the exception was thrown
+    // while setting it up or tearing it down.  We need to mark it
+    // dead before we enter any exception handlers as they will not
+    // expect it to be there.
+    set_num_monitors(num_monitors() - 1);
+    action ^= EAM_MONITOR_FUDGE;
+  }
+  handle_exception(pending_exception, action); 
   set_current_state(saved_state);
 
   builder()->SetInsertPoint(no_exception);
 }
 
-void SharkTopLevelBlock::handle_exception(Value*          exception,
-                                          ExceptionAction action)
-{
-  if (action == EX_CHECK_FULL && num_exceptions() != 0) {
+void SharkTopLevelBlock::handle_exception(Value* exception, int action)
+{
+  if (action & EAM_HANDLE && num_exceptions() != 0) {
     // Clear the stack and push the exception onto it.
     // We do this now to protect it across the VM call
     // we may be about to make.
@@ -1631,7 +1638,7 @@ void SharkTopLevelBlock::do_monitorexit(
   release_lock(EX_CHECK_FULL);
 }
 
-void SharkTopLevelBlock::acquire_lock(Value *lockee, ExceptionAction ea)
+void SharkTopLevelBlock::acquire_lock(Value *lockee, int exception_action)
 {
   BasicBlock *try_recursive = function()->CreateBlock("try_recursive");
   BasicBlock *got_recursive = function()->CreateBlock("got_recursive");
@@ -1705,7 +1712,9 @@ void SharkTopLevelBlock::acquire_lock(Va
 
   // It's not a recursive case so we need to drop into the runtime
   builder()->SetInsertPoint(not_recursive);
-  call_vm(SharkRuntime::monitorenter(), monitor_addr, ea);
+  call_vm(
+    SharkRuntime::monitorenter(), monitor_addr,
+    exception_action | EAM_MONITOR_FUDGE);
   BasicBlock *acquired_slow = builder()->GetInsertBlock();
   builder()->CreateBr(lock_acquired);  
 
@@ -1714,7 +1723,7 @@ void SharkTopLevelBlock::acquire_lock(Va
   current_state()->merge(fast_state, acquired_fast, acquired_slow);
 }
 
-void SharkTopLevelBlock::release_lock(ExceptionAction ea)
+void SharkTopLevelBlock::release_lock(int exception_action)
 {
   BasicBlock *not_recursive = function()->CreateBlock("not_recursive");
   BasicBlock *released_fast = function()->CreateBlock("released_fast");
@@ -1757,7 +1766,9 @@ void SharkTopLevelBlock::release_lock(Ex
 
   // Need to drop into the runtime to release this one
   builder()->SetInsertPoint(slow_path);
-  call_vm(SharkRuntime::monitorexit(), monitor_addr, ea);
+  call_vm(
+    SharkRuntime::monitorexit(), monitor_addr,
+    exception_action | EAM_MONITOR_FUDGE);
   BasicBlock *released_slow = builder()->GetInsertBlock();
   builder()->CreateBr(lock_released);  
 
diff -r 6b95c888541f -r b7825ac40fd9 ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp
--- a/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp	Fri May 29 12:13:53 2009 -0400
+++ b/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp	Tue Jun 02 15:14:15 2009 +0100
@@ -237,28 +237,34 @@ class SharkTopLevelBlock : public SharkB
                               SharkState*       saved_state,
                               llvm::BasicBlock* continue_block);
   // Exceptions
-  enum ExceptionAction {
-    EX_CHECK_NONE,     // don't check for pending exceptions
-    EX_CHECK_NO_CATCH, // if there is a pending exception then throw it
-    EX_CHECK_FULL      // if there is a pending exception then catch it
-  };                   //   if it has a handler or throw it otherwise
-  void check_pending_exception(ExceptionAction action);
-  void handle_exception(llvm::Value* exception, ExceptionAction action);
+  enum ExceptionActionMask {
+    // The actual bitmasks that things test against
+    EAM_CHECK         = 1, // whether to check for pending exceptions
+    EAM_HANDLE        = 2, // whether to attempt to handle pending exceptions
+    EAM_MONITOR_FUDGE = 4, // whether the monitor count needs adjusting
+
+    // More convenient values for passing
+    EX_CHECK_NONE     = 0,
+    EX_CHECK_NO_CATCH = EAM_CHECK,
+    EX_CHECK_FULL     = EAM_CHECK | EAM_HANDLE
+  };
+  void check_pending_exception(int action);
+  void handle_exception(llvm::Value* exception, int action);
 
   // VM calls
  private:
   llvm::CallInst* call_vm(llvm::Constant* callee,
                           llvm::Value**   args_start,
                           llvm::Value**   args_end,
-                          ExceptionAction ea)
+                          int             exception_action)
   {
     current_state()->decache_for_VM_call();
     function()->set_last_Java_frame();
     llvm::CallInst *res = builder()->CreateCall(callee, args_start, args_end);
     function()->reset_last_Java_frame();
     current_state()->cache_after_VM_call();
-    if (ea != EX_CHECK_NONE) {
-      check_pending_exception(ea);
+    if (exception_action) {
+      check_pending_exception(exception_action);
       current_state()->set_has_safepointed(true);
     }
     return res;
@@ -266,40 +272,40 @@ class SharkTopLevelBlock : public SharkB
 
  public:
   llvm::CallInst* call_vm(llvm::Constant* callee,
-                          ExceptionAction ea)
+                          int             exception_action)
   {
     llvm::Value *args[] = {thread()};
-    return call_vm(callee, args, args + 1, ea);
+    return call_vm(callee, args, args + 1, exception_action);
   }
   llvm::CallInst* call_vm(llvm::Constant* callee,
                           llvm::Value*    arg1,
-                          ExceptionAction ea)
+                          int             exception_action)
   {
     llvm::Value *args[] = {thread(), arg1};
-    return call_vm(callee, args, args + 2, ea);
+    return call_vm(callee, args, args + 2, exception_action);
   }
   llvm::CallInst* call_vm(llvm::Constant* callee,
                           llvm::Value*    arg1,
                           llvm::Value*    arg2,
-                          ExceptionAction ea)
+                          int             exception_action)
   {
     llvm::Value *args[] = {thread(), arg1, arg2};
-    return call_vm(callee, args, args + 3, ea);
+    return call_vm(callee, args, args + 3, exception_action);
   }
   llvm::CallInst* call_vm(llvm::Constant* callee,
                           llvm::Value*    arg1,
                           llvm::Value*    arg2,
                           llvm::Value*    arg3,
-                          ExceptionAction ea)
+                          int             exception_action)
   {
     llvm::Value *args[] = {thread(), arg1, arg2, arg3};
-    return call_vm(callee, args, args + 4, ea);
+    return call_vm(callee, args, args + 4, exception_action);
   }
 
   // Synchronization
  private:
-  void acquire_lock(llvm::Value* lockee, ExceptionAction ea);
-  void release_lock(ExceptionAction ea);
+  void acquire_lock(llvm::Value* lockee, int exception_action);
+  void release_lock(int exception_action);
 
  public:
   void acquire_method_lock();



More information about the distro-pkg-dev mailing list