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

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

[dotgnu-pnet-commits] pnet ChangeLog configure.in engine/int_proto.h ...


From: Klaus Treichel
Subject: [dotgnu-pnet-commits] pnet ChangeLog configure.in engine/int_proto.h ...
Date: Sun, 22 Feb 2009 12:31:23 +0000

CVSROOT:        /cvsroot/dotgnu-pnet
Module name:    pnet
Changes by:     Klaus Treichel <ktreichel>      09/02/22 12:31:23

Modified files:
        .              : ChangeLog configure.in 
        engine         : int_proto.h int_table.c lib_math.c 
        libgc          : Makefile.am 

Log message:
        Add support for new 2.0 rounding methods in  System.Math.
        Remove libtool.m4 from libgc's extra dists.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnet/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3604&r2=1.3605
http://cvs.savannah.gnu.org/viewcvs/pnet/configure.in?cvsroot=dotgnu-pnet&r1=1.230&r2=1.231
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/int_proto.h?cvsroot=dotgnu-pnet&r1=1.110&r2=1.111
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/int_table.c?cvsroot=dotgnu-pnet&r1=1.114&r2=1.115
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/lib_math.c?cvsroot=dotgnu-pnet&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/pnet/libgc/Makefile.am?cvsroot=dotgnu-pnet&r1=1.11&r2=1.12

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ChangeLog,v
retrieving revision 1.3604
retrieving revision 1.3605
diff -u -b -r1.3604 -r1.3605
--- ChangeLog   15 Feb 2009 15:00:57 -0000      1.3604
+++ ChangeLog   22 Feb 2009 12:31:20 -0000      1.3605
@@ -1,3 +1,17 @@
+2009-02-22  Klaus Treichek  <address@hidden>
+
+       * configure.in: Add checking for x86_64-*-linux* when checking which
+       thread library to use if not specified.
+       Add checks for existance of the round, rint and trunc functions.
+
+       * engine/int_proto.h, engine/int_table.c: Regenerate
+
+       * engine/lib_math.c (Math_Round): Use the rint function if present.
+       Add support and internal functions for midpoint rounding away from zero
+       and System.Math.Truncate (rounding towards zero).
+
+       * libgc/Makefile.am: Remove libtool.m4 from extra dists.
+
 2009-02-15  Klaus Treichel  <address@hidden>
 
        * cscc/csharp/cs_cast.tc (CSTypeToName): Add handling of generic type

Index: configure.in
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/configure.in,v
retrieving revision 1.230
retrieving revision 1.231
diff -u -b -r1.230 -r1.231
--- configure.in        1 Jun 2008 08:25:04 -0000       1.230
+++ configure.in        22 Feb 2009 12:31:21 -0000      1.231
@@ -284,7 +284,7 @@
     THREADS=posix
     THREADLIBS=-lpthread
     case "$host" in
-     x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux*)
+     x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux* | 
x86_64-*-linux*)
        AC_DEFINE(GC_LINUX_THREADS, 1, [Define to use libgc linux thread 
support])
        AC_DEFINE(_REENTRANT, 1, [Define for re-entrant thread support])
         if test "${enable_parallel_mark}"; then
@@ -616,7 +616,7 @@
 AC_CHECK_FUNCS(getpid qsort unlink remove getcwd getwd)
 AC_CHECK_FUNCS(get_current_dir_name dlopen strerror fcntl ftruncate)
 AC_CHECK_FUNCS(acos asin atan atan2 ceil cos cosh exp floor remainder)
-AC_CHECK_FUNCS(log log10 pow rint sin sinh sqrt tan tanh)
+AC_CHECK_FUNCS(log log10 pow rint sin sinh sqrt tan tanh round rint trunc)
 AC_CHECK_FUNCS(wctomb wcrtomb mbtowc mbrtowc nl_langinfo setlocale)
 AC_CHECK_FUNCS(clock_gettime)
 AC_CHECK_FUNCS(usleep gethostbyname gethostbyaddr isatty getpwuid geteuid)
@@ -718,6 +718,7 @@
 AM_CONDITIONAL(USING_LIBGC, test x$withgc = xyes)
 
 if test x$withffi = xyes; then
