summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-01-08 07:02:26 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-01-08 07:02:26 +0000
commitc56b86ecd21cf89edccfcc5f39d4343fc5b33449 (patch)
tree747e583dea0b747b903396eb369eb7fac1ba93be /eval.c
parentb25af75ba54f62b07accc1b85f85046aee0f8581 (diff)
* eval.c (rb_add_method): clear replaced method from the cache.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1974 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/eval.c b/eval.c
index 54b5af4b0c..86cbe17c00 100644
--- a/eval.c
+++ b/eval.c
@@ -232,7 +232,8 @@ rb_add_method(klass, mid, node, noex)
}
if (OBJ_FROZEN(klass)) rb_error_frozen("class/module");
body = NEW_METHOD(node, noex);
- st_insert(RCLASS(klass)->m_tbl, mid, body);
+ if (st_insert(RCLASS(klass)->m_tbl, mid, body))
+ rb_clear_cache_by_id(mid);
}
static NODE*
@@ -4199,8 +4200,17 @@ stack_length(p)
void
rb_stack_check()
{
- if (stack_length(0) > STACK_LEVEL_MAX) {
- rb_raise(rb_eSysStackError, "stack level too deep");
+ static int overflowing = 0;
+ if (!overflowing && stack_length(0) > STACK_LEVEL_MAX) {
+ int state;
+ overflowing = 1;
+ PUSH_TAG(PROT_NONE);
+ if ((state = EXEC_TAG()) == 0) {
+ rb_raise(rb_eSysStackError, "stack level too deep");
+ }
+ POP_TAG();
+ overflowing = 0;
+ JUMP_TAG(state);
}
}