summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-01-24 06:32:10 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-01-24 06:32:10 +0000
commit74273daffb0d9f1b17795c8b8bbe8e32e14229eb (patch)
treefed81cdcc098be263311cc4597697bb88c7cc73c /eval.c
parent0dc1a293fdcda1558f42d207ef289fd8e7b9401d (diff)
* eval.c (POP_BLOCK_TAG): call rb_gc_force_recycle() if block has
not been objectified. * eval.c (rb_callcc): should nail down block->tag history to avoid rb_gc_force_recycle(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/eval.c b/eval.c
index 1fd2384..e8850db 100644
--- a/eval.c
+++ b/eval.c
@@ -583,21 +583,18 @@ new_blktag()
_block.dyna_vars = ruby_dyna_vars; \
ruby_block = &_block;
+#define POP_BLOCK_TAG(tag) do { \
+ if ((tag)->flags & BLOCK_DYNAMIC) \
+ (tag)->flags |= BLOCK_ORPHAN; \
+ else \
+ rb_gc_force_recycle((VALUE)tag); \
+} while (0)
+
#define POP_BLOCK() \
- _block.tag->flags |= BLOCK_ORPHAN; \
+ POP_BLOCK_TAG(_block.tag); \
ruby_block = _block.prev; \
}
-#define PUSH_BLOCK2(b) { \
- struct BLOCK * volatile _old; \
- _old = ruby_block; \
- ruby_block = b;
-
-#define POP_BLOCK2() \
- _block.tag->flags |= BLOCK_ORPHAN; \
- ruby_block = _old; \
-}
-
struct RVarmap *ruby_dyna_vars;
#define PUSH_VARS() { \
struct RVarmap * volatile _old; \
@@ -5924,6 +5921,7 @@ blk_mark(data)
rb_gc_mark(data->self);
rb_gc_mark(data->dyna_vars);
rb_gc_mark(data->klass);
+ rb_gc_mark(data->tag);
data = data->prev;
}
}
@@ -5966,6 +5964,7 @@ blk_copy_prev(block)
MEMCPY(tmp->frame.argv, block->prev->frame.argv, VALUE, tmp->frame.argc);
}
scope_dup(tmp->scope);
+ tmp->tag->flags |= BLOCK_DYNAMIC;
block->prev = tmp;
block = tmp;
}
@@ -6043,6 +6042,8 @@ rb_f_binding(self)
else {
data->prev = 0;
}
+ data->flags |= BLOCK_DYNAMIC;
+ data->tag->flags |= BLOCK_DYNAMIC;
for (p = data; p; p = p->prev) {
for (vars = p->dyna_vars; vars; vars = vars->next) {
@@ -6126,6 +6127,7 @@ proc_new(klass)
data->prev = 0;
}
data->flags |= BLOCK_DYNAMIC;
+ data->tag->flags |= BLOCK_DYNAMIC;
for (p = data; p; p = p->prev) {
for (vars = p->dyna_vars; vars; vars = vars->next) {
@@ -8405,6 +8407,14 @@ rb_callcc(self)
for (tag=prot_tag; tag; tag=tag->prev) {
scope_dup(tag->scope);
}
+ if (ruby_block) {
+ struct BLOCK *block = ruby_block;
+
+ while (block) {
+ block->tag->flags |= BLOCK_DYNAMIC;
+ block = block->prev;
+ }
+ }
th->thread = curr_thread->thread;
for (vars = th->dyna_vars; vars; vars = vars->next) {