src/share/vm/utilities/exceptions.cpp

Print this page


   1 /*
   2  * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
   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  *
  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 "incls/_precompiled.incl"
  26 #include "incls/_exceptions.cpp.incl"


















  27 
  28 
  29 // Implementation of ThreadShadow
  30 void check_ThreadShadow() {
  31   const ByteSize offset1 = byte_offset_of(ThreadShadow, _pending_exception);
  32   const ByteSize offset2 = Thread::pending_exception_offset();
  33   if (offset1 != offset2) fatal("ThreadShadow::_pending_exception is not positioned correctly");
  34 }
  35 
  36 
  37 void ThreadShadow::set_pending_exception(oop exception, const char* file, int line) {
  38   assert(exception != NULL && exception->is_oop(), "invalid exception oop");
  39   _pending_exception = exception;
  40   _exception_file    = file;
  41   _exception_line    = line;
  42 }
  43 
  44 void ThreadShadow::clear_pending_exception() {
  45   if (TraceClearedExceptions) {
  46     if (_pending_exception != NULL) {


   1 /*
   2  * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
   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  *
  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 "oops/oop.inline.hpp"
  30 #include "runtime/init.hpp"
  31 #include "runtime/java.hpp"
  32 #include "runtime/javaCalls.hpp"
  33 #include "runtime/threadCritical.hpp"
  34 #include "utilities/events.hpp"
  35 #include "utilities/exceptions.hpp"
  36 #ifdef TARGET_OS_FAMILY_linux
  37 # include "thread_linux.inline.hpp"
  38 #endif
  39 #ifdef TARGET_OS_FAMILY_solaris
  40 # include "thread_solaris.inline.hpp"
  41 #endif
  42 #ifdef TARGET_OS_FAMILY_windows
  43 # include "thread_windows.inline.hpp"
  44 #endif
  45 
  46 
  47 // Implementation of ThreadShadow
  48 void check_ThreadShadow() {
  49   const ByteSize offset1 = byte_offset_of(ThreadShadow, _pending_exception);
  50   const ByteSize offset2 = Thread::pending_exception_offset();
  51   if (offset1 != offset2) fatal("ThreadShadow::_pending_exception is not positioned correctly");
  52 }
  53 
  54 
  55 void ThreadShadow::set_pending_exception(oop exception, const char* file, int line) {
  56   assert(exception != NULL && exception->is_oop(), "invalid exception oop");
  57   _pending_exception = exception;
  58   _exception_file    = file;
  59   _exception_line    = line;
  60 }
  61 
  62 void ThreadShadow::clear_pending_exception() {
  63   if (TraceClearedExceptions) {
  64     if (_pending_exception != NULL) {