(thanks to Anton Kovalenko).
* enhancement: more, and more correct, SSE instruction definitions on
x86-64 (thanks to Alexander Gavrilov).
+ * enhancement: SB-EXT:SPIN-LOOP-HINT assembles to an instruction designed
+ to help the processor execute spin loops, when applicable. Currently
+ implemented for x86 and x86-64.
* optimization: unsigned integer divisions by a constant are implemented
using multiplication (affects CEILING, FLOOR, TRUNCATE, MOD, and REM.)
* optimization: improved type-derivation for LOAD-TIME-VALUE.
"WORD"
"MOST-POSITIVE-WORD"
+ ;; Not an atomic operation, but should be used with them
+ "SPIN-LOOP-HINT"
+
;; Time related things
"CALL-WITH-TIMING"
"GET-TIME-OF-DAY"
(type sb!vm:signed-word diff))
(%array-atomic-incf/word array index diff))
+(defun spin-loop-hint ()
+ #!+sb-doc
+ "Hints the processor that the current thread is spin-looping."
+ (spin-loop-hint))
+
(defun call-hooks (kind hooks &key (on-error :error))
(dolist (hook hooks)
(handler-case
(inst ldl count offset count-vector)
(inst addq count 1 count)
(inst stl count offset count-vector))))
+
+;;;; Dummy definition for a spin-loop hint VOP
+(define-vop (spin-loop-hint)
+ (:translate spin-loop-hint)
+ (:policy :fast-safe)
+ (:generator 0))
(unsafe))
(defknown %compare-and-swap-symbol-value (symbol t t) t
(unsafe unwind))
+(defknown spin-loop-hint () (values)
+ (always-translatable))
(inst addi 1 count count)
(inst stw count offset count-vector))))
+;;;; Dummy definition for a spin-loop hint VOP
+(define-vop (spin-loop-hint)
+ (:translate spin-loop-hint)
+ (:policy :fast-safe)
+ (:generator 0))
(inst nop)
(inst addu count 1)
(inst sw count count-vector offset))))
+
+;;;; Dummy definition for a spin-loop hint VOP
+(define-vop (spin-loop-hint)
+ (:translate spin-loop-hint)
+ (:policy :fast-safe)
+ (:generator 0))
(:policy :fast-safe)
(:translate %data-dependency-barrier)
(:generator 3))
+
+;;;; Dummy definition for a spin-loop hint VOP
+(define-vop (spin-loop-hint)
+ (:translate spin-loop-hint)
+ (:policy :fast-safe)
+ (:generator 0))
(inst ld count count-vector offset)
(inst add count 1)
(inst st count count-vector offset))))
+
+;;;; Dummy definition for a spin-loop hint VOP
+(define-vop (spin-loop-hint)
+ (:translate spin-loop-hint)
+ (:policy :fast-safe)
+ (:generator 0))
(:policy :fast-safe)
(:translate %data-dependency-barrier)
(:generator 3))
+
+(define-vop (pause)
+ (:translate spin-loop-hint)
+ (:policy :fast-safe)
+ (:generator 0
+ (inst pause)))
(emit-byte segment (if (eq size :byte) #b10110000 #b10110001))
(emit-ea segment dst (reg-tn-encoding src)))))
+(define-instruction pause (segment)
+ (:printer two-bytes ((op '(#xf3 #x90))))
+ (:emitter
+ (emit-byte segment #xf3)
+ (emit-byte segment #x90)))
\f
(defun emit-prefix (segment name)
(ecase name
(:policy :fast-safe)
(:translate %data-dependency-barrier)
(:generator 3))
+
+(define-vop (pause)
+ (:translate spin-loop-hint)
+ (:policy :fast-safe)
+ (:generator 0
+ (inst pause)))