Skip to content

Commit 33c4672

Browse files
committedMar 14, 2016
Removed remaining CallFrame passing.
1 parent 662b431 commit 33c4672

24 files changed

+89
-111
lines changed
 

Diff for: ‎machine/builtin/array.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ namespace rubinius {
140140
}
141141

142142
if(CBOOL(value->respond_to(state, G(sym_to_ary), cTrue))) {
143-
Object* res = value->send(state, state->vm()->call_frame(), G(sym_to_ary));
143+
Object* res = value->send(state, G(sym_to_ary));
144144
if(!res) return 0;
145145

146146
if(Array* ary = try_as<Array>(res)) {

Diff for: ‎machine/builtin/autoload.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace rubinius {
1818
Autoload* self = this;
1919
OnStack<2> os(state, self, under);
2020

21-
Object* res = send(state, state->vm()->call_frame(), state->symbol("resolve"));
21+
Object* res = send(state, state->symbol("resolve"));
2222
if(!res) return NULL;
2323

2424
if(CBOOL(res) || !honor_require) {
@@ -39,7 +39,7 @@ namespace rubinius {
3939
Autoload* self = this;
4040
OnStack<1> os(state, self);
4141

42-
Object* res = send(state, state->vm()->call_frame(), state->symbol("resolve"));
42+
Object* res = send(state, state->symbol("resolve"));
4343
if(!res) return NULL;
4444

4545
if(CBOOL(res) || !honor_require) {

Diff for: ‎machine/builtin/block_environment.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ namespace rubinius {
226226
*/
227227
Memory::GCInhibit inhibitor(state);
228228

229-
if(!(obj = obj->send(state, state->vm()->call_frame(), G(sym_to_ary)))) {
229+
if(!(obj = obj->send(state, G(sym_to_ary)))) {
230230
return false;
231231
}
232232
}
@@ -286,7 +286,7 @@ namespace rubinius {
286286
*/
287287
Memory::GCInhibit inhibitor(state);
288288

289-
kw_result = dispatch.send(state, state->vm()->call_frame(), args);
289+
kw_result = dispatch.send(state, args);
290290
}
291291

292292
if(kw_result) {

Diff for: ‎machine/builtin/call_site.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ namespace rubinius {
5757
*/
5858
Memory::GCInhibit inhibitor(state);
5959

60-
ret = G(rubinius)->send(state, state->vm()->call_frame(),
61-
state->symbol("bind_call"), ary);
60+
ret = G(rubinius)->send(state, state->symbol("bind_call"), ary);
6261
}
6362

6463
if(CallUnit* cu = try_as<CallUnit>(ret)) {

Diff for: ‎machine/builtin/executable.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ namespace rubinius {
5757

5858
Dispatch dispatch(G(sym_call));
5959

60-
return dispatch.send(state, state->vm()->call_frame(), args);
60+
return dispatch.send(state, args);
6161
}
6262

6363
void Executable::add_inliner(STATE, Memory* om, CompiledCode* code) {

Diff for: ‎machine/builtin/fiber.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ namespace rubinius {
6363
vm->set_current_fiber(fib);
6464

6565
Array* result = nil<Array>();
66-
Object* obj = fib->starter()->send(state, NULL, G(sym_call), fib->value(), cNil, false);
66+
Object* obj = fib->starter()->send(state, G(sym_call), fib->value(), cNil, false);
6767

6868
// GC has run! Don't use stack vars!
6969

Diff for: ‎machine/builtin/find_object.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,7 @@ namespace rubinius {
287287
ary->append(state, obj);
288288
} else {
289289
args->set(state, 0, obj);
290-
ret = callable->send(state, state->vm()->call_frame(), G(sym_call),
291-
args, cNil, false);
290+
ret = callable->send(state, G(sym_call), args, cNil, false);
292291
}
293292

294293
delete condition;
@@ -330,8 +329,7 @@ namespace rubinius {
330329
memory::VariableRootBuffer vrb(state->vm()->current_root_buffers(),
331330
variable_buffer, stack_size);
332331
args->set(state, 0, obj);
333-
ret = callable->send(state, state->vm()->call_frame(), G(sym_call),
334-
args, cNil, false);
332+
ret = callable->send(state, G(sym_call), args, cNil, false);
335333
if(!ret) break;
336334
}
337335
}

Diff for: ‎machine/builtin/native_function.cpp

+6-11
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ namespace rubinius {
403403
ary->set(state, 0, Fixnum::from(*(int*)parameters[i]));
404404

405405
Object* result = stub->args_info[i].enum_obj->send(state,
406-
env->current_call_frame(), state->symbol("symbol"), ary);
406+
state->symbol("symbol"), ary);
407407

408408
if(!result) {
409409
utilities::logger::error("Exception raised by callback, ignoring");
@@ -478,8 +478,7 @@ namespace rubinius {
478478
}
479479
}
480480

481-
Object* obj = stub->callable->send(
482-
state, env->current_call_frame(), G(sym_call), args);
481+
Object* obj = stub->callable->send(state, G(sym_call), args);
483482

484483
// Ug. An exception is being raised...
485484
if(!obj) {
@@ -556,8 +555,7 @@ namespace rubinius {
556555
Array* ary = Array::create(state, 1);
557556
ary->set(state, 0, obj);
558557

559-
Object* value = stub->ret_info.enum_obj->send(
560-
state, env->current_call_frame(), state->symbol("[]"), ary);
558+
Object* value = stub->ret_info.enum_obj->send(state, state->symbol("[]"), ary);
561559

562560
if(!value) {
563561
// For now, log the error and return nil.
@@ -922,8 +920,7 @@ namespace rubinius {
922920
heap_allocations[ffi_index] = data;
923921
*tmp = data;
924922
} else if(CBOOL(obj->respond_to(state, state->symbol("to_ptr"), cTrue))) {
925-
Object* o2 = obj->send(state,
926-
state->vm()->call_frame(), state->symbol("to_ptr"));
923+
Object* o2 = obj->send(state, state->symbol("to_ptr"));
927924
if(!o2) {
928925
for(size_t i = 0; i < arg_count; i++) {
929926
if(heap_allocations[i]) {
@@ -953,8 +950,7 @@ namespace rubinius {
953950
Array* ary = Array::create(state, 1);
954951
ary->set(state, 0, obj);
955952

956-
Object* val = arg_info->enum_obj->send(
957-
state, state->vm()->call_frame(), state->symbol("[]"), ary);
953+
Object* val = arg_info->enum_obj->send(state, state->symbol("[]"), ary);
958954

959955
if(!val) {
960956
for(size_t i = 0; i < arg_count; i++) {
@@ -1149,8 +1145,7 @@ namespace rubinius {
11491145
Array* ary = Array::create(state, 1);
11501146
ary->set(state, 0, Integer::from(state, (native_int)result));
11511147

1152-
ret = ffi_data->ret_info.enum_obj->send(state,
1153-
state->vm()->call_frame(), state->symbol("symbol"), ary);
1148+
ret = ffi_data->ret_info.enum_obj->send(state, state->symbol("symbol"), ary);
11541149
break;
11551150
}
11561151
case RBX_FFI_TYPE_CALLBACK: {

Diff for: ‎machine/builtin/object.cpp

+23-23
Original file line numberDiff line numberDiff line change
@@ -518,9 +518,7 @@ namespace rubinius {
518518
return class_object(state);
519519
}
520520

521-
Object* Object::send(STATE, CallFrame* caller, Symbol* name, Array* ary,
522-
Object* block, bool allow_private)
523-
{
521+
Object* Object::send(STATE, Symbol* name, Array* ary, Object* block, bool allow_private) {
524522
LookupData lookup(this, this->lookup_begin(state),
525523
allow_private ? G(sym_private) : G(sym_protected));
526524
Dispatch dispatch(name);
@@ -529,10 +527,10 @@ namespace rubinius {
529527
args.set_block(block);
530528
args.set_recv(this);
531529

532-
return dispatch.send(state, caller, lookup, args);
530+
return dispatch.send(state, lookup, args);
533531
}
534532

535-
Object* Object::send(STATE, CallFrame* caller, Symbol* name, bool allow_private) {
533+
Object* Object::send(STATE, Symbol* name, bool allow_private) {
536534
LookupData lookup(this, this->lookup_begin(state),
537535
allow_private ? G(sym_private) : G(sym_protected));
538536
Dispatch dispatch(name);
@@ -541,26 +539,28 @@ namespace rubinius {
541539
args.set_block(cNil);
542540
args.set_recv(this);
543541

544-
return dispatch.send(state, caller, lookup, args);
542+
return dispatch.send(state, lookup, args);
545543
}
546544

547-
Object* Object::send_prim(STATE, Executable* exec,
545+
Object* Object::send(STATE, Executable* exec,
548546
Module* mod, Arguments& args, Symbol* min_visibility)
549547
{
550548
if(args.total() < 1) return Primitives::failure();
551549

552-
// Don't shift the argument because we might fail and we need Arguments
553-
// to be pristine in the fallback code.
550+
/* Don't shift the argument because we might fail and we need Arguments to
551+
* be pristine in the fallback code.
552+
*/
554553
Object* meth = args.get_argument(0);
555554
Symbol* sym = try_as<Symbol>(meth);
556555

557-
// All coercion must be done here. Coercing Ruby-side and then
558-
// re-calling #send/#__send__ would produce incorrect results when
559-
// sending messages that are sensitive to the call stack like
560-
// send("__callee__") and the regex globals following send("gsub").
561-
//
562-
// MRI checks for Fixnum explicitly and raises ArgumentError
563-
// instead of TypeError. Seems silly, so we don't bother.
556+
/* All coercion must be done here. Coercing Ruby-side and then re-calling
557+
* #send/#__send__ would produce incorrect results when sending messages
558+
* that are sensitive to the call stack like send("__callee__") and the
559+
* regex globals following send("gsub").
560+
*
561+
* MRI checks for Fixnum explicitly and raises ArgumentError instead of
562+
* TypeError. Seems silly, so we don't bother.
563+
*/
564564
if(!sym) {
565565
if(String* str = try_as<String>(meth)) {
566566
sym = str->to_sym(state);
@@ -573,9 +573,9 @@ namespace rubinius {
573573
args.shift(state);
574574
args.set_name(sym);
575575

576-
// We have to send it with self from the current frame as the
577-
// source, not this object to have correct visibility checks
578-
// for protected.
576+
/* We have to send it with self from the current frame as the source, not
577+
* this object to have correct visibility checks for protected.
578+
*/
579579
Dispatch dispatch(sym);
580580
Object* scope = this;
581581
CallFrame* call_frame = state->vm()->call_frame();
@@ -584,19 +584,19 @@ namespace rubinius {
584584
}
585585
LookupData lookup(scope, lookup_begin(state), min_visibility);
586586

587-
return dispatch.send(state, call_frame, lookup, args);
587+
return dispatch.send(state, lookup, args);
588588
}
589589

590590
Object* Object::private_send_prim(STATE,
591591
Executable* exec, Module* mod, Arguments& args)
592592
{
593-
return send_prim(state, exec, mod, args, G(sym_private));
593+
return send(state, exec, mod, args, G(sym_private));
594594
}
595595

596596
Object* Object::public_send_prim(STATE,
597597
Executable* exec, Module* mod, Arguments& args)
598598
{
599-
return send_prim(state, exec, mod, args, G(sym_public));
599+
return send(state, exec, mod, args, G(sym_public));
600600
}
601601

602602
void Object::set_field(STATE, size_t index, Object* val) {
@@ -921,7 +921,7 @@ namespace rubinius {
921921

922922
Arguments args(missing, this, 2, buf);
923923

924-
if(Object* responds = dispatch.send(state, 0, lookup, args)) {
924+
if(Object* responds = dispatch.send(state, lookup, args)) {
925925
return RBOOL(CBOOL(responds));
926926
}
927927

Diff for: ‎machine/builtin/object.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,11 @@ namespace rubinius {
166166
* Sets up the current task to send the given method name to this
167167
* Object, passing the given number of arguments through varargs.
168168
*/
169-
Object* send(STATE, CallFrame* caller, Symbol* name, Array* args,
169+
Object* send(STATE, Symbol* name, Array* args,
170170
Object* block = cNil, bool allow_private = true);
171-
Object* send(STATE, CallFrame* caller, Symbol* name, bool allow_private = true);
171+
Object* send(STATE, Symbol* name, bool allow_private = true);
172172

173-
Object* send_prim(STATE, Executable* exec, Module* mod, Arguments& args,
173+
Object* send(STATE, Executable* exec, Module* mod, Arguments& args,
174174
Symbol* min_visibility);
175175

176176
/**

Diff for: ‎machine/builtin/pack.cpp

+3-6
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ namespace rubinius {
3939
Array* args = Array::create(state, 1);
4040
args->set(state, 0, obj);
4141

42-
return G(rubinius)->send(state, state->vm()->call_frame(),
43-
state->symbol("pack_to_int"), args);
42+
return G(rubinius)->send(state, state->symbol("pack_to_int"), args);
4443
}
4544

4645
#define BITS_LONG (RBX_SIZEOF_LONG * 8)
@@ -71,8 +70,7 @@ namespace rubinius {
7170
Array* args = Array::create(state, 1);
7271
args->set(state, 0, obj);
7372

74-
return G(rubinius)->send(state, state->vm()->call_frame(),
75-
state->symbol("pack_to_float"), args);
73+
return G(rubinius)->send(state, state->symbol("pack_to_float"), args);
7674
}
7775

7876
inline String* encoding_string(STATE, Object* obj, const char* coerce_name)
@@ -85,8 +83,7 @@ namespace rubinius {
8583

8684
std::string coerce_method("pack_");
8785
coerce_method += coerce_name;
88-
Object* result = G(rubinius)->send(state, state->vm()->call_frame(),
89-
state->symbol(coerce_method.c_str()), args);
86+
Object* result = G(rubinius)->send(state, state->symbol(coerce_method.c_str()), args);
9087

9188
if(!result) return 0;
9289
return as<String>(result);

Diff for: ‎machine/builtin/proc.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ namespace rubinius {
8080
*/
8181
Memory::GCInhibit inhibitor(state);
8282

83-
obj = obj->send(state, state->vm()->call_frame(), G(sym_to_ary));
83+
obj = obj->send(state, G(sym_to_ary));
8484
}
8585

8686
if(!(ary = try_as<Array>(obj))) {
@@ -121,7 +121,7 @@ namespace rubinius {
121121
if(self->bound_method_->nil_p()) {
122122
if(self->block_->nil_p()) {
123123
Dispatch dispatch(state->symbol("__yield__"));
124-
return dispatch.send(state, state->vm()->call_frame(), args);
124+
return dispatch.send(state, args);
125125
} else {
126126
return self->block_->call(state, args, flags);
127127
}

Diff for: ‎machine/builtin/system.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -1425,7 +1425,7 @@ namespace rubinius {
14251425
args.set_recv(obj);
14261426

14271427
OnStack<1> os(state, dest);
1428-
Object* ret = dispatch.send(state, state->vm()->call_frame(), lookup, args);
1428+
Object* ret = dispatch.send(state, lookup, args);
14291429

14301430
if(!ret && state->vm()->thread_state()->raise_reason() == cCatchThrow) {
14311431
if(state->vm()->thread_state()->throw_dest() == dest) {
@@ -1542,8 +1542,7 @@ namespace rubinius {
15421542
buf[0] = name;
15431543
buf[1] = G(sym_public);
15441544
Arguments args(name, obj, 2, buf);
1545-
responds = RBOOL(CBOOL(dispatch.send(state,
1546-
state->vm()->call_frame(), lookup, args)));
1545+
responds = RBOOL(CBOOL(dispatch.send(state, lookup, args)));
15471546
}
15481547
return responds;
15491548
}

Diff for: ‎machine/builtin/thread.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ namespace rubinius {
111111
}
112112

113113
Object* send_run(STATE) {
114-
return state->vm()->thread.get()->send(state, NULL, state->symbol("__run__"));
114+
return state->vm()->thread.get()->send(state, state->symbol("__run__"));
115115
}
116116

117117
Thread* Thread::allocate(STATE, Object* self) {
@@ -315,7 +315,7 @@ namespace rubinius {
315315
Object* instance = 0;
316316
OnStack<1> os(state, instance);
317317

318-
instance = klass->send(state, 0, state->symbol("new"));
318+
instance = klass->send(state, state->symbol("new"));
319319
if(instance) {
320320
state->shared().env()->set_loader(instance);
321321
} else {
@@ -325,7 +325,7 @@ namespace rubinius {
325325
// Enable the JIT after the core library has loaded
326326
G(jit)->enable(state);
327327

328-
Object* exit = instance->send(state, 0, state->symbol("main"));
328+
Object* exit = instance->send(state, state->symbol("main"));
329329

330330
state->shared().signals()->system_exit(state->vm()->thread_state()->raise_value());
331331

0 commit comments

Comments
 (0)
Please sign in to comment.