Beispiel #1
0
 public static void op1_round(SObject arg)
 {
     if (arg is SFixnum)
     {
         return;
     }
     else if (arg is SVL)
     {
         SVL a = (SVL)arg;
         if (a.tag == Tags.RatnumTag)
         {
             Call.callMillicodeSupport1(Constants.MS_RATNUM_ROUND, arg);
             return;
         }
     }
     else if (arg is SByteVL)
     {
         SByteVL a = (SByteVL)arg;
         if (a.tag == Tags.FlonumTag)
         {
             double d = a.unsafeAsDouble(0);
             Reg.Result = Factory.makeFlonum(System.Math.Round(d));
             return;
         }
         else if (a.tag == Tags.BignumTag)
         {
             return;
         }
     }
     Exn.fault(Constants.EX_ROUND, "round: expected real number");
 }
Beispiel #2
0
        public static Procedure getSupportProcedure(int index)
        {
            SObject support = Reg.globalValue("millicode-support");

            if (support is SVL)
            {
                SVL       procedures = (SVL)support;
                Procedure p          = procedures.elementAt(index) as Procedure;
                if (p != null)
                {
                    return(p);
                }
                else
                {
                    Exn.internalError("millicode support " + index + " not a procedure");
                    return(null);
                }
            }
            else if (support == Factory.Undefined)
            {
                Exn.internalError("millicode-support is not defined (index: " + index + ")");
                return(null);
            }
            else
            {
                Exn.internalError("millicode-support is not a vector");
                return(null);
            }
        }
Beispiel #3
0
 public static SObject op1_imag_part(SObject arg)
 {
     if (arg is SFixnum)
     {
         return(Factory.makeFixnum(0));
     }
     else if (arg is SVL)
     {
         SVL a = (SVL)arg;
         if (a.tag == Tags.BignumTag
             | a.tag == Tags.RatnumTag)
         {
             return(Factory.makeFixnum(0));
         }
         else if (a.tag == Tags.RectnumTag)
         {
             return(Number.rectImagPart(a));
         }
     }
     else if (arg is SByteVL)
     {
         SByteVL a = (SByteVL)arg;
         if (a.tag == Tags.FlonumTag)
         {
             return(Factory.makeFixnum(0));
         }
         else if (a.tag == Tags.CompnumTag)
         {
             return(Number.compImagPart(a));
         }
     }
     Exn.fault(Constants.EX_IMAGPART,
               "not a number");
     return(Factory.Unspecified);
 }
Beispiel #4
0
        public static void op2_minus(SObject arg1, SObject arg2)
        {
            if (arg1 is SFixnum & arg2 is SFixnum)
            {
                int a = ((SFixnum)arg1).value;
                int b = ((SFixnum)arg2).value;
                Reg.Result = Factory.makeNumber(a - b);
                return;
            }
            else if (arg1 is SVL & arg2 is SVL)
            {
                SVL a = (SVL)arg1;
                SVL b = (SVL)arg2;
                if (a.tag == Tags.RatnumTag & b.tag == Tags.RatnumTag)
                {
                    Call.callMillicodeSupport2(Constants.MS_RATNUM_SUB, a, b);
                    return; // TAIL CALL
                }
                else if (a.tag == Tags.RectnumTag & b.tag == Tags.RectnumTag)
                {
                    Call.callMillicodeSupport2(Constants.MS_RECTNUM_SUB, a, b);
                    return; // TAIL CALL
                }
            }
            else if (arg1 is SByteVL & arg2 is SByteVL)
            {
                SByteVL a = (SByteVL)arg1;
                SByteVL b = (SByteVL)arg2;
                if (a.tag == Tags.BignumTag & b.tag == Tags.BignumTag)
                {
                    Call.callMillicodeSupport2(Constants.MS_BIGNUM_SUB, a, b);
                    return; // TAIL CALL
                }
                else if (a.tag == Tags.FlonumTag & b.tag == Tags.FlonumTag)
                {
                    double av     = a.unsafeAsDouble(0);
                    double bv     = b.unsafeAsDouble(0);
                    double result = av - bv;
                    Reg.Result = Factory.makeFlonum(result);
                    return;
                }
                else if (a.tag == Tags.CompnumTag & b.tag == Tags.CompnumTag)
                {
                    double ar = a.unsafeAsDouble(0);
                    double ai = a.unsafeAsDouble(1);
                    double br = b.unsafeAsDouble(0);
                    double bi = b.unsafeAsDouble(1);
                    Reg.Result = Factory.makeCompnum(ar - br, ai - bi);
                    return;
                }
            }
            Procedure generic
                = Call.getSupportProcedure(Constants.MS_GENERIC_SUB);

            Call.contagion(arg1, arg2, generic);
            return; // TAIL CALL
        }
