@@ -89,11 +89,10 @@ namespace rubinius {
89
89
return execute_interpreter (state, env, args, invocation);
90
90
}
91
91
92
- // TODO: this is a quick hack to process block arguments in 1.9 .
92
+ // TODO: Specialize argument handlers for blocks like those for methods .
93
93
class GenericArguments {
94
94
public:
95
- static bool call (STATE,
96
- MachineCode* mcode, StackVariables* scope,
95
+ static bool call (STATE, MachineCode* mcode, StackVariables* scope,
97
96
Arguments& args, int flags)
98
97
{
99
98
/* There are 5 types of arguments, illustrated here:
@@ -422,6 +421,18 @@ namespace rubinius {
422
421
scope->initialize (invocation.self , block, mod, mcode->number_of_locals );
423
422
scope->set_parent (env->scope_ );
424
423
424
+ if (!GenericArguments::call (state, mcode, scope, args, invocation.flags )) {
425
+ if (state->vm ()->thread_state ()->raise_reason () == cNone) {
426
+ Exception* exc =
427
+ Exception::make_argument_error (state, mcode->required_args , args.total (),
428
+ mcode->name ());
429
+ exc->locations (state, Location::from_call_stack (state));
430
+ state->raise_exception (exc);
431
+ }
432
+
433
+ return NULL ;
434
+ }
435
+
425
436
CallFrame* previous_frame = 0 ;
426
437
InterpreterCallFrame* frame = ALLOCA_CALL_FRAME (mcode->stack_size );
427
438
@@ -439,20 +450,6 @@ namespace rubinius {
439
450
440
451
state->vm ()->push_call_frame (frame, previous_frame);
441
452
442
- if (!GenericArguments::call (state, mcode, scope, args, invocation.flags )) {
443
- state->vm ()->pop_call_frame (previous_frame);
444
-
445
- if (state->vm ()->thread_state ()->raise_reason () == cNone) {
446
- Exception* exc =
447
- Exception::make_argument_error (state, mcode->required_args , args.total (),
448
- mcode->name ());
449
- exc->locations (state, Location::from_call_stack (state));
450
- state->raise_exception (exc);
451
- }
452
-
453
- return NULL ;
454
- }
455
-
456
453
Object* value = 0 ;
457
454
458
455
#ifdef RBX_PROFILER
@@ -469,26 +466,20 @@ namespace rubinius {
469
466
// Check the stack and interrupts here rather than in the interpreter
470
467
// loop itself.
471
468
if (state->check_interrupts (state)) {
472
- state->vm ()->checkpoint (state);
473
-
474
469
tooling::BlockEntry method (state, env, mod);
475
470
value = (*mcode->run )(state, mcode);
476
471
}
477
472
} else {
478
473
// Check the stack and interrupts here rather than in the interpreter
479
474
// loop itself.
480
475
if (state->check_interrupts (state)) {
481
- state->vm ()->checkpoint (state);
482
-
483
476
value = (*mcode->run )(state, mcode);
484
477
}
485
478
}
486
479
#else
487
480
// Check the stack and interrupts here rather than in the interpreter
488
481
// loop itself.
489
482
if (state->check_interrupts (state)) {
490
- state->vm ()->checkpoint (state);
491
-
492
483
value = (*mcode->run )(state, mcode);
493
484
}
494
485
#endif
0 commit comments