[macruby-changes] [5201] MacRuby/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Thu Jan 27 20:53:41 PST 2011
Revision: 5201
http://trac.macosforge.org/projects/ruby/changeset/5201
Author: lsansonetti at apple.com
Date: 2011-01-27 20:53:40 -0800 (Thu, 27 Jan 2011)
Log Message:
-----------
fix a bug in the compilation of the 'next' expression which would not honor ensure blocks
Modified Paths:
--------------
MacRuby/trunk/compiler.cpp
MacRuby/trunk/compiler.h
Modified: MacRuby/trunk/compiler.cpp
===================================================================
--- MacRuby/trunk/compiler.cpp 2011-01-28 04:48:38 UTC (rev 5200)
+++ MacRuby/trunk/compiler.cpp 2011-01-28 04:53:40 UTC (rev 5201)
@@ -73,6 +73,7 @@
__save_state(int, return_from_block);\
__save_state(int, return_from_block_ids);\
__save_state(PHINode *, ensure_pn);\
+ __save_state(NODE *, ensure_node);\
__save_state(bool, block_declaration);\
__save_state(AllocaInst *, dispatch_argv);
@@ -106,6 +107,7 @@
__restore_state(return_from_block);\
__restore_state(return_from_block_ids);\
__restore_state(ensure_pn);\
+ __restore_state(ensure_node);\
__restore_state(block_declaration);\
__restore_state(dispatch_argv);
@@ -138,6 +140,7 @@
return_from_block = -1;\
return_from_block_ids = 0;\
ensure_pn = NULL;\
+ ensure_node = NULL;\
block_declaration = false;\
dispatch_argv = NULL;
@@ -1993,10 +1996,13 @@
compile_landing_pad_footer();
}
if (within_loop) {
+ if (ensure_node != NULL) {
+ compile_node(ensure_node);
+ }
BranchInst::Create(current_loop_begin_bb, bb);
}
else if (within_block) {
- ReturnInst::Create(context, val, bb);
+ compile_simple_return(val);
}
else {
rb_raise(rb_eLocalJumpError, "unexpected next");
@@ -4488,6 +4494,9 @@
Value *old_has_ensure =
compile_set_has_ensure(ConstantInt::get(Int8Ty, 1));
+ NODE *old_ensure_node = ensure_node;
+ ensure_node = node->nd_ensr;
+
rescue_invoke_bb = new_rescue_invoke_bb;
rescue_rethrow_bb = new_rescue_rethrow_bb;
DEBUG_LEVEL_INC();
@@ -4497,6 +4506,8 @@
rescue_invoke_bb = old_rescue_invoke_bb;
BranchInst::Create(ensure_normal_bb, bb);
+ ensure_node = old_ensure_node;
+
if (new_rescue_invoke_bb->use_empty()
&& new_rescue_rethrow_bb->use_empty()) {
new_rescue_invoke_bb->eraseFromParent();
Modified: MacRuby/trunk/compiler.h
===================================================================
--- MacRuby/trunk/compiler.h 2011-01-28 04:48:38 UTC (rev 5200)
+++ MacRuby/trunk/compiler.h 2011-01-28 04:53:40 UTC (rev 5201)
@@ -127,6 +127,8 @@
BasicBlock *rescue_invoke_bb;
BasicBlock *rescue_rethrow_bb;
BasicBlock *ensure_bb;
+ PHINode *ensure_pn;
+ NODE *ensure_node;
bool current_rescue;
NODE *current_block_node;
Function *current_block_func;
@@ -139,7 +141,6 @@
PHINode *current_loop_exit_val;
int return_from_block;
int return_from_block_ids;
- PHINode *ensure_pn;
bool block_declaration;
AllocaInst *dispatch_argv;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20110127/e56222b5/attachment.html>
More information about the macruby-changes
mailing list