Skip to content

Commit

Permalink
disabled :trivial memory barriers - they were not really used
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmos72 committed Apr 25, 2015
1 parent 17843fc commit 3198388
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions lang/features-detect.lisp
Expand Up @@ -24,7 +24,6 @@ STMX is currently tested only on ABCL, CCL, CLISP, CMUCL, ECL and SBCL.")
;; unknown system - for safety, disable even features
;; enabled by default on known systems
(set-features '(bt/with-lock nil)
'(mem-rw-barriers nil)
'(define-constant-once nil))


Expand Down Expand Up @@ -58,9 +57,7 @@ STMX is currently tested only on ABCL, CCL, CLISP, CMUCL, ECL and SBCL.")

#+lispworks ;; incomplete porting
(set-features '(tclass-options ((:optimize-slot-access nil)))
'(bt/lock-owner mp:lock-owner)
#+(or x86 x8664 x86-64 x86_64)
'(mem-rw-barriers :trivial))
'(bt/lock-owner mp:lock-owner))

#+abcl
(set-features '(bt/lock-owner :abcl)
Expand All @@ -71,8 +68,9 @@ STMX is currently tested only on ABCL, CCL, CLISP, CMUCL, ECL and SBCL.")

#+ccl
(set-features '(bt/lock-owner ccl::%%lock-owner)
#+x86 '(mem-rw-barriers nil) ;; causes "bogus object" errors.
;; trivial mem barriers cause "bogus object" errors.
'(define-constant-once nil) ;; causes deadlocks
#?+(symbol ccl defstatic) '(define-global ccl:defstatic)
'use-initialize-instance-before
'closer-mop/works-on-structs
'(sxhash-equalp ccl::%%equalphash))
Expand All @@ -82,7 +80,6 @@ STMX is currently tested only on ABCL, CCL, CLISP, CMUCL, ECL and SBCL.")
;; thus STMX compiles in single-thread mode, without using bt/with-lock and mem-rw-barriers.
;; On the other hand, define-constant-once and use-initialize-instance-before work.
(set-features '(bt/with-lock nil)
'(mem-rw-barriers nil)
'use-initialize-instance-before
'closer-mop/works-on-structs
;; on CLISP, SXHASH can be used for SXHASH-EQUALP,
Expand All @@ -94,9 +91,6 @@ STMX is currently tested only on ABCL, CCL, CLISP, CMUCL, ECL and SBCL.")

#+cmucl
(set-features '(bt/lock-owner mp::lock-process)
;; do NOT use :trivial memory barriers: they are very fragile,
;; even if running with the command-line options "-fpu" "x87"
'(mem-rw-barriers nil)
'closer-mop/works-on-structs
'(sxhash-equalp (lisp::internal-equalp-hash * 0)))

Expand All @@ -105,15 +99,14 @@ STMX is currently tested only on ABCL, CCL, CLISP, CMUCL, ECL and SBCL.")
;; as of 2015-02-07, latest ECL from git://git.code.sf.net/p/ecls/ecl seems to fix them
(set-features '(bt/lock-owner mp::lock-owner)
'(bt/with-lock nil) ;; bugged?
'(mem-rw-barriers nil) ;; bugged?
'(define-constant-once nil) ;; bugged?
'use-initialize-instance-before
'closer-mop/works-on-structs
'(sxhash-equalp si:hash-equalp))

#+sbcl
(set-features #+compare-and-swap-vops '(atomic-ops :sbcl)
#+memory-barrier-vops '(mem-rw-barriers :sbcl)
#+memory-barrier-vops '(mem-rw-barriers :sbcl)

;; usually, bt/lock-owner it not needed on SBCL: the combo
;; ATOMIC-OPS + MEM-RW-BARRIERS provides FAST-MUTEX, which implements
Expand Down Expand Up @@ -185,10 +178,12 @@ STMX is currently tested only on ABCL, CCL, CLISP, CMUCL, ECL and SBCL.")
;; Summarizing, for most Lisp compilers (ECL being a notable exception)
;; 'mem-rw-barriers feature can be set to :trivial on x86 and x86-64
;; (unless a better implementation is available, obviously)
;;
;; For safety, we let each implementation decide whether to set
;; '(mem-rw-barriers :trivial) on x86 and x86-64


#+(or x86 x8664 x86-64 x86_64)
(default-feature 'mem-rw-barriers :trivial)
(default-feature 'mem-rw-barriers nil)


;; FAST-MUTEX requires atomic compare-and-swap plus *real* memory barriers.
Expand Down

0 comments on commit 3198388

Please sign in to comment.