Beispiel #5
0
        public static void op2_numeric_equals(SObject arg1, SObject arg2)
        {
            if (arg1 is SFixnum & arg2 is SFixnum)
            {
                bool result = ((SFixnum)arg1).value == ((SFixnum)arg2).value;
                Reg.Result = Factory.makeBoolean(result);
                return;
            }
            else if (arg1 is SVL & arg2 is SVL)
            {
                SVL a = (SVL)arg1;
                SVL b = (SVL)arg2;
                if (a.tag == Tags.RatnumTag & b.tag == Tags.RatnumTag)
                {
                    Call.callMillicodeSupport2(Constants.MS_RATNUM_EQUAL, a, b);
                    return; // TAIL CALL
                }
                else if (a.tag == Tags.RectnumTag & b.tag == Tags.RectnumTag)
                {
                    Call.callMillicodeSupport2(Constants.MS_RECTNUM_EQUAL, a, b);
                    return; // TAIL CALL
                }
            }
            else if (arg1 is SByteVL & arg2 is SByteVL)
            {
                SByteVL a = (SByteVL)arg1;
                SByteVL b = (SByteVL)arg2;
                if (a.tag == Tags.BignumTag &
                    b.tag == Tags.BignumTag)
                {
                    Call.callMillicodeSupport2(Constants.MS_BIGNUM_EQUAL, a, b);
                    return; // TAIL CALL
                }
                else if (a.tag == Tags.FlonumTag & b.tag == Tags.FlonumTag)
                {
                    double av = a.unsafeAsDouble(0);
                    double bv = b.unsafeAsDouble(0);
                    Reg.Result = Factory.makeBoolean(av == bv);
                    return;
                }
                else if (a.tag == Tags.CompnumTag & b.tag == Tags.CompnumTag)
                {
                    double ar = a.unsafeAsDouble(0);
                    double ai = a.unsafeAsDouble(1);
                    double br = b.unsafeAsDouble(0);
                    double bi = b.unsafeAsDouble(1);
                    Reg.Result = Factory.makeBoolean(ar == br & ai == bi);
                    return;
                }
            }
            Procedure generic
                = Call.getSupportProcedure(Constants.MS_GENERIC_EQUAL);

            Call.econtagion(arg1, arg2, generic);
            return; // TAIL CALL
        }
    public void OnPostprocessBuild(BuildReport report)
    {
        //Calculate build time
        SVL.buildTime = EditorApplication.timeSinceStartup - SVL.buildTime;

        //Sort the results and make row data
        SVL.Sorting();

        //Prepare CSV string
        List <string[]> outputRows = new List <string[]>();

        //Write Overview Result
        outputRows.Add(new string[] { "Build Time (seonds)", SVL.buildTime.ToString("0.000") });
        outputRows.Add(new string[] { "Shader Count", "" + SVL.shaderlist.Count });
        outputRows.Add(new string[] { "Total Variant Count", "" + SVL.variantTotalCount });
        //outputRows.Add( new string[] { "Total Data Count" , ""+SVL.compiledTotalCount } );
        outputRows.Add(new string[] { "" });

        //Write Shader Result
        outputRows.Add(new string[] { "Shader", "Variant Count" });
        for (int i = 0; i < SVL.shaderlist.Count; i++)
        {
            outputRows.Add(new string[] { SVL.shaderlist[i].name, "" + SVL.shaderlist[i].noOfVariantsForThisShader });
        }
        outputRows.Add(new string[] { "" });

        //Write Each variant Result
        for (int i = 0; i < SVL.rowData.Count; i++)
        {
            outputRows.Add(SVL.rowData[i]);
        }

        //Prepare CSV string
        int           length    = outputRows.Count;
        string        delimiter = ",";
        StringBuilder sb        = new StringBuilder();

        for (int index = 0; index < length; index++)
        {
            sb.AppendLine(string.Join(delimiter, outputRows[index]));
        }

        //Write to CSV file
        ShaderVariantTool.folderPath = Application.dataPath.Replace("/Assets", "/");
        ShaderVariantTool.savedFile  = ShaderVariantTool.folderPath + "ShaderVariants_" + DateTime.Now.ToString("yyyyMMdd_hh-mm-ss") + ".csv";
        StreamWriter outStream = System.IO.File.CreateText(ShaderVariantTool.savedFile);

        outStream.WriteLine(sb);
        outStream.Close();

        //CleanUp
        outputRows.Clear();

        // TO DO - read the editor log shader compiled info
        //Debug.Log("MyCustomBuildProcessor.OnPostprocessBuild for target " + report.summary.platform + " at path " + report.summary.outputPath);
    }
