comparison src/share/vm/utilities/exceptions.cpp @ 3272:01147d8aac1d

7009923: JSR 292: VM crash in JavaThread::last_frame Summary: Handle stack overflow before the first frame is called, by printing out the called method and not walking the stack. Reviewed-by: dholmes, phh, dsamersoff
author coleenp
date Tue, 26 Apr 2011 14:04:43 -0400
parents 1d1603768966
children be4ca325525a f08d439fab8c
comparison
equal deleted inserted replaced
3271:cdd13dce903e 3272:01147d8aac1d
205 Handle exception = new_exception(thread, h_name, h_signature, args, h_cause, h_loader, h_prot); 205 Handle exception = new_exception(thread, h_name, h_signature, args, h_cause, h_loader, h_prot);
206 _throw(thread, file, line, exception); 206 _throw(thread, file, line, exception);
207 } 207 }
208 208
209 209
210 void Exceptions::throw_stack_overflow_exception(Thread* THREAD, const char* file, int line) { 210 void Exceptions::throw_stack_overflow_exception(Thread* THREAD, const char* file, int line, methodHandle method) {
211 Handle exception; 211 Handle exception;
212 if (!THREAD->has_pending_exception()) { 212 if (!THREAD->has_pending_exception()) {
213 klassOop k = SystemDictionary::StackOverflowError_klass(); 213 klassOop k = SystemDictionary::StackOverflowError_klass();
214 oop e = instanceKlass::cast(k)->allocate_instance(CHECK); 214 oop e = instanceKlass::cast(k)->allocate_instance(CHECK);
215 exception = Handle(THREAD, e); // fill_in_stack trace does gc 215 exception = Handle(THREAD, e); // fill_in_stack trace does gc
216 assert(instanceKlass::cast(k)->is_initialized(), "need to increase min_stack_allowed calculation"); 216 assert(instanceKlass::cast(k)->is_initialized(), "need to increase min_stack_allowed calculation");
217 if (StackTraceInThrowable) { 217 if (StackTraceInThrowable) {
218 java_lang_Throwable::fill_in_stack_trace(exception); 218 java_lang_Throwable::fill_in_stack_trace(exception, method());
219 } 219 }
220 } else { 220 } else {
221 // if prior exception, throw that one instead 221 // if prior exception, throw that one instead
222 exception = Handle(THREAD, THREAD->pending_exception()); 222 exception = Handle(THREAD, THREAD->pending_exception());
223 } 223 }
224 _throw_oop(THREAD, file, line, exception()); 224 _throw(THREAD, file, line, exception);
225 } 225 }
226 226
227 void Exceptions::fthrow(Thread* thread, const char* file, int line, Symbol* h_name, const char* format, ...) { 227 void Exceptions::fthrow(Thread* thread, const char* file, int line, Symbol* h_name, const char* format, ...) {
228 const int max_msg_size = 1024; 228 const int max_msg_size = 1024;
229 va_list ap; 229 va_list ap;