diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-11-16 07:25:30 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-11-16 07:25:30 +0000 |
commit | 0017143d2f0521a893bc9e00a30e3c17eea8c21a (patch) | |
tree | c1d8b00efd5bcf65459867264a9420a0ac036e27 | |
parent | 43ebe9bfd993537fd75c5263022f0340cc0193a5 (diff) | |
download | ruby-0017143d2f0521a893bc9e00a30e3c17eea8c21a.tar.gz |
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().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | proc.c | 2 | ||||
-rw-r--r-- | vm.c | 6 | ||||
-rw-r--r-- | vm_core.h | 14 |
3 files changed, 14 insertions, 8 deletions
@@ -1921,7 +1921,7 @@ rb_mod_define_method(int argc, VALUE *argv, VALUE mod) 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 } @@ -866,12 +866,6 @@ rb_proc_create(VALUE klass, const struct rb_block *block, } 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; @@ -1498,8 +1498,20 @@ int rb_ec_frame_method_id_and_class(const rb_execution_context_t *ec, ID *idp, I 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); |