dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dotgnu-pnet-commits] pnet ChangeLog engine/jitc.c engine/Makefile.am...


From: Klaus Treichel
Subject: [dotgnu-pnet-commits] pnet ChangeLog engine/jitc.c engine/Makefile.am...
Date: Wed, 29 Nov 2006 19:49:17 +0000

CVSROOT:        /cvsroot/dotgnu-pnet
Module name:    pnet
Changes by:     Klaus Treichel <ktreichel>      06/11/29 19:49:17

Modified files:
        .              : ChangeLog 
        engine         : jitc.c Makefile.am 
Added files:
        engine         : jitc_math.c 

Log message:
        2006-11-29  Klaus Treichel  <address@hidden>
        
                * engine/jitc.c: Add inlineing of System.Math methods.
        
                * engine/jitc_math.c: added.
        
                * engine/Makefile.am: Add jitc_math.c to the jitc sources.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnet/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3393&r2=1.3394
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/jitc.c?cvsroot=dotgnu-pnet&r1=1.60&r2=1.61
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/Makefile.am?cvsroot=dotgnu-pnet&r1=1.90&r2=1.91
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/jitc_math.c?cvsroot=dotgnu-pnet&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ChangeLog,v
retrieving revision 1.3393
retrieving revision 1.3394
diff -u -b -r1.3393 -r1.3394
--- ChangeLog   28 Nov 2006 19:15:23 -0000      1.3393
+++ ChangeLog   29 Nov 2006 19:49:16 -0000      1.3394
@@ -1,3 +1,11 @@
+2006-11-29  Klaus Treichel  <address@hidden>
+
+       * engine/jitc.c: Add inlineing of System.Math methods.
+
+       * engine/jitc_math.c: added.
+
+       * engine/Makefile.am: Add jitc_math.c to the jitc sources.
+
 2006-11-28  Klaus Treichel  <address@hidden>
 
        * engine/jitc.h: Add System.Array and System.Math to the classes handled

Index: engine/jitc.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/jitc.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -b -r1.60 -r1.61
--- engine/jitc.c       28 Nov 2006 19:15:23 -0000      1.60
+++ engine/jitc.c       29 Nov 2006 19:49:17 -0000      1.61
@@ -311,6 +311,7 @@
 #include "jitc_array.c"
 #include "jitc_call.c"
 #include "jitc_delegate.c"
