summaryrefslogtreecommitdiff
path: root/cont.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
commit284565992f487937080230d3ae2b5afae4c8ac3f (patch)
tree372a124cb831288479f8807bcb53d3cfbf533b9b /cont.c
parent426fcba8916780c99c7280a8278f84d81ff3d05e (diff)
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@12415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'cont.c')
-rw-r--r--cont.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/cont.c b/cont.c
index 786f00835b..9f1efac8b8 100644
--- a/cont.c
+++ b/cont.c
@@ -120,11 +120,17 @@ cont_new(VALUE klass)
return cont;
}
+void th_stack_to_heap(rb_thread_t *th);
+
static VALUE
cont_capture(volatile int *stat)
{
- rb_context_t *cont = cont_new(rb_cCont);
- rb_thread_t *th = &cont->saved_thread;
+ rb_context_t *cont;
+ rb_thread_t *th;
+
+ th_stack_to_heap(GET_THREAD());
+ cont = cont_new(rb_cCont);
+ th = &cont->saved_thread;
cont->vm_stack = ALLOC_N(VALUE, th->stack_size);
MEMCPY(cont->vm_stack, th->stack, VALUE, th->stack_size);