From: Paul Eggert Date: Thu, 30 Jul 2020 16:22:01 +0000 (-0700) Subject: Port to Oracle Studio 12.6 (sparc) X-Git-Tag: emacs-28.0.90~6891 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=88b4516cf8c3ff39803430452b8adbb86a73642a;p=emacs.git Port to Oracle Studio 12.6 (sparc) * src/alloc.c (__builtin_unwind_init) [!HAVE___BUILTIN_UNWIND_INIT]: Move from here ... * src/lisp.h: ... to here, since flush_stack_call_func uses it. * src/pdumper.c (dump_off_from_lisp): Avoid ‘return n;;’ to pacify Oracle Studio. --- diff --git a/src/alloc.c b/src/alloc.c index ed30c449785..76bb20876b0 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -4966,27 +4966,6 @@ typedef union #endif } stacktop_sentry; -/* Force callee-saved registers and register windows onto the stack. - Use the platform-defined __builtin_unwind_init if available, - obviating the need for machine dependent methods. */ -#ifndef HAVE___BUILTIN_UNWIND_INIT -# ifdef __sparc__ - /* This trick flushes the register windows so that all the state of - the process is contained in the stack. - FreeBSD does not have a ta 3 handler, so handle it specially. - FIXME: Code in the Boehm GC suggests flushing (with 'flushrs') is - needed on ia64 too. See mach_dep.c, where it also says inline - assembler doesn't work with relevant proprietary compilers. */ -# if defined __sparc64__ && defined __FreeBSD__ -# define __builtin_unwind_init() asm ("flushw") -# else -# define __builtin_unwind_init() asm ("ta 3") -# endif -# else -# define __builtin_unwind_init() ((void) 0) -# endif -#endif - /* Yield an address close enough to the top of the stack that the garbage collector need not scan above it. Callers should be declared NO_INLINE. */ @@ -5022,16 +5001,14 @@ typedef union We have to mark Lisp objects in CPU registers that can hold local variables or are used to pass parameters. - This code assumes that calling setjmp saves registers we need + If __builtin_unwind_init is available, it should suffice to save + registers. + + Otherwise, assume that calling setjmp saves registers we need to see in a jmp_buf which itself lies on the stack. This doesn't have to be true! It must be verified for each system, possibly by taking a look at the source code of setjmp. - If __builtin_unwind_init is available (defined by GCC >= 2.8) we - can use it as a machine independent method to store all registers - to the stack. In this case the macros described in the previous - two paragraphs are not used. - Stack Layout Architectures differ in the way their processor stack is organized. diff --git a/src/lisp.h b/src/lisp.h index 7b4f484b9b7..fdf69ab7368 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3811,6 +3811,25 @@ extern void mark_maybe_objects (Lisp_Object const *, ptrdiff_t); extern void mark_stack (char const *, char const *); extern void flush_stack_call_func1 (void (*func) (void *arg), void *arg); +/* Force callee-saved registers and register windows onto the stack, + so that conservative garbage collection can see their values. */ +#ifndef HAVE___BUILTIN_UNWIND_INIT +# ifdef __sparc__ + /* This trick flushes the register windows so that all the state of + the process is contained in the stack. + FreeBSD does not have a ta 3 handler, so handle it specially. + FIXME: Code in the Boehm GC suggests flushing (with 'flushrs') is + needed on ia64 too. See mach_dep.c, where it also says inline + assembler doesn't work with relevant proprietary compilers. */ +# if defined __sparc64__ && defined __FreeBSD__ +# define __builtin_unwind_init() asm ("flushw") +# else +# define __builtin_unwind_init() asm ("ta 3") +# endif +# else +# define __builtin_unwind_init() ((void) 0) +# endif +#endif INLINE void flush_stack_call_func (void (*func) (void *arg), void *arg) { diff --git a/src/pdumper.c b/src/pdumper.c index 7f6876666be..865ceff6fff 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -747,8 +747,9 @@ dump_off_from_lisp (Lisp_Object value) intmax_t n = intmax_t_from_lisp (value); eassert (DUMP_OFF_MIN <= n && n <= DUMP_OFF_MAX); ALLOW_IMPLICIT_CONVERSION; - return n; + dump_off converted = n; DISALLOW_IMPLICIT_CONVERSION; + return converted; } static Lisp_Object