Beispiel #7
0
        public void fillFromVector(SVL hframe)
        {
            SObject[] elements = hframe.elements;

            this.prepare(elements.Length - Cont.HC_OVERHEAD - 1);
            this.returnIndex = ((SFixnum)elements[Cont.HC_RETOFFSET]).value;
            for (int si = 0; si <= this.lastslot; ++si)
            {
                this.setSlot(si, elements[si + Cont.HC_OVERHEAD]);
            }
        }
Beispiel #8
0
        public static void op2_greater_or_equal(SObject arg1, SObject arg2)
        {
            if (arg1 is SFixnum & arg2 is SFixnum)
            {
                bool result =
                    ((SFixnum)arg1).value >= ((SFixnum)arg2).value;
                Reg.Result = Factory.makeBoolean(result);
                return;
            }
            else if (arg1 is SVL & arg2 is SVL)
            {
                SVL a = (SVL)arg1;
                SVL b = (SVL)arg2;
                if (a.tag == Tags.RatnumTag & b.tag == Tags.RatnumTag)
                {
                    Call.callMillicodeSupport2(Constants.MS_RATNUM_GREATEREQ, a, b);
                    return; // TAIL CALL
                }
                else if (a.tag == Tags.RectnumTag & b.tag == Tags.RectnumTag)
                {
                    Exn.fault(Constants.EX_GREATEREQP, ">= cannot compare rectnums");
                    return; // TAIL CALL
                }
            }
            else if (arg1 is SByteVL & arg2 is SByteVL)
            {
                SByteVL a = (SByteVL)arg1;
                SByteVL b = (SByteVL)arg2;
                if (a.tag == Tags.BignumTag & b.tag == Tags.BignumTag)
                {
                    Call.callMillicodeSupport2(Constants.MS_BIGNUM_GREATEREQ, a, b);
                    return; // TAIL CALL
                }
                else if (a.tag == Tags.FlonumTag & b.tag == Tags.FlonumTag)
                {
                    double av = a.unsafeAsDouble(0);
                    double bv = b.unsafeAsDouble(0);
                    Reg.Result = Factory.makeBoolean(av >= bv);
                    return;
                }
                else if (a.tag == Tags.CompnumTag & b.tag == Tags.CompnumTag)
                {
                    Exn.fault(Constants.EX_GREATEREQP, ">= cannot compare compnums");
                    return;
                }
            }
            Procedure generic
                = Call.getSupportProcedure(Constants.MS_GENERIC_GREATEREQ);

            Call.pcontagion(arg1, arg2, generic);
            return; // TAIL CALL
        }
Beispiel #9
0
        public static void rangeCheckVL(SObject arg1, SObject arg2, SObject arg3, int blame)
        {
            SVL bv    = (SVL)arg1;
            int index = ((SFixnum)arg2).value;

            if (index >= 0 && index < bv.elements.Length)
            {
            }
            else
            {
                Exn.fault(blame, "index out of range", arg1, arg2, arg3);
            }
        }
