From 3310499d3529f63da5dffd1e885484e325881744 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Sun, 23 Feb 2014 16:39:24 +0000 Subject: [PATCH] Generate code for -0. constants correctly in liarc. --- src/Makefile.in | 4 +++- src/compiler/machines/C/cutl.scm | 9 ++++++++- src/compiler/machines/C/stackify.scm | 8 +++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/Makefile.in b/src/Makefile.in index 195cd7fc7..5f50de5c2 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -141,7 +141,7 @@ target-toolchain: all-sf target-toolchain: cross-target target-toolchain: lib/runtime.com -@IF_LIARC@microcode/scheme: compile-runtime +@IF_LIARC@microcode/scheme: all-runtime @IF_SVM@microcode/scheme: microcode/svm1-defns.h microcode/scheme: (cd microcode && $(MAKE) all) @@ -354,7 +354,9 @@ all-runtime: compile-runtime @IF_LIARC@all-runtime: bundle-runtime .PHONY: bundle-runtime +bundle-runtime: runtime/runtime-os2.c bundle-runtime: runtime/runtime-unx.c +bundle-runtime: runtime/runtime-w32.c .PHONY: compile-runtime compile-runtime: toolchain diff --git a/src/compiler/machines/C/cutl.scm b/src/compiler/machines/C/cutl.scm index 012fc6a2f..062dc9255 100644 --- a/src/compiler/machines/C/cutl.scm +++ b/src/compiler/machines/C/cutl.scm @@ -98,7 +98,14 @@ USA. (cond ((string? item) item) ((char? item) (string item)) ((symbol? item) (symbol-name item)) - ((number? item) (number->string item)) + ((number? item) + ;; XXX Kludgey test for negative zero, to support building + ;; from versions when NUMBER->STRING failed to do that itself. + (if (and (flo:flonum? item) + (flo:zero? item) + (flo:negative? (flo:atan2 item -1.))) + "-0." + (number->string item))) ((decoded-time? item) (decoded-time->iso8601-string item)) ((not item) "false") ((eq? item #t) "true") diff --git a/src/compiler/machines/C/stackify.scm b/src/compiler/machines/C/stackify.scm index 4c21f560d..cc2b18d83 100644 --- a/src/compiler/machines/C/stackify.scm +++ b/src/compiler/machines/C/stackify.scm @@ -534,7 +534,13 @@ USA. prog))) ((flo:flonum? obj) (build/string stackify-opcode/push-flonum - (number->string obj) + ;; XXX Kludgey test for negative zero, to + ;; support building from versions when + ;; NUMBER->STRING failed to do that itself. + (if (and (flo:zero? obj) + (flo:negative? (flo:atan2 obj -1.))) + "-0." + (number->string obj)) prog)) ;; The runtime system needs the following ((interpreter-return-address? obj) -- 2.25.1