Mercurial > hg > graal-compiler
annotate src/share/vm/utilities/preserveException.hpp @ 1711:a6bff45449bc
6973570: OrderAccess::storestore() scales poorly on multi-socket x64 and sparc: cache-line ping-ponging
Summary: volatile store to static variable removed in favour of a volatile store to stack to avoid excessive cache coherency traffic; verified that the volatile store is not elided by any of our current compilers.
Reviewed-by: dholmes, dice, jcoomes, kvn
author | ysr |
---|---|
date | Tue, 10 Aug 2010 14:53:35 -0700 |
parents | c18cbe5936b8 |
children | f95d63e2154a |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
2 * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
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 | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
25 // This file provides more support for exception handling; see also exceptions.hpp | |
26 class PreserveExceptionMark { | |
27 private: | |
28 Thread* _thread; | |
29 Handle _preserved_exception_oop; | |
30 int _preserved_exception_line; | |
31 const char* _preserved_exception_file; | |
32 | |
33 public: | |
34 PreserveExceptionMark(Thread*& thread); | |
35 ~PreserveExceptionMark(); | |
36 }; | |
37 | |
38 | |
39 // This is a clone of PreserveExceptionMark which asserts instead | |
40 // of failing when what it wraps generates a pending exception. | |
41 // It also addresses bug 6431341. | |
42 class CautiouslyPreserveExceptionMark { | |
43 private: | |
44 Thread* _thread; | |
45 Handle _preserved_exception_oop; | |
46 int _preserved_exception_line; | |
47 const char* _preserved_exception_file; | |
48 | |
49 public: | |
50 CautiouslyPreserveExceptionMark(Thread* thread); | |
51 ~CautiouslyPreserveExceptionMark(); | |
52 }; | |
53 | |
54 | |
55 // Like PreserveExceptionMark but allows new exceptions to be generated in | |
56 // the body of the mark. If a new exception is generated then the original one | |
57 // is discarded. | |
58 class WeakPreserveExceptionMark { | |
59 private: | |
60 Thread* _thread; | |
61 Handle _preserved_exception_oop; | |
62 int _preserved_exception_line; | |
63 const char* _preserved_exception_file; | |
64 | |
65 void preserve(); | |
66 void restore(); | |
67 | |
68 public: | |
69 WeakPreserveExceptionMark(Thread* pThread) : _thread(pThread), _preserved_exception_oop() { | |
70 if (pThread->has_pending_exception()) { | |
71 preserve(); | |
72 } | |
73 } | |
74 ~WeakPreserveExceptionMark() { | |
75 if (_preserved_exception_oop.not_null()) { | |
76 restore(); | |
77 } | |
78 } | |
79 }; | |
80 | |
81 | |
82 | |
83 // use global exception mark when allowing pending exception to be set and | |
84 // saving and restoring them | |
85 #define PRESERVE_EXCEPTION_MARK Thread* THREAD; PreserveExceptionMark __em(THREAD); |