Beispiel #10
0
        public static SVL internSymbol(string str)
        {
            if (!allowInternSymbol)
            {
                Exn.internalError("interning symbols no longer allowed");
                return(null);
            }
            SVL sym = (SVL)internedSymbols[str];

            if (sym == null)
            {
                sym = makeSymbolUninterned(str);
                internedSymbols[str] = sym;
            }
            return(sym);
        }
Beispiel #11
0
        public static void dumpContinuation()
        {
            msg.WriteLine("Continuation:");
            SObject sframe = Cont.getCC();
            int     i      = 0;

            while (sframe is SVL)
            {
                SVL frame = (SVL)sframe;
                dumpFrame(frame.elements, i);
                sframe = frame.elements[Cont.HC_DYNLINK];
                i++;
            }
            msg.WriteLine("  Continuation ended with {0}", sframe);
            msg.WriteLine();
        }
Beispiel #12
0
 public static void op1_negative(SObject arg)
 {
     if (arg is SFixnum)
     {
         int a = ((SFixnum)arg).value;
         Reg.Result = Factory.makeNumber(-a);
         return;
     }
     else if (arg is SVL)
     {
         SVL a = (SVL)arg;
         if (a.tag == Tags.RatnumTag)
         {
             Call.callMillicodeSupport1(Constants.MS_RATNUM_NEGATE, a);
             return; // TAIL CALL
         }
         else if (a.tag == Tags.RectnumTag)
         {
             Call.callMillicodeSupport1(Constants.MS_RECTNUM_NEGATE, a);
             return;
         }
     }
     else if (arg is SByteVL)
     {
         SByteVL a = (SByteVL)arg;
         if (a.tag == Tags.BignumTag)
         {
             Call.callMillicodeSupport1(Constants.MS_BIGNUM_NEGATE, a);
             return;
         }
         else if (a.tag == Tags.FlonumTag)
         {
             Reg.Result = Factory.makeFlonum(-a.unsafeAsDouble(0));
             return;
         }
         else if (a.tag == Tags.CompnumTag)
         {
             double real = a.unsafeAsDouble(0);
             double imag = a.unsafeAsDouble(1);
             Reg.Result = Factory.makeCompnum(-real, -imag);
             return;
         }
     }
     Exn.fault(Constants.EX_NEG, "not a number");
     return;
 }
Beispiel #13
0
        /* Comparison Operations */
        /* --------------------- */

        public static void op1_zerop(SObject arg)
        {
            if (arg is SFixnum)
            {
                Reg.Result = Factory.makeBoolean(((SFixnum)arg).value == 0);
                return;
            }
            else if (arg is SVL)
            {
                SVL a = (SVL)arg;
                if (a.tag == Tags.RatnumTag)
                {
                    Reg.Result = Factory.False; // FIXME???
                }
                else if (a.tag == Tags.RectnumTag)
                {
                    op2_numeric_equals(arg, Factory.makeFixnum(0));
                    return;
                }
            }
            else if (arg is SByteVL)
            {
                SByteVL a = (SByteVL)arg;
                if (a.tag == Tags.BignumTag)
                {
                    Reg.Result = Factory.makeBoolean(Number.getBignumLength(a) == 0);
                    return;
                }
                else if (a.tag == Tags.FlonumTag)
                {
                    Reg.Result = Factory.makeBoolean(a.unsafeAsDouble(0) == 0.0);
                    return;
                }
                else if (a.tag == Tags.CompnumTag)
                {
                    Reg.Result = Factory.makeBoolean
                                     (a.unsafeAsDouble(0) == 0.0 &
                                     a.unsafeAsDouble(1) == 0.0);
                    return;
                }
            }
            Reg.Result = Factory.makeBoolean(false);
            return;
        }
Beispiel #14
0
        /* fillCache
         */
        public static void fillCache()
        {
#if HAS_PERFORMANCE_COUNTERS
            if (stackReloadCounter != null)
            {
                stackReloadCounter.Increment();
            }
#endif
            cont = ROOT;
            SVL h = heap as SVL;

            if (h == null)
            {
                Exn.internalError("fillCache: Cont.heap is not a vector");
            }
            else
            {
                heap = h.elements[Cont.HC_DYNLINK];
                cont.fillFromVector(h);
            }
        }
