Permalink
Browse files

0.8.14.5: Join the foreign legion!

           * x86/FreeBSD, x86/Linux and Sparc/SunOS now have
              linkage-table support, allowing SAVE-LISP-AND-DIE to
              function properly in the presence of loaded shared
              objects.
           * As a related cleanup automate testing for dlopen
              support on the plaform, and conditionalize
              LOAD-SHARED-OBJECT support on the resulting
              :os-provides-dlopen feature.
  • Loading branch information...
nikodemus committed Sep 9, 2004
1 parent e6c468c commit 75b52379bdc2269961af6a1308eca63610f38ac3
Showing with 1,017 additions and 484 deletions.
  1. +7 −3 CREDITS
  2. +7 −0 NEWS
  3. +4 −0 build-order.lisp-expr
  4. +6 −2 contrib/sb-bsd-sockets/sockopt.lisp
  5. +1 −2 contrib/sb-posix/macros.lisp
  6. +6 −3 doc/manual/beyond-ansi.texinfo
  7. +31 −4 make-config.sh
  8. +3 −0 make-target-contrib.sh
  9. +7 −2 make.sh
  10. +30 −12 package-data-list.lisp-expr
  11. +8 −5 src/code/cold-init.lisp
  12. +2 −6 src/code/condition.lisp
  13. +9 −5 src/code/debug-int.lisp
  14. +5 −4 src/code/debug.lisp
  15. +2 −9 src/code/early-fasl.lisp
  16. +19 −6 src/code/fop.lisp
  17. +110 −0 src/code/foreign-load.lisp
  18. +103 −140 src/code/foreign.lisp
  19. +4 −9 src/code/gc.lisp
  20. +95 −0 src/code/linkage-table.lisp
  21. +4 −0 src/code/linux-os.lisp
  22. +0 −14 src/code/load.lisp
  23. +16 −0 src/code/primordial-extensions.lisp
  24. +3 −4 src/code/profile.lisp
  25. +59 −55 src/code/save.lisp
  26. +12 −9 src/code/target-alieneval.lisp
  27. +13 −13 src/code/target-extensions.lisp
  28. +4 −27 src/code/target-load.lisp
  29. +1 −0 src/code/target-signal.lisp
  30. +0 −1 src/cold/warm.lisp
  31. +7 −2 src/compiler/dump.lisp
  32. +13 −0 src/compiler/fndb.lisp
  33. +7 −2 src/compiler/generic/core.lisp
  34. +76 −62 src/compiler/generic/genesis.lisp
  35. +23 −2 src/compiler/saptran.lisp
  36. +18 −4 src/compiler/sparc/c-call.lisp
  37. +28 −18 src/compiler/sparc/parms.lisp
  38. +5 −2 src/compiler/target-disassem.lisp
  39. +12 −3 src/compiler/x86/c-call.lisp
  40. +48 −34 src/compiler/x86/parms.lisp
  41. +90 −0 src/runtime/sparc-arch.c
  42. +4 −1 src/runtime/sparc-assem.S
  43. +4 −0 src/runtime/validate.c
  44. +4 −0 src/runtime/validate.h
  45. +32 −0 src/runtime/x86-arch.c
  46. +47 −6 tests/foreign.test.sh
  47. +3 −2 tools-for-build/Makefile
  48. +8 −9 tools-for-build/grovel-features.sh
  49. +15 −0 tools-for-build/os-provides-dlopen-test.c
  50. +1 −1 tools-for-build/sparc-funcdef.sh
  51. +1 −1 version.lisp-expr
View
10 CREDITS
@@ -627,6 +627,10 @@ Gerd Moellman:
faster in the typical case than the old optimizations in PCL and
less buggy.
+Timothy Moore:
+ He designed and implemented the original CMUCL linkage-table, on
+ which the SBCL implementation thereof is based.
+
William ("Bill") Newman:
He continued to maintain SBCL after the fork, increasing ANSI
compliance, fixing bugs, regularizing the internals of the
@@ -670,8 +674,8 @@ Rudi Schlatte:
Nikodemus Siivola:
He provided build fixes, in particular to tame the SunOS toolchain,
- implemented package locks, and has fixed many (stream-related and
- other) bugs besides.
+ implemented package locks, ported the linkage-table code from CMUCL,
+ and has fixed many (stream-related and other) bugs besides.
Juho Snellman:
He provided several performance enhancements, including a better hash
@@ -687,7 +691,7 @@ Brian Spilsbury:
Raymond Toy:
He continued to work on CMU CL after the SBCL fork, especially on
floating point stuff. Various patches and fixes of his have been
- ported to SBCL.
+ ported to SBCL, including his Sparc port of linkage-table.
Peter Van Eynde:
He wrestled the CLISP test suite into a mostly portable test suite
View
7 NEWS
@@ -1,4 +1,11 @@
changes in sbcl-0.8.15 relative to sbcl-0.8.14:
+ * incompatible change: SB-INT:*BEFORE-SAVE-INITIALIZATIONS* and
+ SB-INT:*AFTER-SAVE-INITIALIZATIONS* have been renamed
+ SB-EXT:*SAVE-HOOKS* and SB-EXT:*INIT-HOOKS*, and are now
+ part of the supported interface.
+ * new feature: saving cores with foreign code loaded is now
+ supported on x86/FreeBSD, x86/Linux, and sparc/SunOS. (based
+ on Timothy Moore's work for CMUCL)
* bug fix: incorrect expansion of defgeneric that caused
a style warning. (thanks for Zach Beane)
View
@@ -455,6 +455,10 @@
("src/code/thread")
("src/code/load")
+ #!+linkage-table ("src/code/linkage-table" :not-host)
+ #!+os-provides-dlopen ("src/code/foreign-load" :not-host)
+ ("src/code/foreign")
+
("src/code/fop") ; needs macros from code/load.lisp
("src/compiler/ctype")
@@ -58,7 +58,9 @@ Code for options that not every system has should be conditionalised:
(sb-alien:addr size)))
(socket-error "getsockopt")
(,mangle-return buffer size)))
- `(error 'unsupported-operator :name ',lisp-name)))
+ `(error 'unsupported-operator
+ :format-control "Socket option ~S is not supported in this platform."
+ :format-arguments (list ',lisp-name))))
(defun (setf ,lisp-name) (new-val socket)
,(if supportedp
`(sb-alien:with-alien ((buffer ,buffer-type))
@@ -72,7 +74,9 @@ Code for options that not every system has should be conditionalised:
`(length new-val)
`(sb-alien:alien-size ,buffer-type :bytes))))
(socket-error "setsockopt")))
- `(error 'unsupported-operator :name `(setf ,lisp-name)))))))
+ `(error 'unsupported-operator
+ :format-control "Socket option ~S is not supported on this platform."
+ :format-arguments (list ',lisp-name)))))))
;;; sockopts that have integer arguments
@@ -47,8 +47,7 @@
(intern (substitute #\- #\_ (string-upcase s)) :sb-posix))
(defmacro define-call-internally (lisp-name c-name return-type error-predicate &rest arguments)
- (if (sb-fasl::foreign-symbol-address-as-integer-or-nil
- (sb-vm:extern-alien-name c-name))
+ (if (sb-sys:foreign-symbol-address-as-integer-or-nil c-name)
`(progn
(declaim (inline ,lisp-name))
(defun ,lisp-name ,(mapcar #'car arguments)
@@ -112,9 +112,12 @@ the @code{inspect} prompt.
SBCL has the ability to save its state as a file for later
execution. This functionality is important for its bootstrapping
-process, and is also provided as an extension to the user. Note that
-foreign libraries loaded via @code{load-shared-object} don't survive
-this process; a core should not be saved in this case.
+process, and is also provided as an extension to the user.
+
+Note that foreign libraries loaded via @code{load-shared-object} don't
+survive this process on all platforms; a core should not be saved in
+this case. Platforms where this is supported as of SBCL 0.8.14.5 are
+x86/Linux, x86/FreeBSD and sparc/SunOS.
@emph{FIXME: what should be done for foreign libraries?}
View
@@ -161,6 +161,20 @@ case `uname` in
esac
cd $original_dir
+# FIXME: Things like :c-stack-grows-..., etc, should be
+# *derived-target-features* or equivalent, so that there was a nicer
+# way to specify them then sprinkling them in this file. They should
+# still be tweakable by advanced users, though, but probably not
+# appear in *features* of target. #!+/- should be adjusted to take
+# them in account as well. At minimum the nicer specification stuff,
+# though:
+#
+# (define-feature :dlopen (features)
+# (union '(:bsd :linux :darwin :sunos) features))
+#
+# (define-feature :c-stack-grows-downwards-not-upwards (features)
+# (member :x86 features))
+
# KLUDGE: currently the x86 only works with the generational garbage
# collector (indicated by the presence of :GENCGC in *FEATURES*) and
# alpha, sparc and ppc with the stop'n'copy collector (indicated by
@@ -169,20 +183,29 @@ cd $original_dir
# base-target-features.lisp-expr, we add it into local-target-features
# if we're building for x86. -- CSR, 2002-02-21 Then we do something
# similar with :STACK-GROWS-FOOWARD, too. -- WHN 2002-03-03
-if [ "$sbcl_arch" = "x86" ] ; then
+if [ "$sbcl_arch" = "x86" ]; then
printf ' :gencgc :stack-grows-downward-not-upward :c-stack-is-control-stack' >> $ltf
-elif [ "$sbcl_arch" = "mips" ] ; then
+ if [ "$sbcl_os" = "linux" ] || [ "$sbcl_os" = "freebsd" ]; then
+ printf ' :linkage-table' >> $ltf
+ fi
+elif [ "$sbcl_arch" = "mips" ]; then
# Use a little C program to try to guess the endianness. Ware
# cross-compilers!
- $GNUMAKE -C tools-for-build determine-endianness
+ #
+ # FIXME: integrate to grovel-features, mayhaps
+ $GNUMAKE -C tools-for-build determine-endianness -I src/runtime
tools-for-build/determine-endianness >> $ltf
elif [ "$sbcl_arch" = "ppc" -a "$sbcl_os" = "linux" ]; then
# Use a C program to detect which kind of glibc we're building on,
# to bandage across the break in source compatibility between
# versions 2.3.1 and 2.3.2
- $GNUMAKE -C tools-for-build where-is-mcontext
+ #
+ # FIXME: integrate to grovel-features., maypahps
+ $GNUMAKE -C tools-for-build where-is-mcontext -I src/runtime
tools-for-build/where-is-mcontext > src/runtime/ppc-linux-mcontext.h
elif [ "$sbcl_arch" = "ppc" -a "$sbcl_os" = "darwin" ]; then
+ # We provide a dlopen shim, so a little lie won't hurt
+ printf " :os-provides-dlopen" >> $ltf
# The default stack ulimit under darwin is too small to run PURIFY.
# Best we can do is complain and exit at this stage
if [ "`ulimit -s`" = "512" ]; then
@@ -196,11 +219,15 @@ elif [ "$sbcl_arch" = "sparc" ]; then
# FUNCDEF macro for assembler. No harm in running this on sparc-linux
# as well.
sh tools-for-build/sparc-funcdef.sh > src/runtime/sparc-funcdef.h
+ if [ "$sbcl_os" = "sunos" ]; then
+ printf ' :linkage-table' >> $ltf
+ fi
else
# Nothing need be done in this case, but sh syntax wants a placeholder.
echo > /dev/null
fi
+export sbcl_os sbcl_arch
sh tools-for-build/grovel-features.sh >> $ltf
echo //finishing $ltf
View
@@ -13,6 +13,9 @@
# provided with absolutely no warranty. See the COPYING and CREDITS
# files for more information.
+. ./find-gnumake.sh
+find_gnumake
+
# usually SBCL_HOME refers to the installed root of SBCL, not the
# build directory. Right now, however, where there are dependencies
# between contrib packages, we want the _uninstalled_ versions to be
View
@@ -109,11 +109,16 @@ time sh make-target-contrib.sh || exit 1
# Sometimes people used to see the "No tests failed." output from the last
# DEFTEST in contrib self-tests and think that's all that is. So...
-FLAG=false
+FLAG=true
for dir in contrib/*
do
if [ -d "$dir" -a -e "$dir/Makefile" -a ! -e "$dir/test-passed" ]; then
- $FLAG || (echo "Failed contribs:" && FLAG=true)
+ if $FLAG; then
+ echo > /dev/null
+ else
+ echo "Failed contribs:"
+ FLAG=false
+ fi
echo " `basename $dir`"
fi
done
@@ -56,7 +56,7 @@ of SBCL which maintained the CMU-CL-style split into two packages.)"
"ENUM" "EXTERN-ALIEN"
"FREE-ALIEN"
"GET-ERRNO"
- "INT"
+ "INT"
"LOAD-1-FOREIGN" "LOAD-FOREIGN" "LOAD-SHARED-OBJECT" "LONG"
"MAKE-ALIEN"
"NULL-ALIEN"
@@ -360,7 +360,7 @@ of SBCL which maintained the CMU-CL-style split into two packages.)"
basic stuff like BACKTRACE and ARG. For now, the actual supported interface
is still mixed indiscriminately with low-level internal implementation stuff
like *STACK-TOP-HINT* and unsupported stuff like *TRACED-FUN-LIST*."
- :use ("CL" "SB!EXT" "SB!INT" "SB!SYS")
+ :use ("CL" "SB!EXT" "SB!INT" "SB!SYS" "SB!KERNEL")
:export ("*DEBUG-BEGINNER-HELP-P*"
"*DEBUG-CONDITION*"
"*DEBUG-PRINT-LENGTH*" "*DEBUG-PRINT-LEVEL*"
@@ -519,7 +519,6 @@ like *STACK-TOP-HINT* and unsupported stuff like *TRACED-FUN-LIST*."
"READ-ONLY-CORE-SPACE-ID"
"*!REVERSED-COLD-TOPLEVELS*"
"STATIC-CORE-SPACE-ID"
- "*STATIC-FOREIGN-SYMBOLS*"
"VERSION-CORE-ENTRY-TYPE-CODE"))
;; This package is a grab bag for things which used to be internal
@@ -552,6 +551,9 @@ like *STACK-TOP-HINT* and unsupported stuff like *TRACED-FUN-LIST*."
"*GC-RUN-TIME*"
"PURIFY"
+ ;; Hooks into init & save sequences
+ "*INIT-HOOKS*" "*SAVE-HOOKS*"
+
;; There is no one right way to report progress on
;; hairy compiles.
"*COMPILE-PROGRESS*"
@@ -735,10 +737,7 @@ Lisp extension proposal by David N. Gray"
the stuff in here originated in CMU CL's EXTENSIONS package and is
retained, possibly temporariliy, because it might be used internally."
:use ("CL" "SB!ALIEN" "SB!GRAY" "SB!FASL" "SB!SYS")
- :export ("*AFTER-SAVE-INITIALIZATIONS*"
- "*BEFORE-SAVE-INITIALIZATIONS*"
-
- ;; lambda list keyword extensions
+ :export (;; lambda list keyword extensions
"&MORE"
;; INFO stuff doesn't belong in a user-visible package, we
@@ -785,6 +784,7 @@ retained, possibly temporariliy, because it might be used internally."
;; and cross-compiling
"DEFMACRO-MUNDANELY"
"DEFCONSTANT-EQX"
+ "DEFINE-UNSUPPORTED-FUN"
;; messing with PATHNAMEs
"MAKE-TRIVIAL-DEFAULT-PATHNAME"
@@ -1439,21 +1439,25 @@ is a good idea, but see SB-SYS re. blurring of boundaries."
"!COLD-INIT" "!UNINTERN-INIT-ONLY-STUFF"
"!GLOBALDB-COLD-INIT" "!FDEFN-COLD-INIT"
- "!FUNCTION-NAMES-COLD-INIT"
+ "!FOREIGN-COLD-INIT" "!FUNCTION-NAMES-COLD-INIT"
"!TYPE-CLASS-COLD-INIT" "!TYPEDEFS-COLD-INIT"
"!ALIEN-TYPE-COLD-INIT" "!CLASSES-COLD-INIT"
"!EARLY-TYPE-COLD-INIT" "!LATE-TYPE-COLD-INIT"
"!FIXUP-TYPE-COLD-INIT" "!TARGET-TYPE-COLD-INIT"
"!RANDOM-COLD-INIT" "!READER-COLD-INIT"
- "!TYPECHECKFUNS-COLD-INIT"
- "STREAM-COLD-INIT-OR-RESET" "!LOADER-COLD-INIT"
+ "!TYPECHECKFUNS-COLD-INIT" "!LOADER-COLD-INIT"
"!EXHAUST-COLD-INIT" "!PACKAGE-COLD-INIT"
- "SIGNAL-COLD-INIT-OR-REINIT"
"!POLICY-COLD-INIT-OR-RESANIFY"
"!VM-TYPE-COLD-INIT" "!BACKQ-COLD-INIT"
"!SHARPM-COLD-INIT" "!EARLY-PROCLAIM-COLD-INIT"
"!LATE-PROCLAIM-COLD-INIT" "!CLASS-FINALIZE"
+
"GC-REINIT"
+ "SIGNAL-COLD-INIT-OR-REINIT"
+ "STREAM-COLD-INIT-OR-RESET"
+
+ ;; Cleanups to run before saving a core
+ "DEBUG-DEINIT" "FOREIGN-DEINIT" "PROFILE-DEINIT"
;; Note: These are out of lexicographical order
;; because in CMU CL they were defined as
@@ -1733,22 +1737,32 @@ SB-KERNEL) have been undone, but probably more remain."
;; SB!KERNEL.)
"%PRIMITIVE"
"%STANDARD-CHAR-P"
+ "*LINKAGE-INFO*"
"*LONG-SITE-NAME*" "*SHORT-SITE-NAME*"
+ "*RUNTIME-DLHANDLE*"
+ "*SHARED-OBJECTS*"
+ "*STATIC-FOREIGN-SYMBOLS*"
"*STDERR*" "*STDIN*"
"*STDOUT*" "*TASK-DATA*"
"*TASK-NOTIFY*" "*TASK-SELF*" "*TTY*" "*TYPESCRIPTPORT*"
"ADD-FD-HANDLER"
"ALLOCATE-SYSTEM-MEMORY"
"BEEP" "BITS"
"BYTES" "C-PROCEDURE"
+ "CLOSE-SHARED-OBJECTS"
"COMPILER-VERSION"
"DEALLOCATE-SYSTEM-MEMORY"
"DEFAULT-INTERRUPT"
"DEPORT-BOOLEAN" "DEPORT-INTEGER"
+ "DLOPEN-OR-LOSE"
"FROB-DO-BODY"
"ENABLE-INTERRUPT" "ENUMERATION"
"FD-STREAM-FD" "FD-STREAM-P"
- "FOREIGN-SYMBOL-ADDRESS" "FOREIGN-SYMBOL-ADDRESS-AS-INTEGER"
+ "FIND-FOREIGN-SYMBOL-IN-TABLE"
+ "FOREIGN-SYMBOL-ADDRESS"
+ "FOREIGN-SYMBOL-ADDRESS-AS-INTEGER"
+ "FOREIGN-SYMBOL-ADDRESS-AS-INTEGER-OR-NIL"
+ "FOREIGN-SYMBOL-DATAREF-ADDRESS"
"FOREIGN-SYMBOL-IN-ADDRESS"
"GET-PAGE-SIZE" "GET-SYSTEM-INFO"
"IGNORE-INTERRUPT"
@@ -1760,6 +1774,7 @@ SB-KERNEL) have been undone, but probably more remain."
"POINTER" "POINTER<" "POINTER>"
"READ-N-BYTES" "REALLOCATE-SYSTEM-MEMORY" "RECORD-SIZE"
"REMOVE-FD-HANDLER"
+ "REOPEN-SHARED-OBJECTS"
"RESOLVE-LOADED-ASSEMBLER-REFERENCES"
"SAP+" "SAP-" "SAP-INT"
"SAP-REF-16" "SAP-REF-32" "SAP-REF-64" "SAP-REF-8"
@@ -2124,6 +2139,9 @@ structure representations"
"READ-ONLY-SPACE-START" "READ-ONLY-SPACE-END"
"TARGET-BYTE-ORDER" "TARGET-HEAP-ADDRESS-SPACE"
"STATIC-SPACE-START" "STATIC-SPACE-END"
+ #!+linkage-table "LINKAGE-TABLE-SPACE-START"
+ #!+linkage-table "LINKAGE-TABLE-SPACE-END"
+ #!+linkage-table "LINKAGE-TABLE-ENTRY-SIZE"
"TRACE-TABLE-CALL-SITE"
"TRACE-TABLE-FUN-EPILOGUE" "TRACE-TABLE-FUN-PROLOGUE"
"TRACE-TABLE-NORMAL" "N-WIDETAG-BITS" "WIDETAG-MASK"
View
@@ -214,7 +214,9 @@
(show-and-call stream-cold-init-or-reset)
(show-and-call !loader-cold-init)
+ (show-and-call !foreign-cold-init)
(show-and-call signal-cold-init-or-reinit)
+ (/show0 "enabling internal errors")
(setf (sb!alien:extern-alien "internal_errors_enabled" boolean) t)
;; FIXME: This list of modes should be defined in one place and
@@ -263,9 +265,9 @@
(unix-code 0 unix-code-p)
(unix-status unix-code))
#!+sb-doc
- "Terminate the current Lisp. Things are cleaned up (with UNWIND-PROTECT
- and so forth) unless RECKLESSLY-P is non-NIL. On UNIX-like systems,
- UNIX-STATUS is used as the status code."
+ "Terminate the current Lisp. Things are cleaned up (with
+UNWIND-PROTECT and so forth) unless RECKLESSLY-P is non-NIL. On
+UNIX-like systems, UNIX-STATUS is used as the status code."
(declare (type (signed-byte 32) unix-status unix-code))
(/show0 "entering QUIT")
;; FIXME: UNIX-CODE was deprecated in sbcl-0.6.8, after having been
@@ -298,8 +300,9 @@ instead (which is another name for the same thing)."))
(set-floating-point-modes
:traps '(:overflow #!-netbsd :invalid :divide-by-zero))
(sb!thread::maybe-install-futex-functions)))
- (gc-on)
- (gc))
+ (foreign-reinit)
+ (gc-reinit)
+ (mapc #'funcall *init-hooks*))
;;;; some support for any hapless wretches who end up debugging cold
;;;; init code
View
@@ -775,12 +775,8 @@
;;; regression tests cheerfully passed because they assumed that
;;; unFBOUNDPness meant they were running on an system which didn't
;;; support the extension.)
-(define-condition unsupported-operator (cell-error) ()
- (:report
- (lambda (condition stream)
- (format stream
- "unsupported on this platform (OS, CPU, whatever): ~S"
- (cell-error-name condition)))))
+(define-condition unsupported-operator (simple-error) ())
+
;;; (:ansi-cl :function remove)
;;; (:ansi-cl :section (a b c))
Oops, something went wrong.

0 comments on commit 75b5237

Please sign in to comment.