+
        AC_CONFIG_SUBDIRS(libffi)
 fi
 

Index: engine/int_proto.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/int_proto.h,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -b -r1.110 -r1.111
--- engine/int_proto.h  3 Jan 2009 14:15:20 -0000       1.110
+++ engine/int_proto.h  22 Feb 2009 12:31:22 -0000      1.111
@@ -25,7 +25,6 @@
 extern void _IL_Array_Set_Objectiii(ILExecThread * _thread, ILObject * _this, 
ILObject * value, ILInt32 index1, ILInt32 index2, ILInt32 index3);
 extern void _IL_Array_Set_Objectai(ILExecThread * _thread, ILObject * _this, 
ILObject * value, System_Array * indices);
 
-extern ILBool _IL_Double_IsNaN(ILExecThread * _thread, ILDouble d);
 extern ILInt32 _IL_Double_TestInfinity(ILExecThread * _thread, ILDouble d);
 
 extern ILObject * _IL_Enum_GetEnumValue(ILExecThread * _thread, ILObject * 
_this);
@@ -130,11 +129,13 @@
 extern void _IL_Type_GetTypeHandle(ILExecThread * _thread, void * _result, 
ILObject * obj);
 extern ILObject * _IL_Type_GetType(ILExecThread * _thread, ILString * name, 
ILBool throwOnError, ILBool ignoreCase);
 
-extern ILBool _IL_Single_IsNaN(ILExecThread * _thread, ILFloat f);
 extern ILInt32 _IL_Single_TestInfinity(ILExecThread * _thread, ILFloat f);
 
 extern ILDouble _IL_Math_Log(ILExecThread * _thread, ILDouble d);
 extern ILDouble _IL_Math_RoundDouble(ILExecThread * _thread, ILDouble value, 
ILInt32 digits);
+extern ILDouble _IL_Math_Round(ILExecThread * _thread, ILDouble a);
+extern ILDouble _IL_Math_RoundDoubleAwayFromZero_d(ILExecThread * _thread, 
ILDouble a);
+extern ILDouble _IL_Math_RoundDoubleAwayFromZero_di(ILExecThread * _thread, 
ILDouble a, ILInt32 digits);
 extern ILDouble _IL_Math_Acos(ILExecThread * _thread, ILDouble d);
 extern ILDouble _IL_Math_Asin(ILExecThread * _thread, ILDouble d);
 extern ILDouble _IL_Math_Atan(ILExecThread * _thread, ILDouble d);
@@ -147,12 +148,12 @@
 extern ILDouble _IL_Math_IEEERemainder(ILExecThread * _thread, ILDouble x, 
ILDouble y);
 extern ILDouble _IL_Math_Log10(ILExecThread * _thread, ILDouble d);
 extern ILDouble _IL_Math_Pow(ILExecThread * _thread, ILDouble x, ILDouble y);
-extern ILDouble _IL_Math_Round(ILExecThread * _thread, ILDouble a);
 extern ILDouble _IL_Math_Sin(ILExecThread * _thread, ILDouble a);
 extern ILDouble _IL_Math_Sinh(ILExecThread * _thread, ILDouble a);
 extern ILDouble _IL_Math_Sqrt(ILExecThread * _thread, ILDouble a);
 extern ILDouble _IL_Math_Tan(ILExecThread * _thread, ILDouble a);
 extern ILDouble _IL_Math_Tanh(ILExecThread * _thread, ILDouble value);
+extern ILDouble _IL_Math_Truncate(ILExecThread * _thread, ILDouble d);
 
 extern void _IL_ArgIterator_ctor_RuntimeArgumentHandle(ILExecThread * _thread, 
void * _this, void * argList);
 extern ILInt32 _IL_ArgIterator_GetRemainingCount(ILExecThread * _thread, void 
* _this);

Index: engine/int_table.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/int_table.c,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -b -r1.114 -r1.115
--- engine/int_table.c  3 Jan 2009 14:15:20 -0000       1.114
+++ engine/int_table.c  22 Feb 2009 12:31:22 -0000      1.115
@@ -180,15 +180,6 @@
 
 #if !defined(HAVE_LIBFFI)
 
