@@ -89,11 +89,10 @@ namespace rubinius {
8989 return execute_interpreter (state, env, args, invocation);
9090 }
9191
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 .
9393 class GenericArguments {
9494 public:
95- static bool call (STATE,
96- MachineCode* mcode, StackVariables* scope,
95+ static bool call (STATE, MachineCode* mcode, StackVariables* scope,
9796 Arguments& args, int flags)
9897 {
9998 /* There are 5 types of arguments, illustrated here:
@@ -422,6 +421,18 @@ namespace rubinius {
422421 scope->initialize (invocation.self , block, mod, mcode->number_of_locals );
423422 scope->set_parent (env->scope_ );
424423
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+
425436 CallFrame* previous_frame = 0 ;
426437 InterpreterCallFrame* frame = ALLOCA_CALL_FRAME (mcode->stack_size );
427438
@@ -439,20 +450,6 @@ namespace rubinius {
439450
440451 state->vm ()->push_call_frame (frame, previous_frame);
441452
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-
456453 Object* value = 0 ;
457454
458455#ifdef RBX_PROFILER
@@ -469,26 +466,20 @@ namespace rubinius {
469466 // Check the stack and interrupts here rather than in the interpreter
470467 // loop itself.
471468 if (state->check_interrupts (state)) {
472- state->vm ()->checkpoint (state);
473-
474469 tooling::BlockEntry method (state, env, mod);
475470 value = (*mcode->run )(state, mcode);
476471 }
477472 } else {
478473 // Check the stack and interrupts here rather than in the interpreter
479474 // loop itself.
480475 if (state->check_interrupts (state)) {
481- state->vm ()->checkpoint (state);
482-
483476 value = (*mcode->run )(state, mcode);
484477 }
485478 }
486479#else
487480 // Check the stack and interrupts here rather than in the interpreter
488481 // loop itself.
489482 if (state->check_interrupts (state)) {
490- state->vm ()->checkpoint (state);
491-
492483 value = (*mcode->run )(state, mcode);
493484 }
494485#endif
0 commit comments