[macruby-changes] [3429] MacRuby/trunk/object.c
source_changes at macosforge.org
source_changes at macosforge.org
Wed Feb 3 18:10:08 PST 2010
Revision: 3429
http://trac.macosforge.org/projects/ruby/changeset/3429
Author: lsansonetti at apple.com
Date: 2010-02-03 18:10:07 -0800 (Wed, 03 Feb 2010)
Log Message:
-----------
faster rb_eql()
Modified Paths:
--------------
MacRuby/trunk/object.c
Modified: MacRuby/trunk/object.c
===================================================================
--- MacRuby/trunk/object.c 2010-02-04 02:09:52 UTC (rev 3428)
+++ MacRuby/trunk/object.c 2010-02-04 02:10:07 UTC (rev 3429)
@@ -35,8 +35,11 @@
VALUE rb_cTrueClass;
VALUE rb_cFalseClass;
-static ID id_eq, id_eql, id_match, id_inspect, id_init_copy;
+static ID id_eq, id_match, id_inspect, id_init_copy;
+static SEL eqlSel = 0;
+static void *eqlCache = NULL;
+
static void *allocCache = NULL;
static void *initializeCache = NULL;
static void *initialize2Cache = NULL;
@@ -82,7 +85,7 @@
int
rb_eql(VALUE obj1, VALUE obj2)
{
- return RTEST(rb_funcall(obj1, id_eql, 1, obj2));
+ return RTEST(rb_vm_call_with_cache(eqlCache, obj1, eqlSel, 1, &obj2));
}
/*
@@ -2947,6 +2950,8 @@
initialize2Cache = rb_vm_get_call_cache(selInitialize2);
eqCache = rb_vm_get_call_cache(selEq);
dupCache = rb_vm_get_call_cache(selDup);
+ eqlSel = sel_registerName("eql?:");
+ eqlCache = rb_vm_get_call_cache(eqlSel);
rb_objc_define_method(*(VALUE *)rb_cModule, "alloc", rb_module_s_alloc, 0);
rb_objc_define_method(*(VALUE *)rb_cClass, "alloc", rb_class_s_alloc, 0);
@@ -3142,7 +3147,6 @@
rb_define_global_const("FALSE", Qfalse);
id_eq = rb_intern("==");
- id_eql = rb_intern("eql?");
id_match = rb_intern("=~");
id_inspect = rb_intern("inspect");
id_init_copy = rb_intern("initialize_copy");
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100203/f4458962/attachment.html>
More information about the macruby-changes
mailing list