summaryrefslogtreecommitdiffstats
path: root/vm.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-05-30 05:56:13 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-05-30 05:56:13 +0000
commit2de9bf108ef949a3af13299499ef207528df62ac (patch)
tree372a124cb831288479f8807bcb53d3cfbf533b9b /vm.c
parent7d52d7ec653139f3ca373b05d8be7910e73e0193 (diff)
downloadruby-2de9bf108ef949a3af13299499ef207528df62ac.tar.gz
ruby-2de9bf108ef949a3af13299499ef207528df62ac.tar.xz
ruby-2de9bf108ef949a3af13299499ef207528df62ac.zip
* cont.c (cont_capture): store all local variables in heap
([ruby-dev:30832]). * vm.c (th_stack_to_heap): added. * test/ruby/test_continuation.rb: add a test for above. * eval_intern.h (th_get_ruby_level_cfp): fix to clean code. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@12415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/vm.c b/vm.c
index 3337117f2..1c313cba1 100644
--- a/vm.c
+++ b/vm.c
@@ -400,7 +400,6 @@ th_collect_local_variables_in_heap(rb_thread_t *th, VALUE *dfp, VALUE ary)
}
}
-
VALUE
th_make_env_object(rb_thread_t *th, rb_control_frame_t *cfp)
{
@@ -413,6 +412,16 @@ th_make_env_object(rb_thread_t *th, rb_control_frame_t *cfp)
return envval;
}
+void
+th_stack_to_heap(rb_thread_t *th)
+{
+ rb_control_frame_t *cfp = th->cfp;
+ while ((cfp = th_get_ruby_level_cfp(th, cfp)) != 0) {
+ th_make_env_object(th, cfp);
+ cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
+ }
+}
+
static VALUE
th_make_proc_from_block(rb_thread_t *th, rb_control_frame_t *cfp,
rb_block_t *block)