ruby-changes:36316
From: nobu <ko1@a...>
Date: Thu, 13 Nov 2014 18:10:55 +0900 (JST)
Subject: [ruby-changes:36316] nobu:r48397 (trunk): proc.c: make lambda directly
nobu 2014-11-13 18:10:40 +0900 (Thu, 13 Nov 2014) New Revision: 48397 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48397 Log: proc.c: make lambda directly * vm.c (rb_vm_make_proc_lambda): similar to rb_vm_make_proc() with is_lambda argument. Modified files: trunk/ChangeLog trunk/proc.c trunk/vm.c trunk/vm_core.h Index: ChangeLog =================================================================== --- ChangeLog (revision 48396) +++ ChangeLog (revision 48397) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Nov 13 18:10:38 2014 Nobuyoshi Nakada <nobu@r...> + + * vm.c (rb_vm_make_proc_lambda): similar to rb_vm_make_proc() with + is_lambda argument. + Thu Nov 13 12:11:18 2014 NAKAMURA Usaku <usa@r...> * rb_w32_fstat{,i64}: speed up. adjuting timestamps in this function Index: vm_core.h =================================================================== --- vm_core.h (revision 48396) +++ vm_core.h (revision 48397) @@ -944,6 +944,7 @@ int rb_thread_method_id_and_class(rb_thr https://github.com/ruby/ruby/blob/trunk/vm_core.h#L944 VALUE rb_vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc, int argc, const VALUE *argv, const rb_block_t *blockptr); +VALUE rb_vm_make_proc_lambda(rb_thread_t *th, const rb_block_t *block, VALUE klass, int8_t is_lambda); VALUE rb_vm_make_proc(rb_thread_t *th, const rb_block_t *block, VALUE klass); VALUE rb_vm_make_binding(rb_thread_t *th, const rb_control_frame_t *src_cfp); VALUE rb_vm_make_env_object(rb_thread_t *th, rb_control_frame_t *cfp); Index: proc.c =================================================================== --- proc.c (revision 48396) +++ proc.c (revision 48397) @@ -566,10 +566,7 @@ proc_new(VALUE klass, int is_lambda) https://github.com/ruby/ruby/blob/trunk/proc.c#L566 rb_control_frame_t *cfp = th->cfp; rb_block_t *block; - if ((block = rb_vm_control_frame_block_ptr(cfp)) != 0) { - /* block found */ - } - else { + if (!(block = rb_vm_control_frame_block_ptr(cfp))) { cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp); if ((block = rb_vm_control_frame_block_ptr(cfp)) != 0) { @@ -596,13 +593,7 @@ proc_new(VALUE klass, int is_lambda) https://github.com/ruby/ruby/blob/trunk/proc.c#L593 } } - procval = rb_vm_make_proc(th, block, klass); - - if (is_lambda) { - rb_proc_t *proc; - GetProcPtr(procval, proc); - proc->is_lambda = TRUE; - } + procval = rb_vm_make_proc_lambda(th, block, klass, is_lambda); return procval; } Index: vm.c =================================================================== --- vm.c (revision 48396) +++ vm.c (revision 48397) @@ -663,6 +663,12 @@ rb_proc_alloc(VALUE klass, const rb_bloc https://github.com/ruby/ruby/blob/trunk/vm.c#L663 VALUE rb_vm_make_proc(rb_thread_t *th, const rb_block_t *block, VALUE klass) { + return rb_vm_make_proc_lambda(th, block, klass, 0); +} + +VALUE +rb_vm_make_proc_lambda(rb_thread_t *th, const rb_block_t *block, VALUE klass, int8_t is_lambda) +{ VALUE procval, envval, blockprocval = 0; rb_control_frame_t *cfp = RUBY_VM_GET_CFP_FROM_BLOCK_PTR(block); @@ -677,7 +683,7 @@ rb_vm_make_proc(rb_thread_t *th, const r https://github.com/ruby/ruby/blob/trunk/vm.c#L683 } procval = rb_proc_alloc(klass, block, envval, blockprocval, - (int8_t)th->safe_level, 0, 0); + (int8_t)th->safe_level, 0, is_lambda); if (VMDEBUG) { if (th->stack < block->ep && block->ep < th->stack + th->stack_size) { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/