Beispiel #15
0
        // file modification time
        private static void mtime()
        {
            string file = ((SByteVL)Reg.Register2).asString();
            SVL    v    = (SVL)Reg.Register3;

            try {
                DateTime time = File.GetLastWriteTime(file);
                v.setElementAt(0, Factory.makeFixnum(time.Year));
                v.setElementAt(1, Factory.makeFixnum(time.Month));
                v.setElementAt(2, Factory.makeFixnum(time.Day));
                v.setElementAt(3, Factory.makeFixnum(time.Hour));
                v.setElementAt(4, Factory.makeFixnum(time.Minute));
                v.setElementAt(5, Factory.makeFixnum(time.Second));

                Reg.Result = Factory.makeFixnum(0);
            }
            // file doesn't exist, or bad path name...
            catch (Exception) {
                Reg.Result = Factory.makeFixnum(-1);
            }
        }
Beispiel #16
0
 public static void op1_truncate(SObject arg)
 {
     if (arg is SFixnum)
     {
         Reg.Result = arg;
         return;
     }
     else if (arg is SVL)
     {
         SVL a = (SVL)arg;
         if (a.tag == Tags.RatnumTag)
         {
             Call.callMillicodeSupport1(Constants.MS_RATNUM_TRUNCATE, arg);
             return;
         }
     }
     else if (arg is SByteVL)
     {
         SByteVL a = (SByteVL)arg;
         if (a.tag == Tags.FlonumTag)
         {
             double d = a.unsafeAsDouble(0);
             if (d < 0)
             {
                 Reg.Result = Factory.makeFlonum(System.Math.Ceiling(d));
                 return;
             }
             else
             {
                 Reg.Result = Factory.makeFlonum(System.Math.Floor(d));
                 return;
             }
         }
         else if (a.tag == Tags.BignumTag)
         {
             return;
         }
     }
     Exn.fault(Constants.EX_TRUNC, "truncate: expected real number");
 }
Beispiel #17
0
 public static void op1_inexact2exact(SObject arg)
 {
     if (arg is SFixnum)
     {
         return;
     }
     else if (arg is SVL)
     {
         SVL a = (SVL)arg;
     }
     else if (arg is SByteVL)
     {
         SByteVL a = (SByteVL)arg;
         if (a.tag == Tags.FlonumTag
             | a.tag == Tags.CompnumTag)
         {
             Call.callMillicodeSupport1(Constants.MS_GENERIC_INEXACT2EXACT, arg);
             return;
         }
         else if (a.tag == Tags.BignumTag)
         {
             return;
         }
     }
     else if (arg is SVL)
     {
         SVL a = (SVL)arg;
         if (a.tag == Tags.RatnumTag)
         {
             return;
         }
         else if (a.tag == Tags.RectnumTag)
         {
             return;
         }
     }
     Exn.fault(Constants.EX_I2E, "not a number");
     return;
 }
