Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rubinius/rubinius
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: be8cdcc990f1
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 360db0768d74
Choose a head ref
  • 2 commits
  • 8 files changed
  • 1 contributor

Commits on Apr 9, 2015

  1. Copy the full SHA
    4666ce6 View commit details
  2. removed implementation of rb_block_call

    should be ruby 1.9+ only. breaks compatibility, as
    can be repro'd here:
    https://github.com/sshao/repros/tree/39d2010/rb_block_iterate
    sshao committed Apr 9, 2015
    Copy the full SHA
    360db07 View commit details
43 changes: 0 additions & 43 deletions spec/ruby/optional/capi/ext/kernel_spec.c
Original file line number Diff line number Diff line change
@@ -32,41 +32,6 @@ VALUE kernel_spec_rb_block_proc(VALUE self) {
}
#endif

#ifdef HAVE_RB_BLOCK_CALL

VALUE block_call_inject(VALUE yield_value, VALUE data2) {
/* yield_value yields the first block argument */
VALUE elem = yield_value;
VALUE elem_incr = INT2FIX(FIX2INT(elem) + 1);
return elem_incr;
}

VALUE kernel_spec_rb_block_call(VALUE self, VALUE ary) {
return rb_block_call(ary, rb_intern("map"), 0, NULL, block_call_inject, Qnil);
}

#ifdef RUBY_VERSION_IS_1_9
VALUE block_call_inject_multi_arg(VALUE yield_value, VALUE data2, int argc, VALUE argv[]) {
/* yield_value yields the first block argument */
VALUE sum = yield_value;
VALUE elem = argv[1];

return INT2FIX(FIX2INT(sum) + FIX2INT(elem));
}

VALUE kernel_spec_rb_block_call_multi_arg(VALUE self, VALUE ary) {
VALUE method_args[1];
method_args[0] = INT2FIX(0);
return rb_block_call(ary, rb_intern("inject"), 1, method_args, block_call_inject_multi_arg, Qnil);
}

VALUE kernel_spec_rb_block_call_no_func(VALUE self, VALUE ary) {
return rb_block_call(ary, rb_intern("map"), 0, NULL, NULL, Qnil);
}

#endif
#endif

#ifdef HAVE_RB_ENSURE
VALUE kernel_spec_rb_ensure(VALUE self, VALUE main_proc, VALUE arg,
VALUE ensure_proc, VALUE arg2) {
@@ -306,14 +271,6 @@ void Init_kernel_spec() {
rb_define_method(cls, "rb_need_block", kernel_spec_rb_need_block, 0);
#endif

#ifdef HAVE_RB_BLOCK_CALL
rb_define_method(cls, "rb_block_call", kernel_spec_rb_block_call, 1);
#ifdef RUBY_VERSION_IS_1_9
rb_define_method(cls, "rb_block_call_multi_arg", kernel_spec_rb_block_call_multi_arg, 1);
rb_define_method(cls, "rb_block_call_no_func", kernel_spec_rb_block_call_no_func, 1);
#endif
#endif

#ifdef HAVE_RB_BLOCK_PROC
rb_define_method(cls, "rb_block_proc", kernel_spec_rb_block_proc, 0);
#endif
1 change: 0 additions & 1 deletion spec/ruby/optional/capi/ext/mri.h
Original file line number Diff line number Diff line change
@@ -18,7 +18,6 @@
#undef HAVE_RBIGNUM_POSITIVE_P
#undef HAVE_RBIGNUM_NEGATIVE_P
#undef HAVE_RB_STR_SET_LEN
#undef HAVE_RB_BLOCK_CALL
#undef HAVE_RB_OBJ_METHOD
#endif

1 change: 0 additions & 1 deletion spec/ruby/optional/capi/ext/rubyspec.h
Original file line number Diff line number Diff line change
@@ -343,7 +343,6 @@
/* Kernel */
#define HAVE_RB_BLOCK_GIVEN_P 1
#define HAVE_RB_BLOCK_PROC 1
#define HAVE_RB_BLOCK_CALL 1
#define HAVE_RB_ENSURE 1
#define HAVE_RB_EVAL_STRING 1
#define HAVE_RB_EVAL_STRING_WRAP 1
11 changes: 0 additions & 11 deletions spec/ruby/optional/capi/kernel_spec.rb
Original file line number Diff line number Diff line change
@@ -27,17 +27,6 @@
end
end

describe "rb_block_call" do
before :each do
ScratchPad.record []
end

it "calls the block with a single argument" do
ary = [1, 3, 5]
@s.rb_block_call(ary).should == [2, 4, 6]
end
end

describe "rb_raise" do
it "raises an exception" do
lambda { @s.rb_raise({}) }.should raise_error(TypeError)
20 changes: 0 additions & 20 deletions vm/builtin/native_method.cpp
Original file line number Diff line number Diff line change
@@ -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));
1 change: 0 additions & 1 deletion vm/builtin/native_method.hpp
Original file line number Diff line number Diff line change
@@ -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
14 changes: 0 additions & 14 deletions vm/capi/capi.cpp
Original file line number Diff line number Diff line change
@@ -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();
4 changes: 0 additions & 4 deletions vm/include/capi/ruby.h
Original file line number Diff line number Diff line change
@@ -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);