X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fgeneric%2Fparms.lisp;h=4661321a9776ad81c9cc81fd526a24938e6318f3;hb=7f579b076a1fc54587538ead07e506e7f06f3fe8;hp=bbd4eaea5ddc10d85aca886af7b810e21344f2e9;hpb=27b74ec6758f52b76e4f90cbf628f173a0cc6acb;p=sbcl.git diff --git a/src/compiler/generic/parms.lisp b/src/compiler/generic/parms.lisp index bbd4eae..4661321 100644 --- a/src/compiler/generic/parms.lisp +++ b/src/compiler/generic/parms.lisp @@ -12,7 +12,7 @@ (in-package "SB!VM") -(def!macro !configure-dynamic-space-end (default) +(def!macro !configure-dynamic-space-end (&optional default) (with-open-file (f "output/dynamic-space-size.txt") (let ((line (read-line f))) (multiple-value-bind (number end) @@ -27,7 +27,85 @@ (t (error "Invalid --dynamic-space-size=~A" line))))) `(+ dynamic-space-start ,(* number mult))) - default))))) + (or default + `(+ dynamic-space-start + (ecase n-word-bits + (32 (expt 2 29)) + (64 (expt 2 30)))))))))) + +#!+gencgc +;; Define START/END constants for GENCGC spaces. +;; Assumptions: +;; We only need very small read-only and static spaces, because +;; gencgc does not purify any more. We can count on being able to +;; allocate them with roughly the same size, and next to each other. +;; +;; There is one page of unmapped buffer between them for good measure. +;; +;; The linkage table (if enabled) can be treated the same way. +;; +;; Dynamic space traditionally sits elsewhere, so has its own +;; parameter. But if not specified, it is allocated right after +;; the other spaces (used on Windows/x86). +;; +;; The safepoint page (if enabled) is to be allocated immediately +;; prior to static page. For x86(-64) this would not matter, because +;; they can only reference it using an absolute fixup anyway, but +;; for RISC platforms we can (and must) do better. +;; +;; The safepoint page needs to be small enough that the offset from +;; static space is immediate, e.g. >= -2^12 for SPARC. #x1000 works +;; for almost all platforms, but is too small to make VirtualProtect +;; happy -- hence the need for an extra `alignment' configuration +;; option below, which parms.lisp can set to #x10000 on Windows. +;; +;; Cosmetic problem: +;; +;; In the interest of readability, &KEY would be much nicer than +;; &OPTIONAL. But is it possible to use keyword arguments to +;; DEF!MACRO? +;; +(def!macro !gencgc-space-setup + (small-spaces-start + &optional dynamic-space-start* + default-dynamic-space-size + ;; Smallest os_validate()able alignment; used as safepoint + ;; page size. Default suitable for POSIX platforms. + (alignment #x1000) + ;; traditional distance between spaces -- including the margin: + (small-space-spread #x100000) + ;; traditional margin between spaces + (margin-size #x1000)) + (let* ((spaces '(read-only static #!+linkage-table linkage-table)) + (ptr small-spaces-start) + safepoint-address + (small-space-forms + (loop for (space next-space) on spaces appending + (let* ((next-start (+ ptr small-space-spread)) + (end next-start)) + (when (eq next-space 'static) + ;; margin becomes safepoint page; substract margin again. + (decf end alignment) + (setf safepoint-address end)) + (prog1 + `((def!constant ,(symbolicate space "-SPACE-START") + ,ptr) + (def!constant ,(symbolicate space "-SPACE-END") + ,(- end margin-size))) + (setf ptr next-start))))) + (safepoint-page-forms + (list #!+sb-safepoint + `(def!constant gc-safepoint-page-addr ,safepoint-address))) + (dynamic-space-start* (or dynamic-space-start* ptr)) + (optional-dynamic-space-end + (when default-dynamic-space-size + (list (+ dynamic-space-start* default-dynamic-space-size))))) + `(progn + ,@safepoint-page-forms + ,@small-space-forms + (def!constant dynamic-space-start ,dynamic-space-start*) + (def!constant dynamic-space-end (!configure-dynamic-space-end + ,@optional-dynamic-space-end))))) (defparameter *c-callable-static-symbols* '(sub-gc @@ -44,7 +122,11 @@ sb!di::handle-breakpoint sb!di::handle-single-step-trap fdefinition-object - #!+win32 sb!kernel::handle-win32-exception)) + #!+win32 sb!kernel::handle-win32-exception + #!+sb-thruption sb!thread::run-interruption + #!+sb-safepoint sb!thread::enter-foreign-callback + #!+(and sb-safepoint-strictly (not win32)) + sb!unix::signal-handler-callback)) (defparameter *common-static-symbols* '(t @@ -76,17 +158,25 @@ sb!unix::*allow-with-interrupts* sb!unix::*interrupts-enabled* sb!unix::*interrupt-pending* - *in-without-gcing* + #!+sb-thruption sb!unix::*thruption-pending* + #!+sb-thruption sb!impl::*restart-clusters* + sb!vm::*in-without-gcing* *gc-inhibit* *gc-pending* #!-sb-thread *stepping* + #!+sb-safepoint sb!impl::*gc-safe* + #!+sb-safepoint sb!impl::*in-safepoint* ;; threading support #!+sb-thread *stop-for-gc-pending* #!+sb-thread *free-tls-index* #!+sb-thread *tls-index-lock* + ;; dynamic runtime linking support + #!+sb-dynamic-core *required-runtime-c-symbols* + sb!kernel::*gc-epoch* + ;; Dispatch tables for generic array access sb!impl::%%data-vector-reffers%% sb!impl::%%data-vector-reffers/check-bounds%%