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 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/systemDictionary.hpp"
27 #include "classfile/vmSymbols.hpp"
28 #include "compiler/compileBroker.hpp"
29 #include "logging/log.hpp"
30 #include "memory/resourceArea.hpp"
31 #include "oops/oop.inline.hpp"
32 #include "runtime/init.hpp"
33 #include "runtime/java.hpp"
34 #include "runtime/javaCalls.hpp"
35 #include "runtime/thread.inline.hpp"
36 #include "runtime/threadCritical.hpp"
37 #include "utilities/events.hpp"
38 #include "utilities/exceptions.hpp"
39
40 // Implementation of ThreadShadow
41 void check_ThreadShadow() {
42 const ByteSize offset1 = byte_offset_of(ThreadShadow, _pending_exception);
43 const ByteSize offset2 = Thread::pending_exception_offset();
44 if (offset1 != offset2) fatal("ThreadShadow::_pending_exception is not positioned correctly");
45 }
46
47
48 void ThreadShadow::set_pending_exception(oop exception, const char* file, int line) {
49 assert(exception != NULL && exception->is_oop(), "invalid exception oop");
50 _pending_exception = exception;
51 _exception_file = file;
52 _exception_line = line;
53 }
54
55 void ThreadShadow::clear_pending_exception() {
56 if (_pending_exception != NULL && log_is_enabled(Debug, exceptions)) {
57 ResourceMark rm;
58 outputStream* logst = Log(exceptions)::debug_stream();
59 logst->print("Thread::clear_pending_exception: cleared exception:");
60 _pending_exception->print_on(logst);
61 }
62 _pending_exception = NULL;
63 _exception_file = NULL;
64 _exception_line = 0;
65 }
66 // Implementation of Exceptions
67
68 bool Exceptions::special_exception(Thread* thread, const char* file, int line, Handle h_exception) {
69 // bootstrapping check
70 if (!Universe::is_fully_initialized()) {
71 vm_exit_during_initialization(h_exception);
72 ShouldNotReachHere();
73 }
74
75 #ifdef ASSERT
76 // Check for trying to throw stack overflow before initialization is complete
77 // to prevent infinite recursion trying to initialize stack overflow without
78 // adequate stack space.
79 // This can happen with stress testing a large value of StackShadowPages
80 if (h_exception()->klass() == SystemDictionary::StackOverflowError_klass()) {
|
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 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/systemDictionary.hpp"
27 #include "classfile/vmSymbols.hpp"
28 #include "compiler/compileBroker.hpp"
29 #include "logging/log.hpp"
30 #include "logging/logStream.hpp"
31 #include "memory/resourceArea.hpp"
32 #include "oops/oop.inline.hpp"
33 #include "runtime/init.hpp"
34 #include "runtime/java.hpp"
35 #include "runtime/javaCalls.hpp"
36 #include "runtime/thread.inline.hpp"
37 #include "runtime/threadCritical.hpp"
38 #include "utilities/events.hpp"
39 #include "utilities/exceptions.hpp"
40
41 // Implementation of ThreadShadow
42 void check_ThreadShadow() {
43 const ByteSize offset1 = byte_offset_of(ThreadShadow, _pending_exception);
44 const ByteSize offset2 = Thread::pending_exception_offset();
45 if (offset1 != offset2) fatal("ThreadShadow::_pending_exception is not positioned correctly");
46 }
47
48
49 void ThreadShadow::set_pending_exception(oop exception, const char* file, int line) {
50 assert(exception != NULL && exception->is_oop(), "invalid exception oop");
51 _pending_exception = exception;
52 _exception_file = file;
53 _exception_line = line;
54 }
55
56 void ThreadShadow::clear_pending_exception() {
57 LogTarget(Debug, exceptions) lt;
58 if (_pending_exception != NULL && lt.is_enabled()) {
59 ResourceMark rm;
60 LogStream ls(lt);
61 ls.print("Thread::clear_pending_exception: cleared exception:");
62 _pending_exception->print_on(&ls);
63 }
64 _pending_exception = NULL;
65 _exception_file = NULL;
66 _exception_line = 0;
67 }
68 // Implementation of Exceptions
69
70 bool Exceptions::special_exception(Thread* thread, const char* file, int line, Handle h_exception) {
71 // bootstrapping check
72 if (!Universe::is_fully_initialized()) {
73 vm_exit_during_initialization(h_exception);
74 ShouldNotReachHere();
75 }
76
77 #ifdef ASSERT
78 // Check for trying to throw stack overflow before initialization is complete
79 // to prevent infinite recursion trying to initialize stack overflow without
80 // adequate stack space.
81 // This can happen with stress testing a large value of StackShadowPages
82 if (h_exception()->klass() == SystemDictionary::StackOverflowError_klass()) {
|