[macruby-changes] [388] MacRuby/branches/lrz_unstable

source_changes at macosforge.org source_changes at macosforge.org
Wed Jul 30 17:14:44 PDT 2008


Revision: 388
          http://trac.macosforge.org/projects/ruby/changeset/388
Author:   lsansonetti at apple.com
Date:     2008-07-30 17:14:44 -0700 (Wed, 30 Jul 2008)
Log Message:
-----------
wip

Modified Paths:
--------------
    MacRuby/branches/lrz_unstable/compile.c
    MacRuby/branches/lrz_unstable/id.c
    MacRuby/branches/lrz_unstable/id.h
    MacRuby/branches/lrz_unstable/insnhelper.h
    MacRuby/branches/lrz_unstable/insns.def
    MacRuby/branches/lrz_unstable/parse.y

Modified: MacRuby/branches/lrz_unstable/compile.c
===================================================================
--- MacRuby/branches/lrz_unstable/compile.c	2008-07-30 22:08:27 UTC (rev 387)
+++ MacRuby/branches/lrz_unstable/compile.c	2008-07-31 00:14:44 UTC (rev 388)
@@ -693,7 +693,17 @@
     operands[2] = block;
     operands[3] = flag;
     operands[4] = 0;
-    operands[5] = (VALUE)sel_registerName(rb_id2name(SYM2ID(id)));
+    if (FIX2INT(argc) > 0) {
+        char buf[512];
+
+        strlcpy(buf, rb_id2name(SYM2ID(id)), sizeof buf);
+	if (buf[strlen(buf) - 1] != ':')
+	    strlcat(buf, ":", sizeof buf);
+	operands[5] = (VALUE)sel_registerName(buf);
+    }
+    else {
+	operands[5] = (VALUE)sel_registerName(rb_id2name(SYM2ID(id)));
+    }
     operands[6] = 0;
     iobj = new_insn_core(iseq, line_no, BIN(send), 6, operands);
     return iobj;
@@ -1611,6 +1621,11 @@
 		    insn_set_specialized_instruction(iobj, BIN(opt_aref));
 		}
 	    }
+	    else if (argc == 2) {
+		if (mid == idASET) {
+		    insn_set_specialized_instruction(iobj, BIN(opt_aset));
+		}
+	    }
 	}
 
 	if (argc > 0) {

Modified: MacRuby/branches/lrz_unstable/id.c
===================================================================
--- MacRuby/branches/lrz_unstable/id.c	2008-07-30 22:08:27 UTC (rev 387)
+++ MacRuby/branches/lrz_unstable/id.c	2008-07-31 00:14:44 UTC (rev 388)
@@ -40,6 +40,26 @@
     idNot = rb_intern("!");
     idNeq = rb_intern("!=");
 
+#if WITH_OBJC
+    selPLUS = sel_registerName("+:");
+    selMINUS = sel_registerName("-:");
+    selMULT = sel_registerName("*:");
+    selDIV = sel_registerName("/:");
+    selMOD = sel_registerName("%:");
+    selEq = sel_registerName("==:");
+    selNeq = sel_registerName("!=:");
+    selLT = sel_registerName("<:");
+    selLE = sel_registerName("<=:");
+    selGT = sel_registerName(">:");
+    selGE = sel_registerName(">=:");
+    selLTLT = sel_registerName("<<:");
+    selAREF = sel_registerName("[]:");
+    selASET = sel_registerName("[]=:");
+    selLength = sel_registerName("length");
+    selSucc = sel_registerName("succ");
+    selNot = sel_registerName("!");
+#endif
+
     idAREF = rb_intern("[]");
     idASET = rb_intern("[]=");
 

Modified: MacRuby/branches/lrz_unstable/id.h
===================================================================
--- MacRuby/branches/lrz_unstable/id.h	2008-07-30 22:08:27 UTC (rev 387)
+++ MacRuby/branches/lrz_unstable/id.h	2008-07-31 00:14:44 UTC (rev 388)
@@ -53,6 +53,23 @@
 extern ID idRespond_to;
 extern ID idInitialize;
 #if WITH_OBJC
+extern SEL selPLUS;
+extern SEL selMINUS;
+extern SEL selMULT;
+extern SEL selDIV;
+extern SEL selMOD;
+extern SEL selEq;
+extern SEL selNeq;
+extern SEL selLT;
+extern SEL selLE;
+extern SEL selGT;
+extern SEL selGE;
+extern SEL selLTLT;
+extern SEL selAREF;
+extern SEL selASET;
+extern SEL selLength;
+extern SEL selSucc;
+extern SEL selNot;
 extern ID idIncludedModules;
 extern ID idIncludedInClasses;
 #endif

Modified: MacRuby/branches/lrz_unstable/insnhelper.h
===================================================================
--- MacRuby/branches/lrz_unstable/insnhelper.h	2008-07-30 22:08:27 UTC (rev 387)
+++ MacRuby/branches/lrz_unstable/insnhelper.h	2008-07-31 00:14:44 UTC (rev 388)
@@ -140,9 +140,9 @@
 #define BASIC_OP_UNREDEFINED_P(op) ((ruby_vm_redefined_flag & (op)) == 0)
 #define HEAP_CLASS_OF(obj) RBASIC(obj)->klass
 
-#define CALL_SIMPLE_METHOD(num, id, recv) do { \
+#define CALL_SIMPLE_METHOD(num, id, recv, sel) do { \
     VALUE klass = CLASS_OF(recv); \
-    CALL_METHOD(num, 0, 0, id, rb_method_node(klass, id), recv, CLASS_OF(recv), (SEL)0); \
+    CALL_METHOD(num, 0, 0, id, rb_method_node(klass, id), recv, CLASS_OF(recv), sel); \
 } while (0)
 
 #endif /* RUBY_INSNHELPER_H */

