src/share/vm/utilities/exceptions.hpp

changeset 2497
3582bf76420e
parent 2314
f95d63e2154a
child 2708
1d1603768966
equal deleted inserted replaced
2496:27e4ea99855d 2497:3582bf76420e
48 // Forward declarations to be independent of the include structure. 48 // Forward declarations to be independent of the include structure.
49 // This allows us to have exceptions.hpp included in top.hpp. 49 // This allows us to have exceptions.hpp included in top.hpp.
50 50
51 class Thread; 51 class Thread;
52 class Handle; 52 class Handle;
53 class symbolHandle; 53 class Symbol;
54 class symbolOopDesc;
55 class JavaCallArguments; 54 class JavaCallArguments;
56 55
57 // The ThreadShadow class is a helper class to access the _pending_exception 56 // The ThreadShadow class is a helper class to access the _pending_exception
58 // field of the Thread class w/o having access to the Thread's interface (for 57 // field of the Thread class w/o having access to the Thread's interface (for
59 // include hierachy reasons). 58 // include hierachy reasons).
98 // relatively rare. The Exceptions operations should only be 97 // relatively rare. The Exceptions operations should only be
99 // used directly if the macros below are insufficient. 98 // used directly if the macros below are insufficient.
100 99
101 class Exceptions { 100 class Exceptions {
102 static bool special_exception(Thread *thread, const char* file, int line, Handle exception); 101 static bool special_exception(Thread *thread, const char* file, int line, Handle exception);
103 static bool special_exception(Thread* thread, const char* file, int line, symbolHandle name, const char* message); 102 static bool special_exception(Thread* thread, const char* file, int line, Symbol* name, const char* message);
104 public: 103 public:
105 // this enum is defined to indicate whether it is safe to 104 // this enum is defined to indicate whether it is safe to
106 // ignore the encoding scheme of the original message string. 105 // ignore the encoding scheme of the original message string.
107 typedef enum { 106 typedef enum {
108 safe_to_utf8 = 0, 107 safe_to_utf8 = 0,
110 } ExceptionMsgToUtf8Mode; 109 } ExceptionMsgToUtf8Mode;
111 // Throw exceptions: w/o message, w/ message & with formatted message. 110 // Throw exceptions: w/o message, w/ message & with formatted message.
112 static void _throw_oop(Thread* thread, const char* file, int line, oop exception); 111 static void _throw_oop(Thread* thread, const char* file, int line, oop exception);
113 static void _throw(Thread* thread, const char* file, int line, Handle exception, const char* msg = NULL); 112 static void _throw(Thread* thread, const char* file, int line, Handle exception, const char* msg = NULL);
114 static void _throw_msg(Thread* thread, const char* file, int line, 113 static void _throw_msg(Thread* thread, const char* file, int line,
115 symbolHandle name, const char* message, Handle loader, 114 Symbol* name, const char* message, Handle loader,
116 Handle protection_domain); 115 Handle protection_domain);
117 static void _throw_msg(Thread* thread, const char* file, int line, 116 static void _throw_msg(Thread* thread, const char* file, int line,
118 symbolOop name, const char* message); 117 Symbol* name, const char* message);
119 static void _throw_msg(Thread* thread, const char* file, int line,
120 symbolHandle name, const char* message);
121 static void _throw_args(Thread* thread, const char* file, int line, 118 static void _throw_args(Thread* thread, const char* file, int line,
122 symbolHandle name, symbolHandle signature, 119 Symbol* name, Symbol* signature,
123 JavaCallArguments* args); 120 JavaCallArguments* args);
124 static void _throw_msg_cause(Thread* thread, const char* file, 121 static void _throw_msg_cause(Thread* thread, const char* file,
125 int line, symbolHandle h_name, const char* message, 122 int line, Symbol* h_name, const char* message,
126 Handle h_cause, Handle h_loader, Handle h_protection_domain); 123 Handle h_cause, Handle h_loader, Handle h_protection_domain);
127 static void _throw_msg_cause(Thread* thread, const char* file, int line, 124 static void _throw_msg_cause(Thread* thread, const char* file, int line,
128 symbolHandle name, const char* message, Handle cause); 125 Symbol* name, const char* message, Handle cause);
129 126
130 // There is no THROW... macro for this method. Caller should remember 127 // There is no THROW... macro for this method. Caller should remember
131 // to do a return after calling it. 128 // to do a return after calling it.
132 static void fthrow(Thread* thread, const char* file, int line, symbolHandle name, 129 static void fthrow(Thread* thread, const char* file, int line, Symbol* name,
133 const char* format, ...); 130 const char* format, ...);
134 131
135 // Create and initialize a new exception 132 // Create and initialize a new exception
136 static Handle new_exception(Thread* thread, symbolHandle name, 133 static Handle new_exception(Thread* thread, Symbol* name,
137 symbolHandle signature, JavaCallArguments* args, 134 Symbol* signature, JavaCallArguments* args,
138 Handle cause, Handle loader, 135 Handle cause, Handle loader,
139 Handle protection_domain); 136 Handle protection_domain);
140 137
141 static Handle new_exception(Thread* thread, symbolHandle name, 138 static Handle new_exception(Thread* thread, Symbol* name,
142 const char* message, Handle cause, Handle loader, 139 const char* message, Handle cause, Handle loader,
143 Handle protection_domain, 140 Handle protection_domain,
144 ExceptionMsgToUtf8Mode to_utf8_safe = safe_to_utf8); 141 ExceptionMsgToUtf8Mode to_utf8_safe = safe_to_utf8);
145 142
146 static Handle new_exception(Thread* thread, symbolOop name, 143 static Handle new_exception(Thread* thread, Symbol* name,
147 const char* message, 144 const char* message,
148 ExceptionMsgToUtf8Mode to_utf8_safe = safe_to_utf8); 145 ExceptionMsgToUtf8Mode to_utf8_safe = safe_to_utf8);
149 146
150 static void throw_stack_overflow_exception(Thread* thread, const char* file, int line); 147 static void throw_stack_overflow_exception(Thread* thread, const char* file, int line);
151 148

mercurial