[polyml] 01/09: Change to upstream's soft float fixes

James Clarke jrtc27-guest at moszumanska.debian.org
Tue Feb 2 21:20:59 UTC 2016


This is an automated email from the git hooks/post-receive script.

jrtc27-guest pushed a commit to branch master
in repository polyml.

commit 7dbb02bf74ae179e8074d57ec0fb2baf85494c43
Author: James Clarke <jrtc27 at jrtc27.com>
Date:   Sun Jan 31 18:12:24 2016 +0000

    Change to upstream's soft float fixes
---
 debian/changelog                                   |  10 ++
 debian/patches/disable-compile-time-real-eval.diff |  57 ++++++++++
 .../rounding-mode-test-allow-exceptions.diff       |  83 +++++++++++++++
 ...de-test-only-allow-exceptions-for-set-mode.diff |  66 ++++++++++++
 debian/patches/series                              |   5 +-
 debian/patches/soft-float-rounding.diff            | 115 ---------------------
 debian/patches/soft-fpu.diff                       |  37 +++++++
 7 files changed, 257 insertions(+), 116 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 83d8d25..50f1135 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+polyml (5.6-2) UNRELEASED; urgency=low
+
+  * Replaced soft-float-rounding.diff with upstream's
+    rounding-mode-test-allow-exceptions.diff,
+    rounding-mode-test-only-allow-exceptions-for-set-mode.diff, soft-fpu.diff
+    and disable-compile-time-real-eval.diff. Avoids modifying the test driver,
+    instead skipping the test if unsupported directly inside the test itself.
+
+ -- James Clarke <jrtc27 at jrtc27.com>  Sun, 31 Jan 2016 17:59:21 +0000
+
 polyml (5.6-1) unstable; urgency=low
 
   * New upstream version
diff --git a/debian/patches/disable-compile-time-real-eval.diff b/debian/patches/disable-compile-time-real-eval.diff
new file mode 100644
index 0000000..a57a642
--- /dev/null
+++ b/debian/patches/disable-compile-time-real-eval.diff
@@ -0,0 +1,57 @@
+Description: Disable compile-time evaluation of real number functions.
+ Real number operations depend on the current rounding mode.  That means that in
+ general it is not possible to "fold" operations on real constants.
+Origin: upstream, https://github.com/polyml/polyml/commit/4fca50be382fcec8212367081791d51bea44c0bd
+Author: David Matthews <dm at prolingua.co.uk>
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/libpolyml/poly_specific.cpp
++++ b/libpolyml/poly_specific.cpp
+@@ -154,7 +154,10 @@
+     case POLY_SYS_equala: return PROPWORD_NORAISE|PROPWORD_NOUPDATE|PROPWORD_NODEREF;
+     case POLY_SYS_ora: return PROPWORD_NORAISE|PROPWORD_NOUPDATE|PROPWORD_NODEREF;
+     case POLY_SYS_anda: return PROPWORD_NORAISE|PROPWORD_NOUPDATE|PROPWORD_NODEREF;
+-    case POLY_SYS_Real_str: return PROPWORD_NORAISE|PROPWORD_NOUPDATE|PROPWORD_NODEREF;
++
++        // Floating point operations depend on the current rounding mode.  That means
++        // that it's not possible to perform floating point operations at compile-time.
++    case POLY_SYS_Real_str: return PROPWORD_NORAISE|PROPWORD_NOUPDATE;
+     case POLY_SYS_Real_geq: return PROPWORD_NORAISE|PROPWORD_NOUPDATE|PROPWORD_NODEREF;
+     case POLY_SYS_Real_leq: return PROPWORD_NORAISE|PROPWORD_NOUPDATE|PROPWORD_NODEREF;
+     case POLY_SYS_Real_gtr: return PROPWORD_NORAISE|PROPWORD_NOUPDATE|PROPWORD_NODEREF;
+@@ -162,21 +165,21 @@
+     case POLY_SYS_Real_eq: return PROPWORD_NORAISE|PROPWORD_NOUPDATE|PROPWORD_NODEREF;
+     case POLY_SYS_Real_neq: return PROPWORD_NORAISE|PROPWORD_NOUPDATE|PROPWORD_NODEREF;
+     case POLY_SYS_Real_Dispatch: return 0;
+-    case POLY_SYS_Add_real: return PROPWORD_NORAISE|PROPWORD_NOUPDATE|PROPWORD_NODEREF;
+-    case POLY_SYS_Sub_real: return PROPWORD_NORAISE|PROPWORD_NOUPDATE|PROPWORD_NODEREF;
+-    case POLY_SYS_Mul_real: return PROPWORD_NORAISE|PROPWORD_NOUPDATE|PROPWORD_NODEREF;
+-    case POLY_SYS_Div_real: return PROPWORD_NORAISE|PROPWORD_NOUPDATE|PROPWORD_NODEREF;
+-    case POLY_SYS_Abs_real: return PROPWORD_NORAISE|PROPWORD_NOUPDATE|PROPWORD_NODEREF;
+-    case POLY_SYS_Neg_real: return PROPWORD_NORAISE|PROPWORD_NOUPDATE|PROPWORD_NODEREF;
++    case POLY_SYS_Add_real: return PROPWORD_NORAISE|PROPWORD_NOUPDATE;
++    case POLY_SYS_Sub_real: return PROPWORD_NORAISE|PROPWORD_NOUPDATE;
++    case POLY_SYS_Mul_real: return PROPWORD_NORAISE|PROPWORD_NOUPDATE;
++    case POLY_SYS_Div_real: return PROPWORD_NORAISE|PROPWORD_NOUPDATE;
++    case POLY_SYS_Abs_real: return PROPWORD_NORAISE|PROPWORD_NOUPDATE|PROPWORD_NODEREF; // Only affects sign
++    case POLY_SYS_Neg_real: return PROPWORD_NORAISE|PROPWORD_NOUPDATE|PROPWORD_NODEREF; // Only affects sign
+     case POLY_SYS_conv_real: return PROPWORD_NOUPDATE|PROPWORD_NODEREF;
+-    case POLY_SYS_real_to_int: return PROPWORD_NORAISE|PROPWORD_NOUPDATE|PROPWORD_NODEREF;
+-    case POLY_SYS_int_to_real: return PROPWORD_NORAISE|PROPWORD_NOUPDATE|PROPWORD_NODEREF;
+-    case POLY_SYS_sqrt_real: return PROPWORD_NORAISE|PROPWORD_NOUPDATE|PROPWORD_NODEREF;
+-    case POLY_SYS_sin_real: return PROPWORD_NORAISE|PROPWORD_NOUPDATE|PROPWORD_NODEREF;
+-    case POLY_SYS_cos_real: return PROPWORD_NORAISE|PROPWORD_NOUPDATE|PROPWORD_NODEREF;
+-    case POLY_SYS_arctan_real: return PROPWORD_NORAISE|PROPWORD_NOUPDATE|PROPWORD_NODEREF;
+-    case POLY_SYS_exp_real: return PROPWORD_NORAISE|PROPWORD_NOUPDATE|PROPWORD_NODEREF;
+-    case POLY_SYS_ln_real: return PROPWORD_NORAISE|PROPWORD_NOUPDATE|PROPWORD_NODEREF;
++    case POLY_SYS_real_to_int: return PROPWORD_NORAISE|PROPWORD_NOUPDATE;
++    case POLY_SYS_int_to_real: return PROPWORD_NORAISE|PROPWORD_NOUPDATE;
++    case POLY_SYS_sqrt_real: return PROPWORD_NORAISE|PROPWORD_NOUPDATE;
++    case POLY_SYS_sin_real: return PROPWORD_NORAISE|PROPWORD_NOUPDATE;
++    case POLY_SYS_cos_real: return PROPWORD_NORAISE|PROPWORD_NOUPDATE;
++    case POLY_SYS_arctan_real: return PROPWORD_NORAISE|PROPWORD_NOUPDATE;
++    case POLY_SYS_exp_real: return PROPWORD_NORAISE|PROPWORD_NOUPDATE;
++    case POLY_SYS_ln_real: return PROPWORD_NORAISE|PROPWORD_NOUPDATE;
+     case POLY_SYS_stdin: return 0; // Not a function
+     case POLY_SYS_stdout: return 0; // Not a function
+     case POLY_SYS_process_env: return 0;
diff --git a/debian/patches/rounding-mode-test-allow-exceptions.diff b/debian/patches/rounding-mode-test-allow-exceptions.diff
new file mode 100644
index 0000000..015d948
--- /dev/null
+++ b/debian/patches/rounding-mode-test-allow-exceptions.diff
@@ -0,0 +1,83 @@
+Description: Change rounding mode test to allow for the possibility of exceptions.
+ IEEReal.setRoundingMode may raise an exception if it is not implemented
+ or only implemented for certain rounding modes.
+Origin: upstream, https://github.com/polyml/polyml/commit/891e8122dcca36f9c2e9eea5a3eca7cf5de9f191
+Author: David Matthews <dm at prolingua.co.uk>
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/Tests/Succeed/Test121.ML
++++ b/Tests/Succeed/Test121.ML
+@@ -2,30 +2,49 @@
+    and compiled code. *)
+ fun check x = if x then () else raise Fail "Wrong";
+ open IEEEReal;
+-setRoundingMode(TO_POSINF);
+-check(getRoundingMode() = TO_POSINF);
+-val pos = 1.0/3.0;
+-check(pos * 3.0 > 1.0);
+-val neg = ~1.0/3.0;
+-check(neg * 3.0 > ~1.0);
+ 
+-setRoundingMode(TO_NEGINF);
+-check(getRoundingMode() = TO_NEGINF);
+-val pos = 1.0/3.0;
+-check(pos * 3.0 < 1.0);
+-val neg = ~1.0/3.0;
+-check(neg * 3.0 < ~1.0);
++(* setRoundingMode may raise an exception if it isn't implemented or
++   only permits certain rounding modes. *)
++let
++    val () = setRoundingMode(TO_POSINF);
++    val () = check(getRoundingMode() = TO_POSINF);
++    val pos = 1.0/3.0;
++    val () = check(pos * 3.0 > 1.0);
++    val neg = ~1.0/3.0;
++    val () = check(neg * 3.0 > ~1.0)
++in
++    ()
++end handle _ => ();
+ 
+-setRoundingMode(TO_ZERO);
+-check(getRoundingMode() = TO_ZERO);
+-val pos = 1.0/3.0;
+-check(pos * 3.0 < 1.0);
+-val neg = ~1.0/3.0;
+-check(neg * 3.0 > ~1.0);
+-check(Real.==(~neg, pos));
++let
++    val () = setRoundingMode(TO_NEGINF);
++    val () = check(getRoundingMode() = TO_NEGINF);
++    val pos = 1.0/3.0;
++    val () = check(pos * 3.0 < 1.0);
++    val neg = ~1.0/3.0;
++    val () = check(neg * 3.0 < ~1.0);
++in
++    ()
++end handle _ => ();
+ 
+-setRoundingMode(TO_NEAREST);
+-check(getRoundingMode() = TO_NEAREST);
+-val pos = 1.0/3.0;
+-val neg = ~1.0/3.0;
+-check(Real.==(~neg, pos));
++let
++    val () = setRoundingMode(TO_ZERO);
++    val () = check(getRoundingMode() = TO_ZERO);
++    val pos = 1.0/3.0;
++    val () = check(pos * 3.0 < 1.0);
++    val neg = ~1.0/3.0;
++    val () = check(neg * 3.0 > ~1.0);
++    val () = check(Real.==(~neg, pos));
++in
++    ()
++end handle _ => ();
++
++let
++    val () = setRoundingMode(TO_NEAREST);
++    val () = check(getRoundingMode() = TO_NEAREST);
++    val pos = 1.0/3.0;
++    val neg = ~1.0/3.0;
++    val () = check(Real.==(~neg, pos));
++in
++    ()
++end handle _ => ();
diff --git a/debian/patches/rounding-mode-test-only-allow-exceptions-for-set-mode.diff b/debian/patches/rounding-mode-test-only-allow-exceptions-for-set-mode.diff
new file mode 100644
index 0000000..f676fc1
--- /dev/null
+++ b/debian/patches/rounding-mode-test-only-allow-exceptions-for-set-mode.diff
@@ -0,0 +1,66 @@
+Description: Fix change to test to deal only with an exception from setRoundingMode.
+ Catching all exceptions effectively disabled the test completely
+Origin: upstream, https://github.com/polyml/polyml/commit/880d868c9fdddc9a5499701750348b28760883fa
+Author: David Matthews <dm at prolingua.co.uk>
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/Tests/Succeed/Test121.ML
++++ b/Tests/Succeed/Test121.ML
+@@ -3,10 +3,12 @@
+ fun check x = if x then () else raise Fail "Wrong";
+ open IEEEReal;
+ 
++exception NotImplemented;
++
+ (* setRoundingMode may raise an exception if it isn't implemented or
+    only permits certain rounding modes. *)
+ let
+-    val () = setRoundingMode(TO_POSINF);
++    val () = setRoundingMode(TO_POSINF) handle Fail _ => raise NotImplemented
+     val () = check(getRoundingMode() = TO_POSINF);
+     val pos = 1.0/3.0;
+     val () = check(pos * 3.0 > 1.0);
+@@ -14,10 +16,10 @@
+     val () = check(neg * 3.0 > ~1.0)
+ in
+     ()
+-end handle _ => ();
++end handle NotImplemented => ();
+ 
+ let
+-    val () = setRoundingMode(TO_NEGINF);
++    val () = setRoundingMode(TO_NEGINF) handle Fail _ => raise NotImplemented
+     val () = check(getRoundingMode() = TO_NEGINF);
+     val pos = 1.0/3.0;
+     val () = check(pos * 3.0 < 1.0);
+@@ -25,10 +27,10 @@
+     val () = check(neg * 3.0 < ~1.0);
+ in
+     ()
+-end handle _ => ();
++end handle NotImplemented => ();
+ 
+ let
+-    val () = setRoundingMode(TO_ZERO);
++    val () = setRoundingMode(TO_ZERO) handle Fail _ => raise NotImplemented
+     val () = check(getRoundingMode() = TO_ZERO);
+     val pos = 1.0/3.0;
+     val () = check(pos * 3.0 < 1.0);
+@@ -37,14 +39,14 @@
+     val () = check(Real.==(~neg, pos));
+ in
+     ()
+-end handle _ => ();
++end handle NotImplemented => ();
+ 
+ let
+-    val () = setRoundingMode(TO_NEAREST);
++    val () = setRoundingMode(TO_NEAREST) handle Fail _ => raise NotImplemented
+     val () = check(getRoundingMode() = TO_NEAREST);
+     val pos = 1.0/3.0;
+     val neg = ~1.0/3.0;
+     val () = check(Real.==(~neg, pos));
+ in
+     ()
+-end handle _ => ();
++end handle NotImplemented => ();
diff --git a/debian/patches/series b/debian/patches/series
index 8506c3e..b25f1aa 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,4 +1,7 @@
-soft-float-rounding.diff
 streamtoken-endian.diff
 ioctl-int.diff
 s390.diff
