* eval.c (rb_clear_cache_by_class): check both klass and origin.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2003-07-17 08:58:16 +00:00
Родитель 9a27cf9499
Коммит 8cee72d5c6
5 изменённых файлов: 38 добавлений и 33 удалений

Просмотреть файл

@ -1,3 +1,7 @@
Thu Jul 17 17:57:32 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_clear_cache_by_class): check both klass and origin.
Thu Jul 17 13:46:25 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (ruby_init): set ruby_running to true after

41
eval.c
Просмотреть файл

@ -256,7 +256,7 @@ rb_clear_cache_by_class(klass)
if (!ruby_running) return;
ent = cache; end = ent + CACHE_SIZE;
while (ent < end) {
if (ent->origin == klass) {
if (ent->klass == klass || ent->origin == klass) {
ent->mid = 0;
}
ent++;
@ -365,6 +365,7 @@ rb_get_method_body(klassp, idp, noexp)
if (ruby_running) {
/* store in cache */
if (BUILTIN_TYPE(origin) == T_ICLASS) origin = RBASIC(origin)->klass;
ent = cache + EXPR1(klass, id);
ent->klass = klass;
ent->noex = body->nd_noex;
@ -949,6 +950,8 @@ static VALUE rb_yield_0 _((VALUE, VALUE, VALUE, int, int));
#define YIELD_PROC_CALL 1
#define YIELD_PUBLIC_DEF 2
#define YIELD_FUNC_AVALUE 1
#define YIELD_FUNC_SVALUE 2
static VALUE rb_call _((VALUE,VALUE,ID,int,const VALUE*,int));
static VALUE module_setup _((VALUE,NODE*));
@ -4121,7 +4124,18 @@ rb_yield_0(val, self, klass, flags, avalue)
result = Qnil;
}
else if (nd_type(node) == NODE_CFUNC || nd_type(node) == NODE_IFUNC) {
if (avalue) val = avalue_to_svalue(val);
if (node->nd_state == YIELD_FUNC_AVALUE) {
if (!avalue) {
val = svalue_to_avalue(val);
}
}
else {
if (avalue) {
val = avalue_to_svalue(val);
}
if (val == Qundef && node->nd_state != YIELD_FUNC_SVALUE)
val = Qnil;
}
result = (*node->nd_cfnc)(val, node->nd_tval, self);
}
else {
@ -7557,24 +7571,17 @@ struct proc_funcall_data {
VALUE val;
};
static VALUE
proc_funcall(args, data)
VALUE args;
struct proc_funcall_data *data;
{
return (*data->func)(svalue_to_avalue(args), data->val);
}
VALUE
rb_proc_new(func, val)
VALUE (*func)(ANYARGS); /* VALUE yieldarg[, VALUE procarg] */
VALUE val;
{
struct proc_funcall_data data;
struct BLOCK *data;
VALUE proc = rb_iterate((VALUE(*)_((VALUE)))mproc, 0, func, val);
data.func = func;
data.val = val;
return rb_iterate((VALUE(*)_((VALUE)))mproc, 0, proc_funcall, (VALUE)&data);
Data_Get_Struct(proc, struct BLOCK, data);
data->body->nd_state = YIELD_FUNC_AVALUE;
return proc;
}
static VALUE
@ -10061,12 +10068,12 @@ catch_i(tag)
}
VALUE
rb_catch(tag, proc, data)
rb_catch(tag, func, data)
const char *tag;
VALUE (*proc)();
VALUE (*func)();
VALUE data;
{
return rb_iterate((VALUE(*)_((VALUE)))catch_i, rb_intern(tag), proc, data);
return rb_iterate((VALUE(*)_((VALUE)))catch_i, rb_intern(tag), func, data);
}
static VALUE

1
gc.c
Просмотреть файл

@ -1109,7 +1109,6 @@ obj_free(obj)
}
break;
case T_ICLASS:
rb_clear_cache_by_class((VALUE)obj);
/* iClass shares table with the module */
break;

Просмотреть файл

@ -411,19 +411,18 @@ end
class Fixnum
alias power! **
unless defined? 1.power!
alias power! **
p [__FILE__, defined? 1.power!]
end
# Redefined to handle a Complex argument.
def ** (other)
if self < 0
Complex.new!(self, 0) ** other
else
if defined? Rational
if other >= 0
self.power!(other)
else
Rational.new!(self,1)**other
end
if defined? self.rpower
self.rpower(other)
else
self.power!(other)
end
@ -597,7 +596,6 @@ module Math
end
# Documentation comments:
# - source: original (researched from pickaxe)
# - a couple of fixme's

Просмотреть файл

@ -329,10 +329,6 @@ class Integer
end
class Fixnum
unless defined? Complex
alias power! **;
end
undef quo
def quo(other)
Rational.new!(self,1) / other
@ -346,8 +342,9 @@ class Fixnum
Rational.new!(self,1)**other
end
end
unless defined? Complex
unless defined? 1.power!
alias power! **
alias ** rpower
end
end