+#include "jitc_math.c"
 #undef IL_JITC_DECLARATIONS
 
 /*
@@ -3420,6 +3421,133 @@
                                }
                        }
                        break;
+
+                       case IL_JIT_TYPEKIND_SYSTEM_MATH:
+                       {
+                               ILType *signature = ILMethod_Signature(method);
+                               ILType *returnType;
+
+                               if(!signature)
+                               {
+                                       break;
+                               }
+                               if(!(returnType = 
ILTypeGetEnumType(ILTypeGetParam(signature, 0))))
+                               {
+                                       break;
+                               }
+
+                               if(ILType_IsPrimitive(returnType))
+                               {
+                                       if(!strcmp(ILMethod_Name(method), 
"Abs"))
+                                       {
+                                               inlineFunc = 
_ILJitSystemMathAbs;
+                                       }
+                                       else if(!strcmp(ILMethod_Name(method), 
"Acos"))
+                                       {
+                                               inlineFunc = 
_ILJitSystemMathAcos;
+                                       }
+                                       else if(!strcmp(ILMethod_Name(method), 
"Asin"))
+                                       {
+                                               inlineFunc = 
_ILJitSystemMathAsin;
+                                       }
+                                       else if(!strcmp(ILMethod_Name(method), 
"Atan"))
+                                       {
+                                               inlineFunc = 
_ILJitSystemMathAtan;
+                                       }
+                                       else if(!strcmp(ILMethod_Name(method), 
"Atan2"))
+                                       {
+                                               inlineFunc = 
_ILJitSystemMathAtan2;
+                                       }
+                                       else if(!strcmp(ILMethod_Name(method), 
"Ceiling"))
+                                       {
+                                               inlineFunc = 
_ILJitSystemMathCeiling;
+                                       }
+                                       else if(!strcmp(ILMethod_Name(method), 
"Cos"))
+                                       {
+                                               inlineFunc = 
_ILJitSystemMathCos;
+                                       }
+                                       else if(!strcmp(ILMethod_Name(method), 
"Cosh"))
+                                       {
+                                               inlineFunc = 
_ILJitSystemMathCosh;
+                                       }
+                                       else if(!strcmp(ILMethod_Name(method), 
"Exp"))
+                                       {
+                                               inlineFunc = 
_ILJitSystemMathExp;
+                                       }
+                                       else if(!strcmp(ILMethod_Name(method), 
"Floor"))
+                                       {
+                                               inlineFunc = 
_ILJitSystemMathFloor;
+                                       }
+                                       else if(!strcmp(ILMethod_Name(method), 
"IEEERemainder"))
+                                       {
+                                               inlineFunc = 
_ILJitSystemMathIEEERemainder;
+                                       }
+                                       else if(!strcmp(ILMethod_Name(method), 
"Log"))
+                                       {
+                                               ILUInt32 num = 
ILTypeNumParams(signature);
+
+                                               if(num == 1)
+                                               {
+                                                       inlineFunc = 
_ILJitSystemMathLog;
+                                               }
+                                       }
+                                       else if(!strcmp(ILMethod_Name(method), 
"Log10"))
+                                       {
+                                               inlineFunc = 
_ILJitSystemMathLog10;
+                                       }
+                                       else if(!strcmp(ILMethod_Name(method), 
"Max"))
+                                       {
+                                               inlineFunc = 
_ILJitSystemMathMax;
+                                       }
+                                       else if(!strcmp(ILMethod_Name(method), 
"Min"))
+                                       {
+                                               inlineFunc = 
_ILJitSystemMathMin;
+                                       }
+                                       else if(!strcmp(ILMethod_Name(method), 
"Pow"))
+                                       {
+                                               inlineFunc = 
_ILJitSystemMathPow;
+                                       }
+                                       else if(!strcmp(ILMethod_Name(method), 
"Sign"))
+                                       {
+                                               ILUInt32 num = 
ILTypeNumParams(signature);
+
+                                               if(num == 1)
+                                               {
+                                                       ILType *argType;
+
+                                                       if(!(argType = 
ILTypeGetParam(signature, 1)))
+                                                       {
+                                                               break;
+                                                       }
+                                                       
if(ILType_IsPrimitive(argType))
+                                                       {
+                                                               inlineFunc = 
_ILJitSystemMathSign;
+                                                       }
+                                               }
+                                       }
+                                       else if(!strcmp(ILMethod_Name(method), 
"Sin"))
+                                       {
+                                               inlineFunc = 
_ILJitSystemMathSin;
+                                       }
+                                       else if(!strcmp(ILMethod_Name(method), 
"Sinh"))
+                                       {
+                                               inlineFunc = 
_ILJitSystemMathSinh;
+                                       }
+                                       else if(!strcmp(ILMethod_Name(method), 
"Sqrt"))
+                                       {
+                                               inlineFunc = 
_ILJitSystemMathSqrt;
+                                       }
+                                       else if(!strcmp(ILMethod_Name(method), 
"Tan"))
+                                       {
+                                               inlineFunc = 
_ILJitSystemMathTan;
+                                       }
+                                       else if(!strcmp(ILMethod_Name(method), 
"Tanh"))
+                                       {
+                                               inlineFunc = 
_ILJitSystemMathTanh;
+                                       }
+                               }
+                       }
+                       break;
                }
        }
 
@@ -3941,7 +4069,7 @@
        {
                ILType *type = ILClassToType(classPrivate->classInfo);
 
-               /* When it's a runtime object check if it has to be handled 
special. */
+               /* If it's a runtime object check if it has to be handled 
special. */
                if(process->context->systemImage == 
classPrivate->classInfo->programItem.image)
                {
                        jitType = 
_ILJitTypeSpecials(classPrivate->classInfo->className);
@@ -3974,6 +4102,24 @@
                {
                        classPrivate->jitTypes.jitTypeKind = 
IL_JIT_TYPEKIND_ARRAY;
                }
+               else if(process->context->systemImage == 
classPrivate->classInfo->programItem.image)
+               {
+                       if(ILClass_Namespace(classPrivate->classInfo))
+                       {
+                               /* Check for classes in the System namespace 
which have inline methods. */
+                               
if(!strcmp(ILClass_Namespace(classPrivate->classInfo), "System"))
+                               {
+                                       
if(!strcmp(ILClass_Name(classPrivate->classInfo), "Array"))
+                                       {
+                                               
classPrivate->jitTypes.jitTypeKind = IL_JIT_TYPEKIND_SYSTEM_ARRAY;
+                                       }
+                                       else 
if(!strcmp(ILClass_Name(classPrivate->classInfo), "Math"))
+                                       {
+                                               
classPrivate->jitTypes.jitTypeKind = IL_JIT_TYPEKIND_SYSTEM_MATH;
+                                       }
+                               }
+                       }
+               }
        }
        else
        {
@@ -4196,6 +4342,7 @@
 #include "jitc_except.c"
 #include "jitc_call.c"
 #include "jitc_delegate.c"
+#include "jitc_math.c"
 #undef IL_JITC_FUNCTIONS
 
 /*

Index: engine/Makefile.am
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/Makefile.am,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -b -r1.90 -r1.91
--- engine/Makefile.am  4 Oct 2006 14:33:33 -0000       1.90
+++ engine/Makefile.am  29 Nov 2006 19:49:17 -0000      1.91
@@ -26,6 +26,7 @@
                                jitc_except.c \
                                jitc_labels.c \
                                jitc_locals.c \
+                               jitc_math.c \
                                jitc_obj.c \
                                jitc_pinvoke.c \
                                jitc_profile.c \

Index: engine/jitc_math.c
===================================================================
RCS file: engine/jitc_math.c
diff -N engine/jitc_math.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ engine/jitc_math.c  29 Nov 2006 19:49:17 -0000      1.1
@@ -0,0 +1,1295 @@
+/*
+ * jitc_math.c - Jit coder inline functions for the System.Math class.
+ *
+ * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifdef IL_JITC_DECLARATIONS
+
+/*
+ * Inline function to handle the calls to System.Math.Abs().
+ */
+static int _ILJitSystemMathAbs(ILJITCoder *jitCoder,
+                                                          ILMethod *method,
+                                                          ILCoderMethodInfo 
*methodInfo,
+                                                          ILJitStackItem *args,
+                                                          ILInt32 numArgs);
+
+/*
+ * Inline function to handle the calls to System.Math.Acos().
+ */
+static int _ILJitSystemMathAcos(ILJITCoder *jitCoder,
+                                                               ILMethod 
*method,
+                                                               
ILCoderMethodInfo *methodInfo,
+                                                               ILJitStackItem 
*args,
+                                                               ILInt32 
numArgs);
+
+/*
+ * Inline function to handle the calls to System.Math.Asin().
+ */
+static int _ILJitSystemMathAsin(ILJITCoder *jitCoder,
+                                                               ILMethod 
*method,
+                                                               
ILCoderMethodInfo *methodInfo,
+                                                               ILJitStackItem 
*args,
+                                                               ILInt32 
numArgs);
+
+/*
+ * Inline function to handle the calls to System.Math.Atan().
+ */
+static int _ILJitSystemMathAtan(ILJITCoder *jitCoder,
+                                                               ILMethod 
*method,
+                                                               
ILCoderMethodInfo *methodInfo,
+                                                               ILJitStackItem 
*args,
+                                                               ILInt32 
numArgs);
+
+/*
+ * Inline function to handle the calls to System.Math.Atan2().
+ */
+static int _ILJitSystemMathAtan2(ILJITCoder *jitCoder,
+                                                                ILMethod 
*method,
+                                                                
ILCoderMethodInfo *methodInfo,
+                                                                ILJitStackItem 
*args,
+                                                                ILInt32 
numArgs);
+
+/*
+ * Inline function to handle the calls to System.Math.Ceiling().
+ */
+static int _ILJitSystemMathCeiling(ILJITCoder *jitCoder,
+                                                                  ILMethod 
*method,
+                                                                  
ILCoderMethodInfo *methodInfo,
+                                                                  
ILJitStackItem *args,
+                                                                  ILInt32 
numArgs);
+
+/*
+ * Inline function to handle the calls to System.Math.Cos().
+ */
+static int _ILJitSystemMathCos(ILJITCoder *jitCoder,
+                                                          ILMethod *method,
+                                                          ILCoderMethodInfo 
*methodInfo,
+                                                          ILJitStackItem *args,
+                                                          ILInt32 numArgs);
+
+/*
+ * Inline function to handle the calls to System.Math.Cosh().
+ */
+static int _ILJitSystemMathCosh(ILJITCoder *jitCoder,
+                                                               ILMethod 
*method,
+                                                               
ILCoderMethodInfo *methodInfo,
+                                                               ILJitStackItem 
*args,
+                                                               ILInt32 
numArgs);
+
+/*
+ * Inline function to handle the calls to System.Math.Exp().
+ */
+static int _ILJitSystemMathExp(ILJITCoder *jitCoder,
+                                                          ILMethod *method,
+                                                          ILCoderMethodInfo 
*methodInfo,
+                                                          ILJitStackItem *args,
+                                                          ILInt32 numArgs);
+
+/*
+ * Inline function to handle the calls to System.Math.Floor().
+ */
+static int _ILJitSystemMathFloor(ILJITCoder *jitCoder,
+                                                               ILMethod 
*method,
+                                                               
ILCoderMethodInfo *methodInfo,
+                                                               ILJitStackItem 
*args,
+                                                               ILInt32 
numArgs);
+
+/*
+ * Inline function to handle the calls to System.Math.IEEERemainder().
+ */
+static int _ILJitSystemMathIEEERemainder(ILJITCoder *jitCoder,
+                                                                               
 ILMethod *method,
+                                                                               
 ILCoderMethodInfo *methodInfo,
+                                                                               
 ILJitStackItem *args,
+                                                                               
 ILInt32 numArgs);
+
+/*
+ * Inline function to handle the calls to System.Math.Log().
+ * For now only the call with one arg can be handled here (base e).
+ * TODO: Handle the Log with a specified base.
+ */
+static int _ILJitSystemMathLog(ILJITCoder *jitCoder,
+                                                          ILMethod *method,
+                                                          ILCoderMethodInfo 
*methodInfo,
+                                                          ILJitStackItem *args,
+                                                          ILInt32 numArgs);
+
+/*
+ * Inline function to handle the calls to System.Math.Log10().
+ */
+static int _ILJitSystemMathLog10(ILJITCoder *jitCoder,
+                                                                ILMethod 
*method,
+                                                                
ILCoderMethodInfo *methodInfo,
+                                                                ILJitStackItem 
*args,
+                                                                ILInt32 
numArgs);
+
+/*
+ * Inline function to handle the calls to System.Math.Max().
+ */
+static int _ILJitSystemMathMax(ILJITCoder *jitCoder,
+                                                          ILMethod *method,
+                                                          ILCoderMethodInfo 
*methodInfo,
+                                                          ILJitStackItem *args,
+                                                          ILInt32 numArgs);
+
+/*
+ * Inline function to handle the calls to System.Math.Min().
+ */
+static int _ILJitSystemMathMin(ILJITCoder *jitCoder,
+                                                          ILMethod *method,
+                                                          ILCoderMethodInfo 
*methodInfo,
+                                                          ILJitStackItem *args,
+                                                          ILInt32 numArgs);
+
+/*
+ * Inline function to handle the calls to System.Math.Pow().
+ */
+static int _ILJitSystemMathPow(ILJITCoder *jitCoder,
+                                                          ILMethod *method,
+                                                          ILCoderMethodInfo 
*methodInfo,
+                                                          ILJitStackItem *args,
+                                                          ILInt32 numArgs);
+
+/*
+ * Inline function to handle the calls to System.Math.Sign().
+ */
+static int _ILJitSystemMathSign(ILJITCoder *jitCoder,
+                                                               ILMethod 
*method,
+                                                               
ILCoderMethodInfo *methodInfo,
+                                                               ILJitStackItem 
*args,
+                                                               ILInt32 
numArgs);
+
+/*
+ * Inline function to handle the calls to System.Math.Sin().
+ */
+static int _ILJitSystemMathSin(ILJITCoder *jitCoder,
+                                                          ILMethod *method,
+                                                          ILCoderMethodInfo 
*methodInfo,
+                                                          ILJitStackItem *args,
+                                                          ILInt32 numArgs);
+
+/*
+ * Inline function to handle the calls to System.Math.Sinh().
+ */
+static int _ILJitSystemMathSinh(ILJITCoder *jitCoder,
+                                                               ILMethod 
*method,
+                                                               
ILCoderMethodInfo *methodInfo,
+                                                               ILJitStackItem 
*args,
+                                                               ILInt32 
numArgs);
+
+/*
+ * Inline function to handle the calls to System.Math.Sqrt().
+ */
+static int _ILJitSystemMathSqrt(ILJITCoder *jitCoder,
+                                                               ILMethod 
*method,
+                                                               
ILCoderMethodInfo *methodInfo,
+                                                               ILJitStackItem 
*args,
+                                                               ILInt32 
numArgs);
+
+/*
+ * Inline function to handle the calls to System.Math.Tan().
+ */
+static int _ILJitSystemMathTan(ILJITCoder *jitCoder,
+                                                          ILMethod *method,
+                                                          ILCoderMethodInfo 
*methodInfo,
+                                                          ILJitStackItem *args,
+                                                          ILInt32 numArgs);
+
+/*
+ * Inline function to handle the calls to System.Math.Tanh().
+ */
+static int _ILJitSystemMathTanh(ILJITCoder *jitCoder,
+                                                               ILMethod 
*method,
+                                                               
ILCoderMethodInfo *methodInfo,
+                                                               ILJitStackItem 
*args,
+                                                               ILInt32 
numArgs);
+
+#endif /* IL_JITC_DECLARATIONS */
+
+#ifdef IL_JITC_FUNCTIONS
+
+/*
+ * Inline function to handle the calls to System.Math.Abs().
+ */
+static int _ILJitSystemMathAbs(ILJITCoder *jitCoder,
+                                                          ILMethod *method,
+                                                          ILCoderMethodInfo 
*methodInfo,
+                                                          ILJitStackItem *args,
+                                                          ILInt32 numArgs)
+{
+       ILJitFunction jitFunction = ILJitFunctionFromILMethod(method);
+       ILJitType signature;
+       ILJitType returnType;
+       ILJitValue returnValue;
+
+       if(!jitFunction)
+       {
+               /* We need to layout the class first. */
+               if(!_LayoutClass(ILExecThreadCurrent(), 
ILMethod_Owner(methodInfo)))
+               {
+                       return 0;
+               }
+               if(!(jitFunction = ILJitFunctionFromILMethod(method)))
+               {
+                       return 0;
+               }
+       }
+       if(!(signature = jit_function_get_signature(jitFunction)))
+       {
+               return 0;
+       }
+       /* The return type is equal to the param type so we can use it for 
both. */
+       if(!(returnType = jit_type_get_return(signature)))
+       {
+               return 0;
+       }
+
+       if(!(returnValue = jit_insn_abs(jitCoder->jitFunction,
+                                                                       
_ILJitValueConvertImplicit(jitCoder->jitFunction,
+                                                                               
                                           _ILJitStackItemValue(args[0]),
+                                                                               
                                           returnType))))
+       {
+               return 0;
+       }
+       _ILJitStackPushValue(jitCoder, returnValue);
+       return 1;
+}
+
+/*
+ * Inline function to handle the calls to System.Math.Acos().
+ */
+static int _ILJitSystemMathAcos(ILJITCoder *jitCoder,
+                                                               ILMethod 
*method,
+                                                               
ILCoderMethodInfo *methodInfo,
+                                                               ILJitStackItem 
*args,
+                                                               ILInt32 numArgs)
+{
+       ILJitFunction jitFunction = ILJitFunctionFromILMethod(method);
+       ILJitType signature;
+       ILJitType returnType;
+       ILJitValue returnValue;
+
+       if(!jitFunction)
+       {
+               /* We need to layout the class first. */
+               if(!_LayoutClass(ILExecThreadCurrent(), 
ILMethod_Owner(methodInfo)))
+               {
+                       return 0;
+               }
+               if(!(jitFunction = ILJitFunctionFromILMethod(method)))
+               {
+                       return 0;
+               }
+       }
+       if(!(signature = jit_function_get_signature(jitFunction)))
+       {
+               return 0;
+       }
+       /* The return type is equal to the param type so we can use it for 
both. */
+       if(!(returnType = jit_type_get_return(signature)))
+       {
+               return 0;
+       }
+
+       if(!(returnValue = jit_insn_acos(jitCoder->jitFunction,
+                                                                        
_ILJitValueConvertImplicit(jitCoder->jitFunction,
+                                                                               
                                                _ILJitStackItemValue(args[0]),
+                                                                               
                                                returnType))))
+       {
+               return 0;
+       }
+       _ILJitStackPushValue(jitCoder, returnValue);
+       return 1;
+}
+
+/*
+ * Inline function to handle the calls to System.Math.Asin().
+ */
+static int _ILJitSystemMathAsin(ILJITCoder *jitCoder,
+                                                               ILMethod 
*method,
+                                                               
ILCoderMethodInfo *methodInfo,
+                                                               ILJitStackItem 
*args,
+                                                               ILInt32 numArgs)
+{
+       ILJitFunction jitFunction = ILJitFunctionFromILMethod(method);
+       ILJitType signature;
+       ILJitType returnType;
+       ILJitValue returnValue;
+
+       if(!jitFunction)
+       {
+               /* We need to layout the class first. */
+               if(!_LayoutClass(ILExecThreadCurrent(), 
ILMethod_Owner(methodInfo)))
+               {
+                       return 0;
+               }
+               if(!(jitFunction = ILJitFunctionFromILMethod(method)))
+               {
+                       return 0;
+               }
+       }
+       if(!(signature = jit_function_get_signature(jitFunction)))
+       {
+               return 0;
+       }
+       /* The return type is equal to the param type so we can use it for 
both. */
+       if(!(returnType = jit_type_get_return(signature)))
+       {
+               return 0;
+       }
+
+       if(!(returnValue = jit_insn_asin(jitCoder->jitFunction,
+                                                                        
_ILJitValueConvertImplicit(jitCoder->jitFunction,
+                                                                               
                                                _ILJitStackItemValue(args[0]),
+                                                                               
                                                returnType))))
+       {
+               return 0;
+       }
+       _ILJitStackPushValue(jitCoder, returnValue);
+       return 1;
+}
+
+/*
+ * Inline function to handle the calls to System.Math.Atan().
+ */
+static int _ILJitSystemMathAtan(ILJITCoder *jitCoder,
+                                                               ILMethod 
*method,
+                                                               
ILCoderMethodInfo *methodInfo,
+                                                               ILJitStackItem 
*args,
+                                                               ILInt32 numArgs)
+{
+       ILJitFunction jitFunction = ILJitFunctionFromILMethod(method);
+       ILJitType signature;
+       ILJitType returnType;
+       ILJitValue returnValue;
+
+       if(!jitFunction)
+       {
+               /* We need to layout the class first. */
+               if(!_LayoutClass(ILExecThreadCurrent(), 
ILMethod_Owner(methodInfo)))
+               {
+                       return 0;
+               }
+               if(!(jitFunction = ILJitFunctionFromILMethod(method)))
+               {
+                       return 0;
+               }
+       }
+       if(!(signature = jit_function_get_signature(jitFunction)))
+       {
+               return 0;
+       }
+       /* The return type is equal to the param type so we can use it for 
both. */
+       if(!(returnType = jit_type_get_return(signature)))
+       {
+               return 0;
+       }
+
+       if(!(returnValue = jit_insn_atan(jitCoder->jitFunction,
+                                                                        
_ILJitValueConvertImplicit(jitCoder->jitFunction,
+                                                                               
                                                _ILJitStackItemValue(args[0]),
+                                                                               
                                                returnType))))
+       {
+               return 0;
+       }
+       _ILJitStackPushValue(jitCoder, returnValue);
+       return 1;
+}
+
+/*
+ * Inline function to handle the calls to System.Math.Atan2().
+ */
+static int _ILJitSystemMathAtan2(ILJITCoder *jitCoder,
+                                                                ILMethod 
*method,
+                                                                
ILCoderMethodInfo *methodInfo,
+                                                                ILJitStackItem 
*args,
+                                                                ILInt32 
numArgs)
+{
+       ILJitFunction jitFunction = ILJitFunctionFromILMethod(method);
+       ILJitType signature;
+       ILJitType returnType;
+       ILJitValue returnValue;
+
+       if(!jitFunction)
+       {
+               /* We need to layout the class first. */
+               if(!_LayoutClass(ILExecThreadCurrent(), 
ILMethod_Owner(methodInfo)))
+               {
+                       return 0;
+               }
+               if(!(jitFunction = ILJitFunctionFromILMethod(method)))
+               {
+                       return 0;
+               }
+       }
+       if(!(signature = jit_function_get_signature(jitFunction)))
+       {
+               return 0;
+       }
+       /* The return type is equal to the param type so we can use it for 
both. */
+       if(!(returnType = jit_type_get_return(signature)))
+       {
+               return 0;
+       }
+
+       if(!(returnValue = jit_insn_atan2(jitCoder->jitFunction,
+                                                                        
_ILJitValueConvertImplicit(jitCoder->jitFunction,
+                                                                               
                                                _ILJitStackItemValue(args[0]),
+                                                                               
                                                returnType),
+                                                                        
_ILJitValueConvertImplicit(jitCoder->jitFunction,
+                                                                               
                                                _ILJitStackItemValue(args[1]),
+                                                                               
                                                returnType))))
+       {
+               return 0;
+       }
+       _ILJitStackPushValue(jitCoder, returnValue);
+       return 1;
+}
+
+/*
+ * Inline function to handle the calls to System.Math.Ceiling().
+ */
+static int _ILJitSystemMathCeiling(ILJITCoder *jitCoder,
+                                                                  ILMethod 
*method,
+                                                                  
ILCoderMethodInfo *methodInfo,
+                                                                  
ILJitStackItem *args,
+                                                                  ILInt32 
numArgs)
+{
+       ILJitFunction jitFunction = ILJitFunctionFromILMethod(method);
+       ILJitType signature;
+       ILJitType returnType;
+       ILJitValue returnValue;
+
+       if(!jitFunction)
+       {
+               /* We need to layout the class first. */
+               if(!_LayoutClass(ILExecThreadCurrent(), 
ILMethod_Owner(methodInfo)))
+               {
+                       return 0;
+               }
+               if(!(jitFunction = ILJitFunctionFromILMethod(method)))
+               {
+                       return 0;
+               }
+       }
+       if(!(signature = jit_function_get_signature(jitFunction)))
+       {
+               return 0;
+       }
+       /* The return type is equal to the param type so we can use it for 
both. */
+       if(!(returnType = jit_type_get_return(signature)))
+       {
+               return 0;
+       }
+
+       if(!(returnValue = jit_insn_ceil(jitCoder->jitFunction,
+                                                                        
_ILJitValueConvertImplicit(jitCoder->jitFunction,
+                                                                               
                                                _ILJitStackItemValue(args[0]),
+                                                                               
                                                returnType))))
+       {
+               return 0;
+       }
+       _ILJitStackPushValue(jitCoder, returnValue);
+       return 1;
+}
+
+/*
+ * Inline function to handle the calls to System.Math.Cos().
+ */
+static int _ILJitSystemMathCos(ILJITCoder *jitCoder,
+                                                          ILMethod *method,
+                                                          ILCoderMethodInfo 
*methodInfo,
+                                                          ILJitStackItem *args,
+                                                          ILInt32 numArgs)
+{
+       ILJitFunction jitFunction = ILJitFunctionFromILMethod(method);
+       ILJitType signature;
+       ILJitType returnType;
+       ILJitValue returnValue;
+
+       if(!jitFunction)
+       {
+               /* We need to layout the class first. */
+               if(!_LayoutClass(ILExecThreadCurrent(), 
ILMethod_Owner(methodInfo)))
+               {
+                       return 0;
+               }
+               if(!(jitFunction = ILJitFunctionFromILMethod(method)))
+               {
+                       return 0;
+               }
+       }
+       if(!(signature = jit_function_get_signature(jitFunction)))
+       {
+               return 0;
+       }
+       /* The return type is equal to the param type so we can use it for 
both. */
+       if(!(returnType = jit_type_get_return(signature)))
+       {
+               return 0;
+       }
+
+       if(!(returnValue = jit_insn_cos(jitCoder->jitFunction,
+                                                                       
_ILJitValueConvertImplicit(jitCoder->jitFunction,
+                                                                               
                                           _ILJitStackItemValue(args[0]),
+                                                                               
                                           returnType))))
+       {
+               return 0;
+       }
+       _ILJitStackPushValue(jitCoder, returnValue);
+       return 1;
+}
+
+/*
+ * Inline function to handle the calls to System.Math.Cosh().
+ */
+static int _ILJitSystemMathCosh(ILJITCoder *jitCoder,
+                                                               ILMethod 
*method,
+                                                               
ILCoderMethodInfo *methodInfo,
+                                                               ILJitStackItem 
*args,
+                                                               ILInt32 numArgs)
+{
+       ILJitFunction jitFunction = ILJitFunctionFromILMethod(method);
+       ILJitType signature;
+       ILJitType returnType;
+       ILJitValue returnValue;
+
+       if(!jitFunction)
+       {
+               /* We need to layout the class first. */
+               if(!_LayoutClass(ILExecThreadCurrent(), 
ILMethod_Owner(methodInfo)))
+               {
+                       return 0;
+               }
+               if(!(jitFunction = ILJitFunctionFromILMethod(method)))
+               {
+                       return 0;
+               }
+       }
+       if(!(signature = jit_function_get_signature(jitFunction)))
+       {
+               return 0;
+       }
+       /* The return type is equal to the param type so we can use it for 
both. */
+       if(!(returnType = jit_type_get_return(signature)))
+       {
+               return 0;
+       }
+
+       if(!(returnValue = jit_insn_cosh(jitCoder->jitFunction,
+                                                                        
_ILJitValueConvertImplicit(jitCoder->jitFunction,
+                                                                               
                                                _ILJitStackItemValue(args[0]),
+                                                                               
                                                returnType))))
+       {
+               return 0;
+       }
+       _ILJitStackPushValue(jitCoder, returnValue);
+       return 1;
+}
+
+/*
+ * Inline function to handle the calls to System.Math.Exp().
+ */
+static int _ILJitSystemMathExp(ILJITCoder *jitCoder,
+                                                          ILMethod *method,
+                                                          ILCoderMethodInfo 
*methodInfo,
+                                                          ILJitStackItem *args,
+                                                          ILInt32 numArgs)
+{
+       ILJitFunction jitFunction = ILJitFunctionFromILMethod(method);
+       ILJitType signature;
+       ILJitType returnType;
+       ILJitValue returnValue;
+
+       if(!jitFunction)
+       {
+               /* We need to layout the class first. */
+               if(!_LayoutClass(ILExecThreadCurrent(), 
ILMethod_Owner(methodInfo)))
+               {
+                       return 0;
+               }
+               if(!(jitFunction = ILJitFunctionFromILMethod(method)))
+               {
+                       return 0;
+               }
+       }
+       if(!(signature = jit_function_get_signature(jitFunction)))
+       {
+               return 0;
+       }
+       /* The return type is equal to the param type so we can use it for 
both. */
+       if(!(returnType = jit_type_get_return(signature)))
+       {
+               return 0;
+       }
+
+       if(!(returnValue = jit_insn_exp(jitCoder->jitFunction,
+                                                                       
_ILJitValueConvertImplicit(jitCoder->jitFunction,
+                                                                               
                                           _ILJitStackItemValue(args[0]),
+                                                                               
                                           returnType))))
+       {
+               return 0;
+       }
+       _ILJitStackPushValue(jitCoder, returnValue);
+       return 1;
+}
+
+/*
+ * Inline function to handle the calls to System.Math.Floor().
+ */
+static int _ILJitSystemMathFloor(ILJITCoder *jitCoder,
+                                                               ILMethod 
*method,
+                                                               
ILCoderMethodInfo *methodInfo,
+                                                               ILJitStackItem 
*args,
+                                                               ILInt32 numArgs)
+{
+       ILJitFunction jitFunction = ILJitFunctionFromILMethod(method);
+       ILJitType signature;
+       ILJitType returnType;
+       ILJitValue returnValue;
+
+       if(!jitFunction)
+       {
+               /* We need to layout the class first. */
+               if(!_LayoutClass(ILExecThreadCurrent(), 
ILMethod_Owner(methodInfo)))
+               {
+                       return 0;
+               }
+               if(!(jitFunction = ILJitFunctionFromILMethod(method)))
+               {
+                       return 0;
+               }
+       }
+       if(!(signature = jit_function_get_signature(jitFunction)))
+       {
+               return 0;
+       }
+       /* The return type is equal to the param type so we can use it for 
both. */
+       if(!(returnType = jit_type_get_return(signature)))
+       {
+               return 0;
+       }
+
+       if(!(returnValue = jit_insn_floor(jitCoder->jitFunction,
+                                                                         
_ILJitValueConvertImplicit(jitCoder->jitFunction,
+                                                                               
                                                 _ILJitStackItemValue(args[0]),
+                                                                               
                                                 returnType))))
+       {
+               return 0;
+       }
+       _ILJitStackPushValue(jitCoder, returnValue);
+       return 1;
+}
+
+/*
+ * Inline function to handle the calls to System.Math.IEEERemainder().
+ */
+static int _ILJitSystemMathIEEERemainder(ILJITCoder *jitCoder,
+                                                                               
 ILMethod *method,
+                                                                               
 ILCoderMethodInfo *methodInfo,
+                                                                               
 ILJitStackItem *args,
+                                                                               
 ILInt32 numArgs)
+{
+       ILJitFunction jitFunction = ILJitFunctionFromILMethod(method);
+       ILJitType signature;
+       ILJitType returnType;
+       ILJitValue returnValue;
+
+       if(!jitFunction)
+       {
+               /* We need to layout the class first. */
+               if(!_LayoutClass(ILExecThreadCurrent(), 
ILMethod_Owner(methodInfo)))
+               {
+                       return 0;
+               }
+               if(!(jitFunction = ILJitFunctionFromILMethod(method)))
+               {
+                       return 0;
+               }
+       }
+       if(!(signature = jit_function_get_signature(jitFunction)))
+       {
+               return 0;
+       }
+       /* The return type is equal to the param type so we can use it for 
both. */
+       if(!(returnType = jit_type_get_return(signature)))
+       {
+               return 0;
+       }
+
+       if(!(returnValue = jit_insn_rem_ieee(jitCoder->jitFunction,
+                                                                               
 _ILJitValueConvertImplicit(jitCoder->jitFunction,
+                                                                               
                                                        
_ILJitStackItemValue(args[0]),
+                                                                               
                                                        returnType),
+                                                                               
 _ILJitValueConvertImplicit(jitCoder->jitFunction,
+                                                                               
                                                        
_ILJitStackItemValue(args[1]),
+                                                                               
                                                        returnType))))
+       {
+               return 0;
+       }
+       _ILJitStackPushValue(jitCoder, returnValue);
+       return 1;
+}
+
+/*
+ * Inline function to handle the calls to System.Math.Log().
+ * For now only the call with one arg can be handled here (base e).
+ * TODO: Handle the Log with a specified base.
+ */
+static int _ILJitSystemMathLog(ILJITCoder *jitCoder,
+                                                          ILMethod *method,
+                                                          ILCoderMethodInfo 
*methodInfo,
+                                                          ILJitStackItem *args,
+                                                          ILInt32 numArgs)
+{
+       ILJitFunction jitFunction = ILJitFunctionFromILMethod(method);
+       ILJitType signature;
+       ILJitType returnType;
+       ILJitValue returnValue;
+
+       if(!jitFunction)
+       {
+               /* We need to layout the class first. */
+               if(!_LayoutClass(ILExecThreadCurrent(), 
ILMethod_Owner(methodInfo)))
+               {
+                       return 0;
+               }
+               if(!(jitFunction = ILJitFunctionFromILMethod(method)))
+               {
+                       return 0;
+               }
+       }
+       if(!(signature = jit_function_get_signature(jitFunction)))
+       {
+               return 0;
+       }
+       /* The return type is equal to the param type so we can use it for 
both. */
+       if(!(returnType = jit_type_get_return(signature)))
+       {
+               return 0;
+       }
+
+       if(!(returnValue = jit_insn_log(jitCoder->jitFunction,
+                                                                       
_ILJitValueConvertImplicit(jitCoder->jitFunction,
+                                                                               
                                           _ILJitStackItemValue(args[0]),
+                                                                               
                                           returnType))))
+       {
+               return 0;
+       }
+       _ILJitStackPushValue(jitCoder, returnValue);
+       return 1;
+}
+
+/*
+ * Inline function to handle the calls to System.Math.Log10().
+ */
+static int _ILJitSystemMathLog10(ILJITCoder *jitCoder,
+                                                                ILMethod 
*method,
+                                                                
ILCoderMethodInfo *methodInfo,
+                                                                ILJitStackItem 
*args,
+                                                                ILInt32 
numArgs)
+{
+       ILJitFunction jitFunction = ILJitFunctionFromILMethod(method);
+       ILJitType signature;
+       ILJitType returnType;
+       ILJitValue returnValue;
+
+       if(!jitFunction)
+       {
+               /* We need to layout the class first. */
+               if(!_LayoutClass(ILExecThreadCurrent(), 
ILMethod_Owner(methodInfo)))
+               {
+                       return 0;
+               }
+               if(!(jitFunction = ILJitFunctionFromILMethod(method)))
+               {
+                       return 0;
+               }
+       }
+       if(!(signature = jit_function_get_signature(jitFunction)))
+       {
+               return 0;
+       }
+       /* The return type is equal to the param type so we can use it for 
both. */
+       if(!(returnType = jit_type_get_return(signature)))
+       {
+               return 0;
+       }
+
+       if(!(returnValue = jit_insn_log10(jitCoder->jitFunction,
+                                                                         
_ILJitValueConvertImplicit(jitCoder->jitFunction,
+                                                                               
                                                 _ILJitStackItemValue(args[0]),
+                                                                               
                                                 returnType))))
+       {
+               return 0;
+       }
+       _ILJitStackPushValue(jitCoder, returnValue);
+       return 1;
+}
+
+/*
+ * Inline function to handle the calls to System.Math.Max().
+ */
+static int _ILJitSystemMathMax(ILJITCoder *jitCoder,
+                                                          ILMethod *method,
+                                                          ILCoderMethodInfo 
*methodInfo,
+                                                          ILJitStackItem *args,
+                                                          ILInt32 numArgs)
+{
+       ILJitFunction jitFunction = ILJitFunctionFromILMethod(method);
+       ILJitType signature;
+       ILJitType returnType;
+       ILJitValue returnValue;
+
+       if(!jitFunction)
+       {
+               /* We need to layout the class first. */
+               if(!_LayoutClass(ILExecThreadCurrent(), 
ILMethod_Owner(methodInfo)))
+               {
+                       return 0;
+               }
+               if(!(jitFunction = ILJitFunctionFromILMethod(method)))
+               {
+                       return 0;
+               }
+       }
+       if(!(signature = jit_function_get_signature(jitFunction)))
+       {
+               return 0;
+       }
+       /* The return type is equal to the param type so we can use it for 
both. */
+       if(!(returnType = jit_type_get_return(signature)))
+       {
+               return 0;
+       }
+
+       if(!(returnValue = jit_insn_max(jitCoder->jitFunction,
+                                                                       
_ILJitValueConvertImplicit(jitCoder->jitFunction,
+                                                                               
                                           _ILJitStackItemValue(args[0]),
+                                                                               
                                           returnType),
+                                                                       
_ILJitValueConvertImplicit(jitCoder->jitFunction,
+                                                                               
                                           _ILJitStackItemValue(args[1]),
+                                                                               
                                           returnType))))
+       {
+               return 0;
+       }
+       _ILJitStackPushValue(jitCoder, returnValue);
+       return 1;
+}
+
+/*
+ * Inline function to handle the calls to System.Math.Min().
+ */
+static int _ILJitSystemMathMin(ILJITCoder *jitCoder,
+                                                          ILMethod *method,
+                                                          ILCoderMethodInfo 
*methodInfo,
+                                                          ILJitStackItem *args,
+                                                          ILInt32 numArgs)
+{
+       ILJitFunction jitFunction = ILJitFunctionFromILMethod(method);
+       ILJitType signature;
+       ILJitType returnType;
+       ILJitValue returnValue;
+
+       if(!jitFunction)
+       {
+               /* We need to layout the class first. */
+               if(!_LayoutClass(ILExecThreadCurrent(), 
ILMethod_Owner(methodInfo)))
+               {
+                       return 0;
+               }
+               if(!(jitFunction = ILJitFunctionFromILMethod(method)))
+               {
+                       return 0;
+               }
+       }
+       if(!(signature = jit_function_get_signature(jitFunction)))
+       {
+               return 0;
+       }
+       /* The return type is equal to the param type so we can use it for 
both. */
+       if(!(returnType = jit_type_get_return(signature)))
+       {
+               return 0;
+       }
+
+       if(!(returnValue = jit_insn_min(jitCoder->jitFunction,
+                                                                       
_ILJitValueConvertImplicit(jitCoder->jitFunction,
+                                                                               
                                           _ILJitStackItemValue(args[0]),
+                                                                               
                                           returnType),
+                                                                       
_ILJitValueConvertImplicit(jitCoder->jitFunction,
+                                                                               
                                           _ILJitStackItemValue(args[1]),
+                                                                               
                                           returnType))))
+       {
+               return 0;
+       }
+       _ILJitStackPushValue(jitCoder, returnValue);
+       return 1;
+}
+
+/*
+ * Inline function to handle the calls to System.Math.Pow().
+ */
+static int _ILJitSystemMathPow(ILJITCoder *jitCoder,
+                                                          ILMethod *method,
+                                                          ILCoderMethodInfo 
*methodInfo,
+                                                          ILJitStackItem *args,
+                                                          ILInt32 numArgs)
+{
+       ILJitFunction jitFunction = ILJitFunctionFromILMethod(method);
+       ILJitType signature;
+       ILJitType returnType;
+       ILJitValue returnValue;
+
+       if(!jitFunction)
+       {
+               /* We need to layout the class first. */
+               if(!_LayoutClass(ILExecThreadCurrent(), 
ILMethod_Owner(methodInfo)))
+               {
+                       return 0;
+               }
+               if(!(jitFunction = ILJitFunctionFromILMethod(method)))
+               {
+                       return 0;
+               }
+       }
+       if(!(signature = jit_function_get_signature(jitFunction)))
+       {
+               return 0;
+       }
+       /* The return type is equal to the param type so we can use it for 
both. */
+       if(!(returnType = jit_type_get_return(signature)))
+       {
+               return 0;
+       }
+
+       if(!(returnValue = jit_insn_pow(jitCoder->jitFunction,
+                                                                       
_ILJitValueConvertImplicit(jitCoder->jitFunction,
+                                                                               
                                           _ILJitStackItemValue(args[0]),
+                                                                               
                                           returnType),
+                                                                       
_ILJitValueConvertImplicit(jitCoder->jitFunction,
+                                                                               
                                           _ILJitStackItemValue(args[1]),
+                                                                               
                                           returnType))))
+       {
+               return 0;
+       }
+       _ILJitStackPushValue(jitCoder, returnValue);
+       return 1;
+}
+
+/*
+ * Inline function to handle the calls to System.Math.Sign().
+ */
+static int _ILJitSystemMathSign(ILJITCoder *jitCoder,
+                                                               ILMethod 
*method,
+                                                               
ILCoderMethodInfo *methodInfo,
+                                                               ILJitStackItem 
*args,
+                                                               ILInt32 numArgs)
+{
+       ILJitFunction jitFunction = ILJitFunctionFromILMethod(method);
+       ILJitType signature;
+       ILJitType argType;
+       ILJitValue returnValue;
+       unsigned int jitNumArgs;
+
+       if(!jitFunction)
+       {
+               /* We need to layout the class first. */
+               if(!_LayoutClass(ILExecThreadCurrent(), 
ILMethod_Owner(methodInfo)))
+               {
+                       return 0;
+               }
+               if(!(jitFunction = ILJitFunctionFromILMethod(method)))
+               {
+                       return 0;
+               }
+       }
+       if(!(signature = jit_function_get_signature(jitFunction)))
+       {
+               return 0;
+       }
+
+       jitNumArgs = jit_type_num_params(signature);
+#ifdef IL_JIT_THREAD_IN_SIGNATURE
+       if(jitNumArgs != 2)
+#else
+       if(jitNumArgs != 1)
+#endif
+       {
+               /* wrong number of args. */
+               return 0;
+       }
+
+#ifdef IL_JIT_THREAD_IN_SIGNATURE
+       if(!(argType = jit_type_get_param(signature, 1)))
+#else
+       if(!(argType = jit_type_get_param(signature, 0)))
+#endif
+       {
+               return 0;
+       }
+
+       if(!(returnValue = jit_insn_sign(jitCoder->jitFunction,
+                                                                        
_ILJitValueConvertImplicit(jitCoder->jitFunction,
+                                                                               
                                                _ILJitStackItemValue(args[0]),
+                                                                               
                                                argType))))
+       {
+               return 0;
+       }
+       _ILJitStackPushValue(jitCoder, returnValue);
+       return 1;
+}
+
+/*
+ * Inline function to handle the calls to System.Math.Sin().
+ */
+static int _ILJitSystemMathSin(ILJITCoder *jitCoder,
+                                                          ILMethod *method,
+                                                          ILCoderMethodInfo 
*methodInfo,
+                                                          ILJitStackItem *args,
+                                                          ILInt32 numArgs)
+{
+       ILJitFunction jitFunction = ILJitFunctionFromILMethod(method);
+       ILJitType signature;
+       ILJitType returnType;
+       ILJitValue returnValue;
+
+       if(!jitFunction)
+       {
+               /* We need to layout the class first. */
+               if(!_LayoutClass(ILExecThreadCurrent(), 
ILMethod_Owner(methodInfo)))
+               {
+                       return 0;
+               }
+               if(!(jitFunction = ILJitFunctionFromILMethod(method)))
+               {
+                       return 0;
+               }
+       }
+       if(!(signature = jit_function_get_signature(jitFunction)))
+       {
+               return 0;
+       }
+       /* The return type is equal to the param type so we can use it for 
both. */
+       if(!(returnType = jit_type_get_return(signature)))
+       {
+               return 0;
+       }
+
+       if(!(returnValue = jit_insn_sin(jitCoder->jitFunction,
+                                                                       
_ILJitValueConvertImplicit(jitCoder->jitFunction,
+                                                                               
                                           _ILJitStackItemValue(args[0]),
+                                                                               
                                           returnType))))
+       {
+               return 0;
+       }
+       _ILJitStackPushValue(jitCoder, returnValue);
+       return 1;
+}
+
+/*
+ * Inline function to handle the calls to System.Math.Sinh().
+ */
+static int _ILJitSystemMathSinh(ILJITCoder *jitCoder,
+                                                               ILMethod 
*method,
+                                                               
ILCoderMethodInfo *methodInfo,
+                                                               ILJitStackItem 
*args,
+                                                               ILInt32 numArgs)
+{
+       ILJitFunction jitFunction = ILJitFunctionFromILMethod(method);
+       ILJitType signature;
+       ILJitType returnType;
+       ILJitValue returnValue;
+
+       if(!jitFunction)
+       {
+               /* We need to layout the class first. */
+               if(!_LayoutClass(ILExecThreadCurrent(), 
ILMethod_Owner(methodInfo)))
+               {
+                       return 0;
+               }
+               if(!(jitFunction = ILJitFunctionFromILMethod(method)))
+               {
+                       return 0;
+               }
+       }
+       if(!(signature = jit_function_get_signature(jitFunction)))
+       {
+               return 0;
+       }
+       /* The return type is equal to the param type so we can use it for 
both. */
+       if(!(returnType = jit_type_get_return(signature)))
+       {
+               return 0;
+       }
+
+       if(!(returnValue = jit_insn_sinh(jitCoder->jitFunction,
+                                                                        
_ILJitValueConvertImplicit(jitCoder->jitFunction,
+                                                                               
                                                _ILJitStackItemValue(args[0]),
+                                                                               
                                                returnType))))
+       {
+               return 0;
+       }
+       _ILJitStackPushValue(jitCoder, returnValue);
+       return 1;
+}
+
+/*
+ * Inline function to handle the calls to System.Math.Sqrt().
+ */
+static int _ILJitSystemMathSqrt(ILJITCoder *jitCoder,
+                                                               ILMethod 
*method,
+                                                               
ILCoderMethodInfo *methodInfo,
+                                                               ILJitStackItem 
*args,
+                                                               ILInt32 numArgs)
+{
+       ILJitFunction jitFunction = ILJitFunctionFromILMethod(method);
+       ILJitType signature;
+       ILJitType returnType;
+       ILJitValue returnValue;
+
+       if(!jitFunction)
+       {
+               /* We need to layout the class first. */
+               if(!_LayoutClass(ILExecThreadCurrent(), 
ILMethod_Owner(methodInfo)))
+               {
+                       return 0;
+               }
+               if(!(jitFunction = ILJitFunctionFromILMethod(method)))
+               {
+                       return 0;
+               }
+       }
+       if(!(signature = jit_function_get_signature(jitFunction)))
+       {
+               return 0;
+       }
+       /* The return type is equal to the param type so we can use it for 
both. */
+       if(!(returnType = jit_type_get_return(signature)))
+       {
+               return 0;
+       }
+
+       if(!(returnValue = jit_insn_sqrt(jitCoder->jitFunction,
+                                                                        
_ILJitValueConvertImplicit(jitCoder->jitFunction,
+                                                                               
                                                _ILJitStackItemValue(args[0]),
+                                                                               
                                                returnType))))
+       {
+               return 0;
+       }
+       _ILJitStackPushValue(jitCoder, returnValue);
+       return 1;
+}
+
+/*
+ * Inline function to handle the calls to System.Math.Tan().
+ */
+static int _ILJitSystemMathTan(ILJITCoder *jitCoder,
+                                                          ILMethod *method,
+                                                          ILCoderMethodInfo 
*methodInfo,
+                                                          ILJitStackItem *args,
+                                                          ILInt32 numArgs)
+{
+       ILJitFunction jitFunction = ILJitFunctionFromILMethod(method);
+       ILJitType signature;
+       ILJitType returnType;
+       ILJitValue returnValue;
+
+       if(!jitFunction)
+       {
+               /* We need to layout the class first. */
+               if(!_LayoutClass(ILExecThreadCurrent(), 
ILMethod_Owner(methodInfo)))
+               {
+                       return 0;
+               }
+               if(!(jitFunction = ILJitFunctionFromILMethod(method)))
+               {
+                       return 0;
+               }
+       }
+       if(!(signature = jit_function_get_signature(jitFunction)))
+       {
+               return 0;
+       }
+       /* The return type is equal to the param type so we can use it for 
both. */
+       if(!(returnType = jit_type_get_return(signature)))
+       {
+               return 0;
+       }
+
+       if(!(returnValue = jit_insn_tan(jitCoder->jitFunction,
+                                                                       
_ILJitValueConvertImplicit(jitCoder->jitFunction,
+                                                                               
                                           _ILJitStackItemValue(args[0]),
+                                                                               
                                           returnType))))
+       {
+               return 0;
+       }
+       _ILJitStackPushValue(jitCoder, returnValue);
+       return 1;
+}
+
+/*
+ * Inline function to handle the calls to System.Math.Tanh().
+ */
+static int _ILJitSystemMathTanh(ILJITCoder *jitCoder,
+                                                               ILMethod 
*method,
+                                                               
ILCoderMethodInfo *methodInfo,
+                                                               ILJitStackItem 
*args,
+                                                               ILInt32 numArgs)
+{
+       ILJitFunction jitFunction = ILJitFunctionFromILMethod(method);
+       ILJitType signature;
+       ILJitType returnType;
+       ILJitValue returnValue;
+
+       if(!jitFunction)
+       {
+               /* We need to layout the class first. */
+               if(!_LayoutClass(ILExecThreadCurrent(), 
ILMethod_Owner(methodInfo)))
+               {
+                       return 0;
+               }
+               if(!(jitFunction = ILJitFunctionFromILMethod(method)))
+               {
+                       return 0;
+               }
+       }
+       if(!(signature = jit_function_get_signature(jitFunction)))
+       {
+               return 0;
+       }
+       /* The return type is equal to the param type so we can use it for 
both. */
+       if(!(returnType = jit_type_get_return(signature)))
+       {
+               return 0;
+       }
+
+       if(!(returnValue = jit_insn_tanh(jitCoder->jitFunction,
+                                                                        
_ILJitValueConvertImplicit(jitCoder->jitFunction,
+                                                                               
                                                _ILJitStackItemValue(args[0]),
+                                                                               
                                                returnType))))
+       {
+               return 0;
+       }
+       _ILJitStackPushValue(jitCoder, returnValue);
+       return 1;
+}
+
+#endif /* IL_JITC_FUNCTIONS */
+




reply via email to

[Prev in Thread] Current Thread [Next in Thread]