Modified: MacRuby/branches/lrz_unstable/insns.def
===================================================================
--- MacRuby/branches/lrz_unstable/insns.def	2008-07-30 22:08:27 UTC (rev 387)
+++ MacRuby/branches/lrz_unstable/insns.def	2008-07-31 00:14:44 UTC (rev 388)
@@ -1408,11 +1408,7 @@
       INSN_LABEL(normal_dispatch):
 	PUSH(recv);
 	PUSH(obj);
-
-	static SEL selPLUS=0;
-	if (selPLUS==0) { selPLUS = sel_registerName("+:"); }
-	CALL_METHOD(1, 0, 0, idPLUS, NULL, recv, CLASS_OF(recv), (SEL)selPLUS);
-	//CALL_SIMPLE_METHOD(1, idPLUS, recv);
+	CALL_SIMPLE_METHOD(1, idPLUS, recv, selPLUS);
     }
 }
 
@@ -1446,7 +1442,7 @@
 	/* other */
 	PUSH(recv);
 	PUSH(obj);
-	CALL_SIMPLE_METHOD(1, idMINUS, recv);
+	CALL_SIMPLE_METHOD(1, idMINUS, recv, selMINUS);
     }
 }
 
@@ -1499,7 +1495,7 @@
       INSN_LABEL(normal_dispatch):
 	PUSH(recv);
 	PUSH(obj);
-	CALL_SIMPLE_METHOD(1, idMULT, recv);
+	CALL_SIMPLE_METHOD(1, idMULT, recv, selMULT);
     }
 }
 
@@ -1563,7 +1559,7 @@
       INSN_LABEL(normal_dispatch):
 	PUSH(recv);
 	PUSH(obj);
-	CALL_SIMPLE_METHOD(1, idDIV, recv);
+	CALL_SIMPLE_METHOD(1, idDIV, recv, selDIV);
     }
 }
 
@@ -1642,7 +1638,7 @@
       INSN_LABEL(normal_dispatch):
 	PUSH(recv);
 	PUSH(obj);
-	CALL_SIMPLE_METHOD(1, idMOD, recv);
+	CALL_SIMPLE_METHOD(1, idMOD, recv, selMOD);
     }
 }
 
@@ -1663,7 +1659,7 @@
 	/* other */
 	PUSH(recv);
 	PUSH(obj);
-	CALL_SIMPLE_METHOD(1, idEq, recv);
+	CALL_SIMPLE_METHOD(1, idEq, recv, selEq);
     }
 }
 