+rounding-mode-test-allow-exceptions.diff
+rounding-mode-test-only-allow-exceptions-for-set-mode.diff
+soft-fpu.diff
+disable-compile-time-real-eval.diff
diff --git a/debian/patches/soft-float-rounding.diff b/debian/patches/soft-float-rounding.diff
deleted file mode 100644
index 64759a2..0000000
--- a/debian/patches/soft-float-rounding.diff
+++ /dev/null
@@ -1,115 +0,0 @@
-Description: Don't support rounding modes for soft-float systems
- On armel, floating point operations are implemented in software.
- However, the implementation always rounds to nearest. If the system has
- a hardware FPU, it will support setting the rounding mode to any valid
- value, and subsequent gets will return this value, but it will have no
- effect on the actual rounding performed. If the system doesn't have a
- hardware FPU, it will only allow the rounding mode to be set to
- FE_NEAREST, and getting the rounding mode will always return this.
- .
- Since rounding may not be supported, the floating point rounding mode
- test needs to be skipped on unsupported systems. This is implemented by
- raising Fail "Skip Test", which is caught in runTests.
-Author: James Clarke <jrtc27 at jrtc27.com>
-Forwarded: https://github.com/polyml/polyml/16
----
-This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
---- a/libpolyml/reals.cpp
-+++ b/libpolyml/reals.cpp
-@@ -370,9 +370,28 @@
- #define POLY_ROUND_UPWARD       2
- #define POLY_ROUND_TOZERO       3
- 
-+#if defined(__SOFTFP__)
-+// soft-float lacks proper rounding mode support
-+// While some systems will support fegetround/fesetround, it will have no
-+// effect on the actual rounding performed, as the software implementation only
-+// ever rounds to nearest.
-+static int getrounding(TaskData *)
-+{
-+    return POLY_ROUND_TONEAREST;
-+}
-+
-+static void setrounding(TaskData *taskData, Handle args)
-+{
-+    switch (get_C_long(taskData, DEREFWORDHANDLE(args)))
-+    {
-+    case POLY_ROUND_TONEAREST: return; // The only mode supported
-+    }
-+    raise_exception_string(taskData, EXC_Fail, "Setting the floating point rounding control to a value other than TO_NEAREST is not supported for software-based floating point implementations");
-+}
-+
- // It would be nice to be able to use autoconf to test for these as functions
- // but they are frequently inlined 
--#if defined(HAVE_FENV_H)
-+#elif defined(HAVE_FENV_H)
- // C99 version.  This is becoming the most common.
- static int getrounding(TaskData *)
- {
---- a/Tests/Succeed/Test121.ML
-+++ b/Tests/Succeed/Test121.ML
-@@ -2,7 +2,7 @@
-    and compiled code. *)
- fun check x = if x then () else raise Fail "Wrong";
- open IEEEReal;
--setRoundingMode(TO_POSINF);
-+setRoundingMode(TO_POSINF) handle Fail _ => raise Fail "Skip Test";
- check(getRoundingMode() = TO_POSINF);
- val pos = 1.0/3.0;
- check(pos * 3.0 > 1.0);
---- a/Tests/RunTests.sml
-+++ b/Tests/RunTests.sml
-@@ -6,6 +6,8 @@
- 
-     fun runTests (dirName, expectSuccess) =
-     let
-+        datatype test_result = TEST_PASS | TEST_FAIL | TEST_SKIP;
-+
-         (* Run a file.  Returns true if it succeeds, false if it fails. *)
-         fun runTest fileName =
-         let
-@@ -79,6 +81,7 @@
-             (* The tests in the Fail directory should all raise exceptions
-                in the compiler as a result of detecting errors. *)
-             exception CompilerException
-+            exception SkipTestException
-         in
-             (
-                 while not (TextIO.StreamIO.endOfStream(!stream)) do
-@@ -90,14 +93,18 @@
-                         PolyML.compiler(getChar, [CPOutStream discardOut, CPNameSpace localNameSpace])
-                             handle Fail "Static Errors" => raise CompilerException
-                 in
--                    code()
-+                    code() handle Fail "Skip Test" => raise SkipTestException
-                 end;
-                 (* Normal termination: close the stream. *)
-                 TextIO.StreamIO.closeIn (! stream);
--                expectSuccess (* OK if we expected success. *)
-+                if expectSuccess then TEST_PASS else TEST_FAIL (* OK if we expected success. *)
-             ) handle
--                CompilerException => (TextIO.StreamIO.closeIn(!stream); not expectSuccess)
--                | exn => (TextIO.StreamIO.closeIn(!stream); false)
-+                CompilerException => (
-+                    TextIO.StreamIO.closeIn(!stream);
-+                    if expectSuccess then TEST_FAIL else TEST_PASS
-+                )
-+                | SkipTestException => (TextIO.StreamIO.closeIn(!stream); TEST_SKIP)
-+                | exn => (TextIO.StreamIO.closeIn(!stream); TEST_FAIL)
- 
-         end;
- 
-@@ -112,9 +119,10 @@
-                 then
-                 (
-                     print f; print " => ";
--                    if runTest(joinDirFile{dir=testPath, file=f})
--                    then (print "Passed\n"; runDir fails)
--                    else (print "Failed!!\n"; runDir(fails @ [joinDirFile{dir=dirName, file=f}]))
-+                    case runTest(joinDirFile{dir=testPath, file=f}) of
-+                        TEST_PASS => (print "Passed\n"; runDir fails)
-+                    |   TEST_FAIL => (print "Failed!!\n"; runDir(fails @ [joinDirFile{dir=dirName, file=f}]))
-+                    |   TEST_SKIP => (print "Skipped\n"; runDir fails)
-                 )
-                 else runDir fails
-         val failedTests = runDir []
diff --git a/debian/patches/soft-fpu.diff b/debian/patches/soft-fpu.diff
new file mode 100644
index 0000000..0b26508
--- /dev/null
+++ b/debian/patches/soft-fpu.diff
@@ -0,0 +1,37 @@
+Description: Handle setround/getround on soft fpu
+Origin: upstream, https://github.com/polyml/polyml/commit/5ebcc2893fa1d30c9493e2c9958205f5d6863ccb
+Author: James Clarke <jrtc27 at jrtc7.com>
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/libpolyml/reals.cpp
++++ b/libpolyml/reals.cpp
+@@ -370,9 +370,28 @@
+ #define POLY_ROUND_UPWARD       2
+ #define POLY_ROUND_TOZERO       3
+ 
++#if defined(__SOFTFP__)
++// soft-float lacks proper rounding mode support
++// While some systems will support fegetround/fesetround, it will have no
++// effect on the actual rounding performed, as the software implementation only
++// ever rounds to nearest.
++static int getrounding(TaskData *)
++{
++    return POLY_ROUND_TONEAREST;
++}
++
++static void setrounding(TaskData *taskData, Handle args)
++{
++    switch (get_C_long(taskData, DEREFWORDHANDLE(args)))
++    {
++    case POLY_ROUND_TONEAREST: return; // The only mode supported
++    }
++    raise_exception_string(taskData, EXC_Fail, "setRound: Not implemented");
++}
++
+ // It would be nice to be able to use autoconf to test for these as functions
+ // but they are frequently inlined 
+-#if defined(HAVE_FENV_H)
++#elif defined(HAVE_FENV_H)
+ // C99 version.  This is becoming the most common.
+ static int getrounding(TaskData *)
+ {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/polyml.git



More information about the debian-science-commits mailing list