-static void marshal_bpd(void (*fn)(), void *rvalue, void **avalue)
-{
-       *((ILNativeInt *)rvalue) = (*(ILInt8 (*)(void *, ILDouble))fn)(*((void 
* *)(avalue[0])), *((ILDouble *)(avalue[1])));
-}
-
-#endif
-
-#if !defined(HAVE_LIBFFI)
-
 static void marshal_ipd(void (*fn)(), void *rvalue, void **avalue)
 {
        *((ILNativeInt *)rvalue) = (*(ILInt32 (*)(void *, ILDouble))fn)(*((void 
* *)(avalue[0])), *((ILDouble *)(avalue[1])));
@@ -199,7 +190,6 @@
 #ifndef _IL_Double_suppressed
 
 IL_METHOD_BEGIN(Double_Methods)
-       IL_METHOD("IsNaN", "(d)Z", _IL_Double_IsNaN, marshal_bpd)
        IL_METHOD("TestInfinity", "(d)i", _IL_Double_TestInfinity, marshal_ipd)
 IL_METHOD_END
 
@@ -697,19 +687,9 @@
 
 #endif
 
-#if !defined(HAVE_LIBFFI)
-
-static void marshal_bpf(void (*fn)(), void *rvalue, void **avalue)
-{
-       *((ILNativeInt *)rvalue) = (*(ILInt8 (*)(void *, ILFloat))fn)(*((void * 
*)(avalue[0])), *((ILFloat *)(avalue[1])));
-}
-
-#endif
-
 #ifndef _IL_Single_suppressed
 
 IL_METHOD_BEGIN(Single_Methods)
-       IL_METHOD("IsNaN", "(f)Z", _IL_Single_IsNaN, marshal_bpf)
        IL_METHOD("TestInfinity", "(f)i", _IL_Single_TestInfinity, marshal_ipf)
 IL_METHOD_END
 
@@ -747,6 +727,9 @@
 IL_METHOD_BEGIN(Math_Methods)
        IL_METHOD("Log", "(d)d", _IL_Math_Log, marshal_dpd)
        IL_METHOD("RoundDouble", "(di)d", _IL_Math_RoundDouble, marshal_dpdi)
+       IL_METHOD("Round", "(d)d", _IL_Math_Round, marshal_dpd)
+       IL_METHOD("RoundDoubleAwayFromZero", "(d)d", 
_IL_Math_RoundDoubleAwayFromZero_d, marshal_dpd)
+       IL_METHOD("RoundDoubleAwayFromZero", "(di)d", 
_IL_Math_RoundDoubleAwayFromZero_di, marshal_dpdi)
        IL_METHOD("Acos", "(d)d", _IL_Math_Acos, marshal_dpd)
        IL_METHOD("Asin", "(d)d", _IL_Math_Asin, marshal_dpd)
        IL_METHOD("Atan", "(d)d", _IL_Math_Atan, marshal_dpd)
@@ -759,12 +742,12 @@
        IL_METHOD("IEEERemainder", "(dd)d", _IL_Math_IEEERemainder, 
marshal_dpdd)
        IL_METHOD("Log10", "(d)d", _IL_Math_Log10, marshal_dpd)
        IL_METHOD("Pow", "(dd)d", _IL_Math_Pow, marshal_dpdd)
-       IL_METHOD("Round", "(d)d", _IL_Math_Round, marshal_dpd)
        IL_METHOD("Sin", "(d)d", _IL_Math_Sin, marshal_dpd)
        IL_METHOD("Sinh", "(d)d", _IL_Math_Sinh, marshal_dpd)
        IL_METHOD("Sqrt", "(d)d", _IL_Math_Sqrt, marshal_dpd)
        IL_METHOD("Tan", "(d)d", _IL_Math_Tan, marshal_dpd)
        IL_METHOD("Tanh", "(d)d", _IL_Math_Tanh, marshal_dpd)
+       IL_METHOD("Truncate", "(d)d", _IL_Math_Truncate, marshal_dpd)
 IL_METHOD_END
 
 #endif

Index: engine/lib_math.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_math.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- engine/lib_math.c   12 Nov 2006 17:10:10 -0000      1.9
+++ engine/lib_math.c   22 Feb 2009 12:31:22 -0000      1.10
@@ -209,6 +209,9 @@
  * Round a "double" value to the nearest integer, using the
  * "round half even" rounding mode.
  */
+#ifdef HAVE_RINT
+       #define Math_Round(x)   (rint((x)))
+#else
 static double Math_Round(double x)
 {
        double above, below;
@@ -235,6 +238,65 @@
                return below;
        }
 }