@@ -1694,7 +1690,7 @@
 	/* other */
 	PUSH(recv);
 	PUSH(obj);
-	CALL_SIMPLE_METHOD(1, idNeq, recv);
+	CALL_SIMPLE_METHOD(1, idNeq, recv, selNeq);
     }
 }
 
@@ -1723,9 +1719,7 @@
     else {
 	PUSH(recv);
 	PUSH(obj);
-	//static SEL selPLUS=0;
-	//if (selPLUS==0) { selPLUS = sel_registerName("+:"); }
-	CALL_SIMPLE_METHOD(1, idLT, recv);
+	CALL_SIMPLE_METHOD(1, idLT, recv, selLT);
     }
 }
 
@@ -1755,7 +1749,7 @@
 	/* other */
 	PUSH(recv);
 	PUSH(obj);
-	CALL_SIMPLE_METHOD(1, idLE, recv);
+	CALL_SIMPLE_METHOD(1, idLE, recv, selLE);
     }
 }
 
@@ -1784,7 +1778,7 @@
     else {
 	PUSH(recv);
 	PUSH(obj);
-	CALL_SIMPLE_METHOD(1, idGT, recv);
+	CALL_SIMPLE_METHOD(1, idGT, recv, selGT);
     }
 }
 
@@ -1813,7 +1807,7 @@
     else {
 	PUSH(recv);
 	PUSH(obj);
-	CALL_SIMPLE_METHOD(1, idGE, recv);
+	CALL_SIMPLE_METHOD(1, idGE, recv, selGE);
     }
 }
 
@@ -1847,7 +1841,7 @@
       INSN_LABEL(normal_dispatch):
 	PUSH(recv);
 	PUSH(obj);
-	CALL_SIMPLE_METHOD(1, idLTLT, recv);
+	CALL_SIMPLE_METHOD(1, idLTLT, recv, selLTLT);
     }
 }
 
@@ -1877,7 +1871,7 @@
       INSN_LABEL(normal_dispatch):
 	PUSH(recv);
 	PUSH(obj);
-	CALL_SIMPLE_METHOD(1, idAREF, recv);
+	CALL_SIMPLE_METHOD(1, idAREF, recv, selAREF);
     }
 }
 
@@ -1911,7 +1905,7 @@
 	PUSH(recv);
 	PUSH(obj);
 	PUSH(set);
-	CALL_SIMPLE_METHOD(2, idASET, recv);
+	CALL_SIMPLE_METHOD(2, idASET, recv, selASET);
     }
 }
 
@@ -1944,7 +1938,7 @@
     else {
       INSN_LABEL(normal_dispatch):
 	PUSH(recv);
-	CALL_SIMPLE_METHOD(0, idLength, recv);
+	CALL_SIMPLE_METHOD(0, idLength, recv, selLength);
     }
 }
 
@@ -1991,7 +1985,7 @@
     if (0) {
       INSN_LABEL(normal_dispatch):
 	PUSH(recv);
-	CALL_SIMPLE_METHOD(0, idSucc, recv);
+	CALL_SIMPLE_METHOD(0, idSucc, recv, selSucc);
     }
 }
 
@@ -2014,7 +2008,7 @@
     }
     else {
 	PUSH(recv);
-	CALL_SIMPLE_METHOD(0, idNot, recv);
+	CALL_SIMPLE_METHOD(0, idNot, recv, selNot);
     }
 }
 

Modified: MacRuby/branches/lrz_unstable/parse.y
===================================================================
--- MacRuby/branches/lrz_unstable/parse.y	2008-07-30 22:08:27 UTC (rev 387)
+++ MacRuby/branches/lrz_unstable/parse.y	2008-07-31 00:14:44 UTC (rev 388)
@@ -8711,14 +8711,6 @@
 	n->nd_mid = rb_intern(buf);
 	n->nd_args = new_argv;
     }
-    else if (args != NULL && args->nd_argc >= 1) {
-	char buf[512];
-
-	strlcpy(buf, rb_id2name(n->u2.id), sizeof buf);
-	strlcat(buf, ":", sizeof buf);
-
-	n->nd_mid = rb_intern(buf);
-    }
     return n;
 }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080730/9bbf5640/attachment.html 


More information about the macruby-changes mailing list