comparison src/share/vm/runtime/synchronizer.cpp @ 14909:4ca6dc0799b6

Backout jdk9 merge
author Gilles Duboscq <duboscq@ssw.jku.at>
date Tue, 01 Apr 2014 13:57:07 +0200
parents d8041d695d19
children 52b4284cb496
comparison
equal deleted inserted replaced
14908:8db6e76cb658 14909:4ca6dc0799b6
1 /* 1 /*
2 * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
51 #endif 51 #endif
52 #ifdef TARGET_OS_FAMILY_bsd 52 #ifdef TARGET_OS_FAMILY_bsd
53 # include "os_bsd.inline.hpp" 53 # include "os_bsd.inline.hpp"
54 #endif 54 #endif
55 55
56 #if defined(__GNUC__) && !defined(PPC64) 56 #if defined(__GNUC__)
57 // Need to inhibit inlining for older versions of GCC to avoid build-time failures 57 // Need to inhibit inlining for older versions of GCC to avoid build-time failures
58 #define ATTR __attribute__((noinline)) 58 #define ATTR __attribute__((noinline))
59 #else 59 #else
60 #define ATTR 60 #define ATTR
61 #endif 61 #endif
82 if (klassname != NULL) { \ 82 if (klassname != NULL) { \
83 bytes = (char*)klassname->bytes(); \ 83 bytes = (char*)klassname->bytes(); \
84 len = klassname->utf8_length(); \ 84 len = klassname->utf8_length(); \
85 } 85 }
86 86
87 #ifndef USDT2
88 HS_DTRACE_PROBE_DECL5(hotspot, monitor__wait,
89 jlong, uintptr_t, char*, int, long);
90 HS_DTRACE_PROBE_DECL4(hotspot, monitor__waited,
91 jlong, uintptr_t, char*, int);
92
93 #define DTRACE_MONITOR_WAIT_PROBE(monitor, obj, thread, millis) \
94 { \
95 if (DTraceMonitorProbes) { \
96 DTRACE_MONITOR_PROBE_COMMON(obj, thread); \
97 HS_DTRACE_PROBE5(hotspot, monitor__wait, jtid, \
98 (monitor), bytes, len, (millis)); \
99 } \
100 }
101
102 #define DTRACE_MONITOR_PROBE(probe, monitor, obj, thread) \
103 { \
104 if (DTraceMonitorProbes) { \
105 DTRACE_MONITOR_PROBE_COMMON(obj, thread); \
106 HS_DTRACE_PROBE4(hotspot, monitor__##probe, jtid, \
107 (uintptr_t)(monitor), bytes, len); \
108 } \
109 }
110
111 #else /* USDT2 */
112
87 #define DTRACE_MONITOR_WAIT_PROBE(monitor, obj, thread, millis) \ 113 #define DTRACE_MONITOR_WAIT_PROBE(monitor, obj, thread, millis) \
88 { \ 114 { \
89 if (DTraceMonitorProbes) { \ 115 if (DTraceMonitorProbes) { \
90 DTRACE_MONITOR_PROBE_COMMON(obj, thread); \ 116 DTRACE_MONITOR_PROBE_COMMON(obj, thread); \
91 HOTSPOT_MONITOR_WAIT(jtid, \ 117 HOTSPOT_MONITOR_WAIT(jtid, \
92 (uintptr_t)(monitor), bytes, len, (millis)); \ 118 (uintptr_t)(monitor), bytes, len, (millis)); \
93 } \ 119 } \
94 } 120 }
95 121
96 #define HOTSPOT_MONITOR_PROBE_waited HOTSPOT_MONITOR_WAITED 122 #define HOTSPOT_MONITOR_PROBE_waited HOTSPOT_MONITOR_PROBE_WAITED
97 123
98 #define DTRACE_MONITOR_PROBE(probe, monitor, obj, thread) \ 124 #define DTRACE_MONITOR_PROBE(probe, monitor, obj, thread) \
99 { \ 125 { \
100 if (DTraceMonitorProbes) { \ 126 if (DTraceMonitorProbes) { \
101 DTRACE_MONITOR_PROBE_COMMON(obj, thread); \ 127 DTRACE_MONITOR_PROBE_COMMON(obj, thread); \
102 HOTSPOT_MONITOR_PROBE_##probe(jtid, /* probe = waited */ \ 128 HOTSPOT_MONITOR_PROBE_##probe(jtid, /* probe = waited */ \
103 (uintptr_t)(monitor), bytes, len); \ 129 (uintptr_t)(monitor), bytes, len); \
104 } \ 130 } \
105 } 131 }
106 132
133 #endif /* USDT2 */
107 #else // ndef DTRACE_ENABLED 134 #else // ndef DTRACE_ENABLED
108 135
109 #define DTRACE_MONITOR_WAIT_PROBE(obj, thread, millis, mon) {;} 136 #define DTRACE_MONITOR_WAIT_PROBE(obj, thread, millis, mon) {;}
110 #define DTRACE_MONITOR_PROBE(probe, obj, thread, mon) {;} 137 #define DTRACE_MONITOR_PROBE(probe, obj, thread, mon) {;}
111 138
344 371
345 372
346 // ----------------------------------------------------------------------------- 373 // -----------------------------------------------------------------------------
347 // Wait/Notify/NotifyAll 374 // Wait/Notify/NotifyAll
348 // NOTE: must use heavy weight monitor to handle wait() 375 // NOTE: must use heavy weight monitor to handle wait()
349 int ObjectSynchronizer::wait(Handle obj, jlong millis, TRAPS) { 376 void ObjectSynchronizer::wait(Handle obj, jlong millis, TRAPS) {
350 if (UseBiasedLocking) { 377 if (UseBiasedLocking) {
351 BiasedLocking::revoke_and_rebias(obj, false, THREAD); 378 BiasedLocking::revoke_and_rebias(obj, false, THREAD);
352 assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now"); 379 assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now");
353 } 380 }
354 if (millis < 0) { 381 if (millis < 0) {
355 TEVENT (wait - throw IAX) ; 382 TEVENT (wait - throw IAX) ;
356 THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), "timeout value is negative"); 383 THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "timeout value is negative");
357 } 384 }
358 ObjectMonitor* monitor = ObjectSynchronizer::inflate(THREAD, obj()); 385 ObjectMonitor* monitor = ObjectSynchronizer::inflate(THREAD, obj());
359 DTRACE_MONITOR_WAIT_PROBE(monitor, obj(), THREAD, millis); 386 DTRACE_MONITOR_WAIT_PROBE(monitor, obj(), THREAD, millis);
360 monitor->wait(millis, true, THREAD); 387 monitor->wait(millis, true, THREAD);
361 388
362 // This dummy call is in place to get around dtrace bug 6254741. Once 389 /* This dummy call is in place to get around dtrace bug 6254741. Once
363 // that's fixed we can uncomment the following line, remove the call 390 that's fixed we can uncomment the following line and remove the call */
364 // and change this function back into a "void" func.
365 // DTRACE_MONITOR_PROBE(waited, monitor, obj(), THREAD); 391 // DTRACE_MONITOR_PROBE(waited, monitor, obj(), THREAD);
366 return dtrace_waited_probe(monitor, obj, THREAD); 392 dtrace_waited_probe(monitor, obj, THREAD);
367 } 393 }
368 394
369 void ObjectSynchronizer::waitUninterruptibly (Handle obj, jlong millis, TRAPS) { 395 void ObjectSynchronizer::waitUninterruptibly (Handle obj, jlong millis, TRAPS) {
370 if (UseBiasedLocking) { 396 if (UseBiasedLocking) {
371 BiasedLocking::revoke_and_rebias(obj, false, THREAD); 397 BiasedLocking::revoke_and_rebias(obj, false, THREAD);
709 assert(mark->is_neutral(), "sanity check"); 735 assert(mark->is_neutral(), "sanity check");
710 return false; 736 return false;
711 } 737 }
712 738
713 // Be aware of this method could revoke bias of the lock object. 739 // Be aware of this method could revoke bias of the lock object.
714 // This method queries the ownership of the lock handle specified by 'h_obj'. 740 // This method querys the ownership of the lock handle specified by 'h_obj'.
715 // If the current thread owns the lock, it returns owner_self. If no 741 // If the current thread owns the lock, it returns owner_self. If no
716 // thread owns the lock, it returns owner_none. Otherwise, it will return 742 // thread owns the lock, it returns owner_none. Otherwise, it will return
717 // owner_other. 743 // ower_other.
718 ObjectSynchronizer::LockOwnership ObjectSynchronizer::query_lock_ownership 744 ObjectSynchronizer::LockOwnership ObjectSynchronizer::query_lock_ownership
719 (JavaThread *self, Handle h_obj) { 745 (JavaThread *self, Handle h_obj) {
720 // The caller must beware this method can revoke bias, and 746 // The caller must beware this method can revoke bias, and
721 // revocation can result in a safepoint. 747 // revocation can result in a safepoint.
722 assert (!SafepointSynchronize::is_at_safepoint(), "invariant") ; 748 assert (!SafepointSynchronize::is_at_safepoint(), "invariant") ;