From a499f2c9099d1dc2cb4227a2505eb4cc6f310e24 Mon Sep 17 00:00:00 2001 From: Juho Snellman Date: Thu, 26 Jan 2006 21:51:31 +0000 Subject: [PATCH] 0.9.9.1: Use an opt-in strategy for SSE. By default use the base version of fast_bzero unconditionally. The cpuid-based detection is only enabled when we have reason to believe that the operating system supports SSE. Patch by NIIMI Satoshi. --- src/runtime/bsd-os.c | 10 ++++------ src/runtime/linux-os.c | 4 ++++ src/runtime/x86-arch.h | 3 +++ src/runtime/x86-assem.S | 6 +++--- version.lisp-expr | 2 +- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/runtime/bsd-os.c b/src/runtime/bsd-os.c index 2c84a10..0bd5fc9 100644 --- a/src/runtime/bsd-os.c +++ b/src/runtime/bsd-os.c @@ -299,16 +299,14 @@ static void freebsd_init() * x86-assem.S. */ #ifdef LISP_FEATURE_X86 - extern void fast_bzero_base(void *, size_t); - extern void (*fast_bzero_pointer)(void *, size_t); size_t len; int instruction_sse; len = sizeof(instruction_sse); - if (sysctlbyname("hw.instruction_sse", &instruction_sse, &len, NULL, 0) != 0 - || instruction_sse == 0) { - /* Use the non-SSE version*/ - fast_bzero_pointer = fast_bzero_base; + if (sysctlbyname("hw.instruction_sse", &instruction_sse, &len, NULL, 0) == 0 + && instruction_sse != 0) { + /* Use the SSE detector */ + fast_bzero_pointer = fast_bzero_detect; } #endif /* LISP_FEATURE_X86 */ } diff --git a/src/runtime/linux-os.c b/src/runtime/linux-os.c index 778f72c..2b1dd25 100644 --- a/src/runtime/linux-os.c +++ b/src/runtime/linux-os.c @@ -208,6 +208,10 @@ os_init(char *argv[], char *envp[]) fprintf(stderr, "WARNING: Couldn't re-execute SBCL with the proper personality flags (maybe /proc isn't mounted?). Trying to continue anyway.\n"); } } + /* Use SSE detector. Recent versions of Linux enable SSE support + * on SSE capable CPUs. */ + /* FIXME: Are there any old versions that does not support SSE? */ + fast_bzero_pointer = fast_bzero_detect; #endif } diff --git a/src/runtime/x86-arch.h b/src/runtime/x86-arch.h index f8174c2..7fe1aa0 100644 --- a/src/runtime/x86-arch.h +++ b/src/runtime/x86-arch.h @@ -56,4 +56,7 @@ swap_lispobjs(volatile lispobj *dest, lispobj value) return old_value; } +extern void fast_bzero_detect(void *, size_t); +extern void (*fast_bzero_pointer)(void *, size_t); + #endif /* _X86_ARCH_H */ diff --git a/src/runtime/x86-assem.S b/src/runtime/x86-assem.S index cae77e3..2069f96 100644 --- a/src/runtime/x86-assem.S +++ b/src/runtime/x86-assem.S @@ -868,9 +868,9 @@ GNAME(exception_trampoline): .align 4 GNAME(fast_bzero_pointer): /* Variable containing a pointer to the bzero function to use. - * Initially points to a function that detects which implementation - * should be used, and then updates the variable. */ - .long GNAME(fast_bzero_detect) + * Initially points to a basic function. Change this variable + * to fast_bzero_detect if OS supports SSE. */ + .long GNAME(fast_bzero_base) .text .align align_8byte,0x90 diff --git a/version.lisp-expr b/version.lisp-expr index 110602a..937d404 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.9.9" +"0.9.9.1" -- 1.7.10.4