This is the constructor:
PreserveExceptionMark::PreserveExceptionMark(Thread*& thread) {
thread = Thread::current();
_thread = thread;
_preserved_exception_oop = Handle(thread, _thread->pending_exception());
_thread->clear_pending_exception(); // Needed to avoid infinite recursion
_preserved_exception_line = _thread->exception_line();
_preserved_exception_file = _thread->exception_file();
}
File and line are saved after they have been cleared.
Also, thread, is reference parameter which set is both non-intuitive and not in the style of HotSpot. However, this is needed with the primary usage via this macro:
#define PRESERVE_EXCEPTION_MARK Thread* THREAD; PreserveExceptionMark __em(THREAD);
Finally, the comment, on clear the pending exception appears to be incorrect.
PreserveExceptionMark::PreserveExceptionMark(Thread*& thread) {
thread = Thread::current();
_thread = thread;
_preserved_exception_oop = Handle(thread, _thread->pending_exception());
_thread->clear_pending_exception(); // Needed to avoid infinite recursion
_preserved_exception_line = _thread->exception_line();
_preserved_exception_file = _thread->exception_file();
}
File and line are saved after they have been cleared.
Also, thread, is reference parameter which set is both non-intuitive and not in the style of HotSpot. However, this is needed with the primary usage via this macro:
#define PRESERVE_EXCEPTION_MARK Thread* THREAD; PreserveExceptionMark __em(THREAD);
Finally, the comment, on clear the pending exception appears to be incorrect.