[macruby-changes] [1405] MacRuby/branches/experimental

source_changes at macosforge.org source_changes at macosforge.org
Thu Apr 9 14:57:37 PDT 2009


Revision: 1405
          http://trac.macosforge.org/projects/ruby/changeset/1405
Author:   lsansonetti at apple.com
Date:     2009-04-09 14:57:37 -0700 (Thu, 09 Apr 2009)
Log Message:
-----------
some misc fixes

Modified Paths:
--------------
    MacRuby/branches/experimental/README.rdoc
    MacRuby/branches/experimental/array.c
    MacRuby/branches/experimental/class.c
    MacRuby/branches/experimental/gc.c
    MacRuby/branches/experimental/hash.c
    MacRuby/branches/experimental/include/ruby/ruby.h
    MacRuby/branches/experimental/parse.y
    MacRuby/branches/experimental/roxor.cpp
    MacRuby/branches/experimental/set.c
    MacRuby/branches/experimental/string.c

Modified: MacRuby/branches/experimental/README.rdoc
===================================================================
--- MacRuby/branches/experimental/README.rdoc	2009-04-09 19:09:14 UTC (rev 1404)
+++ MacRuby/branches/experimental/README.rdoc	2009-04-09 21:57:37 UTC (rev 1405)
@@ -19,7 +19,8 @@
 * An Intel machine. PowerPC machines are not supported anymore, but may still
   work. An Intel 64-bit machine (Intel Core Duo 2) is recommended.
 
-* Mac OS X 10.5.6 or later.
+* Mac OS X 10.5.6 or later. If you are building on Mac OS X 10.6 please get in
+  touch with lsansonetti at apple.com to be able to correctly build the project.
 
 * LLVM trunk, compiled for both i386 and x86_64.
 

