* vm_insnhelper.c (opt_eq_func): fix optimization bug. This issue
was found out and debugged with Takuto Hayashi at Security and Programming camp 2009. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c0ec326b7b
commit
a174dbcd4f
@ -1,3 +1,9 @@
|
|||||||
|
Sun Aug 16 03:06:59 2009 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
|
* vm_insnhelper.c (opt_eq_func): fix optimization bug. This issue
|
||||||
|
was found out and debugged with Takuto Hayashi at Security and
|
||||||
|
Programming camp 2009.
|
||||||
|
|
||||||
Sun Aug 16 01:10:00 2009 NARUSE, Yui <naruse@ruby-lang.org>
|
Sun Aug 16 01:10:00 2009 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* regparse.c (add_ctype_to_cc_by_range): fix the first
|
* regparse.c (add_ctype_to_cc_by_range): fix the first
|
||||||
|
@ -1547,16 +1547,9 @@ inline
|
|||||||
VALUE
|
VALUE
|
||||||
opt_eq_func(VALUE recv, VALUE obj, IC ic)
|
opt_eq_func(VALUE recv, VALUE obj, IC ic)
|
||||||
{
|
{
|
||||||
VALUE val = Qundef;
|
|
||||||
|
|
||||||
if (FIXNUM_2_P(recv, obj) &&
|
if (FIXNUM_2_P(recv, obj) &&
|
||||||
BASIC_OP_UNREDEFINED_P(BOP_EQ)) {
|
BASIC_OP_UNREDEFINED_P(BOP_EQ)) {
|
||||||
if (recv == obj) {
|
return (recv == obj) ? Qtrue : Qfalse;
|
||||||
val = Qtrue;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
val = Qfalse;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) {
|
else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) {
|
||||||
if (HEAP_CLASS_OF(recv) == rb_cFloat &&
|
if (HEAP_CLASS_OF(recv) == rb_cFloat &&
|
||||||
@ -1566,21 +1559,18 @@ opt_eq_func(VALUE recv, VALUE obj, IC ic)
|
|||||||
double b = RFLOAT_VALUE(obj);
|
double b = RFLOAT_VALUE(obj);
|
||||||
|
|
||||||
if (isnan(a) || isnan(b)) {
|
if (isnan(a) || isnan(b)) {
|
||||||
val = Qfalse;
|
return Qfalse;
|
||||||
}
|
|
||||||
else if (a == b) {
|
|
||||||
val = Qtrue;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
val = Qfalse;
|
|
||||||
}
|
}
|
||||||
|
return (a == b) ? Qtrue : Qfalse;
|
||||||
}
|
}
|
||||||
else if (HEAP_CLASS_OF(recv) == rb_cString &&
|
else if (HEAP_CLASS_OF(recv) == rb_cString &&
|
||||||
HEAP_CLASS_OF(obj) == rb_cString &&
|
HEAP_CLASS_OF(obj) == rb_cString &&
|
||||||
BASIC_OP_UNREDEFINED_P(BOP_EQ)) {
|
BASIC_OP_UNREDEFINED_P(BOP_EQ)) {
|
||||||
val = rb_str_equal(recv, obj);
|
return rb_str_equal(recv, obj);
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
|
|
||||||
|
{
|
||||||
const rb_method_entry_t *me = vm_method_search(idEq, CLASS_OF(recv), ic);
|
const rb_method_entry_t *me = vm_method_search(idEq, CLASS_OF(recv), ic);
|
||||||
extern VALUE rb_obj_equal(VALUE obj1, VALUE obj2);
|
extern VALUE rb_obj_equal(VALUE obj1, VALUE obj2);
|
||||||
|
|
||||||
@ -1588,9 +1578,8 @@ opt_eq_func(VALUE recv, VALUE obj, IC ic)
|
|||||||
return recv == obj ? Qtrue : Qfalse;
|
return recv == obj ? Qtrue : Qfalse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return val;
|
return Qundef;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct opt_case_dispatch_i_arg {
|
struct opt_case_dispatch_i_arg {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user