Beispiel #18
0
        public static void op2_divide(SObject arg1, SObject arg2)
        {
            if (arg1 is SFixnum & arg2 is SFixnum)
            {
                int a = ((SFixnum)arg1).value;
                int b = ((SFixnum)arg2).value;
                if (b != 0)
                {
                    int result = a / b;
                    if (result * b == a)
                    {
                        Reg.Result = Factory.makeFixnum(result);
                        return;
                    }
                }
                else
                {
                    Exn.fault(Constants.EX_DIV, "division by zero", arg1, arg2);
                    return;
                }
                Call.callMillicodeSupport2(Constants.MS_FIXNUM2RATNUM_DIV,
                                           arg1, arg2);
                return; // TAIL CALL
            }
            else if (arg1 is SVL & arg2 is SVL)
            {
                SVL a = (SVL)arg1;
                SVL b = (SVL)arg2;
                if (a.tag == Tags.RatnumTag & b.tag == Tags.RatnumTag)
                {
                    Call.callMillicodeSupport2(Constants.MS_RATNUM_DIV, a, b);
                    return; // TAIL CALL
                }
                else if (a.tag == Tags.RectnumTag & b.tag == Tags.RectnumTag)
                {
                    Call.callMillicodeSupport2(Constants.MS_RECTNUM_DIV, a, b);
                    return; // TAIL CALL
                }
            }
            else if (arg1 is SByteVL & arg2 is SByteVL)
            {
                SByteVL a = (SByteVL)arg1;
                SByteVL b = (SByteVL)arg2;
                if (a.tag == Tags.BignumTag & b.tag == Tags.BignumTag)
                {
                    Call.callMillicodeSupport2(Constants.MS_BIGNUM_DIV, a, b);
                    return; // TAIL CALL
                }
                else if (a.tag == Tags.FlonumTag & b.tag == Tags.FlonumTag)
                {
                    double av     = a.unsafeAsDouble(0);
                    double bv     = b.unsafeAsDouble(0);
                    double result = av / bv;
                    Reg.Result = Factory.makeFlonum(result);
                    return;
                }
                else if (a.tag == Tags.CompnumTag & b.tag == Tags.CompnumTag)
                {
                    double ar    = a.unsafeAsDouble(0);
                    double ai    = a.unsafeAsDouble(1);
                    double br    = b.unsafeAsDouble(0);
                    double bi    = b.unsafeAsDouble(1);
                    double denom = br * br + bi * bi;
                    Reg.Result = Factory.makeCompnum
                                     ((ar * br + ai * bi) / denom,
                                     (ai * br - ar * bi) / denom);
                    return;
                }
            }
            Procedure generic
                = Call.getSupportProcedure(Constants.MS_GENERIC_DIV);

            Call.contagion(arg1, arg2, generic);
            return; // TAIL CALL
        }
Beispiel #19
0
  public void fillFromVector (SVL hframe)
  {
    SObject[] elements = hframe.elements;

    this.prepare (elements.Length - Cont.HC_OVERHEAD - 1);
    this.returnIndex = ((SFixnum)elements[Cont.HC_RETOFFSET]).value;
    for (int si = 0; si <= this.lastslot; ++si) {
	this.setSlot (si, elements[si + Cont.HC_OVERHEAD]);
	}
  }
Beispiel #20
0
 public static SObject rectImagPart(SVL n) {
     return n.elements[1];
 }
Beispiel #21
0
 // ============
 //   Complex
 // ============
 
 public static SObject rectRealPart(SVL n) {
     return n.elements[0];
 }
Beispiel #22
0
        // ============
        //   Complex
        // ============

        public static SObject rectRealPart(SVL n)
        {
            return(n.elements[0]);
        }
Beispiel #23
0
 public static SObject rectImagPart(SVL n)
 {
     return(n.elements[1]);
 }
Beispiel #24
0
        public static void op2_multiply(SObject arg1, SObject arg2)
        {
            if (arg1 is SFixnum & arg2 is SFixnum)
            {
                long a = ((SFixnum)arg1).value;
                long b = ((SFixnum)arg2).value;
                Reg.Result = Factory.makeNumber(a * b);
                return;
            }
            else if (arg1 is SVL & arg2 is SVL)
            {
                SVL a = (SVL)arg1;
                SVL b = (SVL)arg2;
                if (a.tag == Tags.RatnumTag &
                    b.tag == Tags.RatnumTag)
                {
                    Call.callMillicodeSupport2(Constants.MS_RATNUM_MUL, a, b);
                    return; // TAIL CALL
                }
                else if (a.tag == Tags.RectnumTag & b.tag == Tags.RectnumTag)
                {
                    Call.callMillicodeSupport2(Constants.MS_RECTNUM_MUL, a, b);
                    return; // TAIL CALL
                }
            }
            else if (arg1 is SByteVL & arg2 is SByteVL)
            {
                SByteVL a = (SByteVL)arg1;
                SByteVL b = (SByteVL)arg2;
                if (a.tag == Tags.BignumTag & b.tag == Tags.BignumTag)
                {
                    Call.callMillicodeSupport2(Constants.MS_BIGNUM_MUL, a, b);
                    return; // TAIL CALL
                }
                else if (a.tag == Tags.FlonumTag & b.tag == Tags.FlonumTag)
                {
                    double av     = a.unsafeAsDouble(0);
                    double bv     = b.unsafeAsDouble(0);
                    double result = av * bv;
                    Reg.Result = Factory.makeFlonum(result);
                    return;
                }
                else if (a.tag == Tags.CompnumTag)
                {
                    double ar = a.unsafeAsDouble(0);
                    double ai = a.unsafeAsDouble(1);
                    if (b.tag == Tags.CompnumTag)
                    {
                        double br = b.unsafeAsDouble(0);
                        double bi = b.unsafeAsDouble(1);
                        // We have to consider separately the case where one
                        // of the imaginary parts is 0 in order to avoid
                        // getting NaN.
                        if (ai == 0)
                        {
                            double real = ar * br;
                            double imag = ar * bi;
                            Reg.Result = Factory.makeCompnum(real, imag);
                        }
                        else if (bi == 0)
                        {
                            double real = ar * br;
                            double imag = ai * br;
                            Reg.Result = Factory.makeCompnum(real, imag);
                        }
                        else
                        {
                            double real = ar * br - ai * bi;
                            double imag = ar * bi + ai * br;
                            Reg.Result = Factory.makeCompnum(real, imag);
                        }
                        return;
                    }
                    else if (b.tag == Tags.FlonumTag & ai == 0.0)
                    {
                        double br = b.unsafeAsDouble(0);
                        Reg.Result = Factory.makeFlonum(ar * br);
                        return;
                    }
                }
            }
            Procedure generic
                = Call.getSupportProcedure(Constants.MS_GENERIC_MUL);

            Call.contagion(arg1, arg2, generic);
            return; // TAIL CALL
        }
