summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-07-05 10:04:56 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-07-05 10:04:56 +0000
commit0bb4c2b3db16c7e1c23877f1f1efc216c601f3d0 (patch)
treed9045d9e1835d881258b638ceb4552c887f720c8 /vm.c
parenta74dbca6863a41bd948961944d1c6b19e01070c7 (diff)
* compile.c (iseq_compile_each): add break catch point.
* insns.def (throw): support correct "break" and "return". this commit achieve that "make test" passes all tests. * vm.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/vm.c b/vm.c
index 81e6ee2f81..fd7bd4f372 100644
--- a/vm.c
+++ b/vm.c
@@ -606,12 +606,15 @@ vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc,
TH_PUSH_TAG(th);
if ((state = EXEC_TAG()) == 0) {
th->safe_level = proc->safe_level;
-
val = invoke_block(th, &proc->block, self, argc, argv);
}
- else {
- if (state == TAG_BREAK ||
- (state == TAG_RETURN && proc->is_lambda)) {
+ TH_POP_TAG();
+
+ th->safe_level = stored_safe;
+ lfp_set_special_cref(proc->block.lfp, (NODE*)stored_special_cref_stack);
+
+ if (state) {
+ if (state == TAG_RETURN && proc->is_lambda) {
VALUE err = th->errinfo;
VALUE *escape_dfp = GET_THROWOBJ_CATCH_POINT(err);
VALUE *cdfp = proc->block.dfp;
@@ -624,10 +627,6 @@ vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc,
}
}
}
- TH_POP_TAG();
-
- th->safe_level = stored_safe;
- lfp_set_special_cref(proc->block.lfp, (NODE*)stored_special_cref_stack);
if (state) {
JUMP_TAG(state);
@@ -873,9 +872,8 @@ vm_get_cbase(rb_thread_t *th)
static VALUE
make_localjump_error(const char *mesg, VALUE value, int reason)
{
- VALUE exc =
- rb_exc_new2(rb_const_get(rb_cObject, rb_intern("LocalJumpError")),
- mesg);
+ extern VALUE rb_eLocalJumpError;
+ VALUE exc = rb_exc_new2(rb_eLocalJumpError, mesg);
ID id;
switch (reason) {