changeset 8616:d343737786fe

changed profiling of exceptions so that the ExceptionSeen flag also works without GRAALVM
author Christian Haeubl <haeubl@ssw.jku.at>
date Thu, 28 Mar 2013 17:11:06 +0100
parents 91c79e13b9cf
children 6d884611d4c1
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodData.java src/share/vm/interpreter/interpreterRuntime.cpp src/share/vm/oops/methodData.cpp src/share/vm/oops/methodData.hpp src/share/vm/runtime/deoptimization.hpp
diffstat 5 files changed, 17 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodData.java	Thu Mar 28 13:38:47 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodData.java	Thu Mar 28 17:11:06 2013 +0100
@@ -165,7 +165,7 @@
         /**
          * Corresponds to DS_RECOMPILE_BIT defined in deoptimization.cpp.
          */
-        private static final int EXCEPTIONS_MASK = 0x80;
+        private static final int EXCEPTIONS_MASK = 0x2;
 
         private final int tag;
         private final int staticSize;
--- a/src/share/vm/interpreter/interpreterRuntime.cpp	Thu Mar 28 13:38:47 2013 +0100
+++ b/src/share/vm/interpreter/interpreterRuntime.cpp	Thu Mar 28 17:11:06 2013 +0100
@@ -434,18 +434,13 @@
     }
   } while (should_repeat == true);
 
-#ifdef GRAALVM
+#ifdef GRAAL
   if (h_method->method_data() != NULL) {
     ResourceMark rm(thread);
     ProfileData* pdata = h_method->method_data()->allocate_bci_to_data(current_bci);
-    if (pdata != NULL) {
-      // We re-purpose the DS_RECOMPILE_BIT to record that an exception was thrown at
-      // the current bci.
-      int tstate0 = pdata->trap_state();
-      int tstate1 = Deoptimization::trap_state_set_recompiled(tstate0, true);
-      if (tstate1 != tstate0) {
-        pdata->set_trap_state(tstate1);
-      }
+    if (pdata != NULL && pdata->is_BitData()) {
+      BitData* bit_data = (BitData*) pdata;
+      bit_data->set_exception_seen();
     }
   }
 #endif
--- a/src/share/vm/oops/methodData.cpp	Thu Mar 28 13:38:47 2013 +0100
+++ b/src/share/vm/oops/methodData.cpp	Thu Mar 28 17:11:06 2013 +0100
@@ -456,7 +456,7 @@
   return DataLayout::compute_size_in_bytes(cell_count);
 }
 
-#ifdef GRAALVM
+#ifdef GRAAL
 int MethodData::compute_extra_data_count(int data_size, int empty_bc_count) {
   if (!ProfileTraps) return 0;
 
@@ -735,7 +735,7 @@
 }
 
 bool MethodData::is_empty_data(int size_in_bytes, Bytecodes::Code code) {
-#ifdef GRAALVM
+#ifdef GRAAL
   return size_in_bytes == 0 && Bytecodes::can_trap(code);
 #else
   return size_in_bytes == 0;
--- a/src/share/vm/oops/methodData.hpp	Thu Mar 28 13:38:47 2013 +0100
+++ b/src/share/vm/oops/methodData.hpp	Thu Mar 28 17:11:06 2013 +0100
@@ -461,7 +461,11 @@
   enum {
     // null_seen:
     //  saw a null operand (cast/aastore/instanceof)
-    null_seen_flag              = DataLayout::first_flag + 0
+      null_seen_flag              = DataLayout::first_flag + 0
+#ifdef GRAAL
+    // bytecode threw any exception
+    , exception_seen_flag         = null_seen_flag + 1
+#endif
   };
   enum { bit_cell_count = 0 };  // no additional data fields needed.
 public:
@@ -484,7 +488,11 @@
   // Consulting it allows the compiler to avoid setting up null_check traps.
   bool null_seen()     { return flag_at(null_seen_flag); }
   void set_null_seen()    { set_flag_at(null_seen_flag); }
-
+#ifdef GRAAL
+  // true if an exception was thrown at the specific BCI
+  bool exception_seen() { return flag_at(exception_seen_flag); }
+  void set_exception_seen() { set_flag_at(exception_seen_flag); }
+#endif
 
   // Code generation support
   static int null_seen_byte_constant() {
--- a/src/share/vm/runtime/deoptimization.hpp	Thu Mar 28 13:38:47 2013 +0100
+++ b/src/share/vm/runtime/deoptimization.hpp	Thu Mar 28 17:11:06 2013 +0100
@@ -275,13 +275,8 @@
       return (DeoptReason)
         ((~(trap_request) >> _reason_shift) & right_n_bits(_reason_bits));
     } else {
-#ifdef GRAALVM
-      ShouldNotReachHere();
-      return Reason_none;
-#else
       // standard reason for unloaded CP entry
       return Reason_unloaded;
-#endif // GRAAL
     }
   }
   static DeoptAction trap_request_action(int trap_request) {
@@ -289,25 +284,15 @@
       return (DeoptAction)
         ((~(trap_request) >> _action_shift) & right_n_bits(_action_bits));
     } else {
-#ifdef GRAALVM
-      ShouldNotReachHere();
-      return Action_make_not_compilable;
-#else
       // standard action for unloaded CP entry
       return _unloaded_action;
-#endif // GRAAL
     }
   }
   static int trap_request_index(int trap_request) {
     if (trap_request < 0) {
       return -1;
     } else {
-#ifdef GRAALVM
-      ShouldNotReachHere();
-      return -1;
-#else
       return trap_request;
-#endif // GRAAL
     }
   }
   static int make_trap_request(DeoptReason reason, DeoptAction action,