summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-01-09 07:26:21 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-01-09 07:26:21 +0000
commit87beea44969367180d255f56c4001348cf41d210 (patch)
tree1c6ff993469e69370eaaf3116eefc1eab035dbac /eval.c
parent39711489a44a1c0ed02b0a605d3e83558b3b8dd3 (diff)
* enum.c (enum_inject): new method.
* gc.c (rb_gc_call_finalizer_at_exit): clear klass member of terminating object. * eval.c (rb_call): raise exception for terminated object. * bignum.c (bigdivrem): t2 might be too big for signed long; do not use rb_int2big(), but rb_uint2big(). * error.c (rb_load_fail): new func to report LoadError. * ruby.c (load_file): use rb_load_fail. * eval.c (ruby_finalize): should enclosed by PUSH_TAG/POP_TAG. * gc.c (rb_gc_mark): link 2 of NODE_IFUNC should not be explicitly marked. it may contain non object pointer. * re.c (reg_s_last_match): Regexp::last_match(nth) returns nth substring of the match (alternative for $& and $<digit>). * eval.c (rb_mod_define_method): wrong comparison for blocks. * gc.c (id2ref): should handle Symbol too. * gc.c (id2ref): should print original ptr value * eval.c (rb_iterate): NODE_CFUNC does not protect its data (nd_tval), so create new node NODE_IFUNC for iteration C function. * eval.c (rb_yield_0): use NODE_IFUNC. * gc.c (rb_gc_mark): support NODE_IFUNC. * gc.c (mem_error): prohibit recursive mem_error(). (ruby-bugs-ja:PR#36) * eval.c (rb_thread_fd_writable): should not switch context if rb_thread_critical is set. * eval.c (rb_thread_wait_fd): ditto. * eval.c (rb_thread_wait_for): ditto. * eval.c (rb_thread_select): ditto. * eval.c (rb_thread_join): join during critical section causes deadlock. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/eval.c b/eval.c
index 21cff9b..4ad82d1 100644
--- a/eval.c
+++ b/eval.c
@@ -1122,9 +1122,15 @@ void rb_exec_end_proc _((void));
void
ruby_finalize()
{
- rb_trap_exit();
- rb_exec_end_proc();
- rb_gc_call_finalizer_at_exit();
+ int state;
+
+ PUSH_TAG(PROT_NONE);
+ if ((state = EXEC_TAG()) == 0) {
+ rb_trap_exit();
+ rb_exec_end_proc();
+ rb_gc_call_finalizer_at_exit();
+ }
+ POP_TAG();
}
void
@@ -3526,7 +3532,7 @@ rb_yield_0(val, self, klass, acheck)
if (!node) {
result = Qnil;
}
- else if (nd_type(node) == NODE_IFUNC) {
+ else if (nd_type(node) == NODE_CFUNC || nd_type(node) == NODE_IFUNC) {
if (val == Qundef) val = rb_ary_new2(0);
result = (*node->nd_cfnc)(val, node->nd_tval, self);
}
@@ -4417,6 +4423,9 @@ rb_call(klass, recv, mid, argc, argv, scope)
ID id = mid;
struct cache_entry *ent;
+ if (!klass) {
+ rb_raise(rb_eNotImpError, "method call on terminated obejct");
+ }
/* is it in the method cache? */
ent = cache + EXPR1(klass, mid);
if (ent->mid == mid && ent->klass == klass) {
@@ -6635,7 +6644,7 @@ rb_mod_define_method(argc, argv, mod)
if (RDATA(body)->dmark == (RUBY_DATA_FUNC)bm_mark) {
rb_add_method(mod, id, NEW_DMETHOD(method_unbind(body)), NOEX_PUBLIC);
}
- else if (RDATA(body)->dmark != (RUBY_DATA_FUNC)blk_mark) {
+ else if (RDATA(body)->dmark == (RUBY_DATA_FUNC)blk_mark) {
rb_add_method(mod, id, NEW_BMETHOD(body), NOEX_PUBLIC);
}
else {