+#endif
+
+/*
+ * Round a "double" value to the nearest integer, using the
+ * "round away from zero" rounding mode.
+ */
+#ifdef HAVE_ROUND
+       #define Math_RoundAwayFromZero(x)       round((x))
+#else
+static double Math_RoundAwayFromZero(double x)
+{
+       double above, below;
+       if(!Math_Finite(x))
+       {
+               return x;
+       }
+       above = Math_Ceil(x);
+       below = Math_Floor(x);
+       if(x > 0)
+       {
+               if((x - below) < 0.5)
+               {
+                       return below;
+               }
+               return above;
+       }
+       else
+       {
+               if((above - x) < 0.5)
+               {
+                       return above;
+               }
+               return below;
+       }
+}
+#endif
+
+/*
+ * Round a "double" value towards zero.
+ */
+#ifdef HAVE_TRUNC
+       #define Math_Trunc(x)   trunc((x))
+#else
+static double Math_Trunc(double x)
+{
+       if(!Math_Finite(x))
+       {
+               return x;
+       }
+       if(x > 0.0)
+       {
+               return Math_Floor(x);
+       }
+       else
+       {
+               return Math_Ceil(x);
+       }
+}
+#endif
 
 /*
  * public static double Acos(double d);
@@ -419,6 +481,46 @@
 }
 
 /*
+ * private static double RoundDoubleToNearest(double value);
+ */
+ILDouble _IL_Math_RoundDoubleAwayFromZero_d(ILExecThread *thread,
+                                                                               
        ILDouble value)
+{
+       return (ILDouble)Math_RoundAwayFromZero(value);
+}
+
+/*
+ * private static double RoundDoubleToNearest(double value, int digits);
+ */
+ILDouble _IL_Math_RoundDoubleAwayFromZero_di(ILExecThread *thread,
+                                                                               
         ILDouble value,
+                                                                               
         ILInt32 digits)
+{
+       double rounded;
+       double power;
+       rounded = Math_RoundAwayFromZero((double)value);
+       if(digits == 0 || rounded == (double)value)
+       {
+               /* Simple rounding, or the value is already an integer */
+               return rounded;
+       }
+       else
+       {
+       #ifdef HAVE_POW
+               power = pow(10, (double)digits);
+       #else
+               power = 1.0;
+               while(digits > 0)
+               {
+                       power *= 10.0;
+                       --digits;
+               }
+       #endif
+               return (Math_RoundAwayFromZero(((double)value) * power) / 
power);
+       }
+}
+
+/*
  * public static double Sin(double a);
  */
 ILDouble _IL_Math_Sin(ILExecThread *thread, ILDouble a)
@@ -479,6 +581,14 @@
 }
 
 /*
+ * pubic static double Truncate(double d)
+ */
+ILDouble _IL_Math_Truncate(ILExecThread *thread, ILDouble d)
+{
+       return Math_Trunc((double)d);
+}
+
+/*
  * public static bool IsNaN(float f);
  */
 ILBool _IL_Single_IsNaN(ILExecThread *thread, ILFloat f)

Index: libgc/Makefile.am
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/Makefile.am,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- libgc/Makefile.am   28 Oct 2008 20:35:32 -0000      1.11
+++ libgc/Makefile.am   22 Feb 2009 12:31:23 -0000      1.12
@@ -188,7 +188,7 @@
 
 # :FIXME: why do we distribute this one???
 #
-EXTRA_DIST += libtool.m4
+# EXTRA_DIST += libtool.m4
 
 #
 # :GOTCHA: GNU make rule for making .s out of .S is flawed, 




reply via email to

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