Beispiel #25
0
 public static void op2_eqvp(SObject arg1, SObject arg2)
 {
     // EQ test first, get that out of the way.
     if (arg1 == arg2)
     {
         Reg.Result = Factory.True;
         return;
     }
     else if (arg1 is SChar & arg2 is SChar)
     {
         Reg.Result = Factory.wrap(((SChar)arg1).val == ((SChar)arg2).val);
         return;
     }
     else if (arg1 is SFixnum & arg2 is SFixnum)
     {
         bool result =
             ((SFixnum)arg1).value == ((SFixnum)arg2).value;
         Reg.Result = Factory.makeBoolean(result);
         return;
     }
     else if (arg1 is SVL & arg2 is SVL)
     {
         SVL a = (SVL)arg1;
         SVL b = (SVL)arg2;
         if (a.tag == Tags.RatnumTag & b.tag == Tags.RatnumTag)
         {
             Call.callMillicodeSupport2(Constants.MS_RATNUM_EQUAL, a, b);
             return; // TAIL CALL
         }
         else if (a.tag == Tags.RectnumTag & b.tag == Tags.RectnumTag)
         {
             Call.callMillicodeSupport2(Constants.MS_RECTNUM_EQUAL, a, b);
             return; // TAIL CALL
         }
         else
         {
             Reg.Result = Factory.False;
             return;
         }
     }
     else if (arg1 is SByteVL & arg2 is SByteVL)
     {
         SByteVL a = (SByteVL)arg1;
         SByteVL b = (SByteVL)arg2;
         if (a.tag == Tags.BignumTag & b.tag == Tags.BignumTag)
         {
             Call.callMillicodeSupport2(Constants.MS_BIGNUM_EQUAL, a, b);
             return; // TAIL CALL
         }
         else if (a.tag == Tags.FlonumTag & b.tag == Tags.FlonumTag)
         {
             double av = a.unsafeAsDouble(0);
             double bv = b.unsafeAsDouble(0);
             Reg.Result = Factory.makeBoolean(av == bv);
             return;
         }
         else if (a.tag == Tags.CompnumTag & b.tag == Tags.CompnumTag)
         {
             double ar = a.unsafeAsDouble(0);
             double ai = a.unsafeAsDouble(1);
             double br = b.unsafeAsDouble(0);
             double bi = b.unsafeAsDouble(1);
             Reg.Result = Factory.makeBoolean(ar == br & ai == bi);
             return;
         }
         else
         {
             Reg.Result = Factory.False;
             return;
         }
     }
     else
     {
         Reg.Result = Factory.False;
         return;
     }
 }