* 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:
nobu 2013-05-01 02:38:44 +00:00
Родитель c322f10ad9
Коммит 9644f9b572
4 изменённых файлов: 18 добавлений и 6 удалений

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

@ -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> Tue Apr 30 23:18:00 2013 Zachary Scott <zachary@zacharyscott.net>
* lib/benchmark.rb: Update Benchmark results on newer CPU * lib/benchmark.rb: Update Benchmark results on newer CPU

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

@ -7,6 +7,7 @@ firstline, predefined = __LINE__+1, %[\
gets gets
succ succ
each each
proc
lambda lambda
send send
__send__ __send__
@ -48,7 +49,10 @@ const_ids = []
class_ids = [] class_ids = []
names = {} names = {}
predefined.split(/^/).each_with_index do |line, num| 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 token ||= name
if /#/ =~ token if /#/ =~ token
token = "_#{token.gsub(/\W+/, '_')}" token = "_#{token.gsub(/\W+/, '_')}"

6
proc.c
Просмотреть файл

@ -946,7 +946,7 @@ mnew(VALUE klass, VALUE obj, ID id, VALUE mclass, int scope)
again: again:
me = rb_method_entry_without_refinements(klass, id, &defined_class); me = rb_method_entry_without_refinements(klass, id, &defined_class);
if (UNDEFINED_METHOD_ENTRY_P(me)) { if (UNDEFINED_METHOD_ENTRY_P(me)) {
ID rmiss = rb_intern("respond_to_missing?"); ID rmiss = idRespond_to_missing;
VALUE sym = ID2SYM(id); VALUE sym = ID2SYM(id);
if (obj != Qundef && !rb_method_basic_definition_p(klass, rmiss)) { if (obj != Qundef && !rb_method_basic_definition_p(klass, rmiss)) {
@ -2000,13 +2000,13 @@ method_inspect(VALUE method)
static VALUE static VALUE
mproc(VALUE method) mproc(VALUE method)
{ {
return rb_funcall2(rb_mRubyVMFrozenCore, rb_intern("proc"), 0, 0); return rb_funcall2(rb_mRubyVMFrozenCore, idProc, 0, 0);
} }
static VALUE static VALUE
mlambda(VALUE method) mlambda(VALUE method)
{ {
return rb_funcall(rb_mRubyVMFrozenCore, rb_intern("lambda"), 0, 0); return rb_funcall(rb_mRubyVMFrozenCore, idLambda, 0, 0);
} }
static VALUE static VALUE

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_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_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_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_id(klass, idProc, rb_block_proc, 0);
rb_define_method(klass, "lambda", rb_block_lambda, 0); rb_define_method_id(klass, idLambda, rb_block_lambda, 0);
rb_obj_freeze(fcore); rb_obj_freeze(fcore);
rb_gc_register_mark_object(fcore); rb_gc_register_mark_object(fcore);
rb_mRubyVMFrozenCore = fcore; rb_mRubyVMFrozenCore = fcore;