diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-04-17 02:31:35 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-04-17 02:31:35 +0000 |
commit | e601e775905f356f897857759c479d5ab76b2286 (patch) | |
tree | ccaa98da5509c2fd002552b13e7cfb7973f4fa69 /gc.c | |
parent | e97ac02f8466275732a33f704480c03da722f485 (diff) |
eval.c: copy special exceptions before raise
* eval.c (setup_exception): consider if the exception is frozen,
but not one of special exception objects.
* gc.c (rb_memerror): copy minimum objects.
* thread.c (rb_threadptr_execute_interrupts): prepare special
exception queued by another thread to be raised.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -7624,21 +7624,25 @@ rb_memerror(void) { rb_thread_t *th = GET_THREAD(); rb_objspace_t *objspace = rb_objspace_of(th->vm); + VALUE exc; if (during_gc) gc_exit(objspace, "rb_memerror"); - if (!nomem_error || + exc = nomem_error; + if (!exc || rb_thread_raised_p(th, RAISED_NOMEMORY)) { fprintf(stderr, "[FATAL] failed to allocate memory\n"); exit(EXIT_FAILURE); } if (rb_thread_raised_p(th, RAISED_NOMEMORY)) { rb_thread_raised_clear(th); - GET_THREAD()->errinfo = nomem_error; - TH_JUMP_TAG(th, TAG_RAISE); } - rb_thread_raised_set(th, RAISED_NOMEMORY); - rb_exc_raise(nomem_error); + else { + rb_thread_raised_set(th, RAISED_NOMEMORY); + exc = ruby_vm_special_exception_copy(exc); + } + th->errinfo = exc; + TH_JUMP_TAG(th, TAG_RAISE); } static void * |