Skip to content

Commit

Permalink
revert r2762 which seems to introduce AOT compilation regressions
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/trunk@2764 23306eb0-4c56-4727-a40e-e92c0eb68959
  • Loading branch information
lrz committed Oct 8, 2009
1 parent 76761db commit 31fd08f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 20 deletions.
28 changes: 9 additions & 19 deletions compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ RoxorCompiler::RoxorCompiler(void)
return_from_block_ids = 0;
ensure_pn = NULL;
current_scope = NULL;
class_declaration = false;

dispatcherFunc = NULL;
fastPlusFunc = NULL;
Expand Down Expand Up @@ -2986,8 +2985,7 @@ RoxorCompiler::compile_node(NODE *node)
{
rb_vm_arity_t arity = rb_vm_node_arity(node);
const int nargs = bb == NULL ? 0 : arity.real;
const bool has_dvars = current_block && current_mid == 0 && !class_declaration;
class_declaration = false;
const bool has_dvars = current_block && current_mid == 0;

// Get dynamic vars.
if (has_dvars && node->nd_tbl != NULL) {
Expand Down Expand Up @@ -3876,6 +3874,11 @@ RoxorCompiler::compile_node(NODE *node)
NODE *body = node->nd_body;
if (body != NULL) {
assert(nd_type(body) == NODE_SCOPE);
ID *tbl = body->nd_tbl;
if (tbl != NULL) {
const int args_count = (int)tbl[0];
compile_lvars(&tbl[args_count + 1]);
}
if (body->nd_body != NULL) {
Value *old_self = current_self;
current_self = classVal;
Expand All @@ -3886,11 +3889,6 @@ RoxorCompiler::compile_node(NODE *node)
GlobalValue::InternalLinkage, nilVal, "");

bool old_current_module = current_module;
bool old_current_block_chain = current_block_chain;
bool old_dynamic_class = dynamic_class;

current_block_chain = false;
dynamic_class = false;

std::map<ID, Value *> old_ivar_slots_cache
= ivar_slots_cache;
Expand All @@ -3901,17 +3899,10 @@ RoxorCompiler::compile_node(NODE *node)
current_module = nd_type(node) == NODE_MODULE;

compile_set_current_scope(classVal, publicScope);
bool old_dynamic_class = dynamic_class;
dynamic_class = false;

DEBUG_LEVEL_INC();
class_declaration = true;
Value *val = compile_node(body);
Function *f = cast<Function>(val);
DEBUG_LEVEL_DEC();

std::vector<Value *> params;
params.push_back(classVal);
params.push_back(compile_const_pointer(NULL));
val = compile_protected_call(f, params);
Value *val = compile_node(body->nd_body);

dynamic_class = old_dynamic_class;
compile_set_current_scope(classVal, defaultScope);
Expand All @@ -3922,7 +3913,6 @@ RoxorCompiler::compile_node(NODE *node)
current_self = old_self;
current_opened_class = old_class;
current_module = old_current_module;
current_block_chain = old_current_block_chain;

ivar_slots_cache = old_ivar_slots_cache;

Expand Down
1 change: 0 additions & 1 deletion compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ class RoxorCompiler {
int return_from_block_ids;
PHINode *ensure_pn;
RoxorScope *current_scope;
bool class_declaration;

Function *dispatcherFunc;
Function *fastPlusFunc;
Expand Down

0 comments on commit 31fd08f

Please sign in to comment.