[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sbcl-commits
Subject:    Re: [Sbcl-commits] master: Assert self-containedness of all but 1 autogenerated header
From:       Stas Boukarev <stassats () gmail ! com>
Date:       2023-06-29 17:22:42
Message-ID: CAF63=12fH5UcbmTSmFjvCcQ5DxLrHVM35cC_B-ShsCAwnsf5bQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On win32:
While evaluating the form starting at line 211, column 0
  of #P"D:/a/sbcl/sbcl/tests/../src/compiler/generic/utils.lisp":
Unhandled UNDEFINED-FUNCTION in thread #<HOST-SB-THREAD:THREAD "main
thread" RUNNING
                                          {1000238073}>:
  The function SB-XC:MAKE-ARRAY is undefined.

On Thu, Jun 29, 2023 at 7:49 PM snuglas via Sbcl-commits <
sbcl-commits@lists.sourceforge.net> wrote:

> The branch "master" has been updated in SBCL:
>        via  b3ab2dcf41501a6045013ef00d2317175a2dcbf2 (commit)
>       from  4e15055ee77065e87df331daeae28387f1c061df (commit)
>
> - Log -----------------------------------------------------------------
> commit b3ab2dcf41501a6045013ef00d2317175a2dcbf2
> Author: Douglas Katzman <dougk@google.com>
> Date:   Thu Jun 29 12:45:20 2023 -0400
>
>     Assert self-containedness of all but 1 autogenerated header
>
>     Good layering makes logic clearer when designing new C algorithms that
>     manipulate object representations, without needing to deal with the
> insanity
>     of the 16 inclusions of src/runtime/thread.h just to include the
>     primitive thread.h structure for example.
> ---
>  src/compiler/generic/genesis.lisp | 55
> +++++++++++++++++++++++++++++++++++----
>  src/runtime/gencgc-alloc-region.h | 10 -------
>  src/runtime/gencgc-internal.h     |  1 +
>  src/runtime/gencgc.c              | 13 ++-------
>  src/runtime/thread.h              | 23 +---------------
>  tests/genheaders.test.sh          | 29 ++++++++++++++++-----
>  6 files changed, 77 insertions(+), 54 deletions(-)
>
> diff --git a/src/compiler/generic/genesis.lisp
> b/src/compiler/generic/genesis.lisp
> index 8602ba0da..76bc55931 100644
> --- a/src/compiler/generic/genesis.lisp
> +++ b/src/compiler/generic/genesis.lisp
> @@ -3328,6 +3328,32 @@ lispobj symbol_package(struct symbol*);~%"
> (genesis-header-prefix))
>        "length_"
>        (c-name (string-downcase slot-name))))
>
> +(defun write-genesis-thread-h-requisites ()
> +  (format t "
> +#include \"genesis/config.h\"
> +#ifndef LISP_FEATURE_WIN32
> +#include <pthread.h>
> +#endif
> +#include \"gencgc-alloc-region.h\"
> +
> +#define N_HISTOGRAM_BINS_LARGE 32
> +#define N_HISTOGRAM_BINS_SMALL 32
> +typedef lispobj
> size_histogram[2*N_HISTOGRAM_BINS_LARGE+N_HISTOGRAM_BINS_SMALL];
> +
> +struct thread_state_word {
> +  // - control_stack_guard_page_protected is referenced from
> +  //   hand-written assembly code. (grep 'THREAD_STATE_WORD_OFFSET')
> +  // - sprof_enable is referenced with SAPs.
> +  //   (grep 'sb-vm:thread-state-word-slot')
> +  char control_stack_guard_page_protected;
> +  char sprof_enable; // statistical CPU profiler switch
> +  char state;
> +  char user_thread_p; // opposite of lisp's ephemeral-p
> +#ifdef LISP_FEATURE_64_BIT
> +  char padding[4];
> +#endif
> +};~%"))
> +
>  (defun write-weak-pointer-manipulators ()
>    #+64-bit
>    (format t "static inline void set_weak_pointer_next(struct weak_pointer
> *wp, void *next) {
> @@ -3355,6 +3381,7 @@ static inline struct weak_pointer
> *get_weak_pointer_next(struct weak_pointer *wp
>                 (format t "#define CODE_SLOTS_PER_SIMPLE_FUN ~d~2%"
>                         sb-vm:code-slots-per-simple-fun))
>               (when (eq name 'sb-vm::thread)
> +               (write-genesis-thread-h-requisites)
>                 (format t "#define INIT_THREAD_REGIONS(x) \\~%")
>                 (let ((tlabs (map 'list
>                                   (lambda (x) (c-name (string-downcase
> (second x))))
> @@ -4075,16 +4102,35 @@ III. initially undefined function references
> (alphabetically):
>
>  #+gencgc
>  (defun write-mark-array-operators (stream &optional (ncards
> sb-vm::cards-per-page))
> +  (format stream "#include ~S
> +extern unsigned char *gc_card_mark;~%" (lispobj-dot-h))
> +
>    #-soft-card-marks
>    (progn
>      (aver (= ncards 1))
> -    (format stream "static inline int cardseq_all_marked_nonsticky(long
> card) {
> +    #+nil ; we take these from gc-private.h. Is that right?
> +    (progn
> +      (format stream "static inline int cardseq_all_marked_nonsticky(long
> card) {
>      return gc_card_mark[card] == CARD_MARKED;~%}~%")
> -    (format stream "static inline int cardseq_any_marked(long card) {
> +      (format stream "static inline int cardseq_any_marked(long card) {
>      return gc_card_mark[card] != CARD_UNMARKED;~%}~%")
> -    (format stream "static inline int cardseq_any_sticky_mark(long card) {
> +      (format stream "static inline int cardseq_any_sticky_mark(long
> card) {
>      return gc_card_mark[card] == STICKY_MARK;~%}~%"))
> -  #+soft-card-marks
> +    (return-from write-mark-array-operators))
> +
> +  ;; This string has a ~s and ~w so don't use FORMAT on it
> +  (write-string "
> +/* SIMD-within-a-register algorithms
> + *
> + * from https://graphics.stanford.edu/~seander/bithacks.html
> + */
> +static inline uword_t word_haszero(uword_t word) {
> +  return ((word - 0x0101010101010101LL) & ~word & 0x8080808080808080LL)
> != 0;
> +}
> +static inline uword_t word_has_stickymark(uword_t word) {
> +  return word_haszero(word ^ 0x0202020202020202LL);
> +}
> +" stream)
>    ;; In general we have to be wary of wraparound of the card index bits
>    ;; - see example in comment above the definition of
> addr_to_card_index() -
>    ;; but it's OK to treat marks as linearly addressable within a page.
> @@ -4146,7 +4192,6 @@ III. initially undefined function references
> (alphabetically):
>          (out-to "regnames" (write-regnames-h stream))
>          (out-to "errnames" (write-errnames-h stream))
>          (out-to "gc-tables" (sb-vm::write-gc-tables stream))
> -        #+soft-card-marks
>          (out-to "cardmarks" (write-mark-array-operators stream))
>          (out-to "tagnames" (write-tagnames-h stream))
>          (out-to "print.inc" (write-c-print-dispatch stream))
> diff --git a/src/runtime/gencgc-alloc-region.h
> b/src/runtime/gencgc-alloc-region.h
> index a9cd1d643..7c707a8c7 100644
> --- a/src/runtime/gencgc-alloc-region.h
> +++ b/src/runtime/gencgc-alloc-region.h
> @@ -1,12 +1,6 @@
>  #ifndef _GENCGC_ALLOC_REGION_H_
>  #define _GENCGC_ALLOC_REGION_H_
>
> -#include "gc.h"
> -
> -#ifndef LISP_FEATURE_GENCGC
> -#error "gencgc-alloc-region.h included, but LISP_FEATURE_GENCGC not
> defined"
> -#endif
> -
>  /* Abstract out the data for an allocation region allowing a single
>   * routine to be used for allocation and closing. */
>  /* Caution: if you change this, you may have to change
> compiler/generic/objdef
> @@ -27,9 +21,6 @@ typedef struct {
>      uword_t token;
>  } arena_state;
>
> -// Macro to statically initialize instead of using set_region_empty()
> -#define ALLOC_REGION_INITIALIZER {(void*)0x1000, (void*)1000, 0}
> -
>  // One region for each of page type.
>  // These indices have no correlation to PAGE_TYPE constants.
>  // MIXED has to always be at array index 0 because lisp accesses
> @@ -49,7 +40,6 @@ extern struct alloc_region  gc_alloc_region[6];
>                 |(uintptr_t)gc_alloc_region[4].start_addr \
>                 |(uintptr_t)gc_alloc_region[5].start_addr))
>
> -extern generation_index_t from_space, new_space;
>  extern int gencgc_alloc_profiler;
>
>  #endif /*  _GENCGC_ALLOC_REGION_H_ */
> diff --git a/src/runtime/gencgc-internal.h b/src/runtime/gencgc-internal.h
> index e24434146..c4dc2fd3c 100644
> --- a/src/runtime/gencgc-internal.h
> +++ b/src/runtime/gencgc-internal.h
> @@ -323,6 +323,7 @@ static inline boolean pinned_p(lispobj obj,
> page_index_t page)
>      return (pins & (1<<subpage)) && hopscotch_containsp(&pinned_objects,
> obj);
>  }
>
> +extern generation_index_t from_space, new_space;
>  // Return true only if 'obj' must be *physically* transported to survive
> gc.
>  // Return false if obj is in the immobile space regardless of its
> generation.
>  // Pretend pinned objects are not in oldspace so that they don't get
> moved.
> diff --git a/src/runtime/gencgc.c b/src/runtime/gencgc.c
> index 12e1203a9..d7c6a4951 100644
> --- a/src/runtime/gencgc.c
> +++ b/src/runtime/gencgc.c
> @@ -226,18 +226,9 @@ static inline void reset_page_flags(page_index_t
> page) {
>      assign_page_card_marks(page, CARD_MARKED);
>  }
>
> -/* SIMD-within-a-register algorithms
> - *
> - * from https://graphics.stanford.edu/~seander/bithacks.html
> - */
> -#ifdef LISP_FEATURE_SOFT_CARD_MARKS
> -static inline uword_t word_haszero(uword_t word) {
> -  return ((word - 0x0101010101010101LL) & ~word & 0x8080808080808080LL)
> != 0;
> -}
> -static inline uword_t word_has_stickymark(uword_t word) {
> -  return word_haszero(word ^ 0x0202020202020202LL);
> -}
>  #include "genesis/cardmarks.h"
> +#ifdef LISP_FEATURE_SOFT_CARD_MARKS
> +// This is a macro from gc-private.h otherwise
>  int page_cards_all_marked_nonsticky(page_index_t page) {
>      return cardseq_all_marked_nonsticky(page_to_card_index(page));
>  }
> diff --git a/src/runtime/thread.h b/src/runtime/thread.h
> index 5d8e45d00..c66a56450 100644
> --- a/src/runtime/thread.h
> +++ b/src/runtime/thread.h
> @@ -8,36 +8,15 @@
>  #include "globals.h"
>  #include "runtime.h"
>  #include "os.h"
> -#ifdef LISP_FEATURE_GENCGC
> -#include "gencgc-alloc-region.h"
> -#endif
>  #include "genesis/symbol.h"
>  #include "genesis/static-symbols.h"
> -
> -struct thread_state_word {
> -  // - control_stack_guard_page_protected is referenced from
> -  //   hand-written assembly code. (grep "THREAD_STATE_WORD_OFFSET")
> -  // - sprof_enable is referenced with SAPs.
> -  //   (grep "sb-vm:thread-state-word-slot")
> -  char control_stack_guard_page_protected;
> -  char sprof_enable; // statistical CPU profiler switch
> -  char state;
> -  char user_thread_p; // opposite of lisp's ephemeral-p
> -#ifdef LISP_FEATURE_64_BIT
> -  char padding[4];
> -#endif
> -};
> -
> -#define N_HISTOGRAM_BINS_LARGE 32
> -#define N_HISTOGRAM_BINS_SMALL 32
> -typedef lispobj
> size_histogram[2*N_HISTOGRAM_BINS_LARGE+N_HISTOGRAM_BINS_SMALL];
> -
>  #include "genesis/thread.h"
>  #include "genesis/thread-instance.h"
>  #include "genesis/fdefn.h"
>  #include "genesis/vector.h"
>  #include "interrupt.h"
>  #include "validate.h"           /* for BINDING_STACK_SIZE etc */
> +#include "gc.h" // for page_index_t
>
>  enum threadstate {STATE_RUNNING=1, STATE_STOPPED, STATE_DEAD};
>
> diff --git a/tests/genheaders.test.sh b/tests/genheaders.test.sh
> index b4dcc4210..8003c3b3d 100755
> --- a/tests/genheaders.test.sh
> +++ b/tests/genheaders.test.sh
> @@ -7,10 +7,10 @@ create_test_subdirectory
>  run_sbcl <<EOF
>  ;; technically this is "skipped" if not fasteval, but we don't have
> "skipped"
>  ;; as a status code from shell tests.
> -(unless (and (find-package "SB-INTERPRETER")
> -             ;; host with #+sb-devel hangs, not sure why
> -             (not (member :sb-devel *features*)))
> - ;; exit normally so that the shell doesn't exit abnormally (as per "set
> -e")
> +(when (member :sb-devel *features*)
> +  ;; host with #+sb-devel hangs
> +  ;; exit normally so that the shell doesn't exit abnormally (as per "set
> -e")
> + (format t "~&Skipping test due to sb-devel~%")
>   (exit))
>  (setq *evaluator-mode* :interpret)
>  (defvar *sbcl-local-target-features-file*
> "../local-target-features.lisp-expr")
> @@ -20,7 +20,8 @@ run_sbcl <<EOF
>  (in-package "SB-COLD")
>  (defvar *target-sbcl-version* (read-from-file "../version.lisp-expr"))
>  (in-host-compilation-mode
> - (lambda (&aux (sb-xc:*features* (cons :c-headers-only sb-xc:*features*)))
> + (lambda (&aux (sb-xc:*features* (cons :c-headers-only sb-xc:*features*))
> +               (*load-verbose* t))
>     (do-stems-and-flags (stem flags 1)
>       (when (member :c-headers flags)
>         (handler-bind ((style-warning (function muffle-warning)))
> @@ -29,7 +30,23 @@ run_sbcl <<EOF
>     (load "../src/compiler/generic/genesis.lisp")))
>  (genesis :c-header-dir-name "$TEST_DIRECTORY/" :verbose t)
>  (assert (probe-file "$TEST_DIRECTORY/gc-tables.h"))
> -(dolist (pathname (directory "$TEST_DIRECTORY/*.*")) (delete-file
> pathname))
>  EOF
>
> +src=$TEST_DIRECTORY/test.c
> +obj=$TEST_DIRECTORY/test.o
> +# no files exist if the generator test was entirely skipped
> +if [ -r $TEST_DIRECTORY/array.h ]
> +then
> +    for i in $TEST_DIRECTORY/*.h
> +    do
> +        case $i in
> +        */gc-tables.h) ;; # fails to compile by itself (FIXME)
> +        *)
> +          echo "#include \"$i\"" > ${src}
> +          ./run-compiler.sh -I../src/runtime -c -o ${obj} ${src}
> +          ;;
> +        esac
> +    done
> +fi
> +
>  exit $EXIT_TEST_WIN
>
> -----------------------------------------------------------------------
>
>
> hooks/post-receive
> --
> SBCL
>
>
> _______________________________________________
> Sbcl-commits mailing list
> Sbcl-commits@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sbcl-commits
>

[Attachment #5 (text/html)]

<div dir="ltr">On win32:<div>While evaluating the form starting at line 211, column \
0<br>   of #P&quot;D:/a/sbcl/sbcl/tests/../src/compiler/generic/utils.lisp&quot;:<br>Unhandled \
UNDEFINED-FUNCTION in thread #&lt;HOST-SB-THREAD:THREAD &quot;main thread&quot; \
RUNNING<br>                                                               \
{1000238073}&gt;:<br>   The function SB-XC:MAKE-ARRAY is \
undefined.<br></div></div><br><div class="gmail_quote"><div dir="ltr" \
class="gmail_attr">On Thu, Jun 29, 2023 at 7:49 PM snuglas via Sbcl-commits &lt;<a \
href="mailto:sbcl-commits@lists.sourceforge.net">sbcl-commits@lists.sourceforge.net</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The branch \
&quot;master&quot; has been updated in SBCL:<br>  via   \
b3ab2dcf41501a6045013ef00d2317175a2dcbf2 (commit)<br>  from   \
4e15055ee77065e87df331daeae28387f1c061df (commit)<br> <br>
- Log -----------------------------------------------------------------<br>
commit b3ab2dcf41501a6045013ef00d2317175a2dcbf2<br>
Author: Douglas Katzman &lt;<a href="mailto:dougk@google.com" \
                target="_blank">dougk@google.com</a>&gt;<br>
Date:     Thu Jun 29 12:45:20 2023 -0400<br>
<br>
      Assert self-containedness of all but 1 autogenerated header<br>
<br>
      Good layering makes logic clearer when designing new C algorithms that<br>
      manipulate object representations, without needing to deal with the \
insanity<br>  of the 16 inclusions of src/runtime/thread.h just to include the<br>
      primitive thread.h structure for example.<br>
---<br>
  src/compiler/generic/genesis.lisp | 55 +++++++++++++++++++++++++++++++++++----<br>
  src/runtime/gencgc-alloc-region.h | 10 -------<br>
  src/runtime/gencgc-internal.h        |   1 +<br>
  src/runtime/gencgc.c                     | 13 ++-------<br>
  src/runtime/thread.h                     | 23 +---------------<br>
  tests/<a href="http://genheaders.test.sh" rel="noreferrer" \
target="_blank">genheaders.test.sh</a>               | 29 ++++++++++++++++-----<br>  \
6 files changed, 77 insertions(+), 54 deletions(-)<br> <br>
diff --git a/src/compiler/generic/genesis.lisp \
b/src/compiler/generic/genesis.lisp<br> index 8602ba0da..76bc55931 100644<br>
--- a/src/compiler/generic/genesis.lisp<br>
+++ b/src/compiler/generic/genesis.lisp<br>
@@ -3328,6 +3328,32 @@ lispobj symbol_package(struct symbol*);~%&quot; \
(genesis-header-prefix))<br>  &quot;length_&quot;<br>
           (c-name (string-downcase slot-name))))<br>
<br>
+(defun write-genesis-thread-h-requisites ()<br>
+   (format t &quot;<br>
+#include \&quot;genesis/config.h\&quot;<br>
+#ifndef LISP_FEATURE_WIN32<br>
+#include &lt;pthread.h&gt;<br>
+#endif<br>
+#include \&quot;gencgc-alloc-region.h\&quot;<br>
+<br>
+#define N_HISTOGRAM_BINS_LARGE 32<br>
+#define N_HISTOGRAM_BINS_SMALL 32<br>
+typedef lispobj size_histogram[2*N_HISTOGRAM_BINS_LARGE+N_HISTOGRAM_BINS_SMALL];<br>
+<br>
+struct thread_state_word {<br>
+   // - control_stack_guard_page_protected is referenced from<br>
+   //     hand-written assembly code. (grep &#39;THREAD_STATE_WORD_OFFSET&#39;)<br>
+   // - sprof_enable is referenced with SAPs.<br>
+   //     (grep &#39;sb-vm:thread-state-word-slot&#39;)<br>
+   char control_stack_guard_page_protected;<br>
+   char sprof_enable; // statistical CPU profiler switch<br>
+   char state;<br>
+   char user_thread_p; // opposite of lisp&#39;s ephemeral-p<br>
+#ifdef LISP_FEATURE_64_BIT<br>
+   char padding[4];<br>
+#endif<br>
+};~%&quot;))<br>
+<br>
  (defun write-weak-pointer-manipulators ()<br>
     #+64-bit<br>
     (format t &quot;static inline void set_weak_pointer_next(struct weak_pointer \
*wp, void *next) {<br> @@ -3355,6 +3381,7 @@ static inline struct weak_pointer \
                *get_weak_pointer_next(struct weak_pointer *wp<br>
                        (format t &quot;#define CODE_SLOTS_PER_SIMPLE_FUN \
~d~2%&quot;<br>  sb-vm:code-slots-per-simple-fun))<br>
                     (when (eq name &#39;sb-vm::thread)<br>
+                       (write-genesis-thread-h-requisites)<br>
                        (format t &quot;#define INIT_THREAD_REGIONS(x) \
\\~%&quot;)<br>  (let ((tlabs (map &#39;list<br>
                                                   (lambda (x) (c-name \
(string-downcase (second x))))<br> @@ -4075,16 +4102,35 @@ III. initially undefined \
function references (alphabetically):<br> <br>
  #+gencgc<br>
  (defun write-mark-array-operators (stream &amp;optional (ncards \
sb-vm::cards-per-page))<br> +   (format stream &quot;#include ~S<br>
+extern unsigned char *gc_card_mark;~%&quot; (lispobj-dot-h))<br>
+<br>
     #-soft-card-marks<br>
     (progn<br>
        (aver (= ncards 1))<br>
-      (format stream &quot;static inline int cardseq_all_marked_nonsticky(long card) \
{<br> +      #+nil ; we take these from gc-private.h. Is that right?<br>
+      (progn<br>
+         (format stream &quot;static inline int cardseq_all_marked_nonsticky(long \
card) {<br>  return gc_card_mark[card] == CARD_MARKED;~%}~%&quot;)<br>
-      (format stream &quot;static inline int cardseq_any_marked(long card) {<br>
+         (format stream &quot;static inline int cardseq_any_marked(long card) {<br>
        return gc_card_mark[card] != CARD_UNMARKED;~%}~%&quot;)<br>
-      (format stream &quot;static inline int cardseq_any_sticky_mark(long card) \
{<br> +         (format stream &quot;static inline int cardseq_any_sticky_mark(long \
card) {<br>  return gc_card_mark[card] == STICKY_MARK;~%}~%&quot;))<br>
-   #+soft-card-marks<br>
+      (return-from write-mark-array-operators))<br>
+<br>
+   ;; This string has a ~s and ~w so don&#39;t use FORMAT on it<br>
+   (write-string &quot;<br>
+/* SIMD-within-a-register algorithms<br>
+ *<br>
+ * from <a href="https://graphics.stanford.edu/~seander/bithacks.html" \
rel="noreferrer" target="_blank">https://graphics.stanford.edu/~seander/bithacks.html</a><br>
 + */<br>
+static inline uword_t word_haszero(uword_t word) {<br>
+   return ((word - 0x0101010101010101LL) &amp; ~word &amp; 0x8080808080808080LL) != \
0;<br> +}<br>
+static inline uword_t word_has_stickymark(uword_t word) {<br>
+   return word_haszero(word ^ 0x0202020202020202LL);<br>
+}<br>
+&quot; stream)<br>
     ;; In general we have to be wary of wraparound of the card index bits<br>
     ;; - see example in comment above the definition of addr_to_card_index() -<br>
     ;; but it&#39;s OK to treat marks as linearly addressable within a page.<br>
@@ -4146,7 +4192,6 @@ III. initially undefined function references \
(alphabetically):<br>  (out-to &quot;regnames&quot; (write-regnames-h stream))<br>
              (out-to &quot;errnames&quot; (write-errnames-h stream))<br>
              (out-to &quot;gc-tables&quot; (sb-vm::write-gc-tables stream))<br>
-            #+soft-card-marks<br>
              (out-to &quot;cardmarks&quot; (write-mark-array-operators stream))<br>
              (out-to &quot;tagnames&quot; (write-tagnames-h stream))<br>
              (out-to &quot;print.inc&quot; (write-c-print-dispatch stream))<br>
diff --git a/src/runtime/gencgc-alloc-region.h \
b/src/runtime/gencgc-alloc-region.h<br> index a9cd1d643..7c707a8c7 100644<br>
--- a/src/runtime/gencgc-alloc-region.h<br>
+++ b/src/runtime/gencgc-alloc-region.h<br>
@@ -1,12 +1,6 @@<br>
  #ifndef _GENCGC_ALLOC_REGION_H_<br>
  #define _GENCGC_ALLOC_REGION_H_<br>
<br>
-#include &quot;gc.h&quot;<br>
-<br>
-#ifndef LISP_FEATURE_GENCGC<br>
-#error &quot;gencgc-alloc-region.h included, but LISP_FEATURE_GENCGC not \
                defined&quot;<br>
-#endif<br>
-<br>
  /* Abstract out the data for an allocation region allowing a single<br>
   * routine to be used for allocation and closing. */<br>
  /* Caution: if you change this, you may have to change compiler/generic/objdef<br>
@@ -27,9 +21,6 @@ typedef struct {<br>
        uword_t token;<br>
  } arena_state;<br>
<br>
-// Macro to statically initialize instead of using set_region_empty()<br>
-#define ALLOC_REGION_INITIALIZER {(void*)0x1000, (void*)1000, 0}<br>
-<br>
  // One region for each of page type.<br>
  // These indices have no correlation to PAGE_TYPE constants.<br>
  // MIXED has to always be at array index 0 because lisp accesses<br>
@@ -49,7 +40,6 @@ extern struct alloc_region   gc_alloc_region[6];<br>
                        |(uintptr_t)gc_alloc_region[4].start_addr \<br>
                        |(uintptr_t)gc_alloc_region[5].start_addr))<br>
<br>
-extern generation_index_t from_space, new_space;<br>
  extern int gencgc_alloc_profiler;<br>
<br>
  #endif /*   _GENCGC_ALLOC_REGION_H_ */<br>
diff --git a/src/runtime/gencgc-internal.h b/src/runtime/gencgc-internal.h<br>
index e24434146..c4dc2fd3c 100644<br>
--- a/src/runtime/gencgc-internal.h<br>
+++ b/src/runtime/gencgc-internal.h<br>
@@ -323,6 +323,7 @@ static inline boolean pinned_p(lispobj obj, page_index_t \
                page)<br>
        return (pins &amp; (1&lt;&lt;subpage)) &amp;&amp; \
hopscotch_containsp(&amp;pinned_objects, obj);<br>  }<br>
<br>
+extern generation_index_t from_space, new_space;<br>
  // Return true only if &#39;obj&#39; must be *physically* transported to survive \
gc.<br>  // Return false if obj is in the immobile space regardless of its \
generation.<br>  // Pretend pinned objects are not in oldspace so that they don&#39;t \
                get moved.<br>
diff --git a/src/runtime/gencgc.c b/src/runtime/gencgc.c<br>
index 12e1203a9..d7c6a4951 100644<br>
--- a/src/runtime/gencgc.c<br>
+++ b/src/runtime/gencgc.c<br>
@@ -226,18 +226,9 @@ static inline void reset_page_flags(page_index_t page) {<br>
        assign_page_card_marks(page, CARD_MARKED);<br>
  }<br>
<br>
-/* SIMD-within-a-register algorithms<br>
- *<br>
- * from <a href="https://graphics.stanford.edu/~seander/bithacks.html" \
rel="noreferrer" target="_blank">https://graphics.stanford.edu/~seander/bithacks.html</a><br>
                
- */<br>
-#ifdef LISP_FEATURE_SOFT_CARD_MARKS<br>
-static inline uword_t word_haszero(uword_t word) {<br>
-   return ((word - 0x0101010101010101LL) &amp; ~word &amp; 0x8080808080808080LL) != \
                0;<br>
-}<br>
-static inline uword_t word_has_stickymark(uword_t word) {<br>
-   return word_haszero(word ^ 0x0202020202020202LL);<br>
-}<br>
  #include &quot;genesis/cardmarks.h&quot;<br>
+#ifdef LISP_FEATURE_SOFT_CARD_MARKS<br>
+// This is a macro from gc-private.h otherwise<br>
  int page_cards_all_marked_nonsticky(page_index_t page) {<br>
        return cardseq_all_marked_nonsticky(page_to_card_index(page));<br>
  }<br>
diff --git a/src/runtime/thread.h b/src/runtime/thread.h<br>
index 5d8e45d00..c66a56450 100644<br>
--- a/src/runtime/thread.h<br>
+++ b/src/runtime/thread.h<br>
@@ -8,36 +8,15 @@<br>
  #include &quot;globals.h&quot;<br>
  #include &quot;runtime.h&quot;<br>
  #include &quot;os.h&quot;<br>
-#ifdef LISP_FEATURE_GENCGC<br>
-#include &quot;gencgc-alloc-region.h&quot;<br>
-#endif<br>
  #include &quot;genesis/symbol.h&quot;<br>
  #include &quot;genesis/static-symbols.h&quot;<br>
-<br>
-struct thread_state_word {<br>
-   // - control_stack_guard_page_protected is referenced from<br>
-   //     hand-written assembly code. (grep \
                &quot;THREAD_STATE_WORD_OFFSET&quot;)<br>
-   // - sprof_enable is referenced with SAPs.<br>
-   //     (grep &quot;sb-vm:thread-state-word-slot&quot;)<br>
-   char control_stack_guard_page_protected;<br>
-   char sprof_enable; // statistical CPU profiler switch<br>
-   char state;<br>
-   char user_thread_p; // opposite of lisp&#39;s ephemeral-p<br>
-#ifdef LISP_FEATURE_64_BIT<br>
-   char padding[4];<br>
-#endif<br>
-};<br>
-<br>
-#define N_HISTOGRAM_BINS_LARGE 32<br>
-#define N_HISTOGRAM_BINS_SMALL 32<br>
-typedef lispobj size_histogram[2*N_HISTOGRAM_BINS_LARGE+N_HISTOGRAM_BINS_SMALL];<br>
-<br>
  #include &quot;genesis/thread.h&quot;<br>
  #include &quot;genesis/thread-instance.h&quot;<br>
  #include &quot;genesis/fdefn.h&quot;<br>
  #include &quot;genesis/vector.h&quot;<br>
  #include &quot;interrupt.h&quot;<br>
  #include &quot;validate.h&quot;                 /* for BINDING_STACK_SIZE etc \
*/<br> +#include &quot;gc.h&quot; // for page_index_t<br>
<br>
  enum threadstate {STATE_RUNNING=1, STATE_STOPPED, STATE_DEAD};<br>
<br>
diff --git a/tests/<a href="http://genheaders.test.sh" rel="noreferrer" \
target="_blank">genheaders.test.sh</a> b/tests/<a href="http://genheaders.test.sh" \
rel="noreferrer" target="_blank">genheaders.test.sh</a><br> index \
                b4dcc4210..8003c3b3d 100755<br>
--- a/tests/<a href="http://genheaders.test.sh" rel="noreferrer" \
                target="_blank">genheaders.test.sh</a><br>
+++ b/tests/<a href="http://genheaders.test.sh" rel="noreferrer" \
target="_blank">genheaders.test.sh</a><br> @@ -7,10 +7,10 @@ \
create_test_subdirectory<br>  run_sbcl &lt;&lt;EOF<br>
  ;; technically this is &quot;skipped&quot; if not fasteval, but we don&#39;t have \
&quot;skipped&quot;<br>  ;; as a status code from shell tests.<br>
-(unless (and (find-package &quot;SB-INTERPRETER&quot;)<br>
-                    ;; host with #+sb-devel hangs, not sure why<br>
-                    (not (member :sb-devel *features*)))<br>
- ;; exit normally so that the shell doesn&#39;t exit abnormally (as per &quot;set \
-e&quot;)<br> +(when (member :sb-devel *features*)<br>
+   ;; host with #+sb-devel hangs<br>
+   ;; exit normally so that the shell doesn&#39;t exit abnormally (as per &quot;set \
-e&quot;)<br> + (format t &quot;~&amp;Skipping test due to sb-devel~%&quot;)<br>
   (exit))<br>
  (setq *evaluator-mode* :interpret)<br>
  (defvar *sbcl-local-target-features-file* \
&quot;../local-target-features.lisp-expr&quot;)<br> @@ -20,7 +20,8 @@ run_sbcl \
&lt;&lt;EOF<br>  (in-package &quot;SB-COLD&quot;)<br>
  (defvar *target-sbcl-version* (read-from-file \
&quot;../version.lisp-expr&quot;))<br>  (in-host-compilation-mode<br>
- (lambda (&amp;aux (sb-xc:*features* (cons :c-headers-only sb-xc:*features*)))<br>
+ (lambda (&amp;aux (sb-xc:*features* (cons :c-headers-only sb-xc:*features*))<br>
+                       (*load-verbose* t))<br>
      (do-stems-and-flags (stem flags 1)<br>
         (when (member :c-headers flags)<br>
            (handler-bind ((style-warning (function muffle-warning)))<br>
@@ -29,7 +30,23 @@ run_sbcl &lt;&lt;EOF<br>
      (load &quot;../src/compiler/generic/genesis.lisp&quot;)))<br>
  (genesis :c-header-dir-name &quot;$TEST_DIRECTORY/&quot; :verbose t)<br>
  (assert (probe-file &quot;$TEST_DIRECTORY/gc-tables.h&quot;))<br>
-(dolist (pathname (directory &quot;$TEST_DIRECTORY/*.*&quot;)) (delete-file \
pathname))<br>  EOF<br>
<br>
+src=$TEST_DIRECTORY/test.c<br>
+obj=$TEST_DIRECTORY/test.o<br>
+# no files exist if the generator test was entirely skipped<br>
+if [ -r $TEST_DIRECTORY/array.h ]<br>
+then<br>
+      for i in $TEST_DIRECTORY/*.h<br>
+      do<br>
+            case $i in<br>
+            */gc-tables.h) ;; # fails to compile by itself (FIXME)<br>
+            *)<br>
+               echo &quot;#include \&quot;$i\&quot;&quot; &gt; ${src}<br>
+               ./run-compiler.sh -I../src/runtime -c -o ${obj} ${src}<br>
+               ;;<br>
+            esac<br>
+      done<br>
+fi<br>
+<br>
  exit $EXIT_TEST_WIN<br>
<br>
-----------------------------------------------------------------------<br>
<br>
<br>
hooks/post-receive<br>
-- <br>
SBCL<br>
<br>
<br>
_______________________________________________<br>
Sbcl-commits mailing list<br>
<a href="mailto:Sbcl-commits@lists.sourceforge.net" \
target="_blank">Sbcl-commits@lists.sourceforge.net</a><br> <a \
href="https://lists.sourceforge.net/lists/listinfo/sbcl-commits" rel="noreferrer" \
target="_blank">https://lists.sourceforge.net/lists/listinfo/sbcl-commits</a><br> \
</blockquote></div>





_______________________________________________
Sbcl-commits mailing list
Sbcl-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sbcl-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic