Raymond Toy pushed to branch issue-355-solaris-x86-fp-trap-handler at cmucl / cmucl
Commits:
39c8b616 by Raymond Toy at 2024-09-01T14:24:21+00:00
Fix 354: Add CI test for executables
- - - - -
c1514a66 by Raymond Toy at 2024-09-01T14:24:22+00:00
Merge branch 'issue-354-add-executable-test-to-ci' into 'master'
Fix 354: Add CI test for executables
See merge request cmucl/cmucl!253
- - - - -
4fce8c07 by Raymond Toy at 2024-09-01T15:13:49+00:00
Fix #352: New compression methods for distribution tarballs
- - - - -
40e553b6 by Raymond Toy at 2024-09-01T15:13:50+00:00
Merge branch 'issue-352-new-compression-for-dist' into 'master'
Fix #352: New compression methods for distribution tarballs
Closes #352
See merge request cmucl/cmucl!252
- - - - -
e20f2727 by Raymond Toy at 2024-09-09T19:04:53+00:00
Fix #357: Include limits.h to get PATH_MAX on Solaris
- - - - -
bca25992 by Raymond Toy at 2024-09-09T19:04:58+00:00
Merge branch 'issue-357-elf-include-limits.h' into 'master'
Fix #357: Include limits.h to get PATH_MAX on Solaris
Closes #357
See merge request cmucl/cmucl!256
- - - - -
56f2d8fd by Raymond Toy at 2024-09-09T20:36:09+00:00
Fix #356: Put x87 status word in low 16 bits of mode word
- - - - -
c8020846 by Raymond Toy at 2024-09-09T20:36:12+00:00
Merge branch 'issue-356-x87-status-word-in-low-part' into 'master'
Fix #356: Put x87 status word in low 16 bits of mode word
Closes #356
See merge request cmucl/cmucl!255
- - - - -
133f2970 by Raymond Toy at 2024-09-09T13:42:36-07:00
Merge branch 'master' into issue-355-solaris-x86-fp-trap-handler
- - - - -
6 changed files:
- .gitlab-ci.yml
- bin/make-dist.sh
- bin/make-extra-dist.sh
- bin/make-main-dist.sh
- bin/make-src-dist.sh
- src/compiler/x86/float-sse2.lisp
Changes:
=====================================
.gitlab-ci.yml
=====================================
@@ -98,6 +98,18 @@ linux:test:
script:
- bin/run-unit-tests.sh -l dist/bin/lisp 2>&1 | tee test.log
+linux:exec-test:
+ stage: test
+ tags:
+ - linux
+ needs:
+ - job: linux:build
+ artifacts: true
+ script:
+ # Create an executable and test it by printing the version.
+ - dist/bin/lisp -eval '(save-lisp "saved-lisp-executable" :executable t)'
+ - ./saved-lisp-executable --version
+
linux:cross-test:
stage: test
tags:
@@ -202,6 +214,18 @@ osx:test:
- echo LANG = $LANG
- bin/run-unit-tests.sh -l dist/bin/lisp 2>&1 | tee test.log
+osx:exec-test:
+ stage: test
+ tags:
+ - macos-virtualbox
+ needs:
+ - job: osx:build
+ artifacts: true
+ script:
+ # Create an executable and test it by printing the version.
+ - dist/bin/lisp -eval '(save-lisp "saved-lisp-executable" :executable t)'
+ - ./saved-lisp-executable --version
+
osx:ansi-test:
stage: ansi-test
tags:
=====================================
bin/make-dist.sh
=====================================
@@ -12,10 +12,10 @@
# $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/tools/make-dist.sh,v 1.20 2011/04/11 16:34:49 rtoy Exp $
usage() {
- echo "make-dist.sh: [-hbg] [-G group] [-O owner] [-I destdir] [-M mandir] [-A arch] [-V version] [-o OS] dir"
+ echo "make-dist.sh: [-h] [-C compress] [-G group] [-O owner] [-I destdir] [-M mandir] [-A arch] [-V version] [-o OS] dir"
echo " -h This help"
- echo " -b Use bzip2 compression"
- echo " -g Use gzip compression"
+ echo " -C compress Compression method to use for the tar archives. Must be one of"
+ echo " bzip2, xz, or gzip. The default depends on the OS"
echo " -G group Group to use"
echo " -O owner Owner to use"
echo " -I destdir Install directly to given directory instead of creating a tarball"
@@ -109,15 +109,20 @@ if expr "X${GIT_HASH}" : 'X[0-9][0-9][a-f]' > /dev/null; then
DEFAULT_VERSION="${GIT_HASH}"
fi
-while getopts "G:O:I:M:bghSA:o:V:?" arg
+# Default compression is -J (xz). These variables are passed to the
+# other scripts via the environmen, so export them.
+COMPRESS=-J
+COMPRESS_EXT=xz
+COMPRESS_NAME=xz
+
+while getopts "C:G:O:I:M:hSA:o:V:?" arg
do
case $arg in
+ C) COMPRESS_ARG=$OPTARG ;;
G) GROUP=$OPTARG ;;
O) OWNER=$OPTARG ;;
I) INSTALL_DIR=$OPTARG ;;
M) MANDIR=$OPTARG ;;
- b) ENABLE_BZIP=-b ;;
- g) ENABLE_GZIP=-g ;;
S) MAKE_SRC_DIST=yes ;;
A) ARCH=$OPTARG ;;
o) OS=$OPTARG ;;
@@ -133,6 +138,27 @@ if [ $# -lt 1 ]; then
usage
fi
+# Verify that the -C option is valid
+if [ -n "$COMPRESS_ARG" ]; then
+ case $COMPRESS_ARG in
+ bzip2)
+ COMPRESS=-j
+ COMPRESS_EXT=bz2
+ COMPRESS_NAME=bzip2
+ ;;
+ xz) # Defaults work
+ ;;
+ gzip)
+ COMPRESS=-z
+ COMPRESS_EXT=gz
+ COMPRESS_NAME=gzip
+ ;;
+ *) echo '-C option "'$COMPRESS_ARG'" must be one of bzip2, xz or gzip'
+ exit 1
+ ;;
+ esac
+fi
+
if [ -z "$VERSION" ]; then
# If a default version exists, use it. Otherwise this is an
# error---at least one of these must not be empty.
@@ -171,21 +197,17 @@ fi
echo cmucl-$VERSION-$ARCH-$OS
ROOT=`dirname $0`
-# If no compression options given, default to bzip
-if [ -z "$ENABLE_GZIP" -a -z "$ENABLE_BZIP" ]; then
- ENABLE_BZIP="-b"
-fi
-
-OPTIONS="${GROUP:+ -G ${GROUP}} ${OWNER:+ -O ${OWNER}} ${INSTALL_DIR:+ -I ${INSTALL_DIR}} $ENABLE_GZIP $ENABLE_BZIP"
+GTAR_OPTS="-t ${GTAR:-tar}"
+EXTRA_OPTS="${GROUP:+ -G ${GROUP}} ${OWNER:+ -O ${OWNER}}"
+INSTALL_OPTS="${INSTALL_DIR:+ -I ${INSTALL_DIR}}"
MANDIR="${MANDIR:+ -M ${MANDIR}}"
+OPTIONS="${GTAR_OPTS} ${EXTRA_OPTS} ${INSTALL_OPTS} ${MANDIR}"
+set -x
echo Creating distribution for $ARCH $OS
-$ROOT/make-main-dist.sh $OPTIONS ${MANDIR} $TARGET $VERSION $ARCH $OS || exit 1
-$ROOT/make-extra-dist.sh $OPTIONS $TARGET $VERSION $ARCH $OS || exit 2
+$ROOT/make-main-dist.sh -C $COMPRESS -E $COMPRESS_EXT $OPTIONS ${MANDIR} $TARGET $VERSION $ARCH $OS || exit 1
+$ROOT/make-extra-dist.sh -C $COMPRESS -E $COMPRESS_EXT $OPTIONS $TARGET $VERSION $ARCH $OS || exit 2
if [ X"$MAKE_SRC_DIST" = "Xyes" ]; then
- # If tar is not GNU tar, set the environment variable GTAR to
- # point to GNU tar.
- OPTIONS="${INSTALL_DIR:+ -I ${INSTALL_DIR}} $ENABLE_GZIP $ENABLE_BZIP"
- $ROOT/make-src-dist.sh $OPTIONS -t ${GTAR:-tar} $VERSION
+ $ROOT/make-src-dist.sh -C $COMPRESS -E $COMPRESS_EXT ${GTAR_OPTS} ${INSTALL_OPTS} $VERSION
fi
=====================================
bin/make-extra-dist.sh
=====================================
@@ -1,23 +1,57 @@
#!/bin/sh
-while getopts "G:O:I:bgh?" arg
+usage() {
+ cat <<EOF
+`basename $0` -C option -E ext [-t tar] [-I destdir] [-G group] [-O owner]
+ -h This help
+ -? This help
+ -t tar Tar program to use
+ -C option Tar option for compressing the tarball; required.
+ -E ext Extension to use for the tarball. Must be consistent with
+ -C option. Required.
+ -I destdir Install directly to given directory instead of creating a tarball
+ -G group Group to use
+ -O owner Owner to use
+
+This is generally called by make-dist.sh and not normally invoked by the user
+
+Create a tarball of the extra components for cmucl. This includes things like
+CLX; Hemlock; CLM; contrib library not already included in the main
+distribution; locale messages.
+EOF
+ exit 1
+}
+
+GTAR=tar
+while getopts "C:E:G:O:I:t:h?" arg
do
case $arg in
+ C) COMPRESS=$OPTARG ;;
+ E) COMPRESS_EXT=$OPTARG ;;
G) GROUP="-g $OPTARG" ;;
O) OWNER="-o $OPTARG" ;;
I) INSTALL_DIR=$OPTARG ;;
- b) ENABLE_BZIP=-b ;;
- g) ENABLE_GZIP=-g ;;
+ t) GTAR=$OPTARG ;;
h | \?) usage; exit 1 ;;
esac
done
shift `expr $OPTIND - 1`
+# -C and -E options are required
+if [ -z "$COMPRESS" ]; then
+ echo "-C option is required"
+ exit 2
+fi
+
+if [ -z "$COMPRESS_EXT" ]; then
+ echo "-E option is required"
+ exit 2
+fi
+
if [ "$1" = "" -o "$2" = "" -o "$3" = "" -o "$4" = "" ]
then
- echo "Usage: $0 target-directory version arch os"
- exit 1
+ usage
fi
if [ ! -d "$1" ]
@@ -134,16 +168,7 @@ done
if [ -z "$INSTALL_DIR" ]; then
sync ; sleep 1 ; sync ; sleep 1 ; sync
echo Tarring extra components
- if [ -n "$ENABLE_GZIP" ]; then
- echo " Compressing with gzip"
- ( cd $DESTDIR >/dev/null ; tar cf - lib ) | \
- gzip -c > cmucl-$VERSION-$ARCH-$OS.extra.tar.gz
- fi
- if [ -n "$ENABLE_BZIP" ]; then
- echo " Compressing with bzip"
- ( cd $DESTDIR >/dev/null ; tar cf - lib ) | \
- bzip2 > cmucl-$VERSION-$ARCH-$OS.extra.tar.bz2
- fi
+ $GTAR -C $DESTDIR $COMPRESS -cf cmucl-$VERSION-$ARCH-$OS.extra.tar.$COMPRESS_EXT lib
echo Cleaning $DESTDIR
[ -d $DESTDIR ] && rm -rf $DESTDIR
=====================================
bin/make-main-dist.sh
=====================================
@@ -1,25 +1,61 @@
#!/bin/sh
-# set -x
-while getopts "G:O:I:M:bgh?" arg
+usage() {
+ cat <<EOF
+`basename $0` -C option -E ext [-h?] [-t tar][-I destdir] [-G group] [-O owner] [-M mandir]
+ target-directory version arch os
+ -h This help
+ -? This help
+ -t tar Tar program to use
+ -C option Tar option for compressing the tarball; required.
+ -E ext Extension to use for the tarball. Must be consistent with
+ -C option. Required.
+ -I destdir Install directly to given directory instead of creating a tarball
+ -G group Group to use
+ -O owner Owner to use
+ -M mandir Install manpages in this subdirectory. Default is man/man1
+
+This is generally called by make-dist.sh and not normally invoked by the user
+
+Create a tarball consisting of the main components needed to distribute
+a binary installation of cmucl. This includes the C executable and support
+libraries; the subsystems like Gray streams, and simple streams; external
+formats; contribs like asdf and defsystem; manpages and READMEs."
+EOF
+ exit 1
+}
+
+GTAR=tar
+while getopts "C:E:G:O:I:M:t:h?" arg
do
case $arg in
+ C) COMPRESS=$OPTARG ;;
+ E) COMPRESS_EXT=$OPTARG ;;
G) GROUP="-g $OPTARG" ;;
O) OWNER="-o $OPTARG" ;;
I) INSTALL_DIR=$OPTARG ;;
M) MANDIR=$OPTARG ;;
- b) ENABLE_BZIP=-b ;;
- g) ENABLE_GZIP=-g ;;
+ t) GTAR=$OPTARG ;;
h | \?) usage; exit 1 ;;
esac
done
shift `expr $OPTIND - 1`
+# -C and -E options are required
+if [ -z "$COMPRESS" ]; then
+ echo "-C option is required"
+ exit 2
+fi
+
+if [ -z "$COMPRESS_EXT" ]; then
+ echo "-E option is required"
+ exit 2
+fi
+
if [ "$1" = "" -o "$2" = "" -o "$3" = "" -o "$4" = "" ]
then
- echo "Usage: $0 target-directory version arch os"
- exit 1
+ usage
fi
if [ ! -d "$1" ]
@@ -178,16 +214,7 @@ fi
if [ -z "$INSTALL_DIR" ]; then
sync ; sleep 1 ; sync ; sleep 1 ; sync
echo Tarring main components
- if [ -n "$ENABLE_GZIP" ]; then
- echo " Compressing with gzip"
- ( cd $DESTDIR >/dev/null ; tar cf - . ) | \
- gzip -c > cmucl-$VERSION-$ARCH-$OS.tar.gz
- fi
- if [ -n "$ENABLE_BZIP" ]; then
- echo " Compressing with bzip"
- ( cd $DESTDIR >/dev/null ; tar cf - . ) | \
- bzip2 > cmucl-$VERSION-$ARCH-$OS.tar.bz2
- fi
+ $GTAR -C $DESTDIR $COMPRESS -cf cmucl-$VERSION-$ARCH-$OS.tar.$COMPRESS_EXT .
echo Cleaning $DESTDIR
[ -d $DESTDIR ] && rm -rf $DESTDIR
=====================================
bin/make-src-dist.sh
=====================================
@@ -1,22 +1,31 @@
#!/bin/sh
usage() {
- echo "make-src-dist.sh: [-bgh] [-t gnutar] [-I destdir] version"
- echo " -h This help"
- echo " -b Use bzip2 compression"
- echo " -g Use gzip compression"
- echo " -t tar Name/path to GNU tar"
- echo " -I destdir Install directly to given directory instead of creating a tarball"
- echo ""
- echo 'Create a tar ball of the cmucl sources. The tarball is named '
- echo 'cmucl-src-$version.tar.bz2 (or gz if using gzip compression)'
+ cat <<EOF
+`basename $0` -C option -E ext [-h?] [-t gnutar] [-I destdir] [version]
+ -h This help
+ -? This help
+ -t tar Name/path to GNU tar
+ -C option Tar option for compressing the tarball; required.
+ -E ext Extension to use for the tarball. Must be consistent with
+ -C option. Required.
+ -I destdir Install directly to given directory instead of creating a tarball
+ version The version. Defaults to the current date
+
+This is generally called by make-dist.sh and not normally invoked by the user
+
+Create a tar ball of the cmucl sources."
+EOF
+ exit 1
}
-while getopts "bgh?t:I:" arg
+GTAR=tar
+
+while getopts "C:E:h?t:I:" arg
do
case $arg in
- b) ENABLE_BZIP=-b ;;
- g) ENABLE_GZIP=-g ;;
+ C) COMPRESS=$OPTARG ;;
+ E) COMPRESS_EXT=$OPTARG ;;
t) GTAR=$OPTARG ;;
I) INSTALL_DIR=$OPTARG ;;
h | \?) usage; exit 1 ;;
@@ -25,10 +34,15 @@ done
shift `expr $OPTIND - 1`
-# If no compression given, default to gzip (on the assumption that
-# that is available everywhere.)
-if [ -z "$ENABLE_BZIP" -a -z "$ENABLE_GZIP" ]; then
- ENABLE_GZIP=-b
+# -C and -E options are required
+if [ -z "$COMPRESS" ]; then
+ echo "-C option is required"
+ exit 2
+fi
+
+if [ -z "$COMPRESS_EXT" ]; then
+ echo "-E option is required"
+ exit 2
fi
# If no version is given, default to today's date
@@ -39,20 +53,11 @@ else
fi
echo Creating source distribution
-if [ -n "$ENABLE_GZIP" ]; then
- ZIP="gzip -c"
- ZIPEXT="gz"
-fi
-if [ -n "$ENABLE_BZIP" ]; then
- ZIP="bzip2"
- ZIPEXT="bz2"
-fi
-
GTAR_OPTIONS="--exclude=.git --exclude='*.pot.~*~'"
if [ -z "$INSTALL_DIR" ]; then
- echo " Compressing with $ZIP"
- ${GTAR:-tar} ${GTAR_OPTIONS} -cf - bin src tests | ${ZIP} > cmucl-src-$VERSION.tar.$ZIPEXT
+ # echo " Compressing with $ZIP"
+ ${GTAR} ${GTAR_OPTIONS} ${COMPRESS} -cf cmucl-src-$VERSION.tar.$COMPRESS_EXT bin src tests
else
# Install in the specified directory
- ${GTAR:-tar} ${GTAR_OPTIONS} -cf - bin src tests | (cd $INSTALL_DIR; ${GTAR:-tar} xf -)
+ ${GTAR} ${GTAR_OPTIONS} -cf - bin src tests | (cd $INSTALL_DIR; ${GTAR:-tar} xf -)
fi
=====================================
src/compiler/x86/float-sse2.lisp
=====================================
@@ -1399,7 +1399,8 @@
(inst xor sw-reg #x3f) ; invert exception mask
(move res sw-reg)
;; Put status word in the low 16 bits and the control word in the
- ;; high 16 bits.
+ ;; high 16 bits. This is to match the SSE2 mxcsr register that has
+ ;; the status bits (sticky bits) in lowest part of the word.
(inst rol res 16)))
;; Set the control and status words from the FPU. The low 16 bits
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/4032cffb2259f69b559e88…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/4032cffb2259f69b559e88…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch master at cmucl / cmucl
Commits:
56f2d8fd by Raymond Toy at 2024-09-09T20:36:09+00:00
Fix #356: Put x87 status word in low 16 bits of mode word
- - - - -
c8020846 by Raymond Toy at 2024-09-09T20:36:12+00:00
Merge branch 'issue-356-x87-status-word-in-low-part' into 'master'
Fix #356: Put x87 status word in low 16 bits of mode word
Closes #356
See merge request cmucl/cmucl!255
- - - - -
2 changed files:
- src/code/float-trap.lisp
- src/compiler/x86/float-sse2.lisp
Changes:
=====================================
src/code/float-trap.lisp
=====================================
@@ -102,9 +102,11 @@
;; FPU and only use the SSE2 rounding control bits.
(let* ((x87-modes (vm::x87-floating-point-modes))
(sse-modes (vm::sse2-floating-point-modes))
+ (x87-exceptions (logand #x3f x87-modes))
+ (x87-enables (logand #x3f (ash x87-modes -16)))
(final-mode (logior sse-modes
- (ash (logand #x3f x87-modes) 7) ; control
- (logand #x3f (ash x87-modes -16)))))
+ x87-exceptions
+ (ash x87-enables 7))))
final-mode))
(defun (setf floating-point-modes) (new-mode)
@@ -112,15 +114,17 @@
;; Set the floating point modes for both X87 and SSE2. This
;; include the rounding control bits.
(let* ((rc (ldb float-rounding-mode new-mode))
+ (new-exceptions (logand #x3f new-mode))
+ (new-enables (logand #x3f (ash new-mode -7)))
(x87-modes
- (logior (ash (logand #x3f new-mode) 16)
+ (logior new-exceptions
(ash rc 10)
- (logand #x3f (ash new-mode -7))
+ (ash new-enables 16)
;; Set precision control to be 64-bit, always. We
;; don't use the x87 registers with sse2, so this
;; is ok and would be the correct setting if we
;; ever support long-floats.
- (ash 3 8))))
+ (ash 3 (+ 8 16)))))
(setf (vm::sse2-floating-point-modes) (ldb (byte 24 0) new-mode))
(setf (vm::x87-floating-point-modes) (ldb (byte 24 0) x87-modes)))
new-mode)
=====================================
src/compiler/x86/float-sse2.lisp
=====================================
@@ -1380,7 +1380,7 @@
float-modes)
;; Extract the control and status words from the FPU. The low 16 bits
-;; contain the control word, and the high 16 bits contain the status.
+;; contain the status word, and the high 16 bits contain the control.
(define-vop (x87-floating-point-modes)
(:results (res :scs (unsigned-reg)))
(:result-types unsigned-num)
@@ -1396,12 +1396,16 @@
(inst byte #x66) ; operand size prefix
(inst or sw-reg cw-stack)
(inst xor sw-reg #x3f) ; invert exception mask
- (move res sw-reg)))
+ (move res sw-reg)
+ ;; Put status word in the low 16 bits and the control word in the
+ ;; high 16 bits. This is to match the SSE2 mxcsr register that has
+ ;; the status bits (sticky bits) in lowest part of the word.
+ (inst rol res 16)))
;; Set the control and status words from the FPU. The low 16 bits
-;; contain the control word, and the high 16 bits contain the status.
+;; contain the status word, and the high 16 bits contain the control.
(define-vop (x87-set-floating-point-modes)
- (:args (new :scs (unsigned-reg) :to :result :target res))
+ (:args (new-modes :scs (unsigned-reg) :to :result :target res))
(:results (res :scs (unsigned-reg)))
(:arg-types unsigned-num)
(:result-types unsigned-num)
@@ -1410,7 +1414,12 @@
(:temporary (:sc unsigned-stack) cw-stack)
(:temporary (:sc byte-reg :offset al-offset) sw-reg)
(:temporary (:sc unsigned-reg :offset ecx-offset) old)
+ (:temporary (:sc unsigned-reg) new)
(:generator 6
+ (move new new-modes)
+ ;; Put the status word in the high 16 bits and the control word in
+ ;; the low 16 bits.
+ (inst rol new 16)
(inst mov cw-stack new)
(inst xor cw-stack #x3f) ; invert exception mask
(inst fnstsw)
@@ -1425,7 +1434,7 @@
(inst fldenv (make-ea :dword :base esp-tn))
(inst add esp-tn 28)
DONE
- (move res new)))
+ (move res new-modes)))
(defun sse2-floating-point-modes ()
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/bca25992c5fc536391f39f…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/bca25992c5fc536391f39f…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch issue-356-x87-status-word-in-low-part at cmucl / cmucl
Commits:
4949a011 by Raymond Toy at 2024-09-09T12:07:55-07:00
Address review comments
Add comment to say we're doing this to match the SSE2 mxcsr register
so the sticky bits are in the same place.
- - - - -
1 changed file:
- src/compiler/x86/float-sse2.lisp
Changes:
=====================================
src/compiler/x86/float-sse2.lisp
=====================================
@@ -1398,7 +1398,8 @@
(inst xor sw-reg #x3f) ; invert exception mask
(move res sw-reg)
;; Put status word in the low 16 bits and the control word in the
- ;; high 16 bits.
+ ;; high 16 bits. This is to match the SSE2 mxcsr register that has
+ ;; the status bits (sticky bits) in lowest part of the word.
(inst rol res 16)))
;; Set the control and status words from the FPU. The low 16 bits
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/4949a01101a79a81c4fcc90…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/4949a01101a79a81c4fcc90…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch master at cmucl / cmucl
Commits:
e20f2727 by Raymond Toy at 2024-09-09T19:04:53+00:00
Fix #357: Include limits.h to get PATH_MAX on Solaris
- - - - -
bca25992 by Raymond Toy at 2024-09-09T19:04:58+00:00
Merge branch 'issue-357-elf-include-limits.h' into 'master'
Fix #357: Include limits.h to get PATH_MAX on Solaris
Closes #357
See merge request cmucl/cmucl!256
- - - - -
1 changed file:
- src/lisp/elf.c
Changes:
=====================================
src/lisp/elf.c
=====================================
@@ -18,6 +18,7 @@
#include <fcntl.h>
#include <sys/types.h>
#include <unistd.h>
+#include <limits.h>
#include "os.h"
#include "core.h"
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/40e553b60270947945782b…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/40e553b60270947945782b…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch issue-355-solaris-x86-fp-trap-handler at cmucl / cmucl
Commits:
82c50cbc by Raymond Toy at 2024-09-07T06:41:04-07:00
Tighten up float-modes deftype
The existing `float-modes` type is `(unsigned-byte 24)`. However, for
x87, the float mode can be at least 26 bits long. This showed up
running the unit test suite. Examining the bits in the control word
shows that 26 is the max, if you ignore the reserved bits at the high
part of the control word.
For sse2, the mxcsr register only has 16 defined bits.
Thus, split `float-modes` into separate types, one for x87 and one for sse2.
- - - - -
1 changed file:
- src/compiler/x86/float-sse2.lisp
Changes:
=====================================
src/compiler/x86/float-sse2.lisp
=====================================
@@ -1265,7 +1265,8 @@
;;;; Float mode hackery:
-(deftype float-modes () '(unsigned-byte 24))
+(deftype x87-float-modes () '(unsigned-byte 32))
+(deftype sse2-float-modes () '(unsigned-byte 16))
;; For the record, here is the format of the MXCSR register.
;;
@@ -1288,8 +1289,8 @@
;; 0 invalid operation flag
;;
;; See below for rounding control
-(defknown sse2-floating-point-modes () float-modes (flushable))
-(defknown ((setf sse2-floating-point-modes)) (float-modes) float-modes)
+(defknown sse2-floating-point-modes () sse2-float-modes (flushable))
+(defknown ((setf sse2-floating-point-modes)) (sse2-float-modes) sse2-float-modes)
;; Returns exactly the mxcsr register, except the masks are flipped
;; because we want exception enable flags, not masks.
@@ -1375,9 +1376,9 @@
;; 10 double precision (53 bits)
;; 11 double extended precision (64 bits)
-(defknown x87-floating-point-modes () float-modes (flushable))
-(defknown ((setf x87-floating-point-modes)) (float-modes)
- float-modes)
+(defknown x87-floating-point-modes () x87-float-modes (flushable))
+(defknown ((setf x87-floating-point-modes)) (x87-float-modes)
+ x87-float-modes)
;; Extract the control and status words from the FPU. The low 16 bits
;; contain the status word, and the high 16 bits contain the control.
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/82c50cbcb9448008afb72da…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/82c50cbcb9448008afb72da…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch issue-355-solaris-x86-fp-trap-handler at cmucl / cmucl
Commits:
0d4d754f by Raymond Toy at 2024-09-06T19:26:01-07:00
Comment out debugging prints
We leave these in for now in case we need them for more debugging.
- - - - -
1 changed file:
- src/code/float-trap.lisp
Changes:
=====================================
src/code/float-trap.lisp
=====================================
@@ -483,15 +483,17 @@
(defun sigfpe-handler (signal code scp)
(declare (ignore signal)
(type system-area-pointer scp))
+ #+nil
(format t "***Enter Handler***~%")
(let* ((modes (sigcontext-floating-point-modes
(alien:sap-alien scp (* unix:sigcontext))))
(current-x87-modes (vm::x87-floating-point-modes))
(current-sse2-modes (vm::sse2-floating-point-modes)))
+ #+nil
(progn
- (format t "Current modes: ~32,'0b~%" modes)
- (format t "Current HW x87 modes: ~32,'0b~%" current-x87-modes)
- (format t "Current HW sse2 modes: ~32,'0b~%" current-sse2-modes)
+ (format t "Current modes: ~32,'0b~%" modes)
+ (format t "Current HW x87 modes: ~32,'0b~%" current-x87-modes)
+ (format t "Current HW sse2 modes: ~32,'0b~%" current-sse2-modes))
(multiple-value-bind (fop operands)
(let ((sym (find-symbol "GET-FP-OPERANDS" "VM")))
@@ -505,6 +507,7 @@
;; This means we need to restore the fpu state ourselves.
(unwind-protect
(let ((fpe-info (second (assoc code +fpe-code-info-alist+))))
+ #+nil
(format t "fpe code = ~D~%" code)
(if fpe-info
(error fpe-info
@@ -520,20 +523,25 @@
(logandc2 current-x87-modes trap-bit))
(new-sse2-modes
(logandc2 current-sse2-modes trap-bit)))
- (format t "***Cleanup***~%")
- (format t "Trap bit: ~D~%" trap-bit)
- (format t "Current modes: ~32,'0b~%" (vm::floating-point-modes))
- (format t "Current HW x87 modes: ~32,'0b~%" current-x87-modes)
- (format t "Current HW sse2 modes: ~32,'0b~%" current-sse2-modes)
- (format t "New x87 modes: ~32,'0b~%" new-x87-modes)
- (format t "New sse2 modes: ~32,'0b~%" new-sse2-modes)
+ #+nil
+ (progn
+ (format t "***Cleanup***~%")
+ (format t "Trap bit: ~D~%" trap-bit)
+ (format t "Current modes: ~32,'0b~%" (vm::floating-point-modes))
+ (format t "Current HW x87 modes: ~32,'0b~%" current-x87-modes)
+ (format t "Current HW sse2 modes: ~32,'0b~%" current-sse2-modes)
+ (format t "New x87 modes: ~32,'0b~%" new-x87-modes)
+ (format t "New sse2 modes: ~32,'0b~%" new-sse2-modes))
+ #+nli
(format t "Setting new sse2 modes~%")
(setf (vm::sse2-floating-point-modes) new-sse2-modes)
+ #+nil
(format t "Setting new x87 modes~%")
(setf (vm::x87-floating-point-modes) new-x87-modes)
-
- (format t "new x87 modes: ~32,'0b~%" (vm::x87-floating-point-modes))
- (format t "new sse2 modes: ~32,'0b~%" (vm::sse2-floating-point-modes))))))))
+ #+nil
+ (progn
+ (format t "new x87 modes: ~32,'0b~%" (vm::x87-floating-point-modes))
+ (format t "new sse2 modes: ~32,'0b~%" (vm::sse2-floating-point-modes))))))))
#-(and solaris x86)
(macrolet
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/0d4d754fe5b899005b6f6d8…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/0d4d754fe5b899005b6f6d8…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch issue-355-solaris-x86-fp-trap-handler at cmucl / cmucl
Commits:
07113a7d by Raymond Toy at 2024-09-06T16:02:17-07:00
Remove debugging prints and add some comments.
- - - - -
1 changed file:
- src/code/float-trap.lisp
Changes:
=====================================
src/code/float-trap.lisp
=====================================
@@ -632,6 +632,8 @@
accrued exceptions are cleared at the start of the body to support
their testing within, and restored on exit."))
+;; Solaris/x86 needs to handle the x87 and sse2 mode bits separately
+;; instead of using a merged from from FLOATING-POINT-MODES.
#+(and solaris x86)
(macrolet
((with-float-traps (name merge-traps docstring)
@@ -646,22 +648,22 @@
`(progn
(defmacro ,macro-name (traps &body body)
,docstring
- (let* ((sse2-trap-mask (dpb (lognot (float-trap-mask traps))
- float-traps-byte #xffffffff))
- ;; The x87 trap masks are ordered the same as
- ;; sse2 trap masks, but are located in a
- ;; different part of the word.
- (x87-trap-mask (dpb (lognot (ash (float-trap-mask traps) 16))
- float-traps-byte #xffffffff))
- (exception-mask (dpb (lognot (vm::float-trap-mask traps))
- float-sticky-bits #xffffffff))
- (orig-modes-x87 (gensym "ORIG-MODES-X87-"))
- (orig-modes-sse2 (gensym "ORIG-MODES-SSE2-")))
+ (let ((sse2-trap-mask (dpb (lognot (float-trap-mask traps))
+ float-traps-byte #xffffffff))
+ ;; The x87 trap masks are ordered the same as
+ ;; sse2 trap masks, but are located in a
+ ;; different part of the word.
+ (x87-trap-mask (dpb (lognot (ash (float-trap-mask traps) 16))
+ float-traps-byte #xffffffff))
+ ;; The exception bits (sticky bits) are located in
+ ;; the same place for both x87 and sse2 modes so
+ ;; we can use just one exception mask for both.
+ (exception-mask (dpb (lognot (vm::float-trap-mask traps))
+ float-sticky-bits #xffffffff))
+ (orig-modes-x87 (gensym "ORIG-MODES-X87-"))
+ (orig-modes-sse2 (gensym "ORIG-MODES-SSE2-")))
`(let ((,orig-modes-x87 (x87-floating-point-modes))
(,orig-modes-sse2 (sse2-floating-point-modes)))
- (format t "In W-F-T:~%")
- (format t " orig x87 modes: ~32,'0b~%" ,orig-modes-x87)
- (format t " orig sse2 modes: ~32,'0b~%" ,orig-modes-sse2)
(unwind-protect
(progn
(setf (x87-floating-point-modes)
@@ -672,8 +674,6 @@
(ldb (byte 32 0)
(logand (,',merge-traps ,orig-modes-sse2 ,sse2-trap-mask)
,exception-mask)))
- (format t " masked x87 modes: ~32,'0b~%" (x87-floating-point-modes))
- (format t " masked sse2 modes: ~32,'0b~%" (sse2-floating-point-modes))
,@body)
;; Restore the modes exactly as they were.
(setf (x87-floating-point-modes) ,orig-modes-x87)
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/07113a7d9df3314094b92e4…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/07113a7d9df3314094b92e4…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch issue-355-solaris-x86-fp-trap-handler at cmucl / cmucl
Commits:
5db3c51f by Raymond Toy at 2024-09-06T15:39:33-07:00
Solaris/x86 needs its own with-float-traps macro
For Solaris/x86, `with-float-traps` needs to handle the x87 and sse2
mode bits separately.
The previous version used the merged value returned by
`vm:floating-point-modes`. If the original mode had, say, the
overflow flag set, when the macro restored the modes, the overflow
flag was also set for x87 and sse2. Later on this can cause an
expected overflow because the x87 mode has overflow set along with the
sse2 mode. This shows up in the SIGFPE handler.
To fix this, we handle the x87 and sse2 mode bits separately. Hence,
we don't spuriously add back the overflow bit for x87 which didn't
have it previously set.
- - - - -
1 changed file:
- src/code/float-trap.lisp
Changes:
=====================================
src/code/float-trap.lisp
=====================================
@@ -568,6 +568,7 @@
(alien:sap-alien scp (* unix:sigcontext))
(logandc2 sse2-modes trap-bit)))))))
+#-(and solaris x86)
(macrolet
((with-float-traps (name merge-traps docstring)
;; Define macros to enable or disable floating-point
@@ -631,6 +632,71 @@
accrued exceptions are cleared at the start of the body to support
their testing within, and restored on exit."))
+#+(and solaris x86)
+(macrolet
+ ((with-float-traps (name merge-traps docstring)
+ ;; Define macros to enable or disable floating-point
+ ;; exceptions. Masked exceptions and enabled exceptions only
+ ;; differ whether we AND in the bits or OR them, respectively.
+ ;; MERGE-TRAPS is the logical operation to merge the traps with
+ ;; the current floating-point mode. Thus, use and MERGE-EXCEPTIONS is the
+ ;; logical operation to merge the exceptions (sticky bits) with
+ ;; the current mode.
+ (let ((macro-name (symbolicate "WITH-FLOAT-TRAPS-" name)))
+ `(progn
+ (defmacro ,macro-name (traps &body body)
+ ,docstring
+ (let* ((sse2-trap-mask (dpb (lognot (float-trap-mask traps))
+ float-traps-byte #xffffffff))
+ ;; The x87 trap masks are ordered the same as
+ ;; sse2 trap masks, but are located in a
+ ;; different part of the word.
+ (x87-trap-mask (dpb (lognot (ash (float-trap-mask traps) 16))
+ float-traps-byte #xffffffff))
+ (exception-mask (dpb (lognot (vm::float-trap-mask traps))
+ float-sticky-bits #xffffffff))
+ (orig-modes-x87 (gensym "ORIG-MODES-X87-"))
+ (orig-modes-sse2 (gensym "ORIG-MODES-SSE2-")))
+ `(let ((,orig-modes-x87 (x87-floating-point-modes))
+ (,orig-modes-sse2 (sse2-floating-point-modes)))
+ (format t "In W-F-T:~%")
+ (format t " orig x87 modes: ~32,'0b~%" ,orig-modes-x87)
+ (format t " orig sse2 modes: ~32,'0b~%" ,orig-modes-sse2)
+ (unwind-protect
+ (progn
+ (setf (x87-floating-point-modes)
+ (ldb (byte 32 0)
+ (logand (,',merge-traps ,orig-modes-x87 ,x87-trap-mask)
+ ,exception-mask)))
+ (setf (sse2-floating-point-modes)
+ (ldb (byte 32 0)
+ (logand (,',merge-traps ,orig-modes-sse2 ,sse2-trap-mask)
+ ,exception-mask)))
+ (format t " masked x87 modes: ~32,'0b~%" (x87-floating-point-modes))
+ (format t " masked sse2 modes: ~32,'0b~%" (sse2-floating-point-modes))
+ ,@body)
+ ;; Restore the modes exactly as they were.
+ (setf (x87-floating-point-modes) ,orig-modes-x87)
+ (setf (sse2-floating-point-modes) ,orig-modes-sse2)))))))))
+
+ ;; WITH-FLOAT-TRAPS-MASKED -- Public
+ (with-float-traps masked logand
+ _N"Execute BODY with the floating point exceptions listed in TRAPS
+ masked (disabled). TRAPS should be a list of possible exceptions
+ which includes :UNDERFLOW, :OVERFLOW, :INEXACT, :INVALID and
+ :DIVIDE-BY-ZERO and on the X86 :DENORMALIZED-OPERAND. The respective
+ accrued exceptions are cleared at the start of the body to support
+ their testing within, and restored on exit.")
+
+ ;; WITH-FLOAT-TRAPS-ENABLED -- Public
+ (with-float-traps enabled logorc2
+ _N"Execute BODY with the floating point exceptions listed in TRAPS
+ enabled. TRAPS should be a list of possible exceptions which
+ includes :UNDERFLOW, :OVERFLOW, :INEXACT, :INVALID and
+ :DIVIDE-BY-ZERO and on the X86 :DENORMALIZED-OPERAND. The respective
+ accrued exceptions are cleared at the start of the body to support
+ their testing within, and restored on exit."))
+
(defmacro with-float-rounding-mode ((rounding-mode) &body body)
_N"Execute BODY with the floating-point rounding mode set to
ROUNDING-MODE. ROUNDING-MODE must be a one:
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/5db3c51f755738d221eae41…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/5db3c51f755738d221eae41…
You're receiving this email because of your account on gitlab.common-lisp.net.