* eval.c (ruby_cleanup): free current VM and its objspace even

when exiting by SystemExit.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-10-31 13:24:19 +00:00
Родитель f6003894b9
Коммит a2c4b890be
2 изменённых файлов: 20 добавлений и 14 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Sun Oct 31 22:24:14 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (ruby_cleanup): free current VM and its objspace even
when exiting by SystemExit.
Sun Oct 31 22:10:56 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* compile.c (new_child_iseq): adjust argument types.

29
eval.c
Просмотреть файл

@ -162,6 +162,17 @@ ruby_cleanup(volatile int ex)
POP_TAG();
rb_thread_stop_timer_thread();
#if EXIT_SUCCESS != 0 || EXIT_FAILURE != 1
switch (ex) {
#if EXIT_SUCCESS != 0
case 0: ex = EXIT_SUCCESS; break;
#endif
#if EXIT_FAILURE != 1
case 1: ex = EXIT_FAILURE; break;
#endif
}
#endif
state = 0;
for (nerr = 0; nerr < numberof(errs); ++nerr) {
VALUE err = errs[nerr];
@ -172,31 +183,21 @@ ruby_cleanup(volatile int ex)
if (TYPE(err) == T_NODE) continue;
if (rb_obj_is_kind_of(err, rb_eSystemExit)) {
return sysexit_status(err);
ex = sysexit_status(err);
break;
}
else if (rb_obj_is_kind_of(err, rb_eSignal)) {
VALUE sig = rb_iv_get(err, "signo");
state = NUM2INT(sig);
break;
}
else if (ex == 0) {
ex = 1;
else if (ex == EXIT_SUCCESS) {
ex = EXIT_FAILURE;
}
}
ruby_vm_destruct(GET_VM());
if (state) ruby_default_signal(state);
#if EXIT_SUCCESS != 0 || EXIT_FAILURE != 1
switch (ex) {
#if EXIT_SUCCESS != 0
case 0: return EXIT_SUCCESS;
#endif
#if EXIT_FAILURE != 1
case 1: return EXIT_FAILURE;
#endif
}
#endif
return ex;
}