<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -683,6 +683,12 @@ nucomp_add(VALUE self, SEL sel, VALUE other)
     return f_addsub(self, other, f_add, selPLUS);
 }
 
+VALUE
+rb_nu_plus(VALUE x, VALUE y)
+{
+    return f_addsub(x, y, f_add, selPLUS);
+}
+
 /*
  * call-seq:
  *    cmp - numeric  -&gt;  complex
@@ -695,6 +701,12 @@ nucomp_sub(VALUE self, SEL sel, VALUE other)
     return f_addsub(self, other, f_sub, selMINUS);
 }
 
+VALUE
+rb_nu_minus(VALUE x, VALUE y)
+{
+    return f_addsub(x, y, f_sub, selMINUS);
+}
+
 /*
  * call-seq:
  *    cmp * numeric  -&gt;  complex
@@ -726,6 +738,12 @@ nucomp_mul(VALUE self, SEL sel, VALUE other)
     return rb_objc_num_coerce_bin(self, other, selMULT);
 }
 
+VALUE
+rb_nu_mul(VALUE x, VALUE y)
+{
+    return nucomp_mul(x, 0, y);
+}
+
 inline static VALUE
 f_divide(VALUE self, VALUE other,
 	 VALUE (*func)(VALUE, VALUE), SEL op)
@@ -801,6 +819,12 @@ nucomp_div(VALUE self, SEL sel, VALUE other)
     return f_divide(self, other, f_quo, sel_quo);
 }
 
+VALUE
+rb_nu_div(VALUE x, VALUE y)
+{
+    return nucomp_div(x, 0, y);
+}
+
 #define nucomp_quo nucomp_div
 
 /*</diff>
      <filename>complex.c</filename>
    </modified>
    <modified>
      <diff>@@ -659,8 +659,8 @@ flo_uminus(VALUE flt, SEL sel)
  * and &lt;code&gt;other&lt;/code&gt;.
  */
 
-static VALUE
-flo_plus(VALUE x, SEL sel, VALUE y)
+VALUE
+rb_flo_plus(VALUE x, VALUE y)
 {
     switch (TYPE(y)) {
       case T_FIXNUM:
@@ -674,6 +674,12 @@ flo_plus(VALUE x, SEL sel, VALUE y)
     }
 }
 
+static VALUE
+flo_plus(VALUE x, SEL sel, VALUE y)
+{
+    return rb_flo_plus(x, y);
+}
+
 /*
  * call-seq:
  *   float + other   =&gt; float
@@ -682,8 +688,8 @@ flo_plus(VALUE x, SEL sel, VALUE y)
  * and &lt;code&gt;other&lt;/code&gt;.
  */
 
-static VALUE
-flo_minus(VALUE x, SEL sel, VALUE y)
+VALUE
+rb_flo_minus(VALUE x, VALUE y)
 {
     switch (TYPE(y)) {
       case T_FIXNUM:
@@ -697,6 +703,12 @@ flo_minus(VALUE x, SEL sel, VALUE y)
     }
 }
 
+static VALUE
+flo_minus(VALUE x, SEL sel, VALUE y)
+{
+    return rb_flo_minus(x, y);
+}
+
 /*
  * call-seq:
  *   float * other   =&gt; float
@@ -705,8 +717,8 @@ flo_minus(VALUE x, SEL sel, VALUE y)
  * and &lt;code&gt;other&lt;/code&gt;.
  */
 
-static VALUE
-flo_mul(VALUE x, SEL sel, VALUE y)
+VALUE
+rb_flo_mul(VALUE x, VALUE y)
 {
     switch (TYPE(y)) {
       case T_FIXNUM:
@@ -720,6 +732,12 @@ flo_mul(VALUE x, SEL sel, VALUE y)
     }
 }
 
+static VALUE
+flo_mul(VALUE x, SEL sel, VALUE y)
+{
+    return rb_flo_mul(x, y);
+}
+
 /*
  * call-seq:
  *   float / other   =&gt; float
@@ -728,8 +746,8 @@ flo_mul(VALUE x, SEL sel, VALUE y)
  * &lt;code&gt;float&lt;/code&gt; by &lt;code&gt;other&lt;/code&gt;.
  */
 
-static VALUE
-flo_div(VALUE x, SEL sel, VALUE y)
+VALUE
+rb_flo_div(VALUE x, VALUE y)
 {
     long f_y;
     double d;
@@ -749,6 +767,12 @@ flo_div(VALUE x, SEL sel, VALUE y)
 }
 
 static VALUE
