Skip to content

Commit

Permalink
removed implementation of rb_block_call
Browse files Browse the repository at this point in the history
should be ruby 1.9+ only. breaks compatibility, as
can be repro'd here:
https://github.com/sshao/repros/tree/39d2010/rb_block_iterate
  • Loading branch information
sshao committed Apr 9, 2015
1 parent 4666ce6 commit 360db07
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 39 deletions.
20 changes: 0 additions & 20 deletions vm/builtin/native_method.cpp
Expand Up @@ -573,26 +573,6 @@ namespace rubinius {
return env->get_object(ret);
}

case C_BLOCK_CALL: {
VALUE val;
VALUE ary[args.total()];
VALUE cb_data = env->get_handle(nm->get_ivar(state, state->symbol("cb_data")));

if(args.total() > 0) {
val = env->get_handle(args.get_argument(0));
} else {
val = env->get_handle(cNil);
}

for (std::size_t i = 0; i < args.total(); ++i) {
ary[i] = env->get_handle(args.get_argument(i));
}

VALUE ret = nm->func()(val, cb_data, args.total(), ary);

return env->get_object(ret);
}

case C_LAMBDA: {
VALUE cb_data = env->get_handle(nm->get_ivar(state, state->symbol("cb_data")));
VALUE val = env->get_handle(args.as_array(state));
Expand Down
1 change: 0 additions & 1 deletion vm/builtin/native_method.hpp
Expand Up @@ -253,7 +253,6 @@ namespace rubinius {
ITERATE_BLOCK = -98,
C_CALLBACK = -97,
C_LAMBDA = -96,
C_BLOCK_CALL = -95,
ARGS_IN_RUBY_ARRAY = -3,
RECEIVER_PLUS_ARGS_IN_RUBY_ARRAY = -2,
ARG_COUNT_ARGS_IN_C_ARRAY_PLUS_RECEIVER = -1
Expand Down
14 changes: 0 additions & 14 deletions vm/capi/capi.cpp
Expand Up @@ -617,20 +617,6 @@ extern "C" {
}
}

VALUE rb_block_call(VALUE obj, ID meth, int argc, VALUE* argv,
VALUE(*cb)(ANYARGS), VALUE cb_data) {
NativeMethodEnvironment* env = NativeMethodEnvironment::get();

if(cb) {
Proc* prc = capi::wrap_c_function((void*)cb, cb_data, C_BLOCK_CALL);
env->set_outgoing_block(env->get_handle(prc));
} else {
env->set_outgoing_block(env->get_handle(env->block()));
}

return rb_funcall2(obj, meth, argc, argv);
}

VALUE rb_apply(VALUE recv, ID mid, VALUE args) {
NativeMethodEnvironment* env = NativeMethodEnvironment::get();
env->flush_cached_data();
Expand Down
4 changes: 0 additions & 4 deletions vm/include/capi/ruby.h
Expand Up @@ -751,10 +751,6 @@ VALUE rb_uint2big(unsigned long number);
/* Converts implicit block into a new Proc. */
VALUE rb_block_proc();

typedef VALUE rb_block_call_func _((VALUE, VALUE));
VALUE rb_block_call(VALUE, ID, int, VALUE*, VALUE (*)(ANYARGS), VALUE);
#define HAVE_RB_BLOCK_CALL 1

VALUE rb_each(VALUE);

VALUE rb_iterate(VALUE (*ifunc)(VALUE), VALUE ary, VALUE(*cb)(ANYARGS), VALUE cb_data);
Expand Down

0 comments on commit 360db07

Please sign in to comment.