41 // can throw an exception, we must check if an exception is pending. 42 // The CHECK macros do this in a convenient way. Carrying around the 43 // thread provides also convenient access to it (e.g. for Handle 44 // creation, w/o the need for recomputation). 45 46 47 48 // Forward declarations to be independent of the include structure. 49 // This allows us to have exceptions.hpp included in top.hpp. 50 51 class Thread; 52 class Handle; 53 class Symbol; 54 class JavaCallArguments; 55 56 // The ThreadShadow class is a helper class to access the _pending_exception 57 // field of the Thread class w/o having access to the Thread's interface (for 58 // include hierachy reasons). 59 60 class ThreadShadow: public CHeapObj { 61 protected: 62 oop _pending_exception; // Thread has gc actions. 63 const char* _exception_file; // file information for exception (debugging only) 64 int _exception_line; // line information for exception (debugging only) 65 friend void check_ThreadShadow(); // checks _pending_exception offset 66 67 // The following virtual exists only to force creation of a vtable. 68 // We need ThreadShadow to have a vtable, even in product builds, 69 // so that its layout will start at an offset of zero relative to Thread. 70 // Some C++ compilers are so "clever" that they put the ThreadShadow 71 // base class at offset 4 in Thread (after Thread's vtable), if they 72 // notice that Thread has a vtable but ThreadShadow does not. 73 virtual void unused_initial_virtual() { } 74 75 public: 76 oop pending_exception() const { return _pending_exception; } 77 bool has_pending_exception() const { return _pending_exception != NULL; } 78 const char* exception_file() const { return _exception_file; } 79 int exception_line() const { return _exception_line; } 80 | 41 // can throw an exception, we must check if an exception is pending. 42 // The CHECK macros do this in a convenient way. Carrying around the 43 // thread provides also convenient access to it (e.g. for Handle 44 // creation, w/o the need for recomputation). 45 46 47 48 // Forward declarations to be independent of the include structure. 49 // This allows us to have exceptions.hpp included in top.hpp. 50 51 class Thread; 52 class Handle; 53 class Symbol; 54 class JavaCallArguments; 55 56 // The ThreadShadow class is a helper class to access the _pending_exception 57 // field of the Thread class w/o having access to the Thread's interface (for 58 // include hierachy reasons). 59 60 class ThreadShadow: public CHeapObj { 61 friend class VMStructs; 62 63 protected: 64 oop _pending_exception; // Thread has gc actions. 65 const char* _exception_file; // file information for exception (debugging only) 66 int _exception_line; // line information for exception (debugging only) 67 friend void check_ThreadShadow(); // checks _pending_exception offset 68 69 // The following virtual exists only to force creation of a vtable. 70 // We need ThreadShadow to have a vtable, even in product builds, 71 // so that its layout will start at an offset of zero relative to Thread. 72 // Some C++ compilers are so "clever" that they put the ThreadShadow 73 // base class at offset 4 in Thread (after Thread's vtable), if they 74 // notice that Thread has a vtable but ThreadShadow does not. 75 virtual void unused_initial_virtual() { } 76 77 public: 78 oop pending_exception() const { return _pending_exception; } 79 bool has_pending_exception() const { return _pending_exception != NULL; } 80 const char* exception_file() const { return _exception_file; } 81 int exception_line() const { return _exception_line; } 82 |