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

ruby-changes:48680

From: ko1 <ko1@a...>
Date: Thu, 16 Nov 2017 16:25:39 +0900 (JST)
Subject: [ruby-changes:48680] ko1:r60796 (trunk): provide rb_vm_make_proc/lambda().

ko1	2017-11-16 16:25:30 +0900 (Thu, 16 Nov 2017)

  New Revision: 60796

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60796

  Log:
    provide rb_vm_make_proc/lambda().
    
    * vm.c (rb_vm_make_proc): removed.
    
    * vm_core.h: provide utility inline functions
      * rb_vm_make_proc()
      * rb_vm_make_lambda()
      to call rb_vm_make_proc_lambda().

  Modified files:
    trunk/proc.c
    trunk/vm.c
    trunk/vm_core.h
Index: vm_core.h
===================================================================
--- vm_core.h	(revision 60795)
+++ vm_core.h	(revision 60796)
@@ -1498,8 +1498,20 @@ int rb_ec_frame_method_id_and_class(cons https://github.com/ruby/ruby/blob/trunk/vm_core.h#L1498
 void rb_ec_setup_exception(const rb_execution_context_t *ec, VALUE mesg, VALUE cause);
 
 VALUE rb_vm_invoke_proc(rb_execution_context_t *ec, rb_proc_t *proc, int argc, const VALUE *argv, VALUE block_handler);
+
 VALUE rb_vm_make_proc_lambda(const rb_execution_context_t *ec, const struct rb_captured_block *captured, VALUE klass, int8_t is_lambda);
-VALUE rb_vm_make_proc(const rb_execution_context_t *ec, const struct rb_captured_block *captured, VALUE klass);
+static inline VALUE
+rb_vm_make_proc(const rb_execution_context_t *ec, const struct rb_captured_block *captured, VALUE klass)
+{
+    return rb_vm_make_proc_lambda(ec, captured, klass, 0);
+}
+
+static inline VALUE
+rb_vm_make_lambda(const rb_execution_context_t *ec, const struct rb_captured_block *captured, VALUE klass)
+{
+    return rb_vm_make_proc_lambda(ec, captured, klass, 1);
+}
+
 VALUE rb_vm_make_binding(const rb_execution_context_t *ec, const rb_control_frame_t *src_cfp);
 VALUE rb_vm_env_local_variables(const rb_env_t *env);
 const rb_env_t *rb_vm_env_prev_env(const rb_env_t *env);
Index: proc.c
===================================================================
--- proc.c	(revision 60795)
+++ proc.c	(revision 60796)
@@ -1921,7 +1921,7 @@ rb_mod_define_method(int argc, VALUE *ar https://github.com/ruby/ruby/blob/trunk/proc.c#L1921
 	    break;
 	  case block_handler_type_iseq:
 	  case block_handler_type_ifunc:
-	    body = rb_vm_make_proc_lambda(ec, VM_BH_TO_CAPT_BLOCK(block_handler), rb_cProc, TRUE);
+	    body = rb_vm_make_lambda(ec, VM_BH_TO_CAPT_BLOCK(block_handler), rb_cProc);
 	}
 #endif
     }
Index: vm.c
===================================================================
--- vm.c	(revision 60795)
+++ vm.c	(revision 60796)
@@ -866,12 +866,6 @@ rb_proc_create(VALUE klass, const struct https://github.com/ruby/ruby/blob/trunk/vm.c#L866
 }
 
 VALUE
-rb_vm_make_proc(const rb_execution_context_t *ec, const struct rb_captured_block *captured, VALUE klass)
-{
-    return rb_vm_make_proc_lambda(ec, captured, klass, FALSE);
-}
-
-VALUE
 rb_vm_make_proc_lambda(const rb_execution_context_t *ec, const struct rb_captured_block *captured, VALUE klass, int8_t is_lambda)
 {
     VALUE procval;

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

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