Revision: 2852 http://trac.macosforge.org/projects/ruby/changeset/2852 Author: lsansonetti@apple.com Date: 2009-10-19 15:52:16 -0700 (Mon, 19 Oct 2009) Log Message: ----------- revert parts of r2839 because it breaks the gcd spec - strange bug implying exception handlers (sorry vincent) Revision Links: -------------- http://trac.macosforge.org/projects/ruby/changeset/2839 Modified Paths: -------------- MacRuby/trunk/compiler.cpp Modified: MacRuby/trunk/compiler.cpp =================================================================== --- MacRuby/trunk/compiler.cpp 2009-10-19 19:35:08 UTC (rev 2851) +++ MacRuby/trunk/compiler.cpp 2009-10-19 22:52:16 UTC (rev 2852) @@ -58,7 +58,6 @@ return_from_block_ids = 0; ensure_pn = NULL; current_scope = NULL; - class_declaration = false; dispatcherFunc = NULL; fastPlusFunc = NULL; @@ -2990,8 +2989,7 @@ { 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) { @@ -3025,13 +3023,14 @@ FunctionType *ft = FunctionType::get(RubyObjTy, types, false); std::string function_name; - if (ruby_aot_compile) { + if (ruby_aot_compile) { function_name.append(RSTRING_PTR(ruby_aot_init_func)); function_name.append("_ruby_scope"); - } - else { + } + else { function_name.append("__ruby_scope"); - } + } + Function *f = Function::Create(ft, GlobalValue::ExternalLinkage, function_name, module); @@ -3893,6 +3892,11 @@ 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; @@ -3903,12 +3907,7 @@ 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; ivar_slots_cache.clear(); @@ -3918,18 +3917,11 @@ 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(); + Value *val = compile_node(body->nd_body); - std::vector<Value *> params; - params.push_back(classVal); - params.push_back(compile_const_pointer(NULL)); - val = compile_protected_call(f, params); - dynamic_class = old_dynamic_class; compile_set_current_scope(classVal, defaultScope); @@ -3939,7 +3931,6 @@ 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;
participants (1)
-
source_changes@macosforge.org