ruby-changes:13941
From: nobu <ko1@a...>
Date: Fri, 13 Nov 2009 10:14:29 +0900 (JST)
Subject: [ruby-changes:13941] Ruby:r25745 (mvm): * eval.c (ruby_vm_cleanup): not destruct vm, nor re-send signal.
nobu 2009-11-13 10:14:12 +0900 (Fri, 13 Nov 2009) New Revision: 25745 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25745 Log: * eval.c (ruby_vm_cleanup): not destruct vm, nor re-send signal. * eval.c (ruby_cleanup): destruct current vm and re-send signal. Modified files: branches/mvm/ChangeLog branches/mvm/eval.c branches/mvm/include/ruby/vm.h branches/mvm/main.c Index: mvm/include/ruby/vm.h =================================================================== --- mvm/include/ruby/vm.h (revision 25744) +++ mvm/include/ruby/vm.h (revision 25745) @@ -20,16 +20,18 @@ /* core API */ ruby_vm_t *ruby_vm_new(int argc, char *argv[]); -int ruby_vm_run(ruby_vm_t *vm); +int ruby_vm_run(ruby_vm_t *vm, int *signo); int ruby_vm_run_node(ruby_vm_t *vm, void *n); int ruby_vm_exec_node(ruby_vm_t *vm, void *n); int ruby_vm_start(ruby_vm_t *vm); int ruby_vm_join(ruby_vm_t *vm); +int ruby_vm_cleanup(ruby_vm_t *vm, int ex, int *signo); int ruby_vm_destruct(ruby_vm_t *vm); void ruby_vm_die(ruby_vm_t *); /* initialize API */ ruby_vm_t *ruby_init(void); +int ruby_vm_init(ruby_vm_t *vm); int ruby_vm_init_add_argv(ruby_vm_t *vm, const char *arg); int ruby_vm_init_add_library(ruby_vm_t *vm, const char *lib); int ruby_vm_init_add_library_path(ruby_vm_t *vm, const char *path); Index: mvm/ChangeLog =================================================================== --- mvm/ChangeLog (revision 25744) +++ mvm/ChangeLog (revision 25745) @@ -1,5 +1,9 @@ -Fri Nov 13 09:58:31 2009 Nobuyoshi Nakada <nobu@r...> +Fri Nov 13 10:14:11 2009 Nobuyoshi Nakada <nobu@r...> + * eval.c (ruby_vm_cleanup): not destruct vm, nor re-send signal. + + * eval.c (ruby_cleanup): destruct current vm and re-send signal. + * parse.y (Init_sym): use separate object space. Thu Nov 12 16:35:42 2009 Nobuyoshi Nakada <nobu@r...> Index: mvm/main.c =================================================================== --- mvm/main.c (revision 25744) +++ mvm/main.c (revision 25745) @@ -33,12 +33,13 @@ ruby_sysinit(&argc, &argv); { ruby_vm_t *vm; - int ret; + int ret, signo = 0; RUBY_INIT_STACK; vm = ruby_vm_new(argc, argv); - ret = ruby_vm_run(vm); + ret = ruby_vm_run(vm, &signo); ruby_vm_destruct(vm); + if (signo) ruby_default_signal(signo); return ret; } } Index: mvm/eval.c =================================================================== --- mvm/eval.c (revision 25744) +++ mvm/eval.c (revision 25745) @@ -42,7 +42,6 @@ void InitVM_ext(void); void ruby_vm_prog_init(rb_vm_t *vm); void *ruby_vm_process_options(rb_vm_t *vm, int argc, char **argv); -static int ruby_vm_cleanup(rb_vm_t *vm, int ex); rb_vm_t * ruby_init(void) @@ -144,7 +143,7 @@ void rb_thread_stop_timer_thread(void); int -ruby_vm_cleanup(rb_vm_t *vm, volatile int ex) +ruby_vm_cleanup(rb_vm_t *vm, volatile int ex, int *signo) { int state; volatile VALUE errs[2]; @@ -190,14 +189,13 @@ else if (rb_obj_is_kind_of(err, rb_eSignal)) { VALUE sig = rb_iv_get(err, "signo"); state = NUM2INT(sig); + if (signo) *signo = state; break; } else if (ex == 0) { ex = 1; } } - ruby_vm_destruct(GET_VM()); - if (state) ruby_default_signal(state); #if EXIT_SUCCESS != 0 || EXIT_FAILURE != 1 switch (ex) { @@ -216,7 +214,11 @@ int ruby_cleanup(volatile int ex) { - return ruby_vm_cleanup(GET_VM(), ex); + rb_vm_t *vm = GET_VM(); + int signo = 0, status = ruby_vm_cleanup(vm, ex, &signo); + ruby_vm_destruct(vm); + if (signo) ruby_default_signal(signo); + return status; } static int @@ -271,7 +273,7 @@ } int -ruby_vm_run(rb_vm_t *vm) +ruby_vm_run(rb_vm_t *vm, int *signo) { int status; void *n; @@ -279,15 +281,15 @@ rb_thread_set_current_raw(vm->main_thread); Init_stack((void *)&vm); if ((status = ruby_vm_init(vm)) != 0) { - return ruby_vm_cleanup(vm, status); + return ruby_vm_cleanup(vm, status, signo); } n = ruby_vm_parse_options(vm); if (!ruby_executable_node(n, &status)) { - ruby_vm_cleanup(vm, 0); + ruby_vm_cleanup(vm, 0, signo); return status; } status = ruby_vm_exec_internal(vm, n); - return ruby_vm_cleanup(vm, status); + return ruby_vm_cleanup(vm, status, signo); } /* -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/