mruby/mruby — pull request #420 by masamitsu-murase (2012-08-12 17:32:29+00:00)
Title: Modify exception handling

If an exception is raised before `cipush` is called in `mrb_run`, it should be handled in outer `mrb_run`.

For example, the following code causes segmentation fault.
```ruby
def exception_test
UnknownConstant # raise exception
end

a = :ng
begin
send(:exception_test)
rescue
a = :ok
end

puts(a == :ok)
```

Detail:
In the above case, `send` method is called on `OP_SEND` node in `mrb_run (*1)`.
Then, `mrb_f_send` is called because `send` is defined as `mrb_f_send` in kernel.c.
`mrb_f_send` calls `mrb_run (*2)` to process `exception_test` method.
Because `UnknownConstant` is not defined, an exception is raised
Then VM jumps to L_RAISE label in `mrb_run (*2)` to handle the exception.

In this case, I think that the exception should not handled in `mrb_run (*2)` but in `mrb_run (*1)`.

If this patch is not a good solution, let me know please.