diff --git a/pkgs/base/info.rkt b/pkgs/base/info.rkt index 3297b055ed..6db7f20905 100644 --- a/pkgs/base/info.rkt +++ b/pkgs/base/info.rkt @@ -12,7 +12,7 @@ (define collection 'multi) -(define version "7.6.0.1") +(define version "7.6.0.2") (define deps `("racket-lib" ["racket" #:version ,version])) diff --git a/pkgs/racket-benchmarks/tests/racket/benchmarks/hash/set.rkt b/pkgs/racket-benchmarks/tests/racket/benchmarks/hash/set.rkt index 1781513861..442b5b75fa 100644 --- a/pkgs/racket-benchmarks/tests/racket/benchmarks/hash/set.rkt +++ b/pkgs/racket-benchmarks/tests/racket/benchmarks/hash/set.rkt @@ -19,7 +19,7 @@ (loop (hash-set ht KEY (MAKE-VAL 'true)) (sub1 i))))) - 'set-many + 'set-many-in-order (times (for ([i (in-range Q)]) (let loop ([ht EMPTY] [i K]) @@ -28,7 +28,7 @@ (loop (hash-set ht (MAKE-KEY i) (MAKE-VAL 'true)) (sub1 i)))))) - 'set-many-in-order + 'set-many (times (for ([i (in-range Q)]) (let loop ([ht EMPTY] [l shuffled]) diff --git a/racket/src/cs/compile-file.ss b/racket/src/cs/compile-file.ss index 3358209602..38ad9e28f6 100644 --- a/racket/src/cs/compile-file.ss +++ b/racket/src/cs/compile-file.ss @@ -2,7 +2,7 @@ ;; Check to make we're using a build of Chez Scheme ;; that has all the features we need. (define-values (need-maj need-min need-sub need-dev) - (values 9 5 3 10)) + (values 9 5 3 11)) (unless (guard (x [else #f]) (eval 'scheme-fork-version-number)) (error 'compile-file diff --git a/racket/src/cs/rumble/hamt-stencil.ss b/racket/src/cs/rumble/hamt-stencil.ss index be56e7fb3e..e916f145a5 100644 --- a/racket/src/cs/rumble/hamt-stencil.ss +++ b/racket/src/cs/rumble/hamt-stencil.ss @@ -174,8 +174,9 @@ [val-i (fx- i child-count)]) ; same as key index (bnode-val-local-index-ref n child-count key-count val-i))] [else - ;; Complicated case: we have to figure out how many - ;; previous keys have values + ;; Complicated case that we expect to be rare: figure out how many + ;; previous keys have values, since we don't know how the key/value + ;; index maps to a key/value bit (let* ([child-count (hamt-mask->child-count mask)] [key-count (hamt-mask->key-count mask)] [key-i (fx- i child-count)]) @@ -561,7 +562,10 @@ ;; ---------------------------------------- ;; unsafe iteration; position is a stack -;; represented by a list of (cons node index) +;; of the form +;; - '() +;; - (cons indent (cons node stack)) +;; - (cons (box assoc-list) stack) (define (unsafe-intmap-iterate-first h) (and (not (intmap-empty? h)) @@ -573,12 +577,12 @@ (let ([mask (stencil-vector-mask n)]) (let ([child-count (hamt-mask->child-count mask)] [key-count (hamt-mask->key-count mask)]) - (let ([stack (cons (cons n (fx+ key-count child-count -1)) stack)]) + (let ([stack (cons (fx+ key-count child-count -1) (cons n stack))]) (if (fx= key-count 0) (unsafe-node-iterate-first (bnode-child-index-ref n (fx- child-count 1)) stack) stack))))] [(cnode? n) - (cons (box (cnode-content n)) + (cons (#%box (cnode-content n)) stack)])) (define (unsafe-intmap-iterate-next h pos) @@ -590,32 +594,31 @@ ;; Stack is empty, so we're done #f] [else - (let ([p (car pos)] + (let ([i (car pos)] [stack (cdr pos)]) (cond - [(box? p) - ;; in a cnode - (let ([new-p (cdr (unbox p))]) - (if (null? new-p) - ;; Exhausted this node, so return to parent node - (unsafe-node-iterate-next stack) - ;; still in cnode: - (cons (box new-p) stack)))] - [else - (let ([n (car p)] - [i (cdr p)]) + [(fixnum? i) + (let ([n (car stack)]) (cond [(fx= 0 i) ;; Exhausted this node, so return to parent node - (unsafe-node-iterate-next stack)] + (unsafe-node-iterate-next (cdr stack))] [else ;; Move to next (lower) index in the current node (let ([i (fx1- i)]) (let ([child-count (hamt-mask->child-count (stencil-vector-mask n))] - [stack (cons (cons n i) stack)]) + [stack (cons i stack)]) (if (fx< i child-count) (unsafe-node-iterate-first (bnode-child-index-ref n i) stack) - stack)))]))]))])) + stack)))]))] + [else + ;; in a cnode + (let ([new-p (cdr (#%unbox i))]) + (if (null? new-p) + ;; Exhausted this node, so return to parent node + (unsafe-node-iterate-next stack) + ;; still in cnode: + (cons (#%box new-p) stack)))]))])) (define (unsafe-intmap-iterate-key h pos) (eqtype-dispatch @@ -924,84 +927,83 @@ (define (bnode-entry-at-position n pos mode fail) (let* ([mask (stencil-vector-mask n)] - [child-count (hamt-mask->child-count mask)]) - (let loop ([i 0] [pos pos]) - (cond - [(fx= i child-count) - (let ([key-count (hamt-mask->key-count mask)]) - (cond - [(fx< pos key-count) - (let ([get-key (lambda () (hamt-unwrap-key (bnode-key-index-ref n (fx+ pos child-count))))] - [get-value (lambda () (bnode-val-index-ref n (fx+ pos child-count)))]) - (case mode - [(key) (get-key)] - [(val) (get-value)] - [(both) (values (get-key) (get-value))] - [else (cons (get-key) (get-value))]))] - [else fail]))] - [else - (let ([c (bnode-child-index-ref n i)]) - (cond - [(bnode? c) - (let ([sz (hamt-count c)]) - (if (fx>= pos sz) - (loop (fx+ i 1) (fx- pos sz)) - (bnode-entry-at-position c pos mode fail)))] - [else - (let* ([alist (cnode-content c)] - [len (length alist)]) - (if (fx>= pos len) - (loop (fx+ i 1) (fx- pos len)) - (let ([p (list-ref alist pos)]) - (case mode - [(key) (car p)] - [(val) (cdr p)] - [(both) (values (car p) (cdr p))] - [else p]))))]))])))) + [child-count (hamt-mask->child-count mask)] + [key-count (hamt-mask->key-count mask)]) + (cond + [(fx< pos key-count) + (let ([get-key (lambda () (hamt-unwrap-key (bnode-key-index-ref n (fx+ pos child-count))))] + [get-value (lambda () (bnode-val-index-ref n (fx+ pos child-count)))]) + (case mode + [(key) (get-key)] + [(val) (get-value)] + [(both) (values (get-key) (get-value))] + [else (cons (get-key) (get-value))]))] + [else + (let loop ([i 0] [pos (fx- pos key-count)]) + (cond + [(fx= i child-count) + fail] + [else + (let ([c (bnode-child-index-ref n i)]) + (cond + [(bnode? c) + (let ([sz (hamt-count c)]) + (if (fx>= pos sz) + (loop (fx+ i 1) (fx- pos sz)) + (bnode-entry-at-position c pos mode fail)))] + [else + (let* ([alist (cnode-content c)] + [len (length alist)]) + (if (fx>= pos len) + (loop (fx+ i 1) (fx- pos len)) + (let ([p (list-ref alist pos)]) + (case mode + [(key) (car p)] + [(val) (cdr p)] + [(both) (values (car p) (cdr p))] + [else p]))))]))]))]))) (define (bnode-unsafe-intmap-iterate-key pos) - (let ([p (car pos)]) + (let ([i (car pos)]) (cond - [(box? p) - ;; in a cnode - (caar (unbox p))] + [(fixnum? i) + (let ([h (cadr pos)]) + (hamt-unwrap-key (bnode-key-index-ref h i)))] [else - (let ([h (car p)]) - (hamt-unwrap-key (bnode-key-index-ref h (cdr p))))]))) + ;; in a cnode + (caar (#%unbox i))]))) (define (bnode-unsafe-intmap-iterate-value pos) - (let ([p (car pos)]) + (let ([i (car pos)]) (cond - [(box? p) - ;; in a cnode - (cdar (unbox p))] + [(fixnum? i) + (bnode-val-index-ref (cadr pos) i)] [else - (bnode-val-index-ref (car p) (cdr p))]))) + ;; in a cnode + (cdar (#%unbox i))]))) (define (bnode-unsafe-intmap-iterate-key+value pos) - (let ([p (car pos)]) + (let ([i (car pos)]) (cond - [(box? p) - ;; in a cnode - (let ([pr (car (unbox p))]) - (values (car pr) (cdr pr)))] - [else - (let ([n (car p)] - [i (cdr p)]) + [(fixnum? i) + (let ([n (cadr pos)]) (values (hamt-unwrap-key (bnode-key-index-ref n i)) - (bnode-val-index-ref n i)))]))) + (bnode-val-index-ref n i)))] + [else + ;; in a cnode + (let ([pr (car (#%unbox i))]) + (values (car pr) (cdr pr)))]))) (define (bnode-unsafe-intmap-iterate-pair pos) - (let ([p (car pos)]) + (let ([i (car pos)]) (cond - [(box? p) - ;; in a cnode - (car (unbox p))] - [else - (let ([n (car p)] - [i (cdr p)]) + [(fixnum? i) + (let ([n (cadr pos)]) (cons (hamt-unwrap-key (bnode-key-index-ref n i)) - (bnode-val-index-ref n i)))]))) + (bnode-val-index-ref n i)))] + [else + ;; in a cnode + (car (#%unbox i))]))) (define (bnode=? a b eql? shift) (or diff --git a/racket/src/cs/rumble/intmap.ss b/racket/src/cs/rumble/intmap.ss index 24a20bd8f6..de5db5aaee 100644 --- a/racket/src/cs/rumble/intmap.ss +++ b/racket/src/cs/rumble/intmap.ss @@ -1,21 +1,23 @@ ;; We have several implementations of immutable hash tables. Pick one... -(include "rumble/patricia.ss") +;; (include "rumble/patricia.ss") ;; ;; This Patricia-trie implementation is the prettiest and fastest. It ;; uses the most memory, though --- typically much more than the ;; vector-stencil HAMT. -;; (include "rumble/hamt-stencil.ss") +(include "rumble/hamt-stencil.ss") ;; ;; This HAMT implementation using stencil vectors tends to use the -;; last memory, often by a lot. It's slower than the Patricia-tree -;; implementation, though, especially for `hash-keys-subset?`. +;; least memory, often 1/3 the space of the Patricia-trie +;; implementation. It's slower than the Patricia-tree implementation +;; for some operations, up to a factor of 2 for `hash-set` or +;; `hash-keys-subset?`. ;; (include "rumble/hamt-vector.ss") ;; ;; This HAMT implementaiton uses plain vectors instead of stencil -;; vectors. Its speed and memory use are intermediate, but its speed -;; is closer to the stencil-vector HAMT implementation, and memory use -;; is closer to the Patrica trie implementation. +;; vectors. Its speed and memory use are both worse than the +;; stencil-vector HAMT implementation, but it was the original source +;; of the stencil-vector implementation. diff --git a/racket/src/racket/src/schvers.h b/racket/src/racket/src/schvers.h index 575cc8893d..50d7923e07 100644 --- a/racket/src/racket/src/schvers.h +++ b/racket/src/racket/src/schvers.h @@ -16,7 +16,7 @@ #define MZSCHEME_VERSION_X 7 #define MZSCHEME_VERSION_Y 6 #define MZSCHEME_VERSION_Z 0 -#define MZSCHEME_VERSION_W 1 +#define MZSCHEME_VERSION_W 2 /* A level of indirection makes `#` work as needed: */ #define AS_a_STR_HELPER(x) #x