diff src/share/vm/runtime/sharedRuntime.cpp @ 4137:04b9a2566eec

Merge with hsx23/hotspot.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sat, 17 Dec 2011 21:40:27 +0100
parents be4ca325525a 2ec638646e86
children 723df37192d6
line wrap: on
line diff
--- a/src/share/vm/runtime/sharedRuntime.cpp	Sat Dec 17 20:50:09 2011 +0100
+++ b/src/share/vm/runtime/sharedRuntime.cpp	Sat Dec 17 21:40:27 2011 +0100
@@ -148,11 +148,13 @@
 
 #include <math.h>
 
+#ifndef USDT2
 HS_DTRACE_PROBE_DECL4(hotspot, object__alloc, Thread*, char*, int, size_t);
 HS_DTRACE_PROBE_DECL7(hotspot, method__entry, int,
                       char*, int, char*, int, char*, int);
 HS_DTRACE_PROBE_DECL7(hotspot, method__return, int,
                       char*, int, char*, int, char*, int);
+#endif /* !USDT2 */
 
 // Implementation of SharedRuntime
 
@@ -659,12 +661,14 @@
   int scope_depth = 0;
   if (!force_unwind) {
     int bci = sd->bci();
+    bool recursive_exception = false;
     do {
       bool skip_scope_increment = false;
       // exception handler lookup
       KlassHandle ek (THREAD, exception->klass());
       handler_bci = sd->method()->fast_exception_handler_bci_for(ek, bci, THREAD);
       if (HAS_PENDING_EXCEPTION) {
+        recursive_exception = true;
         // We threw an exception while trying to find the exception handler.
         // Transfer the new exception to the exception handle which will
         // be set into thread local storage, and do another lookup for an
@@ -680,6 +684,9 @@
           skip_scope_increment = true;
         }
       }
+      else {
+        recursive_exception = false;
+      }
       if (!top_frame_only && handler_bci < 0 && !skip_scope_increment) {
         sd = sd->sender();
         if (sd != NULL) {
@@ -687,7 +694,7 @@
         }
         ++scope_depth;
       }
-    } while (!top_frame_only && handler_bci < 0 && sd != NULL);
+    } while (recursive_exception || (!top_frame_only && handler_bci < 0 && sd != NULL));
   }
 
   // found handling method => lookup exception handler
@@ -985,8 +992,14 @@
   Klass* klass = o->blueprint();
   int size = o->size();
   Symbol* name = klass->name();
+#ifndef USDT2
   HS_DTRACE_PROBE4(hotspot, object__alloc, get_java_tid(thread),
                    name->bytes(), name->utf8_length(), size * HeapWordSize);
+#else /* USDT2 */
+  HOTSPOT_OBJECT_ALLOC(
+                   get_java_tid(thread),
+                   (char *) name->bytes(), name->utf8_length(), size * HeapWordSize);
+#endif /* USDT2 */
   return 0;
 }
 
@@ -996,10 +1009,18 @@
   Symbol* kname = method->klass_name();
   Symbol* name = method->name();
   Symbol* sig = method->signature();
+#ifndef USDT2
   HS_DTRACE_PROBE7(hotspot, method__entry, get_java_tid(thread),
       kname->bytes(), kname->utf8_length(),
       name->bytes(), name->utf8_length(),
       sig->bytes(), sig->utf8_length());
+#else /* USDT2 */
+  HOTSPOT_METHOD_ENTRY(
+      get_java_tid(thread),
+      (char *) kname->bytes(), kname->utf8_length(),
+      (char *) name->bytes(), name->utf8_length(),
+      (char *) sig->bytes(), sig->utf8_length());
+#endif /* USDT2 */
   return 0;
 JRT_END
 
@@ -1009,10 +1030,18 @@
   Symbol* kname = method->klass_name();
   Symbol* name = method->name();
   Symbol* sig = method->signature();
+#ifndef USDT2
   HS_DTRACE_PROBE7(hotspot, method__return, get_java_tid(thread),
       kname->bytes(), kname->utf8_length(),
       name->bytes(), name->utf8_length(),
       sig->bytes(), sig->utf8_length());
+#else /* USDT2 */
+  HOTSPOT_METHOD_RETURN(
+      get_java_tid(thread),
+      (char *) kname->bytes(), kname->utf8_length(),
+      (char *) name->bytes(), name->utf8_length(),
+      (char *) sig->bytes(), sig->utf8_length());
+#endif /* USDT2 */
   return 0;
 JRT_END
 
@@ -1674,9 +1703,12 @@
   nmethod* nm = cb->as_nmethod_or_null();
   assert(nm, "must be");
 
-  // Don't fixup MethodHandle call sites as c2i/i2c adapters are used
-  // to implement MethodHandle actions.
-  if (nm->is_method_handle_return(caller_pc)) {
+  // Get the return PC for the passed caller PC.
+  address return_pc = caller_pc + frame::pc_return_offset;
+
+  // Don't fixup method handle call sites as the executed method
+  // handle adapters are doing the required MethodHandle chain work.
+  if (nm->is_method_handle_return(return_pc)) {
     return;
   }
 
@@ -1695,8 +1727,8 @@
 
     // Expect to find a native call there (unless it was no-inline cache vtable dispatch)
     MutexLockerEx ml_patch(Patching_lock, Mutex::_no_safepoint_check_flag);
-    if (NativeCall::is_call_before(caller_pc + frame::pc_return_offset)) {
-      NativeCall *call = nativeCall_before(caller_pc + frame::pc_return_offset);
+    if (NativeCall::is_call_before(return_pc)) {
+      NativeCall *call = nativeCall_before(return_pc);
       //
       // bug 6281185. We might get here after resolving a call site to a vanilla
       // virtual call. Because the resolvee uses the verified entry it may then
@@ -1746,7 +1778,6 @@
       }
     }
   }
-
 IRT_END
 
 
@@ -2161,9 +2192,9 @@
  public:
   AdapterFingerPrint(int total_args_passed, BasicType* sig_bt) {
     // The fingerprint is based on the BasicType signature encoded
-    // into an array of ints with four entries per int.
+    // into an array of ints with eight entries per int.
     int* ptr;
-    int len = (total_args_passed + 3) >> 2;
+    int len = (total_args_passed + 7) >> 3;
     if (len <= (int)(sizeof(_value._compact) / sizeof(int))) {
       _value._compact[0] = _value._compact[1] = _value._compact[2] = 0;
       // Storing the signature encoded as signed chars hits about 98%
@@ -2176,11 +2207,11 @@
       ptr = _value._fingerprint;
     }
 
-    // Now pack the BasicTypes with 4 per int
+    // Now pack the BasicTypes with 8 per int
     int sig_index = 0;
     for (int index = 0; index < len; index++) {
       int value = 0;
-      for (int byte = 0; byte < 4; byte++) {
+      for (int byte = 0; byte < 8; byte++) {
         if (sig_index < total_args_passed) {
           value = (value << 4) | adapter_encoding(sig_bt[sig_index++]);
         }
@@ -2221,8 +2252,9 @@
 
   const char* as_string() {
     stringStream st;
+    st.print("0x");
     for (int i = 0; i < length(); i++) {
-      st.print(PTR_FORMAT, value(i));
+      st.print("%08x", value(i));
     }
     return st.as_string();
   }