author | twisti |
Tue, 04 Sep 2012 18:01:20 -0700 | |
changeset 13732 | a9865f5514fc |
parent 10565 | dc90c239f4ec |
child 14583 | d70ee55535f4 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
7397 | 2 |
* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#ifndef SHARE_VM_UTILITIES_PRESERVEEXCEPTION_HPP |
26 |
#define SHARE_VM_UTILITIES_PRESERVEEXCEPTION_HPP |
|
27 |
||
28 |
#include "runtime/handles.hpp" |
|
29 |
#ifdef TARGET_OS_FAMILY_linux |
|
30 |
# include "thread_linux.inline.hpp" |
|
31 |
#endif |
|
32 |
#ifdef TARGET_OS_FAMILY_solaris |
|
33 |
# include "thread_solaris.inline.hpp" |
|
34 |
#endif |
|
35 |
#ifdef TARGET_OS_FAMILY_windows |
|
36 |
# include "thread_windows.inline.hpp" |
|
37 |
#endif |
|
10565 | 38 |
#ifdef TARGET_OS_FAMILY_bsd |
39 |
# include "thread_bsd.inline.hpp" |
|
40 |
#endif |
|
7397 | 41 |
|
1 | 42 |
// This file provides more support for exception handling; see also exceptions.hpp |
43 |
class PreserveExceptionMark { |
|
44 |
private: |
|
45 |
Thread* _thread; |
|
46 |
Handle _preserved_exception_oop; |
|
47 |
int _preserved_exception_line; |
|
48 |
const char* _preserved_exception_file; |
|
49 |
||
50 |
public: |
|
51 |
PreserveExceptionMark(Thread*& thread); |
|
52 |
~PreserveExceptionMark(); |
|
53 |
}; |
|
54 |
||
55 |
||
56 |
// This is a clone of PreserveExceptionMark which asserts instead |
|
57 |
// of failing when what it wraps generates a pending exception. |
|
58 |
// It also addresses bug 6431341. |
|
59 |
class CautiouslyPreserveExceptionMark { |
|
60 |
private: |
|
61 |
Thread* _thread; |
|
62 |
Handle _preserved_exception_oop; |
|
63 |
int _preserved_exception_line; |
|
64 |
const char* _preserved_exception_file; |
|
65 |
||
66 |
public: |
|
67 |
CautiouslyPreserveExceptionMark(Thread* thread); |
|
68 |
~CautiouslyPreserveExceptionMark(); |
|
69 |
}; |
|
70 |
||
71 |
||
72 |
// Like PreserveExceptionMark but allows new exceptions to be generated in |
|
73 |
// the body of the mark. If a new exception is generated then the original one |
|
74 |
// is discarded. |
|
75 |
class WeakPreserveExceptionMark { |
|
76 |
private: |
|
77 |
Thread* _thread; |
|
78 |
Handle _preserved_exception_oop; |
|
79 |
int _preserved_exception_line; |
|
80 |
const char* _preserved_exception_file; |
|
81 |
||
82 |
void preserve(); |
|
83 |
void restore(); |
|
84 |
||
85 |
public: |
|
86 |
WeakPreserveExceptionMark(Thread* pThread) : _thread(pThread), _preserved_exception_oop() { |
|
87 |
if (pThread->has_pending_exception()) { |
|
88 |
preserve(); |
|
89 |
} |
|
90 |
} |
|
91 |
~WeakPreserveExceptionMark() { |
|
92 |
if (_preserved_exception_oop.not_null()) { |
|
93 |
restore(); |
|
94 |
} |
|
95 |
} |
|
96 |
}; |
|
97 |
||
98 |
||
99 |
||
100 |
// use global exception mark when allowing pending exception to be set and |
|
101 |
// saving and restoring them |
|
102 |
#define PRESERVE_EXCEPTION_MARK Thread* THREAD; PreserveExceptionMark __em(THREAD); |
|
7397 | 103 |
|
104 |
#endif // SHARE_VM_UTILITIES_PRESERVEEXCEPTION_HPP |