Modified: MacRuby/branches/experimental/array.c
===================================================================
--- MacRuby/branches/experimental/array.c	2009-04-09 19:09:14 UTC (rev 1404)
+++ MacRuby/branches/experimental/array.c	2009-04-09 21:57:37 UTC (rev 1405)
@@ -44,8 +44,7 @@
     mask = rb_objc_flag_get_mask((void *)ary);
 #endif
     if (mask == 0) {
-	bool _CFArrayIsMutable(void *);
-	if (!_CFArrayIsMutable((void *)ary)) {
+	if (RARRAY_IMMUTABLE(ary)) {
 	    mask |= FL_FREEZE;
 	}
     }

Modified: MacRuby/branches/experimental/class.c
===================================================================
--- MacRuby/branches/experimental/class.c	2009-04-09 19:09:14 UTC (rev 1404)
+++ MacRuby/branches/experimental/class.c	2009-04-09 21:57:37 UTC (rev 1405)
@@ -1153,10 +1153,10 @@
     else {
 	OBJ_UNTAINT(klass);
     }
-#endif
     if (OBJ_FROZEN(obj)) {
 	OBJ_FREEZE(klass);
     }
+#endif
 //    ALLOW_INTS;
 
     return klass;

Modified: MacRuby/branches/experimental/gc.c
===================================================================
--- MacRuby/branches/experimental/gc.c	2009-04-09 19:09:14 UTC (rev 1404)
+++ MacRuby/branches/experimental/gc.c	2009-04-09 21:57:37 UTC (rev 1405)
@@ -282,13 +282,13 @@
 void
 rb_objc_set_associative_ref(void *obj, void *key, void *val)
 {
-     auto_zone_set_associative_ref(__auto_zone, obj, key, val);
+    auto_zone_set_associative_ref(__auto_zone, obj, key, val);
 }
 
 void *
 rb_objc_get_associative_ref(void *obj, void *key)
 {
-     return auto_zone_get_associative_ref(__auto_zone, obj, key);
+    return auto_zone_get_associative_ref(__auto_zone, obj, key);
 }
 
 void

Modified: MacRuby/branches/experimental/hash.c
===================================================================
--- MacRuby/branches/experimental/hash.c	2009-04-09 19:09:14 UTC (rev 1404)
+++ MacRuby/branches/experimental/hash.c	2009-04-09 21:57:37 UTC (rev 1405)
@@ -231,9 +231,9 @@
     mask = rb_objc_flag_get_mask((const void *)hash);
 #endif
     if (mask == 0) {
-	bool _CFDictionaryIsMutable(void *);
-	if (!_CFDictionaryIsMutable((void *)hash))
+	if (RHASH_IMMUTABLE(hash)) {
 	    mask |= FL_FREEZE;
+	}
     }
     if ((mask & FL_FREEZE) == FL_FREEZE)
 	rb_raise(rb_eRuntimeError, "can't modify frozen/immutable hash");

Modified: MacRuby/branches/experimental/include/ruby/ruby.h
===================================================================
--- MacRuby/branches/experimental/include/ruby/ruby.h	2009-04-09 19:09:14 UTC (rev 1404)
+++ MacRuby/branches/experimental/include/ruby/ruby.h	2009-04-09 21:57:37 UTC (rev 1405)
@@ -1064,6 +1064,19 @@
 RUBY_EXTERN VALUE rb_cNSSet;
 RUBY_EXTERN VALUE rb_cNSMutableSet;
 RUBY_EXTERN VALUE rb_cCFNumber;
+
+bool _CFArrayIsMutable(void *);
+#define RARRAY_IMMUTABLE(o) (*(VALUE *)o == rb_cCFArray && !_CFArrayIsMutable((void *)o))
+
+bool _CFDictionaryIsMutable(void *);
+#define RHASH_IMMUTABLE(o) (*(VALUE *)o == rb_cCFHash && !_CFDictionaryIsMutable((void *)o))
+
+bool __CFStringIsMutable(void *);
+#define RSTRING_IMMUTABLE(o) (*(VALUE *)o == rb_cCFString && !__CFStringIsMutable((void *)o))
+
+bool _CFSetIsMutable(void *);
+#define RSET_IMMUTABLE(o) (*(VALUE *)o == rb_cCFSet && !_CFSetIsMutable((void *)o))
+
 #endif
 
 RUBY_EXTERN VALUE rb_eException;

Modified: MacRuby/branches/experimental/parse.y
===================================================================
--- MacRuby/branches/experimental/parse.y	2009-04-09 19:09:14 UTC (rev 1404)
+++ MacRuby/branches/experimental/parse.y	2009-04-09 21:57:37 UTC (rev 1405)
@@ -9531,6 +9531,9 @@
 	else if (strcmp(name, "release") == 0) {
 	    name_hash = (SEL)0x2000;
 	}
+	else if (strcmp(name, "retainCount") == 0) {
+	    name_hash = (SEL)0x4000;
+	}
 	else {
 	    assert(1==0);
 	}

Modified: MacRuby/branches/experimental/roxor.cpp
===================================================================
--- MacRuby/branches/experimental/roxor.cpp	2009-04-09 19:09:14 UTC (rev 1404)
+++ MacRuby/branches/experimental/roxor.cpp	2009-04-09 21:57:37 UTC (rev 1405)
@@ -3,7 +3,7 @@
 #define ROXOR_COMPILER_DEBUG		0
 #define ROXOR_VM_DEBUG			0
 #define ROXOR_DUMP_IR_BEFORE_EXIT	0
-#define ROXOR_ULTRA_LAZY_JIT		1
+#define ROXOR_ULTRA_LAZY_JIT		0
 
 #include <llvm/Module.h>
 #include <llvm/DerivedTypes.h>
@@ -200,7 +200,8 @@
 	NODE *current_block_node;
 	Function *current_block_func;
 	jmp_buf *return_from_block_jmpbuf;
-        GlobalVariable *current_opened_class;
+	GlobalVariable *current_opened_class;
+	bool current_module;
 	BasicBlock *current_loop_begin_bb;
 	BasicBlock *current_loop_body_bb;
 	BasicBlock *current_loop_end_bb;
@@ -308,8 +309,7 @@
 	Value *compile_lvar_slot(ID name);
 
 	int *get_slot_cache(ID id) {
-	    if (current_block || !current_instance_method) {
-		// TODO should also return NULL if we are inside a module
+	    if (current_block || !current_instance_method || current_module) {
 		return NULL;
 	    }
 	    std::map<ID, int *>::iterator iter = ivar_slots_cache.find(id);
@@ -530,6 +530,7 @@
     current_block_node = NULL;
     current_block_func = NULL;
     current_opened_class = NULL;
+    current_module = false;
     current_loop_begin_bb = NULL;
     current_loop_body_bb = NULL;
     current_loop_end_bb = NULL;
@@ -3439,11 +3440,15 @@
 				"current_opened_class",
 				RoxorCompiler::module);
 
+			bool old_current_module = current_module;
+
 			std::map<ID, int *> old_ivar_slots_cache = ivar_slots_cache;
 			ivar_slots_cache.clear();
 
 			new StoreInst(classVal, current_opened_class, bb);
 
+			current_module = nd_type(node) == NODE_MODULE;
+
 			Value *val = compile_node(body->nd_body);
 
 			BasicBlock::InstListType &list = bb->getInstList();
@@ -3451,6 +3456,7 @@
 
 			current_self = old_self;
 			current_opened_class = old_class;
+			current_module = old_current_module;
 
 			ivar_slots_cache = old_ivar_slots_cache;
 

Modified: MacRuby/branches/experimental/set.c
===================================================================
--- MacRuby/branches/experimental/set.c	2009-04-09 19:09:14 UTC (rev 1404)
+++ MacRuby/branches/experimental/set.c	2009-04-09 21:57:37 UTC (rev 1405)
@@ -22,9 +22,9 @@
     long mask;
     mask = rb_objc_flag_get_mask((void *)set);
     if (mask == 0) {
-	bool _CFSetIsMutable(void *);
-	if (!_CFSetIsMutable((void *)set))
+	if (RSET_IMMUTABLE(set)) {
 	    mask |= FL_FREEZE;
+	}
     }
     if ((mask & FL_FREEZE) == FL_FREEZE)
 	rb_raise(rb_eRuntimeError, "can't modify frozen/immutable set");

Modified: MacRuby/branches/experimental/string.c
===================================================================
--- MacRuby/branches/experimental/string.c	2009-04-09 19:09:14 UTC (rev 1404)
+++ MacRuby/branches/experimental/string.c	2009-04-09 21:57:37 UTC (rev 1405)
@@ -487,8 +487,7 @@
 str_modifiable(VALUE str)
 {
     if (*(VALUE *)str == rb_cCFString) {
-	bool __CFStringIsMutable(void *);
-	if (!__CFStringIsMutable((void *)str)) {
+	if (RSTRING_IMMUTABLE(str)) {
 	    rb_raise(rb_eRuntimeError, "can't modify immutable string");
 	}
     }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090409/a7691231/attachment-0001.html>


More information about the macruby-changes mailing list