[macruby-changes] [2762] MacRuby/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Wed Oct 7 22:06:16 PDT 2009
Revision: 2762
http://trac.macosforge.org/projects/ruby/changeset/2762
Author: vincent.isambart at gmail.com
Date: 2009-10-07 22:06:12 -0700 (Wed, 07 Oct 2009)
Log Message:
-----------
fixed yet an other bug found by the module verifier
in the code generated for core/module/define_method_spec.rb
Modified Paths:
--------------
MacRuby/trunk/compiler.cpp
MacRuby/trunk/compiler.h
Modified: MacRuby/trunk/compiler.cpp
===================================================================
--- MacRuby/trunk/compiler.cpp 2009-10-08 04:10:20 UTC (rev 2761)
+++ MacRuby/trunk/compiler.cpp 2009-10-08 05:06:12 UTC (rev 2762)
@@ -58,6 +58,7 @@
return_from_block_ids = 0;
ensure_pn = NULL;
current_scope = NULL;
+ class_declaration = false;
dispatcherFunc = NULL;
fastPlusFunc = NULL;
@@ -2985,7 +2986,8 @@
{
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;
+ const bool has_dvars = current_block && current_mid == 0 && !class_declaration;
+ class_declaration = false;
// Get dynamic vars.
if (has_dvars && node->nd_tbl != NULL) {
@@ -3874,11 +3876,6 @@
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;
@@ -3889,7 +3886,12 @@
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();
@@ -3899,11 +3901,18 @@
current_module = nd_type(node) == NODE_MODULE;
compile_set_current_scope(classVal, publicScope);
- bool old_dynamic_class = dynamic_class;
- dynamic_class = false;
- Value *val = compile_node(body->nd_body);
+ 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);
+
dynamic_class = old_dynamic_class;
compile_set_current_scope(classVal, defaultScope);
@@ -3913,6 +3922,7 @@
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;
Modified: MacRuby/trunk/compiler.h
===================================================================
--- MacRuby/trunk/compiler.h 2009-10-08 04:10:20 UTC (rev 2761)
+++ MacRuby/trunk/compiler.h 2009-10-08 05:06:12 UTC (rev 2762)
@@ -132,6 +132,7 @@
int return_from_block_ids;
PHINode *ensure_pn;
RoxorScope *current_scope;
+ bool class_declaration;
Function *dispatcherFunc;
Function *fastPlusFunc;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20091007/2eb842ef/attachment-0001.html>
More information about the macruby-changes
mailing list