зеркало из https://github.com/github/ruby.git
proc.c: use predefined IDs
* defs/id.def (predefined): add "idProc". * proc.c (mnew, mproc, mlambda): use predefined IDs. * vm.c (Init_VM): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
c322f10ad9
Коммит
9644f9b572
|
@ -1,3 +1,11 @@
|
|||
Wed May 1 11:38:37 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* defs/id.def (predefined): add "idProc".
|
||||
|
||||
* proc.c (mnew, mproc, mlambda): use predefined IDs.
|
||||
|
||||
* vm.c (Init_VM): ditto.
|
||||
|
||||
Tue Apr 30 23:18:00 2013 Zachary Scott <zachary@zacharyscott.net>
|
||||
|
||||
* lib/benchmark.rb: Update Benchmark results on newer CPU
|
||||
|
|
|
@ -7,6 +7,7 @@ firstline, predefined = __LINE__+1, %[\
|
|||
gets
|
||||
succ
|
||||
each
|
||||
proc
|
||||
lambda
|
||||
send
|
||||
__send__
|
||||
|
@ -48,7 +49,10 @@ const_ids = []
|
|||
class_ids = []
|
||||
names = {}
|
||||
predefined.split(/^/).each_with_index do |line, num|
|
||||
next if /^#/ =~ line or (name, token = line.split; !name)
|
||||
next if /^#/ =~ line
|
||||
line.sub!(/\s+#.*/, '')
|
||||
name, token = line.split
|
||||
next unless name
|
||||
token ||= name
|
||||
if /#/ =~ token
|
||||
token = "_#{token.gsub(/\W+/, '_')}"
|
||||
|
|
6
proc.c
6
proc.c
|
@ -946,7 +946,7 @@ mnew(VALUE klass, VALUE obj, ID id, VALUE mclass, int scope)
|
|||
again:
|
||||
me = rb_method_entry_without_refinements(klass, id, &defined_class);
|
||||
if (UNDEFINED_METHOD_ENTRY_P(me)) {
|
||||
ID rmiss = rb_intern("respond_to_missing?");
|
||||
ID rmiss = idRespond_to_missing;
|
||||
VALUE sym = ID2SYM(id);
|
||||
|
||||
if (obj != Qundef && !rb_method_basic_definition_p(klass, rmiss)) {
|
||||
|
@ -2000,13 +2000,13 @@ method_inspect(VALUE method)
|
|||
static VALUE
|
||||
mproc(VALUE method)
|
||||
{
|
||||
return rb_funcall2(rb_mRubyVMFrozenCore, rb_intern("proc"), 0, 0);
|
||||
return rb_funcall2(rb_mRubyVMFrozenCore, idProc, 0, 0);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
mlambda(VALUE method)
|
||||
{
|
||||
return rb_funcall(rb_mRubyVMFrozenCore, rb_intern("lambda"), 0, 0);
|
||||
return rb_funcall(rb_mRubyVMFrozenCore, idLambda, 0, 0);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
|
4
vm.c
4
vm.c
|
@ -2258,8 +2258,8 @@ Init_VM(void)
|
|||
rb_define_method_id(klass, id_core_hash_merge_ary, m_core_hash_merge_ary, 2);
|
||||
rb_define_method_id(klass, id_core_hash_merge_ptr, m_core_hash_merge_ptr, -1);
|
||||
rb_define_method_id(klass, id_core_hash_merge_kwd, m_core_hash_merge_kwd, 2);
|
||||
rb_define_method(klass, "proc", rb_block_proc, 0);
|
||||
rb_define_method(klass, "lambda", rb_block_lambda, 0);
|
||||
rb_define_method_id(klass, idProc, rb_block_proc, 0);
|
||||
rb_define_method_id(klass, idLambda, rb_block_lambda, 0);
|
||||
rb_obj_freeze(fcore);
|
||||
rb_gc_register_mark_object(fcore);
|
||||
rb_mRubyVMFrozenCore = fcore;
|
||||
|
|
Загрузка…
Ссылка в новой задаче