mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
proc.c: make lambda directly
* vm.c (rb_vm_make_proc_lambda): similar to rb_vm_make_proc() with is_lambda argument. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
787b98e365
commit
2a754a7330
4 changed files with 15 additions and 12 deletions
|
@ -1,3 +1,8 @@
|
|||
Thu Nov 13 18:10:38 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* 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@ruby-lang.org>
|
||||
|
||||
* rb_w32_fstat{,i64}: speed up. adjuting timestamps in this function
|
||||
|
|
13
proc.c
13
proc.c
|
@ -566,10 +566,7 @@ proc_new(VALUE klass, int is_lambda)
|
|||
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)
|
|||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
8
vm.c
8
vm.c
|
@ -662,6 +662,12 @@ rb_proc_alloc(VALUE klass, const rb_block_t *block,
|
|||
|
||||
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 rb_block_t *block, VALUE klass)
|
|||
}
|
||||
|
||||
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) {
|
||||
|
|
|
@ -944,6 +944,7 @@ int rb_thread_method_id_and_class(rb_thread_t *th, ID *idp, VALUE *klassp);
|
|||
|
||||
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue