From 398ed65c909aad37b043c703b9a05de1d9c405bf Mon Sep 17 00:00:00 2001 From: usa Date: Fri, 11 Jan 2013 08:02:06 +0000 Subject: [Backport #7624] * vm_trace.c (rb_threadptr_exec_event_hooks): added a parameter to pop a frame before JUMP_TAG() if exception occurred. This change fix bug of Ruby 1.9. [ruby-core:51128] [ruby-trunk - Bug #7624] * vm_core.h (EXEC_EVENT_HOOK_AND_POP_FRAME): add to use `rb_threadptr_exec_event_hooks()' with the pop flag. * vm.c (vm_exec): use EXEC_EVENT_HOOK_AND_POP_FRAME() while exception handling. While exception hadnling, if an exception is raised in hooks, need to pop current frame and raise this raised exception by hook. * bootstraptest/test_flow.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@38778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm_core.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'vm_core.h') diff --git a/vm_core.h b/vm_core.h index 1a1016217a..ee49704317 100644 --- a/vm_core.h +++ b/vm_core.h @@ -728,17 +728,23 @@ void rb_thread_lock_destroy(rb_thread_lock_t *); /* tracer */ void -rb_threadptr_exec_event_hooks(rb_thread_t *th, rb_event_flag_t flag, VALUE self, ID id, VALUE klass); +rb_threadptr_exec_event_hooks(rb_thread_t *th, rb_event_flag_t flag, VALUE self, ID id, VALUE klass, int pop_p); -#define EXEC_EVENT_HOOK(th, flag, self, id, klass) do { \ +#define EXEC_EVENT_HOOK_ORIG(th, flag, self, id, klass, pop_p) do { \ rb_event_flag_t wait_event__ = (th)->event_flags; \ if (UNLIKELY(wait_event__)) { \ if (wait_event__ & ((flag) | RUBY_EVENT_VM)) { \ - rb_threadptr_exec_event_hooks((th), (flag), (self), (id), (klass)); \ + rb_threadptr_exec_event_hooks((th), (flag), (self), (id), (klass), (pop_p)); \ } \ } \ } while (0) +#define EXEC_EVENT_HOOK(th, flag, self, id, klass) \ + EXEC_EVENT_HOOK_ORIG(th, flag, self, id, klass, 0) + +#define EXEC_EVENT_HOOK_AND_POP_FRAME(th, flag, self, id, klass) \ + EXEC_EVENT_HOOK_ORIG(th, flag, self, id, klass, 1) + #if defined __GNUC__ && __GNUC__ >= 4 #pragma GCC visibility push(default) #endif -- cgit v1.2.3