[prev in list] [next in list] [prev in thread] [next in thread]
List: sbcl-commits
Subject: Re: [Sbcl-commits] master: arm: implement and require :sb-dynamic-core
From: Stas Boukarev <stassats () gmail ! com>
Date: 2020-02-27 9:36:19
Message-ID: CAF63=130LvoRhu0naacPXaKU4Q6PbGXe72O=iv-rL=vOS=YXEA () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Should this be done during the freeze?
On Thu, 27 Feb 2020 at 03:11 Douglas Katzman via Sbcl-commits <
sbcl-commits@lists.sourceforge.net> wrote:
> The branch "master" has been updated in SBCL:
> via ba94dfb8486b2e1d880e3aefefe53b6d2a5b4013 (commit)
> from 8bdbbe69962ef1cb4db83129ef5637df7b4574ab (commit)
>
> - Log -----------------------------------------------------------------
> commit ba94dfb8486b2e1d880e3aefefe53b6d2a5b4013
> Author: Douglas Katzman <dougk@google.com>
> Date: Wed Feb 26 17:55:36 2020 -0500
>
> arm: implement and require :sb-dynamic-core
> ---
> make-config.sh | 2 +-
> src/code/target-sxhash.lisp | 4 ++--
> src/compiler/arm/macros.lisp | 29 +++++++++++++----------------
> src/runtime/Config.arm-linux | 5 +++--
> src/runtime/arm-assem.S | 2 ++
> src/runtime/gencgc-private.h | 2 +-
> src/runtime/os-common.c | 7 +++++++
> 7 files changed, 29 insertions(+), 22 deletions(-)
>
> diff --git a/make-config.sh b/make-config.sh
> index 1acfaed2e..5296d5809 100755
> --- a/make-config.sh
> +++ b/make-config.sh
> @@ -760,7 +760,7 @@ elif [ "$sbcl_arch" = "hppa" ]; then
> printf ' :stack-allocatable-vectors :stack-allocatable-fixed-objects'
> >> $ltf
> printf ' :stack-allocatable-closures :stack-allocatable-lists' >> $ltf
> elif [ "$sbcl_arch" = "arm" ]; then
> - printf ' :gencgc :linkage-table :alien-callbacks' >> $ltf
> + printf ' :gencgc :linkage-table :sb-dynamic-core :alien-callbacks' >>
> $ltf
> # As opposed to soft-float or FPA, we support VFP only (and
> # possibly VFPv2 and higher only), but we'll leave the obvious
> # hooks in for someone to add the support later.
> diff --git a/src/code/target-sxhash.lisp b/src/code/target-sxhash.lisp
> index 8a84d9ebf..3e26febdb 100644
> --- a/src/code/target-sxhash.lisp
> +++ b/src/code/target-sxhash.lisp
> @@ -89,11 +89,11 @@
> ;; dynamic-space-free-pointer increments only when a page is full.
> ;; Using boxed_region directly is finer-grained.
> #+(and (not sb-thread) gencgc)
> - (progn #+(or x86 x86-64 ppc ppc64) ; new way: alloc_region is in static
> space
> + (progn #+(or arm arm64 x86 x86-64 ppc ppc64) ; new way: alloc_region is
> in static space
> (ash (sb-sys:sap-ref-word (sb-sys:int-sap
> sb-vm:static-space-start)
> (* 2 sb-vm:n-word-bytes))
> (- (1+ sb-vm:word-shift)))
> - #-(or x86 x86-64 ppc ppc64) ; old way: alloc_region is in C data
> + #-(or arm arm64 x86 x86-64 ppc ppc64) ; old way: alloc_region is
> in C data
> (ash (extern-alien "gc_alloc_region" unsigned-long)
> (- (1+ sb-vm:word-shift))))
> ;; threads imply gencgc. use the per-thread alloc region pointer
> diff --git a/src/compiler/arm/macros.lisp b/src/compiler/arm/macros.lisp
> index c50c2333d..c566519e0 100644
> --- a/src/compiler/arm/macros.lisp
> +++ b/src/compiler/arm/macros.lisp
> @@ -201,20 +201,20 @@
>
> #+gencgc
> (defun allocation-tramp (alloc-tn size back-label)
> - (let ((fixup (gen-label)))
> + (let ((boxed-region (- (+ static-space-start (* 2 n-word-bytes))
> + nil-value)))
> (when (integerp size)
> (load-immediate-word alloc-tn size))
> - (inst word (logior #xe92d0000
> + ;; Using the native stack is OK - the register values have fixnum
> nature.
> + (inst word (logior #xe92d0000 ; PUSH {rN, lr}
> (ash 1 (if (integerp size) (tn-offset alloc-tn)
> (tn-offset size)))
> (ash 1 (tn-offset lr-tn))))
> - (inst load-from-label alloc-tn alloc-tn fixup)
> + (inst ldr alloc-tn (@ null-tn (+ boxed-region (* 4 n-word-bytes))))
> (inst blx alloc-tn)
> - (inst word (logior #xe8bd0000
> + (inst word (logior #xe8bd0000 ; POP {rN, lr}
> (ash 1 (tn-offset alloc-tn))
> (ash 1 (tn-offset lr-tn))))
> - (inst b back-label)
> - (emit-label fixup)
> - (inst word (make-fixup "alloc_tramp" :foreign))))
> + (inst b back-label)))
>
> (defmacro allocation (result-tn size lowtag &key flag-tn
> stack-allocate-p)
> @@ -246,19 +246,18 @@
> (store-symbol-value ,flag-tn *allocation-pointer*))
> #+gencgc
> (t
> - (let ((fixup (gen-label))
> + (let ((boxed-region (- (+ static-space-start (* 2
> n-word-bytes))
> + nil-value))
> (alloc (gen-label))
> (back-from-alloc (gen-label)))
> - (inst load-from-label ,flag-tn ,flag-tn FIXUP)
> - (loadw ,result-tn ,flag-tn)
> - (loadw ,flag-tn ,flag-tn 1)
> + (inst ldr ,result-tn (@ null-tn boxed-region)) ; free ptr
> + (inst ldr ,flag-tn (@ null-tn (+ boxed-region
> n-word-bytes))) ; end ptr
> (if (integerp ,size)
> (composite-immediate-instruction add ,result-tn
> ,result-tn ,size)
> (inst add ,result-tn ,result-tn ,size))
> (inst cmp ,result-tn ,flag-tn)
> (inst b :hi ALLOC)
> - (inst load-from-label ,flag-tn ,flag-tn FIXUP)
> - (storew ,result-tn ,flag-tn)
> + (inst str ,result-tn (@ null-tn boxed-region)) ; free ptr
>
> (if (integerp ,size)
> (composite-immediate-instruction sub ,result-tn
> ,result-tn ,size)
> @@ -270,9 +269,7 @@
>
> (assemble (:elsewhere)
> (emit-label ALLOC)
> - (allocation-tramp ,result-tn ,size BACK-FROM-ALLOC)
> - (emit-label FIXUP)
> - (inst word (make-fixup "gc_alloc_region" :foreign))))))))
> + (allocation-tramp ,result-tn ,size BACK-FROM-ALLOC)))))))
>
> (defmacro with-fixed-allocation ((result-tn flag-tn type-code size
> &key (lowtag
> other-pointer-lowtag)
> diff --git a/src/runtime/Config.arm-linux b/src/runtime/Config.arm-linux
> index 2c2d271d8..2f72b244e 100644
> --- a/src/runtime/Config.arm-linux
> +++ b/src/runtime/Config.arm-linux
> @@ -12,11 +12,11 @@
> CFLAGS += -marm -march=armv5
> NM = ./linux-nm
>
> -ASSEM_SRC = arm-assem.S ldso-stubs.S
> +ASSEM_SRC = arm-assem.S
> ARCH_SRC = arm-arch.c
>
> OS_SRC = linux-os.c linux-mman.c arm-linux-os.c
> -OS_LIBS = -ldl
> +OS_LIBS = -ldl -Wl,-no-as-needed
>
> ifdef LISP_FEATURE_GENCGC
> GC_SRC = fullcgc.c gencgc.c traceroot.c
> @@ -33,6 +33,7 @@ endif
> ifdef LISP_FEATURE_LARGEFILE
> CFLAGS += -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
> -D_FILE_OFFSET_BITS=64
> endif
> +LINKFLAGS += -Wl,--export-dynamic
>
> # Nothing to do for after-grovel-headers.
> .PHONY: after-grovel-headers
> diff --git a/src/runtime/arm-assem.S b/src/runtime/arm-assem.S
> index 90b0682d8..22d682978 100644
> --- a/src/runtime/arm-assem.S
> +++ b/src/runtime/arm-assem.S
> @@ -328,6 +328,8 @@ alloc_tramp:
> add r6, r4, #8*4
> str r6, STATIC_SYMBOL_VALUE(CONTROL_STACK_POINTER)
>
> + @@ The following comment is misleading: GC won't need to see
> + @@ anything when we're pseudo-atomic.
> @@ Create a new frame and save descriptor regs on the stack
> @@ for the GC to see.
> str reg_CFP, [r4, #0]
> diff --git a/src/runtime/gencgc-private.h b/src/runtime/gencgc-private.h
> index 92677d386..bb7333830 100644
> --- a/src/runtime/gencgc-private.h
> +++ b/src/runtime/gencgc-private.h
> @@ -104,7 +104,7 @@ static inline enum prot_mode
> protection_mode(page_index_t page) {
> // FIXME: should be "#ifndef LISP_FEATURE_SB_THREAD" but not all platforms
> // have been converted to reference a 'struct alloc_region' in static
> space
> #if !defined LISP_FEATURE_SB_THREAD && \
> - (defined LISP_FEATURE_ARM64 \
> + (defined LISP_FEATURE_ARM||defined LISP_FEATURE_ARM64 \
> ||defined LISP_FEATURE_PPC||defined LISP_FEATURE_PPC64 \
> ||defined LISP_FEATURE_X86||defined LISP_FEATURE_X86_64)
> #define SINGLE_THREAD_BOXED_REGION (struct
> alloc_region*)(STATIC_SPACE_START + 2*N_WORD_BYTES)
> diff --git a/src/runtime/os-common.c b/src/runtime/os-common.c
> index 4eb596be1..9d8d1e44d 100644
> --- a/src/runtime/os-common.c
> +++ b/src/runtime/os-common.c
> @@ -189,6 +189,11 @@ void os_link_runtime()
>
> link_target += LINKAGE_TABLE_ENTRY_SIZE;
> }
> +#ifdef LISP_FEATURE_ARM
> + lispobj* static_space = (lispobj*)STATIC_SPACE_START;
> + extern uword_t alloc_tramp(uword_t);
> + static_space[6] = (lispobj)&alloc_tramp; // for LR rN, [NULL, #k] ;
> BLX rN
> +#endif
> #ifdef CALL_INTO_C
> extern long call_into_c();
> SYMBOL(CALL_INTO_C)->value = (lispobj)call_into_c;
> @@ -201,6 +206,8 @@ void os_unlink_runtime()
> #ifdef CALL_INTO_C
> SYMBOL(CALL_INTO_C)->value = UNBOUND_MARKER_WIDETAG;
> #endif
> + lispobj* static_space = (lispobj*)STATIC_SPACE_START;
> + static_space[6] = 0;
> }
>
> boolean
>
> -----------------------------------------------------------------------
>
>
> 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><div dir="auto">Should this be done during the freeze?</div></div><div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 27 Feb 2020 at 03:11 \
Douglas Katzman via Sbcl-commits <<a \
href="mailto:sbcl-commits@lists.sourceforge.net">sbcl-commits@lists.sourceforge.net</a>> \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex">The branch "master" has \
been updated in SBCL:<br> via ba94dfb8486b2e1d880e3aefefe53b6d2a5b4013 \
(commit)<br> from 8bdbbe69962ef1cb4db83129ef5637df7b4574ab (commit)<br>
<br>
- Log -----------------------------------------------------------------<br>
commit ba94dfb8486b2e1d880e3aefefe53b6d2a5b4013<br>
Author: Douglas Katzman <<a href="mailto:dougk@google.com" \
target="_blank">dougk@google.com</a>><br>
Date: Wed Feb 26 17:55:36 2020 -0500<br>
<br>
arm: implement and require :sb-dynamic-core<br>
---<br>
make-config.sh | 2 +-<br>
src/code/target-sxhash.lisp | 4 ++--<br>
src/compiler/arm/macros.lisp | 29 +++++++++++++----------------<br>
src/runtime/Config.arm-linux | 5 +++--<br>
src/runtime/arm-assem.S | 2 ++<br>
src/runtime/gencgc-private.h | 2 +-<br>
src/runtime/os-common.c | 7 +++++++<br>
7 files changed, 29 insertions(+), 22 deletions(-)<br>
<br>
diff --git a/make-config.sh b/make-config.sh<br>
index 1acfaed2e..5296d5809 100755<br>
--- a/make-config.sh<br>
+++ b/make-config.sh<br>
@@ -760,7 +760,7 @@ elif [ "$sbcl_arch" = "hppa" ]; then<br>
printf ' :stack-allocatable-vectors :stack-allocatable-fixed-objects' \
>> $ltf<br>
printf ' :stack-allocatable-closures :stack-allocatable-lists' \
>> $ltf<br> elif [ "$sbcl_arch" = "arm" ]; then<br>
- printf ' :gencgc :linkage-table :alien-callbacks' >> $ltf<br>
+ printf ' :gencgc :linkage-table :sb-dynamic-core :alien-callbacks' \
>> $ltf<br> # As opposed to soft-float or FPA, we support VFP only (and<br>
# possibly VFPv2 and higher only), but we'll leave the obvious<br>
# hooks in for someone to add the support later.<br>
diff --git a/src/code/target-sxhash.lisp b/src/code/target-sxhash.lisp<br>
index 8a84d9ebf..3e26febdb 100644<br>
--- a/src/code/target-sxhash.lisp<br>
+++ b/src/code/target-sxhash.lisp<br>
@@ -89,11 +89,11 @@<br>
;; dynamic-space-free-pointer increments only when a page is full.<br>
;; Using boxed_region directly is finer-grained.<br>
#+(and (not sb-thread) gencgc)<br>
- (progn #+(or x86 x86-64 ppc ppc64) ; new way: alloc_region is in static space<br>
+ (progn #+(or arm arm64 x86 x86-64 ppc ppc64) ; new way: alloc_region is in static \
space<br>
(ash (sb-sys:sap-ref-word (sb-sys:int-sap \
sb-vm:static-space-start)<br>
(* 2 sb-vm:n-word-bytes))<br>
(- (1+ sb-vm:word-shift)))<br>
- #-(or x86 x86-64 ppc ppc64) ; old way: alloc_region is in C data<br>
+ #-(or arm arm64 x86 x86-64 ppc ppc64) ; old way: alloc_region is in C \
data<br>
(ash (extern-alien "gc_alloc_region" unsigned-long)<br>
(- (1+ sb-vm:word-shift))))<br>
;; threads imply gencgc. use the per-thread alloc region pointer<br>
diff --git a/src/compiler/arm/macros.lisp b/src/compiler/arm/macros.lisp<br>
index c50c2333d..c566519e0 100644<br>
--- a/src/compiler/arm/macros.lisp<br>
+++ b/src/compiler/arm/macros.lisp<br>
@@ -201,20 +201,20 @@<br>
<br>
#+gencgc<br>
(defun allocation-tramp (alloc-tn size back-label)<br>
- (let ((fixup (gen-label)))<br>
+ (let ((boxed-region (- (+ static-space-start (* 2 n-word-bytes))<br>
+ nil-value)))<br>
(when (integerp size)<br>
(load-immediate-word alloc-tn size))<br>
- (inst word (logior #xe92d0000<br>
+ ;; Using the native stack is OK - the register values have fixnum nature.<br>
+ (inst word (logior #xe92d0000 ; PUSH {rN, lr}<br>
(ash 1 (if (integerp size) (tn-offset alloc-tn) \
(tn-offset size)))<br> (ash 1 (tn-offset lr-tn))))<br>
- (inst load-from-label alloc-tn alloc-tn fixup)<br>
+ (inst ldr alloc-tn (@ null-tn (+ boxed-region (* 4 n-word-bytes))))<br>
(inst blx alloc-tn)<br>
- (inst word (logior #xe8bd0000<br>
+ (inst word (logior #xe8bd0000 ; POP {rN, lr}<br>
(ash 1 (tn-offset alloc-tn))<br>
(ash 1 (tn-offset lr-tn))))<br>
- (inst b back-label)<br>
- (emit-label fixup)<br>
- (inst word (make-fixup "alloc_tramp" :foreign))))<br>
+ (inst b back-label)))<br>
<br>
(defmacro allocation (result-tn size lowtag &key flag-tn<br>
\
stack-allocate-p)<br> @@ -246,19 +246,18 @@<br>
(store-symbol-value ,flag-tn *allocation-pointer*))<br>
#+gencgc<br>
(t<br>
- (let ((fixup (gen-label))<br>
+ (let ((boxed-region (- (+ static-space-start (* 2 \
n-word-bytes))<br> + \
nil-value))<br> (alloc (gen-label))<br>
(back-from-alloc (gen-label)))<br>
- (inst load-from-label ,flag-tn ,flag-tn FIXUP)<br>
- (loadw ,result-tn ,flag-tn)<br>
- (loadw ,flag-tn ,flag-tn 1)<br>
+ (inst ldr ,result-tn (@ null-tn boxed-region)) ; free ptr<br>
+ (inst ldr ,flag-tn (@ null-tn (+ boxed-region n-word-bytes))) ; \
end ptr<br> (if (integerp ,size)<br>
(composite-immediate-instruction add ,result-tn \
,result-tn ,size)<br> (inst add ,result-tn ,result-tn ,size))<br>
(inst cmp ,result-tn ,flag-tn)<br>
(inst b :hi ALLOC)<br>
- (inst load-from-label ,flag-tn ,flag-tn FIXUP)<br>
- (storew ,result-tn ,flag-tn)<br>
+ (inst str ,result-tn (@ null-tn boxed-region)) ; free ptr<br>
<br>
(if (integerp ,size)<br>
(composite-immediate-instruction sub ,result-tn \
,result-tn ,size)<br> @@ -270,9 +269,7 @@<br>
<br>
(assemble (:elsewhere)<br>
(emit-label ALLOC)<br>
- (allocation-tramp ,result-tn ,size BACK-FROM-ALLOC)<br>
- (emit-label FIXUP)<br>
- (inst word (make-fixup "gc_alloc_region" \
:foreign))))))))<br> + (allocation-tramp ,result-tn ,size \
BACK-FROM-ALLOC)))))))<br> <br>
(defmacro with-fixed-allocation ((result-tn flag-tn type-code size<br>
&key (lowtag \
other-pointer-lowtag)<br>
diff --git a/src/runtime/Config.arm-linux b/src/runtime/Config.arm-linux<br>
index 2c2d271d8..2f72b244e 100644<br>
--- a/src/runtime/Config.arm-linux<br>
+++ b/src/runtime/Config.arm-linux<br>
@@ -12,11 +12,11 @@<br>
CFLAGS += -marm -march=armv5<br>
NM = ./linux-nm<br>
<br>
-ASSEM_SRC = arm-assem.S ldso-stubs.S<br>
+ASSEM_SRC = arm-assem.S<br>
ARCH_SRC = arm-arch.c<br>
<br>
OS_SRC = linux-os.c linux-mman.c arm-linux-os.c<br>
-OS_LIBS = -ldl<br>
+OS_LIBS = -ldl -Wl,-no-as-needed<br>
<br>
ifdef LISP_FEATURE_GENCGC<br>
GC_SRC = fullcgc.c gencgc.c traceroot.c<br>
@@ -33,6 +33,7 @@ endif<br>
ifdef LISP_FEATURE_LARGEFILE<br>
CFLAGS += -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64<br>
endif<br>
+LINKFLAGS += -Wl,--export-dynamic<br>
<br>
# Nothing to do for after-grovel-headers.<br>
.PHONY: after-grovel-headers<br>
diff --git a/src/runtime/arm-assem.S b/src/runtime/arm-assem.S<br>
index 90b0682d8..22d682978 100644<br>
--- a/src/runtime/arm-assem.S<br>
+++ b/src/runtime/arm-assem.S<br>
@@ -328,6 +328,8 @@ alloc_tramp:<br>
add r6, r4, #8*4<br>
str r6, STATIC_SYMBOL_VALUE(CONTROL_STACK_POINTER)<br>
<br>
+ @@ The following comment is misleading: GC won't need to see<br>
+ @@ anything when we're pseudo-atomic.<br>
@@ Create a new frame and save descriptor regs on the stack<br>
@@ for the GC to see.<br>
str reg_CFP, [r4, #0]<br>
diff --git a/src/runtime/gencgc-private.h b/src/runtime/gencgc-private.h<br>
index 92677d386..bb7333830 100644<br>
--- a/src/runtime/gencgc-private.h<br>
+++ b/src/runtime/gencgc-private.h<br>
@@ -104,7 +104,7 @@ static inline enum prot_mode protection_mode(page_index_t page) \
{<br> // FIXME: should be "#ifndef LISP_FEATURE_SB_THREAD" but not all \
platforms<br> // have been converted to reference a 'struct alloc_region' in \
static space<br> #if !defined LISP_FEATURE_SB_THREAD && \<br>
- (defined LISP_FEATURE_ARM64 \<br>
+ (defined LISP_FEATURE_ARM||defined LISP_FEATURE_ARM64 \<br>
||defined LISP_FEATURE_PPC||defined LISP_FEATURE_PPC64 \<br>
||defined LISP_FEATURE_X86||defined LISP_FEATURE_X86_64)<br>
#define SINGLE_THREAD_BOXED_REGION (struct alloc_region*)(STATIC_SPACE_START + \
2*N_WORD_BYTES)<br>
diff --git a/src/runtime/os-common.c b/src/runtime/os-common.c<br>
index 4eb596be1..9d8d1e44d 100644<br>
--- a/src/runtime/os-common.c<br>
+++ b/src/runtime/os-common.c<br>
@@ -189,6 +189,11 @@ void os_link_runtime()<br>
<br>
link_target += LINKAGE_TABLE_ENTRY_SIZE;<br>
}<br>
+#ifdef LISP_FEATURE_ARM<br>
+ lispobj* static_space = (lispobj*)STATIC_SPACE_START;<br>
+ extern uword_t alloc_tramp(uword_t);<br>
+ static_space[6] = (lispobj)&alloc_tramp; // for LR rN, [NULL, #k] ; BLX \
rN<br> +#endif<br>
#ifdef CALL_INTO_C<br>
extern long call_into_c();<br>
SYMBOL(CALL_INTO_C)->value = (lispobj)call_into_c;<br>
@@ -201,6 +206,8 @@ void os_unlink_runtime()<br>
#ifdef CALL_INTO_C<br>
SYMBOL(CALL_INTO_C)->value = UNBOUND_MARKER_WIDETAG;<br>
#endif<br>
+ lispobj* static_space = (lispobj*)STATIC_SPACE_START;<br>
+ static_space[6] = 0;<br>
}<br>
<br>
boolean<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></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