+flo_div(VALUE x, SEL sel, VALUE y)
+{
+    return rb_flo_div(x, y);
+}
+
+static VALUE
 flo_quo(VALUE x, SEL sel, VALUE y)
 {
     return rb_vm_call(x, selDIV, 1, &amp;y, false);
@@ -2183,8 +2207,8 @@ fix_to_s(VALUE x, SEL sel, int argc, VALUE *argv)
  * result.
  */
 
-static VALUE
-fix_plus(VALUE x, SEL sel, VALUE y)
+VALUE
+rb_fix_plus(VALUE x, VALUE y)
 {
     if (FIXNUM_P(y)) {
 	long a, b, c;
@@ -2207,6 +2231,12 @@ fix_plus(VALUE x, SEL sel, VALUE y)
     }
 }
 
+static VALUE
+fix_plus(VALUE x, SEL sel, VALUE y)
+{
+    return rb_fix_plus(x, y);
+}
+
 /*
  * call-seq:
  *   fix - numeric   =&gt;  numeric_result
@@ -2216,8 +2246,8 @@ fix_plus(VALUE x, SEL sel, VALUE y)
  * result.
  */
 
-static VALUE
-fix_minus(VALUE x, SEL sel, VALUE y)
+VALUE
+rb_fix_minus(VALUE x, VALUE y)
 {
     if (FIXNUM_P(y)) {
 	long a, b, c;
@@ -2241,6 +2271,12 @@ fix_minus(VALUE x, SEL sel, VALUE y)
     }
 }
 
+static VALUE
+fix_minus(VALUE x, SEL sel, VALUE y)
+{
+    return rb_fix_minus(x, y);
+}
+
 #define SQRT_LONG_MAX ((SIGNED_VALUE)1&lt;&lt;((SIZEOF_LONG*CHAR_BIT-1)/2))
 /*tests if N*N would overflow*/
 #define FIT_SQRT_LONG(n) (((n)&lt;SQRT_LONG_MAX)&amp;&amp;((n)&gt;=-SQRT_LONG_MAX))
@@ -2254,8 +2290,8 @@ fix_minus(VALUE x, SEL sel, VALUE y)
  * result.
  */
 
-static VALUE
-fix_mul(VALUE x, SEL sel, VALUE y)
+VALUE
+rb_fix_mul(VALUE x, VALUE y)
 {
     if (FIXNUM_P(y)) {
 #ifdef __HP_cc
@@ -2300,6 +2336,12 @@ fix_mul(VALUE x, SEL sel, VALUE y)
     }
 }
 
+static VALUE
+fix_mul(VALUE x, SEL sel, VALUE y)
+{
+    return rb_fix_mul(x, y);
+}
+
 static void
 fixdivmod(long x, long y, long *divp, long *modp)
 {
@@ -2406,6 +2448,12 @@ fix_div(VALUE x, SEL sel, VALUE y)
     return fix_divide(x, y, selDIV);
 }
 
+VALUE
+rb_fix_div(VALUE x, VALUE y)
+{
+    return fix_divide(x, y, selDIV);
+}
+
 /*
  * call-seq:
  *   fix.div(numeric)   =&gt;  numeric_result</diff>
      <filename>numeric.c</filename>
    </modified>
    <modified>
      <diff>@@ -2645,12 +2645,16 @@ __rb_vm_dispatch(RoxorVM *vm, struct mcache *cache, VALUE self, Class klass,
     }
 
 #if ROXOR_VM_DEBUG
-    const bool cached = cache-&gt;flag != 0;
+    bool cached = true;
 #endif
     bool do_rcache = true;
 
     if (cache-&gt;flag == 0) {
 recache:
+#if ROXOR_VM_DEBUG
+	cached = false;
+#endif
+
 	Method method;
 	if (opt == DISPATCH_SUPER) {
 	    method = rb_vm_super_lookup((VALUE)klass, sel);
@@ -3041,6 +3045,21 @@ rb_vm_dispatch(struct mcache *cache, VALUE self, SEL sel, rb_vm_block_t *block,
 // not, because this is already handled by the compiler.
 // Also, fixnums and floats are already handled.
 
+extern &quot;C&quot; {
+    VALUE rb_fix_plus(VALUE x, VALUE y);
+    VALUE rb_fix_minus(VALUE x, VALUE y);
+    VALUE rb_fix_div(VALUE x, VALUE y);
+    VALUE rb_fix_mul(VALUE x, VALUE y);
+    VALUE rb_flo_plus(VALUE x, VALUE y);
+    VALUE rb_flo_minus(VALUE x, VALUE y);
+    VALUE rb_flo_div(VALUE x, VALUE y);
+    VALUE rb_flo_mul(VALUE x, VALUE y);
+    VALUE rb_nu_plus(VALUE x, VALUE y);
+    VALUE rb_nu_minus(VALUE x, VALUE y);
+    VALUE rb_nu_div(VALUE x, VALUE y);
+    VALUE rb_nu_mul(VALUE x, VALUE y);
+}
+
 extern &quot;C&quot;
 VALUE
 rb_vm_fast_plus(struct mcache *cache, VALUE self, VALUE other)
@@ -3049,6 +3068,12 @@ rb_vm_fast_plus(struct mcache *cache, VALUE self, VALUE other)
 	// TODO: Array, String
 	case T_BIGNUM:
 	    return rb_big_plus(self, other);
+	case T_FIXNUM:
+	    return rb_fix_plus(self, other);
+	case T_FLOAT:
+	    return rb_flo_plus(self, other);
+	case T_COMPLEX:
+	    return rb_nu_plus(self, other);
     }
     return rb_vm_dispatch(cache, self, selPLUS, NULL, 0, 1, other);
 }
@@ -3061,6 +3086,12 @@ rb_vm_fast_minus(struct mcache *cache, VALUE self, VALUE other)
 	// TODO: Array, String
 	case T_BIGNUM:
 	    return rb_big_minus(self, other);
+	case T_FIXNUM:
+	    return rb_fix_minus(self, other);
+	case T_FLOAT:
+	    return rb_flo_minus(self, other);
+	case T_COMPLEX:
+	    return rb_nu_minus(self, other);
     }
     return rb_vm_dispatch(cache, self, selMINUS, NULL, 0, 1, other);
 }
@@ -3072,6 +3103,12 @@ rb_vm_fast_div(struct mcache *cache, VALUE self, VALUE other)
     switch (TYPE(self)) {
 	case T_BIGNUM:
 	    return rb_big_div(self, other);
+	case T_FIXNUM:
+	    return rb_fix_div(self, other);
+	case T_FLOAT:
+	    return rb_flo_div(self, other);
+	case T_COMPLEX:
+	    return rb_nu_div(self, other);
     }
     return rb_vm_dispatch(cache, self, selDIV, NULL, 0, 1, other);
 }
@@ -3084,6 +3121,12 @@ rb_vm_fast_mult(struct mcache *cache, VALUE self, VALUE other)
 	// TODO: Array, String
 	case T_BIGNUM:
 	    return rb_big_mul(self, other);
+	case T_FIXNUM:
+	    return rb_fix_mul(self, other);
+	case T_FLOAT:
+	    return rb_flo_mul(self, other);
+	case T_COMPLEX:
+	    return rb_nu_mul(self, other);
     }
     return rb_vm_dispatch(cache, self, selMULT, NULL, 0, 1, other);
 }</diff>
      <filename>vm.cpp</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>d8bb5384d483ad1146a9afa21be553887addad11</id>
    </parent>
  </parents>
  <author>
    <name>lsansonetti@apple.com</name>
    <email>lsansonetti@apple.com@23306eb0-4c56-4727-a40e-e92c0eb68959</email>
  </author>
  <url>http://github.com/masterkain/macruby/commit/507c77ecde37c668fa44c415767628ae75ad4406</url>
  <id>507c77ecde37c668fa44c415767628ae75ad4406</id>
  <committed-date>2009-08-27T22:11:13-07:00</committed-date>
  <authored-date>2009-08-27T22:11:13-07:00</authored-date>
  <message>added fixnum/float/complex support for the fast arithmetic primitives

git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/trunk@2402 23306eb0-4c56-4727-a40e-e92c0eb68959</message>
  <tree>3dc8061d969c72afed9ec768e80a5f4a30fe86f0</tree>
  <committer>
    <name>lsansonetti@apple.com</name>
    <email>lsansonetti@apple.com@23306eb0-4c56-4727-a40e-e92c0eb68959</email>
  </committer>
</commit>
