From ca11b53896365c948426974cb90e8f71c70d123b Mon Sep 17 00:00:00 2001 From: Simon South Date: Sun, 31 May 2020 20:36:43 -0400 Subject: [PATCH] Guard floating-point opcodes with explicit memory barrier --- src/interp/engine/interp-inlining.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/interp/engine/interp-inlining.h b/src/interp/engine/interp-inlining.h index 3339b0e..4ee5c5a 100644 --- a/src/interp/engine/interp-inlining.h +++ b/src/interp/engine/interp-inlining.h @@ -78,8 +78,17 @@ 4.3, we need to insert a label, and ensure its address is taken (to stop it being optimised out). However, this reduces performance on PowerPC by approx 1 - 2%. + + With gcc 5 and newer an asm statement with a "memory" + clobber argument explicitly sets a memory barrier for the + compiler, preventing it from reordering memory accesses + in a way that breaks decaching. */ -#if (__GNUC__ == 4) && (__GNUC_MINOR__ >= 3) +#if (__GNUC__ > 4) +#define DEF_GUARD_TABLE(level) /* none */ +#define GUARD(opcode, level) __asm__("" ::: "memory"); +#define GUARD_TBLS /* none */ +#elif (__GNUC__ == 4) && (__GNUC_MINOR__ >= 3) #define DEF_GUARD_TABLE(level) DEF_HANDLER_TABLE(level, GUARD) #define GUARD(opcode, level) label(opcode, level, GUARD) #define GUARD_TBLS , HNDLR_TBLS(GUARD) -- 2.26.2 >
#!@abs_top_builddir@/guile \
--no-auto-compile -e main -s
!#
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2018 Mathieu Lirzin <mthl@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

;; IMPORTANT: We must avoid loading any modules from Guix here,
;; because we need to adjust the guile load paths first.
;; It's okay to import modules from core Guile though.

(define-syntax-rule (push! elt v) (set! v (cons elt v)))

(define (augment-load-paths!)
  ;; Add installed modules to load-path.
  (push! "@guilemoduledir@" %load-path)
  (push! "@guileobjectdir@" %load-compiled-path))

(define* (main #:optional (args (command-line)))
  (unless (getenv "GUIX_UNINSTALLED")
    (augment-load-paths!))

  (let ((guix-main (module-ref (resolve-interface '(guix ui))
                               'guix-main)))
    (bindtextdomain "guix" "@localedir@")
    (bindtextdomain "guix-packages" "@localedir@")
    ;; XXX: It would be more convenient to change it to:
    ;;   (exit (apply guix-main (command-line)))
    ;; but since the 'guix' command is not updated by 'guix pull', we cannot
    ;; really do it now.
    (apply guix-main args)))

;;; Local Variables:
;;; mode: scheme
;;; End: