[前][次][番号順一覧][スレッド一覧]

ruby-changes:28478

From: nobu <ko1@a...>
Date: Wed, 1 May 2013 11:39:04 +0900 (JST)
Subject: [ruby-changes:28478] nobu:r40530 (trunk): proc.c: use predefined IDs

nobu	2013-05-01 11:38:44 +0900 (Wed, 01 May 2013)

  New Revision: 40530

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40530

  Log:
    proc.c: use predefined IDs
    
    * defs/id.def (predefined): add "idProc".
    * proc.c (mnew, mproc, mlambda): use predefined IDs.
    * vm.c (Init_VM): ditto.

  Modified files:
    trunk/ChangeLog
    trunk/defs/id.def
    trunk/proc.c
    trunk/vm.c

Index: defs/id.def
===================================================================
--- defs/id.def	(revision 40529)
+++ defs/id.def	(revision 40530)
@@ -7,6 +7,7 @@ firstline, predefined = __LINE__+1, %[\ https://github.com/ruby/ruby/blob/trunk/defs/id.def#L7
   gets
   succ
   each
+  proc
   lambda
   send
   __send__
@@ -48,7 +49,10 @@ const_ids = [] https://github.com/ruby/ruby/blob/trunk/defs/id.def#L49
 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+/, '_')}"
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 40529)
+++ ChangeLog	(revision 40530)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed May  1 11:38:37 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* 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@z...>
 
 	* lib/benchmark.rb: Update Benchmark results on newer CPU
Index: proc.c
===================================================================
--- proc.c	(revision 40529)
+++ proc.c	(revision 40530)
@@ -946,7 +946,7 @@ mnew(VALUE klass, VALUE obj, ID id, VALU https://github.com/ruby/ruby/blob/trunk/proc.c#L946
   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) https://github.com/ruby/ruby/blob/trunk/proc.c#L2000
 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
Index: vm.c
===================================================================
--- vm.c	(revision 40529)
+++ vm.c	(revision 40530)
@@ -2258,8 +2258,8 @@ Init_VM(void) https://github.com/ruby/ruby/blob/trunk/vm.c#L2258
     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;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]