summaryrefslogtreecommitdiff
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
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
-rw-r--r--ChangeLog8
-rw-r--r--eval.c32
2 files changed, 29 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index c208118b6fe..12173cd00f4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,14 @@ Wed Jan 24 14:58:08 2001 Akinori MUSHA <knu@ruby-lang.org>
* lib/cgi.rb: fix the problem that when running under mod_ruby
header() outputs only one Set-Cookie line.
+Wed Jan 24 01:45:49 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * 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().
+
Tue Jan 23 18:51:57 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* gc.c (rb_gc_call_finalizer_at_exit): should finalize objects in
diff --git a/eval.c b/eval.c
index 1fd23849a1f..e8850db6a87 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) {