From 81c374d0f3b7f2a6e88bf577200c05ac5d041aaa Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Sat, 27 Mar 2010 07:50:35 +0000 Subject: [PATCH 001/202] Welcome to a new PLT day. svn: r18644 --- collects/repos-time-stamp/stamp.ss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collects/repos-time-stamp/stamp.ss b/collects/repos-time-stamp/stamp.ss index e1544a4e45..4245f95a31 100644 --- a/collects/repos-time-stamp/stamp.ss +++ b/collects/repos-time-stamp/stamp.ss @@ -1 +1 @@ -#lang scheme/base (provide stamp) (define stamp "26mar2010") +#lang scheme/base (provide stamp) (define stamp "27mar2010") From 19793ca54bcb4724522f7f471e502cc7a3281da3 Mon Sep 17 00:00:00 2001 From: Mike Sperber Date: Sat, 27 Mar 2010 13:52:49 +0000 Subject: [PATCH 002/202] Disable a test that exposes a hard-to-fix problem in the image primitives. svn: r18645 --- collects/tests/deinprogramm/image.ss | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/collects/tests/deinprogramm/image.ss b/collects/tests/deinprogramm/image.ss index bd11526c9c..2dba02294e 100644 --- a/collects/tests/deinprogramm/image.ss +++ b/collects/tests/deinprogramm/image.ss @@ -375,14 +375,10 @@ 2 1))) - (test-case + ;; This one is broken because of a fundamental problem with the + ;; image primitives. + #;(test-case "image=?5" - (write (image=? (rectangle 4 4 'outline 'black) - (overlay - (rectangle 4 4 'outline 'black) - (circle 1 'solid 'red) - 1 1))) - (check-not-image=? (rectangle 4 4 'outline 'black) (overlay (rectangle 4 4 'outline 'black) From 0f3dc1085a007b131293366b486b295e021c44fb Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Sat, 27 Mar 2010 14:06:14 +0000 Subject: [PATCH 003/202] updated the HISTORY; pls. merge to release branch svn: r18646 --- doc/release-notes/drscheme/HISTORY.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/doc/release-notes/drscheme/HISTORY.txt b/doc/release-notes/drscheme/HISTORY.txt index 39d626ac5d..540d0a8ed1 100644 --- a/doc/release-notes/drscheme/HISTORY.txt +++ b/doc/release-notes/drscheme/HISTORY.txt @@ -1,3 +1,16 @@ +------------------------------ + Version 4.2.5 +------------------------------ + + . a few more improvements to 2htdp/image + . new language dialog, designed to encourage + people to use the module language + . the module browser shows the phases in + which each module is invoked (in a new + "long name" mode) + . added alt-1 thru alt-9 as shortcuts to swap + around between tabs + ------------------------------ Version 4.2.4 ------------------------------ From 5c2f79a3fafc5b2237b6564d83352e93c69159c4 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Sat, 27 Mar 2010 14:26:26 +0000 Subject: [PATCH 004/202] removed a now-bogus test case; pls. include this commit in the release svn: r18647 --- collects/games/chat-noir/chat-noir-literate.ss | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/collects/games/chat-noir/chat-noir-literate.ss b/collects/games/chat-noir/chat-noir-literate.ss index e329d8613c..63ec85acc7 100644 --- a/collects/games/chat-noir/chat-noir-literate.ss +++ b/collects/games/chat-noir/chat-noir-literate.ss @@ -2253,13 +2253,7 @@ and reports the results. 'playing 3 (make-posn 0 0) #f) "h") (make-world '() (make-posn 1 1) - 'playing 3 (make-posn 0 0) #t)) - (test (change (make-world '() (make-posn 1 1) - 'playing 3 (make-posn 0 0) #t) - "release") - (make-world '() (make-posn 1 1) 'playing 3 (make-posn 0 0) #f))] - - + 'playing 3 (make-posn 0 0) #t))] @chunk[ From 895b2079165a56dc32a5b4030987c2db0104be95 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Sat, 27 Mar 2010 15:55:50 +0000 Subject: [PATCH 005/202] likely fixed an initialization problem (but I only saw the problem once so Im not sure); pls. include in release svn: r18649 --- collects/games/parcheesi/admin-gui.ss | 34 ++++++++++++++++----------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/collects/games/parcheesi/admin-gui.ss b/collects/games/parcheesi/admin-gui.ss index f39a7e94b0..ab8c480284 100644 --- a/collects/games/parcheesi/admin-gui.ss +++ b/collects/games/parcheesi/admin-gui.ss @@ -333,17 +333,23 @@ corresponds to the unplayed move! that's confusing. [(0) best-player%] [(1) polite-player%] [(2) reckless-player%] - [(3) gui-player%])) + [(3) gui-player%] + [else + (message-box "Parcheesi" (format "index->player got ~s" i)) + gui-player%])) - (define players (vector (index->player 0) - (index->player 0) - (index->player 0) - (index->player 0))) + (define players (vector 'unfilled-in-players-array + 'unfilled-in-players-array + 'unfilled-in-players-array + 'unfilled-in-players-array)) - (define/private (add-choose-player-controls color parent-panel) - (let ([color-order '((green . 0) (red . 1) (blue . 2) (yellow . 3))]) + (define/private (add-choose-player-controls color parent-panel init-selection) + (let* ([color-order '((green . 0) (red . 1) (blue . 2) (yellow . 3))] + [color-index (cdr (assq color color-order))]) + (vector-set! players color-index (index->player init-selection)) (new radio-box% (parent parent-panel) + (selection init-selection) (label #f) (choices '("Amazing Grace" "Polite Polly" @@ -352,7 +358,7 @@ corresponds to the unplayed move! that's confusing. (callback (lambda (rb y) (vector-set! players - (cdr (assq color color-order)) + color-index (index->player (send rb get-selection)))))))) @@ -361,7 +367,7 @@ corresponds to the unplayed move! that's confusing. ;; put all the gui elements together ;; - (define/private (make-player-control-panel parent color ah aw) + (define/private (make-player-control-panel parent color ah aw init-selection) (let* ([parent (new panel:single% (stretchable-height #f) @@ -379,14 +385,14 @@ corresponds to the unplayed move! that's confusing. (stretchable-width #f) (stretchable-height #f))]) (add-gui-player-controls color control-player-panel) - (add-choose-player-controls color choose-player-panel) + (add-choose-player-controls color choose-player-panel init-selection) (list color parent choose-player-panel control-player-panel))) (define gui-player-control-panels - (list (make-player-control-panel green-player-panel 'green 'top 'left) - (make-player-control-panel red-player-panel 'red 'bottom 'left) - (make-player-control-panel yellow-player-panel 'yellow 'top 'right) - (make-player-control-panel blue-player-panel 'blue 'bottom 'right))) + (list (make-player-control-panel green-player-panel 'green 'top 'left 0) + (make-player-control-panel red-player-panel 'red 'bottom 'left 1) + (make-player-control-panel yellow-player-panel 'yellow 'top 'right 2) + (make-player-control-panel blue-player-panel 'blue 'bottom 'right 3))) (define/private (get-player-panel color i) (let ([e (assq color gui-player-control-panels)]) From 73807aef247c0d74806fe43ef0720e3979de7007 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sun, 28 Mar 2010 01:10:33 +0000 Subject: [PATCH 006/202] chaperones (v4.2.5.3) svn: r18650 --- collects/compiler/decompile.ss | 2 +- collects/compiler/zo-marshal.ss | 10 +- collects/compiler/zo-parse.ss | 8 +- collects/scheme/private/for.ss | 4 +- .../scribblings/reference/chaperones.scrbl | 339 ++++++ collects/scribblings/reference/security.scrbl | 1 + .../reference/struct-inspectors.scrbl | 20 +- collects/scribblings/reference/struct.scrbl | 7 +- collects/scribblings/reference/unsafe.scrbl | 25 +- collects/scribblings/scribble/decode.scrbl | 4 +- collects/tests/mzscheme/chaperone.ss | 556 +++++++++ collects/tests/mzscheme/mz-tests.ss | 1 + collects/tests/mzscheme/optimize.ss | 6 + collects/tests/mzscheme/unsafe.ss | 52 +- src/mzscheme/include/mzscheme.exp | 2 + src/mzscheme/include/mzscheme3m.exp | 2 + src/mzscheme/include/mzwin.def | 2 + src/mzscheme/include/mzwin3m.def | 2 + src/mzscheme/include/scheme.h | 15 +- src/mzscheme/src/bool.c | 96 +- src/mzscheme/src/cstartup.inc | 1038 ++++++++-------- src/mzscheme/src/error.c | 35 +- src/mzscheme/src/eval.c | 74 ++ src/mzscheme/src/fun.c | 264 +++- src/mzscheme/src/gen-jit-ts.ss | 4 +- src/mzscheme/src/hash.c | 6 + src/mzscheme/src/jit.c | 423 +++++-- src/mzscheme/src/jit_ts.c | 3 + src/mzscheme/src/jit_ts_def.c | 18 + src/mzscheme/src/jit_ts_future_glue.c | 167 ++- src/mzscheme/src/jit_ts_protos.h | 44 +- src/mzscheme/src/jit_ts_runtime_glue.c | 22 + src/mzscheme/src/list.c | 680 ++++++++++- src/mzscheme/src/mzmark.c | 33 + src/mzscheme/src/mzmarksrc.c | 13 + src/mzscheme/src/portfun.c | 12 +- src/mzscheme/src/print.c | 238 ++-- src/mzscheme/src/read.c | 27 +- src/mzscheme/src/regexp.c | 2 +- src/mzscheme/src/schemef.h | 2 + src/mzscheme/src/schemex.h | 2 + src/mzscheme/src/schemex.inc | 2 + src/mzscheme/src/schemexm.h | 2 + src/mzscheme/src/schminc.h | 4 +- src/mzscheme/src/schpriv.h | 46 + src/mzscheme/src/schvers.h | 4 +- src/mzscheme/src/string.c | 8 +- src/mzscheme/src/struct.c | 1060 ++++++++++++++--- src/mzscheme/src/stxobj.c | 67 +- src/mzscheme/src/stypes.h | 398 ++++--- src/mzscheme/src/thread.c | 73 +- src/mzscheme/src/type.c | 3 + src/mzscheme/src/vector.c | 421 +++++-- 53 files changed, 4926 insertions(+), 1423 deletions(-) create mode 100644 collects/scribblings/reference/chaperones.scrbl create mode 100644 collects/tests/mzscheme/chaperone.ss diff --git a/collects/compiler/decompile.ss b/collects/compiler/decompile.ss index cff92eccd5..be61752ce8 100644 --- a/collects/compiler/decompile.ss +++ b/collects/compiler/decompile.ss @@ -336,7 +336,7 @@ bitwise-bit-set? char=? + - * / quotient remainder min max bitwise-and bitwise-ior bitwise-xor arithmetic-shift vector-ref string-ref bytes-ref - set-mcar! set-mcdr! cons mcons + set-mcar! set-mcdr! cons mcons set-box! list list* vector vector-immutable))] [(4) (memq (car a) '(vector-set! string-set! bytes-set! list list* vector vector-immutable diff --git a/collects/compiler/zo-marshal.ss b/collects/compiler/zo-marshal.ss index c59938b482..2ac973aba1 100644 --- a/collects/compiler/zo-marshal.ss +++ b/collects/compiler/zo-marshal.ss @@ -247,11 +247,11 @@ (define wcm-type-num 14) (define quote-syntax-type-num 15) (define variable-type-num 24) -(define top-type-num 87) -(define case-lambda-sequence-type-num 96) -(define begin0-sequence-type-num 97) -(define module-type-num 100) -(define prefix-type-num 102) +(define top-type-num 89) +(define case-lambda-sequence-type-num 99) +(define begin0-sequence-type-num 100) +(define module-type-num 103) +(define prefix-type-num 105) (define-syntax define-enum (syntax-rules () diff --git a/collects/compiler/zo-parse.ss b/collects/compiler/zo-parse.ss index 77e6685c95..868d7cbff2 100644 --- a/collects/compiler/zo-parse.ss +++ b/collects/compiler/zo-parse.ss @@ -314,10 +314,10 @@ [(15) 'quote-syntax-type] [(24) 'variable-type] [(25) 'module-variable-type] - [(96) 'case-lambda-sequence-type] - [(97) 'begin0-sequence-type] - [(100) 'module-type] - [(102) 'resolve-prefix-type] + [(99) 'case-lambda-sequence-type] + [(100) 'begin0-sequence-type] + [(103) 'module-type] + [(105) 'resolve-prefix-type] [else (error 'int->type "unknown type: ~e" i)])) (define type-readers diff --git a/collects/scheme/private/for.ss b/collects/scheme/private/for.ss index 3035f90758..4a58518382 100644 --- a/collects/scheme/private/for.ss +++ b/collects/scheme/private/for.ss @@ -1143,9 +1143,9 @@ (define-sequence-syntax *in-vector (lambda () #'in-vector) (vector-like-gen #'vector? - #'unsafe-vector-length + #'unsafe-vector*-length #'in-vector - #'unsafe-vector-ref)) + #'unsafe-vector*-ref)) (define-sequence-syntax *in-string (lambda () #'in-string) diff --git a/collects/scribblings/reference/chaperones.scrbl b/collects/scribblings/reference/chaperones.scrbl new file mode 100644 index 0000000000..965516c6b8 --- /dev/null +++ b/collects/scribblings/reference/chaperones.scrbl @@ -0,0 +1,339 @@ +#lang scribble/doc +@(require "mz.ss") + +@(define-syntax op + (syntax-rules () + [(_ (x ...)) (x ...)] + [(_ id) @scheme[id]])) +@(define-syntax-rule (operations i ...) + (itemlist #:style 'compact @item{@op[i]} ...)) + +@title[#:tag "chaperones"]{Chaperones} + +A @deftech{chaperone} is a wrapper for a value where the wrapper +implements primitive support for @tech{contract}-like checks on the +value's operations. Chaperones apply only to procedures, +@tech{structures} for which an accessor or mutator is available, +@tech{structure types}, @tech{hash tables}, @tech{vectors}, +@tech{box}es. A chaperoned value is @scheme[equal?] to the original +value, but not @scheme[eq?] to the original value. + +A chaperone's refinement of a value's operation is restricted to side +effects (including, in particular, raising and exception) or +chaperoning values supplied to or produced by the operation. For +example, a vector chaperone can redirect @scheme[vector-ref] to raise +an exception if the accessed vector slot contains a string, or it can +cause the result of @scheme[vector-ref] to be a chaperoned variant of +the value that is in the accessed vector slot, but it cannot redirect +@scheme[vector-ref] to produce a value that is arbitrarily different +from the value in the vector slot. + +Beware that each of the following operations can be redirected to +arbitrary procedure through chaperones on the operation's +argument---assuming that the operation is available to the creator of +the chaperone: + +@operations[@t{a structure-field accesor} + @t{a structure-field mutator} + @t{a structure type property accessor} + @t{application of a procedure} + unbox set-box! + vector-ref vector-set! + hash-ref hash-set hash-set! hash-remove hash-remove!] + +Derived operations, such as printing a value, can be redirected +through chaperones due to their use of accessor functions. The +@scheme[equal?], @scheme[equal-hash-code], and +@scheme[equal-secondary-hash-code] operations, in contrast, may bypass +chaperones (but they are not obliged to). + +In addition to redirecting operations that work on a value, a +chaperone can include @deftech{chaperone properties} for a chaperoned +value. A @tech{chaperone property} is similar to a @tech{structure +type property}, but it applies to chaperones instead of structure +types and their instances. + + +@defproc[(chaperone? [v any/c]) boolean?]{ + +Returns @scheme[#t] if @scheme[v] is a chaperone, @scheme[#f] otherwise. + +Programs and libraries generally should avoid @scheme[chaperone?] and +treat chaperones the same as unchaperoned values. In rare cases, +@scheme[chaperone?] may be needed to guard against redirection by a +chaperone of an operation to an arbitrary procedure.} + + +@defproc[(chaperone-of? [v1 any/c] [v2 any/c]) boolean?]{ + +Indicates whether @scheme[v1] can be considered equivalent modulo +chaperones to @scheme[v2]. + +For values that include no chaperones, @scheme[v1] and @scheme[v2] can +be considered chaperones of each other if they are @scheme[equal?], +except that the mutability of vectors and boxes with @scheme[v1] and +@scheme[v2] must be the same. + +Otherwise, all chaperones of @scheme[v2] must be intact in +@scheme[v1], in the sense that parts of @scheme[v2] must be derived +from @scheme[v1] through one of the chaperone constructors (e.g., +@scheme[chaperone-procedure]).} + +@; ------------------------------------------------------------ +@section{Chaperone Constructors} + +@defproc[(chaperone-procedure [proc procedure?] + [wrapper-proc procedure?] + [prop chaperone-property?] + [prop-val any] ... ...) + (and/c procedure? chaperone?)]{ + +Returns a chaperoned procedure that has the same arity, name, and +other attributes as @scheme[proc]. The arity of @scheme[wrapper-proc] +must include the arity of @scheme[proc]; when the chaperoned procedure +is applied, the arguments are first passed to @scheme[wrapper-proc]. + +The result of @scheme[wrapper-proc] must be either the same number of +values as supplied to it or one more than the number of supplied +values. For each supplied value, the corresponding result must be the +same or a chaperone of (in the sense of @scheme[chaperone-of?]) the +supplied value. The additional result, if any, must be a procedure +that accepts as many results as produced by @scheme[proc]; it must +return the same number of results, each of which is the same or a +chaperone of the corresponding original result. + +Pairs of @scheme[prop] and @scheme[prop-val] (the number of arguments +to @scheme[procedure-chaperone] must be even) add chaperone properties +or override chaperone-property values of @scheme[proc].} + +@defproc[(chaperone-struct [v any/c] + [orig-proc (or/c struct-accessor-procedure? + struct-mutator-procedure? + struct-type-property-accessor-procedure? + (one-of/c struct-info))] + [redirect-proc procedure?] ... ... + [prop chaperone-property?] + [val any] ... ...) + any/c]{ + +Returns a chaperoned value like @scheme[v], but with certain +operations on the chaperoned redirected. The @scheme[orig-proc]s +indicate the operations to redirect, and the corresponding +@scheme[redirect-proc]s supply the redirections. + +The protocol for a @scheme[redirect-proc] depends on the corresponding +@scheme[orig-proc]: + +@itemlist[ + + @item{A structure-field or property accessor: @scheme[orig-proc] must + accept two arguments, @scheme[v] and the value @scheme[_field-v] + that @scheme[orig-proc] produces for @scheme[v]; it must return + chaperone of @scheme[_field-v].} + + @item{A structure field mutator: @scheme[orig-proc] must accept two + arguments, @scheme[v] and the value @scheme[_field-v] supplied + to the mutator; it must return chaperone of @scheme[_field-v] + to be propagated to @scheme[orig-proc] and @scheme[v].} + + @item{@scheme[struct-info]: @scheme[orig-proc] must accept two + values, which are the results of @scheme[struct-info] on + @scheme[v]; it must return two values that are chaperones of + its arguments. The @scheme[orig-proc] is not called if + @scheme[struct-info] would return @scheme[#f] as its first + argument.} + +] + +An @scheme[orig-proc] can be @scheme[struct-info] only if some other +@scheme[orig-proc] is supplied, and each @scheme[orig-proc] must +indicate a distinct operation. If no @scheme[orig-proc]s are supplied, +then no @scheme[prop]s must be supplied, and @scheme[v] is returned +unchaperoned. + +Pairs of @scheme[prop-val] and @scheme[val] (the number of arguments +to @scheme[chaperone-procedure] must be even) add chaperone properties +or override chaperone-property values of @scheme[v].} + +@defproc[(chaperone-vector [vec vector?] + [ref-proc (vector? exact-nonnegative-integer? any/c . -> . any/c)] + [set-proc (vector? exact-nonnegative-integer? any/c . -> . any/c)] + [prop chaperone-property?] + [val any] ... ...) + (and/c vector? chaperone?)]{ + +Returns a chaperoned value like @scheme[vec], but with +@scheme[vector-ref] and @scheme[vector-set!] operations on the +chaperoned vector redirected. + +The @scheme[ref-proc] must accept @scheme[vec], an index passed to +@scheme[vector-ref], and the value that @scheme[vector-ref] on +@scheme[vec] produces for the given index; it must produce the same +value or a chaperone of the value, which is the result of +@scheme[vector-ref] on the chaperone. + +The @scheme[set-proc] must accept @scheme[vec], an index passed to +@scheme[vector-set!], and the value passed to @scheme[vector-set!]; it +must produce the same value or a chaperone of the value, which is used +with @scheme[vector-set!] on the original @scheme[vec] to install the +value. The @scheme[set-proc] will not be used if @scheme[vec] is +immutable. + +Pairs of @scheme[prop-val] and @scheme[val] (the number of arguments +to @scheme[chaperone-vector] must be odd) add chaperone properties +or override chaperone-property values of @scheme[vec].} + +@defproc[(chaperone-box [bx box?] + [unbox-proc (box? any/c . -> . any/c)] + [set-proc (box? any/c . -> . any/c)] + [prop chaperone-property?] + [val any] ... ...) + (and/c box? chaperone?)]{ + +Returns a chaperoned value like @scheme[bx], but with +@scheme[unbox] and @scheme[set-box!] operations on the +chaperoned box redirected. + +The @scheme[unbox-proc] must accept @scheme[bx] and the value that +@scheme[unbox] on @scheme[bx] produces index; it must produce the same +value or a chaperone of the value, which is the result of +@scheme[unbox] on the chaperone. + +The @scheme[set-proc] must accept @scheme[bx] and the value passed to +@scheme[set-box!]; it must produce the same value or a chaperone of +the value, which is used with @scheme[set-box!] on the original +@scheme[bx] to install the value. The @scheme[set-proc] will not be +used if @scheme[bx] is immutable. + +Pairs of @scheme[prop-val] and @scheme[val] (the number of arguments +to @scheme[chaperone-box] must be odd) add chaperone properties +or override chaperone-property values of @scheme[bx].} + + +@defproc[(chaperone-hash [hash hash?] + [ref-proc (hash? any/c any/c . -> . any/c)] + [set-proc (hash? any/c any/c . -> . any/c)] + [remove-proc (hash? any/c . -> . any/c)] + [key-proc (hash? any/c . -> . any/c)] + [prop chaperone-property?] + [val any] ... ...) + (and/c vector? chaperone?)]{ + +Returns a chaperoned value like @scheme[hash], but with +@scheme[hash-ref], @scheme[hash-set!] or @scheme[hash-set] (as +applicable) and @scheme[hash-remove] or @scheme[hash-remove!] (as +application) operations on the chaperoned hash table redirected. When +@scheme[hash-set] or @scheme[hash-remove] is used on a chaperoned hash +table, the resulting hash table is given all of the chaperones of the +given hash table. In addition, operations like +@scheme[hash-iterate-key] or @scheme[hash-iterate-map], which extract +keys from the table, use @scheme[key-proc] to filter keys extracted +from the table. Operations like @scheme[hash-iterate-value] or +@scheme[hash-iterate-map] implicitly use @scheme[hash-ref] and +therefore redirect through @scheme[ref-proc]. + +The @scheme[ref-proc] must accept @scheme[hash], an key passed +@scheme[hash-ref], and the value that @scheme[hash-ref] on +@scheme[hash] produces for the given key; it must produce the same +value or a chaperone of the value, which is the result of +@scheme[hash-ref] on the chaperone. + +The @scheme[set-proc] must accept @scheme[hash], a key passed to +@scheme[hash-set!] or @scheme[hash-set], and the value passed to +@scheme[hash-set!] or @scheme[hash-set]; it must produce the same +value or a chaperone of the value, which is used with +@scheme[hash-set!] or @scheme[hash-set] on the original @scheme[hash] +to install the value. + +The @scheme[remove-proc] must accept @scheme[hash] and a key passed to +@scheme[hash-remove!] or @scheme[hash-remove]; it must produce the +same key or a chaperone of the key, which is used with +@scheme[hash-remove!] or @scheme[hash-remove] on the original +@scheme[hash] to remove any mapping using the (chaperoned) key. + +The @scheme[key-proc] must accept @scheme[hash] and a key that has +been extracted from @scheme[hash] (by @scheme[hash-iterate-key] or +other operations that use @scheme[hash-iterate-key] internally); it +must produce the same key or a chaperone of the key, which is then +reported as a key extracted from the table. + +Pairs of @scheme[prop-val] and @scheme[val] (the number of arguments +to @scheme[chaperone-hash] must be odd) add chaperone properties +or override chaperone-property values of @scheme[hash].} + +@defproc[(chaperone-struct-type [struct-type struct-type?] + [struct-info-proc procedure?] + [make-constructor-proc (procedure? . -> . procedure?)] + [guard-proc procedure?] + [prop chaperone-property?] + [val any] ... ...) + (and/c struct-type? chaperone?)]{ + +Returns a chaperoned value like @scheme[struct-type], but with +@scheme[struct-type-info] and @scheme[struct-type-make-constructor] +operations on the chaperoned structure type redirected. In addition, +when a new structure type is created as a subtype of the chaperoned +structure type, @scheme[guard-proc] is interposed as an extra guard on +creation of instances of the subtype. + +The @scheme[struct-info-proc] must accept 8 arguments---the result of +@scheme[struct-type-info] on @scheme[struct-type]. It must return 8 +values, where each is the same or a chaperone of the corresponding +argument. The 8 values are used as the results of +@scheme[struct-type-info] for the chaperoned structure type. + +The @scheme[make-constructor-proc] must accept a single procedure +argument, which is a constructor produced by +@scheme[struct-type-make-constructor] on @scheme[struct-type]. It must +return the same or a chaperone of the procedure, which is used as the +result of @scheme[struct-type-make-constructor] on the chaperoned +structure type. + +The @scheme[guard-proc] must accept as many argument as a constructor +for @scheme[struct-type]; it must return the same number of arguments, +each the same or a chaperone of the corresponding argument. The +@scheme[guard-proc] is added as a constructor guard when a subtype is +created of the chaperoned structure type. + +Pairs of @scheme[prop-val] and @scheme[val] (the number of arguments +to @scheme[chaperone-struct-type] must be even) add chaperone properties +or override chaperone-property values of @scheme[struct-type].} + +@; ------------------------------------------------------------ +@section{Chaperone Properties} + +@defproc[(make-chaperone-property [name symbol?]) + (values chaperone-property? + procedure? + procedure?)]{ + +Creates a new structure type property and returns three values: + +@itemize[ + + @item{a @deftech{chaperone property descriptor}, for use with + @scheme[chaperone-procedure], @scheme[chaperone-struct], and + other chaperone constructors;} + + @item{a @deftech{chaperone property predicate} procedure, which takes + an arbitrary value and returns @scheme[#t] if the value is a + chaperone with a value for the property, @scheme[#f] + otherwise;} + + @item{an @deftech{chaperone property accessor} procedure, which + returns the value associated with a chaperone for the property; + if a value given to the accessor is not a chaperone or does not + have a value for the property, the + @exnraise[exn:fail:contract].} + +]} + +@defproc[(chaperone-property? [v any/c]) boolean?]{ + +Returns @scheme[#t] if @scheme[v] is a @tech{chaperone property +descriptor} value, @scheme[#f] otherwise.} + +@defproc[(chaperone-property-accessor-procedure? [v any/c]) boolean?]{ + +Returns @scheme[#t] if @scheme[v] is an accessor procedure produced +by @scheme[make-chaperone-property], @scheme[#f] otherwise.} diff --git a/collects/scribblings/reference/security.scrbl b/collects/scribblings/reference/security.scrbl index 97c623e5c5..7c377299bb 100644 --- a/collects/scribblings/reference/security.scrbl +++ b/collects/scribblings/reference/security.scrbl @@ -10,6 +10,7 @@ @include-section["eval.scrbl"] @include-section["load-lang.scrbl"] @include-section["module-reflect.scrbl"] +@include-section["chaperones.scrbl"] @include-section["security-guards.scrbl"] @include-section["custodians.scrbl"] @include-section["thread-groups.scrbl"] diff --git a/collects/scribblings/reference/struct-inspectors.scrbl b/collects/scribblings/reference/struct-inspectors.scrbl index 93f7b1c278..e193e33860 100644 --- a/collects/scribblings/reference/struct-inspectors.scrbl +++ b/collects/scribblings/reference/struct-inspectors.scrbl @@ -58,14 +58,14 @@ Returns two values: @itemize[ - @item{@scheme[struct-type]: a structure type descriptor or @scheme[#f]; + @item{@scheme[_struct-type]: a structure type descriptor or @scheme[#f]; the result is a structure type descriptor of the most specific type for which @scheme[v] is an instance, and for which the current inspector has control, or the result is @scheme[#f] if the current inspector does not control any structure type for which the @scheme[struct] is an instance.} - @item{@scheme[skipped?]: @scheme[#f] if the first result corresponds to + @item{@scheme[_skipped?]: @scheme[#f] if the first result corresponds to the most specific structure type of @scheme[v], @scheme[#t] otherwise.} ]} @@ -86,32 +86,32 @@ Returns eight values that provide information about the structure type @itemize[ - @item{@scheme[name]: the structure type's name as a symbol;} + @item{@scheme[_name]: the structure type's name as a symbol;} - @item{@scheme[init-field-cnt]: the number of fields defined by the + @item{@scheme[_init-field-cnt]: the number of fields defined by the structure type provided to the constructor procedure (not counting fields created by its ancestor types);} - @item{@scheme[auto-field-cnt]: the number of fields defined by the + @item{@scheme[_auto-field-cnt]: the number of fields defined by the structure type without a counterpart in the constructor procedure (not counting fields created by its ancestor types);} - @item{@scheme[accessor-proc]: an accessor procedure for the structure + @item{@scheme[_accessor-proc]: an accessor procedure for the structure type, like the one returned by @scheme[make-struct-type];} - @item{@scheme[mutator-proc]: a mutator procedure for the structure + @item{@scheme[_mutator-proc]: a mutator procedure for the structure type, like the one returned by @scheme[make-struct-type];} - @item{@scheme[immutable-k-list]: an immutable list of exact + @item{@scheme[_immutable-k-list]: an immutable list of exact non-negative integers that correspond to immutable fields for the structure type;} - @item{@scheme[super-type]: a structure type descriptor for the + @item{@scheme[_super-type]: a structure type descriptor for the most specific ancestor of the type that is controlled by the current inspector, or @scheme[#f] if no ancestor is controlled by the current inspector;} - @item{@scheme[skipped?]: @scheme[#f] if the seventh result is the + @item{@scheme[_skipped?]: @scheme[#f] if the seventh result is the most specific ancestor type or if the type has no supertype, @scheme[#t] otherwise.} diff --git a/collects/scribblings/reference/struct.scrbl b/collects/scribblings/reference/struct.scrbl index 8f462b7ea9..e191e79051 100644 --- a/collects/scribblings/reference/struct.scrbl +++ b/collects/scribblings/reference/struct.scrbl @@ -367,9 +367,12 @@ is then sent to that property's guard, of any). @defproc[(struct-type-property? [v any/c]) boolean?]{ Returns @scheme[#t] if @scheme[v] is a @tech{structure type property -descriptor} value, @scheme[#f] otherwise. +descriptor} value, @scheme[#f] otherwise.} -} +@defproc[(struct-type-property-accessor-procedure? [v any/c]) boolean?]{ + +Returns @scheme[#t] if @scheme[v] is an accessor procedure produced +by @scheme[make-struct-type-property], @scheme[#f] otherwise.} @;------------------------------------------------------------------------ @section[#:tag "struct-copy"]{Copying and Updating Structures} diff --git a/collects/scribblings/reference/unsafe.scrbl b/collects/scribblings/reference/unsafe.scrbl index 06de73b20a..a9587c8cdc 100644 --- a/collects/scribblings/reference/unsafe.scrbl +++ b/collects/scribblings/reference/unsafe.scrbl @@ -170,9 +170,22 @@ Unsafe variants of @scheme[car], @scheme[cdr], @scheme[mcar], @deftogether[( -@defproc[(unsafe-vector-length [v vector?]) fixnum?] -@defproc[(unsafe-vector-ref [v vector?][k fixnum?]) any/c] -@defproc[(unsafe-vector-set! [v vector?][k fixnum?][val any/c]) void?] +@defproc[(unsafe-unbox [v (and/c box? (not/c chaperone?))]) any/c] +@defproc[(unsafe-set-box! [v (and/c box? (not/c chaperone?))][val any/c]) void?] +@defproc[(unsafe-unbox* [b box?]) fixnum?] +@defproc[(unsafe-set-box*! [b box?][k fixnum?]) void?] +)]{ + +Unsafe versions of @scheme[unbox] and @scheme[set-box!].} + + +@deftogether[( +@defproc[(unsafe-vector-length [v (and/c vector? (not/c chaperone?))]) fixnum?] +@defproc[(unsafe-vector-ref [v (and/c vector? (not/c chaperone?))][k fixnum?]) any/c] +@defproc[(unsafe-vector-set! [v (and/c vector? (not/c chaperone?))][k fixnum?][val any/c]) void?] +@defproc[(unsafe-vector*-length [v vector?]) fixnum?] +@defproc[(unsafe-vector*-ref [v vector?][k fixnum?]) any/c] +@defproc[(unsafe-vector*-set! [v vector?][k fixnum?][val any/c]) void?] )]{ Unsafe versions of @scheme[vector-length], @scheme[vector-ref], and @@ -229,8 +242,10 @@ Unsafe versions of @scheme[f64vector-ref] and @deftogether[( -@defproc[(unsafe-struct-ref [v any/c][k fixnum?]) any/c] -@defproc[(unsafe-struct-set! [v any/c][k fixnum?][val any/c]) void?] +@defproc[(unsafe-struct-ref [v (not/c chaperone?)][k fixnum?]) any/c] +@defproc[(unsafe-struct-set! [v (not/c chaperone?)][k fixnum?][val any/c]) void?] +@defproc[(unsafe-struct*-ref [v any/c][k fixnum?]) any/c] +@defproc[(unsafe-struct*-set! [v any/c][k fixnum?][val any/c]) void?] )]{ Unsafe field access and update for an instance of a structure diff --git a/collects/scribblings/scribble/decode.scrbl b/collects/scribblings/scribble/decode.scrbl index 292bc6a7a7..936ec5c83f 100644 --- a/collects/scribblings/scribble/decode.scrbl +++ b/collects/scribblings/scribble/decode.scrbl @@ -70,13 +70,13 @@ by functions like @scheme[decode-flow].} @defproc[(pre-part? [v any/c]) boolean?]{ Returns @scheme[#t] if @scheme[v] is a @deftech{pre-part} value: a -string or other non-list @scheme[content], a @scheme[block], a +string or other non-list @tech{content}, a @tech{block}, a @scheme[part], a @scheme[title-decl], a @scheme[part-start], a @scheme[part-index-decl], a @scheme[part-collect-decl], a @scheme[part-tag-decl], @|void-const|, or a @scheme[splice] containing a list of @tech{pre-part} values; otherwise returns @scheme[#f]. -A pre-part sequences is decoded into a @scheme[part] by functions like +A pre-part sequence is decoded into a @scheme[part] by functions like @scheme[decode] and @scheme[decode-part].} diff --git a/collects/tests/mzscheme/chaperone.ss b/collects/tests/mzscheme/chaperone.ss new file mode 100644 index 0000000000..564b0ed65f --- /dev/null +++ b/collects/tests/mzscheme/chaperone.ss @@ -0,0 +1,556 @@ + + +(load-relative "loadtest.ss") +(Section 'chaperones) + +;; ---------------------------------------- + +(test #t chaperone-of? 10 10) +(test #t chaperone-of? '(10) '(10)) +(test #t chaperone-of? '#(1 2 3) '#(1 2 3)) +(test #t chaperone-of? '#&(1 2 3) '#&(1 2 3)) + +(test #f chaperone-of? (make-string 1 #\x) (make-string 1 #\x)) +(test #t chaperone-of? + (string->immutable-string (make-string 1 #\x)) + (string->immutable-string (make-string 1 #\x))) + +(define (either-chaperone-of? a b) + (or (chaperone-of? a b) + (chaperone-of? b a))) +(test #f either-chaperone-of? + (string->immutable-string "x") + (make-string 1 #\x)) +(test #f either-chaperone-of? + '#(1 2 3) + (vector 1 2 3)) +(test #f either-chaperone-of? + '#&17 + (box 17)) + +(let () + (define-struct o (a b)) + (define-struct p (x y) #:transparent) + (define-struct (p2 p) (z) #:transparent) + (define-struct q (u [w #:mutable]) #:transparent) + (define-struct (q2 q) (v) #:transparent) + (test #f chaperone-of? (make-o 1 2) (make-o 1 2)) + (test #t chaperone-of? (make-p 1 2) (make-p 1 2)) + (test #f chaperone-of? (make-p 1 (box 2)) (make-p 1 (box 2))) + (test #t chaperone-of? (make-p2 1 2 3) (make-p2 1 2 3)) + (test #f chaperone-of? (make-q 1 2) (make-q 1 2)) + (test #f chaperone-of? (make-q2 1 2 3) (make-q2 1 2 3))) + +;; ---------------------------------------- + +(test #t chaperone? (chaperone-box (box 10) (lambda (b v) v) (lambda (b v) v))) +(test #t box? (chaperone-box (box 10) (lambda (b v) v) (lambda (b v) v))) +(test #t (lambda (x) (box? x)) (chaperone-box (box 10) (lambda (b v) v) (lambda (b v) v))) +(test #t chaperone? (chaperone-box (box-immutable 10) (lambda (b v) v) (lambda (b v) v))) + +(let* ([b (box 0)] + [b2 (chaperone-box b + (lambda (b v) + (when (equal? v 'bad) (error "bad get")) + v) + (lambda (b v) + (when (equal? v 'bad) (error "bad set")) + v))]) + (test #t equal? b b2) + (test #f chaperone-of? b b2) + (test #t chaperone-of? b2 b) + (err/rt-test (set-box! b2 'bad) (lambda (exn) + (test "bad set" exn-message exn))) + (test (void) set-box! b 'bad) + (err/rt-test (unbox b2) (lambda (exn) + (test "bad get" exn-message exn))) + (test (void) set-box! b 'ok) + (test 'ok unbox b2) + (test (void) set-box! b2 'fine) + (test 'fine unbox b)) + +;; ---------------------------------------- + +(test #t chaperone? (chaperone-vector (vector 1 2 3) (lambda (b i v) v) (lambda (b i v) v))) +(test #t vector? (chaperone-vector (vector 1 2 3) (lambda (b i v) v) (lambda (b i v) v))) +(test #t (lambda (x) (vector? x)) (chaperone-vector (vector 1 2 3) (lambda (b i v) v) (lambda (b i v) v))) +(test #t chaperone? (chaperone-vector (vector-immutable 1 2 3) (lambda (b i v) v) (lambda (b i v) v))) + +(let* ([b (vector 1 2 3)] + [b2 (chaperone-vector b + (lambda (b i v) + (when (and (equal? v 'bad) (= i 1)) + (error "bad get")) + v) + (lambda (b i v) + (when (and (equal? v 'bad) (= i 2)) + (error "bad set")) + v))]) + (test #t equal? b b2) + (test #f chaperone-of? b b2) + (test #t chaperone-of? b2 b) + (err/rt-test (vector-set! b2 2 'bad) (lambda (exn) + (test "bad set" exn-message exn))) + (test 3 vector-ref b 2) + (test (void) vector-set! b2 1 'bad) + (test 'bad vector-ref b 1) + (err/rt-test (vector-ref b2 1) (lambda (exn) + (test "bad get" exn-message exn))) + (test (void) vector-set! b 1 'ok) + (test 'ok vector-ref b2 1) + (test (void) vector-set! b2 1 'fine) + (test 'fine vector-ref b 1)) + +;; ---------------------------------------- + +(test #t chaperone? (chaperone-procedure (lambda (x) x) (lambda (y) y))) +(test #t procedure? (chaperone-procedure (lambda (x) x) (lambda (y) y))) +(test #t (lambda (x) (procedure? x))(chaperone-procedure (lambda (x) x) (lambda (y) y))) +(err/rt-test (chaperone-procedure (lambda (x) x) (lambda (y z) y))) +(err/rt-test (chaperone-procedure (case-lambda [() 0] [(x) x]) (lambda (y) y))) + +;; Single argument, no post filter: +(let* ([f (lambda (x) (list x x))] + [in #f] + [f2 (chaperone-procedure + f + (lambda (x) + (set! in x) + x))]) + (test '(110 110) f 110) + (test #f values in) + (test '(111 111) f2 111) + (test 111 values in)) + +;; Multiple arguments, no post filter: +(let* ([f (lambda (x y) (list x y))] + [in #f] + [f2 (chaperone-procedure + f + (lambda (x y) + (set! in (vector x y)) + (values x y)))]) + (test '(1100 1101) f 1100 1101) + (test #f values in) + (test '(1110 1111) f2 1110 1111) + (test (vector 1110 1111) values in)) + +;; Single argument, post filter on single value: +(let* ([f (lambda (x) (list x x))] + [in #f] + [out #f] + [f2 (chaperone-procedure + f + (lambda (x) + (set! in x) + (values x (lambda (y) + (set! out y) + y))))]) + (test '(10 10) f 10) + (test #f values in) + (test #f values out) + (test '(11 11) f2 11) + (test 11 values in) + (test '(11 11) values out)) + +;; Multiple arguments, post filter on multiple values: +(let* ([f (lambda (x y z) (values y (list x z)))] + [in #f] + [out #f] + [f2 (chaperone-procedure + f + (lambda (x y z) + (set! in (vector x y z)) + (values x y z + (lambda (y z) + (set! out (vector y z)) + (values y z)))))]) + (test-values '(b (a c)) (lambda () (f 'a 'b 'c))) + (test #f values in) + (test #f values out) + (test-values '(b (a c)) (lambda () (f2 'a 'b 'c))) + (test (vector 'a 'b 'c) values in) + (test (vector 'b '(a c)) values out)) + +(err/rt-test ((chaperone-procedure (lambda (x) x) (lambda (y) (values y y))) 1)) +(err/rt-test ((chaperone-procedure (lambda (x) x) (lambda (y) (values y y y))) 1)) +(err/rt-test ((chaperone-procedure (lambda (x) (values x x)) (lambda (y) y))) 1) + +;; ---------------------------------------- + +(let () + (define-values (prop:blue blue? blue-ref) (make-chaperone-property 'blue)) + (define-values (prop:green green? green-ref) (make-struct-type-property 'green)) + (define-struct a ([x #:mutable] y)) + (define-struct (b a) ([z #:mutable])) + (define-struct p (u) #:property prop:green 'green) + (define-struct (q p) (v w)) + (test #t chaperone? (chaperone-struct (make-a 1 2) a-x (lambda (a v) v))) + (test #t chaperone? (chaperone-struct (make-b 1 2 3) a-x (lambda (a v) v))) + (test #t chaperone? (chaperone-struct (make-p 1) green-ref (lambda (a v) v))) + (test #t chaperone? (chaperone-struct (make-a 1 2) a-x (lambda (a v) v) prop:blue 'blue)) + (test #t chaperone? (chaperone-struct + (chaperone-struct (make-a 1 2) a-x (lambda (a v) v) prop:blue 'blue) + a-x (lambda (a v) v) + prop:blue 'blue)) + (err/rt-test (chaperone-struct (make-a 1 2) b-z (lambda (a v) v))) + (err/rt-test (chaperone-struct (make-p 1) a-x (lambda (a v) v))) + (err/rt-test (chaperone-struct (make-q 1 2 3) a-x (lambda (a v) v))) + (err/rt-test (chaperone-struct (make-a 1 2) 5 (lambda (a v) v))) + (err/rt-test (chaperone-struct (make-a 1 2) a-x 5)) + (err/rt-test (chaperone-struct (make-a 1 2) a-x (lambda (x) x))) + (err/rt-test (chaperone-struct (make-a 1 2) blue-ref (lambda (a v) v))) + (err/rt-test (chaperone-struct (make-a 1 2) a-x (lambda (a v) v) prop:green 'green)) + (err/rt-test (chaperone-struct + (chaperone-struct (make-a 1 2) a-x (lambda (a v) v) prop:blue 'blue) + blue-ref (lambda (a v) v))) + (let* ([a1 (make-a 1 2)] + [get #f] + [set #f] + [a2 (chaperone-struct a1 a-y (lambda (an-a v) (set! get v) v) + set-a-x! (lambda (an-a v) (set! set v) v))] + [p1 (make-p 100)] + [p-get #f] + [p2 (chaperone-struct p1 green-ref (lambda (p v) (set! p-get v) v))] + [a3 (chaperone-struct a1 a-x (lambda (a y) y) prop:blue 8)]) + (test 2 a-y a1) + (test #f values get) + (test #f values set) + (test 2 a-y a2) + (test 2 values get) + (test #f values set) + (test (void) set-a-x! a1 0) + (test 0 a-x a1) + (test 0 a-x a2) + (test 2 values get) + (test #f values set) + (test (void) set-a-x! a2 10) + (test 2 values get) + (test 10 values set) + (test 10 a-x a1) + (test 10 a-x a2) + (test 2 a-y a1) + (test 2 a-y a2) + (test #t green? p1) + (test #t green? p2) + (test 'green green-ref p1) + (test #f values p-get) + (test 'green green-ref p2) + (test 'green values p-get) + (test #f blue? a1) + (test #f blue? a2) + (test #t blue? a3) + (test 8 blue-ref a3)) + (let* ([a1 (make-b 1 2 3)] + [get #f] + [set #f] + [a2 (chaperone-struct a1 b-z (lambda (an-a v) (set! get v) v) + set-b-z! (lambda (an-a v) (set! set v) v))]) + (test 1 a-x a2) + (test 2 a-y a2) + (test 3 b-z a1) + (test #f values get) + (test #f values set) + (test 3 b-z a2) + (test 3 values get) + (test #f values set) + (test (void) set-b-z! a1 0) + (test 0 b-z a1) + (test 3 values get) + (test #f values set) + (test 0 b-z a2) + (test 0 values get) + (test #f values set) + (test (void) set-b-z! a2 10) + (test 0 values get) + (test 10 values set) + (test 10 b-z a1) + (test 10 b-z a2) + (test 2 a-y a1) + (test 2 a-y a2) + (test 10 values get) + (test 10 values set)) + (let* ([a1 (make-a 0 2)] + [a2 (chaperone-struct a1 a-x (lambda (a v) (if (= v 1) 'bad v)) + set-a-x! (lambda (a v) (if (= v 3) 'bad v)))]) + (test 0 a-x a1) + (test 0 a-x a2) + (test (void) set-a-x! a1 1) + (test 1 a-x a1) + (err/rt-test (a-x a2)) + (test (void) set-a-x! a1 3) + (test 3 a-x a1) + (test 3 a-x a2) + (test (void) set-a-x! a1 4) + (err/rt-test (set-a-x! a2 3)) + (test 4 a-x a1) + (test 4 a-x a2) + (let* ([a3 (chaperone-struct a2 a-x (lambda (a v) (if (= v 10) 'bad v)) + set-a-x! (lambda (a v) (if (= v 30) 'bad v)))]) + (set-a-x! a2 30) + (err/rt-test (set-a-x! a3 30)) + (err/rt-test (set-a-x! a3 3)) + (set-a-x! a3 1) + (test 1 a-x a1) + (err/rt-test (a-x a2)) + (err/rt-test (a-x a3))))) + +;; ---------------------------------------- + +(let () + (define (test-sub linear? rev?) + (define-struct a (x [y #:mutable]) #:property prop:procedure 0) + (let* ([a1 (make-a (lambda (x) (list x x)) 10)] + [get #f] + [a2 (chaperone-struct a1 a-y (lambda (a v) (set! get v) v))] + [pre #f] + [post #f] + [a3 (chaperone-procedure (if linear? a2 a1) + (lambda (z) + (set! pre z) + (values z (lambda (r) + (set! post r) + r))))] + [a2 (if rev? + (chaperone-struct a3 a-y (lambda (a v) (set! get v) v)) + a2)]) + (test '(12 12) a1 12) + (test #f values get) + (test #f values pre) + (test #f values post) + (test '(12 12) a2 12) + (test #f values get) + (test (if rev? 12 #f) values pre) + (test (if rev? '(12 12) #f) values post) + (test '(12 12) a3 12) + (test #f values get) + (test 12 values pre) + (test '(12 12) values post) + (test 10 a-y a1) + (test #f values get) + (test 10 a-y a2) + (test 10 values get) + (test 10 a-y a3) + (test (void) set-a-y! a1 9) + (test 9 a-y a3) + (test (if linear? 9 10) values get) + (test 9 a-y a2) + (test 9 values get))) + (test-sub #f #f) + (test-sub #t #f) + (test-sub #f #t)) + +;; ---------------------------------------- + +(let () + (define-values (prop:blue blue? blue-ref) (make-chaperone-property 'blue)) + (let* ([v1 (vector 1 2 3)] + [v2 (chaperone-vector v1 (lambda (vec i v) v) (lambda (vec i v) v) + prop:blue 89)] + [v3 (chaperone-vector v1 (lambda (vec i v) v) (lambda (vec i v) v))] + [b1 (box 0)] + [b2 (chaperone-box b1 (lambda (b v) v) (lambda (b v) v) + prop:blue 99)] + [b3 (chaperone-box b1 (lambda (b v) v) (lambda (b v) v))] + [p1 (lambda (z) z)] + [p2 (chaperone-procedure p1 (lambda (v) v) prop:blue 109)] + [p3 (chaperone-procedure p1 (lambda (v) v))]) + (define (check v1 v2 v3 val check) + (test #f blue? v1) + (test #t blue? v2) + (test #f blue? v3) + (test val blue-ref v2) + (err/rt-test (blue-ref v1)) + (err/rt-test (blue-ref v3)) + (test #t check v1) + (test #t check v2) + (test #t check v3)) + (check v1 v2 v3 89 (lambda (v) (= (vector-ref v 1) 2))) + (check b1 b2 b3 99 (lambda (b) (= (unbox b) 0))) + (check p1 p2 p3 109 (lambda (p) (= (p 77) 77))))) + +;; ---------------------------------------- + +(for-each + (lambda (make-hash) + (let ([h (chaperone-hash (make-hash) + (lambda (h k v) v) (lambda (h k v) (values k v)) + (lambda (h k) k) (lambda (h k) k))]) + (test #t chaperone? h) + (test #t hash? h) + (test #t (lambda (x) (hash? x)) h))) + (list + make-hash make-hasheq make-hasheqv + (lambda () #hash()) (lambda () #hasheq()) (lambda () #hasheqv()) + make-weak-hash make-weak-hasheq make-weak-hasheqv)) + +(for-each + (lambda (make-hash) + (let* ([h1 (make-hash)] + [get-k #f] + [get-v #f] + [set-k #f] + [set-v #f] + [remove-k #f] + [access-k #f] + [h2 (chaperone-hash h1 + (lambda (h k v) + (set! get-k k) + (set! get-v v) + v) + (lambda (h k v) + (set! set-k k) + (set! set-v v) + (values k v)) + (lambda (h k) + (set! remove-k k) + k) + (lambda (h k) + (set! access-k k) + k))] + [test (lambda (val proc . args) + ;; Avoid printign hash-table argument, which implicitly uses `ref': + (let ([got (apply proc args)]) + (test #t (format "~s ~s ~s" proc val got) (equal? val got))))]) + (test #f hash-ref h1 'key #f) + (test '(#f #f #f #f #f #f) list get-k get-v set-k set-v remove-k access-k) + (test #f hash-ref h2 'key #f) + (test '(#f #f #f #f #f #f) list get-k get-v set-k set-v remove-k access-k) + (test (void) hash-set! h1 'key 'val) + (test '(#f #f #f #f #f #f) list get-k get-v set-k set-v remove-k access-k) + (test 'val hash-ref h1 'key #f) + (test '(#f #f #f #f #f #f) list get-k get-v set-k set-v remove-k access-k) + (test 'val hash-ref h2 'key #f) + (test '(key val #f #f #f #f) list get-k get-v set-k set-v remove-k access-k) + (test (void) hash-set! h2 'key2 'val2) + (test '(key val key2 val2 #f #f) list get-k get-v set-k set-v remove-k access-k) + (test 'val2 hash-ref h1 'key2 #f) + (test '(key val key2 val2 #f #f) list get-k get-v set-k set-v remove-k access-k) + (test 'val2 hash-ref h2 'key2 #f) + (test '(key2 val2 key2 val2 #f #f) list get-k get-v set-k set-v remove-k access-k) + (test (void) hash-remove! h2 'key3) + (test '(key2 val2 key2 val2 key3 #f) list get-k get-v set-k set-v remove-k access-k) + (test 'val2 hash-ref h2 'key2) + (test '(key2 val2 key2 val2 key3 #f) list get-k get-v set-k set-v remove-k access-k) + (test (void) hash-remove! h2 'key2) + (test '(key2 val2 key2 val2 key2 #f) list get-k get-v set-k set-v remove-k access-k) + (test #f hash-ref h2 'key2 #f) + (test '(key2 val2 key2 val2 key2 #f) list get-k get-v set-k set-v remove-k access-k) + (hash-for-each h2 void) + (test '(key val key2 val2 key2 key) list get-k get-v set-k set-v remove-k access-k) + (void))) + (list + make-hash make-hasheq make-hasheqv + make-weak-hash make-weak-hasheq make-weak-hasheqv)) + +(for-each + (lambda (h1) + (let* ([get-k #f] + [get-v #f] + [set-k #f] + [set-v #f] + [remove-k #f] + [access-k #f] + [h2 (chaperone-hash h1 + (lambda (h k v) + (set! get-k k) + (set! get-v v) + v) + (lambda (h k v) + (set! set-k k) + (set! set-v v) + (values k v)) + (lambda (h k) + (set! remove-k k) + k) + (lambda (h k) + (set! access-k k) + k))] + [test (lambda (val proc . args) + ;; Avoid printign hash-table argument, which implicitly uses `ref': + (let ([got (apply proc args)]) + (test #t (format "~s ~s ~s" proc val got) (equal? val got))))]) + (test #f hash-ref h1 'key #f) + (test '(#f #f #f #f #f #f) list get-k get-v set-k set-v remove-k access-k) + (test #f hash-ref h2 'key #f) + (test '(#f #f #f #f #f #f) list get-k get-v set-k set-v remove-k access-k) + (let ([h2 (hash-set h2 'key 'val)]) + (test '(#f #f key val #f #f) list get-k get-v set-k set-v remove-k access-k) + (test 'val hash-ref h2 'key #f) + (test '(key val key val #f #f) list get-k get-v set-k set-v remove-k access-k) + (let ([h2 (hash-set h2 'key2 'val2)]) + (test '(key val key2 val2 #f #f) list get-k get-v set-k set-v remove-k access-k) + (test 'val2 hash-ref h2 'key2 #f) + (test '(key2 val2 key2 val2 #f #f) list get-k get-v set-k set-v remove-k access-k) + (let ([h2 (hash-remove h2 'key3)]) + (test '(key2 val2 key2 val2 key3 #f) list get-k get-v set-k set-v remove-k access-k) + (test 'val2 hash-ref h2 'key2) + (test '(key2 val2 key2 val2 key3 #f) list get-k get-v set-k set-v remove-k access-k) + (let ([h2 (hash-remove h2 'key2)]) + (test '(key2 val2 key2 val2 key2 #f) list get-k get-v set-k set-v remove-k access-k) + (test #f hash-ref h2 'key2 #f) + (test '(key2 val2 key2 val2 key2 #f) list get-k get-v set-k set-v remove-k access-k) + (hash-for-each h2 void) + (test '(key val key2 val2 key2 key) list get-k get-v set-k set-v remove-k access-k) + (void))))))) + (list #hash() #hasheq() #hasheqv())) + +;; ---------------------------------------- + +(let () + (define-struct a (x y) #:transparent) + (let* ([a1 (make-a 1 2)] + [got? #f] + [a2 (chaperone-struct a1 a-x (lambda (a v) v) + struct-info (lambda (s ?) + (set! got? #t) + (values s ?)))] + [got2? #f] + [a3 (chaperone-struct a2 a-x (lambda (a v) v) + struct-info (lambda (s ?) + (set! got2? #t) + (values s ?)))]) + (test-values (list struct:a #f) (lambda () (struct-info a1))) + (test #f values got?) + (test-values (list struct:a #f) (lambda () (struct-info a2))) + (test #t values got?) + (set! got? #f) + (test-values (list struct:a #f) (lambda () (struct-info a3))) + (test #t values got?) + (test #t values got2?))) + +;; ---------------------------------------- + +(let () + (define-struct a (x y) #:transparent) + (let* ([got? #f] + [constr? #f] + [guarded? #f] + [struct:a2 (chaperone-struct-type + struct:a + (lambda (name init-cnt auto-cnt acc mut imms super skipped?) + (set! got? #t) + (values name init-cnt auto-cnt acc mut imms super skipped?)) + (lambda (c) + (set! constr? #t) + c) + (lambda (x y name) + (set! guarded? #t) + (values x y)))]) + (test #t struct-type? struct:a2) + (let-values ([(name init-cnt auto-cnt acc mut imms super skipped?) + (struct-type-info struct:a2)]) + (test #t values got?) + (test '(a 2 0 #f #f) values (list name init-cnt auto-cnt super skipped?))) + (test #f values constr?) + (test #t procedure? (struct-type-make-constructor struct:a2)) + (test #t values constr?) + (let () + (define-struct b (z) #:super struct:a2) + (test #f values guarded?) + (make-b 1 2 3) + (test #t values guarded?)))) + +;; ---------------------------------------- + +(report-errs) diff --git a/collects/tests/mzscheme/mz-tests.ss b/collects/tests/mzscheme/mz-tests.ss index 10f70a3066..f6a1f16a8d 100644 --- a/collects/tests/mzscheme/mz-tests.ss +++ b/collects/tests/mzscheme/mz-tests.ss @@ -25,6 +25,7 @@ (load-relative "will.ss") (load-relative "namespac.ss") (load-relative "modprot.ss") +(load-relative "chaperone.ss") (unless (or building-flat-tests? in-drscheme?) (load-relative "param.ss")) (load-relative "port.ss") diff --git a/collects/tests/mzscheme/optimize.ss b/collects/tests/mzscheme/optimize.ss index f3f7d7cc53..ce0953a310 100644 --- a/collects/tests/mzscheme/optimize.ss +++ b/collects/tests/mzscheme/optimize.ss @@ -558,6 +558,12 @@ (test-setter make-string #\a #\7 'string-set! string-set! string-ref #f) (test-setter make-flvector 1.0 7.0 'flvector-set! flvector-set! flvector-ref #f)) + (let ([v (box 1)]) + (check-error-message 'set-box! (eval `(lambda (x) (set-box! x 10)))) + (tri0 (void) '(lambda (b i v) (set-box! b v)) + (lambda () v) 0 "other" + (lambda () (test "other" unbox v)))) + )) (define (comp=? c1 c2) diff --git a/collects/tests/mzscheme/unsafe.ss b/collects/tests/mzscheme/unsafe.ss index 53f6083a71..bde2372d42 100644 --- a/collects/tests/mzscheme/unsafe.ss +++ b/collects/tests/mzscheme/unsafe.ss @@ -8,6 +8,8 @@ scheme/foreign) (let () + (define ((add-star str) sym) + (string->symbol (regexp-replace str (symbol->string sym) (string-append str "*")))) (define (test-tri result proc x y z #:pre [pre void] #:post [post (lambda (x) x)] @@ -49,24 +51,42 @@ (test-bin 3 'unsafe-fx+ 1 2) (test-bin -1 'unsafe-fx+ 1 -2) + (test-bin 12 'unsafe-fx+ 12 0) + (test-bin -12 'unsafe-fx+ 0 -12) (test-bin 8 'unsafe-fx- 10 2) (test-bin 3 'unsafe-fx- 1 -2) + (test-bin 13 'unsafe-fx- 13 0) (test-bin 20 'unsafe-fx* 10 2) (test-bin -20 'unsafe-fx* 10 -2) + (test-bin -2 'unsafe-fx* 1 -2) + (test-bin -21 'unsafe-fx* -21 1) + (test-bin 0 'unsafe-fx* 0 -2) + (test-bin 0 'unsafe-fx* -21 0) (test-bin 3 'unsafe-fxquotient 17 5) (test-bin -3 'unsafe-fxquotient 17 -5) + (test-bin 0 'unsafe-fxquotient 0 -5) + (test-bin 18 'unsafe-fxquotient 18 1) (test-bin 2 'unsafe-fxremainder 17 5) (test-bin 2 'unsafe-fxremainder 17 -5) + (test-bin 0 'unsafe-fxremainder 0 -5) + (test-bin 0 'unsafe-fxremainder 10 1) + + (test-bin 2 'unsafe-fxmodulo 17 5) + (test-bin -3 'unsafe-fxmodulo 17 -5) + (test-bin 0 'unsafe-fxmodulo 0 -5) + (test-bin 0 'unsafe-fxmodulo 10 1) (test-bin 3.4 'unsafe-fl+ 1.4 2.0) (test-bin -1.1 'unsafe-fl+ 1.0 -2.1) (test-bin +inf.0 'unsafe-fl+ 1.0 +inf.0) (test-bin -inf.0 'unsafe-fl+ 1.0 -inf.0) (test-bin +nan.0 'unsafe-fl+ +nan.0 -inf.0) + (test-bin 1.5 'unsafe-fl+ 1.5 0.0) + (test-bin 1.7 'unsafe-fl+ 0.0 1.7) (test-bin #f unsafe-fx= 1 2) (test-bin #t unsafe-fx= 2 2) @@ -96,13 +116,18 @@ (test-bin 7.9 'unsafe-fl- 10.0 2.1) (test-bin 3.7 'unsafe-fl- 1.0 -2.7) + (test-bin 1.5 'unsafe-fl- 1.5 0.0) (test-bin 20.02 'unsafe-fl* 10.01 2.0) (test-bin -20.02 'unsafe-fl* 10.01 -2.0) + (test-bin +nan.0 'unsafe-fl* +inf.0 0.0) + (test-bin 1.8 'unsafe-fl* 1.0 1.8) + (test-bin 1.81 'unsafe-fl* 1.81 1.0) (test-bin (exact->inexact 17/5) 'unsafe-fl/ 17.0 5.0) (test-bin +inf.0 'unsafe-fl/ 17.0 0.0) (test-bin -inf.0 'unsafe-fl/ -17.0 0.0) + (test-bin 1.5 'unsafe-fl/ 1.5 1.0) (test-bin 3 'unsafe-fxand 7 3) (test-bin 2 'unsafe-fxand 6 3) @@ -183,13 +208,24 @@ #:post (lambda (x) (mcdr v)) #:literal-ok? #f)) - (test-bin 5 'unsafe-vector-ref #(1 5 7) 1) - (test-un 3 'unsafe-vector-length #(1 5 7)) - (let ([v (vector 0 3 7)]) - (test-tri (list (void) 5) 'unsafe-vector-set! v 2 5 - #:pre (lambda () (vector-set! v 2 0)) - #:post (lambda (x) (list x (vector-ref v 2))) - #:literal-ok? #f)) + (for ([star (list values (add-star "vector"))]) + (test-un 3 (star 'unsafe-unbox) #&3) + (let ([b (box 12)]) + (test-tri (list (void) 8) + `(lambda (b i val) (,(star 'unsafe-set-box!) b val)) + b 0 8 + #:pre (lambda () (set-box! b 12)) + #:post (lambda (x) (list x (unbox b))) + #:literal-ok? #f))) + + (for ([star (list values (add-star "vector"))]) + (test-bin 5 (star 'unsafe-vector-ref) #(1 5 7) 1) + (test-un 3 (star 'unsafe-vector-length) #(1 5 7)) + (let ([v (vector 0 3 7)]) + (test-tri (list (void) 5) (star 'unsafe-vector-set!) v 2 5 + #:pre (lambda () (vector-set! v 2 0)) + #:post (lambda (x) (list x (vector-ref v 2))) + #:literal-ok? #f))) (test-bin 53 'unsafe-bytes-ref #"157" 1) (test-un 3 'unsafe-bytes-length #"157") @@ -222,7 +258,7 @@ #:post (lambda (x) (list x (f64vector-ref v 2))) #:literal-ok? #f)) - (let () + (for ([star (list values (add-star "star"))]) (define-struct posn (x [y #:mutable] z)) (test-bin 'a unsafe-struct-ref (make-posn 'a 'b 'c) 0 #:literal-ok? #f) (test-bin 'b unsafe-struct-ref (make-posn 'a 'b 'c) 1 #:literal-ok? #f) diff --git a/src/mzscheme/include/mzscheme.exp b/src/mzscheme/include/mzscheme.exp index b0c01aa5e2..69ce8eb2cb 100644 --- a/src/mzscheme/include/mzscheme.exp +++ b/src/mzscheme/include/mzscheme.exp @@ -529,6 +529,7 @@ scheme_struct_set scheme_make_struct_type_property scheme_make_struct_type_property_w_guard scheme_struct_type_property_ref +scheme_chaperone_struct_type_property_ref scheme_make_location scheme_is_location scheme_make_inspector @@ -536,6 +537,7 @@ scheme_is_subinspector scheme_eq scheme_eqv scheme_equal +scheme_chaperone_of scheme_equal_hash_key scheme_equal_hash_key2 scheme_recur_equal_hash_key diff --git a/src/mzscheme/include/mzscheme3m.exp b/src/mzscheme/include/mzscheme3m.exp index 0a25a51468..17b5aed4c7 100644 --- a/src/mzscheme/include/mzscheme3m.exp +++ b/src/mzscheme/include/mzscheme3m.exp @@ -535,6 +535,7 @@ scheme_struct_set scheme_make_struct_type_property scheme_make_struct_type_property_w_guard scheme_struct_type_property_ref +scheme_chaperone_struct_type_property_ref scheme_make_location scheme_is_location scheme_make_inspector @@ -542,6 +543,7 @@ scheme_is_subinspector scheme_eq scheme_eqv scheme_equal +scheme_chaperone_of scheme_hash_key scheme_equal_hash_key scheme_equal_hash_key2 diff --git a/src/mzscheme/include/mzwin.def b/src/mzscheme/include/mzwin.def index 54b90ec7db..ed148f3095 100644 --- a/src/mzscheme/include/mzwin.def +++ b/src/mzscheme/include/mzwin.def @@ -512,6 +512,7 @@ EXPORTS scheme_make_struct_type_property scheme_make_struct_type_property_w_guard scheme_struct_type_property_ref + scheme_chaperone_struct_type_property_ref scheme_make_location scheme_is_location scheme_make_inspector @@ -519,6 +520,7 @@ EXPORTS scheme_eq scheme_eqv scheme_equal + scheme_chaperone_of scheme_equal_hash_key scheme_equal_hash_key2 scheme_recur_equal_hash_key diff --git a/src/mzscheme/include/mzwin3m.def b/src/mzscheme/include/mzwin3m.def index 1be6adf155..b8b2141e4b 100644 --- a/src/mzscheme/include/mzwin3m.def +++ b/src/mzscheme/include/mzwin3m.def @@ -527,6 +527,7 @@ EXPORTS scheme_make_struct_type_property scheme_make_struct_type_property_w_guard scheme_struct_type_property_ref + scheme_chaperone_struct_type_property_ref scheme_make_location scheme_is_location scheme_make_inspector @@ -534,6 +535,7 @@ EXPORTS scheme_eq scheme_eqv scheme_equal + scheme_chaperone_of scheme_hash_key scheme_equal_hash_key scheme_equal_hash_key2 diff --git a/src/mzscheme/include/scheme.h b/src/mzscheme/include/scheme.h index c47d287cb0..7ee0f91035 100644 --- a/src/mzscheme/include/scheme.h +++ b/src/mzscheme/include/scheme.h @@ -445,6 +445,9 @@ typedef long (*Scheme_Secondary_Hash_Proc)(Scheme_Object *obj, void *cycle_data) #define SCHEME_STXP(obj) SAME_TYPE(SCHEME_TYPE(obj), scheme_stx_type) +#define SCHEME_CHAPERONEP(obj) (SAME_TYPE(SCHEME_TYPE(obj), scheme_chaperone_type) \ + || SAME_TYPE(SCHEME_TYPE(obj), scheme_proc_chaperone_type)) + #define SCHEME_UDPP(obj) SAME_TYPE(SCHEME_TYPE(obj), scheme_udp_type) #define SCHEME_UDP_EVTP(obj) SAME_TYPE(SCHEME_TYPE(obj), scheme_udp_evt_type) @@ -615,9 +618,8 @@ typedef struct Scheme_Offset_Cptr #define SCHEME_PRIM_IS_PRIMITIVE 4 #define SCHEME_PRIM_IS_STRUCT_INDEXED_GETTER 8 #define SCHEME_PRIM_IS_STRUCT_PRED 16 -#define SCHEME_PRIM_IS_PARAMETER 32 -#define SCHEME_PRIM_IS_STRUCT_OTHER 64 -#define SCHEME_PRIM_STRUCT_OTHER_TYPE_MASK (128 | 256) +#define SCHEME_PRIM_IS_STRUCT_OTHER 32 +#define SCHEME_PRIM_OTHER_TYPE_MASK (64 | 128 | 256) #define SCHEME_PRIM_IS_MULTI_RESULT 512 #define SCHEME_PRIM_IS_BINARY_INLINED 1024 #define SCHEME_PRIM_IS_UNSAFE_FUNCTIONAL 2048 @@ -631,11 +633,14 @@ typedef struct Scheme_Offset_Cptr #define SCHEME_PRIM_OPT_IMMEDIATE 2 #define SCHEME_PRIM_OPT_NONCM 1 -/* Values with SCHEME_PRIM_STRUCT_OTHER_TYPE_MASK */ +/* Values with SCHEME_PRIM_OTHER_TYPE_MASK */ #define SCHEME_PRIM_STRUCT_TYPE_INDEXLESS_GETTER 0 #define SCHEME_PRIM_STRUCT_TYPE_CONSTR 128 #define SCHEME_PRIM_STRUCT_TYPE_INDEXLESS_SETTER 256 #define SCHEME_PRIM_STRUCT_TYPE_INDEXED_SETTER (128 | 256) +#define SCHEME_PRIM_TYPE_PARAMETER 64 +#define SCHEME_PRIM_TYPE_STRUCT_PROP_GETTER (64 | 128) +/* combinations still available: 64|256, 64|128|256 */ #define SCHEME_PRIM_IS_STRUCT_PROC (SCHEME_PRIM_IS_STRUCT_INDEXED_GETTER | SCHEME_PRIM_IS_STRUCT_PRED | SCHEME_PRIM_IS_STRUCT_OTHER) @@ -752,7 +757,7 @@ typedef struct { /* ------------------------------------------------- */ -#define SCHEME_PROCP(obj) (!SCHEME_INTP(obj) && ((_SCHEME_TYPE(obj) >= scheme_prim_type) && (_SCHEME_TYPE(obj) <= scheme_native_closure_type))) +#define SCHEME_PROCP(obj) (!SCHEME_INTP(obj) && ((_SCHEME_TYPE(obj) >= scheme_prim_type) && (_SCHEME_TYPE(obj) <= scheme_proc_chaperone_type))) #define SCHEME_SYNTAXP(obj) SAME_TYPE(SCHEME_TYPE(obj), scheme_syntax_compiler_type) #define SCHEME_PRIMP(obj) SAME_TYPE(SCHEME_TYPE(obj), scheme_prim_type) #define SCHEME_CLSD_PRIMP(obj) SAME_TYPE(SCHEME_TYPE(obj), scheme_closed_prim_type) diff --git a/src/mzscheme/src/bool.c b/src/mzscheme/src/bool.c index 060347986f..37c01c4498 100644 --- a/src/mzscheme/src/bool.c +++ b/src/mzscheme/src/bool.c @@ -46,6 +46,8 @@ static Scheme_Object *eq_prim (int argc, Scheme_Object *argv[]); static Scheme_Object *eqv_prim (int argc, Scheme_Object *argv[]); static Scheme_Object *equal_prim (int argc, Scheme_Object *argv[]); static Scheme_Object *equalish_prim (int argc, Scheme_Object *argv[]); +static Scheme_Object *chaperone_p (int argc, Scheme_Object *argv[]); +static Scheme_Object *chaperone_of (int argc, Scheme_Object *argv[]); typedef struct Equal_Info { long depth; /* always odd, so it looks like a fixnum */ @@ -53,6 +55,7 @@ typedef struct Equal_Info { Scheme_Hash_Table *ht; Scheme_Object *recur; Scheme_Object *next, *next_next; + int for_chaperone; } Equal_Info; static int is_equal (Scheme_Object *obj1, Scheme_Object *obj2, Equal_Info *eql); @@ -98,6 +101,14 @@ void scheme_init_bool (Scheme_Env *env) scheme_add_global_constant("equal?/recur", scheme_make_prim_w_arity(equalish_prim, "equal?/recur", 3, 3), env); + + p = scheme_make_immed_prim(chaperone_p, "chaperone?", 1, 1); + SCHEME_PRIM_PROC_FLAGS(p) |= SCHEME_PRIM_IS_UNARY_INLINED; + scheme_add_global_constant("chaperone?", p, env); + + scheme_add_global_constant("chaperone-of?", + scheme_make_prim_w_arity(chaperone_of, "chaperone-of?", 2, 2), + env); } static Scheme_Object * @@ -135,6 +146,7 @@ equal_prim (int argc, Scheme_Object *argv[]) eql.recur = NULL; eql.next = NULL; eql.next_next = NULL; + eql.for_chaperone = 0; return (is_equal(argv[0], argv[1], &eql) ? scheme_true : scheme_false); } @@ -152,6 +164,7 @@ equalish_prim (int argc, Scheme_Object *argv[]) eql.recur = NULL; eql.next = NULL; eql.next_next = argv[2]; + eql.for_chaperone = 0; return (is_equal(argv[0], argv[1], &eql) ? scheme_true : scheme_false); } @@ -246,6 +259,7 @@ int scheme_equal (Scheme_Object *obj1, Scheme_Object *obj2) eql.recur = NULL; eql.next_next = NULL; eql.next = NULL; + eql.for_chaperone = 0; return is_equal(obj1, obj2, &eql); } @@ -342,7 +356,6 @@ static int is_equal_overflow(Scheme_Object *obj1, Scheme_Object *obj2, Equal_Inf int is_equal (Scheme_Object *obj1, Scheme_Object *obj2, Equal_Info *eql) { - top: if (eql->next_next) { if (eql->next) { @@ -357,7 +370,20 @@ int is_equal (Scheme_Object *obj1, Scheme_Object *obj2, Equal_Info *eql) if (scheme_eqv(obj1, obj2)) return 1; - else if (NOT_SAME_TYPE(SCHEME_TYPE(obj1), SCHEME_TYPE(obj2))) { + else if (eql->for_chaperone && SCHEME_CHAPERONEP(obj1)) { + obj1 = ((Scheme_Chaperone *)obj1)->prev; + goto top; + } else if (NOT_SAME_TYPE(SCHEME_TYPE(obj1), SCHEME_TYPE(obj2))) { + if (!eql->for_chaperone) { + if (SCHEME_CHAPERONEP(obj1)) { + obj1 = ((Scheme_Chaperone *)obj1)->val; + goto top; + } + if (SCHEME_CHAPERONEP(obj2)) { + obj2 = ((Scheme_Chaperone *)obj2)->val; + goto top; + } + } return 0; } else if (SCHEME_PAIRP(obj1)) { # include "mzeqchk.inc" @@ -375,6 +401,8 @@ int is_equal (Scheme_Object *obj1, Scheme_Object *obj2, Equal_Info *eql) return 0; } else if (SCHEME_MUTABLE_PAIRP(obj1)) { # include "mzeqchk.inc" + if (eql->for_chaperone) + return 0; if (union_check(obj1, obj2, eql)) return 1; if (is_equal(SCHEME_CAR(obj1), SCHEME_CAR(obj2), eql)) { @@ -385,6 +413,9 @@ int is_equal (Scheme_Object *obj1, Scheme_Object *obj2, Equal_Info *eql) return 0; } else if (SCHEME_VECTORP(obj1)) { # include "mzeqchk.inc" + if (eql->for_chaperone && (!SCHEME_IMMUTABLEP(obj1) + || !SCHEME_IMMUTABLEP(obj2))) + return 0; if (union_check(obj1, obj2, eql)) return 1; return vector_equal(obj1, obj2, eql); @@ -404,12 +435,18 @@ int is_equal (Scheme_Object *obj1, Scheme_Object *obj2, Equal_Info *eql) } else if (SCHEME_BYTE_STRINGP(obj1) || SCHEME_GENERAL_PATHP(obj1)) { int l1, l2; + if (eql->for_chaperone && (!SCHEME_IMMUTABLEP(obj1) + || !SCHEME_IMMUTABLEP(obj2))) + return 0; l1 = SCHEME_BYTE_STRTAG_VAL(obj1); l2 = SCHEME_BYTE_STRTAG_VAL(obj2); return ((l1 == l2) && !memcmp(SCHEME_BYTE_STR_VAL(obj1), SCHEME_BYTE_STR_VAL(obj2), l1)); } else if (SCHEME_CHAR_STRINGP(obj1)) { int l1, l2; + if (eql->for_chaperone && (!SCHEME_IMMUTABLEP(obj1) + || !SCHEME_IMMUTABLEP(obj2))) + return 0; l1 = SCHEME_CHAR_STRTAG_VAL(obj1); l2 = SCHEME_CHAR_STRTAG_VAL(obj2); return ((l1 == l2) @@ -421,12 +458,16 @@ int is_equal (Scheme_Object *obj1, Scheme_Object *obj2, Equal_Info *eql) st1 = SCHEME_STRUCT_TYPE(obj1); st2 = SCHEME_STRUCT_TYPE(obj2); - procs1 = scheme_struct_type_property_ref(scheme_equal_property, (Scheme_Object *)st1); - if (procs1 && (st1 != st2)) { - procs2 = scheme_struct_type_property_ref(scheme_equal_property, (Scheme_Object *)st2); - if (!procs2 - || !SAME_OBJ(SCHEME_VEC_ELS(procs1)[0], SCHEME_VEC_ELS(procs2)[0])) - procs1 = NULL; + if (eql->for_chaperone) { + procs1 = NULL; + } else { + procs1 = scheme_struct_type_property_ref(scheme_equal_property, (Scheme_Object *)st1); + if (procs1 && (st1 != st2)) { + procs2 = scheme_struct_type_property_ref(scheme_equal_property, (Scheme_Object *)st2); + if (!procs2 + || !SAME_OBJ(SCHEME_VEC_ELS(procs1)[0], SCHEME_VEC_ELS(procs2)[0])) + procs1 = NULL; + } } if (procs1) { @@ -466,9 +507,12 @@ int is_equal (Scheme_Object *obj1, Scheme_Object *obj2, Equal_Info *eql) return SCHEME_TRUEP(recur); } else if (st1 != st2) { return 0; + } else if (eql->for_chaperone + && !(MZ_OPT_HASH_KEY(&st1->iso) & STRUCT_TYPE_ALL_IMMUTABLE)) { + return 0; } else { - /* Same types, but doesn't have an equality property, - so check transparency: */ + /* Same types, but doesn't have an equality property + (or checking for chaperone), so check transparency: */ Scheme_Object *insp; insp = scheme_get_param(scheme_current_config(), MZCONFIG_INSPECTOR); if (scheme_inspector_sees_part(obj1, insp, -2) @@ -482,6 +526,9 @@ int is_equal (Scheme_Object *obj1, Scheme_Object *obj2, Equal_Info *eql) } } else if (SCHEME_BOXP(obj1)) { SCHEME_USE_FUEL(1); + if (eql->for_chaperone && (!SCHEME_IMMUTABLEP(obj1) + || !SCHEME_IMMUTABLEP(obj2))) + return 0; if (union_check(obj1, obj2, eql)) return 1; obj1 = SCHEME_BOX_VAL(obj1); @@ -489,6 +536,8 @@ int is_equal (Scheme_Object *obj1, Scheme_Object *obj2, Equal_Info *eql) goto top; } else if (SCHEME_HASHTP(obj1)) { # include "mzeqchk.inc" + if (eql->for_chaperone) + return 0; if (union_check(obj1, obj2, eql)) return 1; return scheme_hash_table_equal_rec((Scheme_Hash_Table *)obj1, (Scheme_Hash_Table *)obj2, eql); @@ -499,6 +548,8 @@ int is_equal (Scheme_Object *obj1, Scheme_Object *obj2, Equal_Info *eql) return scheme_hash_tree_equal_rec((Scheme_Hash_Tree *)obj1, (Scheme_Hash_Tree *)obj2, eql); } else if (SCHEME_BUCKTP(obj1)) { # include "mzeqchk.inc" + if (eql->for_chaperone) + return 0; if (union_check(obj1, obj2, eql)) return 1; return scheme_bucket_table_equal_rec((Scheme_Bucket_Table *)obj1, (Scheme_Bucket_Table *)obj2, eql); @@ -568,3 +619,28 @@ Scheme_Object * scheme_make_false (void) { return scheme_false; } + +static Scheme_Object *chaperone_p(int argc, Scheme_Object *argv[]) +{ + return (SCHEME_CHAPERONEP(argv[0]) ? scheme_true : scheme_false); +} + +static Scheme_Object *chaperone_of(int argc, Scheme_Object *argv[]) +{ + return (scheme_chaperone_of(argv[0], argv[1]) ? scheme_true : scheme_false); +} + +int scheme_chaperone_of(Scheme_Object *obj1, Scheme_Object *obj2) +{ + Equal_Info eql; + + eql.depth = 1; + eql.car_depth = 1; + eql.ht = NULL; + eql.recur = NULL; + eql.next = NULL; + eql.next_next = NULL; + eql.for_chaperone = 1; + + return is_equal(obj1, obj2, &eql); +} diff --git a/src/mzscheme/src/cstartup.inc b/src/mzscheme/src/cstartup.inc index 5a1ec4b528..84812dd35a 100644 --- a/src/mzscheme/src/cstartup.inc +++ b/src/mzscheme/src/cstartup.inc @@ -1,105 +1,105 @@ { - SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,52,46,50,46,52,46,53,50,0,0,0,1,0,0,3,0,12,0, -17,0,20,0,27,0,34,0,38,0,51,0,56,0,63,0,68,0,72,0,78, + SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,52,46,50,46,53,46,51,50,0,0,0,1,0,0,3,0,12,0, +25,0,30,0,33,0,40,0,47,0,51,0,58,0,63,0,68,0,72,0,78, 0,92,0,106,0,109,0,115,0,119,0,121,0,132,0,134,0,148,0,155,0, 177,0,179,0,193,0,4,1,33,1,44,1,55,1,65,1,101,1,134,1,167, 1,226,1,36,2,114,2,180,2,185,2,205,2,96,3,116,3,167,3,233,3, 118,4,4,5,56,5,79,5,158,5,0,0,105,7,0,0,29,11,11,68,104, -101,114,101,45,115,116,120,64,99,111,110,100,62,111,114,66,108,101,116,114,101, -99,66,117,110,108,101,115,115,63,108,101,116,72,112,97,114,97,109,101,116,101, -114,105,122,101,64,119,104,101,110,66,100,101,102,105,110,101,64,108,101,116,42, +101,114,101,45,115,116,120,72,112,97,114,97,109,101,116,101,114,105,122,101,64, +99,111,110,100,62,111,114,66,108,101,116,114,101,99,66,117,110,108,101,115,115, +63,108,101,116,66,100,101,102,105,110,101,64,119,104,101,110,64,108,101,116,42, 63,97,110,100,65,113,117,111,116,101,29,94,2,13,68,35,37,107,101,114,110, 101,108,11,29,94,2,13,68,35,37,112,97,114,97,109,122,11,62,105,102,65, 98,101,103,105,110,63,115,116,120,61,115,70,108,101,116,45,118,97,108,117,101, 115,61,120,73,108,101,116,114,101,99,45,118,97,108,117,101,115,66,108,97,109, 98,100,97,1,20,112,97,114,97,109,101,116,101,114,105,122,97,116,105,111,110, 45,107,101,121,61,118,73,100,101,102,105,110,101,45,118,97,108,117,101,115,97, -35,11,8,240,161,75,0,0,95,159,2,15,35,35,159,2,14,35,35,159,2, -14,35,35,16,20,2,3,2,1,2,5,2,1,2,6,2,1,2,7,2,1, -2,8,2,1,2,9,2,1,2,4,2,1,2,10,2,1,2,11,2,1,2, -12,2,1,97,36,11,8,240,161,75,0,0,93,159,2,14,35,36,16,2,2, -2,161,2,1,36,2,2,2,1,2,2,96,11,11,8,240,161,75,0,0,16, -0,96,37,11,8,240,161,75,0,0,16,0,13,16,4,35,29,11,11,2,1, +35,11,8,240,164,75,0,0,95,159,2,15,35,35,159,2,14,35,35,159,2, +14,35,35,16,20,2,3,2,1,2,4,2,1,2,6,2,1,2,7,2,1, +2,8,2,1,2,9,2,1,2,10,2,1,2,5,2,1,2,11,2,1,2, +12,2,1,97,36,11,8,240,164,75,0,0,93,159,2,14,35,36,16,2,2, +2,161,2,1,36,2,2,2,1,2,2,96,37,11,8,240,164,75,0,0,16, +0,96,11,11,8,240,164,75,0,0,16,0,13,16,4,35,29,11,11,2,1, 11,18,16,2,99,64,104,101,114,101,8,31,8,30,8,29,8,28,8,27,93, -8,224,168,75,0,0,95,9,8,224,168,75,0,0,2,1,27,248,22,139,4, -195,249,22,132,4,80,158,38,35,251,22,79,2,16,248,22,94,199,12,249,22, -69,2,17,248,22,96,201,27,248,22,139,4,195,249,22,132,4,80,158,38,35, -251,22,79,2,16,248,22,94,199,249,22,69,2,17,248,22,96,201,12,27,248, -22,71,248,22,139,4,196,28,248,22,77,193,20,15,159,36,35,36,28,248,22, -77,248,22,71,194,248,22,70,193,249,22,132,4,80,158,38,35,251,22,79,2, -16,248,22,70,199,249,22,69,2,12,248,22,71,201,11,18,16,2,101,10,8, +8,224,171,75,0,0,95,9,8,224,171,75,0,0,2,1,27,248,22,142,4, +195,249,22,135,4,80,158,38,35,251,22,80,2,16,248,22,95,199,12,249,22, +70,2,17,248,22,97,201,27,248,22,142,4,195,249,22,135,4,80,158,38,35, +251,22,80,2,16,248,22,95,199,249,22,70,2,17,248,22,97,201,12,27,248, +22,72,248,22,142,4,196,28,248,22,78,193,20,15,159,36,35,36,28,248,22, +78,248,22,72,194,248,22,71,193,249,22,135,4,80,158,38,35,251,22,80,2, +16,248,22,71,199,249,22,70,2,12,248,22,72,201,11,18,16,2,101,10,8, 31,8,30,8,29,8,28,8,27,16,4,11,11,2,18,3,1,8,101,110,118, -49,50,53,56,48,16,4,11,11,2,19,3,1,8,101,110,118,49,50,53,56, -49,93,8,224,169,75,0,0,95,9,8,224,169,75,0,0,2,1,27,248,22, -71,248,22,139,4,196,28,248,22,77,193,20,15,159,36,35,36,28,248,22,77, -248,22,71,194,248,22,70,193,249,22,132,4,80,158,38,35,250,22,79,2,20, -248,22,79,249,22,79,248,22,79,2,21,248,22,70,201,251,22,79,2,16,2, -21,2,21,249,22,69,2,4,248,22,71,204,18,16,2,101,11,8,31,8,30, +49,50,53,55,55,16,4,11,11,2,19,3,1,8,101,110,118,49,50,53,55, +56,93,8,224,172,75,0,0,95,9,8,224,172,75,0,0,2,1,27,248,22, +72,248,22,142,4,196,28,248,22,78,193,20,15,159,36,35,36,28,248,22,78, +248,22,72,194,248,22,71,193,249,22,135,4,80,158,38,35,250,22,80,2,20, +248,22,80,249,22,80,248,22,80,2,21,248,22,71,201,251,22,80,2,16,2, +21,2,21,249,22,70,2,5,248,22,72,204,18,16,2,101,11,8,31,8,30, 8,29,8,28,8,27,16,4,11,11,2,18,3,1,8,101,110,118,49,50,53, -56,51,16,4,11,11,2,19,3,1,8,101,110,118,49,50,53,56,52,93,8, -224,170,75,0,0,95,9,8,224,170,75,0,0,2,1,248,22,139,4,193,27, -248,22,139,4,194,249,22,69,248,22,79,248,22,70,196,248,22,71,195,27,248, -22,71,248,22,139,4,23,197,1,249,22,132,4,80,158,38,35,28,248,22,54, -248,22,133,4,248,22,70,23,198,2,27,249,22,2,32,0,89,162,8,44,36, -42,9,222,33,39,248,22,139,4,248,22,94,23,200,2,250,22,79,2,22,248, -22,79,249,22,79,248,22,79,248,22,70,23,204,2,250,22,80,2,23,249,22, -2,22,70,23,204,2,248,22,96,23,206,2,249,22,69,248,22,70,23,202,1, -249,22,2,22,94,23,200,1,250,22,80,2,20,249,22,2,32,0,89,162,8, -44,36,46,9,222,33,40,248,22,139,4,248,22,70,201,248,22,71,198,27,248, -22,139,4,194,249,22,69,248,22,79,248,22,70,196,248,22,71,195,27,248,22, -71,248,22,139,4,23,197,1,249,22,132,4,80,158,38,35,250,22,80,2,22, -249,22,2,32,0,89,162,8,44,36,46,9,222,33,42,248,22,139,4,248,22, -70,201,248,22,71,198,27,248,22,71,248,22,139,4,196,27,248,22,139,4,248, -22,70,195,249,22,132,4,80,158,39,35,28,248,22,77,195,250,22,80,2,20, -9,248,22,71,199,250,22,79,2,7,248,22,79,248,22,70,199,250,22,80,2, -11,248,22,71,201,248,22,71,202,27,248,22,71,248,22,139,4,23,197,1,27, -249,22,1,22,83,249,22,2,22,139,4,248,22,139,4,248,22,70,199,249,22, -132,4,80,158,39,35,251,22,79,1,22,119,105,116,104,45,99,111,110,116,105, -110,117,97,116,105,111,110,45,109,97,114,107,2,24,250,22,80,1,23,101,120, +56,48,16,4,11,11,2,19,3,1,8,101,110,118,49,50,53,56,49,93,8, +224,173,75,0,0,95,9,8,224,173,75,0,0,2,1,248,22,142,4,193,27, +248,22,142,4,194,249,22,70,248,22,80,248,22,71,196,248,22,72,195,27,248, +22,72,248,22,142,4,23,197,1,249,22,135,4,80,158,38,35,28,248,22,55, +248,22,136,4,248,22,71,23,198,2,27,249,22,2,32,0,89,162,8,44,36, +42,9,222,33,39,248,22,142,4,248,22,95,23,200,2,250,22,80,2,22,248, +22,80,249,22,80,248,22,80,248,22,71,23,204,2,250,22,81,2,23,249,22, +2,22,71,23,204,2,248,22,97,23,206,2,249,22,70,248,22,71,23,202,1, +249,22,2,22,95,23,200,1,250,22,81,2,20,249,22,2,32,0,89,162,8, +44,36,46,9,222,33,40,248,22,142,4,248,22,71,201,248,22,72,198,27,248, +22,142,4,194,249,22,70,248,22,80,248,22,71,196,248,22,72,195,27,248,22, +72,248,22,142,4,23,197,1,249,22,135,4,80,158,38,35,250,22,81,2,22, +249,22,2,32,0,89,162,8,44,36,46,9,222,33,42,248,22,142,4,248,22, +71,201,248,22,72,198,27,248,22,72,248,22,142,4,196,27,248,22,142,4,248, +22,71,195,249,22,135,4,80,158,39,35,28,248,22,78,195,250,22,81,2,20, +9,248,22,72,199,250,22,80,2,8,248,22,80,248,22,71,199,250,22,81,2, +11,248,22,72,201,248,22,72,202,27,248,22,72,248,22,142,4,23,197,1,27, +249,22,1,22,84,249,22,2,22,142,4,248,22,142,4,248,22,71,199,249,22, +135,4,80,158,39,35,251,22,80,1,22,119,105,116,104,45,99,111,110,116,105, +110,117,97,116,105,111,110,45,109,97,114,107,2,24,250,22,81,1,23,101,120, 116,101,110,100,45,112,97,114,97,109,101,116,101,114,105,122,97,116,105,111,110, 21,95,1,27,99,111,110,116,105,110,117,97,116,105,111,110,45,109,97,114,107, -45,115,101,116,45,102,105,114,115,116,11,2,24,201,250,22,80,2,20,9,248, -22,71,203,27,248,22,71,248,22,139,4,196,28,248,22,77,193,20,15,159,36, -35,36,249,22,132,4,80,158,38,35,27,248,22,139,4,248,22,70,197,28,249, -22,171,8,62,61,62,248,22,133,4,248,22,94,196,250,22,79,2,20,248,22, -79,249,22,79,21,93,2,25,248,22,70,199,250,22,80,2,3,249,22,79,2, -25,249,22,79,248,22,103,203,2,25,248,22,71,202,251,22,79,2,16,28,249, -22,171,8,248,22,133,4,248,22,70,200,64,101,108,115,101,10,248,22,70,197, -250,22,80,2,20,9,248,22,71,200,249,22,69,2,3,248,22,71,202,100,8, +45,115,101,116,45,102,105,114,115,116,11,2,24,201,250,22,81,2,20,9,248, +22,72,203,27,248,22,72,248,22,142,4,196,28,248,22,78,193,20,15,159,36, +35,36,249,22,135,4,80,158,38,35,27,248,22,142,4,248,22,71,197,28,249, +22,175,8,62,61,62,248,22,136,4,248,22,95,196,250,22,80,2,20,248,22, +80,249,22,80,21,93,2,25,248,22,71,199,250,22,81,2,4,249,22,80,2, +25,249,22,80,248,22,104,203,2,25,248,22,72,202,251,22,80,2,16,28,249, +22,175,8,248,22,136,4,248,22,71,200,64,101,108,115,101,10,248,22,71,197, +250,22,81,2,20,9,248,22,72,200,249,22,70,2,4,248,22,72,202,100,8, 31,8,30,8,29,8,28,8,27,16,4,11,11,2,18,3,1,8,101,110,118, -49,50,54,48,54,16,4,11,11,2,19,3,1,8,101,110,118,49,50,54,48, -55,93,8,224,171,75,0,0,18,16,2,158,94,10,64,118,111,105,100,8,47, -95,9,8,224,171,75,0,0,2,1,27,248,22,71,248,22,139,4,196,249,22, -132,4,80,158,38,35,28,248,22,54,248,22,133,4,248,22,70,197,250,22,79, -2,26,248,22,79,248,22,70,199,248,22,94,198,27,248,22,133,4,248,22,70, -197,250,22,79,2,26,248,22,79,248,22,70,197,250,22,80,2,23,248,22,71, -199,248,22,71,202,159,35,20,102,159,35,16,1,11,16,0,83,158,41,20,100, +49,50,54,48,51,16,4,11,11,2,19,3,1,8,101,110,118,49,50,54,48, +52,93,8,224,174,75,0,0,18,16,2,158,94,10,64,118,111,105,100,8,47, +95,9,8,224,174,75,0,0,2,1,27,248,22,72,248,22,142,4,196,249,22, +135,4,80,158,38,35,28,248,22,55,248,22,136,4,248,22,71,197,250,22,80, +2,26,248,22,80,248,22,71,199,248,22,95,198,27,248,22,136,4,248,22,71, +197,250,22,80,2,26,248,22,80,248,22,71,197,250,22,81,2,23,248,22,72, +199,248,22,72,202,159,35,20,105,159,35,16,1,11,16,0,83,158,41,20,103, 144,69,35,37,109,105,110,45,115,116,120,2,1,11,11,11,10,35,80,158,35, -35,20,102,159,35,16,0,16,0,16,1,2,2,36,16,0,35,16,0,35,11, +35,20,105,159,35,16,0,16,0,16,1,2,2,36,16,0,35,16,0,35,11, 11,38,35,11,11,11,16,10,2,3,2,4,2,5,2,6,2,7,2,8,2, 9,2,10,2,11,2,12,16,10,11,11,11,11,11,11,11,11,11,11,16,10, 2,3,2,4,2,5,2,6,2,7,2,8,2,9,2,10,2,11,2,12,35, 45,36,11,11,11,16,0,16,0,16,0,35,35,11,11,11,11,16,0,16,0, -16,0,35,35,16,11,16,5,2,2,20,15,159,35,35,35,35,20,102,159,35, -16,0,16,1,33,32,10,16,5,2,6,89,162,8,44,36,52,9,223,0,33, -33,35,20,102,159,35,16,1,2,2,16,0,11,16,5,2,9,89,162,8,44, -36,52,9,223,0,33,34,35,20,102,159,35,16,1,2,2,16,0,11,16,5, -2,12,89,162,8,44,36,52,9,223,0,33,35,35,20,102,159,35,16,1,2, -2,16,1,33,36,11,16,5,2,4,89,162,8,44,36,55,9,223,0,33,37, -35,20,102,159,35,16,1,2,2,16,1,33,38,11,16,5,2,7,89,162,8, -44,36,57,9,223,0,33,41,35,20,102,159,35,16,1,2,2,16,0,11,16, -5,2,5,89,162,8,44,36,52,9,223,0,33,43,35,20,102,159,35,16,1, +16,0,35,35,16,11,16,5,2,2,20,15,159,35,35,35,35,20,105,159,35, +16,0,16,1,33,32,10,16,5,2,7,89,162,8,44,36,52,9,223,0,33, +33,35,20,105,159,35,16,1,2,2,16,0,11,16,5,2,10,89,162,8,44, +36,52,9,223,0,33,34,35,20,105,159,35,16,1,2,2,16,0,11,16,5, +2,12,89,162,8,44,36,52,9,223,0,33,35,35,20,105,159,35,16,1,2, +2,16,1,33,36,11,16,5,2,5,89,162,8,44,36,55,9,223,0,33,37, +35,20,105,159,35,16,1,2,2,16,1,33,38,11,16,5,2,8,89,162,8, +44,36,57,9,223,0,33,41,35,20,105,159,35,16,1,2,2,16,0,11,16, +5,2,6,89,162,8,44,36,52,9,223,0,33,43,35,20,105,159,35,16,1, 2,2,16,0,11,16,5,2,11,89,162,8,44,36,53,9,223,0,33,44,35, -20,102,159,35,16,1,2,2,16,0,11,16,5,2,8,89,162,8,44,36,54, -9,223,0,33,45,35,20,102,159,35,16,1,2,2,16,0,11,16,5,2,3, -89,162,8,44,36,57,9,223,0,33,46,35,20,102,159,35,16,1,2,2,16, -1,33,48,11,16,5,2,10,89,162,8,44,36,53,9,223,0,33,49,35,20, -102,159,35,16,1,2,2,16,0,11,16,0,94,2,14,2,15,93,2,14,9, +20,105,159,35,16,1,2,2,16,0,11,16,5,2,3,89,162,8,44,36,54, +9,223,0,33,45,35,20,105,159,35,16,1,2,2,16,0,11,16,5,2,4, +89,162,8,44,36,57,9,223,0,33,46,35,20,105,159,35,16,1,2,2,16, +1,33,48,11,16,5,2,9,89,162,8,44,36,53,9,223,0,33,49,35,20, +105,159,35,16,1,2,2,16,0,11,16,0,94,2,14,2,15,93,2,14,9, 9,35,0}; EVAL_ONE_SIZED_STR((char *)expr, 2018); } { - SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,52,46,50,46,52,46,53,64,0,0,0,1,0,0,13,0,18,0, + SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,52,46,50,46,53,46,51,64,0,0,0,1,0,0,13,0,18,0, 35,0,50,0,68,0,84,0,94,0,112,0,132,0,148,0,166,0,197,0,226, 0,248,0,6,1,12,1,26,1,31,1,41,1,49,1,77,1,109,1,115,1, 160,1,205,1,229,1,12,2,14,2,71,2,161,3,202,3,19,5,105,5,191, @@ -132,231 +132,231 @@ 114,105,110,103,6,36,36,99,97,110,110,111,116,32,97,100,100,32,97,32,115, 117,102,102,105,120,32,116,111,32,97,32,114,111,111,116,32,112,97,116,104,58, 32,5,0,27,20,14,159,80,158,36,50,250,80,158,39,51,249,22,27,11,80, -158,41,50,22,132,13,10,248,22,164,5,23,196,2,28,248,22,161,6,23,194, -2,12,87,94,248,22,175,8,23,194,1,248,80,159,37,53,36,195,28,248,22, -77,23,195,2,9,27,248,22,70,23,196,2,27,28,248,22,178,13,23,195,2, -23,194,1,28,248,22,177,13,23,195,2,249,22,179,13,23,196,1,250,80,158, -42,48,248,22,130,14,2,19,11,10,250,80,158,40,48,248,22,130,14,2,19, -23,197,1,10,28,23,193,2,249,22,69,248,22,181,13,249,22,179,13,23,198, -1,247,22,131,14,27,248,22,71,23,200,1,28,248,22,77,23,194,2,9,27, -248,22,70,23,195,2,27,28,248,22,178,13,23,195,2,23,194,1,28,248,22, -177,13,23,195,2,249,22,179,13,23,196,1,250,80,158,47,48,248,22,130,14, -2,19,11,10,250,80,158,45,48,248,22,130,14,2,19,23,197,1,10,28,23, -193,2,249,22,69,248,22,181,13,249,22,179,13,23,198,1,247,22,131,14,248, -80,159,45,52,36,248,22,71,23,199,1,87,94,23,193,1,248,80,159,43,52, -36,248,22,71,23,197,1,87,94,23,193,1,27,248,22,71,23,198,1,28,248, -22,77,23,194,2,9,27,248,22,70,23,195,2,27,28,248,22,178,13,23,195, -2,23,194,1,28,248,22,177,13,23,195,2,249,22,179,13,23,196,1,250,80, -158,45,48,248,22,130,14,2,19,11,10,250,80,158,43,48,248,22,130,14,2, -19,23,197,1,10,28,23,193,2,249,22,69,248,22,181,13,249,22,179,13,23, -198,1,247,22,131,14,248,80,159,43,52,36,248,22,71,23,199,1,248,80,159, -41,52,36,248,22,71,196,27,248,22,154,13,23,195,2,28,23,193,2,192,87, -94,23,193,1,28,248,22,166,6,23,195,2,27,248,22,176,13,195,28,192,192, -248,22,177,13,195,11,87,94,28,28,248,22,155,13,23,195,2,10,28,248,22, -154,13,23,195,2,10,28,248,22,166,6,23,195,2,28,248,22,176,13,23,195, -2,10,248,22,177,13,23,195,2,11,12,250,22,139,9,76,110,111,114,109,97, +158,41,50,22,144,13,10,248,22,167,5,23,196,2,28,248,22,164,6,23,194, +2,12,87,94,248,22,181,8,23,194,1,248,80,159,37,53,36,195,28,248,22, +78,23,195,2,9,27,248,22,71,23,196,2,27,28,248,22,190,13,23,195,2, +23,194,1,28,248,22,189,13,23,195,2,249,22,191,13,23,196,1,250,80,158, +42,48,248,22,142,14,2,19,11,10,250,80,158,40,48,248,22,142,14,2,19, +23,197,1,10,28,23,193,2,249,22,70,248,22,129,14,249,22,191,13,23,198, +1,247,22,143,14,27,248,22,72,23,200,1,28,248,22,78,23,194,2,9,27, +248,22,71,23,195,2,27,28,248,22,190,13,23,195,2,23,194,1,28,248,22, +189,13,23,195,2,249,22,191,13,23,196,1,250,80,158,47,48,248,22,142,14, +2,19,11,10,250,80,158,45,48,248,22,142,14,2,19,23,197,1,10,28,23, +193,2,249,22,70,248,22,129,14,249,22,191,13,23,198,1,247,22,143,14,248, +80,159,45,52,36,248,22,72,23,199,1,87,94,23,193,1,248,80,159,43,52, +36,248,22,72,23,197,1,87,94,23,193,1,27,248,22,72,23,198,1,28,248, +22,78,23,194,2,9,27,248,22,71,23,195,2,27,28,248,22,190,13,23,195, +2,23,194,1,28,248,22,189,13,23,195,2,249,22,191,13,23,196,1,250,80, +158,45,48,248,22,142,14,2,19,11,10,250,80,158,43,48,248,22,142,14,2, +19,23,197,1,10,28,23,193,2,249,22,70,248,22,129,14,249,22,191,13,23, +198,1,247,22,143,14,248,80,159,43,52,36,248,22,72,23,199,1,248,80,159, +41,52,36,248,22,72,196,27,248,22,166,13,23,195,2,28,23,193,2,192,87, +94,23,193,1,28,248,22,169,6,23,195,2,27,248,22,188,13,195,28,192,192, +248,22,189,13,195,11,87,94,28,28,248,22,167,13,23,195,2,10,28,248,22, +166,13,23,195,2,10,28,248,22,169,6,23,195,2,28,248,22,188,13,23,195, +2,10,248,22,189,13,23,195,2,11,12,250,22,145,9,76,110,111,114,109,97, 108,45,112,97,116,104,45,99,97,115,101,6,42,42,112,97,116,104,32,40,102, 111,114,32,97,110,121,32,115,121,115,116,101,109,41,32,111,114,32,118,97,108, 105,100,45,112,97,116,104,32,115,116,114,105,110,103,23,197,2,28,28,248,22, -155,13,23,195,2,249,22,171,8,248,22,156,13,23,197,2,2,20,249,22,171, -8,247,22,185,7,2,20,27,28,248,22,166,6,23,196,2,23,195,2,248,22, -175,7,248,22,159,13,23,197,2,28,249,22,143,14,0,21,35,114,120,34,94, +167,13,23,195,2,249,22,175,8,248,22,168,13,23,197,2,2,20,249,22,175, +8,247,22,188,7,2,20,27,28,248,22,169,6,23,196,2,23,195,2,248,22, +178,7,248,22,171,13,23,197,2,28,249,22,155,14,0,21,35,114,120,34,94, 91,92,92,93,91,92,92,93,91,63,93,91,92,92,93,34,23,195,2,28,248, -22,166,6,195,248,22,162,13,195,194,27,248,22,141,7,23,195,1,249,22,163, -13,248,22,178,7,250,22,149,14,0,6,35,114,120,34,47,34,28,249,22,143, +22,169,6,195,248,22,174,13,195,194,27,248,22,144,7,23,195,1,249,22,175, +13,248,22,181,7,250,22,161,14,0,6,35,114,120,34,47,34,28,249,22,155, 14,0,22,35,114,120,34,91,47,92,92,93,91,46,32,93,43,91,47,92,92, -93,42,36,34,23,201,2,23,199,1,250,22,149,14,0,19,35,114,120,34,91, +93,42,36,34,23,201,2,23,199,1,250,22,161,14,0,19,35,114,120,34,91, 32,46,93,43,40,91,47,92,92,93,42,41,36,34,23,202,1,6,2,2,92, -49,80,159,43,36,37,2,20,28,248,22,166,6,194,248,22,162,13,194,193,87, -94,28,28,248,22,154,13,23,195,2,10,28,248,22,166,6,23,195,2,28,248, -22,176,13,23,195,2,10,248,22,177,13,23,195,2,11,12,250,22,139,9,23, -196,2,2,21,23,197,2,28,248,22,176,13,23,195,2,12,248,22,172,11,249, -22,178,10,248,22,131,7,250,22,150,7,2,22,23,200,1,23,201,1,247,22, -23,87,94,28,28,248,22,154,13,23,195,2,10,28,248,22,166,6,23,195,2, -28,248,22,176,13,23,195,2,10,248,22,177,13,23,195,2,11,12,250,22,139, -9,23,196,2,2,21,23,197,2,28,248,22,176,13,23,195,2,12,248,22,172, -11,249,22,178,10,248,22,131,7,250,22,150,7,2,22,23,200,1,23,201,1, -247,22,23,87,94,87,94,28,28,248,22,154,13,23,195,2,10,28,248,22,166, -6,23,195,2,28,248,22,176,13,23,195,2,10,248,22,177,13,23,195,2,11, -12,250,22,139,9,195,2,21,23,197,2,28,248,22,176,13,23,195,2,12,248, -22,172,11,249,22,178,10,248,22,131,7,250,22,150,7,2,22,199,23,201,1, +49,80,159,43,36,37,2,20,28,248,22,169,6,194,248,22,174,13,194,193,87, +94,28,28,248,22,166,13,23,195,2,10,28,248,22,169,6,23,195,2,28,248, +22,188,13,23,195,2,10,248,22,189,13,23,195,2,11,12,250,22,145,9,23, +196,2,2,21,23,197,2,28,248,22,188,13,23,195,2,12,248,22,184,11,249, +22,190,10,248,22,134,7,250,22,153,7,2,22,23,200,1,23,201,1,247,22, +23,87,94,28,28,248,22,166,13,23,195,2,10,28,248,22,169,6,23,195,2, +28,248,22,188,13,23,195,2,10,248,22,189,13,23,195,2,11,12,250,22,145, +9,23,196,2,2,21,23,197,2,28,248,22,188,13,23,195,2,12,248,22,184, +11,249,22,190,10,248,22,134,7,250,22,153,7,2,22,23,200,1,23,201,1, +247,22,23,87,94,87,94,28,28,248,22,166,13,23,195,2,10,28,248,22,169, +6,23,195,2,28,248,22,188,13,23,195,2,10,248,22,189,13,23,195,2,11, +12,250,22,145,9,195,2,21,23,197,2,28,248,22,188,13,23,195,2,12,248, +22,184,11,249,22,190,10,248,22,134,7,250,22,153,7,2,22,199,23,201,1, 247,22,23,249,22,3,89,162,8,44,36,49,9,223,2,33,34,196,87,94,28, -28,248,22,154,13,23,194,2,10,28,248,22,166,6,23,194,2,28,248,22,176, -13,23,194,2,10,248,22,177,13,23,194,2,11,12,250,22,139,9,2,6,2, -21,23,196,2,28,248,22,176,13,23,194,2,12,248,22,172,11,249,22,178,10, -248,22,131,7,250,22,150,7,2,22,2,6,23,200,1,247,22,23,32,37,89, -162,8,44,39,54,2,23,222,33,38,28,248,22,77,23,197,2,87,94,23,196, -1,248,22,172,11,249,22,147,11,251,22,150,7,2,24,2,6,28,248,22,77, -23,203,2,87,94,23,202,1,23,201,1,250,22,1,22,172,13,23,204,1,23, -205,1,23,200,1,247,22,23,27,249,22,172,13,248,22,70,23,200,2,23,197, -2,28,248,22,167,13,23,194,2,27,250,22,1,22,172,13,23,197,1,199,28, -248,22,167,13,193,192,251,2,37,198,199,200,248,22,71,202,251,2,37,197,198, -199,248,22,71,201,87,94,87,94,87,94,28,28,248,22,154,13,193,10,28,248, -22,166,6,193,28,248,22,176,13,193,10,248,22,177,13,193,11,12,250,22,139, -9,2,6,2,21,195,28,248,22,176,13,193,12,248,22,172,11,249,22,178,10, -248,22,131,7,250,22,150,7,2,22,2,6,199,247,22,23,249,22,3,32,0, -89,162,8,44,36,48,9,222,33,36,195,27,247,22,132,14,251,2,37,196,197, -198,196,32,40,89,162,43,41,58,2,23,222,33,41,28,248,22,77,23,199,2, -87,94,23,198,1,248,23,196,1,251,22,150,7,2,24,23,199,1,28,248,22, -77,23,203,2,87,94,23,202,1,23,201,1,250,22,1,22,172,13,23,204,1, -23,205,1,23,198,1,27,249,22,172,13,248,22,70,23,202,2,23,199,2,28, -248,22,167,13,23,194,2,27,250,22,1,22,172,13,23,197,1,23,202,2,28, -248,22,167,13,23,194,2,192,87,94,23,193,1,27,248,22,71,23,202,1,28, -248,22,77,23,194,2,87,94,23,193,1,248,23,199,1,251,22,150,7,2,24, -23,202,1,28,248,22,77,23,206,2,87,94,23,205,1,23,204,1,250,22,1, -22,172,13,23,207,1,23,208,1,23,201,1,27,249,22,172,13,248,22,70,23, -197,2,23,202,2,28,248,22,167,13,23,194,2,27,250,22,1,22,172,13,23, -197,1,204,28,248,22,167,13,193,192,253,2,40,203,204,205,206,23,15,248,22, -71,201,253,2,40,202,203,204,205,206,248,22,71,200,87,94,23,193,1,27,248, -22,71,23,201,1,28,248,22,77,23,194,2,87,94,23,193,1,248,23,198,1, -251,22,150,7,2,24,23,201,1,28,248,22,77,23,205,2,87,94,23,204,1, -23,203,1,250,22,1,22,172,13,23,206,1,23,207,1,23,200,1,27,249,22, -172,13,248,22,70,23,197,2,23,201,2,28,248,22,167,13,23,194,2,27,250, -22,1,22,172,13,23,197,1,203,28,248,22,167,13,193,192,253,2,40,202,203, -204,205,206,248,22,71,201,253,2,40,201,202,203,204,205,248,22,71,200,27,247, -22,132,14,253,2,40,198,199,200,201,202,198,87,95,28,28,248,22,155,13,23, -194,2,10,28,248,22,154,13,23,194,2,10,28,248,22,166,6,23,194,2,28, -248,22,176,13,23,194,2,10,248,22,177,13,23,194,2,11,12,252,22,139,9, -23,200,2,2,25,35,23,198,2,23,199,2,28,28,248,22,166,6,23,195,2, -10,248,22,154,7,23,195,2,87,94,23,194,1,12,252,22,139,9,23,200,2, -2,26,36,23,198,2,23,199,1,91,159,38,11,90,161,38,35,11,248,22,175, -13,23,197,2,87,94,23,195,1,87,94,28,192,12,250,22,140,9,23,201,1, +28,248,22,166,13,23,194,2,10,28,248,22,169,6,23,194,2,28,248,22,188, +13,23,194,2,10,248,22,189,13,23,194,2,11,12,250,22,145,9,2,6,2, +21,23,196,2,28,248,22,188,13,23,194,2,12,248,22,184,11,249,22,190,10, +248,22,134,7,250,22,153,7,2,22,2,6,23,200,1,247,22,23,32,37,89, +162,8,44,39,54,2,23,222,33,38,28,248,22,78,23,197,2,87,94,23,196, +1,248,22,184,11,249,22,159,11,251,22,153,7,2,24,2,6,28,248,22,78, +23,203,2,87,94,23,202,1,23,201,1,250,22,1,22,184,13,23,204,1,23, +205,1,23,200,1,247,22,23,27,249,22,184,13,248,22,71,23,200,2,23,197, +2,28,248,22,179,13,23,194,2,27,250,22,1,22,184,13,23,197,1,199,28, +248,22,179,13,193,192,251,2,37,198,199,200,248,22,72,202,251,2,37,197,198, +199,248,22,72,201,87,94,87,94,87,94,28,28,248,22,166,13,193,10,28,248, +22,169,6,193,28,248,22,188,13,193,10,248,22,189,13,193,11,12,250,22,145, +9,2,6,2,21,195,28,248,22,188,13,193,12,248,22,184,11,249,22,190,10, +248,22,134,7,250,22,153,7,2,22,2,6,199,247,22,23,249,22,3,32,0, +89,162,8,44,36,48,9,222,33,36,195,27,247,22,144,14,251,2,37,196,197, +198,196,32,40,89,162,43,41,58,2,23,222,33,41,28,248,22,78,23,199,2, +87,94,23,198,1,248,23,196,1,251,22,153,7,2,24,23,199,1,28,248,22, +78,23,203,2,87,94,23,202,1,23,201,1,250,22,1,22,184,13,23,204,1, +23,205,1,23,198,1,27,249,22,184,13,248,22,71,23,202,2,23,199,2,28, +248,22,179,13,23,194,2,27,250,22,1,22,184,13,23,197,1,23,202,2,28, +248,22,179,13,23,194,2,192,87,94,23,193,1,27,248,22,72,23,202,1,28, +248,22,78,23,194,2,87,94,23,193,1,248,23,199,1,251,22,153,7,2,24, +23,202,1,28,248,22,78,23,206,2,87,94,23,205,1,23,204,1,250,22,1, +22,184,13,23,207,1,23,208,1,23,201,1,27,249,22,184,13,248,22,71,23, +197,2,23,202,2,28,248,22,179,13,23,194,2,27,250,22,1,22,184,13,23, +197,1,204,28,248,22,179,13,193,192,253,2,40,203,204,205,206,23,15,248,22, +72,201,253,2,40,202,203,204,205,206,248,22,72,200,87,94,23,193,1,27,248, +22,72,23,201,1,28,248,22,78,23,194,2,87,94,23,193,1,248,23,198,1, +251,22,153,7,2,24,23,201,1,28,248,22,78,23,205,2,87,94,23,204,1, +23,203,1,250,22,1,22,184,13,23,206,1,23,207,1,23,200,1,27,249,22, +184,13,248,22,71,23,197,2,23,201,2,28,248,22,179,13,23,194,2,27,250, +22,1,22,184,13,23,197,1,203,28,248,22,179,13,193,192,253,2,40,202,203, +204,205,206,248,22,72,201,253,2,40,201,202,203,204,205,248,22,72,200,27,247, +22,144,14,253,2,40,198,199,200,201,202,198,87,95,28,28,248,22,167,13,23, +194,2,10,28,248,22,166,13,23,194,2,10,28,248,22,169,6,23,194,2,28, +248,22,188,13,23,194,2,10,248,22,189,13,23,194,2,11,12,252,22,145,9, +23,200,2,2,25,35,23,198,2,23,199,2,28,28,248,22,169,6,23,195,2, +10,248,22,157,7,23,195,2,87,94,23,194,1,12,252,22,145,9,23,200,2, +2,26,36,23,198,2,23,199,1,91,159,38,11,90,161,38,35,11,248,22,187, +13,23,197,2,87,94,23,195,1,87,94,28,192,12,250,22,146,9,23,201,1, 2,27,23,199,1,249,22,7,194,195,91,159,37,11,90,161,37,35,11,87,95, -28,28,248,22,155,13,23,196,2,10,28,248,22,154,13,23,196,2,10,28,248, -22,166,6,23,196,2,28,248,22,176,13,23,196,2,10,248,22,177,13,23,196, -2,11,12,252,22,139,9,2,9,2,25,35,23,200,2,23,201,2,28,28,248, -22,166,6,23,197,2,10,248,22,154,7,23,197,2,12,252,22,139,9,2,9, -2,26,36,23,200,2,23,201,2,91,159,38,11,90,161,38,35,11,248,22,175, -13,23,199,2,87,94,23,195,1,87,94,28,192,12,250,22,140,9,2,9,2, -27,23,201,2,249,22,7,194,195,27,249,22,164,13,250,22,148,14,0,20,35, +28,28,248,22,167,13,23,196,2,10,28,248,22,166,13,23,196,2,10,28,248, +22,169,6,23,196,2,28,248,22,188,13,23,196,2,10,248,22,189,13,23,196, +2,11,12,252,22,145,9,2,9,2,25,35,23,200,2,23,201,2,28,28,248, +22,169,6,23,197,2,10,248,22,157,7,23,197,2,12,252,22,145,9,2,9, +2,26,36,23,200,2,23,201,2,91,159,38,11,90,161,38,35,11,248,22,187, +13,23,199,2,87,94,23,195,1,87,94,28,192,12,250,22,146,9,2,9,2, +27,23,201,2,249,22,7,194,195,27,249,22,176,13,250,22,160,14,0,20,35, 114,120,35,34,40,63,58,91,46,93,91,94,46,93,42,124,41,36,34,248,22, -160,13,23,201,1,28,248,22,166,6,23,203,2,249,22,178,7,23,204,1,8, -63,23,202,1,28,248,22,155,13,23,199,2,248,22,156,13,23,199,1,87,94, -23,198,1,247,22,157,13,28,248,22,154,13,194,249,22,172,13,195,194,192,91, -159,37,11,90,161,37,35,11,87,95,28,28,248,22,155,13,23,196,2,10,28, -248,22,154,13,23,196,2,10,28,248,22,166,6,23,196,2,28,248,22,176,13, -23,196,2,10,248,22,177,13,23,196,2,11,12,252,22,139,9,2,10,2,25, -35,23,200,2,23,201,2,28,28,248,22,166,6,23,197,2,10,248,22,154,7, -23,197,2,12,252,22,139,9,2,10,2,26,36,23,200,2,23,201,2,91,159, -38,11,90,161,38,35,11,248,22,175,13,23,199,2,87,94,23,195,1,87,94, -28,192,12,250,22,140,9,2,10,2,27,23,201,2,249,22,7,194,195,27,249, -22,164,13,249,22,164,7,250,22,149,14,0,9,35,114,120,35,34,91,46,93, -34,248,22,160,13,23,203,1,6,1,1,95,28,248,22,166,6,23,202,2,249, -22,178,7,23,203,1,8,63,23,201,1,28,248,22,155,13,23,199,2,248,22, -156,13,23,199,1,87,94,23,198,1,247,22,157,13,28,248,22,154,13,194,249, -22,172,13,195,194,192,249,247,22,133,5,194,11,249,80,159,37,46,36,9,9, -249,80,159,37,46,36,195,9,27,247,22,134,14,249,80,158,38,47,28,23,195, -2,27,248,22,183,7,6,11,11,80,76,84,67,79,76,76,69,67,84,83,28, -192,192,6,0,0,6,0,0,27,28,23,196,1,250,22,172,13,248,22,130,14, -69,97,100,100,111,110,45,100,105,114,247,22,181,7,6,8,8,99,111,108,108, -101,99,116,115,11,27,248,80,159,41,52,36,250,22,83,23,203,1,248,22,79, -248,22,130,14,72,99,111,108,108,101,99,116,115,45,100,105,114,23,204,1,28, -193,249,22,69,195,194,192,32,50,89,162,8,44,38,8,31,2,18,222,33,51, -27,249,22,141,14,23,197,2,23,198,2,28,23,193,2,87,94,23,196,1,27, -248,22,94,23,195,2,27,27,248,22,103,23,197,1,27,249,22,141,14,23,201, -2,23,196,2,28,23,193,2,87,94,23,194,1,27,248,22,94,23,195,2,27, -27,248,22,103,23,197,1,27,249,22,141,14,23,205,2,23,196,2,28,23,193, -2,87,94,23,194,1,27,248,22,94,23,195,2,27,27,248,22,103,23,197,1, -27,249,22,141,14,23,209,2,23,196,2,28,23,193,2,87,94,23,194,1,27, -248,22,94,23,195,2,27,27,248,22,103,23,197,1,27,249,22,141,14,23,213, -2,23,196,2,28,23,193,2,87,94,23,194,1,27,248,22,94,23,195,2,27, -250,2,50,23,215,2,23,216,1,248,22,103,23,199,1,28,249,22,160,7,23, -196,2,2,28,249,22,83,23,214,2,194,249,22,69,248,22,163,13,23,197,1, -194,87,95,23,211,1,23,193,1,28,249,22,160,7,23,196,2,2,28,249,22, -83,23,212,2,9,249,22,69,248,22,163,13,23,197,1,9,28,249,22,160,7, -23,196,2,2,28,249,22,83,23,210,2,194,249,22,69,248,22,163,13,23,197, -1,194,87,94,23,193,1,28,249,22,160,7,23,196,2,2,28,249,22,83,23, -208,2,9,249,22,69,248,22,163,13,23,197,1,9,28,249,22,160,7,23,196, -2,2,28,249,22,83,23,206,2,194,249,22,69,248,22,163,13,23,197,1,194, -87,94,23,193,1,28,249,22,160,7,23,196,2,2,28,249,22,83,23,204,2, -9,249,22,69,248,22,163,13,23,197,1,9,28,249,22,160,7,23,196,2,2, -28,249,22,83,23,202,2,194,249,22,69,248,22,163,13,23,197,1,194,87,94, -23,193,1,28,249,22,160,7,23,196,2,2,28,249,22,83,23,200,2,9,249, -22,69,248,22,163,13,23,197,1,9,28,249,22,160,7,23,196,2,2,28,249, -22,83,197,194,87,94,23,196,1,249,22,69,248,22,163,13,23,197,1,194,87, -94,23,193,1,28,249,22,160,7,23,198,2,2,28,249,22,83,195,9,87,94, -23,194,1,249,22,69,248,22,163,13,23,199,1,9,87,95,28,28,248,22,154, -7,194,10,248,22,166,6,194,12,250,22,139,9,2,13,6,21,21,98,121,116, +172,13,23,201,1,28,248,22,169,6,23,203,2,249,22,181,7,23,204,1,8, +63,23,202,1,28,248,22,167,13,23,199,2,248,22,168,13,23,199,1,87,94, +23,198,1,247,22,169,13,28,248,22,166,13,194,249,22,184,13,195,194,192,91, +159,37,11,90,161,37,35,11,87,95,28,28,248,22,167,13,23,196,2,10,28, +248,22,166,13,23,196,2,10,28,248,22,169,6,23,196,2,28,248,22,188,13, +23,196,2,10,248,22,189,13,23,196,2,11,12,252,22,145,9,2,10,2,25, +35,23,200,2,23,201,2,28,28,248,22,169,6,23,197,2,10,248,22,157,7, +23,197,2,12,252,22,145,9,2,10,2,26,36,23,200,2,23,201,2,91,159, +38,11,90,161,38,35,11,248,22,187,13,23,199,2,87,94,23,195,1,87,94, +28,192,12,250,22,146,9,2,10,2,27,23,201,2,249,22,7,194,195,27,249, +22,176,13,249,22,167,7,250,22,161,14,0,9,35,114,120,35,34,91,46,93, +34,248,22,172,13,23,203,1,6,1,1,95,28,248,22,169,6,23,202,2,249, +22,181,7,23,203,1,8,63,23,201,1,28,248,22,167,13,23,199,2,248,22, +168,13,23,199,1,87,94,23,198,1,247,22,169,13,28,248,22,166,13,194,249, +22,184,13,195,194,192,249,247,22,136,5,194,11,249,80,159,37,46,36,9,9, +249,80,159,37,46,36,195,9,27,247,22,146,14,249,80,158,38,47,28,23,195, +2,27,248,22,186,7,6,11,11,80,76,84,67,79,76,76,69,67,84,83,28, +192,192,6,0,0,6,0,0,27,28,23,196,1,250,22,184,13,248,22,142,14, +69,97,100,100,111,110,45,100,105,114,247,22,184,7,6,8,8,99,111,108,108, +101,99,116,115,11,27,248,80,159,41,52,36,250,22,84,23,203,1,248,22,80, +248,22,142,14,72,99,111,108,108,101,99,116,115,45,100,105,114,23,204,1,28, +193,249,22,70,195,194,192,32,50,89,162,8,44,38,8,31,2,18,222,33,51, +27,249,22,153,14,23,197,2,23,198,2,28,23,193,2,87,94,23,196,1,27, +248,22,95,23,195,2,27,27,248,22,104,23,197,1,27,249,22,153,14,23,201, +2,23,196,2,28,23,193,2,87,94,23,194,1,27,248,22,95,23,195,2,27, +27,248,22,104,23,197,1,27,249,22,153,14,23,205,2,23,196,2,28,23,193, +2,87,94,23,194,1,27,248,22,95,23,195,2,27,27,248,22,104,23,197,1, +27,249,22,153,14,23,209,2,23,196,2,28,23,193,2,87,94,23,194,1,27, +248,22,95,23,195,2,27,27,248,22,104,23,197,1,27,249,22,153,14,23,213, +2,23,196,2,28,23,193,2,87,94,23,194,1,27,248,22,95,23,195,2,27, +250,2,50,23,215,2,23,216,1,248,22,104,23,199,1,28,249,22,163,7,23, +196,2,2,28,249,22,84,23,214,2,194,249,22,70,248,22,175,13,23,197,1, +194,87,95,23,211,1,23,193,1,28,249,22,163,7,23,196,2,2,28,249,22, +84,23,212,2,9,249,22,70,248,22,175,13,23,197,1,9,28,249,22,163,7, +23,196,2,2,28,249,22,84,23,210,2,194,249,22,70,248,22,175,13,23,197, +1,194,87,94,23,193,1,28,249,22,163,7,23,196,2,2,28,249,22,84,23, +208,2,9,249,22,70,248,22,175,13,23,197,1,9,28,249,22,163,7,23,196, +2,2,28,249,22,84,23,206,2,194,249,22,70,248,22,175,13,23,197,1,194, +87,94,23,193,1,28,249,22,163,7,23,196,2,2,28,249,22,84,23,204,2, +9,249,22,70,248,22,175,13,23,197,1,9,28,249,22,163,7,23,196,2,2, +28,249,22,84,23,202,2,194,249,22,70,248,22,175,13,23,197,1,194,87,94, +23,193,1,28,249,22,163,7,23,196,2,2,28,249,22,84,23,200,2,9,249, +22,70,248,22,175,13,23,197,1,9,28,249,22,163,7,23,196,2,2,28,249, +22,84,197,194,87,94,23,196,1,249,22,70,248,22,175,13,23,197,1,194,87, +94,23,193,1,28,249,22,163,7,23,198,2,2,28,249,22,84,195,9,87,94, +23,194,1,249,22,70,248,22,175,13,23,199,1,9,87,95,28,28,248,22,157, +7,194,10,248,22,169,6,194,12,250,22,145,9,2,13,6,21,21,98,121,116, 101,32,115,116,114,105,110,103,32,111,114,32,115,116,114,105,110,103,196,28,28, -248,22,78,195,249,22,4,22,154,13,196,11,12,250,22,139,9,2,13,6,13, +248,22,79,195,249,22,4,22,166,13,196,11,12,250,22,145,9,2,13,6,13, 13,108,105,115,116,32,111,102,32,112,97,116,104,115,197,250,2,50,197,195,28, -248,22,166,6,197,248,22,177,7,197,196,32,53,89,162,8,44,38,52,70,102, +248,22,169,6,197,248,22,180,7,197,196,32,53,89,162,8,44,38,52,70,102, 111,117,110,100,45,101,120,101,99,222,33,56,32,54,89,162,8,44,39,57,64, -110,101,120,116,222,33,55,27,248,22,180,13,23,196,2,28,249,22,173,8,23, -195,2,23,197,1,11,28,248,22,176,13,23,194,2,27,249,22,172,13,23,197, -1,23,196,1,28,23,197,2,91,159,38,11,90,161,38,35,11,248,22,175,13, -23,197,2,87,95,23,195,1,23,194,1,27,28,23,202,2,27,248,22,180,13, -23,199,2,28,249,22,173,8,23,195,2,23,200,2,11,28,248,22,176,13,23, -194,2,250,2,53,23,205,2,23,206,2,249,22,172,13,23,200,2,23,198,1, +110,101,120,116,222,33,55,27,248,22,128,14,23,196,2,28,249,22,177,8,23, +195,2,23,197,1,11,28,248,22,188,13,23,194,2,27,249,22,184,13,23,197, +1,23,196,1,28,23,197,2,91,159,38,11,90,161,38,35,11,248,22,187,13, +23,197,2,87,95,23,195,1,23,194,1,27,28,23,202,2,27,248,22,128,14, +23,199,2,28,249,22,177,8,23,195,2,23,200,2,11,28,248,22,188,13,23, +194,2,250,2,53,23,205,2,23,206,2,249,22,184,13,23,200,2,23,198,1, 250,2,53,23,205,2,23,206,2,23,196,1,11,28,23,193,2,192,87,94,23, -193,1,27,28,248,22,154,13,23,196,2,27,249,22,172,13,23,198,2,23,205, -2,28,28,248,22,167,13,193,10,248,22,166,13,193,192,11,11,28,23,193,2, -192,87,94,23,193,1,28,23,203,2,11,27,248,22,180,13,23,200,2,28,249, -22,173,8,23,195,2,23,201,1,11,28,248,22,176,13,23,194,2,250,2,53, -23,206,1,23,207,1,249,22,172,13,23,201,1,23,198,1,250,2,53,205,206, +193,1,27,28,248,22,166,13,23,196,2,27,249,22,184,13,23,198,2,23,205, +2,28,28,248,22,179,13,193,10,248,22,178,13,193,192,11,11,28,23,193,2, +192,87,94,23,193,1,28,23,203,2,11,27,248,22,128,14,23,200,2,28,249, +22,177,8,23,195,2,23,201,1,11,28,248,22,188,13,23,194,2,250,2,53, +23,206,1,23,207,1,249,22,184,13,23,201,1,23,198,1,250,2,53,205,206, 195,192,87,94,23,194,1,28,23,196,2,91,159,38,11,90,161,38,35,11,248, -22,175,13,23,197,2,87,95,23,195,1,23,194,1,27,28,23,201,2,27,248, -22,180,13,23,199,2,28,249,22,173,8,23,195,2,23,200,2,11,28,248,22, -176,13,23,194,2,250,2,53,23,204,2,23,205,2,249,22,172,13,23,200,2, +22,187,13,23,197,2,87,95,23,195,1,23,194,1,27,28,23,201,2,27,248, +22,128,14,23,199,2,28,249,22,177,8,23,195,2,23,200,2,11,28,248,22, +188,13,23,194,2,250,2,53,23,204,2,23,205,2,249,22,184,13,23,200,2, 23,198,1,250,2,53,23,204,2,23,205,2,23,196,1,11,28,23,193,2,192, -87,94,23,193,1,27,28,248,22,154,13,23,196,2,27,249,22,172,13,23,198, -2,23,204,2,28,28,248,22,167,13,193,10,248,22,166,13,193,192,11,11,28, -23,193,2,192,87,94,23,193,1,28,23,202,2,11,27,248,22,180,13,23,200, -2,28,249,22,173,8,23,195,2,23,201,1,11,28,248,22,176,13,23,194,2, -250,2,53,23,205,1,23,206,1,249,22,172,13,23,201,1,23,198,1,250,2, -53,204,205,195,192,28,23,193,2,91,159,38,11,90,161,38,35,11,248,22,175, +87,94,23,193,1,27,28,248,22,166,13,23,196,2,27,249,22,184,13,23,198, +2,23,204,2,28,28,248,22,179,13,193,10,248,22,178,13,193,192,11,11,28, +23,193,2,192,87,94,23,193,1,28,23,202,2,11,27,248,22,128,14,23,200, +2,28,249,22,177,8,23,195,2,23,201,1,11,28,248,22,188,13,23,194,2, +250,2,53,23,205,1,23,206,1,249,22,184,13,23,201,1,23,198,1,250,2, +53,204,205,195,192,28,23,193,2,91,159,38,11,90,161,38,35,11,248,22,187, 13,23,199,2,87,95,23,195,1,23,194,1,27,28,23,198,2,251,2,54,23, 198,2,23,203,2,23,201,2,23,202,2,11,28,23,193,2,192,87,94,23,193, -1,27,28,248,22,154,13,195,27,249,22,172,13,197,200,28,28,248,22,167,13, -193,10,248,22,166,13,193,192,11,11,28,192,192,28,198,11,251,2,54,198,203, -201,202,194,32,57,89,162,8,44,39,8,31,2,18,222,33,58,28,248,22,77, -23,197,2,11,27,248,22,179,13,248,22,70,23,199,2,27,249,22,172,13,23, -196,1,23,197,2,28,248,22,166,13,23,194,2,250,2,53,198,199,195,87,94, -23,193,1,27,248,22,71,23,200,1,28,248,22,77,23,194,2,11,27,248,22, -179,13,248,22,70,23,196,2,27,249,22,172,13,23,196,1,23,200,2,28,248, -22,166,13,23,194,2,250,2,53,201,202,195,87,94,23,193,1,27,248,22,71, -23,197,1,28,248,22,77,23,194,2,11,27,248,22,179,13,248,22,70,23,196, -2,27,249,22,172,13,23,196,1,23,203,2,28,248,22,166,13,23,194,2,250, -2,53,204,205,195,87,94,23,193,1,27,248,22,71,23,197,1,28,248,22,77, -23,194,2,11,27,248,22,179,13,248,22,70,23,196,2,27,249,22,172,13,23, -196,1,23,206,2,28,248,22,166,13,23,194,2,250,2,53,23,15,23,16,195, -87,94,23,193,1,27,248,22,71,23,197,1,28,248,22,77,23,194,2,11,27, -248,22,179,13,248,22,70,23,196,2,27,249,22,172,13,23,196,1,23,209,2, -28,248,22,166,13,23,194,2,250,2,53,23,18,23,19,195,87,94,23,193,1, -27,248,22,71,23,197,1,28,248,22,77,23,194,2,11,27,248,22,179,13,248, -22,70,195,27,249,22,172,13,23,196,1,23,19,28,248,22,166,13,193,250,2, -53,23,21,23,22,195,251,2,57,23,21,23,22,23,23,248,22,71,199,87,95, -28,28,248,22,154,13,23,195,2,10,28,248,22,166,6,23,195,2,28,248,22, -176,13,23,195,2,10,248,22,177,13,23,195,2,11,12,250,22,139,9,2,14, +1,27,28,248,22,166,13,195,27,249,22,184,13,197,200,28,28,248,22,179,13, +193,10,248,22,178,13,193,192,11,11,28,192,192,28,198,11,251,2,54,198,203, +201,202,194,32,57,89,162,8,44,39,8,31,2,18,222,33,58,28,248,22,78, +23,197,2,11,27,248,22,191,13,248,22,71,23,199,2,27,249,22,184,13,23, +196,1,23,197,2,28,248,22,178,13,23,194,2,250,2,53,198,199,195,87,94, +23,193,1,27,248,22,72,23,200,1,28,248,22,78,23,194,2,11,27,248,22, +191,13,248,22,71,23,196,2,27,249,22,184,13,23,196,1,23,200,2,28,248, +22,178,13,23,194,2,250,2,53,201,202,195,87,94,23,193,1,27,248,22,72, +23,197,1,28,248,22,78,23,194,2,11,27,248,22,191,13,248,22,71,23,196, +2,27,249,22,184,13,23,196,1,23,203,2,28,248,22,178,13,23,194,2,250, +2,53,204,205,195,87,94,23,193,1,27,248,22,72,23,197,1,28,248,22,78, +23,194,2,11,27,248,22,191,13,248,22,71,23,196,2,27,249,22,184,13,23, +196,1,23,206,2,28,248,22,178,13,23,194,2,250,2,53,23,15,23,16,195, +87,94,23,193,1,27,248,22,72,23,197,1,28,248,22,78,23,194,2,11,27, +248,22,191,13,248,22,71,23,196,2,27,249,22,184,13,23,196,1,23,209,2, +28,248,22,178,13,23,194,2,250,2,53,23,18,23,19,195,87,94,23,193,1, +27,248,22,72,23,197,1,28,248,22,78,23,194,2,11,27,248,22,191,13,248, +22,71,195,27,249,22,184,13,23,196,1,23,19,28,248,22,178,13,193,250,2, +53,23,21,23,22,195,251,2,57,23,21,23,22,23,23,248,22,72,199,87,95, +28,28,248,22,166,13,23,195,2,10,28,248,22,169,6,23,195,2,28,248,22, +188,13,23,195,2,10,248,22,189,13,23,195,2,11,12,250,22,145,9,2,14, 6,25,25,112,97,116,104,32,111,114,32,115,116,114,105,110,103,32,40,115,97, -110,115,32,110,117,108,41,23,197,2,28,28,23,195,2,28,28,248,22,154,13, -23,196,2,10,28,248,22,166,6,23,196,2,28,248,22,176,13,23,196,2,10, -248,22,177,13,23,196,2,11,248,22,176,13,23,196,2,11,10,12,250,22,139, +110,115,32,110,117,108,41,23,197,2,28,28,23,195,2,28,28,248,22,166,13, +23,196,2,10,28,248,22,169,6,23,196,2,28,248,22,188,13,23,196,2,10, +248,22,189,13,23,196,2,11,248,22,188,13,23,196,2,11,10,12,250,22,145, 9,2,14,6,29,29,35,102,32,111,114,32,114,101,108,97,116,105,118,101,32, 112,97,116,104,32,111,114,32,115,116,114,105,110,103,23,198,2,28,28,248,22, -176,13,23,195,2,91,159,38,11,90,161,38,35,11,248,22,175,13,23,198,2, -249,22,171,8,194,68,114,101,108,97,116,105,118,101,11,27,248,22,183,7,6, +188,13,23,195,2,91,159,38,11,90,161,38,35,11,248,22,187,13,23,198,2, +249,22,175,8,194,68,114,101,108,97,116,105,118,101,11,27,248,22,186,7,6, 4,4,80,65,84,72,27,28,23,194,2,27,249,80,159,40,47,37,23,197,1, -9,28,249,22,171,8,247,22,185,7,2,20,249,22,69,248,22,163,13,5,1, -46,194,192,87,94,23,194,1,9,28,248,22,77,23,194,2,11,27,248,22,179, -13,248,22,70,23,196,2,27,249,22,172,13,23,196,1,23,200,2,28,248,22, -166,13,23,194,2,250,2,53,201,202,195,87,94,23,193,1,27,248,22,71,23, -197,1,28,248,22,77,23,194,2,11,27,248,22,179,13,248,22,70,23,196,2, -27,249,22,172,13,23,196,1,23,203,2,28,248,22,166,13,23,194,2,250,2, -53,204,205,195,87,94,23,193,1,27,248,22,71,23,197,1,28,248,22,77,23, -194,2,11,27,248,22,179,13,248,22,70,195,27,249,22,172,13,23,196,1,205, -28,248,22,166,13,193,250,2,53,23,15,23,16,195,251,2,57,23,15,23,16, -23,17,248,22,71,199,27,248,22,179,13,23,196,1,28,248,22,166,13,193,250, +9,28,249,22,175,8,247,22,188,7,2,20,249,22,70,248,22,175,13,5,1, +46,194,192,87,94,23,194,1,9,28,248,22,78,23,194,2,11,27,248,22,191, +13,248,22,71,23,196,2,27,249,22,184,13,23,196,1,23,200,2,28,248,22, +178,13,23,194,2,250,2,53,201,202,195,87,94,23,193,1,27,248,22,72,23, +197,1,28,248,22,78,23,194,2,11,27,248,22,191,13,248,22,71,23,196,2, +27,249,22,184,13,23,196,1,23,203,2,28,248,22,178,13,23,194,2,250,2, +53,204,205,195,87,94,23,193,1,27,248,22,72,23,197,1,28,248,22,78,23, +194,2,11,27,248,22,191,13,248,22,71,195,27,249,22,184,13,23,196,1,205, +28,248,22,178,13,193,250,2,53,23,15,23,16,195,251,2,57,23,15,23,16, +23,17,248,22,72,199,27,248,22,191,13,23,196,1,28,248,22,178,13,193,250, 2,53,198,199,195,11,250,80,159,38,48,36,196,197,11,250,80,159,38,48,36, -196,11,11,87,94,249,22,157,6,247,22,129,5,195,248,22,183,5,249,22,176, -3,35,249,22,160,3,197,198,27,28,23,197,2,87,95,23,196,1,23,195,1, -23,197,1,87,94,23,197,1,27,248,22,130,14,2,19,27,249,80,159,40,48, -36,23,196,1,11,27,27,248,22,179,3,23,200,1,28,192,192,35,27,27,248, -22,179,3,23,202,1,28,192,192,35,249,22,160,5,23,197,1,83,158,39,20, -97,95,89,162,8,44,35,47,9,224,3,2,33,62,23,195,1,23,196,1,27, -248,22,145,5,23,195,1,248,80,159,38,53,36,193,159,35,20,102,159,35,16, -1,11,16,0,83,158,41,20,100,144,67,35,37,117,116,105,108,115,29,11,11, -11,11,11,10,42,80,158,35,35,20,102,159,37,16,17,2,1,2,2,2,3, +196,11,11,87,94,249,22,160,6,247,22,132,5,195,248,22,186,5,249,22,179, +3,35,249,22,163,3,197,198,27,28,23,197,2,87,95,23,196,1,23,195,1, +23,197,1,87,94,23,197,1,27,248,22,142,14,2,19,27,249,80,159,40,48, +36,23,196,1,11,27,27,248,22,182,3,23,200,1,28,192,192,35,27,27,248, +22,182,3,23,202,1,28,192,192,35,249,22,163,5,23,197,1,83,158,39,20, +100,95,89,162,8,44,35,47,9,224,3,2,33,62,23,195,1,23,196,1,27, +248,22,148,5,23,195,1,248,80,159,38,53,36,193,159,35,20,105,159,35,16, +1,11,16,0,83,158,41,20,103,144,67,35,37,117,116,105,108,115,29,11,11, +11,11,11,10,42,80,158,35,35,20,105,159,37,16,17,2,1,2,2,2,3, 2,4,2,5,2,6,2,7,2,8,2,9,2,10,2,11,2,12,2,13,2, 14,2,15,30,2,17,1,20,112,97,114,97,109,101,116,101,114,105,122,97,116, 105,111,110,45,107,101,121,4,30,2,17,1,23,101,120,116,101,110,100,45,112, @@ -369,7 +369,7 @@ 0,35,35,16,0,16,17,83,158,35,16,2,89,162,43,36,48,2,18,223,0, 33,29,80,159,35,53,36,83,158,35,16,2,89,162,8,44,36,55,2,18,223, 0,33,30,80,159,35,52,36,83,158,35,16,2,32,0,89,162,43,36,44,2, -1,222,33,31,80,159,35,35,36,83,158,35,16,2,249,22,168,6,7,92,7, +1,222,33,31,80,159,35,35,36,83,158,35,16,2,249,22,171,6,7,92,7, 92,80,159,35,36,36,83,158,35,16,2,89,162,43,36,53,2,3,223,0,33, 32,80,159,35,37,36,83,158,35,16,2,32,0,89,162,8,44,37,49,2,4, 222,33,33,80,159,35,38,36,83,158,35,16,2,32,0,89,162,8,44,38,50, @@ -380,13 +380,13 @@ 89,162,43,37,52,2,9,222,33,44,80,159,35,43,36,83,158,35,16,2,32, 0,89,162,43,37,53,2,10,222,33,45,80,159,35,44,36,83,158,35,16,2, 32,0,89,162,43,36,43,2,11,222,33,46,80,159,35,45,36,83,158,35,16, -2,83,158,38,20,96,96,2,12,89,162,43,35,43,9,223,0,33,47,89,162, +2,83,158,38,20,99,96,2,12,89,162,43,35,43,9,223,0,33,47,89,162, 43,36,44,9,223,0,33,48,89,162,43,37,54,9,223,0,33,49,80,159,35, -46,36,83,158,35,16,2,27,248,22,137,14,248,22,177,7,27,28,249,22,171, -8,247,22,185,7,2,20,6,1,1,59,6,1,1,58,250,22,150,7,6,14, +46,36,83,158,35,16,2,27,248,22,149,14,248,22,180,7,27,28,249,22,175, +8,247,22,188,7,2,20,6,1,1,59,6,1,1,58,250,22,153,7,6,14, 14,40,91,94,126,97,93,42,41,126,97,40,46,42,41,23,196,2,23,196,1, 89,162,8,44,37,47,2,13,223,0,33,52,80,159,35,47,36,83,158,35,16, -2,83,158,38,20,96,96,2,14,89,162,8,44,38,59,9,223,0,33,59,89, +2,83,158,38,20,99,96,2,14,89,162,8,44,38,59,9,223,0,33,59,89, 162,43,37,46,9,223,0,33,60,89,162,43,36,45,9,223,0,33,61,80,159, 35,48,36,83,158,35,16,2,89,162,43,38,51,2,15,223,0,33,63,80,159, 35,49,36,94,29,94,2,16,68,35,37,107,101,114,110,101,108,11,29,94,2, @@ -394,16 +394,16 @@ EVAL_ONE_SIZED_STR((char *)expr, 6127); } { - SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,52,46,50,46,52,46,53,8,0,0,0,1,0,0,6,0,19,0, + SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,52,46,50,46,53,46,51,8,0,0,0,1,0,0,6,0,19,0, 34,0,48,0,62,0,76,0,118,0,0,0,53,1,0,0,65,113,117,111,116, 101,29,94,2,1,67,35,37,117,116,105,108,115,11,29,94,2,1,69,35,37, 110,101,116,119,111,114,107,11,29,94,2,1,68,35,37,112,97,114,97,109,122, 11,29,94,2,1,68,35,37,101,120,112,111,98,115,11,29,94,2,1,68,35, -37,107,101,114,110,101,108,11,97,35,11,8,240,39,76,0,0,98,159,2,2, +37,107,101,114,110,101,108,11,97,35,11,8,240,42,76,0,0,98,159,2,2, 35,35,159,2,3,35,35,159,2,4,35,35,159,2,5,35,35,159,2,6,35, -35,159,2,6,35,35,16,0,159,35,20,102,159,35,16,1,11,16,0,83,158, -41,20,100,144,69,35,37,98,117,105,108,116,105,110,29,11,11,11,11,11,18, -96,11,42,42,42,35,80,158,35,35,20,102,159,35,16,0,16,0,16,0,35, +35,159,2,6,35,35,16,0,159,35,20,105,159,35,16,1,11,16,0,83,158, +41,20,103,144,69,35,37,98,117,105,108,116,105,110,29,11,11,11,11,11,18, +96,11,42,42,42,35,80,158,35,35,20,105,159,35,16,0,16,0,16,0,35, 16,0,35,16,0,35,11,11,38,35,11,11,11,16,0,16,0,16,0,35,35, 36,11,11,11,16,0,16,0,16,0,35,35,11,11,11,11,16,0,16,0,16, 0,35,35,16,0,16,0,102,2,6,2,5,29,94,2,1,69,35,37,102,111, @@ -414,14 +414,14 @@ EVAL_ONE_SIZED_STR((char *)expr, 346); } { - SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,52,46,50,46,52,46,53,69,0,0,0,1,0,0,11,0,38,0, + SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,52,46,50,46,53,46,51,69,0,0,0,1,0,0,11,0,38,0, 44,0,57,0,66,0,73,0,95,0,117,0,143,0,155,0,173,0,193,0,205, 0,221,0,244,0,0,1,31,1,38,1,43,1,48,1,53,1,58,1,67,1, 72,1,76,1,84,1,93,1,138,1,158,1,187,1,218,1,18,2,28,2,75, -2,85,2,92,2,235,3,254,3,11,4,169,4,181,4,59,5,101,6,223,6, -229,6,243,6,255,6,89,7,102,7,221,7,233,7,67,8,80,8,199,8,226, -8,238,8,72,9,85,9,204,9,217,9,80,10,88,10,173,10,175,10,241,10, -230,17,24,18,45,18,0,0,233,20,0,0,70,100,108,108,45,115,117,102,102, +2,85,2,92,2,235,3,254,3,11,4,169,4,181,4,59,5,101,6,224,6, +230,6,244,6,0,7,90,7,103,7,222,7,234,7,68,8,81,8,200,8,227, +8,239,8,73,9,86,9,205,9,218,9,81,10,89,10,174,10,176,10,242,10, +232,17,26,18,47,18,0,0,235,20,0,0,70,100,108,108,45,115,117,102,102, 105,120,1,25,100,101,102,97,117,108,116,45,108,111,97,100,47,117,115,101,45, 99,111,109,112,105,108,101,100,65,113,117,111,116,101,29,94,2,3,67,35,37, 117,116,105,108,115,11,68,35,37,112,97,114,97,109,122,29,94,2,3,2,5, @@ -439,243 +439,243 @@ 108,64,115,97,109,101,5,3,46,122,111,6,6,6,110,97,116,105,118,101,64, 108,111,111,112,63,108,105,98,67,105,103,110,111,114,101,100,249,22,14,195,80, 159,37,45,37,20,14,159,80,158,35,39,250,80,158,38,40,249,22,27,11,80, -158,40,39,22,134,5,28,248,22,154,13,23,198,2,23,197,1,87,94,23,197, -1,247,22,131,14,247,194,250,22,172,13,23,197,1,23,199,1,249,80,158,42, -38,23,198,1,2,22,252,22,172,13,23,199,1,23,201,1,2,23,247,22,186, +158,40,39,22,137,5,28,248,22,166,13,23,198,2,23,197,1,87,94,23,197, +1,247,22,143,14,247,194,250,22,184,13,23,197,1,23,199,1,249,80,158,42, +38,23,198,1,2,22,252,22,184,13,23,199,1,23,201,1,2,23,247,22,189, 7,249,80,158,44,38,23,200,1,80,159,44,35,37,87,94,23,194,1,27,250, -22,189,13,196,11,32,0,89,162,8,44,35,40,9,222,11,28,192,249,22,69, -195,194,11,27,252,22,172,13,23,200,1,23,202,1,2,23,247,22,186,7,249, -80,158,45,38,23,201,1,80,159,45,35,37,27,250,22,189,13,196,11,32,0, -89,162,8,44,35,40,9,222,11,28,192,249,22,69,195,194,11,249,247,22,136, -14,248,22,70,195,195,27,250,22,172,13,23,198,1,23,200,1,249,80,158,43, -38,23,199,1,2,22,27,250,22,189,13,196,11,32,0,89,162,8,44,35,40, -9,222,11,28,192,249,22,69,195,194,11,249,247,22,132,5,248,22,70,195,195, -249,247,22,132,5,194,195,87,94,28,248,80,158,36,37,23,195,2,12,250,22, -139,9,77,108,111,97,100,47,117,115,101,45,99,111,109,112,105,108,101,100,6, +22,137,14,196,11,32,0,89,162,8,44,35,40,9,222,11,28,192,249,22,70, +195,194,11,27,252,22,184,13,23,200,1,23,202,1,2,23,247,22,189,7,249, +80,158,45,38,23,201,1,80,159,45,35,37,27,250,22,137,14,196,11,32,0, +89,162,8,44,35,40,9,222,11,28,192,249,22,70,195,194,11,249,247,22,148, +14,248,22,71,195,195,27,250,22,184,13,23,198,1,23,200,1,249,80,158,43, +38,23,199,1,2,22,27,250,22,137,14,196,11,32,0,89,162,8,44,35,40, +9,222,11,28,192,249,22,70,195,194,11,249,247,22,135,5,248,22,71,195,195, +249,247,22,135,5,194,195,87,94,28,248,80,158,36,37,23,195,2,12,250,22, +145,9,77,108,111,97,100,47,117,115,101,45,99,111,109,112,105,108,101,100,6, 25,25,112,97,116,104,32,111,114,32,118,97,108,105,100,45,112,97,116,104,32, 115,116,114,105,110,103,23,197,2,91,159,41,11,90,161,36,35,11,28,248,22, -178,13,23,201,2,23,200,1,27,247,22,134,5,28,23,193,2,249,22,179,13, -23,203,1,23,195,1,200,90,161,38,36,11,248,22,175,13,23,194,2,87,94, -23,196,1,90,161,36,39,11,28,249,22,171,8,23,196,2,68,114,101,108,97, +190,13,23,201,2,23,200,1,27,247,22,137,5,28,23,193,2,249,22,191,13, +23,203,1,23,195,1,200,90,161,38,36,11,248,22,187,13,23,194,2,87,94, +23,196,1,90,161,36,39,11,28,249,22,175,8,23,196,2,68,114,101,108,97, 116,105,118,101,87,94,23,194,1,2,21,23,194,1,90,161,36,40,11,247,22, -133,14,27,89,162,43,36,49,62,122,111,225,7,5,3,33,29,27,89,162,43, +145,14,27,89,162,43,36,49,62,122,111,225,7,5,3,33,29,27,89,162,43, 36,51,9,225,8,6,4,33,30,27,249,22,5,89,162,8,44,36,46,9,223, 5,33,31,23,203,2,27,28,23,195,1,27,249,22,5,89,162,8,44,36,52, 9,225,13,11,9,33,32,23,205,2,27,28,23,196,2,11,193,28,192,192,28, -193,28,23,196,2,28,249,22,172,3,248,22,71,196,248,22,71,23,199,2,193, +193,28,23,196,2,28,249,22,175,3,248,22,72,196,248,22,72,23,199,2,193, 11,11,11,11,28,23,193,2,249,80,159,47,58,36,202,89,162,43,35,45,9, 224,14,2,33,33,87,94,23,193,1,27,28,23,197,1,27,249,22,5,83,158, -39,20,97,94,89,162,8,44,36,50,9,225,14,12,10,33,34,23,203,1,23, -206,1,27,28,196,11,193,28,192,192,28,193,28,196,28,249,22,172,3,248,22, -71,196,248,22,71,199,193,11,11,11,11,28,192,249,80,159,48,58,36,203,89, +39,20,100,94,89,162,8,44,36,50,9,225,14,12,10,33,34,23,203,1,23, +206,1,27,28,196,11,193,28,192,192,28,193,28,196,28,249,22,175,3,248,22, +72,196,248,22,72,199,193,11,11,11,11,28,192,249,80,159,48,58,36,203,89, 162,43,35,45,9,224,15,2,33,35,249,80,159,48,58,36,203,89,162,43,35, 44,9,224,15,7,33,36,0,17,35,114,120,34,94,40,46,42,63,41,47,40, 46,42,41,36,34,32,39,89,162,8,44,36,58,2,24,222,33,40,27,249,22, -141,14,2,38,23,196,2,28,23,193,2,87,94,23,194,1,249,22,69,248,22, -94,23,196,2,27,248,22,103,23,197,1,27,249,22,141,14,2,38,23,196,2, -28,23,193,2,87,94,23,194,1,249,22,69,248,22,94,23,196,2,27,248,22, -103,23,197,1,27,249,22,141,14,2,38,23,196,2,28,23,193,2,87,94,23, -194,1,249,22,69,248,22,94,23,196,2,27,248,22,103,23,197,1,27,249,22, -141,14,2,38,23,196,2,28,23,193,2,87,94,23,194,1,249,22,69,248,22, -94,23,196,2,248,2,39,248,22,103,23,197,1,248,22,79,194,248,22,79,194, -248,22,79,194,248,22,79,194,32,41,89,162,43,36,54,2,24,222,33,42,28, -248,22,77,248,22,71,23,195,2,249,22,7,9,248,22,70,195,91,159,37,11, -90,161,37,35,11,27,248,22,71,196,28,248,22,77,248,22,71,23,195,2,249, -22,7,9,248,22,70,195,91,159,37,11,90,161,37,35,11,27,248,22,71,196, -28,248,22,77,248,22,71,23,195,2,249,22,7,9,248,22,70,195,91,159,37, -11,90,161,37,35,11,248,2,41,248,22,71,196,249,22,7,249,22,69,248,22, -70,199,196,195,249,22,7,249,22,69,248,22,70,199,196,195,249,22,7,249,22, -69,248,22,70,199,196,195,27,27,249,22,141,14,2,38,23,197,2,28,23,193, -2,87,94,23,195,1,249,22,69,248,22,94,23,196,2,27,248,22,103,23,197, -1,27,249,22,141,14,2,38,23,196,2,28,23,193,2,87,94,23,194,1,249, -22,69,248,22,94,23,196,2,27,248,22,103,23,197,1,27,249,22,141,14,2, -38,23,196,2,28,23,193,2,87,94,23,194,1,249,22,69,248,22,94,23,196, -2,27,248,22,103,23,197,1,27,249,22,141,14,2,38,23,196,2,28,23,193, -2,87,94,23,194,1,249,22,69,248,22,94,23,196,2,248,2,39,248,22,103, -23,197,1,248,22,79,194,248,22,79,194,248,22,79,194,248,22,79,195,28,23, -195,1,192,28,248,22,77,248,22,71,23,195,2,249,22,7,9,248,22,70,195, -91,159,37,11,90,161,37,35,11,27,248,22,71,196,28,248,22,77,248,22,71, -23,195,2,249,22,7,9,248,22,70,195,91,159,37,11,90,161,37,35,11,27, -248,22,71,196,28,248,22,77,248,22,71,23,195,2,249,22,7,9,248,22,70, -195,91,159,37,11,90,161,37,35,11,248,2,41,248,22,71,196,249,22,7,249, -22,69,248,22,70,199,196,195,249,22,7,249,22,69,248,22,70,199,196,195,249, -22,7,249,22,69,248,22,70,199,196,195,87,95,28,248,22,176,4,195,12,250, -22,139,9,2,17,6,20,20,114,101,115,111,108,118,101,100,45,109,111,100,117, +153,14,2,38,23,196,2,28,23,193,2,87,94,23,194,1,249,22,70,248,22, +95,23,196,2,27,248,22,104,23,197,1,27,249,22,153,14,2,38,23,196,2, +28,23,193,2,87,94,23,194,1,249,22,70,248,22,95,23,196,2,27,248,22, +104,23,197,1,27,249,22,153,14,2,38,23,196,2,28,23,193,2,87,94,23, +194,1,249,22,70,248,22,95,23,196,2,27,248,22,104,23,197,1,27,249,22, +153,14,2,38,23,196,2,28,23,193,2,87,94,23,194,1,249,22,70,248,22, +95,23,196,2,248,2,39,248,22,104,23,197,1,248,22,80,194,248,22,80,194, +248,22,80,194,248,22,80,194,32,41,89,162,43,36,54,2,24,222,33,42,28, +248,22,78,248,22,72,23,195,2,249,22,7,9,248,22,71,195,91,159,37,11, +90,161,37,35,11,27,248,22,72,196,28,248,22,78,248,22,72,23,195,2,249, +22,7,9,248,22,71,195,91,159,37,11,90,161,37,35,11,27,248,22,72,196, +28,248,22,78,248,22,72,23,195,2,249,22,7,9,248,22,71,195,91,159,37, +11,90,161,37,35,11,248,2,41,248,22,72,196,249,22,7,249,22,70,248,22, +71,199,196,195,249,22,7,249,22,70,248,22,71,199,196,195,249,22,7,249,22, +70,248,22,71,199,196,195,27,27,249,22,153,14,2,38,23,197,2,28,23,193, +2,87,94,23,195,1,249,22,70,248,22,95,23,196,2,27,248,22,104,23,197, +1,27,249,22,153,14,2,38,23,196,2,28,23,193,2,87,94,23,194,1,249, +22,70,248,22,95,23,196,2,27,248,22,104,23,197,1,27,249,22,153,14,2, +38,23,196,2,28,23,193,2,87,94,23,194,1,249,22,70,248,22,95,23,196, +2,27,248,22,104,23,197,1,27,249,22,153,14,2,38,23,196,2,28,23,193, +2,87,94,23,194,1,249,22,70,248,22,95,23,196,2,248,2,39,248,22,104, +23,197,1,248,22,80,194,248,22,80,194,248,22,80,194,248,22,80,195,28,23, +195,1,192,28,248,22,78,248,22,72,23,195,2,249,22,7,9,248,22,71,195, +91,159,37,11,90,161,37,35,11,27,248,22,72,196,28,248,22,78,248,22,72, +23,195,2,249,22,7,9,248,22,71,195,91,159,37,11,90,161,37,35,11,27, +248,22,72,196,28,248,22,78,248,22,72,23,195,2,249,22,7,9,248,22,71, +195,91,159,37,11,90,161,37,35,11,248,2,41,248,22,72,196,249,22,7,249, +22,70,248,22,71,199,196,195,249,22,7,249,22,70,248,22,71,199,196,195,249, +22,7,249,22,70,248,22,71,199,196,195,87,95,28,248,22,179,4,195,12,250, +22,145,9,2,17,6,20,20,114,101,115,111,108,118,101,100,45,109,111,100,117, 108,101,45,112,97,116,104,197,28,24,193,2,248,24,194,1,195,87,94,23,193, -1,12,27,27,250,22,143,2,80,159,41,42,37,248,22,161,14,247,22,136,12, -11,28,23,193,2,192,87,94,23,193,1,27,247,22,127,87,94,250,22,141,2, -80,159,42,42,37,248,22,161,14,247,22,136,12,195,192,250,22,141,2,195,198, -66,97,116,116,97,99,104,251,211,197,198,199,10,28,192,250,22,138,9,11,196, -195,248,22,136,9,194,32,47,89,162,43,36,51,2,24,222,33,48,28,248,22, -77,248,22,71,23,195,2,249,22,7,9,248,22,70,195,91,159,37,11,90,161, -37,35,11,27,248,22,71,196,28,248,22,77,248,22,71,23,195,2,249,22,7, -9,248,22,70,195,91,159,37,11,90,161,37,35,11,248,2,47,248,22,71,196, -249,22,7,249,22,69,248,22,70,199,196,195,249,22,7,249,22,69,248,22,70, -199,196,195,32,49,89,162,8,44,36,54,2,24,222,33,50,27,249,22,141,14, -2,38,23,196,2,28,23,193,2,87,94,23,194,1,249,22,69,248,22,94,23, -196,2,27,248,22,103,23,197,1,27,249,22,141,14,2,38,23,196,2,28,23, -193,2,87,94,23,194,1,249,22,69,248,22,94,23,196,2,27,248,22,103,23, -197,1,27,249,22,141,14,2,38,23,196,2,28,23,193,2,87,94,23,194,1, -249,22,69,248,22,94,23,196,2,248,2,49,248,22,103,23,197,1,248,22,79, -194,248,22,79,194,248,22,79,194,32,51,89,162,43,36,51,2,24,222,33,52, -28,248,22,77,248,22,71,23,195,2,249,22,7,9,248,22,70,195,91,159,37, -11,90,161,37,35,11,27,248,22,71,196,28,248,22,77,248,22,71,23,195,2, -249,22,7,9,248,22,70,195,91,159,37,11,90,161,37,35,11,248,2,51,248, -22,71,196,249,22,7,249,22,69,248,22,70,199,196,195,249,22,7,249,22,69, -248,22,70,199,196,195,32,53,89,162,8,44,36,54,2,24,222,33,54,27,249, -22,141,14,2,38,23,196,2,28,23,193,2,87,94,23,194,1,249,22,69,248, -22,94,23,196,2,27,248,22,103,23,197,1,27,249,22,141,14,2,38,23,196, -2,28,23,193,2,87,94,23,194,1,249,22,69,248,22,94,23,196,2,27,248, -22,103,23,197,1,27,249,22,141,14,2,38,23,196,2,28,23,193,2,87,94, -23,194,1,249,22,69,248,22,94,23,196,2,248,2,53,248,22,103,23,197,1, -248,22,79,194,248,22,79,194,248,22,79,194,28,249,22,172,6,194,6,1,1, -46,2,21,28,249,22,172,6,194,6,2,2,46,46,62,117,112,192,32,56,89, -162,43,36,51,2,24,222,33,57,28,248,22,77,248,22,71,23,195,2,249,22, -7,9,248,22,70,195,91,159,37,11,90,161,37,35,11,27,248,22,71,196,28, -248,22,77,248,22,71,23,195,2,249,22,7,9,248,22,70,195,91,159,37,11, -90,161,37,35,11,248,2,56,248,22,71,196,249,22,7,249,22,69,248,22,70, -199,196,195,249,22,7,249,22,69,248,22,70,199,196,195,32,58,89,162,8,44, -36,54,2,24,222,33,59,27,249,22,141,14,2,38,23,196,2,28,23,193,2, -87,94,23,194,1,249,22,69,248,22,94,23,196,2,27,248,22,103,23,197,1, -27,249,22,141,14,2,38,23,196,2,28,23,193,2,87,94,23,194,1,249,22, -69,248,22,94,23,196,2,27,248,22,103,23,197,1,27,249,22,141,14,2,38, -23,196,2,28,23,193,2,87,94,23,194,1,249,22,69,248,22,94,23,196,2, -248,2,58,248,22,103,23,197,1,248,22,79,194,248,22,79,194,248,22,79,194, -32,60,89,162,8,44,36,54,2,24,222,33,61,27,249,22,141,14,2,38,23, -196,2,28,23,193,2,87,94,23,194,1,249,22,69,248,22,94,23,196,2,27, -248,22,103,23,197,1,27,249,22,141,14,2,38,23,196,2,28,23,193,2,87, -94,23,194,1,249,22,69,248,22,94,23,196,2,27,248,22,103,23,197,1,27, -249,22,141,14,2,38,23,196,2,28,23,193,2,87,94,23,194,1,249,22,69, -248,22,94,23,196,2,248,2,60,248,22,103,23,197,1,248,22,79,194,248,22, -79,194,248,22,79,194,27,248,2,60,23,195,1,192,28,249,22,173,8,248,22, -71,23,200,2,23,197,1,28,249,22,171,8,248,22,70,23,200,2,23,196,1, -251,22,136,9,2,17,6,26,26,99,121,99,108,101,32,105,110,32,108,111,97, -100,105,110,103,32,97,116,32,126,101,58,32,126,101,23,200,1,249,22,2,22, -71,248,22,84,249,22,69,23,206,1,23,202,1,12,12,247,192,20,14,159,80, -159,39,44,37,249,22,69,248,22,161,14,247,22,136,12,23,197,1,20,14,159, -80,158,39,39,250,80,158,42,40,249,22,27,11,80,158,44,39,22,158,4,23, -196,1,249,247,22,133,5,23,198,1,248,22,57,248,22,158,13,23,198,1,87, -94,28,28,248,22,154,13,23,196,2,10,248,22,184,4,23,196,2,12,28,23, -197,2,250,22,138,9,11,6,15,15,98,97,100,32,109,111,100,117,108,101,32, -112,97,116,104,23,200,2,250,22,139,9,2,17,6,19,19,109,111,100,117,108, -101,45,112,97,116,104,32,111,114,32,112,97,116,104,23,198,2,28,28,248,22, -67,23,196,2,249,22,171,8,248,22,70,23,198,2,2,3,11,248,22,177,4, -248,22,94,196,28,28,248,22,67,23,196,2,249,22,171,8,248,22,70,23,198, -2,66,112,108,97,110,101,116,11,87,94,28,207,12,20,14,159,80,158,36,51, -80,158,36,49,90,161,36,35,10,249,22,159,4,21,94,2,25,6,18,18,112, -108,97,110,101,116,47,114,101,115,111,108,118,101,114,46,115,115,1,27,112,108, -97,110,101,116,45,109,111,100,117,108,101,45,110,97,109,101,45,114,101,115,111, -108,118,101,114,12,252,212,199,200,201,202,80,158,41,49,87,94,23,193,1,27, -89,162,8,44,36,45,79,115,104,111,119,45,99,111,108,108,101,99,116,105,111, -110,45,101,114,114,223,5,33,46,27,28,248,22,54,23,198,2,27,250,22,143, -2,80,159,42,43,37,249,22,69,23,203,2,247,22,132,14,11,28,23,193,2, -192,87,94,23,193,1,91,159,37,11,90,161,37,35,11,27,248,22,60,23,202, -2,248,2,47,248,2,49,23,195,1,27,251,80,158,46,52,2,17,23,202,1, -28,248,22,77,23,199,2,23,199,2,248,22,70,23,199,2,28,248,22,77,23, -199,2,9,248,22,71,23,199,2,249,22,172,13,23,195,1,28,248,22,77,23, -197,1,87,94,23,197,1,6,7,7,109,97,105,110,46,115,115,249,22,189,6, -23,199,1,6,3,3,46,115,115,28,248,22,166,6,23,198,2,87,94,23,194, -1,27,27,28,23,200,2,28,249,22,171,8,23,202,2,80,158,42,46,80,158, -40,47,27,248,22,178,4,23,202,2,28,248,22,154,13,23,194,2,91,159,38, -11,90,161,38,35,11,248,22,175,13,23,197,1,87,95,83,160,37,11,80,158, -44,46,23,204,2,83,160,37,11,80,158,44,47,192,192,11,11,28,23,193,2, -192,87,94,23,193,1,27,247,22,134,5,28,23,193,2,192,87,94,23,193,1, -247,22,131,14,27,250,22,143,2,80,159,43,43,37,249,22,69,23,204,2,23, -199,2,11,28,23,193,2,192,87,94,23,193,1,91,159,37,11,90,161,37,35, -11,248,2,51,248,2,53,23,203,2,250,22,1,22,172,13,23,199,1,249,22, -83,249,22,2,32,0,89,162,8,44,36,43,9,222,33,55,23,200,1,248,22, -79,23,200,1,28,248,22,154,13,23,198,2,87,94,23,194,1,28,248,22,177, -13,23,198,2,23,197,2,248,22,79,6,26,26,32,40,97,32,112,97,116,104, -32,109,117,115,116,32,98,101,32,97,98,115,111,108,117,116,101,41,28,249,22, -171,8,248,22,70,23,200,2,2,25,27,250,22,143,2,80,159,42,43,37,249, -22,69,23,203,2,247,22,132,14,11,28,23,193,2,192,87,94,23,193,1,91, -159,38,11,90,161,37,35,11,27,248,22,94,23,203,2,248,2,56,248,2,58, -23,195,1,90,161,36,37,11,28,248,22,77,248,22,96,23,203,2,28,248,22, -77,23,194,2,249,22,143,14,0,8,35,114,120,34,91,46,93,34,23,196,2, -11,10,27,27,28,23,197,2,249,22,83,28,248,22,77,248,22,96,23,207,2, -21,93,6,5,5,109,122,108,105,98,249,22,1,22,83,249,22,2,32,0,89, -162,8,44,36,43,9,222,33,62,248,22,96,23,210,2,23,197,2,28,248,22, -77,23,196,2,248,22,79,23,197,2,23,195,2,251,80,158,48,52,2,17,23, -204,1,248,22,70,23,198,2,248,22,71,23,198,1,249,22,172,13,23,195,1, -28,23,198,1,87,94,23,196,1,23,197,1,28,248,22,77,23,197,1,87,94, -23,197,1,6,7,7,109,97,105,110,46,115,115,28,249,22,143,14,0,8,35, -114,120,34,91,46,93,34,23,199,2,23,197,1,249,22,189,6,23,199,1,6, -3,3,46,115,115,28,249,22,171,8,248,22,70,23,200,2,64,102,105,108,101, -249,22,179,13,248,22,183,13,248,22,94,23,201,2,27,28,23,201,2,28,249, -22,171,8,23,203,2,80,158,43,46,80,158,41,47,27,248,22,178,4,23,203, -2,28,248,22,154,13,23,194,2,91,159,38,11,90,161,38,35,11,248,22,175, -13,23,197,1,87,95,83,160,37,11,80,158,45,46,23,205,2,83,160,37,11, -80,158,45,47,192,192,11,11,28,23,193,2,192,87,94,23,193,1,27,247,22, -134,5,28,23,193,2,192,87,94,23,193,1,247,22,131,14,12,87,94,28,28, -248,22,154,13,23,194,2,10,248,22,188,7,23,194,2,87,94,23,199,1,12, -28,23,199,2,250,22,138,9,67,114,101,113,117,105,114,101,249,22,150,7,6, -17,17,98,97,100,32,109,111,100,117,108,101,32,112,97,116,104,126,97,28,23, -198,2,248,22,70,23,199,2,6,0,0,23,202,1,87,94,23,199,1,250,22, -139,9,2,17,249,22,150,7,6,13,13,109,111,100,117,108,101,32,112,97,116, -104,126,97,28,23,198,2,248,22,70,23,199,2,6,0,0,23,200,2,27,28, -248,22,188,7,23,195,2,249,22,129,8,23,196,2,35,249,22,181,13,248,22, -182,13,23,197,2,11,27,28,248,22,188,7,23,196,2,249,22,129,8,23,197, -2,36,248,80,158,41,53,23,195,2,91,159,38,11,90,161,38,35,11,28,248, -22,188,7,23,199,2,250,22,7,2,26,249,22,129,8,23,203,2,37,2,26, -248,22,175,13,23,198,2,87,95,23,195,1,23,193,1,27,28,248,22,188,7, -23,200,2,249,22,129,8,23,201,2,38,249,80,158,46,54,23,197,2,5,0, -27,28,248,22,188,7,23,201,2,249,22,129,8,23,202,2,39,248,22,177,4, -23,200,2,27,27,250,22,143,2,80,159,50,42,37,248,22,161,14,247,22,136, -12,11,28,23,193,2,192,87,94,23,193,1,27,247,22,127,87,94,250,22,141, -2,80,159,51,42,37,248,22,161,14,247,22,136,12,195,192,87,95,28,23,208, -1,27,250,22,143,2,23,197,2,197,11,28,23,193,1,12,87,95,27,27,28, -248,22,17,80,159,50,45,37,80,159,49,45,37,247,22,19,250,22,25,248,22, -23,23,197,2,80,159,52,44,37,23,196,1,27,248,22,161,14,247,22,136,12, -249,22,3,83,158,39,20,97,94,89,162,8,44,36,54,9,226,12,11,2,3, -33,63,23,195,1,23,196,1,248,28,248,22,17,80,159,49,45,37,32,0,89, -162,43,36,41,9,222,33,64,80,159,48,59,36,89,162,43,35,50,9,227,13, -9,8,4,3,33,65,250,22,141,2,23,197,1,197,10,12,28,28,248,22,188, -7,23,202,1,11,28,248,22,166,6,23,206,2,10,28,248,22,54,23,206,2, -10,28,248,22,67,23,206,2,249,22,171,8,248,22,70,23,208,2,2,25,11, -250,22,141,2,80,159,49,43,37,28,248,22,166,6,23,209,2,249,22,69,23, -210,1,27,28,23,212,2,28,249,22,171,8,23,214,2,80,158,54,46,87,94, -23,212,1,80,158,52,47,27,248,22,178,4,23,214,2,28,248,22,154,13,23, -194,2,91,159,38,11,90,161,38,35,11,248,22,175,13,23,197,1,87,95,83, -160,37,11,80,158,56,46,23,23,83,160,37,11,80,158,56,47,192,192,11,11, -28,23,193,2,192,87,94,23,193,1,27,247,22,134,5,28,23,193,2,192,87, -94,23,193,1,247,22,131,14,249,22,69,23,210,1,247,22,132,14,252,22,190, -7,23,208,1,23,207,1,23,205,1,23,203,1,201,12,193,87,96,83,160,37, -11,80,158,35,49,248,80,158,36,57,249,22,27,11,80,158,38,51,248,22,157, -4,80,159,36,50,37,248,22,133,5,80,159,36,36,36,248,22,191,12,80,159, -36,41,36,83,160,37,11,80,158,35,49,248,80,158,36,57,249,22,27,11,80, -158,38,51,159,35,20,102,159,35,16,1,11,16,0,83,158,41,20,100,144,66, -35,37,98,111,111,116,29,11,11,11,11,11,10,37,80,158,35,35,20,102,159, -37,16,23,2,1,2,2,30,2,4,72,112,97,116,104,45,115,116,114,105,110, -103,63,10,30,2,4,75,112,97,116,104,45,97,100,100,45,115,117,102,102,105, -120,7,30,2,6,2,7,4,30,2,6,1,23,101,120,116,101,110,100,45,112, -97,114,97,109,101,116,101,114,105,122,97,116,105,111,110,3,2,8,2,9,2, -10,2,11,2,12,2,13,2,14,2,15,2,16,2,17,30,2,18,2,7,4, -30,2,4,69,45,102,105,110,100,45,99,111,108,0,30,2,4,76,110,111,114, -109,97,108,45,99,97,115,101,45,112,97,116,104,6,30,2,4,79,112,97,116, -104,45,114,101,112,108,97,99,101,45,115,117,102,102,105,120,9,2,19,2,20, -30,2,18,74,114,101,112,97,114,97,109,101,116,101,114,105,122,101,5,16,0, -16,0,35,16,0,35,16,12,2,11,2,12,2,9,2,10,2,13,2,14,2, -2,2,8,2,1,2,16,2,15,2,17,47,11,11,38,35,11,11,11,16,2, -2,19,2,20,16,2,11,11,16,2,2,19,2,20,37,37,36,11,11,11,16, -0,16,0,16,0,35,35,11,11,11,11,16,0,16,0,16,0,35,35,16,0, -16,16,83,158,35,16,2,89,162,43,36,44,9,223,0,33,27,80,159,35,59, -36,83,158,35,16,2,89,162,43,37,48,68,119,105,116,104,45,100,105,114,223, -0,33,28,80,159,35,58,36,83,158,35,16,2,248,22,185,7,69,115,111,45, -115,117,102,102,105,120,80,159,35,35,36,83,158,35,16,2,89,162,43,37,59, -2,2,223,0,33,37,80,159,35,36,36,83,158,35,16,2,32,0,89,162,8, -44,36,41,2,8,222,192,80,159,35,41,36,83,158,35,16,2,247,22,130,2, -80,159,35,42,36,83,158,35,16,2,247,22,129,2,80,159,35,43,36,83,158, -35,16,2,247,22,65,80,159,35,44,36,83,158,35,16,2,248,22,18,74,109, -111,100,117,108,101,45,108,111,97,100,105,110,103,80,159,35,45,36,83,158,35, -16,2,11,80,158,35,46,83,158,35,16,2,11,80,158,35,47,83,158,35,16, -2,32,0,89,162,43,37,8,25,2,15,222,33,43,80,159,35,48,36,83,158, -35,16,2,11,80,158,35,49,83,158,35,16,2,91,159,37,10,90,161,36,35, -10,11,90,161,36,36,10,83,158,38,20,96,96,2,17,89,162,8,44,36,50, -9,224,2,0,33,44,89,162,43,38,48,9,223,1,33,45,89,162,43,39,8, -32,9,224,2,0,33,66,208,80,159,35,50,36,83,158,35,16,2,89,162,43, -35,44,2,19,223,0,33,67,80,159,35,55,36,83,158,35,16,2,89,162,8, -44,35,44,2,20,223,0,33,68,80,159,35,56,36,96,29,94,2,3,68,35, -37,107,101,114,110,101,108,11,29,94,2,3,69,35,37,109,105,110,45,115,116, -120,11,2,4,2,18,9,9,9,35,0}; - EVAL_ONE_SIZED_STR((char *)expr, 5512); +1,12,27,27,250,22,145,2,80,159,41,42,37,248,22,173,14,247,22,148,12, +11,28,23,193,2,192,87,94,23,193,1,27,247,22,129,2,87,94,250,22,143, +2,80,159,42,42,37,248,22,173,14,247,22,148,12,195,192,250,22,143,2,195, +198,66,97,116,116,97,99,104,251,211,197,198,199,10,28,192,250,22,144,9,11, +196,195,248,22,142,9,194,32,47,89,162,43,36,51,2,24,222,33,48,28,248, +22,78,248,22,72,23,195,2,249,22,7,9,248,22,71,195,91,159,37,11,90, +161,37,35,11,27,248,22,72,196,28,248,22,78,248,22,72,23,195,2,249,22, +7,9,248,22,71,195,91,159,37,11,90,161,37,35,11,248,2,47,248,22,72, +196,249,22,7,249,22,70,248,22,71,199,196,195,249,22,7,249,22,70,248,22, +71,199,196,195,32,49,89,162,8,44,36,54,2,24,222,33,50,27,249,22,153, +14,2,38,23,196,2,28,23,193,2,87,94,23,194,1,249,22,70,248,22,95, +23,196,2,27,248,22,104,23,197,1,27,249,22,153,14,2,38,23,196,2,28, +23,193,2,87,94,23,194,1,249,22,70,248,22,95,23,196,2,27,248,22,104, +23,197,1,27,249,22,153,14,2,38,23,196,2,28,23,193,2,87,94,23,194, +1,249,22,70,248,22,95,23,196,2,248,2,49,248,22,104,23,197,1,248,22, +80,194,248,22,80,194,248,22,80,194,32,51,89,162,43,36,51,2,24,222,33, +52,28,248,22,78,248,22,72,23,195,2,249,22,7,9,248,22,71,195,91,159, +37,11,90,161,37,35,11,27,248,22,72,196,28,248,22,78,248,22,72,23,195, +2,249,22,7,9,248,22,71,195,91,159,37,11,90,161,37,35,11,248,2,51, +248,22,72,196,249,22,7,249,22,70,248,22,71,199,196,195,249,22,7,249,22, +70,248,22,71,199,196,195,32,53,89,162,8,44,36,54,2,24,222,33,54,27, +249,22,153,14,2,38,23,196,2,28,23,193,2,87,94,23,194,1,249,22,70, +248,22,95,23,196,2,27,248,22,104,23,197,1,27,249,22,153,14,2,38,23, +196,2,28,23,193,2,87,94,23,194,1,249,22,70,248,22,95,23,196,2,27, +248,22,104,23,197,1,27,249,22,153,14,2,38,23,196,2,28,23,193,2,87, +94,23,194,1,249,22,70,248,22,95,23,196,2,248,2,53,248,22,104,23,197, +1,248,22,80,194,248,22,80,194,248,22,80,194,28,249,22,175,6,194,6,1, +1,46,2,21,28,249,22,175,6,194,6,2,2,46,46,62,117,112,192,32,56, +89,162,43,36,51,2,24,222,33,57,28,248,22,78,248,22,72,23,195,2,249, +22,7,9,248,22,71,195,91,159,37,11,90,161,37,35,11,27,248,22,72,196, +28,248,22,78,248,22,72,23,195,2,249,22,7,9,248,22,71,195,91,159,37, +11,90,161,37,35,11,248,2,56,248,22,72,196,249,22,7,249,22,70,248,22, +71,199,196,195,249,22,7,249,22,70,248,22,71,199,196,195,32,58,89,162,8, +44,36,54,2,24,222,33,59,27,249,22,153,14,2,38,23,196,2,28,23,193, +2,87,94,23,194,1,249,22,70,248,22,95,23,196,2,27,248,22,104,23,197, +1,27,249,22,153,14,2,38,23,196,2,28,23,193,2,87,94,23,194,1,249, +22,70,248,22,95,23,196,2,27,248,22,104,23,197,1,27,249,22,153,14,2, +38,23,196,2,28,23,193,2,87,94,23,194,1,249,22,70,248,22,95,23,196, +2,248,2,58,248,22,104,23,197,1,248,22,80,194,248,22,80,194,248,22,80, +194,32,60,89,162,8,44,36,54,2,24,222,33,61,27,249,22,153,14,2,38, +23,196,2,28,23,193,2,87,94,23,194,1,249,22,70,248,22,95,23,196,2, +27,248,22,104,23,197,1,27,249,22,153,14,2,38,23,196,2,28,23,193,2, +87,94,23,194,1,249,22,70,248,22,95,23,196,2,27,248,22,104,23,197,1, +27,249,22,153,14,2,38,23,196,2,28,23,193,2,87,94,23,194,1,249,22, +70,248,22,95,23,196,2,248,2,60,248,22,104,23,197,1,248,22,80,194,248, +22,80,194,248,22,80,194,27,248,2,60,23,195,1,192,28,249,22,177,8,248, +22,72,23,200,2,23,197,1,28,249,22,175,8,248,22,71,23,200,2,23,196, +1,251,22,142,9,2,17,6,26,26,99,121,99,108,101,32,105,110,32,108,111, +97,100,105,110,103,32,97,116,32,126,101,58,32,126,101,23,200,1,249,22,2, +22,72,248,22,85,249,22,70,23,206,1,23,202,1,12,12,247,192,20,14,159, +80,159,39,44,37,249,22,70,248,22,173,14,247,22,148,12,23,197,1,20,14, +159,80,158,39,39,250,80,158,42,40,249,22,27,11,80,158,44,39,22,161,4, +23,196,1,249,247,22,136,5,23,198,1,248,22,58,248,22,170,13,23,198,1, +87,94,28,28,248,22,166,13,23,196,2,10,248,22,187,4,23,196,2,12,28, +23,197,2,250,22,144,9,11,6,15,15,98,97,100,32,109,111,100,117,108,101, +32,112,97,116,104,23,200,2,250,22,145,9,2,17,6,19,19,109,111,100,117, +108,101,45,112,97,116,104,32,111,114,32,112,97,116,104,23,198,2,28,28,248, +22,68,23,196,2,249,22,175,8,248,22,71,23,198,2,2,3,11,248,22,180, +4,248,22,95,196,28,28,248,22,68,23,196,2,249,22,175,8,248,22,71,23, +198,2,66,112,108,97,110,101,116,11,87,94,28,207,12,20,14,159,80,158,36, +51,80,158,36,49,90,161,36,35,10,249,22,162,4,21,94,2,25,6,18,18, +112,108,97,110,101,116,47,114,101,115,111,108,118,101,114,46,115,115,1,27,112, +108,97,110,101,116,45,109,111,100,117,108,101,45,110,97,109,101,45,114,101,115, +111,108,118,101,114,12,252,212,199,200,201,202,80,158,41,49,87,94,23,193,1, +27,89,162,8,44,36,45,79,115,104,111,119,45,99,111,108,108,101,99,116,105, +111,110,45,101,114,114,223,5,33,46,27,28,248,22,55,23,198,2,27,250,22, +145,2,80,159,42,43,37,249,22,70,23,203,2,247,22,144,14,11,28,23,193, +2,192,87,94,23,193,1,91,159,37,11,90,161,37,35,11,27,248,22,61,23, +202,2,248,2,47,248,2,49,23,195,1,27,251,80,158,46,52,2,17,23,202, +1,28,248,22,78,23,199,2,23,199,2,248,22,71,23,199,2,28,248,22,78, +23,199,2,9,248,22,72,23,199,2,249,22,184,13,23,195,1,28,248,22,78, +23,197,1,87,94,23,197,1,6,7,7,109,97,105,110,46,115,115,249,22,128, +7,23,199,1,6,3,3,46,115,115,28,248,22,169,6,23,198,2,87,94,23, +194,1,27,27,28,23,200,2,28,249,22,175,8,23,202,2,80,158,42,46,80, +158,40,47,27,248,22,181,4,23,202,2,28,248,22,166,13,23,194,2,91,159, +38,11,90,161,38,35,11,248,22,187,13,23,197,1,87,95,83,160,37,11,80, +158,44,46,23,204,2,83,160,37,11,80,158,44,47,192,192,11,11,28,23,193, +2,192,87,94,23,193,1,27,247,22,137,5,28,23,193,2,192,87,94,23,193, +1,247,22,143,14,27,250,22,145,2,80,159,43,43,37,249,22,70,23,204,2, +23,199,2,11,28,23,193,2,192,87,94,23,193,1,91,159,37,11,90,161,37, +35,11,248,2,51,248,2,53,23,203,2,250,22,1,22,184,13,23,199,1,249, +22,84,249,22,2,32,0,89,162,8,44,36,43,9,222,33,55,23,200,1,248, +22,80,23,200,1,28,248,22,166,13,23,198,2,87,94,23,194,1,28,248,22, +189,13,23,198,2,23,197,2,248,22,80,6,26,26,32,40,97,32,112,97,116, +104,32,109,117,115,116,32,98,101,32,97,98,115,111,108,117,116,101,41,28,249, +22,175,8,248,22,71,23,200,2,2,25,27,250,22,145,2,80,159,42,43,37, +249,22,70,23,203,2,247,22,144,14,11,28,23,193,2,192,87,94,23,193,1, +91,159,38,11,90,161,37,35,11,27,248,22,95,23,203,2,248,2,56,248,2, +58,23,195,1,90,161,36,37,11,28,248,22,78,248,22,97,23,203,2,28,248, +22,78,23,194,2,249,22,155,14,0,8,35,114,120,34,91,46,93,34,23,196, +2,11,10,27,27,28,23,197,2,249,22,84,28,248,22,78,248,22,97,23,207, +2,21,93,6,5,5,109,122,108,105,98,249,22,1,22,84,249,22,2,32,0, +89,162,8,44,36,43,9,222,33,62,248,22,97,23,210,2,23,197,2,28,248, +22,78,23,196,2,248,22,80,23,197,2,23,195,2,251,80,158,48,52,2,17, +23,204,1,248,22,71,23,198,2,248,22,72,23,198,1,249,22,184,13,23,195, +1,28,23,198,1,87,94,23,196,1,23,197,1,28,248,22,78,23,197,1,87, +94,23,197,1,6,7,7,109,97,105,110,46,115,115,28,249,22,155,14,0,8, +35,114,120,34,91,46,93,34,23,199,2,23,197,1,249,22,128,7,23,199,1, +6,3,3,46,115,115,28,249,22,175,8,248,22,71,23,200,2,64,102,105,108, +101,249,22,191,13,248,22,131,14,248,22,95,23,201,2,27,28,23,201,2,28, +249,22,175,8,23,203,2,80,158,43,46,80,158,41,47,27,248,22,181,4,23, +203,2,28,248,22,166,13,23,194,2,91,159,38,11,90,161,38,35,11,248,22, +187,13,23,197,1,87,95,83,160,37,11,80,158,45,46,23,205,2,83,160,37, +11,80,158,45,47,192,192,11,11,28,23,193,2,192,87,94,23,193,1,27,247, +22,137,5,28,23,193,2,192,87,94,23,193,1,247,22,143,14,12,87,94,28, +28,248,22,166,13,23,194,2,10,248,22,191,7,23,194,2,87,94,23,199,1, +12,28,23,199,2,250,22,144,9,67,114,101,113,117,105,114,101,249,22,153,7, +6,17,17,98,97,100,32,109,111,100,117,108,101,32,112,97,116,104,126,97,28, +23,198,2,248,22,71,23,199,2,6,0,0,23,202,1,87,94,23,199,1,250, +22,145,9,2,17,249,22,153,7,6,13,13,109,111,100,117,108,101,32,112,97, +116,104,126,97,28,23,198,2,248,22,71,23,199,2,6,0,0,23,200,2,27, +28,248,22,191,7,23,195,2,249,22,132,8,23,196,2,35,249,22,129,14,248, +22,130,14,23,197,2,11,27,28,248,22,191,7,23,196,2,249,22,132,8,23, +197,2,36,248,80,158,41,53,23,195,2,91,159,38,11,90,161,38,35,11,28, +248,22,191,7,23,199,2,250,22,7,2,26,249,22,132,8,23,203,2,37,2, +26,248,22,187,13,23,198,2,87,95,23,195,1,23,193,1,27,28,248,22,191, +7,23,200,2,249,22,132,8,23,201,2,38,249,80,158,46,54,23,197,2,5, +0,27,28,248,22,191,7,23,201,2,249,22,132,8,23,202,2,39,248,22,180, +4,23,200,2,27,27,250,22,145,2,80,159,50,42,37,248,22,173,14,247,22, +148,12,11,28,23,193,2,192,87,94,23,193,1,27,247,22,129,2,87,94,250, +22,143,2,80,159,51,42,37,248,22,173,14,247,22,148,12,195,192,87,95,28, +23,208,1,27,250,22,145,2,23,197,2,197,11,28,23,193,1,12,87,95,27, +27,28,248,22,17,80,159,50,45,37,80,159,49,45,37,247,22,19,250,22,25, +248,22,23,23,197,2,80,159,52,44,37,23,196,1,27,248,22,173,14,247,22, +148,12,249,22,3,83,158,39,20,100,94,89,162,8,44,36,54,9,226,12,11, +2,3,33,63,23,195,1,23,196,1,248,28,248,22,17,80,159,49,45,37,32, +0,89,162,43,36,41,9,222,33,64,80,159,48,59,36,89,162,43,35,50,9, +227,13,9,8,4,3,33,65,250,22,143,2,23,197,1,197,10,12,28,28,248, +22,191,7,23,202,1,11,28,248,22,169,6,23,206,2,10,28,248,22,55,23, +206,2,10,28,248,22,68,23,206,2,249,22,175,8,248,22,71,23,208,2,2, +25,11,250,22,143,2,80,159,49,43,37,28,248,22,169,6,23,209,2,249,22, +70,23,210,1,27,28,23,212,2,28,249,22,175,8,23,214,2,80,158,54,46, +87,94,23,212,1,80,158,52,47,27,248,22,181,4,23,214,2,28,248,22,166, +13,23,194,2,91,159,38,11,90,161,38,35,11,248,22,187,13,23,197,1,87, +95,83,160,37,11,80,158,56,46,23,23,83,160,37,11,80,158,56,47,192,192, +11,11,28,23,193,2,192,87,94,23,193,1,27,247,22,137,5,28,23,193,2, +192,87,94,23,193,1,247,22,143,14,249,22,70,23,210,1,247,22,144,14,252, +22,129,8,23,208,1,23,207,1,23,205,1,23,203,1,201,12,193,87,96,83, +160,37,11,80,158,35,49,248,80,158,36,57,249,22,27,11,80,158,38,51,248, +22,160,4,80,159,36,50,37,248,22,136,5,80,159,36,36,36,248,22,139,13, +80,159,36,41,36,83,160,37,11,80,158,35,49,248,80,158,36,57,249,22,27, +11,80,158,38,51,159,35,20,105,159,35,16,1,11,16,0,83,158,41,20,103, +144,66,35,37,98,111,111,116,29,11,11,11,11,11,10,37,80,158,35,35,20, +105,159,37,16,23,2,1,2,2,30,2,4,72,112,97,116,104,45,115,116,114, +105,110,103,63,10,30,2,4,75,112,97,116,104,45,97,100,100,45,115,117,102, +102,105,120,7,30,2,6,2,7,4,30,2,6,1,23,101,120,116,101,110,100, +45,112,97,114,97,109,101,116,101,114,105,122,97,116,105,111,110,3,2,8,2, +9,2,10,2,11,2,12,2,13,2,14,2,15,2,16,2,17,30,2,18,2, +7,4,30,2,4,69,45,102,105,110,100,45,99,111,108,0,30,2,4,76,110, +111,114,109,97,108,45,99,97,115,101,45,112,97,116,104,6,30,2,4,79,112, +97,116,104,45,114,101,112,108,97,99,101,45,115,117,102,102,105,120,9,2,19, +2,20,30,2,18,74,114,101,112,97,114,97,109,101,116,101,114,105,122,101,5, +16,0,16,0,35,16,0,35,16,12,2,11,2,12,2,9,2,10,2,13,2, +14,2,2,2,8,2,1,2,16,2,15,2,17,47,11,11,38,35,11,11,11, +16,2,2,19,2,20,16,2,11,11,16,2,2,19,2,20,37,37,36,11,11, +11,16,0,16,0,16,0,35,35,11,11,11,11,16,0,16,0,16,0,35,35, +16,0,16,16,83,158,35,16,2,89,162,43,36,44,9,223,0,33,27,80,159, +35,59,36,83,158,35,16,2,89,162,43,37,48,68,119,105,116,104,45,100,105, +114,223,0,33,28,80,159,35,58,36,83,158,35,16,2,248,22,188,7,69,115, +111,45,115,117,102,102,105,120,80,159,35,35,36,83,158,35,16,2,89,162,43, +37,59,2,2,223,0,33,37,80,159,35,36,36,83,158,35,16,2,32,0,89, +162,8,44,36,41,2,8,222,192,80,159,35,41,36,83,158,35,16,2,247,22, +132,2,80,159,35,42,36,83,158,35,16,2,247,22,131,2,80,159,35,43,36, +83,158,35,16,2,247,22,66,80,159,35,44,36,83,158,35,16,2,248,22,18, +74,109,111,100,117,108,101,45,108,111,97,100,105,110,103,80,159,35,45,36,83, +158,35,16,2,11,80,158,35,46,83,158,35,16,2,11,80,158,35,47,83,158, +35,16,2,32,0,89,162,43,37,8,25,2,15,222,33,43,80,159,35,48,36, +83,158,35,16,2,11,80,158,35,49,83,158,35,16,2,91,159,37,10,90,161, +36,35,10,11,90,161,36,36,10,83,158,38,20,99,96,2,17,89,162,8,44, +36,50,9,224,2,0,33,44,89,162,43,38,48,9,223,1,33,45,89,162,43, +39,8,32,9,224,2,0,33,66,208,80,159,35,50,36,83,158,35,16,2,89, +162,43,35,44,2,19,223,0,33,67,80,159,35,55,36,83,158,35,16,2,89, +162,8,44,35,44,2,20,223,0,33,68,80,159,35,56,36,96,29,94,2,3, +68,35,37,107,101,114,110,101,108,11,29,94,2,3,69,35,37,109,105,110,45, +115,116,120,11,2,4,2,18,9,9,9,35,0}; + EVAL_ONE_SIZED_STR((char *)expr, 5514); } diff --git a/src/mzscheme/src/error.c b/src/mzscheme/src/error.c index 8ae2c2fd71..463f87770a 100644 --- a/src/mzscheme/src/error.c +++ b/src/mzscheme/src/error.c @@ -671,7 +671,7 @@ call_error(char *buffer, int len, Scheme_Object *exn) "optimizer constant-fold attempt failed%s: %s", scheme_optimize_context_to_string(scheme_current_thread->constant_folding), buffer); - if (SCHEME_STRUCTP(exn) + if (SCHEME_CHAPERONE_STRUCTP(exn) && scheme_is_struct_instance(exn_table[MZEXN_BREAK].type, exn)) { /* remember to re-raise exception */ scheme_current_thread->reading_delayed = exn; @@ -965,7 +965,7 @@ static char *make_arity_expect_string(const char *name, int namelen, xminc = minc - (is_method ? 1 : 0); xmaxc = maxc - (is_method ? 1 : 0); - if ((minc == -1) && SCHEME_PROC_STRUCTP((Scheme_Object *)name)) { + if ((minc == -1) && SCHEME_CHAPERONE_PROC_STRUCTP((Scheme_Object *)name)) { Scheme_Object *arity_maker; while (1) { @@ -992,7 +992,7 @@ static char *make_arity_expect_string(const char *name, int namelen, Scheme_Object *v; int is_method; v = scheme_extract_struct_procedure((Scheme_Object *)name, -1, NULL, &is_method); - if (!v || is_method || !SCHEME_PROC_STRUCTP(v)) + if (!v || is_method || !SCHEME_CHAPERONE_PROC_STRUCTP(v)) break; name = (const char *)v; } @@ -1138,7 +1138,7 @@ void scheme_wrong_count_m(const char *name, int minc, int maxc, name = scheme_get_proc_name((Scheme_Object *)name, NULL, 1); } else if (SCHEME_STRUCTP(pa)) { /* This happens when a non-case-lambda is not yet JITted. - It's an arity-at-least record. */ + It's an arity-at-least record. */ pa = ((Scheme_Structure *)pa)->slots[0]; minc = SCHEME_INT_VAL(pa); maxc = -1; @@ -1241,7 +1241,7 @@ char *scheme_make_arity_expect_string(Scheme_Object *proc, } name = scheme_get_proc_name((Scheme_Object *)proc, &namelen, 1); #endif - } else if (SCHEME_STRUCTP(proc)) { + } else if (SCHEME_CHAPERONE_STRUCTP(proc)) { name = (const char *)proc; mina = -1; maxa = 0; @@ -2159,7 +2159,7 @@ static Scheme_Object *raise_mismatch_error(int argc, Scheme_Object *argv[]) static int is_arity_at_least(Scheme_Object *v) { - return (SCHEME_STRUCTP(v) + return (SCHEME_CHAPERONE_STRUCTP(v) && scheme_is_struct_instance(scheme_arity_at_least, v) && scheme_nonneg_exact_p(((Scheme_Structure *)v)->slots[0])); } @@ -2209,7 +2209,7 @@ static Scheme_Object *raise_arity_error(int argc, Scheme_Object *argv[]) minc = maxc = SCHEME_INT_VAL(argv[1]); } else if (is_arity_at_least(argv[1])) { Scheme_Object *v; - v = ((Scheme_Structure *)argv[1])->slots[0]; + v = scheme_struct_ref(argv[1], 0); if (SCHEME_INTP(v)) { minc = SCHEME_INT_VAL(v); maxc = -1; @@ -2328,7 +2328,7 @@ def_error_display_proc(int argc, Scheme_Object *argv[]) scheme_write_byte_string("\n", 1, port); /* Print context, if available */ - if (SCHEME_STRUCTP(argv[1]) + if (SCHEME_CHAPERONE_STRUCTP(argv[1]) && scheme_is_struct_instance(exn_table[MZEXN].type, argv[1]) && !scheme_is_struct_instance(exn_table[MZEXN_FAIL_USER].type, argv[1])) { Scheme_Object *l, *w; @@ -2347,7 +2347,7 @@ def_error_display_proc(int argc, Scheme_Object *argv[]) print_width = SCHEME_INT_VAL(w); else print_width = 0x7FFFFFFF; - l = scheme_get_stack_trace(((Scheme_Structure *)argv[1])->slots[1]); + l = scheme_get_stack_trace(scheme_struct_ref(argv[1], 1)); while (!SCHEME_NULLP(l)) { if (!max_cnt) { scheme_write_byte_string("...\n", 4, port); @@ -3107,9 +3107,10 @@ def_exn_handler(int argc, Scheme_Object *argv[]) char *s; int len = -1; - if (SCHEME_STRUCTP(argv[0]) + if (SCHEME_CHAPERONE_STRUCTP(argv[0]) && scheme_is_struct_instance(exn_table[MZEXN].type, argv[0])) { - Scheme_Object *str = ((Scheme_Structure *)argv[0])->slots[0]; + Scheme_Object *str; + str = scheme_struct_ref(argv[0], 0); if (SCHEME_CHAR_STRINGP(str)) { str = scheme_char_string_to_byte_string(str); s = SCHEME_BYTE_STR_VAL(str); @@ -3158,9 +3159,10 @@ nested_exn_handler(void *old_exn, int argc, Scheme_Object *argv[]) who = SCHEME_BYTE_STR_VAL(SCHEME_CAR((Scheme_Object *)old_exn)); sep = " by "; - if (SCHEME_STRUCTP(arg) + if (SCHEME_CHAPERONE_STRUCTP(arg) && scheme_is_struct_instance(exn_table[MZEXN].type, arg)) { - Scheme_Object *str = ((Scheme_Structure *)arg)->slots[0]; + Scheme_Object *str; + str = scheme_struct_ref(arg, 0); raisetype = "exception raised"; str = scheme_char_string_to_byte_string(str); msg = SCHEME_BYTE_STR_VAL(str); @@ -3171,9 +3173,10 @@ nested_exn_handler(void *old_exn, int argc, Scheme_Object *argv[]) } } - if (SCHEME_STRUCTP(orig_arg) + if (SCHEME_CHAPERONE_STRUCTP(orig_arg) && scheme_is_struct_instance(exn_table[MZEXN].type, orig_arg)) { - Scheme_Object *str = ((Scheme_Structure *)orig_arg)->slots[0]; + Scheme_Object *str; + str = scheme_struct_ref(orig_arg, 0); orig_raisetype = "exception raised"; str = scheme_char_string_to_byte_string(str); orig_msg = SCHEME_BYTE_STR_VAL(str); @@ -3289,7 +3292,7 @@ do_raise(Scheme_Object *arg, int need_debug, int eb) scheme_optimize_context_to_string(p->constant_folding), msg); } - if (SCHEME_STRUCTP(arg) + if (SCHEME_CHAPERONE_STRUCTP(arg) && scheme_is_struct_instance(exn_table[MZEXN_BREAK].type, arg)) { /* remember to re-raise exception */ scheme_current_thread->reading_delayed = arg; diff --git a/src/mzscheme/src/eval.c b/src/mzscheme/src/eval.c index cc839cfa93..abee1311ea 100644 --- a/src/mzscheme/src/eval.c +++ b/src/mzscheme/src/eval.c @@ -3673,6 +3673,69 @@ static Scheme_Object *optimize_application3(Scheme_Object *o, Optimize_Info *inf info->single_result = -info->single_result; } + /* Ad hoc optimization of (unsafe-fx+ 0), etc. */ + if (SCHEME_PRIMP(app->rator) + && (SCHEME_PRIM_PROC_FLAGS(app->rator) & SCHEME_PRIM_IS_UNSAFE_FUNCTIONAL)) { + int z1, z2; + + z1 = SAME_OBJ(app->rand1, scheme_make_integer(0)); + z2 = SAME_OBJ(app->rand2, scheme_make_integer(0)); + if (IS_NAMED_PRIM(app->rator, "unsafe-fx+")) { + if (z1) + return app->rand2; + else if (z2) + return app->rand1; + } else if (IS_NAMED_PRIM(app->rator, "unsafe-fx-")) { + if (z2) + return app->rand1; + } else if (IS_NAMED_PRIM(app->rator, "unsafe-fx*")) { + if (z1 || z2) + return scheme_make_integer(0); + if (SAME_OBJ(app->rand1, scheme_make_integer(1))) + return app->rand2; + if (SAME_OBJ(app->rand2, scheme_make_integer(1))) + return app->rand1; + } else if (IS_NAMED_PRIM(app->rator, "unsafe-fx/") + || IS_NAMED_PRIM(app->rator, "unsafe-fxquotient")) { + if (z1) + return scheme_make_integer(0); + if (SAME_OBJ(app->rand2, scheme_make_integer(1))) + return app->rand1; + } else if (IS_NAMED_PRIM(app->rator, "unsafe-fxremainder") + || IS_NAMED_PRIM(app->rator, "unsafe-fxmodulo")) { + if (z1) + return scheme_make_integer(0); + if (SAME_OBJ(app->rand2, scheme_make_integer(1))) + return scheme_make_integer(0); + } + + z1 = (SCHEME_FLOATP(app->rand1) && (SCHEME_FLOAT_VAL(app->rand1) == 0.0)); + z2 = (SCHEME_FLOATP(app->rand2) && (SCHEME_FLOAT_VAL(app->rand2) == 0.0)); + + if (IS_NAMED_PRIM(app->rator, "unsafe-fl+")) { + if (z1) + return app->rand2; + else if (z2) + return app->rand1; + } else if (IS_NAMED_PRIM(app->rator, "unsafe-fl-")) { + if (z2) + return app->rand1; + } else if (IS_NAMED_PRIM(app->rator, "unsafe-fl*")) { + if (SCHEME_FLOATP(app->rand1) && (SCHEME_FLOAT_VAL(app->rand1) == 1.0)) + return app->rand2; + if (SCHEME_FLOATP(app->rand2) && (SCHEME_FLOAT_VAL(app->rand2) == 1.0)) + return app->rand1; + } else if (IS_NAMED_PRIM(app->rator, "unsafe-fl/") + || IS_NAMED_PRIM(app->rator, "unsafe-flquotient")) { + if (SCHEME_FLOATP(app->rand2) && (SCHEME_FLOAT_VAL(app->rand2) == 1.0)) + return app->rand1; + } else if (IS_NAMED_PRIM(app->rator, "unsafe-flremainder") + || IS_NAMED_PRIM(app->rator, "unsafe-flmodulo")) { + if (SCHEME_FLOATP(app->rand2) && (SCHEME_FLOAT_VAL(app->rand2) == 1.0)) + return scheme_make_double(0.0); + } + } + register_flonum_argument_types(NULL, NULL, app, info); return check_unbox_rotation((Scheme_Object *)app, app->rator, 2, info); @@ -9124,6 +9187,17 @@ scheme_do_eval(Scheme_Object *obj, int num_rands, Scheme_Object **rands, } while (SAME_TYPE(scheme_proc_struct_type, SCHEME_TYPE(obj))); goto apply_top; + } else if (type == scheme_proc_chaperone_type) { + if (SCHEME_VECTORP(((Scheme_Chaperone *)obj)->redirects)) { + /* Chaperone is for struct fields, not function arguments */ + obj = ((Scheme_Chaperone *)obj)->prev; + goto apply_top; + } else { + /* Chaperone is for function arguments */ + VACATE_TAIL_BUFFER_USE_RUNSTACK(); + UPDATE_THREAD_RSPTR(); + v = scheme_apply_chaperone(obj, num_rands, rands); + } } else if (type == scheme_closed_prim_type) { GC_CAN_IGNORE Scheme_Closed_Primitive_Proc *prim; diff --git a/src/mzscheme/src/fun.c b/src/mzscheme/src/fun.c index f035f0b0a0..5b9a51ffe1 100644 --- a/src/mzscheme/src/fun.c +++ b/src/mzscheme/src/fun.c @@ -169,6 +169,7 @@ static Scheme_Object *procedure_reduce_arity(int argc, Scheme_Object *argv[]); static Scheme_Object *procedure_rename(int argc, Scheme_Object *argv[]); static Scheme_Object *procedure_to_method(int argc, Scheme_Object *argv[]); static Scheme_Object *procedure_equal_closure_p(int argc, Scheme_Object *argv[]); +static Scheme_Object *chaperone_procedure(int argc, Scheme_Object *argv[]); static Scheme_Object *primitive_p(int argc, Scheme_Object *argv[]); static Scheme_Object *primitive_closure_p(int argc, Scheme_Object *argv[]); static Scheme_Object *primitive_result_arity (int argc, Scheme_Object *argv[]); @@ -511,6 +512,11 @@ scheme_init_fun (Scheme_Env *env) "procedure-closure-contents-eq?", 2, 2, 1), env); + scheme_add_global_constant("chaperone-procedure", + scheme_make_prim_w_arity(chaperone_procedure, + "chaperone-procedure", + 2, -1), + env); scheme_add_global_constant("primitive?", scheme_make_folding_prim(primitive_p, @@ -2535,7 +2541,6 @@ extern int g_print_prims; Scheme_Object * scheme_tail_apply (Scheme_Object *rator, int num_rands, Scheme_Object **rands) { - /* NOTE: apply_values_execute (in syntax.c) and tail_call_with_values_from_multiple_result (in jit.c) assume that this function won't allocate when @@ -2543,25 +2548,16 @@ scheme_tail_apply (Scheme_Object *rator, int num_rands, Scheme_Object **rands) int i; Scheme_Thread *p = scheme_current_thread; - #ifdef INSTRUMENT_PRIMITIVES - if (g_print_prims) - { - printf("scheme_tail_apply\n"); - } - #endif - p->ku.apply.tail_rator = rator; p->ku.apply.tail_num_rands = num_rands; if (num_rands) { Scheme_Object **a; if (num_rands > p->tail_buffer_size) { - { - Scheme_Object **tb; - tb = MALLOC_N(Scheme_Object *, num_rands); - p->tail_buffer = tb; - p->tail_buffer_size = num_rands; - } + Scheme_Object **tb; + tb = MALLOC_N(Scheme_Object *, num_rands); + p->tail_buffer = tb; + p->tail_buffer_size = num_rands; } a = p->tail_buffer; p->ku.apply.tail_rands = a; @@ -2911,9 +2907,9 @@ static Scheme_Object *clone_arity(Scheme_Object *a) SCHEME_CAR(l) = a; } return m; - } else if (SCHEME_STRUCTP(a)) { + } else if (SCHEME_CHAPERONE_STRUCTP(a)) { Scheme_Object *p[1]; - p[0] = ((Scheme_Structure *)a)->slots[0]; + p[0] = scheme_struct_ref(a, 0); return scheme_make_struct_instance(scheme_arity_at_least, 1, p); } else return a; @@ -3145,6 +3141,10 @@ static Scheme_Object *get_or_check_arity(Scheme_Object *p, long a, Scheme_Object return scheme_false; } #endif + } else if (type == scheme_proc_chaperone_type) { + p = SCHEME_CHAPERONE_VAL(p); + SCHEME_USE_FUEL(1); + goto top; } else { Scheme_Closure_Data *data; @@ -3332,7 +3332,7 @@ Scheme_Object *scheme_proc_struct_name_source(Scheme_Object *a) { Scheme_Object *b; - while (SCHEME_PROC_STRUCTP(a)) { + while (SCHEME_CHAPERONE_PROC_STRUCTP(a)) { if (scheme_reduced_procedure_struct && scheme_is_struct_instance(scheme_reduced_procedure_struct, a) && SCHEME_TRUEP(((Scheme_Structure *)a)->slots[2])) { @@ -3432,6 +3432,10 @@ const char *scheme_get_proc_name(Scheme_Object *p, int *len, int for_error) p = other; goto top; } + } else if (type == scheme_proc_chaperone_type) { + p = SCHEME_CHAPERONE_VAL(p); + SCHEME_USE_FUEL(1); + goto top; } else { Scheme_Object *name; @@ -3507,8 +3511,13 @@ static Scheme_Object *object_name(int argc, Scheme_Object **argv) { Scheme_Object *a = argv[0]; + if (SCHEME_CHAPERONEP(a)) + a = SCHEME_CHAPERONE_VAL(a); + if (SCHEME_PROC_STRUCTP(a)) { a = scheme_proc_struct_name_source(a); + if (SCHEME_CHAPERONEP(a)) + a = SCHEME_CHAPERONE_VAL(a); if (SCHEME_STRUCTP(a) && scheme_reduced_procedure_struct @@ -3590,14 +3599,14 @@ static Scheme_Object *procedure_arity_p(int argc, Scheme_Object *argv[]) } else if (SCHEME_BIGNUMP(v)) { if (!SCHEME_BIGPOS(v)) return scheme_false; - } else if (!SCHEME_STRUCTP(v) + } else if (!SCHEME_CHAPERONE_STRUCTP(v) || !scheme_is_struct_instance(scheme_arity_at_least, v)) { return scheme_false; } a = SCHEME_CDR(a); } return SCHEME_NULLP(a) ? scheme_true : scheme_false; - } else if (SCHEME_STRUCTP(a) + } else if (SCHEME_CHAPERONE_STRUCTP(a) && scheme_is_struct_instance(scheme_arity_at_least, a)) { return scheme_true; } else @@ -3624,9 +3633,9 @@ static int is_arity(Scheme_Object *a, int at_least_ok, int list_ok) } else if (SCHEME_BIGNUMP(a)) { return SCHEME_BIGPOS(a); } else if (at_least_ok - && SCHEME_STRUCTP(a) + && SCHEME_CHAPERONE_STRUCTP(a) && scheme_is_struct_instance(scheme_arity_at_least, a)) { - a = ((Scheme_Structure *)a)->slots[0]; + a = scheme_struct_ref(a, 0); return is_arity(a, 0, 0); } @@ -3686,24 +3695,9 @@ static Scheme_Object *make_reduced_proc(Scheme_Object *proc, Scheme_Object *aty, return scheme_make_struct_instance(scheme_reduced_procedure_struct, 4, a); } -static Scheme_Object *procedure_reduce_arity(int argc, Scheme_Object *argv[]) +static int is_subarity(Scheme_Object *req, Scheme_Object *orig) { - Scheme_Object *orig, *req, *aty, *oa, *ra, *ol, *lra, *ara, *prev, *pr, *tmp; - - if (!SCHEME_PROCP(argv[0])) - scheme_wrong_type("procedure-reduce-arity", "procedure", 0, argc, argv); - - if (!is_arity(argv[1], 1, 1)) { - scheme_wrong_type("procedure-reduce-arity", "arity", 1, argc, argv); - } - - /* Check whether current arity covers the requested arity. This is - a bit complicated, because both the source and target can be - lists that include arity-at-least records. */ - - orig = get_or_check_arity(argv[0], -1, NULL); - aty = clone_arity(argv[1]); - req = aty; + Scheme_Object *oa, *ra, *ol, *lra, *ara, *prev, *pr, *tmp; if (!SCHEME_PAIRP(orig) && !SCHEME_NULLP(orig)) orig = scheme_make_pair(orig, scheme_null); @@ -3712,13 +3706,13 @@ static Scheme_Object *procedure_reduce_arity(int argc, Scheme_Object *argv[]) while (!SCHEME_NULLP(req)) { ra = SCHEME_CAR(req); - if (SCHEME_STRUCTP(ra) + if (SCHEME_CHAPERONE_STRUCTP(ra) && scheme_is_struct_instance(scheme_arity_at_least, ra)) { /* Convert to a sequence of range pairs, where the last one can be (min, #f); we'll iterate through the original arity to knock out ranges until (if it matches) we end up with an empty list of ranges. */ - ra = scheme_make_pair(scheme_make_pair(((Scheme_Structure *)ra)->slots[0], + ra = scheme_make_pair(scheme_make_pair(scheme_struct_ref(ra, 0), scheme_false), scheme_null); } @@ -3816,17 +3810,42 @@ static Scheme_Object *procedure_reduce_arity(int argc, Scheme_Object *argv[]) } if (SCHEME_NULLP(ol)) { - scheme_raise_exn(MZEXN_FAIL_CONTRACT_CONTINUATION, - "procedure-reduce-arity: arity of procedure: %V" - " does not include requested arity: %V", - argv[0], - argv[1]); - return NULL; + return 0; } req = SCHEME_CDR(req); } + return 1; +} + +static Scheme_Object *procedure_reduce_arity(int argc, Scheme_Object *argv[]) +{ + Scheme_Object *orig, *aty; + + if (!SCHEME_PROCP(argv[0])) + scheme_wrong_type("procedure-reduce-arity", "procedure", 0, argc, argv); + + if (!is_arity(argv[1], 1, 1)) { + scheme_wrong_type("procedure-reduce-arity", "arity", 1, argc, argv); + } + + /* Check whether current arity covers the requested arity. This is + a bit complicated, because both the source and target can be + lists that include arity-at-least records. */ + + orig = get_or_check_arity(argv[0], -1, NULL); + aty = clone_arity(argv[1]); + + if (!is_subarity(aty, orig)) { + scheme_raise_exn(MZEXN_FAIL_CONTRACT, + "procedure-reduce-arity: arity of procedure: %V" + " does not include requested arity: %V", + argv[0], + argv[1]); + return NULL; + } + /* Construct a procedure that has the given arity. */ return make_reduced_proc(argv[0], aty, NULL, NULL); } @@ -3969,6 +3988,159 @@ static Scheme_Object *procedure_equal_closure_p(int argc, Scheme_Object *argv[]) return scheme_false; } +static Scheme_Object *chaperone_procedure(int argc, Scheme_Object *argv[]) +{ + Scheme_Chaperone *px; + Scheme_Object *val = argv[0], *orig, *naya; + Scheme_Hash_Tree *props; + + if (SCHEME_CHAPERONEP(val)) + val = SCHEME_CHAPERONE_VAL(val); + + if (!SCHEME_PROCP(val)) + scheme_wrong_type("chaperone-procedure", "procedure", 0, argc, argv); + if (!SCHEME_PROCP(argv[1])) + scheme_wrong_type("chaperone-procedure", "procedure", 1, argc, argv); + + orig = get_or_check_arity(val, -1, NULL); + naya = get_or_check_arity(argv[1], -1, NULL); + + if (!is_subarity(orig, naya)) + scheme_raise_exn(MZEXN_FAIL_CONTRACT, + "chaperone-procedure: arity of chaperoneing procedure: %V" + " does not cover arity of original procedure: %V", + argv[1], + argv[0]); + + props = scheme_parse_chaperone_props("chaperone-procedure", 2, argc, argv); + + px = MALLOC_ONE_TAGGED(Scheme_Chaperone); + px->so.type = scheme_proc_chaperone_type; + px->val = val; + px->prev = argv[0]; + px->props = props; + px->redirects = argv[1]; + + return (Scheme_Object *)px; +} + +Scheme_Object *scheme_apply_chaperone(Scheme_Object *o, int argc, Scheme_Object **argv) +{ + Scheme_Chaperone *px = (Scheme_Chaperone *)o; + Scheme_Object *v, *a[1], *a2[1], **argv2, *post; + int c, i; + + v = _scheme_apply_multi(px->redirects, argc, argv); + if (v == SCHEME_MULTIPLE_VALUES) { + GC_CAN_IGNORE Scheme_Thread *p = scheme_current_thread; + if (SAME_OBJ(p->ku.multiple.array, p->values_buffer)) + p->values_buffer = NULL; + c = p->ku.multiple.count; + argv2 = p->ku.multiple.array; + } else { + c = 1; + a2[0] = v; + argv2 = a2; + } + + if ((c == argc) || (c == (argc + 1))) { + for (i = 0; i < argc; i++) { + if (!scheme_chaperone_of(argv2[i], argv[i])) { + if (argc == 1) + scheme_raise_exn(MZEXN_FAIL_CONTRACT_ARITY, + "procedure chaperone: %V: result: %V is not a chaperone of argument: %V", + px->redirects, + argv2[i], argv[i]); + else + scheme_raise_exn(MZEXN_FAIL_CONTRACT_ARITY, + "procedure chaperone: %V: %d%s result: %V is not a chaperone of argument: %V", + px->redirects, + i, scheme_number_suffix(i), + argv2[i], argv[i]); + } + } + } else { + scheme_raise_exn(MZEXN_FAIL_CONTRACT_ARITY, + "procedure chaperone: %V: returned %d values, expected %d or %d", + px->redirects, + c, argc, argc + 1); + return NULL; + } + + if (c == argc) { + /* No filter for the result, so tail call: */ + return scheme_tail_apply(px->prev, c, argv2); + } else { + /* Last element is a filter for the result(s) */ + post = argv2[argc]; + if (!SCHEME_PROCP(post)) + scheme_raise_exn(MZEXN_FAIL_CONTRACT, + "procedure chaperone: %V: expected as last result, produced: %V", + px->redirects, + post); + v = _scheme_apply_multi(px->prev, argc, argv2); + if (v == SCHEME_MULTIPLE_VALUES) { + GC_CAN_IGNORE Scheme_Thread *p = scheme_current_thread; + if (SAME_OBJ(p->ku.multiple.array, p->values_buffer)) + p->values_buffer = NULL; + c = p->ku.multiple.count; + argv = p->ku.multiple.array; + } else { + c = 1; + a[0] = v; + argv = a; + } + + if (!scheme_check_proc_arity(NULL, c, 0, -1, &post)) + scheme_raise_exn(MZEXN_FAIL_CONTRACT, + "procedure-result chaperone: %V: does not accept %d values produced by chaperoned procedure", + post, + c); + + v = _scheme_apply_multi(post, c, argv); + if (v == SCHEME_MULTIPLE_VALUES) { + GC_CAN_IGNORE Scheme_Thread *p = scheme_current_thread; + if (SAME_OBJ(p->ku.multiple.array, p->values_buffer)) + p->values_buffer = NULL; + argc = p->ku.multiple.count; + argv2 = p->ku.multiple.array; + } else { + argc = 1; + a2[0] = v; + argv2 = a2; + } + + if (c == argc) { + for (i = 0; i < argc; i++) { + if (!scheme_chaperone_of(argv2[i], argv[i])) { + if (argc == 1) + scheme_raise_exn(MZEXN_FAIL_CONTRACT_ARITY, + "procedure-result chaperone: %V: result: %V is not a chaperone of original result: %V", + post, + argv2[i], argv[i]); + else + scheme_raise_exn(MZEXN_FAIL_CONTRACT_ARITY, + "procedure-result chaperone: %V: %d%s result: %V is not a chaperone of original result: %V", + post, + i, scheme_number_suffix(i), + argv2[i], argv[i]); + } + } + } else { + scheme_raise_exn(MZEXN_FAIL_CONTRACT_ARITY, + "procedure-result chaperone: %V: returned %d values, expected %d", + post, + argc, c); + return NULL; + } + + if (c == 1) + return argv2[0]; + else + return scheme_values(c, argv2); + } +} + static Scheme_Object * apply(int argc, Scheme_Object *argv[]) { diff --git a/src/mzscheme/src/gen-jit-ts.ss b/src/mzscheme/src/gen-jit-ts.ss index 63d896d2fe..c0b9090543 100644 --- a/src/mzscheme/src/gen-jit-ts.ss +++ b/src/mzscheme/src/gen-jit-ts.ss @@ -155,7 +155,9 @@ s_v iSi_s siS_v - z_p)) + z_p + si_s + sis_v)) (with-output-to-file "jit_ts_def.c" #:exists 'replace diff --git a/src/mzscheme/src/hash.c b/src/mzscheme/src/hash.c index 37916ad4c1..40ea98abc7 100644 --- a/src/mzscheme/src/hash.c +++ b/src/mzscheme/src/hash.c @@ -999,6 +999,9 @@ static long equal_hash_key(Scheme_Object *o, long k, Hash_Info *hi) Scheme_Type t; top: + if (SCHEME_CHAPERONEP(o)) + o = ((Scheme_Chaperone *)o)->val; + t = SCHEME_TYPE(o); k += t; @@ -1421,6 +1424,9 @@ static long equal_hash_key2(Scheme_Object *o, Hash_Info *hi) Scheme_Type t; top: + if (SCHEME_CHAPERONEP(o)) + o = ((Scheme_Chaperone *)o)->val; + t = SCHEME_TYPE(o); if (hi->depth > (MAX_HASH_DEPTH << 1)) diff --git a/src/mzscheme/src/jit.c b/src/mzscheme/src/jit.c index 6b69ebb968..197ba2ec47 100644 --- a/src/mzscheme/src/jit.c +++ b/src/mzscheme/src/jit.c @@ -146,13 +146,14 @@ SHARED_OK static void *bad_car_code, *bad_cdr_code; SHARED_OK static void *bad_caar_code, *bad_cdar_code, *bad_cadr_code, *bad_cddr_code; SHARED_OK static void *bad_mcar_code, *bad_mcdr_code; SHARED_OK static void *bad_set_mcar_code, *bad_set_mcdr_code; -SHARED_OK static void *bad_unbox_code; +SHARED_OK static void *unbox_code, *set_box_code; SHARED_OK static void *bad_vector_length_code; SHARED_OK static void *bad_flvector_length_code; SHARED_OK static void *vector_ref_code, *vector_ref_check_index_code, *vector_set_code, *vector_set_check_index_code; SHARED_OK static void *string_ref_code, *string_ref_check_index_code, *string_set_code, *string_set_check_index_code; SHARED_OK static void *bytes_ref_code, *bytes_ref_check_index_code, *bytes_set_code, *bytes_set_check_index_code; SHARED_OK static void *flvector_ref_check_index_code, *flvector_set_check_index_code, *flvector_set_flonum_check_index_code; +SHARED_OK static void *struct_ref_code, *struct_set_code; SHARED_OK static void *syntax_e_code; SHARED_OK void *scheme_on_demand_jit_code; SHARED_OK static void *on_demand_jit_arity_code; @@ -2028,7 +2029,7 @@ static int check_val_struct_prim(Scheme_Object *p, int arity) return 2; } else if (arity == 2) { if ((((Scheme_Primitive_Proc *)p)->pp.flags & SCHEME_PRIM_IS_STRUCT_OTHER) - && ((((Scheme_Primitive_Proc *)p)->pp.flags & SCHEME_PRIM_STRUCT_OTHER_TYPE_MASK) + && ((((Scheme_Primitive_Proc *)p)->pp.flags & SCHEME_PRIM_OTHER_TYPE_MASK) == SCHEME_PRIM_STRUCT_TYPE_INDEXED_SETTER)) return 3; } @@ -6157,7 +6158,7 @@ static int generate_inlined_constant_test(mz_jit_state *jitter, Scheme_App2_Rec } static int generate_inlined_type_test(mz_jit_state *jitter, Scheme_App2_Rec *app, - Scheme_Type lo_ty, Scheme_Type hi_ty, + Scheme_Type lo_ty, Scheme_Type hi_ty, int can_chaperone, Branch_Info *for_branch, int branch_short, int need_sync) { GC_CAN_IGNORE jit_insn *ref, *ref2, *ref3, *ref4; @@ -6183,17 +6184,31 @@ static int generate_inlined_type_test(mz_jit_state *jitter, Scheme_App2_Rec *app CHECK_LIMIT(); } - ref = jit_bmsi_ul(jit_forward(), JIT_R0, 0x1); - jit_ldxi_s(JIT_R0, JIT_R0, &((Scheme_Object *)0x0)->type); - if (lo_ty == hi_ty) { - ref3 = jit_bnei_p(jit_forward(), JIT_R0, lo_ty); + if ((lo_ty == scheme_integer_type) && (scheme_integer_type == hi_ty)) { + ref3 = jit_bmci_ul(jit_forward(), JIT_R0, 0x1); ref4 = NULL; + ref = NULL; } else { - ref3 = jit_blti_p(jit_forward(), JIT_R0, lo_ty); - ref4 = jit_bgti_p(jit_forward(), JIT_R0, hi_ty); - } - if (int_ok) { - mz_patch_branch(ref); + ref = jit_bmsi_ul(jit_forward(), JIT_R0, 0x1); + jit_ldxi_s(JIT_R1, JIT_R0, &((Scheme_Object *)0x0)->type); + if (can_chaperone) { + __START_INNER_TINY__(branch_short); + ref3 = jit_bnei_i(jit_forward(), JIT_R1, scheme_chaperone_type); + jit_ldxi_p(JIT_R1, JIT_R0, (long)&((Scheme_Chaperone *)0x0)->val); + jit_ldxi_s(JIT_R1, JIT_R1, &((Scheme_Object *)0x0)->type); + mz_patch_branch(ref3); + __END_INNER_TINY__(branch_short); + } + if (lo_ty == hi_ty) { + ref3 = jit_bnei_p(jit_forward(), JIT_R1, lo_ty); + ref4 = NULL; + } else { + ref3 = jit_blti_p(jit_forward(), JIT_R1, lo_ty); + ref4 = jit_bgti_p(jit_forward(), JIT_R1, hi_ty); + } + if (int_ok) { + mz_patch_branch(ref); + } } if (for_branch) { if (!int_ok) { @@ -6204,9 +6219,6 @@ static int generate_inlined_type_test(mz_jit_state *jitter, Scheme_App2_Rec *app branch_for_true(jitter, for_branch); CHECK_LIMIT(); } else { - if ((lo_ty <= scheme_integer_type) && (scheme_integer_type <= hi_ty)) { - mz_patch_branch(ref); - } (void)jit_movi_p(JIT_R0, scheme_true); ref2 = jit_jmpi(jit_forward()); if (!int_ok) { @@ -6327,52 +6339,55 @@ static int generate_inlined_unary(mz_jit_state *jitter, Scheme_App2_Rec *app, in generate_inlined_constant_test(jitter, app, scheme_null, NULL, for_branch, branch_short, need_sync); return 1; } else if (IS_NAMED_PRIM(rator, "pair?")) { - generate_inlined_type_test(jitter, app, scheme_pair_type, scheme_pair_type, for_branch, branch_short, need_sync); + generate_inlined_type_test(jitter, app, scheme_pair_type, scheme_pair_type, 0, for_branch, branch_short, need_sync); return 1; } else if (IS_NAMED_PRIM(rator, "mpair?")) { - generate_inlined_type_test(jitter, app, scheme_mutable_pair_type, scheme_mutable_pair_type, for_branch, branch_short, need_sync); + generate_inlined_type_test(jitter, app, scheme_mutable_pair_type, scheme_mutable_pair_type, 0, for_branch, branch_short, need_sync); return 1; } else if (IS_NAMED_PRIM(rator, "symbol?")) { - generate_inlined_type_test(jitter, app, scheme_symbol_type, scheme_symbol_type, for_branch, branch_short, need_sync); + generate_inlined_type_test(jitter, app, scheme_symbol_type, scheme_symbol_type, 0, for_branch, branch_short, need_sync); return 1; } else if (IS_NAMED_PRIM(rator, "syntax?")) { - generate_inlined_type_test(jitter, app, scheme_stx_type, scheme_stx_type, for_branch, branch_short, need_sync); + generate_inlined_type_test(jitter, app, scheme_stx_type, scheme_stx_type, 0, for_branch, branch_short, need_sync); return 1; } else if (IS_NAMED_PRIM(rator, "char?")) { - generate_inlined_type_test(jitter, app, scheme_char_type, scheme_char_type, for_branch, branch_short, need_sync); + generate_inlined_type_test(jitter, app, scheme_char_type, scheme_char_type, 0, for_branch, branch_short, need_sync); return 1; } else if (IS_NAMED_PRIM(rator, "boolean?")) { generate_inlined_constant_test(jitter, app, scheme_false, scheme_true, for_branch, branch_short, need_sync); return 1; } else if (IS_NAMED_PRIM(rator, "number?")) { - generate_inlined_type_test(jitter, app, scheme_integer_type, scheme_complex_type, for_branch, branch_short, need_sync); + generate_inlined_type_test(jitter, app, scheme_integer_type, scheme_complex_type, 0, for_branch, branch_short, need_sync); return 1; } else if (IS_NAMED_PRIM(rator, "real?")) { - generate_inlined_type_test(jitter, app, scheme_integer_type, scheme_double_type, for_branch, branch_short, need_sync); + generate_inlined_type_test(jitter, app, scheme_integer_type, scheme_double_type, 0, for_branch, branch_short, need_sync); return 1; } else if (IS_NAMED_PRIM(rator, "exact-integer?")) { - generate_inlined_type_test(jitter, app, scheme_integer_type, scheme_bignum_type, for_branch, branch_short, need_sync); + generate_inlined_type_test(jitter, app, scheme_integer_type, scheme_bignum_type, 0, for_branch, branch_short, need_sync); return 1; } else if (IS_NAMED_PRIM(rator, "fixnum?")) { - generate_inlined_type_test(jitter, app, scheme_integer_type, scheme_integer_type, for_branch, branch_short, need_sync); + generate_inlined_type_test(jitter, app, scheme_integer_type, scheme_integer_type, 0, for_branch, branch_short, need_sync); return 1; } else if (IS_NAMED_PRIM(rator, "inexact-real?")) { - generate_inlined_type_test(jitter, app, SCHEME_FLOAT_TYPE, scheme_double_type, for_branch, branch_short, need_sync); + generate_inlined_type_test(jitter, app, SCHEME_FLOAT_TYPE, scheme_double_type, 0, for_branch, branch_short, need_sync); return 1; } else if (IS_NAMED_PRIM(rator, "procedure?")) { - generate_inlined_type_test(jitter, app, scheme_prim_type, scheme_native_closure_type, for_branch, branch_short, need_sync); + generate_inlined_type_test(jitter, app, scheme_prim_type, scheme_proc_chaperone_type, 1, for_branch, branch_short, need_sync); + return 1; + } else if (IS_NAMED_PRIM(rator, "chaperone?")) { + generate_inlined_type_test(jitter, app, scheme_proc_chaperone_type, scheme_chaperone_type, 0, for_branch, branch_short, need_sync); return 1; } else if (IS_NAMED_PRIM(rator, "vector?")) { - generate_inlined_type_test(jitter, app, scheme_vector_type, scheme_vector_type, for_branch, branch_short, need_sync); + generate_inlined_type_test(jitter, app, scheme_vector_type, scheme_vector_type, 1, for_branch, branch_short, need_sync); return 1; } else if (IS_NAMED_PRIM(rator, "box?")) { - generate_inlined_type_test(jitter, app, scheme_box_type, scheme_box_type, for_branch, branch_short, need_sync); + generate_inlined_type_test(jitter, app, scheme_box_type, scheme_box_type, 1, for_branch, branch_short, need_sync); return 1; } else if (IS_NAMED_PRIM(rator, "string?")) { - generate_inlined_type_test(jitter, app, scheme_char_string_type, scheme_char_string_type, for_branch, branch_short, need_sync); + generate_inlined_type_test(jitter, app, scheme_char_string_type, scheme_char_string_type, 0, for_branch, branch_short, need_sync); return 1; } else if (IS_NAMED_PRIM(rator, "bytes?")) { - generate_inlined_type_test(jitter, app, scheme_byte_string_type, scheme_byte_string_type, for_branch, branch_short, need_sync); + generate_inlined_type_test(jitter, app, scheme_byte_string_type, scheme_byte_string_type, 0, for_branch, branch_short, need_sync); return 1; } else if (IS_NAMED_PRIM(rator, "eof-object?")) { generate_inlined_constant_test(jitter, app, scheme_eof, NULL, for_branch, branch_short, need_sync); @@ -6599,20 +6614,25 @@ static int generate_inlined_unary(mz_jit_state *jitter, Scheme_App2_Rec *app, in return 1; } else if (IS_NAMED_PRIM(rator, "vector-length") || IS_NAMED_PRIM(rator, "unsafe-vector-length") + || IS_NAMED_PRIM(rator, "unsafe-vector*-length") || IS_NAMED_PRIM(rator, "flvector-length") || IS_NAMED_PRIM(rator, "unsafe-flvector-length")) { GC_CAN_IGNORE jit_insn *reffail, *ref; - int unsafe = 0, for_fl = 0; + int unsafe = 0, for_fl = 0, can_chaperone = 0; if (IS_NAMED_PRIM(rator, "unsafe-vector-length")) { unsafe = 1; + } else if (IS_NAMED_PRIM(rator, "unsafe-vector*-length")) { + unsafe = 1; + can_chaperone = 1; } else if (IS_NAMED_PRIM(rator, "flvector-length")) { for_fl = 1; } else if (IS_NAMED_PRIM(rator, "unsafe-flvector-length")) { unsafe = 1; for_fl = 1; + } else { + can_chaperone = 1; } - LOG_IT(("inlined vector-length\n")); @@ -6635,6 +6655,7 @@ static int generate_inlined_unary(mz_jit_state *jitter, Scheme_App2_Rec *app, in (void)jit_calli(bad_vector_length_code); else (void)jit_calli(bad_flvector_length_code); + /* bad_vector_length_code may unpack a proxied object */ __START_TINY_JUMPS__(1); mz_patch_branch(ref); @@ -6644,6 +6665,13 @@ static int generate_inlined_unary(mz_jit_state *jitter, Scheme_App2_Rec *app, in else (void)jit_bnei_i(reffail, JIT_R1, scheme_flvector_type); __END_TINY_JUMPS__(1); + } else if (can_chaperone) { + __START_TINY_JUMPS__(1); + jit_ldxi_s(JIT_R1, JIT_R0, &((Scheme_Object *)0x0)->type); + ref = jit_bnei_i(jit_forward(), JIT_R1, scheme_chaperone_type); + jit_ldxi_p(JIT_R0, JIT_R0, (long)&((Scheme_Chaperone *)0x0)->val); + mz_patch_branch(ref); + __END_TINY_JUMPS__(1); } if (!for_fl) @@ -6674,7 +6702,7 @@ static int generate_inlined_unary(mz_jit_state *jitter, Scheme_App2_Rec *app, in return 1; } else if (IS_NAMED_PRIM(rator, "unbox")) { - GC_CAN_IGNORE jit_insn *reffail, *ref; + GC_CAN_IGNORE jit_insn *reffail, *ref, *refdone; LOG_IT(("inlined unbox\n")); @@ -6692,9 +6720,10 @@ static int generate_inlined_unary(mz_jit_state *jitter, Scheme_App2_Rec *app, in __END_TINY_JUMPS__(1); reffail = _jit.x.pc; - (void)jit_calli(bad_unbox_code); + (void)jit_calli(unbox_code); __START_TINY_JUMPS__(1); + refdone = jit_jmpi(jit_forward()); mz_patch_branch(ref); jit_ldxi_s(JIT_R1, JIT_R0, &((Scheme_Object *)0x0)->type); (void)jit_bnei_i(reffail, JIT_R1, scheme_box_type); @@ -6702,6 +6731,10 @@ static int generate_inlined_unary(mz_jit_state *jitter, Scheme_App2_Rec *app, in (void)jit_ldxi_p(JIT_R0, JIT_R0, &SCHEME_BOX_VAL(0x0)); + __START_TINY_JUMPS__(1); + mz_patch_ucbranch(refdone); + __END_TINY_JUMPS__(1); + return 1; } else if (IS_NAMED_PRIM(rator, "unsafe-unbox")) { LOG_IT(("inlined unbox\n")); @@ -6715,6 +6748,34 @@ static int generate_inlined_unary(mz_jit_state *jitter, Scheme_App2_Rec *app, in (void)jit_ldxi_p(JIT_R0, JIT_R0, &SCHEME_BOX_VAL(0x0)); + return 1; + } else if (IS_NAMED_PRIM(rator, "unsafe-unbox*")) { + GC_CAN_IGNORE jit_insn *ref, *ref2; + + LOG_IT(("inlined unbox\n")); + + mz_runstack_skipped(jitter, 1); + + generate_non_tail(app->rand, jitter, 0, 1, 0); + CHECK_LIMIT(); + + mz_runstack_unskipped(jitter, 1); + + /* check for chaperone: */ + __START_TINY_JUMPS__(1); + jit_ldxi_s(JIT_R1, JIT_R0, &((Scheme_Object *)0x0)->type); + ref = jit_bnei_i(jit_forward(), JIT_R1, scheme_chaperone_type); + (void)jit_calli(unbox_code); + ref2 = jit_jmpi(jit_forward()); + mz_patch_branch(ref); + __END_TINY_JUMPS__(1); + + (void)jit_ldxi_p(JIT_R0, JIT_R0, &SCHEME_BOX_VAL(0x0)); + + __START_TINY_JUMPS__(1); + mz_patch_ucbranch(ref2); + __END_TINY_JUMPS__(1); + return 1; } else if (IS_NAMED_PRIM(rator, "syntax-e")) { LOG_IT(("inlined syntax-e\n")); @@ -7021,17 +7082,28 @@ static int generate_binary_char(mz_jit_state *jitter, Scheme_App3_Rec *app, } static int generate_vector_op(mz_jit_state *jitter, int set, int int_ready, int base_offset, - int for_fl, int unsafe, int unbox_flonum, int result_ignored) -/* if int_ready, JIT_R1 has num index (for safe mode) and JIT_V1 has pre-computed offset, - otherwise JIT_R1 has fixnum index */ + int for_fl, int unsafe, + int unbox_flonum, int result_ignored, int can_chaperone, int for_struct) +/* R0 has vector. In set mode, R2 has value; if not unboxed, not unsafe, or can chaperone, + RUNSTACK has space for a temporary (intended for R2). + If int_ready, R1 has num index (for safe mode) and V1 has pre-computed offset, + otherwise R1 has fixnum index */ { - GC_CAN_IGNORE jit_insn *ref, *reffail; + GC_CAN_IGNORE jit_insn *ref, *reffail, *pref; - if (!skip_checks && !unsafe) { + if (!skip_checks && (!unsafe || can_chaperone)) { + if (set && !unbox_flonum) + mz_rs_str(JIT_R2); if (set && !unbox_flonum) mz_rs_str(JIT_R2); __START_TINY_JUMPS__(1); - ref = jit_bmci_ul(jit_forward(), JIT_R0, 0x1); + if (!unsafe) { + ref = jit_bmci_ul(jit_forward(), JIT_R0, 0x1); + } else { + /* assert: can_chaperone */ + jit_ldxi_s(JIT_R2, JIT_R0, &((Scheme_Object *)0x0)->type); + ref = jit_bnei_i(jit_forward(), JIT_R2, scheme_chaperone_type); + } __END_TINY_JUMPS__(1); reffail = _jit.x.pc; @@ -7040,53 +7112,67 @@ static int generate_vector_op(mz_jit_state *jitter, int set, int int_ready, int jit_ori_l(JIT_R1, JIT_R1, 0x1); } if (set) { - if (!for_fl) + if (for_struct) + (void)jit_calli(struct_set_code); + else if (!for_fl) (void)jit_calli(vector_set_check_index_code); else if (unbox_flonum) (void)jit_calli(flvector_set_flonum_check_index_code); else (void)jit_calli(flvector_set_check_index_code); } else { - if (!for_fl) + if (for_struct) + (void)jit_calli(struct_ref_code); + else if (!for_fl) (void)jit_calli(vector_ref_check_index_code); else (void)jit_calli(flvector_ref_check_index_code); } - /* doesn't return */ CHECK_LIMIT(); + if (can_chaperone) { + pref = jit_jmpi(jit_forward()); + } else { + /* doesn't return */ + pref = NULL; + } __START_TINY_JUMPS__(1); mz_patch_branch(ref); - if (!int_ready) - (void)jit_bmci_ul(reffail, JIT_R1, 0x1); - jit_ldxi_s(JIT_R2, JIT_R0, &((Scheme_Object *)0x0)->type); - if (!for_fl) { - (void)jit_bnei_i(reffail, JIT_R2, scheme_vector_type); - jit_ldxi_i(JIT_R2, JIT_R0, (int)&SCHEME_VEC_SIZE(0x0)); - } else { - (void)jit_bnei_i(reffail, JIT_R2, scheme_flvector_type); - jit_ldxi_l(JIT_R2, JIT_R0, (int)&SCHEME_FLVEC_SIZE(0x0)); - } - if (!int_ready) { - jit_rshi_ul(JIT_V1, JIT_R1, 1); - (void)jit_bler_ul(reffail, JIT_R2, JIT_V1); - } else { - (void)jit_bler_ul(reffail, JIT_R2, JIT_R1); - } - CHECK_LIMIT(); - - if (for_fl && set && !unbox_flonum) { - jit_ldr_p(JIT_R2, JIT_RUNSTACK); - (void)jit_bmsi_ul(reffail, JIT_R2, 0x1); - jit_ldxi_s(JIT_R2, JIT_R2, &((Scheme_Object *)0x0)->type); - (void)jit_bnei_i(reffail, JIT_R2, scheme_double_type); + if (!unsafe) { + if (!int_ready) + (void)jit_bmci_ul(reffail, JIT_R1, 0x1); + jit_ldxi_s(JIT_R2, JIT_R0, &((Scheme_Object *)0x0)->type); + if (!for_fl) { + (void)jit_bnei_i(reffail, JIT_R2, scheme_vector_type); + jit_ldxi_i(JIT_R2, JIT_R0, (int)&SCHEME_VEC_SIZE(0x0)); + } else { + (void)jit_bnei_i(reffail, JIT_R2, scheme_flvector_type); + jit_ldxi_l(JIT_R2, JIT_R0, (int)&SCHEME_FLVEC_SIZE(0x0)); + } + if (!int_ready) { + jit_rshi_ul(JIT_V1, JIT_R1, 1); + (void)jit_bler_ul(reffail, JIT_R2, JIT_V1); + } else { + (void)jit_bler_ul(reffail, JIT_R2, JIT_R1); + } CHECK_LIMIT(); + + if (for_fl && set && !unbox_flonum) { + jit_ldr_p(JIT_R2, JIT_RUNSTACK); + (void)jit_bmsi_ul(reffail, JIT_R2, 0x1); + jit_ldxi_s(JIT_R2, JIT_R2, &((Scheme_Object *)0x0)->type); + (void)jit_bnei_i(reffail, JIT_R2, scheme_double_type); + CHECK_LIMIT(); + } + } else if (!int_ready) { + jit_rshi_ul(JIT_V1, JIT_R1, 1); } __END_TINY_JUMPS__(1); } else { if (!int_ready) jit_rshi_ul(JIT_V1, JIT_R1, 1); + pref = NULL; } if (!int_ready) { @@ -7123,6 +7209,8 @@ static int generate_vector_op(mz_jit_state *jitter, int set, int int_ready, int else generate_alloc_double(jitter, 0); } + if (can_chaperone) + mz_patch_ucbranch(pref); } return 1; @@ -7480,7 +7568,9 @@ static int generate_inlined_binary(mz_jit_state *jitter, Scheme_App3_Rec *app, i return 1; } else if (IS_NAMED_PRIM(rator, "vector-ref") || IS_NAMED_PRIM(rator, "unsafe-vector-ref") + || IS_NAMED_PRIM(rator, "unsafe-vector*-ref") || IS_NAMED_PRIM(rator, "unsafe-struct-ref") + || IS_NAMED_PRIM(rator, "unsafe-struct*-ref") || IS_NAMED_PRIM(rator, "string-ref") || IS_NAMED_PRIM(rator, "unsafe-string-ref") || IS_NAMED_PRIM(rator, "bytes-ref") @@ -7489,12 +7579,17 @@ static int generate_inlined_binary(mz_jit_state *jitter, Scheme_App3_Rec *app, i int simple; int which, unsafe = 0, base_offset = ((int)&SCHEME_VEC_ELS(0x0)); int unbox = jitter->unbox; + int can_chaperone = 1, for_struct = 0; if (IS_NAMED_PRIM(rator, "vector-ref")) which = 0; else if (IS_NAMED_PRIM(rator, "unsafe-vector-ref")) { which = 0; unsafe = 1; + can_chaperone = 0; + } else if (IS_NAMED_PRIM(rator, "unsafe-vector*-ref")) { + which = 0; + unsafe = 1; } else if (IS_NAMED_PRIM(rator, "flvector-ref")) { which = 3; base_offset = ((int)&SCHEME_FLVEC_ELS(0x0)); @@ -7507,6 +7602,13 @@ static int generate_inlined_binary(mz_jit_state *jitter, Scheme_App3_Rec *app, i which = 0; unsafe = 1; base_offset = ((int)&((Scheme_Structure *)0x0)->slots); + can_chaperone = 0; + for_struct = 1; + } else if (IS_NAMED_PRIM(rator, "unsafe-struct*-ref")) { + which = 0; + unsafe = 1; + base_offset = ((int)&((Scheme_Structure *)0x0)->slots); + for_struct = 1; } else if (IS_NAMED_PRIM(rator, "string-ref")) which = 1; else if (IS_NAMED_PRIM(rator, "unsafe-string-ref")) { @@ -7532,11 +7634,13 @@ static int generate_inlined_binary(mz_jit_state *jitter, Scheme_App3_Rec *app, i if (!which) { /* vector-ref is relatively simple and worth inlining */ - generate_vector_op(jitter, 0, 0, base_offset, 0, unsafe, 0, 0); + generate_vector_op(jitter, 0, 0, base_offset, 0, unsafe, + 0, 0, can_chaperone, for_struct); CHECK_LIMIT(); } else if (which == 3) { /* flvector-ref is relatively simple and worth inlining */ - generate_vector_op(jitter, 0, 0, base_offset, 1, unsafe, unbox, 0); + generate_vector_op(jitter, 0, 0, base_offset, 1, unsafe, + unbox, 0, can_chaperone, for_struct); CHECK_LIMIT(); } else if (which == 1) { if (unsafe) { @@ -7586,11 +7690,13 @@ static int generate_inlined_binary(mz_jit_state *jitter, Scheme_App3_Rec *app, i jit_movi_l(JIT_V1, offset); if (!which) { /* vector-ref is relatively simple and worth inlining */ - generate_vector_op(jitter, 0, 1, base_offset, 0, unsafe, 0, 0); + generate_vector_op(jitter, 0, 1, base_offset, 0, unsafe, + 0, 0, can_chaperone, for_struct); CHECK_LIMIT(); } else if (which == 3) { /* flvector-ref is relatively simple and worth inlining */ - generate_vector_op(jitter, 0, 1, base_offset, 1, unsafe, unbox, 0); + generate_vector_op(jitter, 0, 1, base_offset, 1, unsafe, + unbox, 0, can_chaperone, for_struct); CHECK_LIMIT(); } else if (which == 1) { if (unsafe) { @@ -7711,6 +7817,40 @@ static int generate_inlined_binary(mz_jit_state *jitter, Scheme_App3_Rec *app, i else (void)jit_stxi_p(&((Scheme_Simple_Object *)0x0)->u.pair_val.cdr, JIT_R0, JIT_R1); + if (!result_ignored) + (void)jit_movi_p(JIT_R0, scheme_void); + + return 1; + } else if (IS_NAMED_PRIM(rator, "set-box!") + || IS_NAMED_PRIM(rator, "unsafe-set-box*!")) { + GC_CAN_IGNORE jit_insn *ref, *ref2, *ref3; + int unsafe; + + LOG_IT(("inlined set-box!\n")); + + unsafe = IS_NAMED_PRIM(rator, "unsafe-set-box*!"); + + generate_two_args(app->rand1, app->rand2, jitter, 1, 2); + CHECK_LIMIT(); + __START_TINY_JUMPS__(1); + if (!unsafe) + ref3 = jit_bmsi_ul(jit_forward(), JIT_R0, 0x1); + else + ref3 = NULL; + jit_ldxi_s(JIT_R2, JIT_R0, &((Scheme_Object *)0x0)->type); + ref = jit_beqi_i(jit_forward(), JIT_R2, scheme_box_type); + mz_patch_branch(ref3); + (void)jit_calli(set_box_code); + ref2 = jit_jmpi(jit_forward()); + mz_patch_branch(ref); + __END_TINY_JUMPS__(1); + + (void)jit_stxi_p(&SCHEME_BOX_VAL(0x0), JIT_R0, JIT_R1); + + __START_TINY_JUMPS__(1); + mz_patch_ucbranch(ref2); + __END_TINY_JUMPS__(1); + if (!result_ignored) (void)jit_movi_p(JIT_R0, scheme_void); @@ -7837,8 +7977,10 @@ static int generate_inlined_nary(mz_jit_state *jitter, Scheme_App_Rec *app, int } else if (!for_branch) { if (IS_NAMED_PRIM(rator, "vector-set!") || IS_NAMED_PRIM(rator, "unsafe-vector-set!") + || IS_NAMED_PRIM(rator, "unsafe-vector*-set!") || IS_NAMED_PRIM(rator, "flvector-set!") || IS_NAMED_PRIM(rator, "unsafe-struct-set!") + || IS_NAMED_PRIM(rator, "unsafe-struct*-set!") || IS_NAMED_PRIM(rator, "string-set!") || IS_NAMED_PRIM(rator, "unsafe-string-set!") || IS_NAMED_PRIM(rator, "bytes-set!") @@ -7846,12 +7988,17 @@ static int generate_inlined_nary(mz_jit_state *jitter, Scheme_App_Rec *app, int int simple, constval, can_delay_vec, can_delay_index; int which, unsafe = 0, base_offset = ((int)&SCHEME_VEC_ELS(0x0)); int pushed, flonum_arg; + int can_chaperone, for_struct = 0; if (IS_NAMED_PRIM(rator, "vector-set!")) which = 0; else if (IS_NAMED_PRIM(rator, "unsafe-vector-set!")) { which = 0; unsafe = 1; + can_chaperone = 0; + } else if (IS_NAMED_PRIM(rator, "unsafe-vector*-set!")) { + which = 0; + unsafe = 1; } else if (IS_NAMED_PRIM(rator, "flvector-set!")) { which = 3; base_offset = ((int)&SCHEME_FLVEC_ELS(0x0)); @@ -7859,6 +8006,13 @@ static int generate_inlined_nary(mz_jit_state *jitter, Scheme_App_Rec *app, int which = 0; unsafe = 1; base_offset = ((int)&((Scheme_Structure *)0x0)->slots); + can_chaperone = 0; + for_struct = 1; + } else if (IS_NAMED_PRIM(rator, "unsafe-struct*-set!")) { + which = 0; + unsafe = 1; + base_offset = ((int)&((Scheme_Structure *)0x0)->slots); + for_struct = 1; } else if (IS_NAMED_PRIM(rator, "string-set!")) which = 1; else if (IS_NAMED_PRIM(rator, "unsafe-string-set!")) { @@ -7996,12 +8150,12 @@ static int generate_inlined_nary(mz_jit_state *jitter, Scheme_App_Rec *app, int if (!which) { /* vector-set! is relatively simple and worth inlining */ generate_vector_op(jitter, 1, 0, base_offset, 0, unsafe, - flonum_arg, result_ignored); + flonum_arg, result_ignored, can_chaperone, for_struct); CHECK_LIMIT(); } else if (which == 3) { /* flvector-set! is relatively simple and worth inlining */ generate_vector_op(jitter, 1, 0, base_offset, 1, unsafe, - flonum_arg, result_ignored); + flonum_arg, result_ignored, can_chaperone, for_struct); CHECK_LIMIT(); } else if (which == 1) { if (unsafe) { @@ -8043,12 +8197,12 @@ static int generate_inlined_nary(mz_jit_state *jitter, Scheme_App_Rec *app, int if (!which) { /* vector-set! is relatively simple and worth inlining */ generate_vector_op(jitter, 1, 1, base_offset, 0, unsafe, - flonum_arg, result_ignored); + flonum_arg, result_ignored, can_chaperone, for_struct); CHECK_LIMIT(); } else if (which == 3) { /* flvector-set! is relatively simple and worth inlining */ generate_vector_op(jitter, 1, 1, base_offset, 1, unsafe, - flonum_arg, result_ignored); + flonum_arg, result_ignored, can_chaperone, for_struct); CHECK_LIMIT(); } else if (which == 1) { if (unsafe) { @@ -10482,20 +10636,44 @@ static int do_generate_common(mz_jit_state *jitter, void *_data) register_sub_func(jitter, code, scheme_false); } - /* *** bad_unbox_code *** */ + /* *** unbox_code *** */ /* R0 is argument */ - bad_unbox_code = jit_get_ip().ptr; + unbox_code = jit_get_ip().ptr; mz_prolog(JIT_R1); jit_prepare(1); jit_pusharg_p(JIT_R0); (void)mz_finish(ts_scheme_unbox); CHECK_LIMIT(); - register_sub_func(jitter, bad_unbox_code, scheme_false); + jit_retval(JIT_R0); /* returns if proxied */ + mz_epilog(JIT_R1); + register_sub_func(jitter, unbox_code, scheme_false); + + /* *** set_box_code *** */ + /* R0 is box, R1 is value */ + set_box_code = jit_get_ip().ptr; + mz_prolog(JIT_R1); + jit_prepare(2); + jit_pusharg_p(JIT_R1); + jit_pusharg_p(JIT_R0); + (void)mz_finish(ts_scheme_set_box); + CHECK_LIMIT(); + /* returns if proxied */ + mz_epilog(JIT_R1); + register_sub_func(jitter, set_box_code, scheme_false); /* *** bad_vector_length_code *** */ /* R0 is argument */ bad_vector_length_code = jit_get_ip().ptr; mz_prolog(JIT_R1); + + /* Check for chaperone: */ + jit_ldxi_s(JIT_R1, JIT_R0, &((Scheme_Object *)0x0)->type); + ref = jit_bnei_i(jit_forward(), JIT_R1, scheme_chaperone_type); + jit_ldxi_p(JIT_R0, JIT_R0, (long)&((Scheme_Chaperone *)0x0)->val); + mz_epilog(JIT_R1); /* return after unwrapping */ + CHECK_LIMIT(); + + mz_patch_branch(ref); jit_prepare(1); jit_pusharg_i(JIT_R0); (void)mz_finish(ts_scheme_vector_length); @@ -10807,6 +10985,9 @@ static int do_generate_common(mz_jit_state *jitter, void *_data) jit_insn *ref, *reffail; Scheme_Type ty; int offset, count_offset, log_elem_size; + void *code; + + code = jit_get_ip().ptr; switch (ii) { case 0: @@ -10816,15 +10997,15 @@ static int do_generate_common(mz_jit_state *jitter, void *_data) log_elem_size = JIT_LOG_WORD_SIZE; if (!iii) { if (!i) { - vector_ref_code = jit_get_ip().ptr; + vector_ref_code = code; } else { - vector_ref_check_index_code = jit_get_ip().ptr; + vector_ref_check_index_code = code; } } else { if (!i) { - vector_set_code = jit_get_ip().ptr; + vector_set_code = code; } else { - vector_set_check_index_code = jit_get_ip().ptr; + vector_set_check_index_code = code; } } break; @@ -10835,15 +11016,15 @@ static int do_generate_common(mz_jit_state *jitter, void *_data) log_elem_size = LOG_MZCHAR_SIZE; if (!iii) { if (!i) { - string_ref_code = jit_get_ip().ptr; + string_ref_code = code; } else { - string_ref_check_index_code = jit_get_ip().ptr; + string_ref_check_index_code = code; } } else { if (!i) { - string_set_code = jit_get_ip().ptr; + string_set_code = code; } else { - string_set_check_index_code = jit_get_ip().ptr; + string_set_check_index_code = code; } } break; @@ -10855,15 +11036,15 @@ static int do_generate_common(mz_jit_state *jitter, void *_data) log_elem_size = 0; if (!iii) { if (!i) { - bytes_ref_code = jit_get_ip().ptr; + bytes_ref_code = code; } else { - bytes_ref_check_index_code = jit_get_ip().ptr; + bytes_ref_check_index_code = code; } } else { if (!i) { - bytes_set_code = jit_get_ip().ptr; + bytes_set_code = code; } else { - bytes_set_check_index_code = jit_get_ip().ptr; + bytes_set_check_index_code = code; } } break; @@ -10900,13 +11081,24 @@ static int do_generate_common(mz_jit_state *jitter, void *_data) case 0: if (!iii) { (void)mz_finish(ts_scheme_checked_vector_ref); + CHECK_LIMIT(); + /* Might return, if arg was chaperone */ + jit_addi_p(JIT_RUNSTACK, JIT_RUNSTACK, WORDS_TO_BYTES(2)); + JIT_UPDATE_THREAD_RSPTR(); + jit_retval(JIT_R0); + mz_epilog(JIT_R2); } else { (void)mz_finish(ts_scheme_checked_vector_set); + /* Might return, if arg was chaperone */ + jit_addi_p(JIT_RUNSTACK, JIT_RUNSTACK, WORDS_TO_BYTES(3)); + JIT_UPDATE_THREAD_RSPTR(); + mz_epilog(JIT_R2); } break; case 1: if (!iii) { (void)mz_finish(ts_scheme_checked_string_ref); + CHECK_LIMIT(); /* might return, if char was outside Latin-1 */ jit_addi_p(JIT_RUNSTACK, JIT_RUNSTACK, WORDS_TO_BYTES(2)); JIT_UPDATE_THREAD_RSPTR(); @@ -11009,6 +11201,8 @@ static int do_generate_common(mz_jit_state *jitter, void *_data) CHECK_LIMIT(); __END_TINY_JUMPS__(1); + + register_sub_func(jitter, code, scheme_false); } } } @@ -11016,12 +11210,16 @@ static int do_generate_common(mz_jit_state *jitter, void *_data) /* *** {flvector}_{ref,set}_check_index_code *** */ /* Same calling convention as for vector ops. */ for (i = 0; i < 3; i++) { + void *code; + + code = jit_get_ip().ptr; + if (!i) { - flvector_ref_check_index_code = jit_get_ip().ptr; + flvector_ref_check_index_code = code; } else if (i == 1) { - flvector_set_check_index_code = jit_get_ip().ptr; + flvector_set_check_index_code = code; } else { - flvector_set_flonum_check_index_code = jit_get_ip().ptr; + flvector_set_flonum_check_index_code = code; } mz_prolog(JIT_R2); @@ -11054,8 +11252,47 @@ static int do_generate_common(mz_jit_state *jitter, void *_data) } /* does not return */ CHECK_LIMIT(); + + register_sub_func(jitter, code, scheme_false); } + /* *** struct_{ref,set}_code *** */ + /* R0 is struct, R1 is index (Scheme number). + In set mode, value is on run stack. */ + for (iii = 0; iii < 2; iii++) { /* ref, set */ + void *code; + + code = jit_get_ip().ptr; + + if (!iii) { + struct_ref_code = code; + } else { + struct_set_code = code; + } + + mz_prolog(JIT_R2); + jit_rshi_ul(JIT_R1, JIT_R1, 1); + JIT_UPDATE_THREAD_RSPTR(); + if (!iii) + jit_prepare(2); + else { + jit_ldr_p(JIT_R2, JIT_RUNSTACK); + jit_prepare(3); + jit_pusharg_p(JIT_R2); + } + jit_pusharg_p(JIT_R1); + jit_pusharg_i(JIT_R0); + if (!iii) { + (void)mz_finish(ts_scheme_struct_ref); + jit_retval(JIT_R0); + } else + (void)mz_finish(ts_scheme_struct_set); + CHECK_LIMIT(); + jit_retval(JIT_R0); + mz_epilog(JIT_R2); + + register_sub_func(jitter, code, scheme_false); + } /* *** syntax_ecode *** */ /* R0 is (potential) syntax object */ @@ -11200,7 +11437,7 @@ static int do_generate_common(mz_jit_state *jitter, void *_data) (void)jit_bnei_i(refslow, JIT_R2, scheme_prim_type); jit_ldxi_s(JIT_R2, JIT_R0, &((Scheme_Primitive_Proc *)0x0)->pp.flags); if (kind == 3) { - jit_andi_i(JIT_R2, JIT_R2, SCHEME_PRIM_STRUCT_OTHER_TYPE_MASK); + jit_andi_i(JIT_R2, JIT_R2, SCHEME_PRIM_OTHER_TYPE_MASK); (void)jit_bnei_i(refslow, JIT_R2, SCHEME_PRIM_STRUCT_TYPE_INDEXED_SETTER); } else { (void)jit_bmci_i(refslow, JIT_R2, ((kind == 1) diff --git a/src/mzscheme/src/jit_ts.c b/src/mzscheme/src/jit_ts.c index 63539556ca..b2b66c2e7d 100644 --- a/src/mzscheme/src/jit_ts.c +++ b/src/mzscheme/src/jit_ts.c @@ -22,6 +22,7 @@ define_ts_s_s(scheme_force_one_value_same_mark, FSRC_OTHER) define_ts__s(malloc_double, FSRC_OTHER) #endif define_ts_s_s(scheme_box, FSRC_OTHER) +define_ts_ss_v(scheme_set_box, FSRC_OTHER) #ifndef CAN_INLINE_ALLOC define_ts_ss_s(scheme_make_mutable_pair, FSRC_OTHER) define_ts_Sl_s(make_list_star, FSRC_OTHER) @@ -61,6 +62,8 @@ define_ts_iS_s(scheme_checked_set_mcdr, FSRC_OTHER) define_ts_s_s(scheme_unbox, FSRC_OTHER) define_ts_s_s(scheme_vector_length, FSRC_OTHER) define_ts_s_s(scheme_flvector_length, FSRC_OTHER) +define_ts_si_s(scheme_struct_ref, FSRC_OTHER) +define_ts_sis_v(scheme_struct_set, FSRC_OTHER) define_ts_s_s(tail_call_with_values_from_multiple_result, FSRC_OTHER) define_ts_s_v(raise_bad_call_with_values, FSRC_OTHER) define_ts_s_s(call_with_values_from_multiple_result_multi, FSRC_OTHER) diff --git a/src/mzscheme/src/jit_ts_def.c b/src/mzscheme/src/jit_ts_def.c index 2f09ee2d9f..f9cc8e5b07 100644 --- a/src/mzscheme/src/jit_ts_def.c +++ b/src/mzscheme/src/jit_ts_def.c @@ -178,3 +178,21 @@ static void* ts_ ## id(size_t g43) \ else \ return id(g43); \ } +#define define_ts_si_s(id, src_type) \ +static Scheme_Object* ts_ ## id(Scheme_Object* g44, int g45) \ + XFORM_SKIP_PROC \ +{ \ + if (scheme_use_rtcall) \ + return scheme_rtcall_si_s("[" #id "]", src_type, id, g44, g45); \ + else \ + return id(g44, g45); \ +} +#define define_ts_sis_v(id, src_type) \ +static void ts_ ## id(Scheme_Object* g46, int g47, Scheme_Object* g48) \ + XFORM_SKIP_PROC \ +{ \ + if (scheme_use_rtcall) \ + scheme_rtcall_sis_v("[" #id "]", src_type, id, g46, g47, g48); \ + else \ + id(g46, g47, g48); \ +} diff --git a/src/mzscheme/src/jit_ts_future_glue.c b/src/mzscheme/src/jit_ts_future_glue.c index a9cbc3fff5..6dd2ca5160 100644 --- a/src/mzscheme/src/jit_ts_future_glue.c +++ b/src/mzscheme/src/jit_ts_future_glue.c @@ -1,4 +1,4 @@ - Scheme_Object* scheme_rtcall_siS_s(const char *who, int src_type, prim_siS_s f, Scheme_Object* g44, int g45, Scheme_Object** g46) + Scheme_Object* scheme_rtcall_siS_s(const char *who, int src_type, prim_siS_s f, Scheme_Object* g49, int g50, Scheme_Object** g51) XFORM_SKIP_PROC { Scheme_Future_Thread_State *fts = scheme_future_thread_state; @@ -13,9 +13,9 @@ future->time_of_request = tm; future->source_of_request = who; future->source_type = src_type; - future->arg_s0 = g44; - future->arg_i1 = g45; - future->arg_S2 = g46; + future->arg_s0 = g49; + future->arg_i1 = g50; + future->arg_S2 = g51; future_do_runtimecall(fts, (void*)f, 0); future = fts->current_ft; @@ -24,7 +24,7 @@ receive_special_result(future, retval, 1); return retval; } - Scheme_Object* scheme_rtcall_iSs_s(const char *who, int src_type, prim_iSs_s f, int g47, Scheme_Object** g48, Scheme_Object* g49) + Scheme_Object* scheme_rtcall_iSs_s(const char *who, int src_type, prim_iSs_s f, int g52, Scheme_Object** g53, Scheme_Object* g54) XFORM_SKIP_PROC { Scheme_Future_Thread_State *fts = scheme_future_thread_state; @@ -39,9 +39,9 @@ future->time_of_request = tm; future->source_of_request = who; future->source_type = src_type; - future->arg_i0 = g47; - future->arg_S1 = g48; - future->arg_s2 = g49; + future->arg_i0 = g52; + future->arg_S1 = g53; + future->arg_s2 = g54; future_do_runtimecall(fts, (void*)f, 0); future = fts->current_ft; @@ -50,7 +50,7 @@ receive_special_result(future, retval, 1); return retval; } - Scheme_Object* scheme_rtcall_s_s(const char *who, int src_type, prim_s_s f, Scheme_Object* g50) + Scheme_Object* scheme_rtcall_s_s(const char *who, int src_type, prim_s_s f, Scheme_Object* g55) XFORM_SKIP_PROC { Scheme_Future_Thread_State *fts = scheme_future_thread_state; @@ -65,8 +65,8 @@ future->time_of_request = tm; future->source_of_request = who; future->source_type = src_type; - future->arg_s0 = g50; - send_special_result(future, g50); + future->arg_s0 = g55; + send_special_result(future, g55); future_do_runtimecall(fts, (void*)f, 0); future = fts->current_ft; retval = future->retval_s; @@ -74,7 +74,7 @@ receive_special_result(future, retval, 1); return retval; } - Scheme_Object* scheme_rtcall_n_s(const char *who, int src_type, prim_n_s f, Scheme_Native_Closure_Data* g51) + Scheme_Object* scheme_rtcall_n_s(const char *who, int src_type, prim_n_s f, Scheme_Native_Closure_Data* g56) XFORM_SKIP_PROC { Scheme_Future_Thread_State *fts = scheme_future_thread_state; @@ -89,7 +89,7 @@ future->time_of_request = tm; future->source_of_request = who; future->source_type = src_type; - future->arg_n0 = g51; + future->arg_n0 = g56; future_do_runtimecall(fts, (void*)f, 0); future = fts->current_ft; @@ -122,7 +122,7 @@ receive_special_result(future, retval, 1); return retval; } - Scheme_Object* scheme_rtcall_ss_s(const char *who, int src_type, prim_ss_s f, Scheme_Object* g52, Scheme_Object* g53) + Scheme_Object* scheme_rtcall_ss_s(const char *who, int src_type, prim_ss_s f, Scheme_Object* g57, Scheme_Object* g58) XFORM_SKIP_PROC { Scheme_Future_Thread_State *fts = scheme_future_thread_state; @@ -137,8 +137,8 @@ future->time_of_request = tm; future->source_of_request = who; future->source_type = src_type; - future->arg_s0 = g52; - future->arg_s1 = g53; + future->arg_s0 = g57; + future->arg_s1 = g58; future_do_runtimecall(fts, (void*)f, 0); future = fts->current_ft; @@ -147,7 +147,7 @@ receive_special_result(future, retval, 1); return retval; } - MZ_MARK_STACK_TYPE scheme_rtcall_ss_m(const char *who, int src_type, prim_ss_m f, Scheme_Object* g54, Scheme_Object* g55) + MZ_MARK_STACK_TYPE scheme_rtcall_ss_m(const char *who, int src_type, prim_ss_m f, Scheme_Object* g59, Scheme_Object* g60) XFORM_SKIP_PROC { Scheme_Future_Thread_State *fts = scheme_future_thread_state; @@ -162,8 +162,8 @@ future->time_of_request = tm; future->source_of_request = who; future->source_type = src_type; - future->arg_s0 = g54; - future->arg_s1 = g55; + future->arg_s0 = g59; + future->arg_s1 = g60; future_do_runtimecall(fts, (void*)f, 0); future = fts->current_ft; @@ -172,7 +172,7 @@ return retval; } - Scheme_Object* scheme_rtcall_Sl_s(const char *who, int src_type, prim_Sl_s f, Scheme_Object** g56, long g57) + Scheme_Object* scheme_rtcall_Sl_s(const char *who, int src_type, prim_Sl_s f, Scheme_Object** g61, long g62) XFORM_SKIP_PROC { Scheme_Future_Thread_State *fts = scheme_future_thread_state; @@ -187,8 +187,8 @@ future->time_of_request = tm; future->source_of_request = who; future->source_type = src_type; - future->arg_S0 = g56; - future->arg_l1 = g57; + future->arg_S0 = g61; + future->arg_l1 = g62; future_do_runtimecall(fts, (void*)f, 0); future = fts->current_ft; @@ -197,7 +197,7 @@ receive_special_result(future, retval, 1); return retval; } - Scheme_Object* scheme_rtcall_l_s(const char *who, int src_type, prim_l_s f, long g58) + Scheme_Object* scheme_rtcall_l_s(const char *who, int src_type, prim_l_s f, long g63) XFORM_SKIP_PROC { Scheme_Future_Thread_State *fts = scheme_future_thread_state; @@ -212,7 +212,7 @@ future->time_of_request = tm; future->source_of_request = who; future->source_type = src_type; - future->arg_l0 = g58; + future->arg_l0 = g63; future_do_runtimecall(fts, (void*)f, 0); future = fts->current_ft; @@ -221,7 +221,7 @@ receive_special_result(future, retval, 1); return retval; } - void scheme_rtcall_bsi_v(const char *who, int src_type, prim_bsi_v f, Scheme_Bucket* g59, Scheme_Object* g60, int g61) + void scheme_rtcall_bsi_v(const char *who, int src_type, prim_bsi_v f, Scheme_Bucket* g64, Scheme_Object* g65, int g66) XFORM_SKIP_PROC { Scheme_Future_Thread_State *fts = scheme_future_thread_state; @@ -236,9 +236,9 @@ future->time_of_request = tm; future->source_of_request = who; future->source_type = src_type; - future->arg_b0 = g59; - future->arg_s1 = g60; - future->arg_i2 = g61; + future->arg_b0 = g64; + future->arg_s1 = g65; + future->arg_i2 = g66; future_do_runtimecall(fts, (void*)f, 0); future = fts->current_ft; @@ -247,7 +247,7 @@ } - void scheme_rtcall_iiS_v(const char *who, int src_type, prim_iiS_v f, int g62, int g63, Scheme_Object** g64) + void scheme_rtcall_iiS_v(const char *who, int src_type, prim_iiS_v f, int g67, int g68, Scheme_Object** g69) XFORM_SKIP_PROC { Scheme_Future_Thread_State *fts = scheme_future_thread_state; @@ -262,9 +262,9 @@ future->time_of_request = tm; future->source_of_request = who; future->source_type = src_type; - future->arg_i0 = g62; - future->arg_i1 = g63; - future->arg_S2 = g64; + future->arg_i0 = g67; + future->arg_i1 = g68; + future->arg_S2 = g69; future_do_runtimecall(fts, (void*)f, 0); future = fts->current_ft; @@ -273,7 +273,7 @@ } - void scheme_rtcall_ss_v(const char *who, int src_type, prim_ss_v f, Scheme_Object* g65, Scheme_Object* g66) + void scheme_rtcall_ss_v(const char *who, int src_type, prim_ss_v f, Scheme_Object* g70, Scheme_Object* g71) XFORM_SKIP_PROC { Scheme_Future_Thread_State *fts = scheme_future_thread_state; @@ -288,8 +288,8 @@ future->time_of_request = tm; future->source_of_request = who; future->source_type = src_type; - future->arg_s0 = g65; - future->arg_s1 = g66; + future->arg_s0 = g70; + future->arg_s1 = g71; future_do_runtimecall(fts, (void*)f, 0); future = fts->current_ft; @@ -298,7 +298,7 @@ } - void scheme_rtcall_b_v(const char *who, int src_type, prim_b_v f, Scheme_Bucket* g67) + void scheme_rtcall_b_v(const char *who, int src_type, prim_b_v f, Scheme_Bucket* g72) XFORM_SKIP_PROC { Scheme_Future_Thread_State *fts = scheme_future_thread_state; @@ -313,7 +313,7 @@ future->time_of_request = tm; future->source_of_request = who; future->source_type = src_type; - future->arg_b0 = g67; + future->arg_b0 = g72; future_do_runtimecall(fts, (void*)f, 0); future = fts->current_ft; @@ -322,7 +322,7 @@ } - Scheme_Object* scheme_rtcall_sl_s(const char *who, int src_type, prim_sl_s f, Scheme_Object* g68, long g69) + Scheme_Object* scheme_rtcall_sl_s(const char *who, int src_type, prim_sl_s f, Scheme_Object* g73, long g74) XFORM_SKIP_PROC { Scheme_Future_Thread_State *fts = scheme_future_thread_state; @@ -337,8 +337,8 @@ future->time_of_request = tm; future->source_of_request = who; future->source_type = src_type; - future->arg_s0 = g68; - future->arg_l1 = g69; + future->arg_s0 = g73; + future->arg_l1 = g74; future_do_runtimecall(fts, (void*)f, 0); future = fts->current_ft; @@ -347,7 +347,7 @@ receive_special_result(future, retval, 1); return retval; } - Scheme_Object* scheme_rtcall_iS_s(const char *who, int src_type, prim_iS_s f, int g70, Scheme_Object** g71) + Scheme_Object* scheme_rtcall_iS_s(const char *who, int src_type, prim_iS_s f, int g75, Scheme_Object** g76) XFORM_SKIP_PROC { Scheme_Future_Thread_State *fts = scheme_future_thread_state; @@ -362,8 +362,8 @@ future->time_of_request = tm; future->source_of_request = who; future->source_type = src_type; - future->arg_i0 = g70; - future->arg_S1 = g71; + future->arg_i0 = g75; + future->arg_S1 = g76; future_do_runtimecall(fts, (void*)f, 0); future = fts->current_ft; @@ -372,7 +372,7 @@ receive_special_result(future, retval, 1); return retval; } - Scheme_Object* scheme_rtcall_S_s(const char *who, int src_type, prim_S_s f, Scheme_Object** g72) + Scheme_Object* scheme_rtcall_S_s(const char *who, int src_type, prim_S_s f, Scheme_Object** g77) XFORM_SKIP_PROC { Scheme_Future_Thread_State *fts = scheme_future_thread_state; @@ -387,7 +387,7 @@ future->time_of_request = tm; future->source_of_request = who; future->source_type = src_type; - future->arg_S0 = g72; + future->arg_S0 = g77; future_do_runtimecall(fts, (void*)f, 0); future = fts->current_ft; @@ -396,7 +396,7 @@ receive_special_result(future, retval, 1); return retval; } - void scheme_rtcall_s_v(const char *who, int src_type, prim_s_v f, Scheme_Object* g73) + void scheme_rtcall_s_v(const char *who, int src_type, prim_s_v f, Scheme_Object* g78) XFORM_SKIP_PROC { Scheme_Future_Thread_State *fts = scheme_future_thread_state; @@ -411,8 +411,8 @@ future->time_of_request = tm; future->source_of_request = who; future->source_type = src_type; - future->arg_s0 = g73; - send_special_result(future, g73); + future->arg_s0 = g78; + send_special_result(future, g78); future_do_runtimecall(fts, (void*)f, 0); future = fts->current_ft; @@ -420,7 +420,7 @@ } - Scheme_Object* scheme_rtcall_iSi_s(const char *who, int src_type, prim_iSi_s f, int g74, Scheme_Object** g75, int g76) + Scheme_Object* scheme_rtcall_iSi_s(const char *who, int src_type, prim_iSi_s f, int g79, Scheme_Object** g80, int g81) XFORM_SKIP_PROC { Scheme_Future_Thread_State *fts = scheme_future_thread_state; @@ -435,9 +435,9 @@ future->time_of_request = tm; future->source_of_request = who; future->source_type = src_type; - future->arg_i0 = g74; - future->arg_S1 = g75; - future->arg_i2 = g76; + future->arg_i0 = g79; + future->arg_S1 = g80; + future->arg_i2 = g81; future_do_runtimecall(fts, (void*)f, 0); future = fts->current_ft; @@ -446,7 +446,7 @@ receive_special_result(future, retval, 1); return retval; } - void scheme_rtcall_siS_v(const char *who, int src_type, prim_siS_v f, Scheme_Object* g77, int g78, Scheme_Object** g79) + void scheme_rtcall_siS_v(const char *who, int src_type, prim_siS_v f, Scheme_Object* g82, int g83, Scheme_Object** g84) XFORM_SKIP_PROC { Scheme_Future_Thread_State *fts = scheme_future_thread_state; @@ -461,9 +461,9 @@ future->time_of_request = tm; future->source_of_request = who; future->source_type = src_type; - future->arg_s0 = g77; - future->arg_i1 = g78; - future->arg_S2 = g79; + future->arg_s0 = g82; + future->arg_i1 = g83; + future->arg_S2 = g84; future_do_runtimecall(fts, (void*)f, 0); future = fts->current_ft; @@ -472,7 +472,7 @@ } - void* scheme_rtcall_z_p(const char *who, int src_type, prim_z_p f, size_t g80) + void* scheme_rtcall_z_p(const char *who, int src_type, prim_z_p f, size_t g85) XFORM_SKIP_PROC { Scheme_Future_Thread_State *fts = scheme_future_thread_state; @@ -487,7 +487,7 @@ future->time_of_request = tm; future->source_of_request = who; future->source_type = src_type; - future->arg_z0 = g80; + future->arg_z0 = g85; future_do_runtimecall(fts, (void*)f, 0); future = fts->current_ft; @@ -495,4 +495,55 @@ future->retval_p = 0; return retval; +} + Scheme_Object* scheme_rtcall_si_s(const char *who, int src_type, prim_si_s f, Scheme_Object* g86, int g87) + XFORM_SKIP_PROC +{ + Scheme_Future_Thread_State *fts = scheme_future_thread_state; + future_t *future; + double tm; + Scheme_Object* retval; + + future = fts->current_ft; + future->prim_protocol = SIG_si_s; + future->prim_func = f; + tm = scheme_get_inexact_milliseconds(); + future->time_of_request = tm; + future->source_of_request = who; + future->source_type = src_type; + future->arg_s0 = g86; + future->arg_i1 = g87; + + future_do_runtimecall(fts, (void*)f, 0); + future = fts->current_ft; + retval = future->retval_s; + future->retval_s = 0; + receive_special_result(future, retval, 1); + return retval; +} + void scheme_rtcall_sis_v(const char *who, int src_type, prim_sis_v f, Scheme_Object* g88, int g89, Scheme_Object* g90) + XFORM_SKIP_PROC +{ + Scheme_Future_Thread_State *fts = scheme_future_thread_state; + future_t *future; + double tm; + + + future = fts->current_ft; + future->prim_protocol = SIG_sis_v; + future->prim_func = f; + tm = scheme_get_inexact_milliseconds(); + future->time_of_request = tm; + future->source_of_request = who; + future->source_type = src_type; + future->arg_s0 = g88; + future->arg_i1 = g89; + future->arg_s2 = g90; + + future_do_runtimecall(fts, (void*)f, 0); + future = fts->current_ft; + + + + } diff --git a/src/mzscheme/src/jit_ts_protos.h b/src/mzscheme/src/jit_ts_protos.h index 0d980befd4..16c3992c14 100644 --- a/src/mzscheme/src/jit_ts_protos.h +++ b/src/mzscheme/src/jit_ts_protos.h @@ -1,60 +1,66 @@ #define SIG_siS_s 5 typedef Scheme_Object* (*prim_siS_s)(Scheme_Object*, int, Scheme_Object**); -Scheme_Object* scheme_rtcall_siS_s(const char *who, int src_type, prim_siS_s f, Scheme_Object* g118, int g119, Scheme_Object** g120); +Scheme_Object* scheme_rtcall_siS_s(const char *who, int src_type, prim_siS_s f, Scheme_Object* g133, int g134, Scheme_Object** g135); #define SIG_iSs_s 6 typedef Scheme_Object* (*prim_iSs_s)(int, Scheme_Object**, Scheme_Object*); -Scheme_Object* scheme_rtcall_iSs_s(const char *who, int src_type, prim_iSs_s f, int g121, Scheme_Object** g122, Scheme_Object* g123); +Scheme_Object* scheme_rtcall_iSs_s(const char *who, int src_type, prim_iSs_s f, int g136, Scheme_Object** g137, Scheme_Object* g138); #define SIG_s_s 7 typedef Scheme_Object* (*prim_s_s)(Scheme_Object*); -Scheme_Object* scheme_rtcall_s_s(const char *who, int src_type, prim_s_s f, Scheme_Object* g124); +Scheme_Object* scheme_rtcall_s_s(const char *who, int src_type, prim_s_s f, Scheme_Object* g139); #define SIG_n_s 8 typedef Scheme_Object* (*prim_n_s)(Scheme_Native_Closure_Data*); -Scheme_Object* scheme_rtcall_n_s(const char *who, int src_type, prim_n_s f, Scheme_Native_Closure_Data* g125); +Scheme_Object* scheme_rtcall_n_s(const char *who, int src_type, prim_n_s f, Scheme_Native_Closure_Data* g140); #define SIG__s 9 typedef Scheme_Object* (*prim__s)(); Scheme_Object* scheme_rtcall__s(const char *who, int src_type, prim__s f ); #define SIG_ss_s 10 typedef Scheme_Object* (*prim_ss_s)(Scheme_Object*, Scheme_Object*); -Scheme_Object* scheme_rtcall_ss_s(const char *who, int src_type, prim_ss_s f, Scheme_Object* g126, Scheme_Object* g127); +Scheme_Object* scheme_rtcall_ss_s(const char *who, int src_type, prim_ss_s f, Scheme_Object* g141, Scheme_Object* g142); #define SIG_ss_m 11 typedef MZ_MARK_STACK_TYPE (*prim_ss_m)(Scheme_Object*, Scheme_Object*); -MZ_MARK_STACK_TYPE scheme_rtcall_ss_m(const char *who, int src_type, prim_ss_m f, Scheme_Object* g128, Scheme_Object* g129); +MZ_MARK_STACK_TYPE scheme_rtcall_ss_m(const char *who, int src_type, prim_ss_m f, Scheme_Object* g143, Scheme_Object* g144); #define SIG_Sl_s 12 typedef Scheme_Object* (*prim_Sl_s)(Scheme_Object**, long); -Scheme_Object* scheme_rtcall_Sl_s(const char *who, int src_type, prim_Sl_s f, Scheme_Object** g130, long g131); +Scheme_Object* scheme_rtcall_Sl_s(const char *who, int src_type, prim_Sl_s f, Scheme_Object** g145, long g146); #define SIG_l_s 13 typedef Scheme_Object* (*prim_l_s)(long); -Scheme_Object* scheme_rtcall_l_s(const char *who, int src_type, prim_l_s f, long g132); +Scheme_Object* scheme_rtcall_l_s(const char *who, int src_type, prim_l_s f, long g147); #define SIG_bsi_v 14 typedef void (*prim_bsi_v)(Scheme_Bucket*, Scheme_Object*, int); -void scheme_rtcall_bsi_v(const char *who, int src_type, prim_bsi_v f, Scheme_Bucket* g133, Scheme_Object* g134, int g135); +void scheme_rtcall_bsi_v(const char *who, int src_type, prim_bsi_v f, Scheme_Bucket* g148, Scheme_Object* g149, int g150); #define SIG_iiS_v 15 typedef void (*prim_iiS_v)(int, int, Scheme_Object**); -void scheme_rtcall_iiS_v(const char *who, int src_type, prim_iiS_v f, int g136, int g137, Scheme_Object** g138); +void scheme_rtcall_iiS_v(const char *who, int src_type, prim_iiS_v f, int g151, int g152, Scheme_Object** g153); #define SIG_ss_v 16 typedef void (*prim_ss_v)(Scheme_Object*, Scheme_Object*); -void scheme_rtcall_ss_v(const char *who, int src_type, prim_ss_v f, Scheme_Object* g139, Scheme_Object* g140); +void scheme_rtcall_ss_v(const char *who, int src_type, prim_ss_v f, Scheme_Object* g154, Scheme_Object* g155); #define SIG_b_v 17 typedef void (*prim_b_v)(Scheme_Bucket*); -void scheme_rtcall_b_v(const char *who, int src_type, prim_b_v f, Scheme_Bucket* g141); +void scheme_rtcall_b_v(const char *who, int src_type, prim_b_v f, Scheme_Bucket* g156); #define SIG_sl_s 18 typedef Scheme_Object* (*prim_sl_s)(Scheme_Object*, long); -Scheme_Object* scheme_rtcall_sl_s(const char *who, int src_type, prim_sl_s f, Scheme_Object* g142, long g143); +Scheme_Object* scheme_rtcall_sl_s(const char *who, int src_type, prim_sl_s f, Scheme_Object* g157, long g158); #define SIG_iS_s 19 typedef Scheme_Object* (*prim_iS_s)(int, Scheme_Object**); -Scheme_Object* scheme_rtcall_iS_s(const char *who, int src_type, prim_iS_s f, int g144, Scheme_Object** g145); +Scheme_Object* scheme_rtcall_iS_s(const char *who, int src_type, prim_iS_s f, int g159, Scheme_Object** g160); #define SIG_S_s 20 typedef Scheme_Object* (*prim_S_s)(Scheme_Object**); -Scheme_Object* scheme_rtcall_S_s(const char *who, int src_type, prim_S_s f, Scheme_Object** g146); +Scheme_Object* scheme_rtcall_S_s(const char *who, int src_type, prim_S_s f, Scheme_Object** g161); #define SIG_s_v 21 typedef void (*prim_s_v)(Scheme_Object*); -void scheme_rtcall_s_v(const char *who, int src_type, prim_s_v f, Scheme_Object* g147); +void scheme_rtcall_s_v(const char *who, int src_type, prim_s_v f, Scheme_Object* g162); #define SIG_iSi_s 22 typedef Scheme_Object* (*prim_iSi_s)(int, Scheme_Object**, int); -Scheme_Object* scheme_rtcall_iSi_s(const char *who, int src_type, prim_iSi_s f, int g148, Scheme_Object** g149, int g150); +Scheme_Object* scheme_rtcall_iSi_s(const char *who, int src_type, prim_iSi_s f, int g163, Scheme_Object** g164, int g165); #define SIG_siS_v 23 typedef void (*prim_siS_v)(Scheme_Object*, int, Scheme_Object**); -void scheme_rtcall_siS_v(const char *who, int src_type, prim_siS_v f, Scheme_Object* g151, int g152, Scheme_Object** g153); +void scheme_rtcall_siS_v(const char *who, int src_type, prim_siS_v f, Scheme_Object* g166, int g167, Scheme_Object** g168); #define SIG_z_p 24 typedef void* (*prim_z_p)(size_t); -void* scheme_rtcall_z_p(const char *who, int src_type, prim_z_p f, size_t g154); +void* scheme_rtcall_z_p(const char *who, int src_type, prim_z_p f, size_t g169); +#define SIG_si_s 25 +typedef Scheme_Object* (*prim_si_s)(Scheme_Object*, int); +Scheme_Object* scheme_rtcall_si_s(const char *who, int src_type, prim_si_s f, Scheme_Object* g170, int g171); +#define SIG_sis_v 26 +typedef void (*prim_sis_v)(Scheme_Object*, int, Scheme_Object*); +void scheme_rtcall_sis_v(const char *who, int src_type, prim_sis_v f, Scheme_Object* g172, int g173, Scheme_Object* g174); diff --git a/src/mzscheme/src/jit_ts_runtime_glue.c b/src/mzscheme/src/jit_ts_runtime_glue.c index 587134ab03..9b9d962ded 100644 --- a/src/mzscheme/src/jit_ts_runtime_glue.c +++ b/src/mzscheme/src/jit_ts_runtime_glue.c @@ -216,5 +216,27 @@ case SIG_z_p: f(future->arg_z0); future->retval_p = retval; + break; + } +case SIG_si_s: + { + prim_si_s f = (prim_si_s)future->prim_func; + Scheme_Object* retval; + + retval = + f(future->arg_s0, future->arg_i1); + future->retval_s = retval; + send_special_result(future, retval); + break; + } +case SIG_sis_v: + { + prim_sis_v f = (prim_sis_v)future->prim_func; + + + + f(future->arg_s0, future->arg_i1, future->arg_s2); + + break; } diff --git a/src/mzscheme/src/list.c b/src/mzscheme/src/list.c index 6e5d42ff84..9f3c85f5ae 100644 --- a/src/mzscheme/src/list.c +++ b/src/mzscheme/src/list.c @@ -24,6 +24,7 @@ */ #include "schpriv.h" +#include "schmach.h" /* read only globals */ READ_ONLY Scheme_Object scheme_null[1]; @@ -88,6 +89,7 @@ static Scheme_Object *immutable_box (int argc, Scheme_Object *argv[]); static Scheme_Object *box_p (int argc, Scheme_Object *argv[]); static Scheme_Object *unbox (int argc, Scheme_Object *argv[]); static Scheme_Object *set_box (int argc, Scheme_Object *argv[]); +static Scheme_Object *chaperone_box(int argc, Scheme_Object **argv); static Scheme_Object *make_hash(int argc, Scheme_Object *argv[]); static Scheme_Object *make_hasheq(int argc, Scheme_Object *argv[]); @@ -119,6 +121,7 @@ static Scheme_Object *eq_hash_code(int argc, Scheme_Object *argv[]); static Scheme_Object *equal_hash_code(int argc, Scheme_Object *argv[]); static Scheme_Object *equal_hash2_code(int argc, Scheme_Object *argv[]); static Scheme_Object *eqv_hash_code(int argc, Scheme_Object *argv[]); +static Scheme_Object *chaperone_hash(int argc, Scheme_Object **argv); static Scheme_Object *make_weak_box(int argc, Scheme_Object *argv[]); static Scheme_Object *weak_box_value(int argc, Scheme_Object *argv[]); @@ -147,6 +150,9 @@ static Scheme_Object *unsafe_set_mcdr (int argc, Scheme_Object *argv[]); static Scheme_Object *unsafe_unbox (int argc, Scheme_Object *argv[]); static Scheme_Object *unsafe_set_box (int argc, Scheme_Object *argv[]); +static Scheme_Object *chaperone_hash_key(const char *name, Scheme_Object *table, Scheme_Object *key); +static Scheme_Object *chaperone_hash_tree_set(Scheme_Object *table, Scheme_Object *key, Scheme_Object *val); + #define BOX "box" #define BOXP "box?" #define UNBOX "unbox" @@ -446,15 +452,19 @@ scheme_init_list (Scheme_Env *env) SCHEME_PRIM_PROC_FLAGS(p) |= SCHEME_PRIM_IS_UNARY_INLINED; scheme_add_global_constant(BOXP, p, env); - p = scheme_make_immed_prim(unbox, UNBOX, 1, 1); + p = scheme_make_noncm_prim(unbox, UNBOX, 1, 1); SCHEME_PRIM_PROC_FLAGS(p) |= SCHEME_PRIM_IS_UNARY_INLINED; scheme_add_global_constant(UNBOX, p, env); - scheme_add_global_constant(SETBOX, - scheme_make_immed_prim(set_box, - SETBOX, - 2, 2), - env); + p = scheme_make_immed_prim(set_box, SETBOX, 2, 2); + SCHEME_PRIM_PROC_FLAGS(p) |= SCHEME_PRIM_IS_BINARY_INLINED; + scheme_add_global_constant(SETBOX, p, env); + + scheme_add_global_constant("chaperone-box", + scheme_make_prim_w_arity(chaperone_box, + "chaperone-box", + 3, -1), + env); scheme_add_global_constant("make-hash", scheme_make_immed_prim(make_hash, @@ -578,16 +588,22 @@ scheme_init_list (Scheme_Env *env) 2, 2), env); scheme_add_global_constant("hash-iterate-value", - scheme_make_immed_prim(hash_table_iterate_value, + scheme_make_noncm_prim(hash_table_iterate_value, "hash-iterate-value", 2, 2), env); scheme_add_global_constant("hash-iterate-key", - scheme_make_immed_prim(hash_table_iterate_key, + scheme_make_noncm_prim(hash_table_iterate_key, "hash-iterate-key", 2, 2), env); + scheme_add_global_constant("chaperone-hash", + scheme_make_prim_w_arity(chaperone_hash, + "chaperone-hash", + 5, -1), + env); + scheme_add_global_constant("eq-hash-code", scheme_make_immed_prim(eq_hash_code, "eq-hash-code", @@ -729,9 +745,17 @@ scheme_init_unsafe_list (Scheme_Env *env) SCHEME_PRIM_PROC_FLAGS(p) |= SCHEME_PRIM_IS_UNARY_INLINED; scheme_add_global_constant("unsafe-unbox", p, env); + p = scheme_make_immed_prim(unsafe_unbox, "unsafe-unbox*", 1, 1); + SCHEME_PRIM_PROC_FLAGS(p) |= SCHEME_PRIM_IS_UNARY_INLINED; + scheme_add_global_constant("unsafe-unbox*", p, env); + p = scheme_make_immed_prim(unsafe_set_box, "unsafe-set-box!", 2, 2); SCHEME_PRIM_PROC_FLAGS(p) |= SCHEME_PRIM_IS_BINARY_INLINED; scheme_add_global_constant("unsafe-set-box!", p, env); + + p = scheme_make_immed_prim(unsafe_set_box, "unsafe-set-box*!", 2, 2); + SCHEME_PRIM_PROC_FLAGS(p) |= SCHEME_PRIM_IS_BINARY_INLINED; + scheme_add_global_constant("unsafe-set-box*!", p, env); } Scheme_Object *scheme_make_pair(Scheme_Object *car, Scheme_Object *cdr) @@ -1100,7 +1124,12 @@ immutablep (int argc, Scheme_Object *argv[]) || SCHEME_CHAR_STRINGP(v) || SCHEME_BOXP(v) || SCHEME_HASHTP(v))) - || SCHEME_HASHTRP(v))) + || SCHEME_HASHTRP(v) + || (SCHEME_NP_CHAPERONEP(v) + && (SCHEME_HASHTRP(SCHEME_CHAPERONE_VAL(v)) + || ((SCHEME_VECTORP(SCHEME_CHAPERONE_VAL(v)) + || SCHEME_BOXP(SCHEME_CHAPERONE_VAL(v))) + && SCHEME_IMMUTABLEP(SCHEME_CHAPERONE_VAL(v))))))) ? scheme_true : scheme_false); } @@ -1454,17 +1483,107 @@ Scheme_Object *scheme_box(Scheme_Object *v) return obj; } +static Scheme_Object *chaperone_unbox_k(void) +{ + Scheme_Thread *p = scheme_current_thread; + Scheme_Object *o = (Scheme_Object *)p->ku.k.p1; + + p->ku.k.p1 = NULL; + + return scheme_unbox(o); +} + +static Scheme_Object *chaperone_unbox_overflow(Scheme_Object *o) +{ + Scheme_Thread *p = scheme_current_thread; + + p->ku.k.p1 = (void *)o; + + return scheme_handle_stack_overflow(chaperone_unbox_k); +} + +static Scheme_Object *chaperone_unbox(Scheme_Object *obj) +{ + Scheme_Chaperone *px = (Scheme_Chaperone *)obj; + Scheme_Object *a[2], *orig; + +#ifdef DO_STACK_CHECK + { +# include "mzstkchk.h" + return chaperone_unbox_overflow(obj); + } +#endif + + orig = scheme_unbox(px->prev); + + if (SCHEME_VECTORP(px->redirects)) { + /* chaperone was on property accessors */ + return orig; + } + + a[0] = px->prev; + a[1] = orig; + obj = _scheme_apply(SCHEME_CAR(px->redirects), 2, a); + + if (!scheme_chaperone_of(obj, orig)) + scheme_raise_exn(MZEXN_FAIL_CONTRACT, + "unbox: chaperone produced a result: %V that is not a chaperone of the original result: %V", + obj, + orig); + + return obj; +} + Scheme_Object *scheme_unbox(Scheme_Object *obj) { - if (!SCHEME_BOXP(obj)) - scheme_wrong_type(UNBOX, "box", 0, 1, &obj); + if (!SCHEME_BOXP(obj)) { + if (SCHEME_NP_CHAPERONEP(obj) + && SCHEME_BOXP(SCHEME_CHAPERONE_VAL(obj))) + return chaperone_unbox(obj); + + scheme_wrong_type(UNBOX, "box", 0, 1, &obj); + } + return (Scheme_Object *)SCHEME_BOX_VAL(obj); } +static void chaperone_set_box(Scheme_Object *obj, Scheme_Object *v) +{ + Scheme_Chaperone *px; + Scheme_Object *a[2]; + + while (1) { + if (SCHEME_BOXP(obj)) { + SCHEME_BOX_VAL(obj) = v; + return; + } else { + px = (Scheme_Chaperone *)obj; + + obj = px->prev; + a[0] = obj; + a[1] = v; + v = _scheme_apply(SCHEME_CDR(px->redirects), 2, a); + + if (!scheme_chaperone_of(v, a[1])) + scheme_raise_exn(MZEXN_FAIL_CONTRACT, + "vector-set!: chaperone produced a result: %V that is not a chaperone of the original result: %V", + v, + a[1]); + } + } +} + void scheme_set_box(Scheme_Object *b, Scheme_Object *v) { - if (!SCHEME_MUTABLE_BOXP(b)) - scheme_wrong_type(SETBOX, "mutable box", 0, 1, &b); + if (!SCHEME_MUTABLE_BOXP(b)) { + if (SCHEME_NP_CHAPERONEP(b) + && SCHEME_MUTABLE_BOXP(SCHEME_CHAPERONE_VAL(b))) { + chaperone_set_box(b, v); + return; + } + + scheme_wrong_type(SETBOX, "mutable box", 0, 1, &b); + } SCHEME_BOX_VAL(b) = v; } @@ -1485,7 +1604,7 @@ static Scheme_Object *immutable_box(int c, Scheme_Object *p[]) static Scheme_Object *box_p(int c, Scheme_Object *p[]) { - return SCHEME_BOXP(p[0]) ? scheme_true : scheme_false; + return SCHEME_CHAPERONE_BOXP(p[0]) ? scheme_true : scheme_false; } static Scheme_Object *unbox(int c, Scheme_Object *p[]) @@ -1499,6 +1618,35 @@ static Scheme_Object *set_box(int c, Scheme_Object *p[]) return scheme_void; } +static Scheme_Object *chaperone_box(int argc, Scheme_Object **argv) +{ + Scheme_Chaperone *px; + Scheme_Object *val = argv[0]; + Scheme_Object *redirects; + Scheme_Hash_Tree *props; + + if (SCHEME_CHAPERONEP(val)) + val = SCHEME_CHAPERONE_VAL(val); + + if (!SCHEME_BOXP(val)) + scheme_wrong_type("chaperone-box", "box", 0, argc, argv); + scheme_check_proc_arity("chaperone-box", 2, 1, argc, argv); + scheme_check_proc_arity("chaperone-box", 2, 2, argc, argv); + + redirects = scheme_make_pair(argv[1], argv[2]); + + props = scheme_parse_chaperone_props("chaperone-box", 3, argc, argv); + + px = MALLOC_ONE_TAGGED(Scheme_Chaperone); + px->so.type = scheme_chaperone_type; + px->val = val; + px->prev = argv[0]; + px->props = props; + px->redirects = redirects; + + return (Scheme_Object *)px; +} + static int compare_equal(void *v1, void *v2) { return !scheme_equal((Scheme_Object *)v1, (Scheme_Object *)v2); @@ -1701,14 +1849,19 @@ Scheme_Hash_Table *scheme_make_hash_table_eqv() static Scheme_Object *hash_table_count(int argc, Scheme_Object *argv[]) { - if (SCHEME_HASHTP(argv[0])) { - Scheme_Hash_Table *t = (Scheme_Hash_Table *)argv[0]; + Scheme_Object *v = argv[0]; + + if (SCHEME_CHAPERONEP(v)) + v = SCHEME_CHAPERONE_VAL(v); + + if (SCHEME_HASHTP(v)) { + Scheme_Hash_Table *t = (Scheme_Hash_Table *)v; return scheme_make_integer(t->count); - } else if (SCHEME_HASHTRP(argv[0])) { - Scheme_Hash_Tree *t = (Scheme_Hash_Tree *)argv[0]; + } else if (SCHEME_HASHTRP(v)) { + Scheme_Hash_Tree *t = (Scheme_Hash_Tree *)v; return scheme_make_integer(t->count); - } else if (SCHEME_BUCKTP(argv[0])) { - Scheme_Bucket_Table *t = (Scheme_Bucket_Table *)argv[0]; + } else if (SCHEME_BUCKTP(v)) { + Scheme_Bucket_Table *t = (Scheme_Bucket_Table *)v; int count = 0, weak, i; Scheme_Bucket **buckets, *bucket; const char *key; @@ -1739,34 +1892,49 @@ static Scheme_Object *hash_table_count(int argc, Scheme_Object *argv[]) static Scheme_Object *hash_table_copy(int argc, Scheme_Object *argv[]) { - if (SCHEME_HASHTP(argv[0])) { + Scheme_Object *v = argv[0]; + + if (SCHEME_NP_CHAPERONEP(v) && (SCHEME_HASHTP(SCHEME_CHAPERONE_VAL(v)) + || SCHEME_BUCKTP(SCHEME_CHAPERONE_VAL(v)))) + return scheme_chaperone_hash_table_copy(v); + + if (SCHEME_HASHTP(v)) { Scheme_Object *o; - Scheme_Hash_Table *t = (Scheme_Hash_Table *)argv[0]; + Scheme_Hash_Table *t = (Scheme_Hash_Table *)v; if (t->mutex) scheme_wait_sema(t->mutex,0); o = (Scheme_Object *)scheme_clone_hash_table(t); if (t->mutex) scheme_post_sema(t->mutex); return o; - } else if (SCHEME_BUCKTP(argv[0])) { + } else if (SCHEME_BUCKTP(v)) { Scheme_Object *o; - Scheme_Bucket_Table *t = (Scheme_Bucket_Table *)argv[0]; + Scheme_Bucket_Table *t = (Scheme_Bucket_Table *)v; if (t->mutex) scheme_wait_sema(t->mutex,0); o = (Scheme_Object *)scheme_clone_bucket_table(t); if (t->mutex) scheme_post_sema(t->mutex); return o; - } else if (SCHEME_HASHTRP(argv[0])) { - Scheme_Hash_Tree *t = (Scheme_Hash_Tree *)argv[0]; + } else if (SCHEME_HASHTRP(v)) { + Scheme_Hash_Tree *t; Scheme_Hash_Table *naya; int i; - Scheme_Object *k, *v; + Scheme_Object *k, *val; + + if (SCHEME_NP_CHAPERONEP(v)) + t = (Scheme_Hash_Tree *)SCHEME_CHAPERONE_VAL(v); + else + t = (Scheme_Hash_Tree *)v; if (scheme_is_hash_tree_equal((Scheme_Object *)t)) naya = scheme_make_hash_table_equal(); + else if (scheme_is_hash_tree_eqv((Scheme_Object *)t)) + naya = scheme_make_hash_table_eqv(); else naya = scheme_make_hash_table(SCHEME_hash_ptr); for (i = t->count; i--; ) { - scheme_hash_tree_index(t, i, &k, &v); - scheme_hash_set(naya, k, v); + scheme_hash_tree_index(t, i, &k, &val); + if (!SAME_OBJ((Scheme_Object *)t, v)) + val = scheme_chaperone_hash_traversal_get(v, k); + scheme_hash_set(naya, k, val); } return (Scheme_Object *)naya; @@ -1780,6 +1948,9 @@ static Scheme_Object *hash_p(int argc, Scheme_Object *argv[]) { Scheme_Object *o = argv[0]; + if (SCHEME_CHAPERONEP(o)) + o = SCHEME_CHAPERONE_VAL(o); + if (SCHEME_HASHTP(o) || SCHEME_HASHTRP(o) || SCHEME_BUCKTP(o)) return scheme_true; else @@ -1790,6 +1961,9 @@ static Scheme_Object *hash_eq_p(int argc, Scheme_Object *argv[]) { Scheme_Object *o = argv[0]; + if (SCHEME_CHAPERONEP(o)) + o = SCHEME_CHAPERONE_VAL(o); + if (SCHEME_HASHTP(o)) { if ((((Scheme_Hash_Table *)o)->compare != compare_equal) && (((Scheme_Hash_Table *)o)->compare != compare_eqv)) @@ -1812,6 +1986,9 @@ static Scheme_Object *hash_eqv_p(int argc, Scheme_Object *argv[]) { Scheme_Object *o = argv[0]; + if (SCHEME_CHAPERONEP(o)) + o = SCHEME_CHAPERONE_VAL(o); + if (SCHEME_HASHTP(o)) { if (((Scheme_Hash_Table *)o)->compare == compare_eqv) return scheme_true; @@ -1832,6 +2009,9 @@ static Scheme_Object *hash_weak_p(int argc, Scheme_Object *argv[]) { Scheme_Object *o = argv[0]; + if (SCHEME_CHAPERONEP(o)) + o = SCHEME_CHAPERONE_VAL(o); + if (SCHEME_BUCKTP(o)) return scheme_true; else if (SCHEME_HASHTP(o) || SCHEME_HASHTRP(o)) @@ -1866,7 +2046,10 @@ static Scheme_Object *hash_table_put_bang(int argc, Scheme_Object *argv[]) { Scheme_Object *v = argv[0]; - if (SCHEME_BUCKTP(v)) { + if (SCHEME_NP_CHAPERONEP(v) && (SCHEME_HASHTP(SCHEME_CHAPERONE_VAL(v)) + || SCHEME_BUCKTP(SCHEME_CHAPERONE_VAL(v)))) + scheme_chaperone_hash_set(v, argv[1], argv[2]); + else if (SCHEME_BUCKTP(v)) { Scheme_Bucket_Table *t = (Scheme_Bucket_Table *)v; if (t->mutex) scheme_wait_sema(t->mutex,0); scheme_add_to_table(t, (char *)argv[1], (void *)argv[2], 0); @@ -1889,6 +2072,9 @@ static Scheme_Object *hash_table_put(int argc, Scheme_Object *argv[]) { Scheme_Object *v = argv[0]; + if (SCHEME_NP_CHAPERONEP(v) && SCHEME_HASHTRP(SCHEME_CHAPERONE_VAL(v))) + return chaperone_hash_tree_set(v, argv[1], argv[2]); + if (!SCHEME_HASHTRP(v)) { scheme_wrong_type("hash-set", "immutable hash", 0, argc, argv); return NULL; @@ -1903,7 +2089,11 @@ static Scheme_Object *hash_table_get(int argc, Scheme_Object *argv[]) v = argv[0]; - if (SCHEME_BUCKTP(v)) { + if (SCHEME_NP_CHAPERONEP(v) && (SCHEME_HASHTP(SCHEME_CHAPERONE_VAL(v)) + || SCHEME_HASHTRP(SCHEME_CHAPERONE_VAL(v)) + || SCHEME_BUCKTP(SCHEME_CHAPERONE_VAL(v)))) + v = scheme_chaperone_hash_get(v, argv[1]); + else if (SCHEME_BUCKTP(v)) { Scheme_Bucket_Table *t = (Scheme_Bucket_Table *)v; if (t->mutex) scheme_wait_sema(t->mutex, 0); v = (Scheme_Object *)scheme_lookup_in_table(t, (char *)argv[1]); @@ -1940,21 +2130,31 @@ static Scheme_Object *hash_table_get(int argc, Scheme_Object *argv[]) static Scheme_Object *hash_table_remove_bang(int argc, Scheme_Object *argv[]) { - if (!(SCHEME_HASHTP(argv[0]) && SCHEME_MUTABLEP(argv[0])) && !SCHEME_BUCKTP(argv[0])) + Scheme_Object *v; + + v = argv[0]; + + if (SCHEME_NP_CHAPERONEP(v) && (SCHEME_HASHTP(SCHEME_CHAPERONE_VAL(v)) + || SCHEME_BUCKTP(SCHEME_CHAPERONE_VAL(v)))) { + scheme_chaperone_hash_set(v, argv[1], NULL); + return scheme_void; + } + + if (!(SCHEME_HASHTP(v) && SCHEME_MUTABLEP(v)) && !SCHEME_BUCKTP(v)) scheme_wrong_type("hash-remove!", "mutable table", 0, argc, argv); - if (SCHEME_BUCKTP(argv[0])) { + if (SCHEME_BUCKTP(v)) { Scheme_Bucket *b; - Scheme_Bucket_Table *t = (Scheme_Bucket_Table *)argv[0]; + Scheme_Bucket_Table *t = (Scheme_Bucket_Table *)v; if (t->mutex) scheme_wait_sema(t->mutex, 0); - b = scheme_bucket_or_null_from_table((Scheme_Bucket_Table *)argv[0], (char *)argv[1], 0); + b = scheme_bucket_or_null_from_table((Scheme_Bucket_Table *)v, (char *)argv[1], 0); if (b) { HT_EXTRACT_WEAK(b->key) = NULL; b->val = NULL; } if (t->mutex) scheme_post_sema(t->mutex); } else{ - Scheme_Hash_Table *t = (Scheme_Hash_Table *)argv[0]; + Scheme_Hash_Table *t = (Scheme_Hash_Table *)v; if (t->mutex) scheme_wait_sema(t->mutex, 0); scheme_hash_set(t, argv[1], NULL); if (t->mutex) scheme_post_sema(t->mutex); @@ -1965,10 +2165,15 @@ static Scheme_Object *hash_table_remove_bang(int argc, Scheme_Object *argv[]) static Scheme_Object *hash_table_remove(int argc, Scheme_Object *argv[]) { - if (!SCHEME_HASHTRP(argv[0])) + Scheme_Object *v = argv[0]; + + if (SCHEME_NP_CHAPERONEP(v) && SCHEME_HASHTRP(SCHEME_CHAPERONE_VAL(v))) + return chaperone_hash_tree_set(v, argv[1], NULL); + + if (!SCHEME_HASHTRP(v)) scheme_wrong_type("hash-remove", "immutable hash", 0, argc, argv); - return (Scheme_Object *)scheme_hash_tree_set((Scheme_Hash_Tree *)argv[0], argv[1], NULL); + return (Scheme_Object *)scheme_hash_tree_set((Scheme_Hash_Tree *)v, argv[1], NULL); } static Scheme_Object *do_map_hash_table(int argc, @@ -1978,9 +2183,16 @@ static Scheme_Object *do_map_hash_table(int argc, { int i; Scheme_Object *f; - Scheme_Object *first, *last = NULL, *v, *p[2]; + Scheme_Object *first, *last = NULL, *v, *p[2], *obj, *chaperone; - if (!(SCHEME_HASHTP(argv[0]) || SCHEME_BUCKTP(argv[0]) || SCHEME_HASHTRP(argv[0]))) + obj = argv[0]; + if (SCHEME_NP_CHAPERONEP(obj)) { + chaperone = obj; + obj = SCHEME_CHAPERONE_VAL(chaperone); + } else + chaperone = NULL; + + if (!(SCHEME_HASHTP(obj) || SCHEME_BUCKTP(obj) || SCHEME_HASHTRP(obj))) scheme_wrong_type(name, "hash", 0, argc, argv); scheme_check_proc_arity(name, 2, 1, argc, argv); @@ -1991,11 +2203,11 @@ static Scheme_Object *do_map_hash_table(int argc, else first = scheme_void; - if (SCHEME_BUCKTP(argv[0])) { + if (SCHEME_BUCKTP(obj)) { Scheme_Bucket_Table *hash; Scheme_Bucket *bucket; - hash = (Scheme_Bucket_Table *)argv[0]; + hash = (Scheme_Bucket_Table *)obj; for (i = hash->size; i--; ) { bucket = hash->buckets[i]; @@ -2004,7 +2216,13 @@ static Scheme_Object *do_map_hash_table(int argc, p[0] = (Scheme_Object *)HT_EXTRACT_WEAK(bucket->key); else p[0] = (Scheme_Object *)bucket->key; - p[1] = (Scheme_Object *)bucket->val; + if (chaperone) { + v = chaperone_hash_key(name, chaperone, p[0]); + p[0] = v; + v = scheme_chaperone_hash_get(chaperone, v); + } else + v = (Scheme_Object *)bucket->val; + p[1] = v; if (keep) { v = _scheme_apply(f, 2, p); v = cons(v, scheme_null); @@ -2017,15 +2235,22 @@ static Scheme_Object *do_map_hash_table(int argc, _scheme_apply_multi(f, 2, p); } } - } else if (SCHEME_HASHTP(argv[0])) { + } else if (SCHEME_HASHTP(obj)) { Scheme_Hash_Table *hash; - hash = (Scheme_Hash_Table *)argv[0]; + hash = (Scheme_Hash_Table *)obj; for (i = hash->size; i--; ) { if (hash->vals[i]) { p[0] = hash->keys[i]; - p[1] = hash->vals[i]; + if (chaperone) { + v = chaperone_hash_key(name, chaperone, p[0]); + p[0] = v; + v = scheme_chaperone_hash_get(chaperone, v); + } else { + v = hash->vals[i]; + } + p[1] = v; if (keep) { v = _scheme_apply(f, 2, p); v = cons(v, scheme_null); @@ -2043,12 +2268,16 @@ static Scheme_Object *do_map_hash_table(int argc, Scheme_Hash_Tree *hash; long pos; - hash = (Scheme_Hash_Tree *)argv[0]; + hash = (Scheme_Hash_Tree *)obj; pos = scheme_hash_tree_next(hash, -1); while (pos != -1) { scheme_hash_tree_index(hash, pos, &ik, &iv); p[0] = ik; + if (chaperone) { + ik = chaperone_hash_key(name, chaperone, ik); + iv = scheme_chaperone_hash_get(chaperone, ik); + } p[1] = iv; if (keep) { v = _scheme_apply(f, 2, p); @@ -2174,9 +2403,16 @@ static Scheme_Object *hash_table_iterate_next(int argc, Scheme_Object *argv[]) static Scheme_Object *hash_table_index(const char *name, int argc, Scheme_Object *argv[], int get_val) { - Scheme_Object *p = argv[1]; + Scheme_Object *p = argv[1], *obj, *chaperone; int pos, sz; + obj = argv[0]; + if (SCHEME_NP_CHAPERONEP(obj)) { + chaperone = obj; + obj = SCHEME_CHAPERONE_VAL(chaperone); + } else + chaperone = NULL; + if (SCHEME_INTP(p)) { pos = SCHEME_INT_VAL(p); if (pos < 0) @@ -2185,42 +2421,61 @@ static Scheme_Object *hash_table_index(const char *name, int argc, Scheme_Object pos = 0x7FFFFFFF; } - if (SCHEME_HASHTP(argv[0])) { + if (SCHEME_HASHTP(obj)) { Scheme_Hash_Table *hash; - hash = (Scheme_Hash_Table *)argv[0]; + hash = (Scheme_Hash_Table *)obj; sz = hash->size; if (pos < sz) { if (hash->vals[pos]) { - if (get_val) + if (chaperone) { + if (get_val) + return scheme_chaperone_hash_get(chaperone, chaperone_hash_key(name, chaperone, hash->keys[pos])); + else + return chaperone_hash_key(name, chaperone, hash->keys[pos]); + } else if (get_val) return hash->vals[pos]; else return hash->keys[pos]; } } - } else if (SCHEME_HASHTRP(argv[0])) { + } else if (SCHEME_HASHTRP(obj)) { Scheme_Object *v, *k; - if (scheme_hash_tree_index((Scheme_Hash_Tree *)argv[0], pos, &k, &v)) - return (get_val ? v : k); - } else if (SCHEME_BUCKTP(argv[0])) { + if (scheme_hash_tree_index((Scheme_Hash_Tree *)obj, pos, &k, &v)) { + if (chaperone) { + if (get_val) + return scheme_chaperone_hash_get(chaperone, chaperone_hash_key(name, chaperone, k)); + else + return chaperone_hash_key(name, chaperone, k); + } else + return (get_val ? v : k); + } + } else if (SCHEME_BUCKTP(obj)) { Scheme_Bucket_Table *hash; int sz; Scheme_Bucket *bucket; - hash = (Scheme_Bucket_Table *)argv[0]; + hash = (Scheme_Bucket_Table *)obj; sz = hash->size; if (pos < sz) { bucket = hash->buckets[pos]; if (bucket && bucket->val && bucket->key) { - if (get_val) + if (get_val && !chaperone) return (Scheme_Object *)bucket->val; else { if (hash->weak) - return (Scheme_Object *)HT_EXTRACT_WEAK(bucket->key); + obj = (Scheme_Object *)HT_EXTRACT_WEAK(bucket->key); else - return (Scheme_Object *)bucket->key; + obj = (Scheme_Object *)bucket->key; + if (chaperone) { + if (get_val) + return scheme_chaperone_hash_get(chaperone, chaperone_hash_key(name, chaperone, obj)); + else + return chaperone_hash_key(name, chaperone, obj); + } else + return obj; } } } @@ -2251,6 +2506,313 @@ static Scheme_Object *hash_table_iterate_key(int argc, Scheme_Object *argv[]) return hash_table_index("hash-iterate-key", argc, argv, 0); } +static Scheme_Object *chaperone_hash(int argc, Scheme_Object **argv) +{ + Scheme_Chaperone *px; + Scheme_Object *val = argv[0]; + Scheme_Object *redirects; + Scheme_Hash_Tree *props; + + if (SCHEME_CHAPERONEP(val)) + val = SCHEME_CHAPERONE_VAL(val); + + if (!SCHEME_HASHTP(val) && !SCHEME_HASHTRP(val) && !SCHEME_BUCKTP(val)) + scheme_wrong_type("chaperone-hash", "hash", 0, argc, argv); + scheme_check_proc_arity("chaperone-hash", 3, 1, argc, argv); /* ref */ + scheme_check_proc_arity("chaperone-hash", 3, 2, argc, argv); /* set! */ + scheme_check_proc_arity("chaperone-hash", 2, 3, argc, argv); /* remove */ + scheme_check_proc_arity("chaperone-hash", 2, 4, argc, argv); /* key */ + + redirects = scheme_make_vector(4, NULL); + SCHEME_VEC_ELS(redirects)[0] = argv[1]; + SCHEME_VEC_ELS(redirects)[1] = argv[2]; + SCHEME_VEC_ELS(redirects)[2] = argv[3]; + SCHEME_VEC_ELS(redirects)[3] = argv[4]; + redirects = scheme_box(redirects); /* so it doesn't look like a struct chaperone */ + + props = scheme_parse_chaperone_props("chaperone-hash", 5, argc, argv); + + px = MALLOC_ONE_TAGGED(Scheme_Chaperone); + px->so.type = scheme_chaperone_type; + px->val = val; + px->prev = argv[0]; + px->props = props; + px->redirects = redirects; + + return (Scheme_Object *)px; +} + +static Scheme_Object *transfer_chaperone(Scheme_Object *chaperone, Scheme_Object *v) +{ + Scheme_Chaperone *px; + + px = MALLOC_ONE_TAGGED(Scheme_Chaperone); + memcpy(px, chaperone, sizeof(Scheme_Chaperone)); + px->prev = v; + if (SCHEME_CHAPERONEP(v)) + px->val = SCHEME_CHAPERONE_VAL(v); + else + px->val = v; + + return (Scheme_Object *)px; +} + +static Scheme_Object *chaperone_hash_op(const char *who, Scheme_Object *o, Scheme_Object *k, + Scheme_Object *v, int mode); + +static Scheme_Object *chaperone_hash_op_k(void) +{ + Scheme_Thread *p = scheme_current_thread; + Scheme_Object *o = (Scheme_Object *)p->ku.k.p1; + Scheme_Object *k = (Scheme_Object *)p->ku.k.p2; + Scheme_Object *v = (Scheme_Object *)p->ku.k.p3; + const char *who = (const char *)p->ku.k.p4; + + p->ku.k.p1 = NULL; + p->ku.k.p2 = NULL; + p->ku.k.p3 = NULL; + p->ku.k.p4 = NULL; + + return chaperone_hash_op(who, o, k, v, p->ku.k.i1); +} + +static Scheme_Object *chaperone_hash_op_overflow(const char *who, Scheme_Object *o, Scheme_Object *k, + Scheme_Object *v, int mode) +{ + Scheme_Thread *p = scheme_current_thread; + + p->ku.k.p1 = (void *)o; + p->ku.k.p2 = (void *)k; + p->ku.k.p3 = (void *)v; + p->ku.k.p4 = (void *)who; + p->ku.k.i1 = mode; + + return scheme_handle_stack_overflow(chaperone_hash_op_k); +} + +static Scheme_Object *chaperone_hash_op(const char *who, Scheme_Object *o, Scheme_Object *k, + Scheme_Object *v, int mode) +{ + Scheme_Object *wraps = NULL; + + while (1) { + if (!SCHEME_NP_CHAPERONEP(o)) { + if (mode == 0) { + if (SCHEME_HASHTP(o)) + return scheme_hash_get((Scheme_Hash_Table *)o, k); + else if (SCHEME_HASHTRP(o)) + return scheme_hash_tree_get((Scheme_Hash_Tree *)o, k); + else + return scheme_lookup_in_table((Scheme_Bucket_Table *)o, (const char *)k); + } else if ((mode == 1) || (mode == 2)) { + if (SCHEME_HASHTP(o)) + scheme_hash_set((Scheme_Hash_Table *)o, k, v); + else if (SCHEME_HASHTRP(o)) { + o = (Scheme_Object *)scheme_hash_tree_set((Scheme_Hash_Tree *)o, k, v); + while (wraps) { + o = transfer_chaperone(SCHEME_CAR(wraps), o); + wraps = SCHEME_CDR(wraps); + } + return o; + } else if (!v) { + Scheme_Bucket *b; + b = scheme_bucket_or_null_from_table((Scheme_Bucket_Table *)o, (char *)k, 0); + if (b) { + HT_EXTRACT_WEAK(b->key) = NULL; + b->val = NULL; + } + } else + scheme_add_to_table((Scheme_Bucket_Table *)o, (const char *)k, v, 0); + return scheme_void; + } else + return k; + } else { + Scheme_Chaperone *px = (Scheme_Chaperone *)o; + Scheme_Object *a[3], *red, *orig; + const char *what; + +#ifdef DO_STACK_CHECK + { +# include "mzstkchk.h" + return chaperone_hash_op_overflow(who, o, k, v, mode); + } +#endif + + if (mode == 0) { + orig = chaperone_hash_op(who, px->prev, k, v, mode); + if (!orig) return NULL; + } else if ((mode == 2) || (mode == 3)) + orig = k; + else + orig = v; + + if (SCHEME_VECTORP(px->redirects)) { + /* chaperone was on property accessors */ + o = orig; + } else { + + red = SCHEME_BOX_VAL(px->redirects); + red = SCHEME_VEC_ELS(red)[mode]; + + a[0] = px->prev; + a[1] = k; + a[2] = orig; + + if (mode == 0) { + /* hash-ref */ + o = _scheme_apply(red, 3, a); + what = "result"; + } else if (mode == 1) { + /* hash-set! */ + Scheme_Object **vals; + int cnt; + Scheme_Thread *p; + + o = _scheme_apply_multi(red, 3, a); + + if (SAME_OBJ(o, SCHEME_MULTIPLE_VALUES)) { + p = scheme_current_thread; + cnt = p->ku.multiple.count; + vals = p->ku.multiple.array; + p->ku.multiple.array = NULL; + if (SAME_OBJ(vals, p->values_buffer)) + p->values_buffer = NULL; + p = NULL; + } else { + vals = NULL; + cnt = 1; + } + + if (cnt != 2) + scheme_raise_exn(MZEXN_FAIL_CONTRACT_ARITY, + "%s: chaperone: %V: returned %d values, expected 2", + who, + red, + cnt); + + if (!scheme_chaperone_of(vals[0], k)) + scheme_raise_exn(MZEXN_FAIL_CONTRACT, + "%s: chaperone produced a key: %V that is not a chaperone of the original key: %V", + who, + vals[0], + k); + k = vals[0]; + o = vals[1]; + what = "value"; + } else { + /* hash-remove! and key extraction */ + o = _scheme_apply(red, 2, a); + what = "key"; + } + + if (!scheme_chaperone_of(o, orig)) + scheme_raise_exn(MZEXN_FAIL_CONTRACT, + "%s: chaperone produced a %s: %V that is not a chaperone of the original %s: %V", + who, what, + o, + what, orig); + } + + if ((mode == 0) || (mode == 3)) + return o; + else { + if (mode == 1) + v = o; + else + k = o; + if (SCHEME_HASHTRP(px->val)) + wraps = scheme_make_raw_pair((Scheme_Object *)px, wraps); + o = px->prev; + } + } + } +} + +Scheme_Object *scheme_chaperone_hash_get(Scheme_Object *table, Scheme_Object *key) +{ + return chaperone_hash_op("hash-ref", table, key, NULL, 0); +} + +void scheme_chaperone_hash_set(Scheme_Object *table, Scheme_Object *key, Scheme_Object *val) +{ + (void)chaperone_hash_op(val ? "hash-set!" : "hash-remove!", table, key, val, val ? 1 : 2); +} + +Scheme_Object *chaperone_hash_tree_set(Scheme_Object *table, Scheme_Object *key, Scheme_Object *val) +{ + return chaperone_hash_op(val ? "hash-set" : "hash-remove", table, key, val, val ? 1 : 2); +} + +static Scheme_Object *chaperone_hash_key(const char *name, Scheme_Object *table, Scheme_Object *key) +{ + return chaperone_hash_op(name, table, key, NULL, 3); +} + +Scheme_Object *scheme_chaperone_hash_traversal_get(Scheme_Object *table, Scheme_Object *key) +{ + key = chaperone_hash_key("hash-table-iterate-key", table, key); + return chaperone_hash_op("hash-ref", table, key, NULL, 0); +} + +Scheme_Object *scheme_chaperone_hash_table_copy(Scheme_Object *obj) +{ + Scheme_Object *a[3], *v, *v2, *idx, *key, *val; + int is_eq, is_eqv; + + v = SCHEME_CHAPERONE_VAL(obj); + + a[0] = obj; + is_eq = SCHEME_TRUEP(hash_eq_p(1, a)); + is_eqv = SCHEME_TRUEP(hash_eqv_p(1, a)); + + if (SCHEME_HASHTP(obj)) { + if (is_eq) + v2 = make_hasheq(0, NULL); + else if (is_eqv) + v2 = make_hasheqv(0, NULL); + else + v2 = make_hash(0, NULL); + } else if (SCHEME_HASHTRP(obj)) { + if (is_eq) + v2 = make_immutable_hasheq(0, NULL); + else if (is_eqv) + v2 = make_immutable_hasheqv(0, NULL); + else + v2 = make_immutable_hash(0, NULL); + } else { + if (is_eq) + v2 = make_weak_hasheq(0, NULL); + else if (is_eqv) + v2 = make_weak_hasheqv(0, NULL); + else + v2 = make_weak_hash(0, NULL); + } + + idx = hash_table_iterate_start(1, a); + while (SCHEME_TRUEP(idx)) { + a[0] = v; + a[1] = idx; + key = hash_table_iterate_key(2, a); + + val = scheme_chaperone_hash_get(obj, key); + if (val) { + a[0] = v2; + a[1] = key; + a[2] = val; + if (SCHEME_HASHTRP(v2)) + v2 = hash_table_put(2, a); + else + (void)hash_table_put_bang(2, a); + } + + a[0] = v; + a[1] = idx; + idx = hash_table_iterate_next(2, a); + } + + return v2; +} + static Scheme_Object *eq_hash_code(int argc, Scheme_Object *argv[]) { long v; diff --git a/src/mzscheme/src/mzmark.c b/src/mzscheme/src/mzmark.c index ede20f83a4..7ec137f48b 100644 --- a/src/mzscheme/src/mzmark.c +++ b/src/mzscheme/src/mzmark.c @@ -4845,6 +4845,39 @@ static int mark_nack_guard_evt_FIXUP(void *p) { #define mark_nack_guard_evt_IS_CONST_SIZE 1 +static int mark_chaperone_SIZE(void *p) { + return + gcBYTES_TO_WORDS(sizeof(Scheme_Chaperone)); +} + +static int mark_chaperone_MARK(void *p) { + Scheme_Chaperone *px = (Scheme_Chaperone *)p; + + gcMARK(px->val); + gcMARK(px->prev); + gcMARK(px->props); + gcMARK(px->redirects); + + return + gcBYTES_TO_WORDS(sizeof(Scheme_Chaperone)); +} + +static int mark_chaperone_FIXUP(void *p) { + Scheme_Chaperone *px = (Scheme_Chaperone *)p; + + gcFIXUP(px->val); + gcFIXUP(px->prev); + gcFIXUP(px->props); + gcFIXUP(px->redirects); + + return + gcBYTES_TO_WORDS(sizeof(Scheme_Chaperone)); +} + +#define mark_chaperone_IS_ATOMIC 0 +#define mark_chaperone_IS_CONST_SIZE 1 + + #endif /* STRUCT */ /**********************************************************************/ diff --git a/src/mzscheme/src/mzmarksrc.c b/src/mzscheme/src/mzmarksrc.c index ce0a7cf717..6541904fa2 100644 --- a/src/mzscheme/src/mzmarksrc.c +++ b/src/mzscheme/src/mzmarksrc.c @@ -1974,6 +1974,19 @@ mark_nack_guard_evt { gcBYTES_TO_WORDS(sizeof(Nack_Guard_Evt)); } +mark_chaperone { + mark: + Scheme_Chaperone *px = (Scheme_Chaperone *)p; + + gcMARK(px->val); + gcMARK(px->prev); + gcMARK(px->props); + gcMARK(px->redirects); + + size: + gcBYTES_TO_WORDS(sizeof(Scheme_Chaperone)); +} + END struct; /**********************************************************************/ diff --git a/src/mzscheme/src/portfun.c b/src/mzscheme/src/portfun.c index 3aa208d11d..4e7c157a58 100644 --- a/src/mzscheme/src/portfun.c +++ b/src/mzscheme/src/portfun.c @@ -372,7 +372,7 @@ static MZ_INLINE Scheme_Input_Port *input_port_record_slow(Scheme_Object *port) if (SCHEME_INPORTP(port)) return (Scheme_Input_Port *)port; - if (!SCHEME_STRUCTP(port)) { + if (!SCHEME_CHAPERONE_STRUCTP(port)) { return (Scheme_Input_Port *)dummy_input_port; } @@ -380,7 +380,7 @@ static MZ_INLINE Scheme_Input_Port *input_port_record_slow(Scheme_Object *port) if (!v) v = scheme_false; else if (SCHEME_INTP(v)) - v = ((Scheme_Structure *)port)->slots[SCHEME_INT_VAL(v)]; + v = scheme_struct_ref(port, SCHEME_INT_VAL(v)); port = v; SCHEME_USE_FUEL(1); @@ -404,7 +404,7 @@ static MZ_INLINE Scheme_Output_Port *output_port_record_slow(Scheme_Object *port if (SCHEME_OUTPORTP(port)) return (Scheme_Output_Port *)port; - if (!SCHEME_STRUCTP(port)) { + if (!SCHEME_CHAPERONE_STRUCTP(port)) { return (Scheme_Output_Port *)dummy_output_port; } @@ -412,7 +412,7 @@ static MZ_INLINE Scheme_Output_Port *output_port_record_slow(Scheme_Object *port if (!v) v = scheme_false; else if (SCHEME_INTP(v)) - v = ((Scheme_Structure *)port)->slots[SCHEME_INT_VAL(v)]; + v = scheme_struct_ref(port, SCHEME_INT_VAL(v)); port = v; SCHEME_USE_FUEL(1); @@ -433,7 +433,7 @@ int scheme_is_input_port(Scheme_Object *port) if (SCHEME_INPORTP(port)) return 1; - if (SCHEME_STRUCTP(port)) + if (SCHEME_CHAPERONE_STRUCTP(port)) if (scheme_struct_type_property_ref(scheme_input_port_property, port)) return 1; @@ -445,7 +445,7 @@ int scheme_is_output_port(Scheme_Object *port) if (SCHEME_OUTPORTP(port)) return 1; - if (SCHEME_STRUCTP(port)) + if (SCHEME_CHAPERONE_STRUCTP(port)) if (scheme_struct_type_property_ref(scheme_output_port_property, port)) return 1; diff --git a/src/mzscheme/src/print.c b/src/mzscheme/src/print.c index ffc479a9f9..fc04d7a1be 100644 --- a/src/mzscheme/src/print.c +++ b/src/mzscheme/src/print.c @@ -122,18 +122,20 @@ static Scheme_Object *writable_struct_subs(Scheme_Object *s, int for_write, Prin #define SCHEME_PREFABP(obj) (((Scheme_Structure *)(obj))->stype->prefab_key) #define SCHEME_HASHTPx(obj) ((SCHEME_HASHTP(obj) && !(MZ_OPT_HASH_KEY(&(((Scheme_Hash_Table *)obj)->iso)) & 0x1))) +#define SCHEME_CHAPERONE_HASHTPx(obj) (SCHEME_HASHTPx(obj) \ + || (SCHEME_NP_CHAPERONEP(obj) && SCHEME_HASHTP(SCHEME_CHAPERONE_VAL(obj)))) #define HAS_SUBSTRUCT(obj, qk) \ (SCHEME_PAIRP(obj) \ || SCHEME_MUTABLE_PAIRP(obj) \ - || SCHEME_VECTORP(obj) \ - || (qk(pp->print_box, 1) && SCHEME_BOXP(obj)) \ + || SCHEME_CHAPERONE_VECTORP(obj) \ + || (qk(pp->print_box, 1) && SCHEME_CHAPERONE_BOXP(obj)) \ || (qk(pp->print_struct \ - && SCHEME_STRUCTP(obj) \ + && SCHEME_CHAPERONE_STRUCTP(obj) \ && PRINTABLE_STRUCT(obj, pp), 0)) \ - || (qk(SCHEME_STRUCTP(obj) && scheme_is_writable_struct(obj), 0)) \ - || (qk(pp->print_struct, 1) && SCHEME_STRUCTP(obj) && SCHEME_PREFABP(obj)) \ - || (qk(pp->print_hash_table, 1) && (SCHEME_HASHTPx(obj) || SCHEME_HASHTRP(obj)))) + || (qk(SCHEME_CHAPERONE_STRUCTP(obj) && scheme_is_writable_struct(obj), 0)) \ + || (qk(pp->print_struct, 1) && SCHEME_CHAPERONE_STRUCTP(obj) && SCHEME_PREFABP(obj)) \ + || (qk(pp->print_hash_table, 1) && (SCHEME_CHAPERONE_HASHTPx(obj) || SCHEME_CHAPERONE_HASHTRP(obj)))) #define ssQUICK(x, isbox) x #define ssQUICKp(x, isbox) (pp ? x : isbox) #define ssALLp(x, isbox) isbox @@ -443,8 +445,8 @@ static int check_cycles(Scheme_Object *obj, int for_write, Scheme_Hash_Table *ht if (SCHEME_PAIRP(obj) || SCHEME_MUTABLE_PAIRP(obj) - || (pp->print_box && SCHEME_BOXP(obj)) - || SCHEME_VECTORP(obj) + || (pp->print_box && SCHEME_CHAPERONE_BOXP(obj)) + || SCHEME_CHAPERONE_VECTORP(obj) || ((SAME_TYPE(t, scheme_structure_type) || SAME_TYPE(t, scheme_proc_struct_type)) && ((pp->print_struct @@ -464,16 +466,29 @@ static int check_cycles(Scheme_Object *obj, int for_write, Scheme_Hash_Table *ht return 1; if (check_cycles(SCHEME_CDR(obj), for_write, ht, pp)) return 1; - } else if (SCHEME_BOXP(obj)) { + } else if (SCHEME_CHAPERONE_BOXP(obj)) { /* got here => printable */ - if (check_cycles(SCHEME_BOX_VAL(obj), for_write, ht, pp)) + Scheme_Object *v; + if (SCHEME_BOXP(obj)) + v = SCHEME_BOX_VAL(obj); + else + v = scheme_unbox(obj); + if (check_cycles(v, for_write, ht, pp)) return 1; - } else if (SCHEME_VECTORP(obj)) { + } else if (SCHEME_CHAPERONE_VECTORP(obj)) { int i, len; + Scheme_Object *v; - len = SCHEME_VEC_SIZE(obj); + if (SCHEME_VECTORP(obj)) + len = SCHEME_VEC_SIZE(obj); + else + len = SCHEME_VEC_SIZE(SCHEME_CHAPERONE_VAL(obj)); for (i = 0; i < len; i++) { - if (check_cycles(SCHEME_VEC_ELS(obj)[i], for_write, ht, pp)) { + if (SCHEME_VECTORP(obj)) + v = SCHEME_VEC_ELS(obj)[i]; + else + v = scheme_chaperone_vector_ref(obj, i); + if (check_cycles(v, for_write, ht, pp)) { return 1; } } @@ -494,33 +509,50 @@ static int check_cycles(Scheme_Object *obj, int for_write, Scheme_Hash_Table *ht } } } - } else if (SCHEME_HASHTPx(obj)) { + } else if (SCHEME_CHAPERONE_HASHTPx(obj)) { /* got here => printable */ Scheme_Hash_Table *t; - Scheme_Object **keys, **vals, *val; + Scheme_Object **keys, **vals, *val, *key; int i; - - t = (Scheme_Hash_Table *)obj; + + if (SCHEME_NP_CHAPERONEP(obj)) + t = (Scheme_Hash_Table *)SCHEME_CHAPERONE_VAL(obj); + else + t = (Scheme_Hash_Table *)obj; + keys = t->keys; vals = t->vals; - for (i = t->size; i--; ) { + for (i = 0; i < t->size; i++) { if (vals[i]) { - val = vals[i]; - if (check_cycles(keys[i], for_write, ht, pp)) - return 1; - if (check_cycles(val, for_write, ht, pp)) - return 1; + key = keys[i]; + if (!SAME_OBJ((Scheme_Object *)t, obj)) + val = scheme_chaperone_hash_traversal_get(obj, key); + else + val = vals[i]; + if (val) { + if (check_cycles(key, for_write, ht, pp)) + return 1; + if (check_cycles(val, for_write, ht, pp)) + return 1; + } } } - } else if (SCHEME_HASHTRP(obj)) { + } else if (SCHEME_CHAPERONE_HASHTRP(obj)) { /* got here => printable */ - Scheme_Hash_Tree *t = (Scheme_Hash_Tree *)obj; + Scheme_Hash_Tree *t; Scheme_Object *key, *val; int i; + + if (SCHEME_NP_CHAPERONEP(obj)) + t = (Scheme_Hash_Tree *)SCHEME_CHAPERONE_VAL(obj); + else + t = (Scheme_Hash_Tree *)obj; i = scheme_hash_tree_next(t, -1); while (i != -1) { scheme_hash_tree_index(t, i, &key, &val); + if (!SAME_OBJ((Scheme_Object *)t, obj)) + val = scheme_chaperone_hash_traversal_get(obj, key); if (check_cycles(key, for_write, ht, pp)) return 1; if (check_cycles(val, for_write, ht, pp)) @@ -610,7 +642,9 @@ static int check_cycles_fast(Scheme_Object *obj, PrintParams *pp, int *fast_chec else /* don't bother with fast checks for non-empty hash trees */ cycle = -1; - } else + } else if (SCHEME_CHAPERONEP(obj)) + cycle = -1; /* no fast checks for chaperones */ + else cycle = 0; return cycle; @@ -682,16 +716,29 @@ static void setup_graph_table(Scheme_Object *obj, int for_write, Scheme_Hash_Tab if (SCHEME_PAIRP(obj) || SCHEME_MUTABLE_PAIRP(obj)) { setup_graph_table(SCHEME_CAR(obj), for_write, ht, counter, pp); setup_graph_table(SCHEME_CDR(obj), for_write, ht, counter, pp); - } else if ((!pp || pp->print_box) && SCHEME_BOXP(obj)) { - setup_graph_table(SCHEME_BOX_VAL(obj), for_write, ht, counter, pp); - } else if (SCHEME_VECTORP(obj)) { + } else if ((!pp || pp->print_box) && SCHEME_CHAPERONE_BOXP(obj)) { + Scheme_Object *v; + if (SCHEME_BOXP(obj)) + v = SCHEME_BOX_VAL(obj); + else + v = scheme_unbox(obj); + setup_graph_table(v, for_write, ht, counter, pp); + } else if (SCHEME_CHAPERONE_VECTORP(obj)) { int i, len; + Scheme_Object *v; - len = SCHEME_VEC_SIZE(obj); + if (SCHEME_VECTORP(obj)) + len = SCHEME_VEC_SIZE(obj); + else + len = SCHEME_VEC_SIZE(SCHEME_CHAPERONE_VAL(obj)); for (i = 0; i < len; i++) { - setup_graph_table(SCHEME_VEC_ELS(obj)[i], for_write, ht, counter, pp); + if (SCHEME_VECTORP(obj)) + v = SCHEME_VEC_ELS(obj)[i]; + else + v = scheme_chaperone_vector_ref(obj, i); + setup_graph_table(v, for_write, ht, counter, pp); } - } else if (pp && SCHEME_STRUCTP(obj)) { /* got here => printable */ + } else if (pp && SCHEME_CHAPERONE_STRUCTP(obj)) { /* got here => printable */ if (scheme_is_writable_struct(obj)) { if (pp->print_unreadable) { obj = writable_struct_subs(obj, for_write, pp); @@ -702,33 +749,50 @@ static void setup_graph_table(Scheme_Object *obj, int for_write, Scheme_Hash_Tab while (i--) { if (scheme_inspector_sees_part(obj, pp->inspector, i)) - setup_graph_table(((Scheme_Structure *)obj)->slots[i], for_write, ht, counter, pp); + setup_graph_table(scheme_struct_ref(obj, i), for_write, ht, counter, pp); } } - } else if (pp && SCHEME_HASHTPx(obj)) { /* got here => printable */ + } else if (pp && SCHEME_CHAPERONE_HASHTPx(obj)) { /* got here => printable */ Scheme_Hash_Table *t; - Scheme_Object **keys, **vals, *val; + Scheme_Object **keys, **vals, *val, *key; int i; - - t = (Scheme_Hash_Table *)obj; + + if (SCHEME_NP_CHAPERONEP(obj)) + t = (Scheme_Hash_Table *)SCHEME_CHAPERONE_VAL(obj); + else + t = (Scheme_Hash_Table *)obj; + keys = t->keys; vals = t->vals; - for (i = t->size; i--; ) { + for (i = 0; i < t->size; i++) { if (vals[i]) { - val = vals[i]; - setup_graph_table(keys[i], for_write, ht, counter, pp); - setup_graph_table(val, for_write, ht, counter, pp); + key = keys[i]; + if (!SAME_OBJ((Scheme_Object *)t, obj)) + val = scheme_chaperone_hash_traversal_get(obj, key); + else + val = vals[i]; + if (val) { + setup_graph_table(key, for_write, ht, counter, pp); + setup_graph_table(val, for_write, ht, counter, pp); + } } } - } else if (SCHEME_HASHTRP(obj)) { + } else if (SCHEME_CHAPERONE_HASHTRP(obj)) { /* got here => printable */ - Scheme_Hash_Tree *t = (Scheme_Hash_Tree *)obj; + Scheme_Hash_Tree *t; Scheme_Object *key, *val; int i; + + if (SCHEME_NP_CHAPERONEP(obj)) + t = (Scheme_Hash_Tree *)SCHEME_CHAPERONE_VAL(obj); + else + t = (Scheme_Hash_Tree *)obj; i = scheme_hash_tree_next(t, -1); while (i != -1) { scheme_hash_tree_index(t, i, &key, &val); + if (!SAME_OBJ((Scheme_Object *)t, obj)) + val = scheme_chaperone_hash_traversal_get(obj, key); setup_graph_table(key, for_write, ht, counter, pp); setup_graph_table(val, for_write, ht, counter, pp); i = scheme_hash_tree_next(t, i); @@ -1600,6 +1664,12 @@ print(Scheme_Object *obj, int notdisplay, int compact, Scheme_Hash_Table *ht, } } + if (SAME_TYPE(SCHEME_TYPE(obj), scheme_proc_chaperone_type)) { + if (!SCHEME_STRUCTP(SCHEME_CHAPERONE_VAL(obj))) + /* unwrap non-struct procedure to print it: */ + obj = SCHEME_CHAPERONE_VAL(obj); + } + if (SCHEME_SYMBOLP(obj) || SCHEME_KEYWORDP(obj)) { @@ -1815,33 +1885,42 @@ print(Scheme_Object *obj, int notdisplay, int compact, Scheme_Hash_Table *ht, print_pair(obj, notdisplay, compact, ht, mt, pp, scheme_mutable_pair_type, !pp->print_mpair_curly); closed = 1; } - else if (SCHEME_VECTORP(obj)) + else if (SCHEME_CHAPERONE_VECTORP(obj)) { print_vector(obj, notdisplay, compact, ht, mt, pp, 0); closed = 1; } - else if ((compact || pp->print_box) && SCHEME_BOXP(obj)) + else if ((compact || pp->print_box) && SCHEME_CHAPERONE_BOXP(obj)) { if (compact && !pp->print_box) { closed = print(scheme_protect_quote(obj), notdisplay, compact, ht, mt, pp); } else { + Scheme_Object *content; if (compact) print_compact(pp, CPT_BOX); else { always_scheme(pp, 1); print_utf8_string(pp, "#&", 0, 2); } - closed = print(SCHEME_BOX_VAL(obj), notdisplay, compact, ht, mt, pp); + if (SCHEME_BOXP(obj)) + content = SCHEME_BOX_VAL(obj); + else + content = scheme_unbox(obj); + closed = print(content, notdisplay, compact, ht, mt, pp); } } else if ((compact || pp->print_hash_table) - && (SCHEME_HASHTPx(obj) || SCHEME_HASHTRP(obj))) + && (SCHEME_CHAPERONE_HASHTPx(obj) || SCHEME_CHAPERONE_HASHTRP(obj))) { Scheme_Hash_Table *t; Scheme_Hash_Tree *tr; - Scheme_Object **keys, **vals, *val, *key; + Scheme_Object **keys, **vals, *val, *key, *orig; int i, size, did_one = 0; + orig = obj; + if (SCHEME_NP_CHAPERONEP(obj)) + obj = SCHEME_CHAPERONE_VAL(obj); + if (compact) { print_compact(pp, CPT_HASH_TABLE); if ((SCHEME_HASHTP(obj) && scheme_is_hash_table_equal(obj)) @@ -1897,23 +1976,32 @@ print(Scheme_Object *obj, int notdisplay, int compact, Scheme_Hash_Table *ht, if (!vals || vals[i]) { if (!vals) { scheme_hash_tree_index(tr, i, &key, &val); + if (!SAME_OBJ(obj, orig)) + val = scheme_chaperone_hash_traversal_get(orig, key); } else { - val = vals[i]; - key = keys[i]; + if (i < t->size) { + val = vals[i]; + key = keys[i]; + if (!SAME_OBJ(obj, orig)) + val = scheme_chaperone_hash_traversal_get(orig, key); + } else + val = 0; } - if (!compact) { - if (did_one) - print_utf8_string(pp, " ", 0, 1); - print_utf8_string(pp, "(", 0, 1); - } - print(key, notdisplay, compact, ht, mt, pp); - if (!compact) - print_utf8_string(pp, " . ", 0, 3); - print(val, notdisplay, compact, ht, mt, pp); - if (!compact) - print_utf8_string(pp, ")", 0, 1); - did_one++; + if (val) { + if (!compact) { + if (did_one) + print_utf8_string(pp, " ", 0, 1); + print_utf8_string(pp, "(", 0, 1); + } + print(key, notdisplay, compact, ht, mt, pp); + if (!compact) + print_utf8_string(pp, " . ", 0, 3); + print(val, notdisplay, compact, ht, mt, pp); + if (!compact) + print_utf8_string(pp, ")", 0, 1); + did_one++; + } } } @@ -1950,9 +2038,10 @@ print(Scheme_Object *obj, int notdisplay, int compact, Scheme_Hash_Table *ht, { print_compact(pp, CPT_VOID); } - else if (SCHEME_STRUCTP(obj)) + else if (SCHEME_CHAPERONE_STRUCTP(obj)) { - if (compact && SCHEME_PREFABP(obj)) { + if (compact && (SCHEME_PREFABP(obj) || (SCHEME_CHAPERONEP(obj) + && SCHEME_PREFABP(SCHEME_CHAPERONE_VAL(obj))))) { Scheme_Object *vec, *prefab; print_compact(pp, CPT_PREFAB); prefab = ((Scheme_Structure *)obj)->stype->prefab_key; @@ -1980,6 +2069,9 @@ print(Scheme_Object *obj, int notdisplay, int compact, Scheme_Hash_Table *ht, } else { Scheme_Object *src; + if (SCHEME_CHAPERONEP(obj)) + obj = SCHEME_CHAPERONE_VAL(obj); + if (SCHEME_PROC_STRUCTP(obj)) { /* Name by procedure? */ src = scheme_proc_struct_name_source(obj); @@ -3124,15 +3216,21 @@ print_vector(Scheme_Object *vec, int notdisplay, int compact, int as_prefab) { int i, size, common = 0; - Scheme_Object **elems; + Scheme_Object **elems, *elem; - size = SCHEME_VEC_SIZE(vec); + if (SCHEME_VECTORP(vec)) + size = SCHEME_VEC_SIZE(vec); + else + size = SCHEME_VEC_SIZE(SCHEME_CHAPERONE_VAL(vec)); if (compact) { print_compact(pp, CPT_VECTOR); print_compact_number(pp, size); } else { - elems = SCHEME_VEC_ELS(vec); + if (SCHEME_VECTORP(vec)) + elems = SCHEME_VEC_ELS(vec); + else + elems = SCHEME_VEC_ELS(SCHEME_CHAPERONE_VAL(vec)); for (i = size; i--; common++) { if (!i || (elems[i] != elems[i - 1])) break; @@ -3160,7 +3258,11 @@ print_vector(Scheme_Object *vec, int notdisplay, int compact, } for (i = 0; i < size; i++) { - print(SCHEME_VEC_ELS(vec)[i], notdisplay, compact, ht, mt, pp); + if (SCHEME_VECTORP(vec)) + elem = SCHEME_VEC_ELS(vec)[i]; + else + elem = scheme_chaperone_vector_ref(vec, i); + print(elem, notdisplay, compact, ht, mt, pp); if (i < (size - 1)) { if (!compact) { if (pp->honu_mode) diff --git a/src/mzscheme/src/read.c b/src/mzscheme/src/read.c index e7b2fff578..a87dd829e4 100644 --- a/src/mzscheme/src/read.c +++ b/src/mzscheme/src/read.c @@ -2113,10 +2113,14 @@ static Scheme_Object *resolve_references(Scheme_Object *obj, result = obj; scheme_hash_set(dht, obj, result); } - } else if (SCHEME_VECTORP(obj)) { + } else if (SCHEME_VECTORP(obj) + || (clone && SCHEME_CHAPERONE_VECTORP(obj))) { int i, len, diff = 0; Scheme_Object *prev_rr, *prev_v; + if (SCHEME_NP_CHAPERONEP(obj)) + obj = scheme_chaperone_vector_copy(obj); + len = SCHEME_VEC_SIZE(obj); if (clone) { @@ -2146,11 +2150,17 @@ static Scheme_Object *resolve_references(Scheme_Object *obj, scheme_hash_set(dht, obj, result); } } else if (SAME_TYPE(SCHEME_TYPE(obj), scheme_table_placeholder_type) - || SCHEME_HASHTRP(obj)) { + || SCHEME_HASHTRP(obj) + || (clone && SCHEME_NP_CHAPERONEP(obj) + && (SCHEME_HASHTP(SCHEME_CHAPERONE_VAL(obj)) + || SCHEME_HASHTRP(SCHEME_CHAPERONE_VAL(obj))))) { Scheme_Hash_Tree *t, *base; Scheme_Object *a, *key, *val, *lst; int kind; + if (SCHEME_NP_CHAPERONEP(obj)) + obj = scheme_chaperone_hash_table_copy(obj); + if (SCHEME_HASHTRP(obj)) { int i; if (scheme_is_hash_tree_equal(obj)) @@ -2224,22 +2234,27 @@ static Scheme_Object *resolve_references(Scheme_Object *obj, scheme_hash_set(t2, key, val); } } - } else if (SCHEME_STRUCTP(obj)) { - Scheme_Structure *s = (Scheme_Structure *)obj; + } else if (SCHEME_STRUCTP(obj) + || (clone && SCHEME_CHAPERONE_STRUCTP(obj))) { + Scheme_Structure *s; + if (clone && SCHEME_CHAPERONEP(obj)) + s = (Scheme_Structure *)SCHEME_CHAPERONE_VAL(obj); + else + s = (Scheme_Structure *)obj; if (s->stype->prefab_key) { /* prefab */ int c, i, diff; Scheme_Object *prev_v, *v; if (clone) { - result = scheme_clone_prefab_struct_instance(s); + result = scheme_clone_prefab_struct_instance((Scheme_Structure *)obj); } scheme_hash_set(dht, obj, result); c = s->stype->num_slots; diff = 0; for (i = 0; i < c; i++) { - prev_v = s->slots[i]; + prev_v = ((Scheme_Structure *)result)->slots[i]; v = resolve_references(prev_v, port, top, dht, tht, clone, tail_depth + 1); if (!SAME_OBJ(prev_v, v)) diff = 1; diff --git a/src/mzscheme/src/regexp.c b/src/mzscheme/src/regexp.c index 6d9ba9cdbd..56d50cad81 100644 --- a/src/mzscheme/src/regexp.c +++ b/src/mzscheme/src/regexp.c @@ -2287,7 +2287,7 @@ static int check_and_propagate_depends(void) } if (SCHEME_HASHTP(v)) { /* Check/propagate assumption. The fixpoint direction is - determined by assuming "true" whil erecursively checking. */ + determined by assuming "true" while recursively checking. */ scheme_hash_set(regbackknown, backdepends->keys[i], scheme_true); if (!next_ht) next_ht = scheme_make_hash_table(SCHEME_hash_ptr); diff --git a/src/mzscheme/src/schemef.h b/src/mzscheme/src/schemef.h index b0f294bf30..ba1efbead8 100644 --- a/src/mzscheme/src/schemef.h +++ b/src/mzscheme/src/schemef.h @@ -1002,6 +1002,7 @@ MZ_EXTERN void scheme_struct_set(Scheme_Object *s, int pos, Scheme_Object *v); MZ_EXTERN Scheme_Object *scheme_make_struct_type_property(Scheme_Object *name); MZ_EXTERN Scheme_Object *scheme_make_struct_type_property_w_guard(Scheme_Object *name, Scheme_Object *guard); XFORM_NONGCING MZ_EXTERN Scheme_Object *scheme_struct_type_property_ref(Scheme_Object *prop, Scheme_Object *s); +MZ_EXTERN Scheme_Object *scheme_chaperone_struct_type_property_ref(Scheme_Object *prop, Scheme_Object *s); MZ_EXTERN Scheme_Object *scheme_make_location(Scheme_Object *src, Scheme_Object *line, @@ -1020,6 +1021,7 @@ XFORM_NONGCING MZ_EXTERN int scheme_is_subinspector(Scheme_Object *i, Scheme_Obj XFORM_NONGCING MZ_EXTERN int scheme_eq(Scheme_Object *obj1, Scheme_Object *obj2); XFORM_NONGCING MZ_EXTERN int scheme_eqv(Scheme_Object *obj1, Scheme_Object *obj2); MZ_EXTERN int scheme_equal(Scheme_Object *obj1, Scheme_Object *obj2); +MZ_EXTERN int scheme_chaperone_of(Scheme_Object *obj1, Scheme_Object *obj2); #ifdef MZ_PRECISE_GC XFORM_NONGCING MZ_EXTERN long scheme_hash_key(Scheme_Object *o); diff --git a/src/mzscheme/src/schemex.h b/src/mzscheme/src/schemex.h index 9ebd1ddb89..17368b8e5d 100644 --- a/src/mzscheme/src/schemex.h +++ b/src/mzscheme/src/schemex.h @@ -833,6 +833,7 @@ void (*scheme_struct_set)(Scheme_Object *s, int pos, Scheme_Object *v); Scheme_Object *(*scheme_make_struct_type_property)(Scheme_Object *name); Scheme_Object *(*scheme_make_struct_type_property_w_guard)(Scheme_Object *name, Scheme_Object *guard); Scheme_Object *(*scheme_struct_type_property_ref)(Scheme_Object *prop, Scheme_Object *s); +Scheme_Object *(*scheme_chaperone_struct_type_property_ref)(Scheme_Object *prop, Scheme_Object *s); Scheme_Object *(*scheme_make_location)(Scheme_Object *src, Scheme_Object *line, Scheme_Object *col, @@ -847,6 +848,7 @@ int (*scheme_is_subinspector)(Scheme_Object *i, Scheme_Object *sup); int (*scheme_eq)(Scheme_Object *obj1, Scheme_Object *obj2); int (*scheme_eqv)(Scheme_Object *obj1, Scheme_Object *obj2); int (*scheme_equal)(Scheme_Object *obj1, Scheme_Object *obj2); +int (*scheme_chaperone_of)(Scheme_Object *obj1, Scheme_Object *obj2); #ifdef MZ_PRECISE_GC long (*scheme_hash_key)(Scheme_Object *o); #endif diff --git a/src/mzscheme/src/schemex.inc b/src/mzscheme/src/schemex.inc index c73cfe1659..be68d0aecf 100644 --- a/src/mzscheme/src/schemex.inc +++ b/src/mzscheme/src/schemex.inc @@ -581,6 +581,7 @@ scheme_extension_table->scheme_make_struct_type_property = scheme_make_struct_type_property; scheme_extension_table->scheme_make_struct_type_property_w_guard = scheme_make_struct_type_property_w_guard; scheme_extension_table->scheme_struct_type_property_ref = scheme_struct_type_property_ref; + scheme_extension_table->scheme_chaperone_struct_type_property_ref = scheme_chaperone_struct_type_property_ref; scheme_extension_table->scheme_make_location = scheme_make_location; scheme_extension_table->scheme_is_location = scheme_is_location; scheme_extension_table->scheme_make_inspector = scheme_make_inspector; @@ -588,6 +589,7 @@ scheme_extension_table->scheme_eq = scheme_eq; scheme_extension_table->scheme_eqv = scheme_eqv; scheme_extension_table->scheme_equal = scheme_equal; + scheme_extension_table->scheme_chaperone_of = scheme_chaperone_of; #ifdef MZ_PRECISE_GC scheme_extension_table->scheme_hash_key = scheme_hash_key; #endif diff --git a/src/mzscheme/src/schemexm.h b/src/mzscheme/src/schemexm.h index 904040728c..d3ee7e64da 100644 --- a/src/mzscheme/src/schemexm.h +++ b/src/mzscheme/src/schemexm.h @@ -581,6 +581,7 @@ #define scheme_make_struct_type_property (scheme_extension_table->scheme_make_struct_type_property) #define scheme_make_struct_type_property_w_guard (scheme_extension_table->scheme_make_struct_type_property_w_guard) #define scheme_struct_type_property_ref (scheme_extension_table->scheme_struct_type_property_ref) +#define scheme_chaperone_struct_type_property_ref (scheme_extension_table->scheme_chaperone_struct_type_property_ref) #define scheme_make_location (scheme_extension_table->scheme_make_location) #define scheme_is_location (scheme_extension_table->scheme_is_location) #define scheme_make_inspector (scheme_extension_table->scheme_make_inspector) @@ -588,6 +589,7 @@ #define scheme_eq (scheme_extension_table->scheme_eq) #define scheme_eqv (scheme_extension_table->scheme_eqv) #define scheme_equal (scheme_extension_table->scheme_equal) +#define scheme_chaperone_of (scheme_extension_table->scheme_chaperone_of) #ifdef MZ_PRECISE_GC #define scheme_hash_key (scheme_extension_table->scheme_hash_key) #endif diff --git a/src/mzscheme/src/schminc.h b/src/mzscheme/src/schminc.h index 0a0cc41190..f555ffa119 100644 --- a/src/mzscheme/src/schminc.h +++ b/src/mzscheme/src/schminc.h @@ -13,8 +13,8 @@ #define USE_COMPILED_STARTUP 1 -#define EXPECTED_PRIM_COUNT 966 -#define EXPECTED_UNSAFE_COUNT 58 +#define EXPECTED_PRIM_COUNT 978 +#define EXPECTED_UNSAFE_COUNT 65 #define EXPECTED_FLFXNUM_COUNT 53 #ifdef MZSCHEME_SOMETHING_OMITTED diff --git a/src/mzscheme/src/schpriv.h b/src/mzscheme/src/schpriv.h index 58a7598f5d..c02c46f042 100644 --- a/src/mzscheme/src/schpriv.h +++ b/src/mzscheme/src/schpriv.h @@ -329,6 +329,8 @@ extern Scheme_Object *scheme_list_proc; extern Scheme_Object *scheme_list_star_proc; extern Scheme_Object *scheme_vector_proc; extern Scheme_Object *scheme_vector_immutable_proc; +extern Scheme_Object *scheme_vector_ref_proc; +extern Scheme_Object *scheme_vector_set_proc; extern Scheme_Object *scheme_box_proc; extern Scheme_Object *scheme_call_with_values_proc; extern Scheme_Object *scheme_make_struct_type_proc; @@ -733,6 +735,47 @@ Scheme_Object *scheme_extract_checked_procedure(int argc, Scheme_Object **argv); Scheme_Object *scheme_rename_struct_proc(Scheme_Object *p, Scheme_Object *sym); +typedef struct Scheme_Chaperone { + Scheme_Object so; + Scheme_Object *val; /* root object */ + Scheme_Object *prev; /* immediately chaperoned object */ + Scheme_Hash_Tree *props; + Scheme_Object *redirects; /* specific to the type of chaperone and root object */ +} Scheme_Chaperone; + +#define SCHEME_CHAPERONE_VAL(obj) (((Scheme_Chaperone *)obj)->val) + +#define SCHEME_P_CHAPERONEP(obj) (SAME_TYPE(SCHEME_TYPE(obj), scheme_proc_chaperone_type)) +#define SCHEME_NP_CHAPERONEP(obj) (SAME_TYPE(SCHEME_TYPE(obj), scheme_chaperone_type)) + +#define SCHEME_CHAPERONE_VECTORP(obj) (SCHEME_VECTORP(obj) \ + || (SCHEME_NP_CHAPERONEP(obj) && SCHEME_VECTORP(SCHEME_CHAPERONE_VAL(obj)))) +#define SCHEME_CHAPERONE_BOXP(obj) (SCHEME_BOXP(obj) \ + || (SCHEME_NP_CHAPERONEP(obj) && SCHEME_BOXP(SCHEME_CHAPERONE_VAL(obj)))) +#define SCHEME_CHAPERONE_STRUCTP(obj) (SCHEME_STRUCTP(obj) \ + || (SCHEME_CHAPERONEP(obj) && SCHEME_STRUCTP(SCHEME_CHAPERONE_VAL(obj)))) +#define SCHEME_CHAPERONE_PROC_STRUCTP(obj) (SCHEME_PROC_STRUCTP(obj) \ + || (SCHEME_P_CHAPERONEP(obj) && SCHEME_PROC_STRUCTP(SCHEME_CHAPERONE_VAL(obj)))) +#define SCHEME_CHAPERONE_STRUCT_TYPEP(obj) (SCHEME_STRUCT_TYPEP(obj) \ + || (SCHEME_NP_CHAPERONEP(obj) && SCHEME_STRUCT_TYPEP(SCHEME_CHAPERONE_VAL(obj)))) +#define SCHEME_CHAPERONE_HASHTP(obj) (SCHEME_HASHTP(obj) \ + || (SCHEME_NP_CHAPERONEP(obj) && SCHEME_HASHTP(SCHEME_CHAPERONE_VAL(obj)))) +#define SCHEME_CHAPERONE_HASHTRP(obj) (SCHEME_HASHTRP(obj) \ + || (SCHEME_NP_CHAPERONEP(obj) && SCHEME_HASHTRP(SCHEME_CHAPERONE_VAL(obj)))) +#define SCHEME_CHAPERONE_BUCKTP(obj) (SCHEME_BUCKTP(obj) \ + || (SCHEME_NP_CHAPERONEP(obj) && SCHEME_BUCKTP(SCHEME_CHAPERONE_VAL(obj)))) + +Scheme_Object *scheme_chaperone_vector_ref(Scheme_Object *o, int i); +void scheme_chaperone_vector_set(Scheme_Object *o, int i, Scheme_Object *v); + +Scheme_Object *scheme_apply_chaperone(Scheme_Object *o, int argc, Scheme_Object **argv); + +Scheme_Hash_Tree *scheme_parse_chaperone_props(const char *who, int start_at, int argc, Scheme_Object **argv); + +Scheme_Object *scheme_chaperone_hash_get(Scheme_Object *table, Scheme_Object *key); +Scheme_Object *scheme_chaperone_hash_traversal_get(Scheme_Object *table, Scheme_Object *key); +void scheme_chaperone_hash_set(Scheme_Object *table, Scheme_Object *key, Scheme_Object *val); + /*========================================================================*/ /* syntax objects */ /*========================================================================*/ @@ -3313,6 +3356,9 @@ Scheme_Object *scheme_checked_flvector_ref(int argc, Scheme_Object **argv); Scheme_Object *scheme_checked_flvector_set(int argc, Scheme_Object **argv); Scheme_Object *scheme_flvector_length(Scheme_Object *v); +Scheme_Object *scheme_chaperone_vector_copy(Scheme_Object *obj); +Scheme_Object *scheme_chaperone_hash_table_copy(Scheme_Object *obj); + void scheme_bad_vec_index(char *name, Scheme_Object *i, const char *what, Scheme_Object *vec, long bottom, long len); diff --git a/src/mzscheme/src/schvers.h b/src/mzscheme/src/schvers.h index ef941a6b62..78095ec7fd 100644 --- a/src/mzscheme/src/schvers.h +++ b/src/mzscheme/src/schvers.h @@ -13,12 +13,12 @@ consistently.) */ -#define MZSCHEME_VERSION "4.2.5.1" +#define MZSCHEME_VERSION "4.2.5.3" #define MZSCHEME_VERSION_X 4 #define MZSCHEME_VERSION_Y 2 #define MZSCHEME_VERSION_Z 5 -#define MZSCHEME_VERSION_W 1 +#define MZSCHEME_VERSION_W 3 #define MZSCHEME_VERSION_MAJOR ((MZSCHEME_VERSION_X * 100) + MZSCHEME_VERSION_Y) #define MZSCHEME_VERSION_MINOR ((MZSCHEME_VERSION_Z * 1000) + MZSCHEME_VERSION_W) diff --git a/src/mzscheme/src/string.c b/src/mzscheme/src/string.c index 6f314d8bba..d6740e87d3 100644 --- a/src/mzscheme/src/string.c +++ b/src/mzscheme/src/string.c @@ -938,7 +938,7 @@ void scheme_out_of_string_range(const char *name, const char *which, scheme_make_provided_string(i, 2, NULL), start, len, is_byte ? "byte-" : "", - SCHEME_VECTORP(s) ? "vector" : "string", + SCHEME_CHAPERONE_VECTORP(s) ? "vector" : "string", sstr, slen); } else { scheme_raise_exn(MZEXN_FAIL_CONTRACT, @@ -946,7 +946,7 @@ void scheme_out_of_string_range(const char *name, const char *which, name, which, scheme_make_provided_string(i, 0, NULL), is_byte ? "byte-" : "", - SCHEME_VECTORP(s) ? "vector" : "string"); + SCHEME_CHAPERONE_VECTORP(s) ? "vector" : "string"); } } @@ -981,7 +981,7 @@ void scheme_get_substring_indices(const char *name, Scheme_Object *str, long len; long start, finish; - if (SCHEME_VECTORP(str)) + if (SCHEME_CHAPERONE_VECTORP(str)) len = SCHEME_VEC_SIZE(str); else if (SCHEME_CHAR_STRINGP(str)) len = SCHEME_CHAR_STRTAG_VAL(str); @@ -2347,7 +2347,7 @@ int scheme_strncmp(const char *a, const char *b, int len) static Scheme_Object *ok_cmdline(int argc, Scheme_Object **argv) { - if (SCHEME_VECTORP(argv[0])) { + if (SCHEME_CHAPERONE_VECTORP(argv[0])) { Scheme_Object *vec = argv[0], *vec2, *str; int i, size = SCHEME_VEC_SIZE(vec); diff --git a/src/mzscheme/src/struct.c b/src/mzscheme/src/struct.c index b7ba340b74..5e50001ce7 100644 --- a/src/mzscheme/src/struct.c +++ b/src/mzscheme/src/struct.c @@ -46,12 +46,12 @@ READ_ONLY static Scheme_Object *rename_transformer_property; READ_ONLY static Scheme_Object *set_transformer_property; READ_ONLY static Scheme_Object *not_free_id_symbol; READ_ONLY static Scheme_Object *scheme_checked_proc_property; +READ_ONLY static Scheme_Object *struct_info_proc; ROSYM static Scheme_Object *ellipses_symbol; ROSYM static Scheme_Object *prefab_symbol; /* locals */ - typedef enum { SCHEME_CONSTR = 1, SCHEME_PRED, @@ -80,8 +80,10 @@ static Scheme_Object *current_code_inspector(int argc, Scheme_Object *argv[]); static Scheme_Object *make_struct_type_property(int argc, Scheme_Object *argv[]); static Scheme_Object *make_struct_type_property_from_c(int argc, Scheme_Object *argv[], - Scheme_Object **predout, Scheme_Object **accessout ); + Scheme_Object **predout, Scheme_Object **accessout, + Scheme_Type type); static Scheme_Object *struct_type_property_p(int argc, Scheme_Object *argv[]); +static Scheme_Object *chaperone_property_p(int argc, Scheme_Object *argv[]); static Scheme_Object *check_evt_property_value_ok(int argc, Scheme_Object *argv[]); static Scheme_Object *check_equal_property_value_ok(int argc, Scheme_Object *argv[]); static Scheme_Object *check_write_property_value_ok(int argc, Scheme_Object *argv[]); @@ -117,6 +119,8 @@ static Scheme_Object *struct_setter_p(int argc, Scheme_Object *argv[]); static Scheme_Object *struct_getter_p(int argc, Scheme_Object *argv[]); static Scheme_Object *struct_pred_p(int argc, Scheme_Object *argv[]); static Scheme_Object *struct_constr_p(int argc, Scheme_Object *argv[]); +static Scheme_Object *struct_prop_getter_p(int argc, Scheme_Object *argv[]); +static Scheme_Object *chaperone_prop_getter_p(int argc, Scheme_Object *argv[]); static Scheme_Object *make_struct_proc(Scheme_Struct_Type *struct_type, char *func_name, Scheme_ProcT proc_type, int field_num); @@ -149,6 +153,12 @@ static Scheme_Object *exn_source_get(int argc, Scheme_Object **argv); static Scheme_Object *procedure_extract_target(int argc, Scheme_Object **argv); +static Scheme_Object *chaperone_struct(int argc, Scheme_Object **argv); +static Scheme_Object *chaperone_struct_type(int argc, Scheme_Object **argv); +static Scheme_Object *make_chaperone_property(int argc, Scheme_Object *argv[]); + +#define PRE_REDIRECTS 2 + #ifdef MZ_PRECISE_GC static void register_traversers(void); #endif @@ -266,7 +276,8 @@ scheme_init_struct (Scheme_Env *env) a[0] = scheme_intern_symbol("custom-write"); a[1] = guard; - write_property = make_struct_type_property_from_c(2, a, &pred, &access); + write_property = make_struct_type_property_from_c(2, a, &pred, &access, + scheme_struct_property_type); scheme_add_global_constant("prop:custom-write", write_property, env); scheme_add_global_constant("custom-write?", pred, env); scheme_add_global_constant("custom-write-accessor", access, env); @@ -472,12 +483,12 @@ scheme_init_struct (Scheme_Env *env) /*** Debugging ****/ - scheme_add_global_constant("struct-info", - scheme_make_prim_w_arity2(struct_info, - "struct-info", - 1, 1, - 2, 2), - env); + REGISTER_SO(struct_info_proc); + struct_info_proc = scheme_make_prim_w_arity2(struct_info, + "struct-info", + 1, 1, + 2, 2); + scheme_add_global_constant("struct-info", struct_info_proc, env); scheme_add_global_constant("struct-type-info", scheme_make_prim_w_arity2(struct_type_info, "struct-type-info", @@ -537,6 +548,16 @@ scheme_init_struct (Scheme_Env *env) "struct-constructor-procedure?", 1, 1), env); + scheme_add_global_constant("struct-type-property-accessor-procedure?", + scheme_make_prim_w_arity(struct_prop_getter_p, + "struct-type-property-accessor-procedure?", + 1, 1), + env); + scheme_add_global_constant("chaperone-property-accessor-procedure?", + scheme_make_prim_w_arity(chaperone_prop_getter_p, + "chaperone-property-accessor-procedure?", + 1, 1), + env); /*** Inspectors ****/ @@ -620,6 +641,28 @@ scheme_init_struct (Scheme_Env *env) SCHEME_PRIM_PROC_FLAGS(p) |= SCHEME_PRIM_IS_NARY_INLINED; scheme_add_global_constant("checked-procedure-check-and-extract", p, env); } + + scheme_add_global_constant("chaperone-struct", + scheme_make_prim_w_arity(chaperone_struct, + "chaperone-struct", + 1, -1), + env); + scheme_add_global_constant("chaperone-struct-type", + scheme_make_prim_w_arity(chaperone_struct_type, + "chaperone-struct-type", + 1, -1), + env); + scheme_add_global_constant("make-chaperone-property", + scheme_make_prim_w_arity2(make_chaperone_property, + "make-chaperone-property", + 1, 1, + 3, 3), + env); + scheme_add_global_constant("chaperone-property?", + scheme_make_folding_prim(chaperone_property_p, + "chaperone-property?", + 1, 1, 1), + env); } /*========================================================================*/ @@ -733,12 +776,26 @@ static Scheme_Object *current_code_inspector(int argc, Scheme_Object *argv[]) static Scheme_Object *prop_pred(int argc, Scheme_Object **args, Scheme_Object *prim) { Scheme_Struct_Type *stype; - Scheme_Object *prop = SCHEME_PRIM_CLOSURE_ELS(prim)[0]; + Scheme_Object *prop = SCHEME_PRIM_CLOSURE_ELS(prim)[0], *v; + Scheme_Chaperone *px; - if (SCHEME_STRUCTP(args[0])) - stype = ((Scheme_Structure *)args[0])->stype; - else if (SAME_TYPE(SCHEME_TYPE(args[0]), scheme_struct_type_type)) - stype = (Scheme_Struct_Type *)args[0]; + v = args[0]; + if (SCHEME_CHAPERONEP(v)) { + /* Check for property at chaperone level: */ + px = (Scheme_Chaperone *)v; + if (px->props) + v = scheme_hash_tree_get(px->props, prop); + else + v = NULL; + if (v) + return scheme_true; + v = px->val; + } + + if (SCHEME_STRUCTP(v)) + stype = ((Scheme_Structure *)v)->stype; + else if (SAME_TYPE(SCHEME_TYPE(v), scheme_struct_type_type)) + stype = (Scheme_Struct_Type *)v; else return scheme_false; @@ -785,11 +842,101 @@ XFORM_NONGCING static Scheme_Object *do_prop_accessor(Scheme_Object *prop, Schem return NULL; } +static Scheme_Object *do_chaperone_prop_accessor(const char *who, Scheme_Object *prop, Scheme_Object *arg); + +static Scheme_Object *chaperone_prop_acc_k(void) +{ + Scheme_Thread *p = scheme_current_thread; + Scheme_Object *o = (Scheme_Object *)p->ku.k.p1; + Scheme_Object *arg = (Scheme_Object *)p->ku.k.p2; + const char *who = (const char *)p->ku.k.p3; + + p->ku.k.p1 = NULL; + p->ku.k.p2 = NULL; + p->ku.k.p3 = NULL; + + return do_chaperone_prop_accessor(who, o, arg); +} + +static Scheme_Object *chaperone_prop_acc_overflow(const char *who, Scheme_Object *o, Scheme_Object *arg) +{ + Scheme_Thread *p = scheme_current_thread; + + p->ku.k.p1 = (void *)o; + p->ku.k.p2 = (void *)arg; + p->ku.k.p3 = (void *)who; + + return scheme_handle_stack_overflow(chaperone_prop_acc_k); +} + +static Scheme_Object *do_chaperone_prop_accessor(const char *who, Scheme_Object *prop, Scheme_Object *arg) +{ + while (1) { + if (SCHEME_CHAPERONEP(arg)) { + Scheme_Chaperone *px = (Scheme_Chaperone *)arg; + Scheme_Object *a[2], *red, *orig; + Scheme_Object *v; + Scheme_Hash_Tree *ht; + + if (px->props) { + v = scheme_hash_tree_get(px->props, prop); + if (v) + return v; + } + + if (!SCHEME_VECTORP(px->redirects) + || !(SCHEME_VEC_ELS(px->redirects)[0])) + arg = px->prev; + else { + ht = (Scheme_Hash_Tree *)SCHEME_VEC_ELS(px->redirects)[0]; + if (ht) + red = scheme_hash_tree_get(ht, prop); + else + red = NULL; + if (!red) + arg = px->prev; + else { +#ifdef DO_STACK_CHECK + { +# include "mzstkchk.h" + return chaperone_prop_acc_overflow(who, prop, arg); + } +#endif + + arg = px->prev; + orig = do_chaperone_prop_accessor(who, prop, arg); + + if (!orig) return NULL; + + a[0] = arg; + a[1] = orig; + v = _scheme_apply(red, 2, a); + + if (!scheme_chaperone_of(v, orig)) + scheme_raise_exn(MZEXN_FAIL_CONTRACT, + "%s: chaperone produced a result: %V that is not a chaperone of the original result: %V", + who, + v , + orig); + + return v; + } + } + } else { + return do_prop_accessor(prop, arg); + } + } +} + static Scheme_Object *prop_accessor(int argc, Scheme_Object **args, Scheme_Object *prim) { Scheme_Object *v; - v = do_prop_accessor(SCHEME_PRIM_CLOSURE_ELS(prim)[0], args[0]); + v = args[0]; + if (SCHEME_CHAPERONEP(v)) + v = do_chaperone_prop_accessor(((Scheme_Primitive_Proc *)prim)->name, SCHEME_PRIM_CLOSURE_ELS(prim)[0], v); + else + v = do_prop_accessor(SCHEME_PRIM_CLOSURE_ELS(prim)[0], v); if (!v) scheme_wrong_type(((Scheme_Primitive_Proc *)prim)->name, @@ -800,19 +947,27 @@ static Scheme_Object *prop_accessor(int argc, Scheme_Object **args, Scheme_Objec } static Scheme_Object *make_struct_type_property_from_c(int argc, Scheme_Object *argv[], - Scheme_Object **predout, Scheme_Object **accessout ) { + Scheme_Object **predout, Scheme_Object **accessout, + Scheme_Type type) +{ Scheme_Struct_Property *p; Scheme_Object *a[1], *v, *supers = scheme_null; char *name; int len; + const char *who; + + if (type == scheme_struct_property_type) + who = "make-struct-type-property"; + else + who = "make-chaperone-property"; if (!SCHEME_SYMBOLP(argv[0])) - scheme_wrong_type("make-struct-type-property", "symbol", 0, argc, argv); + scheme_wrong_type(who, "symbol", 0, argc, argv); if (argc > 1) { if (SCHEME_TRUEP(argv[1]) && !scheme_check_proc_arity(NULL, 2, 1, argc, argv)) - scheme_wrong_type("make-struct-type-property", "procedure (arity 2) or #f", 1, argc, argv); + scheme_wrong_type(who, "procedure (arity 2) or #f", 1, argc, argv); if (argc > 2) { supers = argv[2]; @@ -835,7 +990,7 @@ static Scheme_Object *make_struct_type_property_from_c(int argc, Scheme_Object * } if (!supers) { - scheme_wrong_type("make-struct-type-property", + scheme_wrong_type(who, "list of pairs of structure type properties and procedures (arity 1)", 2, argc, argv); } @@ -843,7 +998,7 @@ static Scheme_Object *make_struct_type_property_from_c(int argc, Scheme_Object * } p = MALLOC_ONE_TAGGED(Scheme_Struct_Property); - p->so.type = scheme_struct_property_type; + p->so.type = type; p->name = argv[0]; if ((argc > 1) && SCHEME_TRUEP(argv[1])) p->guard = argv[1]; @@ -865,6 +1020,8 @@ static Scheme_Object *make_struct_type_property_from_c(int argc, Scheme_Object * memcpy(name + len, "-accessor", 10); v = scheme_make_folding_prim_closure(prop_accessor, 1, a, name, 1, 1, 0); + ((Scheme_Closed_Primitive_Proc *)v)->pp.flags |= SCHEME_PRIM_TYPE_STRUCT_PROP_GETTER; + *accessout = v; return a[0]; @@ -873,7 +1030,14 @@ static Scheme_Object *make_struct_type_property_from_c(int argc, Scheme_Object * static Scheme_Object *make_struct_type_property(int argc, Scheme_Object *argv[]) { Scheme_Object *a[3]; - a[0] = make_struct_type_property_from_c(argc, argv, &a[1], &a[2]); + a[0] = make_struct_type_property_from_c(argc, argv, &a[1], &a[2], scheme_struct_property_type); + return scheme_values(3, a); +} + +static Scheme_Object *make_chaperone_property(int argc, Scheme_Object *argv[]) +{ + Scheme_Object *a[3]; + a[0] = make_struct_type_property_from_c(argc, argv, &a[1], &a[2], scheme_chaperone_property_type); return scheme_values(3, a); } @@ -885,7 +1049,7 @@ Scheme_Object *scheme_make_struct_type_property_w_guard(Scheme_Object *name, Sch a[0] = name; a[1] = guard; - return make_struct_type_property_from_c(2, a, &pred, &access); + return make_struct_type_property_from_c(2, a, &pred, &access, scheme_struct_property_type); } Scheme_Object *scheme_make_struct_type_property(Scheme_Object *name) @@ -893,8 +1057,18 @@ Scheme_Object *scheme_make_struct_type_property(Scheme_Object *name) return scheme_make_struct_type_property_w_guard(name, scheme_false); } +Scheme_Object *scheme_chaperone_struct_type_property_ref(Scheme_Object *prop, Scheme_Object *s) +{ + if (SCHEME_CHAPERONEP(s)) + return do_chaperone_prop_accessor("struct-property-ref", prop, s); + else + return do_prop_accessor(prop, s); +} + Scheme_Object *scheme_struct_type_property_ref(Scheme_Object *prop, Scheme_Object *s) { + if (SCHEME_CHAPERONEP(s)) + s = SCHEME_CHAPERONE_VAL(s); return do_prop_accessor(prop, s); } @@ -904,6 +1078,12 @@ static Scheme_Object *struct_type_property_p(int argc, Scheme_Object *argv[]) ? scheme_true : scheme_false); } +static Scheme_Object *chaperone_property_p(int argc, Scheme_Object *argv[]) +{ + return (SAME_TYPE(SCHEME_TYPE(argv[0]), scheme_chaperone_property_type) + ? scheme_true : scheme_false); +} + static Scheme_Object *guard_property(Scheme_Object *prop, Scheme_Object *v, Scheme_Struct_Type *t) { Scheme_Struct_Property *p = (Scheme_Struct_Property *)prop; @@ -1291,7 +1471,7 @@ int scheme_is_rename_transformer(Scheme_Object *o) { if (SAME_TYPE(SCHEME_TYPE(o), scheme_id_macro_type)) return 1; - if (SCHEME_STRUCTP(o) + if (SCHEME_CHAPERONE_STRUCTP(o) && scheme_struct_type_property_ref(rename_transformer_property, o)) return 1; return 0; @@ -1315,7 +1495,7 @@ Scheme_Object *scheme_rename_transformer_id(Scheme_Object *o) { if (SAME_TYPE(SCHEME_TYPE(o), scheme_id_macro_type)) return SCHEME_PTR1_VAL(o); - if (SCHEME_STRUCTP(o)) { + if (SCHEME_CHAPERONE_STRUCTP(o)) { Scheme_Object *v; v = scheme_struct_type_property_ref(rename_transformer_property, o); if (SCHEME_BOXP(v)) v = SCHEME_BOX_VAL(v); @@ -1342,7 +1522,7 @@ int scheme_is_set_transformer(Scheme_Object *o) { if (SAME_TYPE(SCHEME_TYPE(o), scheme_set_macro_type)) return 1; - if (SCHEME_STRUCTP(o) + if (SCHEME_CHAPERONE_STRUCTP(o) && scheme_struct_type_property_ref(set_transformer_property, o)) return 1; return 0; @@ -1360,7 +1540,7 @@ Scheme_Object *scheme_set_transformer_proc(Scheme_Object *o) { if (SAME_TYPE(SCHEME_TYPE(o), scheme_set_macro_type)) return SCHEME_PTR_VAL(o); - if (SCHEME_STRUCTP(o)) { + if (SCHEME_CHAPERONE_STRUCTP(o)) { Scheme_Object *v; v = scheme_struct_type_property_ref(set_transformer_property, o); if (SCHEME_INTP(v)) { @@ -1424,18 +1604,18 @@ Scheme_Object *scheme_extract_checked_procedure(int argc, Scheme_Object **argv) v = argv[1]; - if (SAME_TYPE(SCHEME_TYPE(argv[0]), scheme_struct_type_type)) + if (SCHEME_STRUCT_TYPEP(argv[0])) stype = (Scheme_Struct_Type *)argv[0]; else stype = NULL; if (!stype || !(MZ_OPT_HASH_KEY(&stype->iso) & STRUCT_TYPE_CHECKED_PROC)) { - scheme_wrong_type("checked-procedure-check-and-extract", "structure type with prop:checked-procedure property", + scheme_wrong_type("checked-procedure-check-and-extract", "unchaperoned structure type with prop:checked-procedure property", 0, argc, argv); return NULL; } - if (SCHEME_STRUCTP(v) && scheme_is_struct_instance((Scheme_Object *)stype, v)) { + if (SCHEME_CHAPERONE_STRUCTP(v) && scheme_is_struct_instance((Scheme_Object *)stype, v)) { checker = ((Scheme_Structure *)v)->slots[0]; proc = ((Scheme_Structure *)v)->slots[1]; @@ -1493,28 +1673,196 @@ int scheme_is_struct_instance(Scheme_Object *type, Scheme_Object *v) return STRUCT_TYPEP(stype, s); } +static Scheme_Object *chaperone_struct_ref(const char *who, Scheme_Object *o, int i); + +static Scheme_Object *chaperone_struct_ref_k(void) +{ + Scheme_Thread *p = scheme_current_thread; + Scheme_Object *o = (Scheme_Object *)p->ku.k.p1; + const char *who = (const char *)p->ku.k.p2; + + p->ku.k.p1 = NULL; + p->ku.k.p2 = NULL; + + return chaperone_struct_ref(who, o, p->ku.k.i1); +} + +static Scheme_Object *chaperone_struct_ref_overflow(const char *who, Scheme_Object *o, int i) +{ + Scheme_Thread *p = scheme_current_thread; + + p->ku.k.p1 = (void *)o; + p->ku.k.p2 = (void *)who; + p->ku.k.i1 = i; + + return scheme_handle_stack_overflow(chaperone_struct_ref_k); +} + +static Scheme_Object *chaperone_struct_ref(const char *who, Scheme_Object *o, int i) +{ + while (1) { + if (!SCHEME_CHAPERONEP(o)) { + return ((Scheme_Structure *)o)->slots[i]; + } else { + Scheme_Chaperone *px = (Scheme_Chaperone *)o; + Scheme_Object *a[2], *red, *orig; + + if (!SCHEME_VECTORP(px->redirects) + || !(SCHEME_VEC_ELS(px->redirects)[PRE_REDIRECTS + i])) { + o = px->prev; + } else { +#ifdef DO_STACK_CHECK + { +# include "mzstkchk.h" + return chaperone_struct_ref_overflow(who, o, i); + } +#endif + + orig = chaperone_struct_ref(who, px->prev, i); + + a[0] = px->prev; + a[1] = orig; + red = SCHEME_VEC_ELS(px->redirects)[PRE_REDIRECTS + i]; + o = _scheme_apply(red, 2, a); + + if (!scheme_chaperone_of(o, orig)) + scheme_raise_exn(MZEXN_FAIL_CONTRACT, + "%s: chaperone produced a result: %V that is not a chaperone of the original result: %V", + who, + o, + orig); + + return o; + } + } + } +} + Scheme_Object *scheme_struct_ref(Scheme_Object *sv, int pos) { - Scheme_Structure *s = (Scheme_Structure *)sv; - - return s->slots[pos]; + if (SCHEME_CHAPERONEP(sv)) { + return chaperone_struct_ref("struct-ref", sv, pos); + } else { + Scheme_Structure *s = (Scheme_Structure *)sv; + + return s->slots[pos]; + } +} + +static void chaperone_struct_set(const char *who, Scheme_Object *o, int i, Scheme_Object *v) +{ + while (1) { + if (!SCHEME_CHAPERONEP(o)) { + SCHEME_VEC_ELS(o)[i] = v; + return; + } else { + Scheme_Chaperone *px = (Scheme_Chaperone *)o; + Scheme_Object *a[2], *red; + int half; + + o = px->prev; + if (SCHEME_VECTORP(px->redirects)) { + half = (SCHEME_VEC_SIZE(px->redirects) - PRE_REDIRECTS) >> 1; + red = SCHEME_VEC_ELS(px->redirects)[PRE_REDIRECTS + half + i]; + if (red) { + a[0] = o; + a[1] = v; + v = _scheme_apply(red, 2, a); + + if (!scheme_chaperone_of(v, a[1])) + scheme_raise_exn(MZEXN_FAIL_CONTRACT, + "%s: chaperone produced a result: %V that is not a chaperone of the original result: %V", + who, + v, + a[1]); + } + } + } + } } void scheme_struct_set(Scheme_Object *sv, int pos, Scheme_Object *v) { - Scheme_Structure *s = (Scheme_Structure *)sv; - - s->slots[pos] = v; + if (SCHEME_CHAPERONEP(sv)) { + chaperone_struct_set("struct-set", sv, pos, v); + } else { + Scheme_Structure *s = (Scheme_Structure *)sv; + + s->slots[pos] = v; + } } +static Scheme_Object **apply_guards(Scheme_Struct_Type *stype, int argc, Scheme_Object **args) +{ + Scheme_Object **guard_argv = NULL, *v, *prev_guards = NULL, *guard; + int p, gcount; + + for (p = stype->name_pos; p >= 0; p--) { + if (stype->parent_types[p]->guard || prev_guards) { + int got; + + if (!guard_argv) { + guard_argv = MALLOC_N(Scheme_Object *, argc + 1); + memcpy(guard_argv, args, sizeof(Scheme_Object *) * argc); + args = guard_argv; + } + + if (!prev_guards) + prev_guards = scheme_null; + while (prev_guards) { + if (SCHEME_PAIRP(prev_guards)) + guard = SCHEME_CAR(prev_guards); + else { + guard = stype->parent_types[p]->guard; + /* In case there are chaperone-added guards: */ + if (guard) { + if (SCHEME_PAIRP(guard)) guard = SCHEME_CAR(guard); + } else + guard = scheme_false; + } + + if (!SCHEME_FALSEP(guard)) { + gcount = stype->parent_types[p]->num_islots; + guard_argv[argc] = guard_argv[gcount]; + guard_argv[gcount] = stype->name; + v = _scheme_apply_multi(guard, gcount + 1, guard_argv); + got = (SAME_OBJ(v, SCHEME_MULTIPLE_VALUES) ? scheme_multiple_count : 1); + if (gcount != got) { + scheme_wrong_return_arity("constructor", + gcount, got, + (got == 1) ? (Scheme_Object **)v : scheme_multiple_array, + "calling guard procedure"); + return NULL; + } + if (SAME_OBJ(v, SCHEME_MULTIPLE_VALUES)) + memcpy(guard_argv, scheme_multiple_array, gcount * sizeof(Scheme_Object *)); + else + guard_argv[0] = v; + guard_argv[gcount] = guard_argv[argc]; + } + + if (SCHEME_NULLP(prev_guards)) + prev_guards = NULL; + else + prev_guards = SCHEME_CDR(prev_guards); + } + } + + /* Any chaperone-imposed guards for the next layer down? */ + if (stype->parent_types[p]->guard + && SCHEME_PAIRP(stype->parent_types[p]->guard)) + prev_guards = SCHEME_CDR(stype->parent_types[p]->guard); + } + + return args; +} Scheme_Object * scheme_make_struct_instance(Scheme_Object *_stype, int argc, Scheme_Object **args) { Scheme_Structure *inst; Scheme_Struct_Type *stype; - Scheme_Object **guard_argv = NULL, *v; - int p, i, j, nis, ns, c, gcount; + int p, i, j, nis, ns, c; stype = (Scheme_Struct_Type *)_stype; @@ -1527,33 +1875,7 @@ scheme_make_struct_instance(Scheme_Object *_stype, int argc, Scheme_Object **arg inst->stype = stype; /* Apply guards, if any: */ - for (p = stype->name_pos; p >= 0; p--) { - if (stype->parent_types[p]->guard) { - int got; - if (!guard_argv) { - guard_argv = MALLOC_N(Scheme_Object *, argc + 1); - memcpy(guard_argv, args, sizeof(Scheme_Object *) * argc); - args = guard_argv; - } - gcount = stype->parent_types[p]->num_islots; - guard_argv[argc] = guard_argv[gcount]; - guard_argv[gcount] = stype->name; - v = _scheme_apply_multi(stype->parent_types[p]->guard, gcount + 1, guard_argv); - got = (SAME_OBJ(v, SCHEME_MULTIPLE_VALUES) ? scheme_multiple_count : 1); - if (gcount != got) { - scheme_wrong_return_arity("constructor", - gcount, got, - (got == 1) ? (Scheme_Object **)v : scheme_multiple_array, - "calling guard procedure"); - return NULL; - } - if (SAME_OBJ(v, SCHEME_MULTIPLE_VALUES)) - memcpy(guard_argv, scheme_multiple_array, gcount * sizeof(Scheme_Object *)); - else - guard_argv[0] = v; - guard_argv[gcount] = guard_argv[argc]; - } - } + args = apply_guards(stype, argc, args); /* Fill in fields: */ j = c; @@ -1607,14 +1929,28 @@ Scheme_Object *scheme_make_prefab_struct_instance(Scheme_Struct_Type *stype, Scheme_Object *scheme_clone_prefab_struct_instance(Scheme_Structure *s) { + Scheme_Object *chaperone, *v; Scheme_Structure *inst; - int c, sz; + int c, sz, i; + + if (SCHEME_CHAPERONEP((Scheme_Object *)s)) { + chaperone = (Scheme_Object *)s; + s = (Scheme_Structure *)SCHEME_CHAPERONE_VAL(chaperone); + } else + chaperone = NULL; c = s->stype->num_slots; sz = (sizeof(Scheme_Structure) + ((c - 1) * sizeof(Scheme_Object *))); inst = (Scheme_Structure *)scheme_malloc_tagged(sz); memcpy(inst, s, sz); + + if (chaperone) { + for (i = 0; i < c; i++) { + v = scheme_struct_ref(chaperone, i); + inst->slots[i] = v; + } + } return (Scheme_Object *)inst; } @@ -1667,11 +2003,16 @@ static int is_simple_struct_type(Scheme_Struct_Type *stype) static Scheme_Object *struct_pred(int argc, Scheme_Object **args, Scheme_Object *prim) { - if (SCHEME_STRUCTP(args[0])) { + Scheme_Object *v = args[0]; + + if (SCHEME_CHAPERONEP(v)) v = SCHEME_CHAPERONE_VAL(v); + + if (SCHEME_STRUCTP(v)) { Scheme_Struct_Type *stype = (Scheme_Struct_Type *)SCHEME_PRIM_CLOSURE_ELS(prim)[0]; - if (STRUCT_TYPEP(stype, ((Scheme_Structure *)args[0]))) + if (STRUCT_TYPEP(stype, ((Scheme_Structure *)v))) return scheme_true; } + return scheme_false; } @@ -1736,8 +2077,10 @@ static Scheme_Object *struct_getter(int argc, Scheme_Object **args, Scheme_Objec Struct_Proc_Info *i = (Struct_Proc_Info *)SCHEME_PRIM_CLOSURE_ELS(prim)[0]; inst = (Scheme_Structure *)args[0]; + if (SCHEME_CHAPERONEP(((Scheme_Object *)inst))) + inst = (Scheme_Structure *)SCHEME_CHAPERONE_VAL((Scheme_Object *)inst); - if (!SCHEME_STRUCTP(args[0])) { + if (!SCHEME_STRUCTP(((Scheme_Object *)inst))) { scheme_wrong_type(i->func_name, type_name_string(i->struct_type->name), 0, argc, args); @@ -1755,7 +2098,10 @@ static Scheme_Object *struct_getter(int argc, Scheme_Object **args, Scheme_Objec else pos = i->field; - return inst->slots[pos]; + if (SAME_OBJ((Scheme_Object *)inst, args[0])) + return inst->slots[pos]; + else + return scheme_struct_ref(args[0], pos); } static Scheme_Object *struct_setter(int argc, Scheme_Object **args, Scheme_Object *prim) @@ -1765,14 +2111,17 @@ static Scheme_Object *struct_setter(int argc, Scheme_Object **args, Scheme_Objec Scheme_Object *v; Struct_Proc_Info *i = (Struct_Proc_Info *)SCHEME_PRIM_CLOSURE_ELS(prim)[0]; - if (!SCHEME_STRUCTP(args[0])) { + inst = (Scheme_Structure *)args[0]; + if (SCHEME_CHAPERONEP(((Scheme_Object *)inst))) + inst = (Scheme_Structure *)SCHEME_CHAPERONE_VAL((Scheme_Object *)inst); + + if (!SCHEME_STRUCTP(((Scheme_Object *)inst))) { scheme_wrong_type(i->func_name, type_name_string(i->struct_type->name), 0, argc, args); return NULL; } - inst = (Scheme_Structure *)args[0]; if (!STRUCT_TYPEP(i->struct_type, inst)) { wrong_struct_type(i->func_name, i->struct_type->name, @@ -1804,7 +2153,10 @@ static Scheme_Object *struct_setter(int argc, Scheme_Object **args, Scheme_Objec } } - inst->slots[pos] = v; + if (SAME_OBJ((Scheme_Object *)inst, args[0])) + inst->slots[pos] = v; + else + scheme_struct_set(args[0], pos, v); return scheme_void; } @@ -1812,10 +2164,15 @@ static Scheme_Object *struct_setter(int argc, Scheme_Object **args, Scheme_Objec static Scheme_Object * struct_p(int argc, Scheme_Object *argv[]) { - if (SCHEME_STRUCTP(argv[0])) { + Scheme_Object *v = argv[0]; + + if (SCHEME_CHAPERONEP(v)) + v = SCHEME_CHAPERONE_VAL(v); + + if (SCHEME_STRUCTP(v)) { Scheme_Object *insp; insp = scheme_get_param(scheme_current_config(), MZCONFIG_INSPECTOR); - if (scheme_inspector_sees_part(argv[0], insp, -1)) + if (scheme_inspector_sees_part(v, insp, -1)) return scheme_true; else return scheme_false; @@ -1826,14 +2183,19 @@ struct_p(int argc, Scheme_Object *argv[]) static Scheme_Object * struct_type_p(int argc, Scheme_Object *argv[]) { - return (SAME_TYPE(SCHEME_TYPE(argv[0]), scheme_struct_type_type) - ? scheme_true : scheme_false); + return (SCHEME_CHAPERONE_STRUCT_TYPEP(argv[0]) + ? scheme_true : scheme_false); } static Scheme_Object *proc_struct_type_p(int argc, Scheme_Object *argv[]) { - if (SAME_TYPE(SCHEME_TYPE(argv[0]), scheme_struct_type_type)) { - if (((Scheme_Struct_Type *)argv[0])->proc_attr) + Scheme_Object *v = argv[0]; + + if (SCHEME_NP_CHAPERONEP(v)) + v = SCHEME_CHAPERONE_VAL(v); + + if (SCHEME_STRUCT_TYPEP(v)) { + if (((Scheme_Struct_Type *)v)->proc_attr) return scheme_true; else return scheme_false; @@ -1842,15 +2204,86 @@ static Scheme_Object *proc_struct_type_p(int argc, Scheme_Object *argv[]) return NULL; } +static Scheme_Object *apply_chaperones(const char *who, Scheme_Object *procs, int argc, Scheme_Object **a) +{ + Scheme_Object *v, **vals, *v1[1]; + int cnt, i; + Scheme_Thread *p; + + while (SCHEME_PAIRP(procs)) { + v = _scheme_apply_multi(SCHEME_CAR(procs), argc, a); + + if (SAME_OBJ(v, SCHEME_MULTIPLE_VALUES)) { + p = scheme_current_thread; + cnt = p->ku.multiple.count; + vals = p->ku.multiple.array; + p->ku.multiple.array = NULL; + if (SAME_OBJ(vals, p->values_buffer)) + p->values_buffer = NULL; + p = NULL; + } else { + v1[0] = v; + vals = v1; + cnt = 1; + } + + if (cnt != argc) { + scheme_raise_exn(MZEXN_FAIL_CONTRACT_ARITY, + "%s: chaperone: %V: returned %d values, expected %d", + who, + SCHEME_CAR(procs), + cnt, argc); + } + + for (i = 0; i < argc; i++) { + if (!scheme_chaperone_of(vals[i], a[i])) + scheme_raise_exn(MZEXN_FAIL_CONTRACT, + "%s: chaperone produced a result: %V that is not a chaperone of the original result: %V", + who, + vals[i], + a[i]); + } + + a = vals; + procs = SCHEME_CDR(procs); + } + + return scheme_values(argc, a); +} + +static Scheme_Object *struct_info_chaperone(Scheme_Object *o, Scheme_Object *si, Scheme_Object *b) +{ + Scheme_Object *procs = scheme_null, *a[2]; + Scheme_Chaperone *px; + + while (SCHEME_CHAPERONEP(o)) { + px = (Scheme_Chaperone *)o; + if (SCHEME_VECTORP(px->redirects)) { + if (SCHEME_VEC_ELS(px->redirects)[1]) + procs = scheme_make_pair(SCHEME_VEC_ELS(px->redirects)[1], procs); + } + o = px->prev; + } + + a[0] = si; + a[1] = b; + + return apply_chaperones("struct-info", procs, 2, a); +} + static Scheme_Object *struct_info(int argc, Scheme_Object *argv[]) { Scheme_Structure *s; Scheme_Struct_Type *stype; int p; Scheme_Object *insp, *a[2]; + Scheme_Object *v = argv[0]; + + if (SCHEME_CHAPERONEP(v)) + v = SCHEME_CHAPERONE_VAL(v); - if (SCHEME_STRUCTP(argv[0])) { - s = (Scheme_Structure *)argv[0]; + if (SCHEME_STRUCTP(v)) { + s = (Scheme_Structure *)v; insp = scheme_get_param(scheme_current_config(), MZCONFIG_INSPECTOR); @@ -1860,10 +2293,13 @@ static Scheme_Object *struct_info(int argc, Scheme_Object *argv[]) while (p--) { stype = stype->parent_types[p]; if (scheme_is_subinspector(stype->inspector, insp)) { - a[0] = (Scheme_Object *)stype; - a[1] = ((SAME_OBJ(stype, s->stype)) ? scheme_false : scheme_true); - - return scheme_values(2, a); + a[0] = (Scheme_Object *)stype; + a[1] = ((SAME_OBJ(stype, s->stype)) ? scheme_false : scheme_true); + + if (!SAME_OBJ(v, argv[0])) + return struct_info_chaperone(argv[0], a[0], a[1]); + else + return scheme_values(2, a); } } } @@ -1876,13 +2312,17 @@ static Scheme_Object *struct_info(int argc, Scheme_Object *argv[]) static Scheme_Object *check_type_and_inspector(const char *who, int always, int argc, Scheme_Object *argv[]) { - Scheme_Object *insp; + Scheme_Object *insp, *val; Scheme_Struct_Type *stype; - if (!SAME_TYPE(SCHEME_TYPE(argv[0]), scheme_struct_type_type)) + val = argv[0]; + if (SCHEME_NP_CHAPERONEP(val)) + val = SCHEME_CHAPERONE_VAL(val); + + if (!SCHEME_STRUCT_TYPEP(val)) scheme_wrong_type(who, "struct-type", 0, argc, argv); - stype = (Scheme_Struct_Type *)argv[0]; + stype = (Scheme_Struct_Type *)val; insp = scheme_get_current_inspector(); @@ -1903,7 +2343,10 @@ static void get_struct_type_info(int argc, Scheme_Object *argv[], Scheme_Object int p, cnt; insp = check_type_and_inspector("struct-type-info", always, argc, argv); - stype = (Scheme_Struct_Type *)argv[0]; + if (SCHEME_NP_CHAPERONEP(argv[0])) + stype = (Scheme_Struct_Type *)SCHEME_CHAPERONE_VAL(argv[0]); + else + stype = (Scheme_Struct_Type *)argv[0]; /* Make sure generic accessor and mutator are created: */ if (!stype->accessor) { @@ -1951,12 +2394,32 @@ static void get_struct_type_info(int argc, Scheme_Object *argv[], Scheme_Object a[7] = ((p == stype->name_pos - 1) ? scheme_false : scheme_true); } +static Scheme_Object *struct_type_info_chaperone(Scheme_Object *o, Scheme_Object **a) +{ + Scheme_Object *procs = scheme_null; + Scheme_Chaperone *px; + + while (SCHEME_NP_CHAPERONEP(o)) { + px = (Scheme_Chaperone *)o; + if (SCHEME_PAIRP(px->redirects)) { + procs = scheme_make_pair(SCHEME_CAR(px->redirects), procs); + } + o = px->prev; + } + + return apply_chaperones("struct-type-info", procs, mzNUM_ST_INFO, a); +} + static Scheme_Object *struct_type_info(int argc, Scheme_Object *argv[]) { Scheme_Object *a[mzNUM_ST_INFO]; get_struct_type_info(argc, argv, a, 0); + if (SCHEME_NP_CHAPERONEP(argv[0])) { + return struct_type_info_chaperone(argv[0], a); + } + return scheme_values(mzNUM_ST_INFO, a); } @@ -1965,7 +2428,10 @@ static Scheme_Object *struct_type_pred(int argc, Scheme_Object *argv[]) Scheme_Struct_Type *stype; check_type_and_inspector("struct-type-make-predicate", 0, argc, argv); - stype = (Scheme_Struct_Type *)argv[0]; + if (SCHEME_NP_CHAPERONEP(argv[0])) + stype = (Scheme_Struct_Type *)SCHEME_CHAPERONE_VAL(argv[0]); + else + stype = (Scheme_Struct_Type *)argv[0]; return make_struct_proc(stype, scheme_symbol_val(PRED_NAME(scheme_symbol_val(stype->name), @@ -1974,33 +2440,62 @@ static Scheme_Object *struct_type_pred(int argc, Scheme_Object *argv[]) stype->num_slots); } +static Scheme_Object *type_constr_chaperone(Scheme_Object *o, Scheme_Object *v) +{ + Scheme_Object *procs = scheme_null, *a[1]; + Scheme_Chaperone *px; + + while (SCHEME_NP_CHAPERONEP(o)) { + px = (Scheme_Chaperone *)o; + if (SCHEME_PAIRP(px->redirects)) { + procs = scheme_make_pair(SCHEME_CADR(px->redirects), procs); + } + o = px->prev; + } + + a[0] = v; + return apply_chaperones("struct-type-make-constructor", procs, 1, a); +} + static Scheme_Object *struct_type_constr(int argc, Scheme_Object *argv[]) { Scheme_Struct_Type *stype; + Scheme_Object *v; check_type_and_inspector("struct-type-make-constructor", 0, argc, argv); - stype = (Scheme_Struct_Type *)argv[0]; + if (SCHEME_NP_CHAPERONEP(argv[0])) + stype = (Scheme_Struct_Type *)SCHEME_CHAPERONE_VAL(argv[0]); + else + stype = (Scheme_Struct_Type *)argv[0]; - return make_struct_proc(stype, - scheme_symbol_val(CSTR_NAME(scheme_symbol_val(stype->name), - SCHEME_SYM_LEN(stype->name))), - SCHEME_CONSTR, - stype->num_slots); + v = make_struct_proc(stype, + scheme_symbol_val(CSTR_NAME(scheme_symbol_val(stype->name), + SCHEME_SYM_LEN(stype->name))), + SCHEME_CONSTR, + stype->num_slots); + + if (SCHEME_NP_CHAPERONEP(argv[0])) + return type_constr_chaperone(argv[0], v); + + return v; } Scheme_Object *scheme_struct_to_vector(Scheme_Object *_s, Scheme_Object *unknown_val, Scheme_Object *insp) { Scheme_Structure *s; Scheme_Struct_Type *stype; - Scheme_Object *v, *name; + Scheme_Object *v, *elem, *name; GC_CAN_IGNORE Scheme_Object **array; int i, m, p, n, last_is_unknown; if (!unknown_val) unknown_val = ellipses_symbol; - s = (Scheme_Structure *)_s; - + if (SCHEME_CHAPERONEP(_s)) + s = (Scheme_Structure *)SCHEME_CHAPERONE_VAL(_s); + else + s = (Scheme_Structure *)_s; + stype = s->stype; p = stype->name_pos + 1; m = 0; @@ -2047,7 +2542,12 @@ Scheme_Object *scheme_struct_to_vector(Scheme_Object *_s, Scheme_Object *unknown last_is_unknown = 1; } else { while (n--) { - array[1 + (--m)] = s->slots[--i]; + --i; + if (SAME_OBJ((Scheme_Object *)s, _s)) + elem = s->slots[i]; + else + elem = scheme_struct_ref(_s, i); + array[1 + (--m)] = elem; } last_is_unknown = 0; } @@ -2058,7 +2558,7 @@ Scheme_Object *scheme_struct_to_vector(Scheme_Object *_s, Scheme_Object *unknown static Scheme_Object *struct_to_vector(int argc, Scheme_Object *argv[]) { - if (!SCHEME_STRUCTP(argv[0])) { + if (!SCHEME_CHAPERONE_STRUCTP(argv[0])) { char *tn, *s; int l; Scheme_Object *v; @@ -2086,7 +2586,10 @@ static Scheme_Object *prefab_struct_key(int argc, Scheme_Object *argv[]) { Scheme_Structure *s = (Scheme_Structure *)argv[0]; - if (SCHEME_STRUCTP(argv[0]) + if (SCHEME_CHAPERONEP((Scheme_Object *)s)) + s = (Scheme_Structure *)SCHEME_CHAPERONE_VAL((Scheme_Object *)s); + + if (SCHEME_STRUCTP(((Scheme_Object *)s)) && s->stype->prefab_key) return SCHEME_CDR(s->stype->prefab_key); @@ -2156,9 +2659,14 @@ int scheme_inspector_sees_part(Scheme_Object *s, Scheme_Object *insp, int pos) /* pos == -1 => sees any part pos == -2 => sees all parts */ { - Scheme_Struct_Type *stype = ((Scheme_Structure *)s)->stype; + Scheme_Struct_Type *stype; int p; + if (SCHEME_CHAPERONEP(s)) + s = SCHEME_CHAPERONE_VAL(s); + + stype = ((Scheme_Structure *)s)->stype; + p = stype->name_pos; if (pos == -1) { @@ -2207,10 +2715,10 @@ static Scheme_Object * struct_setter_p(int argc, Scheme_Object *argv[]) { return ((STRUCT_mPROCP(argv[0], - SCHEME_PRIM_IS_STRUCT_OTHER | SCHEME_PRIM_STRUCT_OTHER_TYPE_MASK, + SCHEME_PRIM_IS_STRUCT_OTHER | SCHEME_PRIM_OTHER_TYPE_MASK, SCHEME_PRIM_IS_STRUCT_OTHER | SCHEME_PRIM_STRUCT_TYPE_INDEXED_SETTER) || STRUCT_mPROCP(argv[0], - SCHEME_PRIM_IS_STRUCT_OTHER | SCHEME_PRIM_STRUCT_OTHER_TYPE_MASK, + SCHEME_PRIM_IS_STRUCT_OTHER | SCHEME_PRIM_OTHER_TYPE_MASK, SCHEME_PRIM_IS_STRUCT_OTHER | SCHEME_PRIM_STRUCT_TYPE_INDEXLESS_SETTER)) ? scheme_true : scheme_false); } @@ -2220,7 +2728,7 @@ struct_getter_p(int argc, Scheme_Object *argv[]) { return ((STRUCT_PROCP(argv[0], SCHEME_PRIM_IS_STRUCT_INDEXED_GETTER) || STRUCT_mPROCP(argv[0], - SCHEME_PRIM_IS_STRUCT_OTHER | SCHEME_PRIM_STRUCT_OTHER_TYPE_MASK, + SCHEME_PRIM_IS_STRUCT_OTHER | SCHEME_PRIM_OTHER_TYPE_MASK, SCHEME_PRIM_IS_STRUCT_OTHER | SCHEME_PRIM_STRUCT_TYPE_INDEXLESS_GETTER)) ? scheme_true : scheme_false); } @@ -2236,8 +2744,28 @@ static Scheme_Object * struct_constr_p(int argc, Scheme_Object *argv[]) { return (STRUCT_mPROCP(argv[0], - SCHEME_PRIM_IS_STRUCT_OTHER | SCHEME_PRIM_STRUCT_OTHER_TYPE_MASK, - SCHEME_PRIM_IS_STRUCT_OTHER | SCHEME_PRIM_STRUCT_TYPE_CONSTR) + SCHEME_PRIM_IS_STRUCT_OTHER | SCHEME_PRIM_OTHER_TYPE_MASK, + SCHEME_PRIM_IS_STRUCT_OTHER | SCHEME_PRIM_STRUCT_TYPE_CONSTR) + ? scheme_true : scheme_false); +} + +static Scheme_Object * +struct_prop_getter_p(int argc, Scheme_Object *argv[]) +{ + return ((STRUCT_mPROCP(argv[0], + SCHEME_PRIM_OTHER_TYPE_MASK, + SCHEME_PRIM_TYPE_STRUCT_PROP_GETTER) + && SAME_TYPE(SCHEME_TYPE(SCHEME_PRIM_CLOSURE_ELS(argv[0])[0]), scheme_struct_property_type)) + ? scheme_true : scheme_false); +} + +static Scheme_Object * +chaperone_prop_getter_p(int argc, Scheme_Object *argv[]) +{ + return ((STRUCT_mPROCP(argv[0], + SCHEME_PRIM_OTHER_TYPE_MASK, + SCHEME_PRIM_TYPE_STRUCT_PROP_GETTER) + && SAME_TYPE(SCHEME_TYPE(SCHEME_PRIM_CLOSURE_ELS(argv[0])[0]), scheme_chaperone_property_type)) ? scheme_true : scheme_false); } @@ -2252,10 +2780,10 @@ static Scheme_Object *make_struct_field_xxor(const char *who, int getter, int fieldstrlen; if (!STRUCT_mPROCP(argv[0], - SCHEME_PRIM_IS_STRUCT_OTHER | SCHEME_PRIM_STRUCT_OTHER_TYPE_MASK, + SCHEME_PRIM_IS_STRUCT_OTHER | SCHEME_PRIM_OTHER_TYPE_MASK, SCHEME_PRIM_IS_STRUCT_OTHER | (getter - ? SCHEME_PRIM_STRUCT_TYPE_INDEXLESS_GETTER - : SCHEME_PRIM_STRUCT_TYPE_INDEXLESS_SETTER))) { + ? SCHEME_PRIM_STRUCT_TYPE_INDEXLESS_GETTER + : SCHEME_PRIM_STRUCT_TYPE_INDEXLESS_SETTER))) { scheme_wrong_type(who, (getter ? "accessor procedure that requires a field index" : "mutator procedure that requires a field index"), @@ -2945,6 +3473,36 @@ static Scheme_Object *append_super_props(Scheme_Struct_Property *p, Scheme_Objec return orig; } +static Scheme_Object *add_struct_type_chaperone_guards(Scheme_Object *o, Scheme_Object *orig_guard) +{ + Scheme_Object *first = NULL, *last = NULL, *p; + Scheme_Chaperone *px; + + /* Order of resulting list should match order of application. Since + we're checking arguments going in, apply more recent chaperone + wrappers first. */ + while (SCHEME_NP_CHAPERONEP(o)) { + px = (Scheme_Chaperone *)o; + if (SCHEME_PAIRP(px->redirects)) { + p = scheme_make_pair(SCHEME_CDR(SCHEME_CDR(px->redirects)), scheme_null); + if (last) + SCHEME_CDR(last) = p; + else + first = p; + last = p; + } + o = px->prev; + } + + if (!last) + return orig_guard; + + if (!orig_guard) + orig_guard = scheme_false; + + return scheme_make_pair(orig_guard, first); +} + static Scheme_Object *_make_struct_type(Scheme_Object *basesym, const char *base, int blen, Scheme_Object *parent, Scheme_Object *inspector, @@ -2959,7 +3517,10 @@ static Scheme_Object *_make_struct_type(Scheme_Object *basesym, const char *base Scheme_Struct_Type *struct_type, *parent_type; int j, depth, checked_proc = 0; - parent_type = (Scheme_Struct_Type *)parent; + if (parent && SCHEME_NP_CHAPERONEP(parent)) + parent_type = (Scheme_Struct_Type *)SCHEME_CHAPERONE_VAL(parent); + else + parent_type = (Scheme_Struct_Type *)parent; depth = parent_type ? (1 + parent_type->name_pos) : 0; @@ -3232,20 +3793,43 @@ static Scheme_Object *_make_struct_type(Scheme_Object *basesym, const char *base if (guard) { - if (!scheme_check_proc_arity(NULL, struct_type->num_islots + 1, -1, 0, &guard)) { scheme_raise_exn(MZEXN_FAIL_CONTRACT, "make-struct-type: guard procedure does not accept %d arguments " - "(one more than the number constructor arguments): %V", + "(one more than the number of constructor arguments): %V", struct_type->num_islots + 1, guard); } struct_type->guard = guard; } + if (parent && SCHEME_NP_CHAPERONEP(parent)) { + guard = add_struct_type_chaperone_guards(parent, struct_type->guard); + struct_type->guard = guard; + } + if (checked_proc) MZ_OPT_HASH_KEY(&struct_type->iso) |= STRUCT_TYPE_CHECKED_PROC; + /* Check all immutable */ + if (!struct_type->name_pos + || MZ_OPT_HASH_KEY(&struct_type->parent_types[struct_type->name_pos - 1]->iso) & STRUCT_TYPE_ALL_IMMUTABLE) { + int i, size; + size = struct_type->num_islots; + if (struct_type->name_pos) + size -= struct_type->parent_types[struct_type->name_pos - 1]->num_islots; + if (struct_type->immutables) { + for (i = 0; i < size; i++) { + if (!struct_type->immutables[i]) + break; + } + } else { + i = 0; + } + if (i == size) + MZ_OPT_HASH_KEY(&struct_type->iso) |= STRUCT_TYPE_ALL_IMMUTABLE; + } + return (Scheme_Object *)struct_type; } @@ -3325,25 +3909,6 @@ Scheme_Struct_Type *hash_prefab(Scheme_Struct_Type *type) if (v) { type = (Scheme_Struct_Type *)v; } else { - /* Check all immutable */ - if (!type->name_pos - || MZ_OPT_HASH_KEY(&type->parent_types[type->name_pos - 1]->iso) & STRUCT_TYPE_ALL_IMMUTABLE) { - int i, size; - size = type->num_islots; - if (type->name_pos) - size -= type->parent_types[type->name_pos - 1]->num_islots; - if (type->immutables) { - for (i = 0; i < size; i++) { - if (!type->immutables[i]) - break; - } - } else { - i = 0; - } - if (i == size) - MZ_OPT_HASH_KEY(&type->iso) |= STRUCT_TYPE_ALL_IMMUTABLE; - } - v = scheme_make_weak_box((Scheme_Object *)type); scheme_add_to_table(prefab_table, (const char *)k, v, 0); } @@ -3362,7 +3927,7 @@ static Scheme_Object *make_struct_type(int argc, Scheme_Object **argv) if (!SCHEME_SYMBOLP(argv[0])) scheme_wrong_type("make-struct-type", "symbol", 0, argc, argv); if (!SCHEME_FALSEP(argv[1]) - && !SAME_TYPE(SCHEME_TYPE(argv[1]), scheme_struct_type_type)) + && !SCHEME_CHAPERONE_STRUCT_TYPEP(argv[1])) scheme_wrong_type("make-struct-type", "struct-type or #f", 1, argc, argv); if (!SCHEME_INTP(argv[2]) || (SCHEME_INT_VAL(argv[2]) < 0)) { @@ -3469,7 +4034,10 @@ static Scheme_Object *make_struct_type(int argc, Scheme_Object **argv) if (prefab) { const char *bad = NULL; Scheme_Object *parent = argv[1]; - if (!SCHEME_FALSEP(parent) && !((Scheme_Struct_Type *)parent)->prefab_key) { + if (SCHEME_NP_CHAPERONEP(parent)) { + bad = ("make-struct-type: chaperoned supertype disallowed" + " for non-generative structure type with name: %S"); + } else if (!SCHEME_FALSEP(parent) && !((Scheme_Struct_Type *)parent)->prefab_key) { bad = ("make-struct-type: generative supertype disallowed" " for non-generative structure type with name: %S"); } else if (!SCHEME_NULLP(props)) { @@ -3759,7 +4327,7 @@ static Scheme_Object *procedure_extract_target(int argc, Scheme_Object **argv) if (!SCHEME_PROCP(argv[0])) scheme_wrong_type("procedure-extract-target", "procedure", 0, argc, argv); - if (SCHEME_PROC_STRUCTP(argv[0])) { + if (SCHEME_CHAPERONE_STRUCTP(argv[0])) { /* Don't expose arity reducer: */ if (scheme_reduced_procedure_struct && scheme_is_struct_instance(scheme_reduced_procedure_struct, argv[0])) @@ -3961,6 +4529,225 @@ static Scheme_Object *check_exn_source_property_value_ok(int argc, Scheme_Object /**********************************************************************/ +static Scheme_Object *chaperone_struct(int argc, Scheme_Object **argv) +/* (chaperone-struct v mutator/selector replacement ...) */ +{ + Scheme_Chaperone *px; + Scheme_Struct_Type *stype; + Scheme_Object *val = argv[0], *proc; + Scheme_Object *redirects, *prop, *si_chaperone = NULL; + Struct_Proc_Info *pi; + Scheme_Object *a[1]; + int i, offset, arity; + const char *kind; + Scheme_Hash_Tree *props = NULL, *red_props = NULL; + + if (argc == 1) return argv[0]; + + if (SCHEME_CHAPERONEP(val)) { + props = ((Scheme_Chaperone *)val)->props; + val = SCHEME_CHAPERONE_VAL(val); + } + + if (SCHEME_STRUCTP(val)) { + stype = ((Scheme_Structure *)val)->stype; + redirects = scheme_make_vector(PRE_REDIRECTS + 2 * stype->num_slots, NULL); + } else { + stype = NULL; + redirects = NULL; + } + + for (i = 1; i < argc; i++) { + proc = argv[i]; + + if ((i > 1) && SAME_TYPE(SCHEME_TYPE(proc), scheme_chaperone_property_type)) { + props = scheme_parse_chaperone_props("chaperone-box", i, argc, argv); + break; + } + + a[0] = proc; + if (SCHEME_TRUEP(struct_setter_p(1, a))) { + kind = "mutator"; + offset = stype->num_slots; + } else if (SCHEME_TRUEP(struct_getter_p(1, a))) { + kind = "accessor"; + offset = 0; + } else if (SCHEME_TRUEP(struct_prop_getter_p(1, a))) { + kind = "struct-type property accessor"; + offset = -1; + } else if (SAME_OBJ(proc, struct_info_proc)) { + kind = "struct-info"; + offset = -2; + } else { + scheme_wrong_type("chaperone-struct", + "structure accessor, structure mutator, struct-type property accessor, or `struct-info'", + i, argc, argv); + return NULL; + } + + if (offset == -2) { + if (si_chaperone) + scheme_raise_exn(MZEXN_FAIL_CONTRACT, + "chaperone-struct: struct-info procedure supplied a second time: %V", + proc); + pi = NULL; + prop = NULL; + arity = 2; + } else if (offset == -1) { + prop = SCHEME_PRIM_CLOSURE_ELS(proc)[0]; + pi = NULL; + + if (!scheme_chaperone_struct_type_property_ref(prop, argv[0])) + scheme_raise_exn(MZEXN_FAIL_CONTRACT, + "chaperone-struct: %s %V does not apply to given object: %V", + kind, + proc, + argv[0]); + if (!red_props) + red_props = scheme_make_hash_tree(0); + + if (scheme_hash_tree_get(red_props, prop)) + scheme_raise_exn(MZEXN_FAIL_CONTRACT, + "chaperone-struct: given %s is for the same property as a previous %s argument: %V", + kind, kind, + proc); + arity = 2; + } else { + pi = (Struct_Proc_Info *)((Scheme_Primitive_Closure *)proc)->val[0]; + prop = NULL; + + if (!SCHEME_STRUCTP(val) || !scheme_is_struct_instance((Scheme_Object *)pi->struct_type, val)) + scheme_raise_exn(MZEXN_FAIL_CONTRACT, + "chaperone-struct: %s %V does not apply to given object: %V", + kind, + proc, + argv[0]); + if (SCHEME_VEC_ELS(redirects)[PRE_REDIRECTS + offset + pi->field]) + scheme_raise_exn(MZEXN_FAIL_CONTRACT, + "chaperone-struct: given %s is for the same field as a previous %s argument: %V", + kind, kind, + proc); + arity = 2; + } + + i++; + if (i >= argc) + scheme_raise_exn(MZEXN_FAIL_CONTRACT, + "chaperone-struct: missing replacement for %s: %V", + kind, + proc); + + proc = argv[i]; + if (!scheme_check_proc_arity(NULL, arity, i, argc, argv)) + scheme_raise_exn(MZEXN_FAIL_CONTRACT, + "chaperone-struct: expected # as %s replacement, given: %V", + arity, + kind, + proc); + + if (prop) + red_props = scheme_hash_tree_set(red_props, prop, proc); + else if (pi) + SCHEME_VEC_ELS(redirects)[PRE_REDIRECTS + offset + pi->field] = proc; + else + si_chaperone = proc; + } + + if (!redirects) { + /* a non-structure chaperone */ + redirects = scheme_make_vector(1, NULL); + } else { + SCHEME_VEC_ELS(redirects)[1] = si_chaperone; + } + + SCHEME_VEC_ELS(redirects)[0] = (Scheme_Object *)red_props; + + px = MALLOC_ONE_TAGGED(Scheme_Chaperone); + if (SCHEME_PROCP(val)) + px->so.type = scheme_proc_chaperone_type; + else + px->so.type = scheme_chaperone_type; + px->val = val; + px->prev = argv[0]; + px->props = props; + px->redirects = redirects; + + return (Scheme_Object *)px; +} + +static Scheme_Object *chaperone_struct_type(int argc, Scheme_Object **argv) +{ + Scheme_Chaperone *px; + Scheme_Object *val = argv[0]; + Scheme_Object *redirects; + Scheme_Hash_Tree *props; + int arity; + + if (SCHEME_CHAPERONEP(val)) + val = SCHEME_CHAPERONE_VAL(val); + + if (!SCHEME_STRUCT_TYPEP(val)) + scheme_wrong_type("chaperone-struct-type", "struct-type", 0, argc, argv); + scheme_check_proc_arity("chaperone-struct-type", 8, 1, argc, argv); + scheme_check_proc_arity("chaperone-struct-type", 1, 2, argc, argv); + if (!SCHEME_PROCP(argv[3])) + scheme_wrong_type("chaperone-struct-type", "procedure", 3, argc, argv); + + arity = ((Scheme_Struct_Type *)val)->num_islots + 1; + if (!scheme_check_proc_arity(NULL, arity, 3, argc, argv)) + scheme_raise_exn(MZEXN_FAIL_CONTRACT, + "chaperone-struct-type: guard procedure does not accept %d arguments " + "(one more than the number of constructor arguments): %V", + arity, argv[0]); + + props = scheme_parse_chaperone_props("chaperone-vector", 4, argc, argv); + + redirects = scheme_make_pair(argv[1], + scheme_make_pair(argv[2], + argv[3])); + + px = MALLOC_ONE_TAGGED(Scheme_Chaperone); + px->so.type = scheme_chaperone_type; + px->props = props; + px->val = val; + px->prev = argv[0]; + px->redirects = redirects; + + return (Scheme_Object *)px; +} + +Scheme_Hash_Tree *scheme_parse_chaperone_props(const char *who, int start_at, int argc, Scheme_Object **argv) +{ + Scheme_Hash_Tree *ht; + Scheme_Object *v; + + if (SCHEME_CHAPERONEP(argv[0])) + ht = ((Scheme_Chaperone *)argv[0])->props; + else + ht = NULL; + + while (start_at < argc) { + v = argv[start_at]; + if (!SAME_TYPE(SCHEME_TYPE(v), scheme_chaperone_property_type)) + scheme_wrong_type(who, "chaperone-property", start_at, argc, argv); + + if (start_at + 1 >= argc) + scheme_arg_mismatch(who, + "missing value after chaperone property: ", + v); + + if (!ht) + ht = scheme_make_hash_tree(0); + ht = scheme_hash_tree_set(ht, v, argv[start_at + 1]); + + start_at += 2; + } + + return ht; +} + +/**********************************************************************/ + #if MZ_PRECISE_GC START_XFORM_SKIP; @@ -3974,6 +4761,7 @@ static void register_traversers(void) GC_REG_TRAV(scheme_proc_struct_type, mark_struct_val); GC_REG_TRAV(scheme_struct_type_type, mark_struct_type_val); GC_REG_TRAV(scheme_struct_property_type, mark_struct_property); + GC_REG_TRAV(scheme_chaperone_property_type, mark_struct_property); GC_REG_TRAV(scheme_wrap_evt_type, mark_wrapped_evt); GC_REG_TRAV(scheme_handle_evt_type, mark_wrapped_evt); @@ -3981,6 +4769,8 @@ static void register_traversers(void) GC_REG_TRAV(scheme_poll_evt_type, mark_nack_guard_evt); GC_REG_TRAV(scheme_rt_struct_proc_info, mark_struct_proc_info); + + GC_REG_TRAV(scheme_chaperone_type, mark_chaperone); } END_XFORM_SKIP; diff --git a/src/mzscheme/src/stxobj.c b/src/mzscheme/src/stxobj.c index 2db1546d1f..796c3fa707 100644 --- a/src/mzscheme/src/stxobj.c +++ b/src/mzscheme/src/stxobj.c @@ -115,6 +115,7 @@ static void preemptive_chunk(Scheme_Stx *stx); #define ICONS scheme_make_pair #define HAS_SUBSTX(obj) (SCHEME_PAIRP(obj) || SCHEME_VECTORP(obj) || SCHEME_BOXP(obj) || prefab_p(obj) || SCHEME_HASHTRP(obj)) +#define HAS_CHAPERONE_SUBSTX(obj) (HAS_SUBSTX(obj) || (SCHEME_NP_CHAPERONEP(obj) && HAS_SUBSTX(SCHEME_CHAPERONE_VAL(obj)))) XFORM_NONGCING static int prefab_p(Scheme_Object *o) { @@ -7887,7 +7888,7 @@ static Scheme_Object *datum_to_syntax_inner(Scheme_Object *o, SCHEME_USE_FUEL(1); if (ht) { - if (HAS_SUBSTX(o)) { + if (HAS_CHAPERONE_SUBSTX(o)) { if (scheme_hash_get(ht, o)) { /* Graphs disallowed */ return_NULL; @@ -7985,34 +7986,55 @@ static Scheme_Object *datum_to_syntax_inner(Scheme_Object *o, result = first; } - } else if (SCHEME_BOXP(o)) { - o = datum_to_syntax_inner(SCHEME_PTR_VAL(o), ut, stx_src, stx_wraps, ht); + } else if (SCHEME_CHAPERONE_BOXP(o)) { + if (SCHEME_NP_CHAPERONEP(o)) + o = scheme_unbox(o); + else + o = SCHEME_PTR_VAL(o); + + o = datum_to_syntax_inner(o, ut, stx_src, stx_wraps, ht); if (!o) return_NULL; result = scheme_box(o); SCHEME_SET_BOX_IMMUTABLE(result); - } else if (SCHEME_VECTORP(o)) { - int size = SCHEME_VEC_SIZE(o), i; - Scheme_Object *a; + } else if (SCHEME_CHAPERONE_VECTORP(o)) { + int size, i; + Scheme_Object *a, *oo; + + oo = o; + if (SCHEME_NP_CHAPERONEP(o)) + o = SCHEME_CHAPERONE_VAL(o); + size = SCHEME_VEC_SIZE(o); result = scheme_make_vector(size, NULL); for (i = 0; i < size; i++) { - a = datum_to_syntax_inner(SCHEME_VEC_ELS(o)[i], ut, stx_src, stx_wraps, ht); + if (SAME_OBJ(o, oo)) + a = SCHEME_VEC_ELS(o)[i]; + else + a = scheme_chaperone_vector_ref(oo, i); + a = datum_to_syntax_inner(a, ut, stx_src, stx_wraps, ht); if (!a) return_NULL; SCHEME_VEC_ELS(result)[i] = a; } SCHEME_SET_VECTOR_IMMUTABLE(result); - } else if (SCHEME_HASHTRP(o)) { - Scheme_Hash_Tree *ht1 = (Scheme_Hash_Tree *)o, *ht2; + } else if (SCHEME_CHAPERONE_HASHTRP(o)) { + Scheme_Hash_Tree *ht1, *ht2; Scheme_Object *key, *val; int i; + + if (SCHEME_NP_CHAPERONEP(o)) + ht1 = (Scheme_Hash_Tree *)SCHEME_CHAPERONE_VAL(o); + else + ht1 = (Scheme_Hash_Tree *)o; ht2 = scheme_make_hash_tree(SCHEME_HASHTR_FLAGS(ht1) & 0x3); i = scheme_hash_tree_next(ht1, -1); while (i != -1) { scheme_hash_tree_index(ht1, i, &key, &val); + if (!SAME_OBJ((Scheme_Object *)ht1, o)) + val = scheme_chaperone_hash_traversal_get(ht1, key); val = datum_to_syntax_inner(val, ut, stx_src, stx_wraps, ht); if (!val) return NULL; ht2 = scheme_hash_tree_set(ht2, key, val); @@ -8020,12 +8042,14 @@ static Scheme_Object *datum_to_syntax_inner(Scheme_Object *o, } result = (Scheme_Object *)ht2; - } else if (prefab_p(o)) { - Scheme_Structure *s = (Scheme_Structure *)o; + } else if (prefab_p(o) || (SCHEME_CHAPERONEP(o) && prefab_p(SCHEME_CHAPERONE_VAL(o)))) { + Scheme_Structure *s; Scheme_Object *a; - int size = s->stype->num_slots, i; - - s = (Scheme_Structure *)scheme_clone_prefab_struct_instance(s); + int size, i; + + s = (Scheme_Structure *)scheme_clone_prefab_struct_instance((Scheme_Structure *)o); + size = s->stype->num_slots; + for (i = 0; i < size; i++) { a = datum_to_syntax_inner(s->slots[i], ut, stx_src, stx_wraps, ht); if (!a) return NULL; @@ -8106,7 +8130,7 @@ static Scheme_Object *general_datum_to_syntax(Scheme_Object *o, if (SCHEME_STXP(o)) return o; - if (can_graph && HAS_SUBSTX(o)) + if (can_graph && HAS_CHAPERONE_SUBSTX(o)) ht = scheme_make_hash_table(SCHEME_hash_ptr); else ht = NULL; @@ -8422,6 +8446,19 @@ static Scheme_Object *datum_to_syntax(int argc, Scheme_Object **argv) ll = scheme_proper_list_length(src); + if (SCHEME_CHAPERONEP(src)) { + src = SCHEME_CHAPERONE_VAL(src); + if (SCHEME_VECTORP(src) && (SCHEME_VEC_SIZE(src) == 5)) { + Scheme_Object *a; + int i; + src = scheme_make_vector(5, NULL); + for (i = 0; i < 5; i++) { + a = scheme_chaperone_vector_ref(argv[2], i); + SCHEME_VEC_ELS(src)[i] = a; + } + } + } + if (!SCHEME_FALSEP(src) && !SCHEME_STXP(src) && !(SCHEME_VECTORP(src) diff --git a/src/mzscheme/src/stypes.h b/src/mzscheme/src/stypes.h index a4356d2a83..1992e83802 100644 --- a/src/mzscheme/src/stypes.h +++ b/src/mzscheme/src/stypes.h @@ -46,210 +46,214 @@ enum { scheme_escaping_cont_type, /* 32 */ scheme_proc_struct_type, /* 33 */ scheme_native_closure_type, /* 34 */ + scheme_proc_chaperone_type, /* 35 */ - /* structure types (overlaps with procs) */ - scheme_structure_type, /* 35 */ + scheme_chaperone_type, /* 36 */ + + /* structure type (plus one above for procs) */ + scheme_structure_type, /* 37 */ /* basic types */ - scheme_char_type, /* 36 */ - scheme_integer_type, /* 37 */ - scheme_bignum_type, /* 38 */ - scheme_rational_type, /* 39 */ - scheme_float_type, /* 40 */ - scheme_double_type, /* 41 */ - scheme_complex_type, /* 42 */ - scheme_char_string_type, /* 43 */ - scheme_byte_string_type, /* 44 */ - scheme_unix_path_type, /* 45 */ - scheme_windows_path_type, /* 46 */ - scheme_symbol_type, /* 47 */ - scheme_keyword_type, /* 48 */ - scheme_null_type, /* 49 */ - scheme_pair_type, /* 50 */ - scheme_mutable_pair_type, /* 51 */ - scheme_vector_type, /* 52 */ - scheme_inspector_type, /* 53 */ - scheme_input_port_type, /* 54 */ - scheme_output_port_type, /* 55 */ - scheme_eof_type, /* 56 */ - scheme_true_type, /* 57 */ - scheme_false_type, /* 58 */ - scheme_void_type, /* 59 */ - scheme_syntax_compiler_type, /* 60 */ - scheme_macro_type, /* 61 */ - scheme_box_type, /* 62 */ - scheme_thread_type, /* 63 */ - scheme_stx_offset_type, /* 64 */ - scheme_cont_mark_set_type, /* 65 */ - scheme_sema_type, /* 66 */ - scheme_hash_table_type, /* 67 */ - scheme_hash_tree_type, /* 68 */ - scheme_cpointer_type, /* 69 */ - scheme_offset_cpointer_type, /* 70 */ - scheme_weak_box_type, /* 71 */ - scheme_ephemeron_type, /* 72 */ - scheme_struct_type_type, /* 73 */ - scheme_module_index_type, /* 74 */ - scheme_set_macro_type, /* 75 */ - scheme_listener_type, /* 76 */ - scheme_namespace_type, /* 77 */ - scheme_config_type, /* 78 */ - scheme_stx_type, /* 79 */ - scheme_will_executor_type, /* 80 */ - scheme_custodian_type, /* 81 */ - scheme_random_state_type, /* 82 */ - scheme_regexp_type, /* 83 */ - scheme_bucket_type, /* 84 */ - scheme_bucket_table_type, /* 85 */ - scheme_subprocess_type, /* 86 */ - scheme_compilation_top_type, /* 87 */ - scheme_wrap_chunk_type, /* 88 */ - scheme_eval_waiting_type, /* 89 */ - scheme_tail_call_waiting_type, /* 90 */ - scheme_undefined_type, /* 91 */ - scheme_struct_property_type, /* 92 */ - scheme_multiple_values_type, /* 93 */ - scheme_placeholder_type, /* 94 */ - scheme_table_placeholder_type, /* 95 */ - scheme_case_lambda_sequence_type, /* 96 */ - scheme_begin0_sequence_type, /* 97 */ - scheme_rename_table_type, /* 98 */ - scheme_rename_table_set_type, /* 99 */ - scheme_module_type, /* 100 */ - scheme_svector_type, /* 101 */ - scheme_resolve_prefix_type, /* 102 */ - scheme_security_guard_type, /* 103 */ - scheme_indent_type, /* 104 */ - scheme_udp_type, /* 105 */ - scheme_udp_evt_type, /* 106 */ - scheme_tcp_accept_evt_type, /* 107 */ - scheme_id_macro_type, /* 108 */ - scheme_evt_set_type, /* 109 */ - scheme_wrap_evt_type, /* 110 */ - scheme_handle_evt_type, /* 111 */ - scheme_nack_guard_evt_type, /* 112 */ - scheme_semaphore_repost_type, /* 113 */ - scheme_channel_type, /* 114 */ - scheme_channel_put_type, /* 115 */ - scheme_thread_resume_type, /* 116 */ - scheme_thread_suspend_type, /* 117 */ - scheme_thread_dead_type, /* 118 */ - scheme_poll_evt_type, /* 119 */ - scheme_nack_evt_type, /* 120 */ - scheme_module_registry_type, /* 121 */ - scheme_thread_set_type, /* 122 */ - scheme_string_converter_type, /* 123 */ - scheme_alarm_type, /* 124 */ - scheme_thread_recv_evt_type, /* 125 */ - scheme_thread_cell_type, /* 126 */ - scheme_channel_syncer_type, /* 127 */ - scheme_special_comment_type, /* 128 */ - scheme_write_evt_type, /* 129 */ - scheme_always_evt_type, /* 130 */ - scheme_never_evt_type, /* 131 */ - scheme_progress_evt_type, /* 132 */ - scheme_certifications_type, /* 133 */ - scheme_already_comp_type, /* 134 */ - scheme_readtable_type, /* 135 */ - scheme_intdef_context_type, /* 136 */ - scheme_lexical_rib_type, /* 137 */ - scheme_thread_cell_values_type, /* 138 */ - scheme_global_ref_type, /* 139 */ - scheme_cont_mark_chain_type, /* 140 */ - scheme_raw_pair_type, /* 141 */ - scheme_prompt_type, /* 142 */ - scheme_prompt_tag_type, /* 143 */ - scheme_expanded_syntax_type, /* 144 */ - scheme_delay_syntax_type, /* 145 */ - scheme_cust_box_type, /* 146 */ - scheme_resolved_module_path_type, /* 147 */ - scheme_module_phase_exports_type, /* 148 */ - scheme_logger_type, /* 149 */ - scheme_log_reader_type, /* 150 */ - scheme_free_id_info_type, /* 151 */ - scheme_rib_delimiter_type, /* 152 */ - scheme_noninline_proc_type, /* 153 */ - scheme_prune_context_type, /* 154 */ - scheme_future_type, /* 155 */ - scheme_flvector_type, /* 156 */ - scheme_place_type, /* 157 */ - scheme_place_async_channel_type, /* 158 */ - scheme_place_bi_channel_type, /* 159 */ - scheme_once_used_type, /* 160 */ + scheme_char_type, /* 38 */ + scheme_integer_type, /* 39 */ + scheme_bignum_type, /* 40 */ + scheme_rational_type, /* 41 */ + scheme_float_type, /* 42 */ + scheme_double_type, /* 43 */ + scheme_complex_type, /* 44 */ + scheme_char_string_type, /* 45 */ + scheme_byte_string_type, /* 46 */ + scheme_unix_path_type, /* 47 */ + scheme_windows_path_type, /* 48 */ + scheme_symbol_type, /* 49 */ + scheme_keyword_type, /* 50 */ + scheme_null_type, /* 51 */ + scheme_pair_type, /* 52 */ + scheme_mutable_pair_type, /* 53 */ + scheme_vector_type, /* 54 */ + scheme_inspector_type, /* 55 */ + scheme_input_port_type, /* 56 */ + scheme_output_port_type, /* 57 */ + scheme_eof_type, /* 58 */ + scheme_true_type, /* 59 */ + scheme_false_type, /* 60 */ + scheme_void_type, /* 61 */ + scheme_syntax_compiler_type, /* 62 */ + scheme_macro_type, /* 63 */ + scheme_box_type, /* 64 */ + scheme_thread_type, /* 65 */ + scheme_stx_offset_type, /* 66 */ + scheme_cont_mark_set_type, /* 67 */ + scheme_sema_type, /* 68 */ + scheme_hash_table_type, /* 69 */ + scheme_hash_tree_type, /* 70 */ + scheme_cpointer_type, /* 71 */ + scheme_offset_cpointer_type, /* 72 */ + scheme_weak_box_type, /* 73 */ + scheme_ephemeron_type, /* 74 */ + scheme_struct_type_type, /* 75 */ + scheme_module_index_type, /* 76 */ + scheme_set_macro_type, /* 77 */ + scheme_listener_type, /* 78 */ + scheme_namespace_type, /* 79 */ + scheme_config_type, /* 80 */ + scheme_stx_type, /* 81 */ + scheme_will_executor_type, /* 82 */ + scheme_custodian_type, /* 83 */ + scheme_random_state_type, /* 84 */ + scheme_regexp_type, /* 85 */ + scheme_bucket_type, /* 86 */ + scheme_bucket_table_type, /* 87 */ + scheme_subprocess_type, /* 88 */ + scheme_compilation_top_type, /* 89 */ + scheme_wrap_chunk_type, /* 90 */ + scheme_eval_waiting_type, /* 91 */ + scheme_tail_call_waiting_type, /* 92 */ + scheme_undefined_type, /* 93 */ + scheme_struct_property_type, /* 94 */ + scheme_chaperone_property_type, /* 95 */ + scheme_multiple_values_type, /* 96 */ + scheme_placeholder_type, /* 97 */ + scheme_table_placeholder_type, /* 98 */ + scheme_case_lambda_sequence_type, /* 99 */ + scheme_begin0_sequence_type, /* 100 */ + scheme_rename_table_type, /* 101 */ + scheme_rename_table_set_type, /* 102 */ + scheme_module_type, /* 103 */ + scheme_svector_type, /* 104 */ + scheme_resolve_prefix_type, /* 105 */ + scheme_security_guard_type, /* 106 */ + scheme_indent_type, /* 107 */ + scheme_udp_type, /* 108 */ + scheme_udp_evt_type, /* 109 */ + scheme_tcp_accept_evt_type, /* 110 */ + scheme_id_macro_type, /* 111 */ + scheme_evt_set_type, /* 112 */ + scheme_wrap_evt_type, /* 113 */ + scheme_handle_evt_type, /* 114 */ + scheme_nack_guard_evt_type, /* 115 */ + scheme_semaphore_repost_type, /* 116 */ + scheme_channel_type, /* 117 */ + scheme_channel_put_type, /* 118 */ + scheme_thread_resume_type, /* 119 */ + scheme_thread_suspend_type, /* 120 */ + scheme_thread_dead_type, /* 121 */ + scheme_poll_evt_type, /* 122 */ + scheme_nack_evt_type, /* 123 */ + scheme_module_registry_type, /* 124 */ + scheme_thread_set_type, /* 125 */ + scheme_string_converter_type, /* 126 */ + scheme_alarm_type, /* 127 */ + scheme_thread_recv_evt_type, /* 128 */ + scheme_thread_cell_type, /* 129 */ + scheme_channel_syncer_type, /* 130 */ + scheme_special_comment_type, /* 131 */ + scheme_write_evt_type, /* 132 */ + scheme_always_evt_type, /* 133 */ + scheme_never_evt_type, /* 134 */ + scheme_progress_evt_type, /* 135 */ + scheme_certifications_type, /* 136 */ + scheme_already_comp_type, /* 137 */ + scheme_readtable_type, /* 138 */ + scheme_intdef_context_type, /* 139 */ + scheme_lexical_rib_type, /* 140 */ + scheme_thread_cell_values_type, /* 141 */ + scheme_global_ref_type, /* 142 */ + scheme_cont_mark_chain_type, /* 143 */ + scheme_raw_pair_type, /* 144 */ + scheme_prompt_type, /* 145 */ + scheme_prompt_tag_type, /* 146 */ + scheme_expanded_syntax_type, /* 147 */ + scheme_delay_syntax_type, /* 148 */ + scheme_cust_box_type, /* 149 */ + scheme_resolved_module_path_type, /* 150 */ + scheme_module_phase_exports_type, /* 151 */ + scheme_logger_type, /* 152 */ + scheme_log_reader_type, /* 153 */ + scheme_free_id_info_type, /* 154 */ + scheme_rib_delimiter_type, /* 155 */ + scheme_noninline_proc_type, /* 156 */ + scheme_prune_context_type, /* 157 */ + scheme_future_type, /* 158 */ + scheme_flvector_type, /* 159 */ + scheme_place_type, /* 160 */ + scheme_place_async_channel_type, /* 161 */ + scheme_place_bi_channel_type, /* 162 */ + scheme_once_used_type, /* 163 */ #ifdef MZTAG_REQUIRED - _scheme_last_normal_type_, /* 161 */ + _scheme_last_normal_type_, /* 164 */ - scheme_rt_weak_array, /* 162 */ + scheme_rt_weak_array, /* 165 */ - scheme_rt_comp_env, /* 163 */ - scheme_rt_constant_binding, /* 164 */ - scheme_rt_resolve_info, /* 165 */ - scheme_rt_optimize_info, /* 166 */ - scheme_rt_compile_info, /* 167 */ - scheme_rt_cont_mark, /* 168 */ - scheme_rt_saved_stack, /* 169 */ - scheme_rt_reply_item, /* 170 */ - scheme_rt_closure_info, /* 171 */ - scheme_rt_overflow, /* 172 */ - scheme_rt_overflow_jmp, /* 173 */ - scheme_rt_meta_cont, /* 174 */ - scheme_rt_dyn_wind_cell, /* 175 */ - scheme_rt_dyn_wind_info, /* 176 */ - scheme_rt_dyn_wind, /* 177 */ - scheme_rt_dup_check, /* 178 */ - scheme_rt_thread_memory, /* 179 */ - scheme_rt_input_file, /* 180 */ - scheme_rt_input_fd, /* 181 */ - scheme_rt_oskit_console_input, /* 182 */ - scheme_rt_tested_input_file, /* 183 */ - scheme_rt_tested_output_file, /* 184 */ - scheme_rt_indexed_string, /* 185 */ - scheme_rt_output_file, /* 186 */ - scheme_rt_load_handler_data, /* 187 */ - scheme_rt_pipe, /* 188 */ - scheme_rt_beos_process, /* 189 */ - scheme_rt_system_child, /* 190 */ - scheme_rt_tcp, /* 191 */ - scheme_rt_write_data, /* 192 */ - scheme_rt_tcp_select_info, /* 193 */ - scheme_rt_param_data, /* 194 */ - scheme_rt_will, /* 195 */ - scheme_rt_struct_proc_info, /* 196 */ - scheme_rt_linker_name, /* 197 */ - scheme_rt_param_map, /* 198 */ - scheme_rt_finalization, /* 199 */ - scheme_rt_finalizations, /* 200 */ - scheme_rt_cpp_object, /* 201 */ - scheme_rt_cpp_array_object, /* 202 */ - scheme_rt_stack_object, /* 203 */ - scheme_rt_preallocated_object, /* 204 */ - scheme_thread_hop_type, /* 205 */ - scheme_rt_srcloc, /* 206 */ - scheme_rt_evt, /* 207 */ - scheme_rt_syncing, /* 208 */ - scheme_rt_comp_prefix, /* 209 */ - scheme_rt_user_input, /* 210 */ - scheme_rt_user_output, /* 211 */ - scheme_rt_compact_port, /* 212 */ - scheme_rt_read_special_dw, /* 213 */ - scheme_rt_regwork, /* 214 */ - scheme_rt_buf_holder, /* 215 */ - scheme_rt_parameterization, /* 216 */ - scheme_rt_print_params, /* 217 */ - scheme_rt_read_params, /* 218 */ - scheme_rt_native_code, /* 219 */ - scheme_rt_native_code_plus_case, /* 220 */ - scheme_rt_jitter_data, /* 221 */ - scheme_rt_module_exports, /* 222 */ - scheme_rt_delay_load_info, /* 223 */ - scheme_rt_marshal_info, /* 224 */ - scheme_rt_unmarshal_info, /* 225 */ - scheme_rt_runstack, /* 226 */ - scheme_rt_sfs_info, /* 227 */ - scheme_rt_validate_clearing, /* 228 */ - scheme_rt_rb_node, /* 229 */ - scheme_rt_frozen_tramp, /* 230 */ + scheme_rt_comp_env, /* 166 */ + scheme_rt_constant_binding, /* 167 */ + scheme_rt_resolve_info, /* 168 */ + scheme_rt_optimize_info, /* 169 */ + scheme_rt_compile_info, /* 170 */ + scheme_rt_cont_mark, /* 171 */ + scheme_rt_saved_stack, /* 172 */ + scheme_rt_reply_item, /* 173 */ + scheme_rt_closure_info, /* 174 */ + scheme_rt_overflow, /* 175 */ + scheme_rt_overflow_jmp, /* 176 */ + scheme_rt_meta_cont, /* 177 */ + scheme_rt_dyn_wind_cell, /* 178 */ + scheme_rt_dyn_wind_info, /* 179 */ + scheme_rt_dyn_wind, /* 180 */ + scheme_rt_dup_check, /* 181 */ + scheme_rt_thread_memory, /* 182 */ + scheme_rt_input_file, /* 183 */ + scheme_rt_input_fd, /* 184 */ + scheme_rt_oskit_console_input, /* 185 */ + scheme_rt_tested_input_file, /* 186 */ + scheme_rt_tested_output_file, /* 187 */ + scheme_rt_indexed_string, /* 188 */ + scheme_rt_output_file, /* 189 */ + scheme_rt_load_handler_data, /* 190 */ + scheme_rt_pipe, /* 191 */ + scheme_rt_beos_process, /* 192 */ + scheme_rt_system_child, /* 193 */ + scheme_rt_tcp, /* 194 */ + scheme_rt_write_data, /* 195 */ + scheme_rt_tcp_select_info, /* 196 */ + scheme_rt_param_data, /* 197 */ + scheme_rt_will, /* 198 */ + scheme_rt_struct_proc_info, /* 199 */ + scheme_rt_linker_name, /* 200 */ + scheme_rt_param_map, /* 201 */ + scheme_rt_finalization, /* 202 */ + scheme_rt_finalizations, /* 203 */ + scheme_rt_cpp_object, /* 204 */ + scheme_rt_cpp_array_object, /* 205 */ + scheme_rt_stack_object, /* 206 */ + scheme_rt_preallocated_object, /* 207 */ + scheme_thread_hop_type, /* 208 */ + scheme_rt_srcloc, /* 209 */ + scheme_rt_evt, /* 210 */ + scheme_rt_syncing, /* 211 */ + scheme_rt_comp_prefix, /* 212 */ + scheme_rt_user_input, /* 213 */ + scheme_rt_user_output, /* 214 */ + scheme_rt_compact_port, /* 215 */ + scheme_rt_read_special_dw, /* 216 */ + scheme_rt_regwork, /* 217 */ + scheme_rt_buf_holder, /* 218 */ + scheme_rt_parameterization, /* 219 */ + scheme_rt_print_params, /* 220 */ + scheme_rt_read_params, /* 221 */ + scheme_rt_native_code, /* 222 */ + scheme_rt_native_code_plus_case, /* 223 */ + scheme_rt_jitter_data, /* 224 */ + scheme_rt_module_exports, /* 225 */ + scheme_rt_delay_load_info, /* 226 */ + scheme_rt_marshal_info, /* 227 */ + scheme_rt_unmarshal_info, /* 228 */ + scheme_rt_runstack, /* 229 */ + scheme_rt_sfs_info, /* 230 */ + scheme_rt_validate_clearing, /* 231 */ + scheme_rt_rb_node, /* 232 */ + scheme_rt_frozen_tramp, /* 233 */ #endif diff --git a/src/mzscheme/src/thread.c b/src/mzscheme/src/thread.c index 48dd64abb3..b0a952393b 100644 --- a/src/mzscheme/src/thread.c +++ b/src/mzscheme/src/thread.c @@ -6184,12 +6184,6 @@ void scheme_install_config(Scheme_Config *config) scheme_set_cont_mark(scheme_parameterization_key, (Scheme_Object *)config); } -#ifdef MZTAG_REQUIRED -# define IS_VECTOR(c) SCHEME_VECTORP((c)->content) -#else -# define IS_VECTOR(c) (!(c)->is_param) -#endif - Scheme_Object *find_param_cell(Scheme_Config *c, Scheme_Object *k, int force_cell) /* Unless force_cell, the result may actually be a value, if there has been no reason to set it before */ @@ -6342,7 +6336,8 @@ static Scheme_Object *parameterization_p(int argc, Scheme_Object **argv) #define SCHEME_PARAMETERP(v) ((SCHEME_PRIMP(v) || SCHEME_CLSD_PRIMP(v)) \ - && (((Scheme_Primitive_Proc *)v)->pp.flags & SCHEME_PRIM_IS_PARAMETER)) + && ((((Scheme_Primitive_Proc *)v)->pp.flags & SCHEME_PRIM_OTHER_TYPE_MASK) \ + == SCHEME_PRIM_TYPE_PARAMETER)) static Scheme_Object *extend_parameterization(int argc, Scheme_Object *argv[]) { @@ -6503,7 +6498,7 @@ static Scheme_Object *make_parameter(int argc, Scheme_Object **argv) p = scheme_make_closed_prim_w_arity(do_param, (void *)data, "parameter-procedure", 0, 1); - ((Scheme_Primitive_Proc *)p)->pp.flags |= SCHEME_PRIM_IS_PARAMETER; + ((Scheme_Primitive_Proc *)p)->pp.flags |= SCHEME_PRIM_TYPE_PARAMETER; return p; } @@ -6530,7 +6525,7 @@ static Scheme_Object *make_derived_parameter(int argc, Scheme_Object **argv) p = scheme_make_closed_prim_w_arity(do_param, (void *)data, "parameter-procedure", 0, 1); - ((Scheme_Primitive_Proc *)p)->pp.flags |= SCHEME_PRIM_IS_PARAMETER; + ((Scheme_Primitive_Proc *)p)->pp.flags |= SCHEME_PRIM_TYPE_PARAMETER; return p; } @@ -6542,11 +6537,9 @@ static Scheme_Object *parameter_procedure_eq(int argc, Scheme_Object **argv) a = argv[0]; b = argv[1]; - if (!((SCHEME_PRIMP(a) || SCHEME_CLSD_PRIMP(a)) - && (((Scheme_Primitive_Proc *)a)->pp.flags & SCHEME_PRIM_IS_PARAMETER))) + if (!SCHEME_PARAMETERP(a)) scheme_wrong_type("parameter-procedure=?", "parameter-procedure", 0, argc, argv); - if (!((SCHEME_PRIMP(b) || SCHEME_CLSD_PRIMP(b)) - && (((Scheme_Primitive_Proc *)b)->pp.flags & SCHEME_PRIM_IS_PARAMETER))) + if (!SCHEME_PARAMETERP(b)) scheme_wrong_type("parameter-procedure=?", "parameter-procedure", 1, argc, argv); return (SAME_OBJ(a, b) @@ -6770,7 +6763,7 @@ Scheme_Object *scheme_register_parameter(Scheme_Prim *function, char *name, int return config_map[which]; o = scheme_make_prim_w_arity(function, name, 0, 1); - ((Scheme_Primitive_Proc *)o)->pp.flags |= SCHEME_PRIM_IS_PARAMETER; + ((Scheme_Primitive_Proc *)o)->pp.flags |= SCHEME_PRIM_TYPE_PARAMETER; config_map[which] = o; @@ -7462,13 +7455,25 @@ END_XFORM_SKIP; /* stats */ /*========================================================================*/ +static void set_perf_vector(Scheme_Object *v, Scheme_Object *ov, int i, Scheme_Object *a) +{ + if (SAME_OBJ(v, ov)) + SCHEME_VEC_ELS(v)[i] = a; + else + scheme_chaperone_vector_set(ov, i, a); +} + static Scheme_Object *current_stats(int argc, Scheme_Object *argv[]) { - Scheme_Object *v; + Scheme_Object *v, *ov; Scheme_Thread *t = NULL; v = argv[0]; + ov = v; + if (SCHEME_CHAPERONEP(v)) + v = SCHEME_CHAPERONE_VAL(v); + if (!SCHEME_MUTABLE_VECTORP(v)) scheme_wrong_type("vector-set-performance-stats!", "mutable vector", 0, argc, argv); if (argc > 1) { @@ -7532,25 +7537,25 @@ static Scheme_Object *current_stats(int argc, Scheme_Object *argv[]) } } - SCHEME_VEC_ELS(v)[3] = scheme_make_integer(sz); + set_perf_vector(v, ov, 3, scheme_make_integer(sz)); } case 3: - SCHEME_VEC_ELS(v)[2] = (t->block_descriptor - ? scheme_true - : ((t->running & MZTHREAD_SUSPENDED) - ? scheme_true - : scheme_false)); + set_perf_vector(v, ov, 2, (t->block_descriptor + ? scheme_true + : ((t->running & MZTHREAD_SUSPENDED) + ? scheme_true + : scheme_false))); case 2: { Scheme_Object *dp; dp = thread_dead_p(1, (Scheme_Object **) mzALIAS &t); - SCHEME_VEC_ELS(v)[1] = dp; + set_perf_vector(v, ov, 1, dp); } case 1: { Scheme_Object *rp; rp = thread_running_p(1, (Scheme_Object **) mzALIAS &t); - SCHEME_VEC_ELS(v)[0] = rp; + set_perf_vector(v, ov, 0, rp); } case 0: break; @@ -7565,27 +7570,27 @@ static Scheme_Object *current_stats(int argc, Scheme_Object *argv[]) switch (SCHEME_VEC_SIZE(v)) { default: case 11: - SCHEME_VEC_ELS(v)[10] = scheme_make_integer(scheme_jit_malloced); + set_perf_vector(v, ov, 10, scheme_make_integer(scheme_jit_malloced)); case 10: - SCHEME_VEC_ELS(v)[9] = scheme_make_integer(scheme_hash_iteration_count); + set_perf_vector(v, ov, 9, scheme_make_integer(scheme_hash_iteration_count)); case 9: - SCHEME_VEC_ELS(v)[8] = scheme_make_integer(scheme_hash_request_count); + set_perf_vector(v, ov, 8, scheme_make_integer(scheme_hash_request_count)); case 8: - SCHEME_VEC_ELS(v)[7] = scheme_make_integer(scheme_num_read_syntax_objects); + set_perf_vector(v, ov, 7, scheme_make_integer(scheme_num_read_syntax_objects)); case 7: - SCHEME_VEC_ELS(v)[6] = scheme_make_integer(num_running_threads+1); + set_perf_vector(v, ov, 6, scheme_make_integer(num_running_threads+1)); case 6: - SCHEME_VEC_ELS(v)[5] = scheme_make_integer(scheme_overflow_count); + set_perf_vector(v, ov, 5, scheme_make_integer(scheme_overflow_count)); case 5: - SCHEME_VEC_ELS(v)[4] = scheme_make_integer(thread_swap_count); + set_perf_vector(v, ov, 4, scheme_make_integer(thread_swap_count)); case 4: - SCHEME_VEC_ELS(v)[3] = scheme_make_integer(scheme_did_gc_count); + set_perf_vector(v, ov, 3, scheme_make_integer(scheme_did_gc_count)); case 3: - SCHEME_VEC_ELS(v)[2] = scheme_make_integer(gcend); + set_perf_vector(v, ov, 2, scheme_make_integer(gcend)); case 2: - SCHEME_VEC_ELS(v)[1] = scheme_make_integer(end); + set_perf_vector(v, ov, 1, scheme_make_integer(end)); case 1: - SCHEME_VEC_ELS(v)[0] = scheme_make_integer(cpuend); + set_perf_vector(v, ov, 0, scheme_make_integer(cpuend)); case 0: break; } diff --git a/src/mzscheme/src/type.c b/src/mzscheme/src/type.c index e54071ae7b..42bc8f09f7 100644 --- a/src/mzscheme/src/type.c +++ b/src/mzscheme/src/type.c @@ -152,7 +152,10 @@ scheme_init_type () set_name(scheme_unix_path_type, ""); set_name(scheme_windows_path_type, ""); set_name(scheme_struct_property_type, ""); + set_name(scheme_chaperone_property_type, ""); set_name(scheme_structure_type, ""); + set_name(scheme_proc_chaperone_type, ""); + set_name(scheme_chaperone_type, ""); #ifdef USE_SENORA_GC set_name(scheme_proc_struct_type, ""); #else diff --git a/src/mzscheme/src/vector.c b/src/mzscheme/src/vector.c index e3643eb0f0..0213eb485a 100644 --- a/src/mzscheme/src/vector.c +++ b/src/mzscheme/src/vector.c @@ -24,10 +24,13 @@ */ #include "schpriv.h" +#include "schmach.h" /* globals */ READ_ONLY Scheme_Object *scheme_vector_proc; READ_ONLY Scheme_Object *scheme_vector_immutable_proc; +READ_ONLY Scheme_Object *scheme_vector_ref_proc; +READ_ONLY Scheme_Object *scheme_vector_set_proc; /* locals */ static Scheme_Object *vector_p (int argc, Scheme_Object *argv[]); @@ -41,6 +44,7 @@ static Scheme_Object *vector_fill (int argc, Scheme_Object *argv[]); static Scheme_Object *vector_copy_bang(int argc, Scheme_Object *argv[]); static Scheme_Object *vector_to_immutable (int argc, Scheme_Object *argv[]); static Scheme_Object *vector_to_values (int argc, Scheme_Object *argv[]); +static Scheme_Object *chaperone_vector(int argc, Scheme_Object **argv); static Scheme_Object *unsafe_vector_len (int argc, Scheme_Object *argv[]); static Scheme_Object *unsafe_vector_ref (int argc, Scheme_Object *argv[]); @@ -89,15 +93,19 @@ scheme_init_vector (Scheme_Env *env) SCHEME_PRIM_PROC_FLAGS(p) |= SCHEME_PRIM_IS_UNARY_INLINED; scheme_add_global_constant("vector-length", p, env); - p = scheme_make_immed_prim(scheme_checked_vector_ref, - "vector-ref", - 2, 2); + REGISTER_SO(scheme_vector_ref_proc); + p = scheme_make_noncm_prim(scheme_checked_vector_ref, + "vector-ref", + 2, 2); + scheme_vector_ref_proc = p; SCHEME_PRIM_PROC_FLAGS(p) |= SCHEME_PRIM_IS_BINARY_INLINED; scheme_add_global_constant("vector-ref", p, env); - p = scheme_make_immed_prim(scheme_checked_vector_set, - "vector-set!", - 3, 3); + REGISTER_SO(scheme_vector_set_proc); + p = scheme_make_noncm_prim(scheme_checked_vector_set, + "vector-set!", + 3, 3); + scheme_vector_set_proc = p; SCHEME_PRIM_PROC_FLAGS(p) |= SCHEME_PRIM_IS_NARY_INLINED; scheme_add_global_constant("vector-set!", p, env); @@ -132,6 +140,12 @@ scheme_init_vector (Scheme_Env *env) 1, 3, 0, -1), env); + + scheme_add_global_constant("chaperone-vector", + scheme_make_prim_w_arity(chaperone_vector, + "chaperone-vector", + 3, -1), + env); } void @@ -139,85 +153,79 @@ scheme_init_unsafe_vector (Scheme_Env *env) { Scheme_Object *p; - p = scheme_make_immed_prim(unsafe_vector_len, - "unsafe-vector-length", - 1, 1); + p = scheme_make_immed_prim(unsafe_vector_len, "unsafe-vector-length", 1, 1); SCHEME_PRIM_PROC_FLAGS(p) |= (SCHEME_PRIM_IS_UNARY_INLINED | SCHEME_PRIM_IS_UNSAFE_FUNCTIONAL); scheme_add_global_constant("unsafe-vector-length", p, env); - p = scheme_make_immed_prim(unsafe_vector_ref, - "unsafe-vector-ref", - 2, 2); + p = scheme_make_immed_prim(unsafe_vector_len, "unsafe-vector*-length", 1, 1); + SCHEME_PRIM_PROC_FLAGS(p) |= (SCHEME_PRIM_IS_UNARY_INLINED + | SCHEME_PRIM_IS_UNSAFE_FUNCTIONAL); + scheme_add_global_constant("unsafe-vector*-length", p, env); + + p = scheme_make_immed_prim(unsafe_vector_ref, "unsafe-vector-ref", 2, 2); SCHEME_PRIM_PROC_FLAGS(p) |= (SCHEME_PRIM_IS_BINARY_INLINED | SCHEME_PRIM_IS_UNSAFE_FUNCTIONAL); scheme_add_global_constant("unsafe-vector-ref", p, env); - p = scheme_make_immed_prim(unsafe_vector_set, - "unsafe-vector-set!", - 3, 3); + p = scheme_make_immed_prim(unsafe_vector_ref, "unsafe-vector*-ref", 2, 2); + SCHEME_PRIM_PROC_FLAGS(p) |= (SCHEME_PRIM_IS_BINARY_INLINED + | SCHEME_PRIM_IS_UNSAFE_FUNCTIONAL); + scheme_add_global_constant("unsafe-vector*-ref", p, env); + + p = scheme_make_immed_prim(unsafe_vector_set, "unsafe-vector-set!", 3, 3); SCHEME_PRIM_PROC_FLAGS(p) |= SCHEME_PRIM_IS_NARY_INLINED; scheme_add_global_constant("unsafe-vector-set!", p, env); - p = scheme_make_immed_prim(unsafe_vector_ref, - "unsafe-vector-ref", - 2, 2); - p = scheme_make_immed_prim(unsafe_struct_ref, - "unsafe-struct-ref", - 2, 2); + p = scheme_make_immed_prim(unsafe_vector_set, "unsafe-vector*-set!", 3, 3); + SCHEME_PRIM_PROC_FLAGS(p) |= SCHEME_PRIM_IS_NARY_INLINED; + scheme_add_global_constant("unsafe-vector*-set!", p, env); + + p = scheme_make_immed_prim(unsafe_struct_ref, "unsafe-struct-ref", 2, 2); SCHEME_PRIM_PROC_FLAGS(p) |= (SCHEME_PRIM_IS_BINARY_INLINED | SCHEME_PRIM_IS_UNSAFE_FUNCTIONAL); scheme_add_global_constant("unsafe-struct-ref", p, env); - p = scheme_make_immed_prim(unsafe_struct_set, - "unsafe-struct-set!", - 3, 3); + p = scheme_make_immed_prim(unsafe_struct_ref, "unsafe-struct*-ref", 2, 2); + SCHEME_PRIM_PROC_FLAGS(p) |= (SCHEME_PRIM_IS_BINARY_INLINED + | SCHEME_PRIM_IS_UNSAFE_FUNCTIONAL); + scheme_add_global_constant("unsafe-struct*-ref", p, env); + + p = scheme_make_immed_prim(unsafe_struct_set, "unsafe-struct-set!", 3, 3); SCHEME_PRIM_PROC_FLAGS(p) |= SCHEME_PRIM_IS_NARY_INLINED; scheme_add_global_constant("unsafe-struct-set!", p, env); + p = scheme_make_immed_prim(unsafe_struct_set, "unsafe-struct*-set!", 3, 3); + SCHEME_PRIM_PROC_FLAGS(p) |= SCHEME_PRIM_IS_NARY_INLINED; + scheme_add_global_constant("unsafe-struct*-set!", p, env); - p = scheme_make_immed_prim(unsafe_string_len, - "unsafe-string-length", - 1, 1); + p = scheme_make_immed_prim(unsafe_string_len, "unsafe-string-length", 1, 1); SCHEME_PRIM_PROC_FLAGS(p) |= (SCHEME_PRIM_IS_UNARY_INLINED | SCHEME_PRIM_IS_UNSAFE_FUNCTIONAL); scheme_add_global_constant("unsafe-string-length", p, env); - p = scheme_make_immed_prim(unsafe_string_ref, - "unsafe-string-ref", - 2, 2); + p = scheme_make_immed_prim(unsafe_string_ref, "unsafe-string-ref", 2, 2); SCHEME_PRIM_PROC_FLAGS(p) |= (SCHEME_PRIM_IS_BINARY_INLINED | SCHEME_PRIM_IS_UNSAFE_FUNCTIONAL); scheme_add_global_constant("unsafe-string-ref", p, env); - p = scheme_make_immed_prim(unsafe_string_set, - "unsafe-string-set!", - 3, 3); + p = scheme_make_immed_prim(unsafe_string_set, "unsafe-string-set!", 3, 3); SCHEME_PRIM_PROC_FLAGS(p) |= SCHEME_PRIM_IS_NARY_INLINED; scheme_add_global_constant("unsafe-string-set!", p, env); - p = scheme_make_immed_prim(unsafe_bytes_len, - "unsafe-bytes-length", - 1, 1); + p = scheme_make_immed_prim(unsafe_bytes_len, "unsafe-bytes-length", 1, 1); SCHEME_PRIM_PROC_FLAGS(p) |= (SCHEME_PRIM_IS_UNARY_INLINED | SCHEME_PRIM_IS_UNSAFE_FUNCTIONAL); scheme_add_global_constant("unsafe-bytes-length", p, env); - p = scheme_make_immed_prim(unsafe_bytes_ref, - "unsafe-bytes-ref", - 2, 2); + p = scheme_make_immed_prim(unsafe_bytes_ref, "unsafe-bytes-ref", 2, 2); SCHEME_PRIM_PROC_FLAGS(p) |= (SCHEME_PRIM_IS_BINARY_INLINED | SCHEME_PRIM_IS_UNSAFE_FUNCTIONAL); scheme_add_global_constant("unsafe-bytes-ref", p, env); - p = scheme_make_immed_prim(unsafe_bytes_set, - "unsafe-bytes-set!", - 3, 3); + p = scheme_make_immed_prim(unsafe_bytes_set, "unsafe-bytes-set!", 3, 3); SCHEME_PRIM_PROC_FLAGS(p) |= SCHEME_PRIM_IS_NARY_INLINED; - scheme_add_global_constant("unsafe-bytes-set!", p, env); - p = scheme_make_immed_prim(unsafe_bytes_ref, - "unsafe-bytes-ref", - 2, 2); + scheme_add_global_constant("unsafe-bytes-set!", p, env); } #define VECTOR_BYTES(size) (sizeof(Scheme_Vector) + ((size) - 1) * sizeof(Scheme_Object *)) @@ -256,7 +264,7 @@ scheme_make_vector (long size, Scheme_Object *fill) static Scheme_Object * vector_p (int argc, Scheme_Object *argv[]) { - return (SCHEME_VECTORP(argv[0]) ? scheme_true : scheme_false); + return (SCHEME_CHAPERONE_VECTORP(argv[0]) ? scheme_true : scheme_false); } static Scheme_Object * @@ -312,10 +320,15 @@ vector_immutable (int argc, Scheme_Object *argv[]) static Scheme_Object * vector_length (int argc, Scheme_Object *argv[]) { - if (!SCHEME_VECTORP(argv[0])) + Scheme_Object *vec = argv[0]; + + if (SCHEME_NP_CHAPERONEP(vec)) + vec = SCHEME_CHAPERONE_VAL(vec); + + if (!SCHEME_VECTORP(vec)) scheme_wrong_type("vector-length", "vector", 0, argc, argv); - return scheme_make_integer(SCHEME_VEC_SIZE(argv[0])); + return scheme_make_integer(SCHEME_VEC_SIZE(vec)); } Scheme_Object *scheme_vector_length(Scheme_Object *v) @@ -355,30 +368,127 @@ bad_index(char *name, Scheme_Object *i, Scheme_Object *vec, int bottom) return NULL; } +static Scheme_Object *chaperone_vector_ref_k(void) +{ + Scheme_Thread *p = scheme_current_thread; + Scheme_Object *o = (Scheme_Object *)p->ku.k.p1; + + p->ku.k.p1 = NULL; + + return scheme_chaperone_vector_ref(o, p->ku.k.i1); +} + +static Scheme_Object *chaperone_vector_ref_overflow(Scheme_Object *o, int i) +{ + Scheme_Thread *p = scheme_current_thread; + + p->ku.k.p1 = (void *)o; + p->ku.k.i1 = i; + + return scheme_handle_stack_overflow(chaperone_vector_ref_k); +} + +Scheme_Object *scheme_chaperone_vector_ref(Scheme_Object *o, int i) +{ + if (!SCHEME_NP_CHAPERONEP(o)) { + return SCHEME_VEC_ELS(o)[i]; + } else { + Scheme_Chaperone *px = (Scheme_Chaperone *)o; + Scheme_Object *a[3], *red, *orig; + +#ifdef DO_STACK_CHECK + { +# include "mzstkchk.h" + return chaperone_vector_ref_overflow(o, i); + } +#endif + + orig = scheme_chaperone_vector_ref(px->prev, i); + + if (SCHEME_VECTORP(px->redirects)) { + /* chaperone was on property accessors */ + return orig; + } + + a[0] = px->prev; + a[1] = scheme_make_integer(i); + a[2] = orig; + red = SCHEME_CAR(px->redirects); + o = _scheme_apply(red, 3, a); + + if (!scheme_chaperone_of(o, orig)) + scheme_raise_exn(MZEXN_FAIL_CONTRACT, + "vector-ref: chaperone produced a result: %V that is not a chaperone of the original result: %V", + o, + orig); + + return o; + } +} + Scheme_Object * scheme_checked_vector_ref (int argc, Scheme_Object *argv[]) { long i, len; + Scheme_Object *vec; - if (!SCHEME_VECTORP(argv[0])) + vec = argv[0]; + if (SCHEME_CHAPERONEP(vec)) + vec = SCHEME_CHAPERONE_VAL(vec); + + if (!SCHEME_VECTORP(vec)) scheme_wrong_type("vector-ref", "vector", 0, argc, argv); - len = SCHEME_VEC_SIZE(argv[0]); + len = SCHEME_VEC_SIZE(vec); i = scheme_extract_index("vector-ref", 1, argc, argv, len, 0); if (i >= len) return bad_index("vector-ref", argv[1], argv[0], 0); - return (SCHEME_VEC_ELS(argv[0]))[i]; + if (!SAME_OBJ(vec, argv[0])) + /* chaperone */ + return scheme_chaperone_vector_ref(argv[0], i); + else + return (SCHEME_VEC_ELS(vec))[i]; +} + +void scheme_chaperone_vector_set(Scheme_Object *o, int i, Scheme_Object *v) +{ + while (1) { + if (!SCHEME_NP_CHAPERONEP(o)) { + SCHEME_VEC_ELS(o)[i] = v; + return; + } else { + Scheme_Chaperone *px = (Scheme_Chaperone *)o; + Scheme_Object *a[3], *red; + + o = px->prev; + a[0] = o; + a[1] = scheme_make_integer(i); + a[2] = v; + red = SCHEME_CDR(px->redirects); + v = _scheme_apply(red, 3, a); + + if (!scheme_chaperone_of(v, a[2])) + scheme_raise_exn(MZEXN_FAIL_CONTRACT, + "vector-set!: chaperone produced a result: %V that is not a chaperone of the original result: %V", + v, + a[2]); + } + } } Scheme_Object * scheme_checked_vector_set(int argc, Scheme_Object *argv[]) { + Scheme_Object *vec = argv[0]; long i, len; - if (!SCHEME_MUTABLE_VECTORP(argv[0])) + if (SCHEME_CHAPERONEP(vec)) + vec = SCHEME_CHAPERONE_VAL(vec); + + if (!SCHEME_MUTABLE_VECTORP(vec)) scheme_wrong_type("vector-set!", "mutable vector", 0, argc, argv); len = SCHEME_VEC_SIZE(argv[0]); @@ -388,20 +498,14 @@ scheme_checked_vector_set(int argc, Scheme_Object *argv[]) if (i >= len) return bad_index("vector-set!", argv[1], argv[0], 0); - (SCHEME_VEC_ELS(argv[0]))[i] = argv[2]; + if (!SAME_OBJ(vec, argv[0])) + scheme_chaperone_vector_set(argv[0], i, argv[2]); + else + SCHEME_VEC_ELS(vec)[i] = argv[2]; return scheme_void; } -static Scheme_Object * -vector_to_list (int argc, Scheme_Object *argv[]) -{ - if (!SCHEME_VECTORP(argv[0])) - scheme_wrong_type("vector->list", "vector", 0, argc, argv); - - return scheme_vector_to_list(argv[0]); -} - # define cons(car, cdr) scheme_make_pair(car, cdr) Scheme_Object * @@ -427,6 +531,43 @@ scheme_vector_to_list (Scheme_Object *vec) return pair; } + +Scheme_Object * +chaperone_vector_to_list (Scheme_Object *vec) +{ + int i; + Scheme_Object *pair = scheme_null; + + i = SCHEME_VEC_SIZE(SCHEME_CHAPERONE_VAL(vec)); + + for (; i--; ) { + if (!(i & 0xFFF)) + SCHEME_USE_FUEL(0xFFF); + pair = cons(scheme_chaperone_vector_ref(vec, i), pair); + } + + return pair; +} + +static Scheme_Object * +vector_to_list (int argc, Scheme_Object *argv[]) +{ + Scheme_Object *vec = argv[0]; + + if (SCHEME_NP_CHAPERONEP(vec)) + vec = SCHEME_CHAPERONE_VAL(vec); + + if (!SCHEME_VECTORP(vec)) { + scheme_wrong_type("vector->list", "vector", 0, argc, argv); + return NULL; + } + + if (!SAME_OBJ(vec, argv[0])) + return chaperone_vector_to_list(argv[0]); + else + return scheme_vector_to_list(vec); +} + static Scheme_Object * list_to_vector (int argc, Scheme_Object *argv[]) { @@ -456,18 +597,27 @@ static Scheme_Object * vector_fill (int argc, Scheme_Object *argv[]) { int i, sz; - Scheme_Object *v; + Scheme_Object *v, *vec = argv[0]; + + if (SCHEME_NP_CHAPERONEP(vec)) + vec = SCHEME_CHAPERONE_VAL(vec); - if (!SCHEME_MUTABLE_VECTORP(argv[0])) + if (!SCHEME_MUTABLE_VECTORP(vec)) scheme_wrong_type("vector-fill!", "mutable vector", 0, argc, argv); v = argv[1]; - sz = SCHEME_VEC_SIZE(argv[0]); - for (i = 0; i < sz; i++) { - SCHEME_VEC_ELS(argv[0])[i] = v; + sz = SCHEME_VEC_SIZE(vec); + if (SAME_OBJ(vec, argv[0])) { + for (i = 0; i < sz; i++) { + SCHEME_VEC_ELS(argv[0])[i] = v; + } + } else { + for (i = 0; i < sz; i++) { + scheme_chaperone_vector_set(argv[0], i, v); + } } - return argv[0]; + return scheme_void; } static Scheme_Object *vector_copy_bang(int argc, Scheme_Object *argv[]) @@ -475,8 +625,13 @@ static Scheme_Object *vector_copy_bang(int argc, Scheme_Object *argv[]) Scheme_Object *s1, *s2; long istart, ifinish; long ostart, ofinish; + int slow = 0; s1 = argv[0]; + if (SCHEME_NP_CHAPERONEP(s1)) { + slow = 1; + s1 = SCHEME_CHAPERONE_VAL(s1); + } if (!SCHEME_MUTABLE_VECTORP(s1)) scheme_wrong_type("vector-copy!", "mutable vector", 0, argc, argv); @@ -485,6 +640,10 @@ static Scheme_Object *vector_copy_bang(int argc, Scheme_Object *argv[]) &ostart, &ofinish, SCHEME_VEC_SIZE(s1)); s2 = argv[2]; + if (SCHEME_NP_CHAPERONEP(s2)) { + slow = 1; + s2 = SCHEME_CHAPERONE_VAL(s2); + } if (!SCHEME_VECTORP(s2)) scheme_wrong_type("vector-copy!", "vector", 2, argc, argv); @@ -499,30 +658,66 @@ static Scheme_Object *vector_copy_bang(int argc, Scheme_Object *argv[]) return NULL; } - memmove(SCHEME_VEC_ELS(s1) + ostart, - SCHEME_VEC_ELS(s2) + istart, - (ifinish - istart) * sizeof(Scheme_Object*)); + if (slow) { + int i, o; + for (i = istart, o = ostart; i < ifinish; i++, o++) { + scheme_chaperone_vector_set(argv[0], o, scheme_chaperone_vector_ref(argv[2], i)); + } + } else { + memmove(SCHEME_VEC_ELS(s1) + ostart, + SCHEME_VEC_ELS(s2) + istart, + (ifinish - istart) * sizeof(Scheme_Object*)); + } return scheme_void; } +Scheme_Object *scheme_chaperone_vector_copy(Scheme_Object *vec) +{ + int len; + Scheme_Object *a[3], *vec2; + + if (SCHEME_NP_CHAPERONEP(vec)) + len = SCHEME_VEC_SIZE(SCHEME_CHAPERONE_VAL(vec)); + else + len = SCHEME_VEC_SIZE(vec); + + vec2 = scheme_make_vector(len, NULL); + a[0] = vec2; + a[1] = scheme_make_integer(0); + a[2] = vec; + + return vector_copy_bang(3, a); +} + static Scheme_Object *vector_to_immutable (int argc, Scheme_Object *argv[]) { - Scheme_Object *vec, *ovec; + Scheme_Object *vec, *ovec, *v; long len, i; - if (!SCHEME_VECTORP(argv[0])) + vec = argv[0]; + if (SCHEME_NP_CHAPERONEP(vec)) + vec = SCHEME_CHAPERONE_VAL(vec); + + if (!SCHEME_VECTORP(vec)) scheme_wrong_type("vector->immutable-vector", "vector", 0, argc, argv); - if (SCHEME_IMMUTABLEP(argv[0])) + if (SCHEME_IMMUTABLEP(vec)) return argv[0]; - ovec = argv[0]; + ovec = vec; len = SCHEME_VEC_SIZE(ovec); vec = scheme_make_vector(len, NULL); - for (i = 0; i < len; i++) { - SCHEME_VEC_ELS(vec)[i] = SCHEME_VEC_ELS(ovec)[i]; + if (!SAME_OBJ(ovec, argv[0])) { + for (i = 0; i < len; i++) { + v = scheme_chaperone_vector_ref(argv[0], i); + SCHEME_VEC_ELS(vec)[i] = v; + } + } else { + for (i = 0; i < len; i++) { + SCHEME_VEC_ELS(vec)[i] = SCHEME_VEC_ELS(ovec)[i]; + } } SCHEME_SET_IMMUTABLE(vec); @@ -536,6 +731,8 @@ static Scheme_Object *vector_to_values (int argc, Scheme_Object *argv[]) long len, start, finish, i; vec = argv[0]; + if (SCHEME_NP_CHAPERONEP(vec)) + vec = SCHEME_CHAPERONE_VAL(vec); if (!SCHEME_VECTORP(vec)) scheme_wrong_type("vector->values", "vector", 0, argc, argv); @@ -552,15 +749,19 @@ static Scheme_Object *vector_to_values (int argc, Scheme_Object *argv[]) finish = len; if (!(start <= len)) { - bad_index("vector->values", argv[1], vec, 0); + bad_index("vector->values", argv[1], argv[0], 0); } if (!(finish >= start && finish <= len)) { - bad_index("vector->values", argv[2], vec, start); + bad_index("vector->values", argv[2], argv[0], start); } len = finish - start; - if (len == 1) - return SCHEME_VEC_ELS(vec)[start]; + if (len == 1) { + if (!SAME_OBJ(vec, argv[0])) + return scheme_chaperone_vector_ref(argv[0], start); + else + return SCHEME_VEC_ELS(vec)[start]; + } p = scheme_current_thread; if (p->values_buffer && (p->values_buffer_size >= len)) @@ -574,31 +775,76 @@ static Scheme_Object *vector_to_values (int argc, Scheme_Object *argv[]) p->ku.multiple.array = a; p->ku.multiple.count = len; - for (i = 0; i < len; i++) { - a[i] = SCHEME_VEC_ELS(vec)[start + i]; + if (!SAME_OBJ(vec, argv[0])) { + for (i = 0; i < len; i++) { + vec = scheme_chaperone_vector_ref(argv[0], start + i); + a[i] = vec; + } + } else { + for (i = 0; i < len; i++) { + a[i] = SCHEME_VEC_ELS(vec)[start + i]; + } } return SCHEME_MULTIPLE_VALUES; } +static Scheme_Object *chaperone_vector(int argc, Scheme_Object **argv) +{ + Scheme_Chaperone *px; + Scheme_Object *val = argv[0]; + Scheme_Object *redirects; + Scheme_Hash_Tree *props; + + if (SCHEME_CHAPERONEP(val)) + val = SCHEME_CHAPERONE_VAL(val); + + if (!SCHEME_VECTORP(val)) + scheme_wrong_type("chaperone-vector", "vector", 0, argc, argv); + scheme_check_proc_arity("chaperone-vector", 3, 1, argc, argv); + scheme_check_proc_arity("chaperone-vector", 3, 2, argc, argv); + + props = scheme_parse_chaperone_props("chaperone-vector", 3, argc, argv); + + redirects = scheme_make_pair(argv[1], argv[2]); + + px = MALLOC_ONE_TAGGED(Scheme_Chaperone); + px->so.type = scheme_chaperone_type; + px->props = props; + px->val = val; + px->prev = argv[0]; + px->redirects = redirects; + + return (Scheme_Object *)px; +} + /************************************************************/ /* unsafe */ /************************************************************/ static Scheme_Object *unsafe_vector_len (int argc, Scheme_Object *argv[]) { - long n = SCHEME_VEC_SIZE(argv[0]); + Scheme_Object *vec = argv[0]; + long n; + if (SCHEME_NP_CHAPERONEP(vec)) vec = SCHEME_CHAPERONE_VAL(vec); + n = SCHEME_VEC_SIZE(vec); return scheme_make_integer(n); } static Scheme_Object *unsafe_vector_ref (int argc, Scheme_Object *argv[]) { - return SCHEME_VEC_ELS(argv[0])[SCHEME_INT_VAL(argv[1])]; + if (SCHEME_NP_CHAPERONEP(argv[0])) + return scheme_chaperone_vector_ref(argv[0], SCHEME_INT_VAL(argv[1])); + else + return SCHEME_VEC_ELS(argv[0])[SCHEME_INT_VAL(argv[1])]; } static Scheme_Object *unsafe_vector_set (int argc, Scheme_Object *argv[]) { - SCHEME_VEC_ELS(argv[0])[SCHEME_INT_VAL(argv[1])] = argv[2]; + if (SCHEME_NP_CHAPERONEP(argv[0])) + scheme_chaperone_vector_set(argv[0], SCHEME_INT_VAL(argv[1]), argv[2]); + else + SCHEME_VEC_ELS(argv[0])[SCHEME_INT_VAL(argv[1])] = argv[2]; return scheme_void; } @@ -650,4 +896,3 @@ static Scheme_Object *unsafe_bytes_set (int argc, Scheme_Object *argv[]) SCHEME_BYTE_STR_VAL(argv[0])[SCHEME_INT_VAL(argv[1])] = (char)SCHEME_INT_VAL(argv[2]); return scheme_void; } - From 4ecf61f413520ebc0278842dd1dae1533fd0ace9 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sun, 28 Mar 2010 02:18:29 +0000 Subject: [PATCH 007/202] fix chaperone bugs uncovered by 64-bit build svn: r18651 --- src/mzscheme/src/struct.c | 2 +- src/mzscheme/src/vector.c | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/mzscheme/src/struct.c b/src/mzscheme/src/struct.c index 5e50001ce7..91a19306c7 100644 --- a/src/mzscheme/src/struct.c +++ b/src/mzscheme/src/struct.c @@ -1753,7 +1753,7 @@ static void chaperone_struct_set(const char *who, Scheme_Object *o, int i, Schem { while (1) { if (!SCHEME_CHAPERONEP(o)) { - SCHEME_VEC_ELS(o)[i] = v; + ((Scheme_Structure *)o)->slots[i] = v; return; } else { Scheme_Chaperone *px = (Scheme_Chaperone *)o; diff --git a/src/mzscheme/src/vector.c b/src/mzscheme/src/vector.c index 0213eb485a..f664cbaa55 100644 --- a/src/mzscheme/src/vector.c +++ b/src/mzscheme/src/vector.c @@ -364,7 +364,10 @@ void scheme_bad_vec_index(char *name, Scheme_Object *i, const char *what, Scheme static Scheme_Object * bad_index(char *name, Scheme_Object *i, Scheme_Object *vec, int bottom) { - scheme_bad_vec_index(name, i, "vector", vec, bottom, SCHEME_VEC_SIZE(vec)); + scheme_bad_vec_index(name, i, "vector", vec, bottom, + (SCHEME_NP_CHAPERONEP(vec) + ? SCHEME_VEC_SIZE(SCHEME_CHAPERONE_VAL(vec)) + : SCHEME_VEC_SIZE(vec))); return NULL; } @@ -491,7 +494,7 @@ scheme_checked_vector_set(int argc, Scheme_Object *argv[]) if (!SCHEME_MUTABLE_VECTORP(vec)) scheme_wrong_type("vector-set!", "mutable vector", 0, argc, argv); - len = SCHEME_VEC_SIZE(argv[0]); + len = SCHEME_VEC_SIZE(vec); i = scheme_extract_index("vector-set!", 1, argc, argv, len, 0); From 73e22ed86706ce62f25e10b809fa0f65b70193ba Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Sun, 28 Mar 2010 07:50:40 +0000 Subject: [PATCH 008/202] Welcome to a new PLT day. svn: r18652 --- collects/repos-time-stamp/stamp.ss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collects/repos-time-stamp/stamp.ss b/collects/repos-time-stamp/stamp.ss index 4245f95a31..75106dfab9 100644 --- a/collects/repos-time-stamp/stamp.ss +++ b/collects/repos-time-stamp/stamp.ss @@ -1 +1 @@ -#lang scheme/base (provide stamp) (define stamp "27mar2010") +#lang scheme/base (provide stamp) (define stamp "28mar2010") From 026356ecc552411aa8077bcecc7fab0c1cb58aae Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sun, 28 Mar 2010 14:08:30 +0000 Subject: [PATCH 009/202] update release notes; merge to 4.2.5 svn: r18653 --- doc/release-notes/mred/HISTORY.txt | 5 ++--- doc/release-notes/mzscheme/HISTORY.txt | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/release-notes/mred/HISTORY.txt b/doc/release-notes/mred/HISTORY.txt index 112dc6d5ea..d573599420 100644 --- a/doc/release-notes/mred/HISTORY.txt +++ b/doc/release-notes/mred/HISTORY.txt @@ -1,9 +1,8 @@ -Version 4.2.4.2 -Added accept-tab-focus method to canvas<%> and editor-canvas% +Version 4.2.5, March 2010 -Version 4.2.4.1 Changed radio-box% to allow #f as a selection so that no buttons are selected +Added accept-tab-focus method to canvas<%> and editor-canvas% ---------------------------------------------------------------------- diff --git a/doc/release-notes/mzscheme/HISTORY.txt b/doc/release-notes/mzscheme/HISTORY.txt index 6d453d777a..4acc8d6f9e 100644 --- a/doc/release-notes/mzscheme/HISTORY.txt +++ b/doc/release-notes/mzscheme/HISTORY.txt @@ -1,5 +1,6 @@ -Version 4.2.4.2 +Version 4.2.5, March 2010 Changed module to wrap each body expression in a prompt +Changed define-cstruct to bind type name for struct-out, etc. Version 4.2.4, January 2010 Added scheme/flonum and scheme/fixnum From b8c3112b98ba069084db1edbee2abe79f46fc9d5 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sun, 28 Mar 2010 15:56:04 +0000 Subject: [PATCH 010/202] fix chaperones on parameters svn: r18654 --- .../scribblings/reference/chaperones.scrbl | 5 ++ .../scribblings/reference/parameters.scrbl | 12 ++- collects/tests/mzscheme/chaperone.ss | 46 ++++++++++ src/mzscheme/src/eval.c | 2 +- src/mzscheme/src/fun.c | 87 +++++++++++++++---- src/mzscheme/src/schpriv.h | 2 +- src/mzscheme/src/struct.c | 47 ++++++---- src/mzscheme/src/stxobj.c | 2 +- src/mzscheme/src/thread.c | 20 ++++- 9 files changed, 182 insertions(+), 41 deletions(-) diff --git a/collects/scribblings/reference/chaperones.scrbl b/collects/scribblings/reference/chaperones.scrbl index 965516c6b8..ac71113d2a 100644 --- a/collects/scribblings/reference/chaperones.scrbl +++ b/collects/scribblings/reference/chaperones.scrbl @@ -102,6 +102,11 @@ that accepts as many results as produced by @scheme[proc]; it must return the same number of results, each of which is the same or a chaperone of the corresponding original result. +If @scheme[wrapper-proc] returns the same number of values as it is +given (i.e., it does not return a procedure to chaperone +@scheme[proc]'s result), then @scheme[proc] is called in @tech{tail +position} with respect to the call to the chaperone. + Pairs of @scheme[prop] and @scheme[prop-val] (the number of arguments to @scheme[procedure-chaperone] must be even) add chaperone properties or override chaperone-property values of @scheme[proc].} diff --git a/collects/scribblings/reference/parameters.scrbl b/collects/scribblings/reference/parameters.scrbl index 4c6e416c42..52ccc8c78d 100644 --- a/collects/scribblings/reference/parameters.scrbl +++ b/collects/scribblings/reference/parameters.scrbl @@ -141,18 +141,24 @@ Returns a parameter procedure that sets or retrieves the same value as @item{@scheme[wrap] applied when obtaining the parameter's value.} -]} +] + +See also @scheme[chaperone-procedure], which can also be used to guard +parameter procedures.} + @defproc[(parameter? [v any/c]) boolean?]{ Returns @scheme[#t] if @scheme[v] is a parameter procedure, @scheme[#f] otherwise.} + @defproc[(parameter-procedure=? [a parameter?][b parameter?]) boolean?]{ Returns @scheme[#t] if the parameter procedures @scheme[a] and -@scheme[b] always modify the same parameter with the same guards, -@scheme[#f] otherwise.} +@scheme[b] always modify the same parameter with the same guards +(although possibly with different @tech{chaperones}), @scheme[#f] +otherwise.} @defproc[(current-parameterization) parameterization?]{Returns the diff --git a/collects/tests/mzscheme/chaperone.ss b/collects/tests/mzscheme/chaperone.ss index 564b0ed65f..c2e5c79697 100644 --- a/collects/tests/mzscheme/chaperone.ss +++ b/collects/tests/mzscheme/chaperone.ss @@ -553,4 +553,50 @@ ;; ---------------------------------------- +(let () + (define (check-param current-directory) + (parameterize ([current-directory (current-directory)]) + (let* ([pre-cd? #f] + [post-cd? #f] + [got-cd? #f] + [post-got-cd? #f] + [cd1 (chaperone-procedure current-directory (case-lambda + [() (set! got-cd? #t) (values)] + [(v) (set! pre-cd? #t) v]))] + [cd2 (chaperone-procedure current-directory (case-lambda + [() (set! got-cd? #t) + (lambda (r) + (set! post-got-cd? #t) + r)] + [(v) + (set! pre-cd? #t) + (values v + (lambda (x) + (set! post-cd? #t) + (void)))]))]) + (test #t parameter? cd1) + (test #t parameter? cd2) + (test '(#f #f #f #f) list pre-cd? post-cd? got-cd? post-got-cd?) + (test (current-directory) cd1) + (test '(#f #f #t #f) list pre-cd? post-cd? got-cd? post-got-cd?) + (test (current-directory) cd2) + (test '(#f #f #t #t) list pre-cd? post-cd? got-cd? post-got-cd?) + (cd1 (current-directory)) + (test '(#t #f #t #t) list pre-cd? post-cd? got-cd? post-got-cd?) + (set! pre-cd? #f) + (parameterize ([cd1 (current-directory)]) + (test '(#t #f #t #t) list pre-cd? post-cd? got-cd? post-got-cd?)) + (set! pre-cd? #f) + (cd2 (current-directory)) + (test '(#t #t #t #t) list pre-cd? post-cd? got-cd? post-got-cd?) + (set! pre-cd? #f) + (set! post-cd? #f) + (parameterize ([cd2 (current-directory)]) + (test '(#t #t #t #t) list pre-cd? post-cd? got-cd? post-got-cd?))))) + (check-param current-directory) + (let ([p (make-parameter 88)]) + (check-param p))) + +;; ---------------------------------------- + (report-errs) diff --git a/src/mzscheme/src/eval.c b/src/mzscheme/src/eval.c index abee1311ea..b5c0282d6a 100644 --- a/src/mzscheme/src/eval.c +++ b/src/mzscheme/src/eval.c @@ -9196,7 +9196,7 @@ scheme_do_eval(Scheme_Object *obj, int num_rands, Scheme_Object **rands, /* Chaperone is for function arguments */ VACATE_TAIL_BUFFER_USE_RUNSTACK(); UPDATE_THREAD_RSPTR(); - v = scheme_apply_chaperone(obj, num_rands, rands); + v = scheme_apply_chaperone(obj, num_rands, rands, NULL); } } else if (type == scheme_closed_prim_type) { GC_CAN_IGNORE Scheme_Closed_Primitive_Proc *prim; diff --git a/src/mzscheme/src/fun.c b/src/mzscheme/src/fun.c index 5b9a51ffe1..5bfe3cd351 100644 --- a/src/mzscheme/src/fun.c +++ b/src/mzscheme/src/fun.c @@ -31,6 +31,7 @@ #include "schpriv.h" #include "schexpobs.h" +#include "schmach.h" /* The implementations of the time primitives, such as `current-seconds', vary a lot from platform to platform. */ @@ -4007,7 +4008,7 @@ static Scheme_Object *chaperone_procedure(int argc, Scheme_Object *argv[]) if (!is_subarity(orig, naya)) scheme_raise_exn(MZEXN_FAIL_CONTRACT, - "chaperone-procedure: arity of chaperoneing procedure: %V" + "chaperone-procedure: arity of chaperoning procedure: %V" " does not cover arity of original procedure: %V", argv[1], argv[0]); @@ -4024,10 +4025,46 @@ static Scheme_Object *chaperone_procedure(int argc, Scheme_Object *argv[]) return (Scheme_Object *)px; } -Scheme_Object *scheme_apply_chaperone(Scheme_Object *o, int argc, Scheme_Object **argv) +static Scheme_Object *apply_chaperone_k(void) +{ + Scheme_Thread *p = scheme_current_thread; + Scheme_Object *o = (Scheme_Object *)p->ku.k.p1; + Scheme_Object **argv = (Scheme_Object **)p->ku.k.p2; + Scheme_Object *auto_val = (Scheme_Object *)p->ku.k.p3; + + p->ku.k.p1 = NULL; + p->ku.k.p2 = NULL; + p->ku.k.p3 = NULL; + + return scheme_apply_chaperone(o, p->ku.k.i1, argv, auto_val); +} + +static Scheme_Object *do_apply_chaperone(Scheme_Object *o, int argc, Scheme_Object **argv, Scheme_Object *auto_val) +{ + #ifdef DO_STACK_CHECK + { +# include "mzstkchk.h" + { + Scheme_Thread *p = scheme_current_thread; + Scheme_Object **argv2; + argv2 = MALLOC_N(Scheme_Object*, argc); + memcpy(argv2, argv, sizeof(Scheme_Object *) * argc); + p->ku.k.p1 = (void *)o; + p->ku.k.p2 = (void *)argv2; + p->ku.k.p3 = (void *)auto_val; + p->ku.k.i1 = argc; + return scheme_handle_stack_overflow(apply_chaperone_k); + } + } +#endif + + return scheme_apply_chaperone(o, argc, argv, auto_val); +} + +Scheme_Object *scheme_apply_chaperone(Scheme_Object *o, int argc, Scheme_Object **argv, Scheme_Object *auto_val) { Scheme_Chaperone *px = (Scheme_Chaperone *)o; - Scheme_Object *v, *a[1], *a2[1], **argv2, *post; + Scheme_Object *v, *a[1], *a2[1], **argv2, *post, *result_v; int c, i; v = _scheme_apply_multi(px->redirects, argc, argv); @@ -4069,7 +4106,14 @@ Scheme_Object *scheme_apply_chaperone(Scheme_Object *o, int argc, Scheme_Object if (c == argc) { /* No filter for the result, so tail call: */ - return scheme_tail_apply(px->prev, c, argv2); + if (auto_val) { + if (SCHEME_CHAPERONEP(px->prev)) + return do_apply_chaperone(px->prev, c, argv2, auto_val); + else + return argv2[0]; + } else { + return scheme_tail_apply(px->prev, c, argv2); + } } else { /* Last element is a filter for the result(s) */ post = argv2[argc]; @@ -4078,7 +4122,16 @@ Scheme_Object *scheme_apply_chaperone(Scheme_Object *o, int argc, Scheme_Object "procedure chaperone: %V: expected as last result, produced: %V", px->redirects, post); - v = _scheme_apply_multi(px->prev, argc, argv2); + if (auto_val) { + if (SCHEME_CHAPERONEP(px->prev)) + result_v = do_apply_chaperone(px->prev, argc, argv2, auto_val); + else + result_v = argv2[0]; + v = auto_val; + } else { + v = _scheme_apply_multi(px->prev, argc, argv2); + result_v = NULL; + } if (v == SCHEME_MULTIPLE_VALUES) { GC_CAN_IGNORE Scheme_Thread *p = scheme_current_thread; if (SAME_OBJ(p->ku.multiple.array, p->values_buffer)) @@ -4114,16 +4167,16 @@ Scheme_Object *scheme_apply_chaperone(Scheme_Object *o, int argc, Scheme_Object for (i = 0; i < argc; i++) { if (!scheme_chaperone_of(argv2[i], argv[i])) { if (argc == 1) - scheme_raise_exn(MZEXN_FAIL_CONTRACT_ARITY, - "procedure-result chaperone: %V: result: %V is not a chaperone of original result: %V", - post, - argv2[i], argv[i]); - else - scheme_raise_exn(MZEXN_FAIL_CONTRACT_ARITY, - "procedure-result chaperone: %V: %d%s result: %V is not a chaperone of original result: %V", - post, - i, scheme_number_suffix(i), - argv2[i], argv[i]); + scheme_raise_exn(MZEXN_FAIL_CONTRACT_ARITY, + "procedure-result chaperone: %V: result: %V is not a chaperone of original result: %V", + post, + argv2[i], argv[i]); + else + scheme_raise_exn(MZEXN_FAIL_CONTRACT_ARITY, + "procedure-result chaperone: %V: %d%s result: %V is not a chaperone of original result: %V", + post, + i, scheme_number_suffix(i), + argv2[i], argv[i]); } } } else { @@ -4134,7 +4187,9 @@ Scheme_Object *scheme_apply_chaperone(Scheme_Object *o, int argc, Scheme_Object return NULL; } - if (c == 1) + if (result_v) + return result_v; + else if (c == 1) return argv2[0]; else return scheme_values(c, argv2); diff --git a/src/mzscheme/src/schpriv.h b/src/mzscheme/src/schpriv.h index c02c46f042..dcc6e14287 100644 --- a/src/mzscheme/src/schpriv.h +++ b/src/mzscheme/src/schpriv.h @@ -768,7 +768,7 @@ typedef struct Scheme_Chaperone { Scheme_Object *scheme_chaperone_vector_ref(Scheme_Object *o, int i); void scheme_chaperone_vector_set(Scheme_Object *o, int i, Scheme_Object *v); -Scheme_Object *scheme_apply_chaperone(Scheme_Object *o, int argc, Scheme_Object **argv); +Scheme_Object *scheme_apply_chaperone(Scheme_Object *o, int argc, Scheme_Object **argv, Scheme_Object *auto_val); Scheme_Hash_Tree *scheme_parse_chaperone_props(const char *who, int start_at, int argc, Scheme_Object **argv); diff --git a/src/mzscheme/src/struct.c b/src/mzscheme/src/struct.c index 91a19306c7..940250f835 100644 --- a/src/mzscheme/src/struct.c +++ b/src/mzscheme/src/struct.c @@ -2714,10 +2714,12 @@ int scheme_inspector_sees_part(Scheme_Object *s, Scheme_Object *insp, int pos) static Scheme_Object * struct_setter_p(int argc, Scheme_Object *argv[]) { - return ((STRUCT_mPROCP(argv[0], + Scheme_Object *v = argv[0]; + if (SCHEME_CHAPERONEP(v)) v = SCHEME_CHAPERONE_VAL(v); + return ((STRUCT_mPROCP(v, SCHEME_PRIM_IS_STRUCT_OTHER | SCHEME_PRIM_OTHER_TYPE_MASK, SCHEME_PRIM_IS_STRUCT_OTHER | SCHEME_PRIM_STRUCT_TYPE_INDEXED_SETTER) - || STRUCT_mPROCP(argv[0], + || STRUCT_mPROCP(v, SCHEME_PRIM_IS_STRUCT_OTHER | SCHEME_PRIM_OTHER_TYPE_MASK, SCHEME_PRIM_IS_STRUCT_OTHER | SCHEME_PRIM_STRUCT_TYPE_INDEXLESS_SETTER)) ? scheme_true : scheme_false); @@ -2726,8 +2728,10 @@ struct_setter_p(int argc, Scheme_Object *argv[]) static Scheme_Object * struct_getter_p(int argc, Scheme_Object *argv[]) { - return ((STRUCT_PROCP(argv[0], SCHEME_PRIM_IS_STRUCT_INDEXED_GETTER) - || STRUCT_mPROCP(argv[0], + Scheme_Object *v = argv[0]; + if (SCHEME_CHAPERONEP(v)) v = SCHEME_CHAPERONE_VAL(v); + return ((STRUCT_PROCP(v, SCHEME_PRIM_IS_STRUCT_INDEXED_GETTER) + || STRUCT_mPROCP(v, SCHEME_PRIM_IS_STRUCT_OTHER | SCHEME_PRIM_OTHER_TYPE_MASK, SCHEME_PRIM_IS_STRUCT_OTHER | SCHEME_PRIM_STRUCT_TYPE_INDEXLESS_GETTER)) ? scheme_true : scheme_false); @@ -2736,14 +2740,18 @@ struct_getter_p(int argc, Scheme_Object *argv[]) static Scheme_Object * struct_pred_p(int argc, Scheme_Object *argv[]) { - return (STRUCT_PROCP(argv[0], SCHEME_PRIM_IS_STRUCT_PRED) + Scheme_Object *v = argv[0]; + if (SCHEME_CHAPERONEP(v)) v = SCHEME_CHAPERONE_VAL(v); + return (STRUCT_PROCP(v, SCHEME_PRIM_IS_STRUCT_PRED) ? scheme_true : scheme_false); } static Scheme_Object * struct_constr_p(int argc, Scheme_Object *argv[]) { - return (STRUCT_mPROCP(argv[0], + Scheme_Object *v = argv[0]; + if (SCHEME_CHAPERONEP(v)) v = SCHEME_CHAPERONE_VAL(v); + return (STRUCT_mPROCP(v, SCHEME_PRIM_IS_STRUCT_OTHER | SCHEME_PRIM_OTHER_TYPE_MASK, SCHEME_PRIM_IS_STRUCT_OTHER | SCHEME_PRIM_STRUCT_TYPE_CONSTR) ? scheme_true : scheme_false); @@ -2752,20 +2760,24 @@ struct_constr_p(int argc, Scheme_Object *argv[]) static Scheme_Object * struct_prop_getter_p(int argc, Scheme_Object *argv[]) { - return ((STRUCT_mPROCP(argv[0], + Scheme_Object *v = argv[0]; + if (SCHEME_CHAPERONEP(v)) v = SCHEME_CHAPERONE_VAL(v); + return ((STRUCT_mPROCP(v, SCHEME_PRIM_OTHER_TYPE_MASK, SCHEME_PRIM_TYPE_STRUCT_PROP_GETTER) - && SAME_TYPE(SCHEME_TYPE(SCHEME_PRIM_CLOSURE_ELS(argv[0])[0]), scheme_struct_property_type)) + && SAME_TYPE(SCHEME_TYPE(SCHEME_PRIM_CLOSURE_ELS(v)[0]), scheme_struct_property_type)) ? scheme_true : scheme_false); } static Scheme_Object * chaperone_prop_getter_p(int argc, Scheme_Object *argv[]) { - return ((STRUCT_mPROCP(argv[0], + Scheme_Object *v = argv[0]; + if (SCHEME_CHAPERONEP(v)) v = SCHEME_CHAPERONE_VAL(v); + return ((STRUCT_mPROCP(v, SCHEME_PRIM_OTHER_TYPE_MASK, SCHEME_PRIM_TYPE_STRUCT_PROP_GETTER) - && SAME_TYPE(SCHEME_TYPE(SCHEME_PRIM_CLOSURE_ELS(argv[0])[0]), scheme_chaperone_property_type)) + && SAME_TYPE(SCHEME_TYPE(SCHEME_PRIM_CLOSURE_ELS(v)[0]), scheme_chaperone_property_type)) ? scheme_true : scheme_false); } @@ -2779,6 +2791,9 @@ static Scheme_Object *make_struct_field_xxor(const char *who, int getter, char digitbuf[20]; int fieldstrlen; + /* We don't allow chaperones on the getter or setter procedure, because we + can't preserve them in the generated procedure. */ + if (!STRUCT_mPROCP(argv[0], SCHEME_PRIM_IS_STRUCT_OTHER | SCHEME_PRIM_OTHER_TYPE_MASK, SCHEME_PRIM_IS_STRUCT_OTHER | (getter @@ -4564,8 +4579,10 @@ static Scheme_Object *chaperone_struct(int argc, Scheme_Object **argv) props = scheme_parse_chaperone_props("chaperone-box", i, argc, argv); break; } + a[0] = proc; + if (SCHEME_CHAPERONEP(proc)) proc = SCHEME_CHAPERONE_VAL(proc); if (SCHEME_TRUEP(struct_setter_p(1, a))) { kind = "mutator"; offset = stype->num_slots; @@ -4589,7 +4606,7 @@ static Scheme_Object *chaperone_struct(int argc, Scheme_Object **argv) if (si_chaperone) scheme_raise_exn(MZEXN_FAIL_CONTRACT, "chaperone-struct: struct-info procedure supplied a second time: %V", - proc); + a[0]); pi = NULL; prop = NULL; arity = 2; @@ -4601,7 +4618,7 @@ static Scheme_Object *chaperone_struct(int argc, Scheme_Object **argv) scheme_raise_exn(MZEXN_FAIL_CONTRACT, "chaperone-struct: %s %V does not apply to given object: %V", kind, - proc, + a[0], argv[0]); if (!red_props) red_props = scheme_make_hash_tree(0); @@ -4610,7 +4627,7 @@ static Scheme_Object *chaperone_struct(int argc, Scheme_Object **argv) scheme_raise_exn(MZEXN_FAIL_CONTRACT, "chaperone-struct: given %s is for the same property as a previous %s argument: %V", kind, kind, - proc); + a[0]); arity = 2; } else { pi = (Struct_Proc_Info *)((Scheme_Primitive_Closure *)proc)->val[0]; @@ -4620,13 +4637,13 @@ static Scheme_Object *chaperone_struct(int argc, Scheme_Object **argv) scheme_raise_exn(MZEXN_FAIL_CONTRACT, "chaperone-struct: %s %V does not apply to given object: %V", kind, - proc, + a[0], argv[0]); if (SCHEME_VEC_ELS(redirects)[PRE_REDIRECTS + offset + pi->field]) scheme_raise_exn(MZEXN_FAIL_CONTRACT, "chaperone-struct: given %s is for the same field as a previous %s argument: %V", kind, kind, - proc); + a[0]); arity = 2; } diff --git a/src/mzscheme/src/stxobj.c b/src/mzscheme/src/stxobj.c index 796c3fa707..c14bca9f5e 100644 --- a/src/mzscheme/src/stxobj.c +++ b/src/mzscheme/src/stxobj.c @@ -8034,7 +8034,7 @@ static Scheme_Object *datum_to_syntax_inner(Scheme_Object *o, while (i != -1) { scheme_hash_tree_index(ht1, i, &key, &val); if (!SAME_OBJ((Scheme_Object *)ht1, o)) - val = scheme_chaperone_hash_traversal_get(ht1, key); + val = scheme_chaperone_hash_traversal_get(o, key); val = datum_to_syntax_inner(val, ut, stx_src, stx_wraps, ht); if (!val) return NULL; ht2 = scheme_hash_tree_set(ht2, key, val); diff --git a/src/mzscheme/src/thread.c b/src/mzscheme/src/thread.c index b0a952393b..f95c097f00 100644 --- a/src/mzscheme/src/thread.c +++ b/src/mzscheme/src/thread.c @@ -6351,13 +6351,20 @@ static Scheme_Object *extend_parameterization(int argc, Scheme_Object *argv[]) scheme_flatten_config(c); } else if (SCHEME_CONFIGP(c) && (argc & 1)) { for (i = 1; i < argc; i += 2) { - if (!SCHEME_PARAMETERP(argv[i])) { + param = argv[i]; + if (!SCHEME_PARAMETERP(param) + && !(SCHEME_CHAPERONEP(param) && SCHEME_PARAMETERP(SCHEME_CHAPERONE_VAL(param)))) { scheme_wrong_type("parameterize", "parameter", i, argc, argv); return NULL; } - a[0] = argv[i + 1]; + key = argv[i + 1]; + if (SCHEME_CHAPERONEP(param)) { + a[0] = key; + key = scheme_apply_chaperone(param, 1, a, scheme_void); + param = SCHEME_CHAPERONE_VAL(param); + } + a[0] = key; a[1] = scheme_false; - param = argv[i]; while (1) { if (SCHEME_PRIMP(param)) { Scheme_Prim *proc; @@ -6421,6 +6428,8 @@ static Scheme_Object *parameter_p(int argc, Scheme_Object **argv) { Scheme_Object *v = argv[0]; + if (SCHEME_CHAPERONEP(v)) v = SCHEME_CHAPERONE_VAL(v); + return (SCHEME_PARAMETERP(v) ? scheme_true : scheme_false); @@ -6509,7 +6518,7 @@ static Scheme_Object *make_derived_parameter(int argc, Scheme_Object **argv) ParamData *data; if (!SCHEME_PARAMETERP(argv[0])) - scheme_wrong_type("make-derived-parameter", "parameter", 0, argc, argv); + scheme_wrong_type("make-derived-parameter", "unchaperoned parameter", 0, argc, argv); scheme_check_proc_arity("make-derived-parameter", 1, 1, argc, argv); scheme_check_proc_arity("make-derived-parameter", 1, 2, argc, argv); @@ -6537,6 +6546,9 @@ static Scheme_Object *parameter_procedure_eq(int argc, Scheme_Object **argv) a = argv[0]; b = argv[1]; + if (SCHEME_CHAPERONEP(a)) a = SCHEME_CHAPERONE_VAL(a); + if (SCHEME_CHAPERONEP(b)) b = SCHEME_CHAPERONE_VAL(b); + if (!SCHEME_PARAMETERP(a)) scheme_wrong_type("parameter-procedure=?", "parameter-procedure", 0, argc, argv); if (!SCHEME_PARAMETERP(b)) From 8de7c3615aab6116cd653553c27d995a1e8d9dce Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Mon, 29 Mar 2010 07:50:18 +0000 Subject: [PATCH 011/202] Welcome to a new PLT day. svn: r18658 --- collects/repos-time-stamp/stamp.ss | 2 +- src/worksp/mred/mred.manifest | 2 +- src/worksp/mred/mred.rc | 8 ++++---- src/worksp/mzcom/mzcom.rc | 8 ++++---- src/worksp/mzcom/mzobj.rgs | 6 +++--- src/worksp/mzscheme/mzscheme.rc | 8 ++++---- src/worksp/starters/start.rc | 8 ++++---- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/collects/repos-time-stamp/stamp.ss b/collects/repos-time-stamp/stamp.ss index 75106dfab9..909a731722 100644 --- a/collects/repos-time-stamp/stamp.ss +++ b/collects/repos-time-stamp/stamp.ss @@ -1 +1 @@ -#lang scheme/base (provide stamp) (define stamp "28mar2010") +#lang scheme/base (provide stamp) (define stamp "29mar2010") diff --git a/src/worksp/mred/mred.manifest b/src/worksp/mred/mred.manifest index 8562626f1b..fe2f1b93c4 100644 --- a/src/worksp/mred/mred.manifest +++ b/src/worksp/mred/mred.manifest @@ -1,7 +1,7 @@ Date: Mon, 29 Mar 2010 12:58:13 +0000 Subject: [PATCH 012/202] Fix the SchemeUnit test suite so it runs without error following changed introduced in r18618. svn: r18659 --- .../tests/schemeunit/all-schemeunit-tests.ss | 1 + collects/tests/schemeunit/run-tests.ss | 5 ++- collects/tests/schemeunit/text-ui-test.ss | 41 +++++++++++-------- 3 files changed, 28 insertions(+), 19 deletions(-) diff --git a/collects/tests/schemeunit/all-schemeunit-tests.ss b/collects/tests/schemeunit/all-schemeunit-tests.ss index a25deb45e6..1b8282f295 100644 --- a/collects/tests/schemeunit/all-schemeunit-tests.ss +++ b/collects/tests/schemeunit/all-schemeunit-tests.ss @@ -41,6 +41,7 @@ format-tests )) +;; These tests fail. The are intended to do this so a human can manually check the output they produce. They should not be run by DrDr as they will generate bogus warnings. (define success-and-failure-tests (test-suite "Successes and Failures" diff --git a/collects/tests/schemeunit/run-tests.ss b/collects/tests/schemeunit/run-tests.ss index 8b5125ce5a..e5346f38ad 100644 --- a/collects/tests/schemeunit/run-tests.ss +++ b/collects/tests/schemeunit/run-tests.ss @@ -4,6 +4,7 @@ schemeunit/text-ui "all-schemeunit-tests.ss") -;(run-tests all-schemeunit-tests) +(run-tests all-schemeunit-tests) -(run-tests success-and-failure-tests) +;; Don't run the failing tests by default. Switch the comments if you want to inspect the visual appearance of failing test's output. +;(run-tests success-and-failure-tests) diff --git a/collects/tests/schemeunit/text-ui-test.ss b/collects/tests/schemeunit/text-ui-test.ss index 9116a295c9..ca7d336a82 100644 --- a/collects/tests/schemeunit/text-ui-test.ss +++ b/collects/tests/schemeunit/text-ui-test.ss @@ -1,5 +1,5 @@ ;;; -;;; Time-stamp: <2008-07-31 10:11:42 noel> +;;; Time-stamp: <2010-03-29 13:56:54 noel> ;;; ;;; Copyright (C) 2005 by Noel Welsh. ;;; @@ -48,12 +48,22 @@ expr ...) (get-output-string p))])) +(define-syntax with-error-to-string + (syntax-rules () + [(with-error-to-string expr ...) + (let ([p (open-output-string)]) + (parameterize ([current-error-port p]) + expr ...) + (get-output-string p))])) + (define-runtime-path here ".") ;; with-silent-output (() -> any) -> any (define (with-silent-output thunk) - (let ((op (open-output-string))) - (parameterize ((current-output-port op)) + (let ([out (open-output-string)] + [err (open-output-string)]) + (parameterize ([current-output-port out] + [current-error-port err]) (thunk)))) (define (failing-test) @@ -99,7 +109,7 @@ (test-case "Binary check displays actual and expected in failure error message" - (let ((op (with-output-to-string (failing-test)))) + (let ((op (with-error-to-string (failing-test)))) (check string-contains op "expected") @@ -109,14 +119,14 @@ (test-case "Binary check doesn't display params" - (let ((op (with-output-to-string (failing-test)))) + (let ((op (with-error-to-string (failing-test)))) (check (lambda (out str) (not (string-contains out str))) op "params"))) (test-case "Binary check output is pretty printed" - (let ([op (with-output-to-string (failing-binary-test/complex-params))]) + (let ([op (with-error-to-string (failing-binary-test/complex-params))]) (check string-contains op "((0 1 2 3 4 5 6 7 8 9 10 11 12 13 14) @@ -125,7 +135,7 @@ (test-case "Non-binary check output is pretty printed" - (let ([op (with-output-to-string (failing-test/complex-params))]) + (let ([op (with-error-to-string (failing-test/complex-params))]) (check string-contains op "((0 1 2 3 4 5 6 7 8 9 10 11 12 13 14) @@ -135,14 +145,14 @@ (test-case "Location trimmed when file is under current directory" (parameterize ((current-directory here)) - (let ((op (with-output-to-string (failing-test)))) + (let ((op (with-error-to-string (failing-test)))) (check string-contains op "location: text-ui-test.ss")))) (test-case "Name and location displayed before actual/expected" - (let ((op (with-output-to-string (failing-test)))) + (let ((op (with-error-to-string (failing-test)))) (let ((name-idx (string-contains op "name:")) (loc-idx (string-contains op "location:")) (actual-idx (string-contains op "actual:")) @@ -153,14 +163,11 @@ (test-case "Quiet mode is quiet" - (let ((op1 (with-output-to-string (quiet-failing-test))) - (op2 (with-output-to-string (quiet-error-test)))) - (check string=? - op1 - "0 success(es) 1 failure(s) 0 error(s) 1 test(s) run\n") - (check string=? - op2 - "0 success(es) 0 failure(s) 1 error(s) 1 test(s) run\n"))) + (let ((op1 (with-error-to-string (quiet-failing-test))) + (op2 (with-error-to-string (quiet-error-test)))) + (check string=? op1 "") + (check string=? op2 ""))) + (test-case "Number of unsuccessful tests returned" (check-equal? (with-silent-output failing-test) 1) From 2bda6af6b02395fede04e81a4fdf97753ddf4fb6 Mon Sep 17 00:00:00 2001 From: Sam Tobin-Hochstadt Date: Mon, 29 Mar 2010 15:01:29 +0000 Subject: [PATCH 013/202] Fix obvious bug. svn: r18660 --- collects/framework/private/decode.ss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collects/framework/private/decode.ss b/collects/framework/private/decode.ss index 47fdae061a..0944528ec1 100644 --- a/collects/framework/private/decode.ss +++ b/collects/framework/private/decode.ss @@ -6,7 +6,7 @@ (define-syntax (module-begin stx) (syntax-case stx () [(_ x ...) - (andmap (lambda (x) (or identifier? (integer? (syntax-e x)))) + (andmap (lambda (x) (or (identifier? x) (integer? (syntax-e x)))) (syntax->list #'(x ...))) (let* ([data (format "~a" (syntax->datum #'(x ...)))] [data (substring data 1 (sub1 (string-length data)))] From baab09fc1b3cb37b31c13920db230b28e7bde4f0 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Mon, 29 Mar 2010 15:06:47 +0000 Subject: [PATCH 014/202] drop the uglier half of the Mac OS X thread-local variable hack; thread GC state through mark functions (to avoid overhead of thread-local accesses); fix some procedure-arity bugs and work toward fixing chaperones and some other procedure operations on keyword procedures svn: r18661 --- collects/scheme/private/kw.ss | 88 +- collects/scheme/private/pre-base.ss | 7 +- collects/tests/mzscheme/chaperone.ss | 6 + collects/tests/mzscheme/procs.ss | 11 +- doc/release-notes/mzscheme/HISTORY.txt | 1 + src/mzscheme/gc2/Makefile.in | 2 +- src/mzscheme/gc2/gc2.h | 25 + src/mzscheme/gc2/mem_account.c | 30 +- src/mzscheme/gc2/newgc.c | 148 +- src/mzscheme/gc2/newgc.h | 4 +- src/mzscheme/gc2/var_stack.c | 10 +- src/mzscheme/gc2/weak.c | 48 +- src/mzscheme/include/schthread.h | 4 +- src/mzscheme/src/fun.c | 24 +- src/mzscheme/src/jit.c | 15 +- src/mzscheme/src/mkmark.ss | 10 +- src/mzscheme/src/mzmark.c | 3562 ++++++++++++------------ src/mzscheme/src/mzmarksrc.c | 1302 ++++----- src/mzscheme/src/salloc.c | 50 +- src/mzscheme/src/type.c | 60 +- 20 files changed, 2761 insertions(+), 2646 deletions(-) diff --git a/collects/scheme/private/kw.ss b/collects/scheme/private/kw.ss index 42c9d450ea..09f93893d1 100644 --- a/collects/scheme/private/kw.ss +++ b/collects/scheme/private/kw.ss @@ -18,7 +18,10 @@ keyword-apply procedure-keywords procedure-reduce-keyword-arity - new-prop:procedure) + new-prop:procedure + new:procedure->method + new:procedure-rename + new:chaperone-procedure) ;; ---------------------------------------- @@ -854,8 +857,10 @@ (let loop ([kws kws][req-kws req-kws]) (if (null? req-kws) (null? kws) - (and (eq? (car kws) (car req-kws)) - (loop (cdr kws) (cdr req-kws)))))) + (if (null? kws) + #f + (and (eq? (car kws) (car req-kws)) + (loop (cdr kws) (cdr req-kws))))))) (arity-check-lambda (kws) ;; Required is a subset of allowed @@ -970,8 +975,8 @@ ;; setting procedure arity (define (procedure-reduce-keyword-arity proc arity req-kw allowed-kw) - (let ([plain-proc (procedure-reduce-arity (if (okp? proc) - (okp-ref proc 0) + (let ([plain-proc (procedure-reduce-arity (if (okp? proc) + (okp-ref proc 0) proc) arity)]) (define (sorted? kws) @@ -1022,17 +1027,62 @@ (raise-mismatch-error 'procedure-reduce-keyword-arity "cannot allow keywords not in original allowed set: " old-allowed)))) - (let ([new-arity (let loop ([a arity]) - (cond - [(integer? a) (+ a 2)] - [(arity-at-least? a) - (make-arity-at-least (+ (arity-at-least-value a) 2))] - [else - (map loop a)]))]) - (make-optional-keyword-procedure - (make-keyword-checker req-kw allowed-kw new-arity) - (procedure-reduce-arity (keyword-procedure-proc proc) - new-arity) - req-kw - allowed-kw - plain-proc))))) + (if (null? allowed-kw) + plain-proc + (let* ([inc-arity (lambda (arity delta) + (let loop ([a arity]) + (cond + [(integer? a) (+ a delta)] + [(arity-at-least? a) + (make-arity-at-least (+ (arity-at-least-value a) delta))] + [else + (map loop a)])))] + [new-arity (inc-arity arity 2)] + [kw-checker (make-keyword-checker req-kw allowed-kw new-arity)] + [new-kw-proc (procedure-reduce-arity (keyword-procedure-proc proc) + new-arity)]) + (if (null? req-kw) + ;; All keywords are optional: + ((if (okm? proc) + make-optional-keyword-method + make-optional-keyword-procedure) + kw-checker + new-kw-proc + req-kw + allowed-kw + plain-proc) + ;; Some keywords are required, so "plain" proc is + ;; irrelevant; we build a new one that wraps `missing-kws'. + ((make-required (or (and (named-keyword-procedure? proc) + (keyword-procedure-name proc)) + (object-name proc)) + (procedure-reduce-arity + missing-kw + (inc-arity arity 1)) + (or (okm? proc) + (keyword-method? proc))) + kw-checker + new-kw-proc + req-kw + allowed-kw)))))) + + (define new:procedure->method + (let ([procedure->method + (lambda (proc) + (procedure->method proc))]) + procedure->method)) + + (define new:procedure-rename + (let ([procedure-rename + (lambda (proc name) + (if (not (and (keyword-procedure? proc) + (symbol? name))) + (procedure-rename proc name) + (procedure-rename proc name)))]) + procedure-rename)) + + (define new:chaperone-procedure + (let ([chaperone-procedure + (lambda (proc wrap-proc . props) + (apply chaperone-procedure proc wrap-proc props))]) + chaperone-procedure))) diff --git a/collects/scheme/private/pre-base.ss b/collects/scheme/private/pre-base.ss index a887b38af1..ee2bc2fd32 100644 --- a/collects/scheme/private/pre-base.ss +++ b/collects/scheme/private/pre-base.ss @@ -73,8 +73,13 @@ (rename module-begin #%module-begin) (rename norm:procedure-arity procedure-arity) (rename norm:raise-arity-error raise-arity-error) + (rename new:procedure->method procedure->method) + (rename new:procedure-rename procedure-rename) + (rename new:chaperone-procedure chaperone-procedure) (all-from-except '#%kernel lambda λ #%app #%module-begin apply prop:procedure - procedure-arity raise-arity-error) + procedure-arity raise-arity-error + procedure->method procedure-rename + chaperone-procedure) (all-from "reqprov.ss") (all-from "for.ss") (all-from "kernstruct.ss") diff --git a/collects/tests/mzscheme/chaperone.ss b/collects/tests/mzscheme/chaperone.ss index c2e5c79697..d3e22b0af1 100644 --- a/collects/tests/mzscheme/chaperone.ss +++ b/collects/tests/mzscheme/chaperone.ss @@ -314,6 +314,12 @@ [a2 (if rev? (chaperone-struct a3 a-y (lambda (a v) (set! get v) v)) a2)]) + (test #t a? a1) + (test #t a? a2) + (test #t a? a3) + (test #t procedure? a1) + (test #t procedure? a2) + (test #t procedure? a3) (test '(12 12) a1 12) (test #f values get) (test #f values pre) diff --git a/collects/tests/mzscheme/procs.ss b/collects/tests/mzscheme/procs.ss index 8d4b214ff3..0d2991a598 100644 --- a/collects/tests/mzscheme/procs.ss +++ b/collects/tests/mzscheme/procs.ss @@ -68,7 +68,7 @@ (for-each (lambda (p) (let ([a (cadr p)]) (test a procedure-arity (car p)) - (test-values (list (caddr p) (cadddr p)) + (test-values (list (caddr p) (cadddr p)) (lambda () (procedure-keywords (car p)))) (let ([1-ok? (let loop ([a a]) @@ -78,7 +78,14 @@ (and (list? a) (ormap loop a))))]) (test 1-ok? procedure-arity-includes? (car p) 1) - (let ([allowed (cadddr p)]) + (let ([allowed (cadddr p)] + [required (caddr p)]) + ;; If some keyword is required, make sure that a plain + ;; application fails: + (unless (null? required) + (err/rt-test + (apply (car p) (make-list (procedure-arity (car p)) #\0)))) + ;; Other tests: (if 1-ok? (cond [(equal? allowed '()) diff --git a/doc/release-notes/mzscheme/HISTORY.txt b/doc/release-notes/mzscheme/HISTORY.txt index 4acc8d6f9e..1e0861912c 100644 --- a/doc/release-notes/mzscheme/HISTORY.txt +++ b/doc/release-notes/mzscheme/HISTORY.txt @@ -1,4 +1,5 @@ Version 4.2.5, March 2010 +Added scheme/future, enabled by default on main platforms Changed module to wrap each body expression in a prompt Changed define-cstruct to bind type name for struct-out, etc. diff --git a/src/mzscheme/gc2/Makefile.in b/src/mzscheme/gc2/Makefile.in index 4b85e3be07..16642f4d95 100644 --- a/src/mzscheme/gc2/Makefile.in +++ b/src/mzscheme/gc2/Makefile.in @@ -269,7 +269,7 @@ list.@LTO@: $(XSRCDIR)/list.c $(CC) $(CFLAGS) -c $(XSRCDIR)/list.c -o list.@LTO@ module.@LTO@: $(XSRCDIR)/module.c $(CC) $(CFLAGS) -c $(XSRCDIR)/module.c -o module.@LTO@ -mzrt.@LTO@: $(SRCDIR)/mzrt.c $(SRCDIR)/mzrt.h +mzrt.@LTO@: $(SRCDIR)/mzrt.c $(SRCDIR)/mzrt.h $(XFORMDEP) $(CC) $(CFLAGS) -DMZ_PRECISE_GC -c $(SRCDIR)/mzrt.c -o mzrt.@LTO@ network.@LTO@: $(XSRCDIR)/network.c $(CC) $(CFLAGS) -c $(XSRCDIR)/network.c -o network.@LTO@ diff --git a/src/mzscheme/gc2/gc2.h b/src/mzscheme/gc2/gc2.h index 1d90093f1d..4afc1858a3 100644 --- a/src/mzscheme/gc2/gc2.h +++ b/src/mzscheme/gc2/gc2.h @@ -15,9 +15,14 @@ #ifndef GC2_JUST_MACROS +struct NewGC; + typedef int (*Size_Proc)(void *obj); +typedef int (*Size2_Proc)(void *obj, struct NewGC *); typedef int (*Mark_Proc)(void *obj); +typedef int (*Mark2_Proc)(void *obj, struct NewGC *); typedef int (*Fixup_Proc)(void *obj); +typedef int (*Fixup2_Proc)(void *obj, struct NewGC *); typedef void (*GC_collect_start_callback_Proc)(void); typedef void (*GC_collect_end_callback_Proc)(void); typedef void (*GC_collect_inform_callback_Proc)(int major_gc, long pre_used, long post_used); @@ -288,6 +293,8 @@ GC2_EXTERN void GC_set_variable_stack(void **p); GC2_EXTERN void GC_register_traversers(short tag, Size_Proc size, Mark_Proc mark, Fixup_Proc fixup, int is_constant_size, int is_atomic); +GC2_EXTERN void GC_register_traversers2(short tag, Size2_Proc size, Mark2_Proc mark, Fixup2_Proc fixup, + int is_constant_size, int is_atomic); /* Registers a traversal procedure for a tag. Obviously, a traversal procedure must be installed for each tag before a collection @@ -336,6 +343,8 @@ GC2_EXTERN void *GC_fixup_self(void *p); /* INTERNAL for the current implemenation (used by macros): */ GC2_EXTERN void GC_mark(const void *p); GC2_EXTERN void GC_fixup(void *p); +GC2_EXTERN void GC_mark2(const void *p, struct NewGC *gc); +GC2_EXTERN void GC_fixup2(void *p, struct NewGC *gc); /* Used in the expansion of gcMARK and gcFIXUP. @@ -350,6 +359,16 @@ GC2_EXTERN void GC_fixup_variable_stack(void **var_stack, long delta, void *limit, void *stack_mem); +GC2_EXTERN void GC_mark2_variable_stack(void **var_stack, + long delta, + void *limit, + void *stack_mem, + struct NewGC *gc); +GC2_EXTERN void GC_fixup2_variable_stack(void **var_stack, + long delta, + void *limit, + void *stack_mem, + struct NewGC *gc); /* Can be called by a mark or fixup traversal proc to traverse and update a chunk of (atomically-allocated) memory containing an image @@ -443,11 +462,17 @@ GC2_EXTERN void GC_set_put_external_event_fd(void *fd); # define gcLOG_WORD_SIZE 2 #endif #define gcMARK(x) GC_mark(x) +#define gcMARK2(x, gc) GC_mark2(x, gc) #define gcMARK_TYPED(t, x) gcMARK(x) +#define gcMARK2_TYPED(t, x, gc) gcMARK2(x, gc) #define gcMARK_TYPED_NOW(t, x) gcMARK(x) +#define gcMARK2_TYPED_NOW(t, x, gc) gcMARK(x, gc) #define gcFIXUP_TYPED_NOW(t, x) GC_fixup(&(x)) +#define gcFIXUP2_TYPED_NOW(t, x, gc) GC_fixup2(&(x), gc) #define gcFIXUP_TYPED(t, x) gcFIXUP_TYPED_NOW(void*, x) +#define gcFIXUP2_TYPED(t, x, gc) gcFIXUP2_TYPED_NOW(void*, x, gc) #define gcFIXUP(x) gcFIXUP_TYPED(void*, x) +#define gcFIXUP2(x, gc) gcFIXUP2_TYPED(void*, x, gc) #define gcBYTES_TO_WORDS(x) ((x + (1 << gcLOG_WORD_SIZE) - 1) >> gcLOG_WORD_SIZE) #define gcWORDS_TO_BYTES(x) (x << gcLOG_WORD_SIZE) diff --git a/src/mzscheme/gc2/mem_account.c b/src/mzscheme/gc2/mem_account.c index a77527b93e..f90a46eba3 100644 --- a/src/mzscheme/gc2/mem_account.c +++ b/src/mzscheme/gc2/mem_account.c @@ -43,12 +43,12 @@ inline static void BTC_register_thread(void *t, void *c) inline static void mark_threads(NewGC *gc, int owner) { GC_Thread_Info *work; - Mark_Proc thread_mark = gc->mark_table[btc_redirect_thread]; + Mark2_Proc thread_mark = gc->mark_table[btc_redirect_thread]; for(work = gc->thread_infos; work; work = work->next) if(work->owner == owner) { if (((Scheme_Thread *)work->thread)->running) { - thread_mark(work->thread); + thread_mark(work->thread, gc); if (work->thread == scheme_current_thread) { GC_mark_variable_stack(GC_variable_stack, 0, get_stack_base(gc), NULL); } @@ -275,7 +275,7 @@ inline static void mark_cust_boxes(NewGC *gc, Scheme_Custodian *cur) { Scheme_Object *pr, *prev = NULL, *next; GC_Weak_Box *wb; - Mark_Proc cust_box_mark = gc->mark_table[btc_redirect_cust_box]; + Mark2_Proc cust_box_mark = gc->mark_table[btc_redirect_cust_box]; /* cust boxes is a list of weak boxes to cust boxes */ @@ -284,7 +284,7 @@ inline static void mark_cust_boxes(NewGC *gc, Scheme_Custodian *cur) wb = (GC_Weak_Box *)SCHEME_CAR(pr); next = SCHEME_CDR(pr); if (wb->val) { - cust_box_mark(wb->val); + cust_box_mark(wb->val, gc); prev = pr; } else { if (prev) @@ -298,34 +298,31 @@ inline static void mark_cust_boxes(NewGC *gc, Scheme_Custodian *cur) cur->checked_cust_boxes = cur->num_cust_boxes; } -int BTC_thread_mark(void *p) +int BTC_thread_mark(void *p, struct NewGC *gc) { - NewGC *gc = GC_get_GC(); if (gc->doing_memory_accounting) { return OBJPTR_TO_OBJHEAD(p)->size; } - return gc->mark_table[btc_redirect_thread](p); + return gc->mark_table[btc_redirect_thread](p, gc); } -int BTC_custodian_mark(void *p) +int BTC_custodian_mark(void *p, struct NewGC *gc) { - NewGC *gc = GC_get_GC(); if (gc->doing_memory_accounting) { if(custodian_to_owner_set(gc, p) == gc->current_mark_owner) - return gc->mark_table[btc_redirect_custodian](p); + return gc->mark_table[btc_redirect_custodian](p, gc); else return OBJPTR_TO_OBJHEAD(p)->size; } - return gc->mark_table[btc_redirect_custodian](p); + return gc->mark_table[btc_redirect_custodian](p, gc); } -int BTC_cust_box_mark(void *p) +int BTC_cust_box_mark(void *p, struct NewGC *gc) { - NewGC *gc = GC_get_GC(); if (gc->doing_memory_accounting) { return OBJPTR_TO_OBJHEAD(p)->size; } - return gc->mark_table[btc_redirect_cust_box](p); + return gc->mark_table[btc_redirect_cust_box](p, gc); } static void btc_overmem_abort(NewGC *gc) @@ -338,12 +335,11 @@ static void btc_overmem_abort(NewGC *gc) static void propagate_accounting_marks(NewGC *gc) { void *p; - PageMap pagemap = gc->page_maps; - Mark_Proc *mark_table = gc->mark_table; + Mark2_Proc *mark_table = gc->mark_table; while(pop_ptr(gc, &p) && !gc->kill_propagation_loop) { /* GCDEBUG((DEBUGOUTF, "btc_account: popped off page %p:%p, ptr %p\n", page, page->addr, p)); */ - propagate_marks_worker(pagemap, mark_table, p); + propagate_marks_worker(gc, mark_table, p); } if(gc->kill_propagation_loop) reset_pointer_stack(gc); diff --git a/src/mzscheme/gc2/newgc.c b/src/mzscheme/gc2/newgc.c index 1a3792e2ef..c4479e863a 100644 --- a/src/mzscheme/gc2/newgc.c +++ b/src/mzscheme/gc2/newgc.c @@ -1432,22 +1432,38 @@ static inline void *get_stack_base(NewGC *gc) { #include "stack_comp.c" -#define GC_X_variable_stack GC_mark_variable_stack -#define gcX(a) gcMARK(*a) +#define GC_X_variable_stack GC_mark2_variable_stack +#define gcX2(a, gc) gcMARK2(*a, gc) #define X_source(stk, p) set_backtrace_source((stk ? stk : p), BT_STACK) #include "var_stack.c" #undef GC_X_variable_stack -#undef gcX +#undef gcX2 #undef X_source -#define GC_X_variable_stack GC_fixup_variable_stack -#define gcX(a) gcFIXUP(*a) +#define GC_X_variable_stack GC_fixup2_variable_stack +#define gcX2(a, gc) gcFIXUP2(*a, gc) #define X_source(stk, p) /* */ #include "var_stack.c" #undef GC_X_variable_stack -#undef gcX +#undef gcX2 #undef X_source +void GC_mark_variable_stack(void **var_stack, + long delta, + void *limit, + void *stack_mem) +{ + GC_mark2_variable_stack(var_stack, delta, limit, stack_mem, GC_get_GC()); +} + +void GC_fixup_variable_stack(void **var_stack, + long delta, + void *limit, + void *stack_mem) +{ + GC_fixup2_variable_stack(var_stack, delta, limit, stack_mem, GC_get_GC()); +} + /*****************************************************************************/ /* Routines for root sets */ /*****************************************************************************/ @@ -1499,16 +1515,16 @@ inline static void mark_finalizer_structs(NewGC *gc) for(fnl = GC_resolve(gc->finalizers); fnl; fnl = GC_resolve(fnl->next)) { set_backtrace_source(fnl, BT_FINALIZER); - gcMARK(fnl->data); + gcMARK2(fnl->data, gc); set_backtrace_source(&gc->finalizers, BT_ROOT); - gcMARK(fnl); + gcMARK2(fnl, gc); } for(fnl = gc->run_queue; fnl; fnl = fnl->next) { set_backtrace_source(fnl, BT_FINALIZER); - gcMARK(fnl->data); - gcMARK(fnl->p); + gcMARK2(fnl->data, gc); + gcMARK2(fnl->p, gc); set_backtrace_source(&gc->run_queue, BT_ROOT); - gcMARK(fnl); + gcMARK2(fnl, gc); } } @@ -1517,17 +1533,17 @@ inline static void repair_finalizer_structs(NewGC *gc) Fnl *fnl; /* repair the base parts of the list */ - gcFIXUP(gc->finalizers); gcFIXUP(gc->run_queue); + gcFIXUP2(gc->finalizers, gc); gcFIXUP2(gc->run_queue, gc); /* then repair the stuff inside them */ for(fnl = gc->finalizers; fnl; fnl = fnl->next) { - gcFIXUP(fnl->data); - gcFIXUP(fnl->p); - gcFIXUP(fnl->next); + gcFIXUP2(fnl->data, gc); + gcFIXUP2(fnl->p, gc); + gcFIXUP2(fnl->next, gc); } for(fnl = gc->run_queue; fnl; fnl = fnl->next) { - gcFIXUP(fnl->data); - gcFIXUP(fnl->p); - gcFIXUP(fnl->next); + gcFIXUP2(fnl->data, gc); + gcFIXUP2(fnl->p, gc); + gcFIXUP2(fnl->next, gc); } } @@ -1545,7 +1561,7 @@ inline static void check_finalizers(NewGC *gc, int level) "CFNL: Level %i finalizer %p on %p queued for finalization.\n", work->eager_level, work, work->p)); set_backtrace_source(work, BT_FINALIZER); - gcMARK(work->p); + gcMARK2(work->p, gc); if(prev) prev->next = next; if(!prev) gc->finalizers = next; if(gc->last_in_queue) gc->last_in_queue = gc->last_in_queue->next = work; @@ -1567,7 +1583,7 @@ inline static void check_finalizers(NewGC *gc, int level) inline static void do_ordered_level3(NewGC *gc) { struct finalizer *temp; - Mark_Proc *mark_table = gc->mark_table; + Mark2_Proc *mark_table = gc->mark_table; for(temp = GC_resolve(gc->finalizers); temp; temp = GC_resolve(temp->next)) if(!marked(gc, temp->p)) { @@ -1575,7 +1591,7 @@ inline static void do_ordered_level3(NewGC *gc) "LVL3: %p is not marked. Marking payload (%p)\n", temp, temp->p)); set_backtrace_source(temp, BT_FINALIZER); - if(temp->tagged) mark_table[*(unsigned short*)temp->p](temp->p); + if(temp->tagged) mark_table[*(unsigned short*)temp->p](temp->p, gc); if(!temp->tagged) GC_mark_xtagged(temp->p); } } @@ -1598,7 +1614,7 @@ inline static void mark_weak_finalizer_structs(NewGC *gc) GCDEBUG((DEBUGOUTF, "MARKING WEAK FINALIZERS.\n")); for(work = gc->weak_finalizers; work; work = work->next) { set_backtrace_source(&gc->weak_finalizers, BT_ROOT); - gcMARK(work); + gcMARK2(work, gc); } } @@ -1607,16 +1623,16 @@ inline static void repair_weak_finalizer_structs(NewGC *gc) Weak_Finalizer *work; Weak_Finalizer *prev; - gcFIXUP(gc->weak_finalizers); + gcFIXUP2(gc->weak_finalizers, gc); work = gc->weak_finalizers; prev = NULL; while(work) { - gcFIXUP(work->next); + gcFIXUP2(work->next, gc); if(!marked(gc, work->p)) { if(prev) prev->next = work->next; if(!prev) gc->weak_finalizers = work->next; work = GC_resolve(work->next); } else { - gcFIXUP(work->p); + gcFIXUP2(work->p, gc); prev = work; work = work->next; } @@ -1640,7 +1656,7 @@ inline static void reset_weak_finalizers(NewGC *gc) for(wfnl = GC_resolve(gc->weak_finalizers); wfnl; wfnl = GC_resolve(wfnl->next)) { if(marked(gc, wfnl->p)) { set_backtrace_source(wfnl, BT_WEAKLINK); - gcMARK(wfnl->saved); + gcMARK2(wfnl->saved, gc); } *(void**)(NUM(GC_resolve(wfnl->p)) + wfnl->offset) = wfnl->saved; wfnl->saved = NULL; @@ -1754,7 +1770,7 @@ inline static void reset_pointer_stack(NewGC *gc) gc->mark_stack->top = MARK_STACK_START(gc->mark_stack); } -static inline void propagate_marks_worker(PageMap pagemap, Mark_Proc *mark_table, void *p); +static inline void propagate_marks_worker(NewGC *gc, Mark2_Proc *mark_table, void *p); /*****************************************************************************/ /* MEMORY ACCOUNTING */ @@ -1996,8 +2012,8 @@ static void NewGC_initialize(NewGC *newgc, NewGC *parentgc) { #ifdef MZ_USE_PLACES NewGCMasterInfo_initialize(); #endif - newgc->mark_table = ofm_malloc_zero(NUMBER_OF_TAGS * sizeof (Mark_Proc)); - newgc->fixup_table = ofm_malloc_zero(NUMBER_OF_TAGS * sizeof (Fixup_Proc)); + newgc->mark_table = ofm_malloc_zero(NUMBER_OF_TAGS * sizeof (Mark2_Proc)); + newgc->fixup_table = ofm_malloc_zero(NUMBER_OF_TAGS * sizeof (Fixup2_Proc)); #ifdef NEWGC_BTC_ACCOUNT BTC_initialize_mark_table(newgc); #endif @@ -2053,9 +2069,9 @@ static NewGC *init_type_tags_worker(NewGC *parentgc, int count, int pair, int mu resize_gen0(gc, GEN0_INITIAL_SIZE); if (!parentgc) { - GC_register_traversers(gc->weak_box_tag, size_weak_box, mark_weak_box, fixup_weak_box, 0, 0); - GC_register_traversers(gc->ephemeron_tag, size_ephemeron, mark_ephemeron, fixup_ephemeron, 0, 0); - GC_register_traversers(gc->weak_array_tag, size_weak_array, mark_weak_array, fixup_weak_array, 0, 0); + GC_register_traversers2(gc->weak_box_tag, size_weak_box, mark_weak_box, fixup_weak_box, 0, 0); + GC_register_traversers2(gc->ephemeron_tag, size_ephemeron, mark_ephemeron, fixup_ephemeron, 0, 0); + GC_register_traversers2(gc->weak_array_tag, size_weak_array, mark_weak_array, fixup_weak_array, 0, 0); } initialize_signal_handler(gc); GC_add_roots(&gc->park, (char *)&gc->park + sizeof(gc->park) + 1); @@ -2163,8 +2179,8 @@ void GC_gcollect(void) } static inline int atomic_mark(void *p) { return 0; } -void GC_register_traversers(short tag, Size_Proc size, Mark_Proc mark, - Fixup_Proc fixup, int constant_Size, int atomic) +void GC_register_traversers2(short tag, Size2_Proc size, Mark2_Proc mark, + Fixup2_Proc fixup, int constant_Size, int atomic) { NewGC *gc = GC_get_GC(); @@ -2179,10 +2195,17 @@ void GC_register_traversers(short tag, Size_Proc size, Mark_Proc mark, atomic = 0; #endif - gc->mark_table[mark_tag] = atomic ? (Mark_Proc)PAGE_ATOMIC : mark; + gc->mark_table[mark_tag] = atomic ? (Mark2_Proc)PAGE_ATOMIC : mark; gc->fixup_table[tag] = fixup; } +void GC_register_traversers(short tag, Size_Proc size, Mark_Proc mark, + Fixup_Proc fixup, int constant_Size, int atomic) +{ + GC_register_traversers2(tag, (Size2_Proc)size, (Mark2_Proc)mark, + (Fixup2_Proc)fixup, constant_Size, atomic); +} + long GC_get_memory_use(void *o) { NewGC *gc = GC_get_GC(); @@ -2203,18 +2226,16 @@ long GC_get_memory_use(void *o) we use internally, and it doesn't do nearly as much. */ /* This is the first mark routine. It's a bit complicated. */ -void GC_mark(const void *const_p) +void GC_mark2(const void *const_p, struct NewGC *gc) { mpage *page; void *p = (void*)const_p; - NewGC *gc; if(!p || (NUM(p) & 0x1)) { GCDEBUG((DEBUGOUTF, "Not marking %p (bad ptr)\n", p)); return; } - gc = GC_get_GC(); if(!(page = pagemap_find_page(gc->page_maps, p))) { #ifdef MZ_USE_PLACES if (!MASTERGC || !MASTERGC->major_places_gc || !(page = pagemap_find_page(MASTERGC->page_maps, p))) @@ -2405,9 +2426,14 @@ void GC_mark(const void *const_p) } } +void GC_mark(const void *const_p) +{ + GC_mark2(const_p, GC_get_GC()); +} + /* this is the second mark routine. It's not quite as complicated. */ /* this is what actually does mark propagation */ -static inline void propagate_marks_worker(PageMap pagemap, Mark_Proc *mark_table, void *pp) +static inline void propagate_marks_worker(NewGC *gc, Mark2_Proc *mark_table, void *pp) { void **start, **end; int alloc_type; @@ -2418,7 +2444,7 @@ static inline void propagate_marks_worker(PageMap pagemap, Mark_Proc *mark_table if (IS_BIG_PAGE_PTR(pp)) { mpage *page; p = REMOVE_BIG_PAGE_PTR_TAG(pp); - page = pagemap_find_page(pagemap, p); + page = pagemap_find_page(gc->page_maps, p); #ifdef MZ_USE_PLACES if (!page && MASTERGC && MASTERGC->major_places_gc) { page = pagemap_find_page(MASTERGC->page_maps, p); @@ -2442,12 +2468,12 @@ static inline void propagate_marks_worker(PageMap pagemap, Mark_Proc *mark_table case PAGE_TAGGED: { const unsigned short tag = *(unsigned short*)start; - Mark_Proc markproc; + Mark2_Proc markproc; ASSERT_TAG(tag); markproc = mark_table[tag]; if(((unsigned long) markproc) >= PAGE_TYPES) { GC_ASSERT(markproc); - markproc(start); + markproc(start, gc); } break; } @@ -2455,7 +2481,7 @@ static inline void propagate_marks_worker(PageMap pagemap, Mark_Proc *mark_table break; case PAGE_ARRAY: { - while(start < end) gcMARK(*start++); break; + while(start < end) gcMARK2(*start++, gc); break; } case PAGE_TARRAY: { @@ -2464,7 +2490,7 @@ static inline void propagate_marks_worker(PageMap pagemap, Mark_Proc *mark_table end -= INSET_WORDS; while(start < end) { GC_ASSERT(mark_table[tag]); - start += mark_table[tag](start); + start += mark_table[tag](start, gc); } break; } @@ -2476,12 +2502,11 @@ static inline void propagate_marks_worker(PageMap pagemap, Mark_Proc *mark_table static void propagate_marks(NewGC *gc) { void *p; - PageMap pagemap = gc->page_maps; - Mark_Proc *mark_table = gc->mark_table; + Mark2_Proc *mark_table = gc->mark_table; while(pop_ptr(gc, &p)) { GCDEBUG((DEBUGOUTF, "Popped pointer %p\n", p)); - propagate_marks_worker(pagemap, mark_table, p); + propagate_marks_worker(gc, mark_table, p); } } @@ -2506,16 +2531,14 @@ void *GC_fixup_self(void *p) return p; } -void GC_fixup(void *pp) +void GC_fixup2(void *pp, struct NewGC *gc) { - NewGC *gc; mpage *page; void *p = *(void**)pp; if(!p || (NUM(p) & 0x1)) return; - gc = GC_get_GC(); if((page = pagemap_find_page(gc->page_maps, p))) { objhead *info; @@ -2527,6 +2550,11 @@ void GC_fixup(void *pp) } else GCDEBUG((DEBUGOUTF, "Not repairing %p from %p (no page)\n", p, pp)); } +void GC_fixup(void *pp) +{ + GC_fixup2(pp, GC_get_GC()); +} + /*****************************************************************************/ /* memory stats and traces */ /*****************************************************************************/ @@ -3075,7 +3103,7 @@ static void repair_heap(NewGC *gc) { mpage *page; int i; - Fixup_Proc *fixup_table = gc->fixup_table; + Fixup2_Proc *fixup_table = gc->fixup_table; #ifdef MZ_USE_PLACES int master_has_switched = postmaster_and_master_gc(gc); #endif @@ -3105,11 +3133,11 @@ static void repair_heap(NewGC *gc) page->size_class = 2; /* remove the mark */ switch(page->page_type) { case PAGE_TAGGED: - fixup_table[*(unsigned short*)start](start); + fixup_table[*(unsigned short*)start](start, gc); break; case PAGE_ATOMIC: break; case PAGE_ARRAY: - while(start < end) gcFIXUP(*(start++)); + while(start < end) gcFIXUP2(*(start++), gc); break; case PAGE_XTAGGED: GC_fixup_xtagged(start); @@ -3118,7 +3146,7 @@ static void repair_heap(NewGC *gc) unsigned short tag = *(unsigned short *)start; ASSERT_TAG(tag); end -= INSET_WORDS; - while(start < end) start += fixup_table[tag](start); + while(start < end) start += fixup_table[tag](start, gc); break; } } @@ -3141,7 +3169,7 @@ static void repair_heap(NewGC *gc) unsigned short tag = *(unsigned short *)obj_start; ASSERT_TAG(tag); info->mark = 0; - fixup_table[tag](obj_start); + fixup_table[tag](obj_start, gc); } else { info->dead = 1; } @@ -3164,7 +3192,7 @@ static void repair_heap(NewGC *gc) if(info->mark) { void **tempend = PPTR(info) + info->size; start = OBJHEAD_TO_OBJPTR(start); - while(start < tempend) gcFIXUP(*start++); + while(start < tempend) gcFIXUP2(*start++, gc); info->mark = 0; } else { info->dead = 1; @@ -3183,7 +3211,7 @@ static void repair_heap(NewGC *gc) tag = *(unsigned short*)start; ASSERT_TAG(tag); while(start < tempend) - start += fixup_table[tag](start); + start += fixup_table[tag](start, gc); info->mark = 0; start = PPTR(info) + size; } else { @@ -3226,7 +3254,7 @@ static void repair_heap(NewGC *gc) { void **tempend = PPTR(info) + info->size; start = OBJHEAD_TO_OBJPTR(start); - while(start < tempend) gcFIXUP(*start++); + while(start < tempend) gcFIXUP2(*start++, gc); } break; case PAGE_TAGGED: @@ -3234,7 +3262,7 @@ static void repair_heap(NewGC *gc) void *obj_start = OBJHEAD_TO_OBJPTR(start); unsigned short tag = *(unsigned short *)obj_start; ASSERT_TAG(tag); - fixup_table[tag](obj_start); + fixup_table[tag](obj_start, gc); start += info->size; } break; @@ -3763,7 +3791,7 @@ static void dump_stack_pos(void *a) } # define GC_X_variable_stack GC_do_dump_variable_stack -# define gcX(a) dump_stack_pos(a) +# define gcX2(a, gc) dump_stack_pos(a) # define X_source(stk, p) /* */ # include "var_stack.c" # undef GC_X_variable_stack diff --git a/src/mzscheme/gc2/newgc.h b/src/mzscheme/gc2/newgc.h index f0eebefdfb..6584d82ba2 100644 --- a/src/mzscheme/gc2/newgc.h +++ b/src/mzscheme/gc2/newgc.h @@ -105,8 +105,8 @@ typedef mpage **PageMap; typedef struct NewGC { Gen0 gen0; - Mark_Proc *mark_table; /* the table of mark procs */ - Fixup_Proc *fixup_table; /* the table of repair procs */ + Mark2_Proc *mark_table; /* the table of mark procs */ + Fixup2_Proc *fixup_table; /* the table of repair procs */ PageMap page_maps; /* All non-gen0 pages are held in the following structure. */ struct mpage *gen1_pages[PAGE_TYPES]; diff --git a/src/mzscheme/gc2/var_stack.c b/src/mzscheme/gc2/var_stack.c index 3f5677241a..be7407669d 100644 --- a/src/mzscheme/gc2/var_stack.c +++ b/src/mzscheme/gc2/var_stack.c @@ -1,5 +1,5 @@ -void GC_X_variable_stack(void **var_stack, long delta, void *limit, void *stack_mem) +void GC_X_variable_stack(void **var_stack, long delta, void *limit, void *stack_mem, struct NewGC *gc) { long size, count; void ***p, **a; @@ -36,7 +36,7 @@ void GC_X_variable_stack(void **var_stack, long delta, void *limit, void *stack_ if (SHALLOWER_STACK_ADDRESS(a, limit)) { while (count--) { X_source(stack_mem, a); - gcX(a); + gcX2(a, gc); a++; } } @@ -44,7 +44,7 @@ void GC_X_variable_stack(void **var_stack, long delta, void *limit, void *stack_ a = (void **)((char *)a + delta); if (SHALLOWER_STACK_ADDRESS(a, limit)) { X_source(stack_mem, a); - gcX(a); + gcX2(a, gc); } } p++; @@ -64,13 +64,13 @@ void GC_X_variable_stack(void **var_stack, long delta, void *limit, void *stack_ a = (void **)((char *)a + delta); while (count--) { X_source(stack_mem, a); - gcX(a); + gcX2(a, gc); a++; } } else { a = (void **)((char *)a + delta); X_source(stack_mem, a); - gcX(a); + gcX2(a, gc); } p++; } diff --git a/src/mzscheme/gc2/weak.c b/src/mzscheme/gc2/weak.c index da95fb12a7..1adf2fbaca 100644 --- a/src/mzscheme/gc2/weak.c +++ b/src/mzscheme/gc2/weak.c @@ -25,7 +25,7 @@ /* weak arrays */ /******************************************************************************/ -static int size_weak_array(void *p) +static int size_weak_array(void *p, struct NewGC *gc) { GC_Weak_Array *a = (GC_Weak_Array *)p; @@ -33,12 +33,11 @@ static int size_weak_array(void *p) + ((a->count - 1) * sizeof(void *))); } -static int mark_weak_array(void *p) +static int mark_weak_array(void *p, struct NewGC *gc) { - GCTYPE *gc = GC_get_GC(); GC_Weak_Array *a = (GC_Weak_Array *)p; - gcMARK(a->replace_val); + gcMARK2(a->replace_val, gc); a->next = gc->weak_arrays; gc->weak_arrays = a; @@ -64,18 +63,18 @@ static int mark_weak_array(void *p) + ((a->count - 1) * sizeof(void *))); } -static int fixup_weak_array(void *p) +static int fixup_weak_array(void *p, struct NewGC *gc) { GC_Weak_Array *a = (GC_Weak_Array *)p; int i; void **data; - gcFIXUP(a->replace_val); + gcFIXUP2(a->replace_val, gc); data = a->data; for (i = a->count; i--; ) { if (data[i]) - gcFIXUP(data[i]); + gcFIXUP2(data[i], gc); } return gcBYTES_TO_WORDS(sizeof(GC_Weak_Array) @@ -132,17 +131,16 @@ static void zero_weak_arrays(GCTYPE *gc) /* weak boxes */ /******************************************************************************/ -static int size_weak_box(void *p) +static int size_weak_box(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(GC_Weak_Box)); } -static int mark_weak_box(void *p) +static int mark_weak_box(void *p, struct NewGC *gc) { - GCTYPE *gc = GC_get_GC(); GC_Weak_Box *wb = (GC_Weak_Box *)p; - gcMARK(wb->secondary_erase); + gcMARK2(wb->secondary_erase, gc); if (wb->val) { wb->next = gc->weak_boxes; @@ -152,12 +150,12 @@ static int mark_weak_box(void *p) return gcBYTES_TO_WORDS(sizeof(GC_Weak_Box)); } -static int fixup_weak_box(void *p) +static int fixup_weak_box(void *p, struct NewGC *gc) { GC_Weak_Box *wb = (GC_Weak_Box *)p; - gcFIXUP(wb->secondary_erase); - gcFIXUP(wb->val); + gcFIXUP2(wb->secondary_erase, gc); + gcFIXUP2(wb->val, gc); return gcBYTES_TO_WORDS(sizeof(GC_Weak_Box)); } @@ -213,14 +211,13 @@ static void zero_weak_boxes(GCTYPE *gc) /* ephemeron */ /******************************************************************************/ -static int size_ephemeron(void *p) +static int size_ephemeron(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(GC_Ephemeron)); } -static int mark_ephemeron(void *p) +static int mark_ephemeron(void *p, struct NewGC *gc) { - GCTYPE *gc = GC_get_GC(); GC_Ephemeron *eph = (GC_Ephemeron *)p; if (eph->val) { @@ -232,29 +229,28 @@ static int mark_ephemeron(void *p) } #ifdef NEWGC_BTC_ACCOUNT -static int BTC_ephemeron_mark(void *p) +static int BTC_ephemeron_mark(void *p, struct NewGC *gc) { - GCTYPE *gc = GC_get_GC(); if (gc->doing_memory_accounting) { GC_Ephemeron *eph = (GC_Ephemeron *)p; - gcMARK(eph->key); - gcMARK(eph->val); + gcMARK2(eph->key, gc); + gcMARK2(eph->val, gc); return gcBYTES_TO_WORDS(sizeof(GC_Ephemeron)); } - return mark_ephemeron(p); + return mark_ephemeron(p, gc); } #endif -static int fixup_ephemeron(void *p) +static int fixup_ephemeron(void *p, struct NewGC *gc) { GC_Ephemeron *eph = (GC_Ephemeron *)p; - gcFIXUP(eph->key); - gcFIXUP(eph->val); + gcFIXUP2(eph->key, gc); + gcFIXUP2(eph->val, gc); return gcBYTES_TO_WORDS(sizeof(GC_Ephemeron)); } @@ -294,7 +290,7 @@ static void mark_ready_ephemerons(GCTYPE *gc) for (eph = gc->ephemerons; eph; eph = next) { next = eph->next; if (is_marked(gc, eph->key)) { - gcMARK(eph->val); + gcMARK2(eph->val, gc); gc->num_last_seen_ephemerons++; } else { eph->next = waiting; diff --git a/src/mzscheme/include/schthread.h b/src/mzscheme/include/schthread.h index d87fe867d7..7b9913ba1c 100644 --- a/src/mzscheme/include/schthread.h +++ b/src/mzscheme/include/schthread.h @@ -303,9 +303,9 @@ static inline Thread_Local_Variables *scheme_get_thread_local_variables() { Thread_Local_Variables *x = NULL; # if defined(OS_X) # if defined(__x86_64__) - asm volatile("movq %%gs:0x8E0, %0" : "=r"(x)); + asm volatile("movq %%gs:0x60(,%1,8), %0" : "=r"(x) : "r"(scheme_thread_local_key)); # else - asm volatile("movl %%gs:0x488, %0" : "=r"(x)); + asm volatile("movl %%gs:0x48(,%1,4), %0" : "=r"(x) : "r"(scheme_thread_local_key)); # endif # elif defined(linux) && defined(MZ_USES_SHARED_LIB) # if defined(__x86_64__) diff --git a/src/mzscheme/src/fun.c b/src/mzscheme/src/fun.c index 5bfe3cd351..21d48811fd 100644 --- a/src/mzscheme/src/fun.c +++ b/src/mzscheme/src/fun.c @@ -2898,21 +2898,28 @@ Scheme_Object *scheme_make_arity(mzshort mina, mzshort maxa) } } -static Scheme_Object *clone_arity(Scheme_Object *a) +static Scheme_Object *clone_arity(Scheme_Object *a, int delta) { if (SCHEME_PAIRP(a)) { Scheme_Object *m, *l; m = scheme_copy_list(a); for (l = m; SCHEME_PAIRP(l); l = SCHEME_CDR(l)) { - a = clone_arity(SCHEME_CAR(l)); + a = clone_arity(SCHEME_CAR(l), delta); SCHEME_CAR(l) = a; } return m; } else if (SCHEME_CHAPERONE_STRUCTP(a)) { Scheme_Object *p[1]; - p[0] = scheme_struct_ref(a, 0); + a = scheme_struct_ref(a, 0); + if (delta) + a = scheme_bin_minus(a, scheme_make_integer(delta)); + p[0] = a; return scheme_make_struct_instance(scheme_arity_at_least, 1, p); - } else + } else if (SCHEME_NULLP(a)) + return a; + else if (delta) + return scheme_bin_minus(a, scheme_make_integer(delta)); + else return a; } @@ -2996,10 +3003,13 @@ static Scheme_Object *get_or_check_arity(Scheme_Object *p, long a, Scheme_Object int is_method; if (scheme_reduced_procedure_struct && scheme_is_struct_instance(scheme_reduced_procedure_struct, p)) { - if (a >= 0) + if (a >= 0) { bign = scheme_make_integer(a); + if (drop) + bign = scheme_bin_plus(bign, scheme_make_integer(a)); + } if (a == -1) - return clone_arity(((Scheme_Structure *)p)->slots[1]); + return clone_arity(((Scheme_Structure *)p)->slots[1], drop); else { /* Check arity (or for varargs) */ Scheme_Object *v; @@ -3836,7 +3846,7 @@ static Scheme_Object *procedure_reduce_arity(int argc, Scheme_Object *argv[]) lists that include arity-at-least records. */ orig = get_or_check_arity(argv[0], -1, NULL); - aty = clone_arity(argv[1]); + aty = clone_arity(argv[1], 0); if (!is_subarity(aty, orig)) { scheme_raise_exn(MZEXN_FAIL_CONTRACT, diff --git a/src/mzscheme/src/jit.c b/src/mzscheme/src/jit.c index 197ba2ec47..211d407f0f 100644 --- a/src/mzscheme/src/jit.c +++ b/src/mzscheme/src/jit.c @@ -11351,7 +11351,8 @@ static int do_generate_common(mz_jit_state *jitter, void *_data) for (i = 0; i < 4; i++) { void *code; int kind, for_branch; - jit_insn *ref, *ref2, *refslow, *bref1, *bref2, *bref3, *bref4, *bref5, *bref6, *bref8; + GC_CAN_IGNORE jit_insn *ref, *ref2, *ref3, *refslow, *bref1, *bref2, *refretry; + GC_CAN_IGNORE jit_insn *bref3, *bref4, *bref5, *bref6, *bref8, *ref9; if ((ii == 1) && (i == 1)) continue; /* no multi variant of pred branch */ @@ -11448,11 +11449,21 @@ static int do_generate_common(mz_jit_state *jitter, void *_data) /* Check argument: */ if (kind == 1) { bref1 = jit_bmsi_ul(jit_forward(), JIT_R1, 0x1); + refretry = _jit.x.pc; jit_ldxi_s(JIT_R2, JIT_R1, &((Scheme_Object *)0x0)->type); __START_INNER_TINY__(1); ref2 = jit_beqi_i(jit_forward(), JIT_R2, scheme_structure_type); + ref3 = jit_beqi_i(jit_forward(), JIT_R2, scheme_proc_struct_type); + ref9 = jit_beqi_i(jit_forward(), JIT_R2, scheme_chaperone_type); + __END_INNER_TINY__(1); + bref2 = jit_bnei_i(jit_forward(), JIT_R2, scheme_proc_chaperone_type); + CHECK_LIMIT(); + __START_INNER_TINY__(1); + mz_patch_branch(ref9); + jit_ldxi_p(JIT_R1, JIT_R1, &SCHEME_CHAPERONE_VAL(0x0)); + (void)jit_jmpi(refretry); + mz_patch_branch(ref3); __END_INNER_TINY__(1); - bref2 = jit_bnei_i(jit_forward(), JIT_R2, scheme_proc_struct_type); } else { (void)jit_bmsi_ul(refslow, JIT_R1, 0x1); jit_ldxi_s(JIT_R2, JIT_R1, &((Scheme_Object *)0x0)->type); diff --git a/src/mzscheme/src/mkmark.ss b/src/mzscheme/src/mkmark.ss index 5d0061fce4..84a15d7d56 100644 --- a/src/mzscheme/src/mkmark.ss +++ b/src/mzscheme/src/mkmark.ss @@ -48,28 +48,28 @@ (read-lines re:size)) null)] [size (read-lines re:close)]) - (printf "static int ~a_SIZE(void *p) {~n" name) + (printf "static int ~a_SIZE(void *p, struct NewGC *gc) {~n" name) (print-lines prefix) (printf " return~n") (print-lines size) (printf "}~n~n") - (printf "static int ~a_MARK(void *p) {~n" name) + (printf "static int ~a_MARK(void *p, struct NewGC *gc) {~n" name) (print-lines prefix) (print-lines (map (lambda (s) (regexp-replace* "FIXUP_ONLY[(]([^;]*;)[)]" (regexp-replace* - "FIXUP_TYPED_NOW[(][^,]*," + "FIXUP2_TYPED_NOW[(][^,]*," s - "MARK(") + "MARK2(") "")) mark)) (printf " return~n") (print-lines size) (printf "}~n~n") - (printf "static int ~a_FIXUP(void *p) {~n" name) + (printf "static int ~a_FIXUP(void *p, struct NewGC *gc) {~n" name) (print-lines prefix) (print-lines (map (lambda (s) (regexp-replace* diff --git a/src/mzscheme/src/mzmark.c b/src/mzscheme/src/mzmark.c index 7ec137f48b..1c0210a27d 100644 --- a/src/mzscheme/src/mzmark.c +++ b/src/mzscheme/src/mzmark.c @@ -2,28 +2,28 @@ #ifdef MARKS_FOR_TYPE_C -static int variable_obj_SIZE(void *p) { +static int variable_obj_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Bucket_With_Home)); } -static int variable_obj_MARK(void *p) { +static int variable_obj_MARK(void *p, struct NewGC *gc) { Scheme_Bucket *b = (Scheme_Bucket *)p; - gcMARK(b->key); - gcMARK(b->val); - gcMARK(((Scheme_Bucket_With_Home *)b)->home); + gcMARK2(b->key, gc); + gcMARK2(b->val, gc); + gcMARK2(((Scheme_Bucket_With_Home *)b)->home, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Bucket_With_Home)); } -static int variable_obj_FIXUP(void *p) { +static int variable_obj_FIXUP(void *p, struct NewGC *gc) { Scheme_Bucket *b = (Scheme_Bucket *)p; - gcFIXUP(b->key); - gcFIXUP(b->val); - gcFIXUP(((Scheme_Bucket_With_Home *)b)->home); + gcFIXUP2(b->key, gc); + gcFIXUP2(b->val, gc); + gcFIXUP2(((Scheme_Bucket_With_Home *)b)->home, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Bucket_With_Home)); @@ -33,28 +33,28 @@ static int variable_obj_FIXUP(void *p) { #define variable_obj_IS_CONST_SIZE 1 -static int module_var_SIZE(void *p) { +static int module_var_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Module_Variable)); } -static int module_var_MARK(void *p) { +static int module_var_MARK(void *p, struct NewGC *gc) { Module_Variable *mv = (Module_Variable *)p; - gcMARK(mv->modidx); - gcMARK(mv->sym); - gcMARK(mv->insp); + gcMARK2(mv->modidx, gc); + gcMARK2(mv->sym, gc); + gcMARK2(mv->insp, gc); return gcBYTES_TO_WORDS(sizeof(Module_Variable)); } -static int module_var_FIXUP(void *p) { +static int module_var_FIXUP(void *p, struct NewGC *gc) { Module_Variable *mv = (Module_Variable *)p; - gcFIXUP(mv->modidx); - gcFIXUP(mv->sym); - gcFIXUP(mv->insp); + gcFIXUP2(mv->modidx, gc); + gcFIXUP2(mv->sym, gc); + gcFIXUP2(mv->insp, gc); return gcBYTES_TO_WORDS(sizeof(Module_Variable)); @@ -64,26 +64,26 @@ static int module_var_FIXUP(void *p) { #define module_var_IS_CONST_SIZE 1 -static int bucket_obj_SIZE(void *p) { +static int bucket_obj_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Bucket)); } -static int bucket_obj_MARK(void *p) { +static int bucket_obj_MARK(void *p, struct NewGC *gc) { Scheme_Bucket *b = (Scheme_Bucket *)p; - gcMARK(b->key); - gcMARK(b->val); + gcMARK2(b->key, gc); + gcMARK2(b->val, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Bucket)); } -static int bucket_obj_FIXUP(void *p) { +static int bucket_obj_FIXUP(void *p, struct NewGC *gc) { Scheme_Bucket *b = (Scheme_Bucket *)p; - gcFIXUP(b->key); - gcFIXUP(b->val); + gcFIXUP2(b->key, gc); + gcFIXUP2(b->val, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Bucket)); @@ -93,17 +93,17 @@ static int bucket_obj_FIXUP(void *p) { #define bucket_obj_IS_CONST_SIZE 1 -static int local_obj_SIZE(void *p) { +static int local_obj_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Local)); } -static int local_obj_MARK(void *p) { +static int local_obj_MARK(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Local)); } -static int local_obj_FIXUP(void *p) { +static int local_obj_FIXUP(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Local)); } @@ -112,17 +112,17 @@ static int local_obj_FIXUP(void *p) { #define local_obj_IS_CONST_SIZE 1 -static int toplevel_obj_SIZE(void *p) { +static int toplevel_obj_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Toplevel)); } -static int toplevel_obj_MARK(void *p) { +static int toplevel_obj_MARK(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Toplevel)); } -static int toplevel_obj_FIXUP(void *p) { +static int toplevel_obj_FIXUP(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Toplevel)); } @@ -131,17 +131,17 @@ static int toplevel_obj_FIXUP(void *p) { #define toplevel_obj_IS_CONST_SIZE 1 -static int quotesyntax_obj_SIZE(void *p) { +static int quotesyntax_obj_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Quote_Syntax)); } -static int quotesyntax_obj_MARK(void *p) { +static int quotesyntax_obj_MARK(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Quote_Syntax)); } -static int quotesyntax_obj_FIXUP(void *p) { +static int quotesyntax_obj_FIXUP(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Quote_Syntax)); } @@ -150,25 +150,25 @@ static int quotesyntax_obj_FIXUP(void *p) { #define quotesyntax_obj_IS_CONST_SIZE 1 -static int cpointer_obj_SIZE(void *p) { +static int cpointer_obj_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Cptr)); } -static int cpointer_obj_MARK(void *p) { +static int cpointer_obj_MARK(void *p, struct NewGC *gc) { if (!(SCHEME_CPTR_FLAGS(p) & 0x1)) { - gcMARK(SCHEME_CPTR_VAL(p)); + gcMARK2(SCHEME_CPTR_VAL(p), gc); } - gcMARK(SCHEME_CPTR_TYPE(p)); + gcMARK2(SCHEME_CPTR_TYPE(p), gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Cptr)); } -static int cpointer_obj_FIXUP(void *p) { +static int cpointer_obj_FIXUP(void *p, struct NewGC *gc) { if (!(SCHEME_CPTR_FLAGS(p) & 0x1)) { - gcFIXUP(SCHEME_CPTR_VAL(p)); + gcFIXUP2(SCHEME_CPTR_VAL(p), gc); } - gcFIXUP(SCHEME_CPTR_TYPE(p)); + gcFIXUP2(SCHEME_CPTR_TYPE(p), gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Cptr)); } @@ -177,25 +177,25 @@ static int cpointer_obj_FIXUP(void *p) { #define cpointer_obj_IS_CONST_SIZE 1 -static int offset_cpointer_obj_SIZE(void *p) { +static int offset_cpointer_obj_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Offset_Cptr)); } -static int offset_cpointer_obj_MARK(void *p) { +static int offset_cpointer_obj_MARK(void *p, struct NewGC *gc) { if (!(SCHEME_CPTR_FLAGS(p) & 0x1)) { - gcMARK(SCHEME_CPTR_VAL(p)); + gcMARK2(SCHEME_CPTR_VAL(p), gc); } - gcMARK(SCHEME_CPTR_TYPE(p)); + gcMARK2(SCHEME_CPTR_TYPE(p), gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Offset_Cptr)); } -static int offset_cpointer_obj_FIXUP(void *p) { +static int offset_cpointer_obj_FIXUP(void *p, struct NewGC *gc) { if (!(SCHEME_CPTR_FLAGS(p) & 0x1)) { - gcFIXUP(SCHEME_CPTR_VAL(p)); + gcFIXUP2(SCHEME_CPTR_VAL(p), gc); } - gcFIXUP(SCHEME_CPTR_TYPE(p)); + gcFIXUP2(SCHEME_CPTR_TYPE(p), gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Offset_Cptr)); } @@ -204,21 +204,21 @@ static int offset_cpointer_obj_FIXUP(void *p) { #define offset_cpointer_obj_IS_CONST_SIZE 1 -static int twoptr_obj_SIZE(void *p) { +static int twoptr_obj_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Simple_Object)); } -static int twoptr_obj_MARK(void *p) { - gcMARK(SCHEME_PTR1_VAL((Scheme_Object *)p)); - gcMARK(SCHEME_PTR2_VAL((Scheme_Object *)p)); +static int twoptr_obj_MARK(void *p, struct NewGC *gc) { + gcMARK2(SCHEME_PTR1_VAL((Scheme_Object *)p), gc); + gcMARK2(SCHEME_PTR2_VAL((Scheme_Object *)p), gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Simple_Object)); } -static int twoptr_obj_FIXUP(void *p) { - gcFIXUP(SCHEME_PTR1_VAL((Scheme_Object *)p)); - gcFIXUP(SCHEME_PTR2_VAL((Scheme_Object *)p)); +static int twoptr_obj_FIXUP(void *p, struct NewGC *gc) { + gcFIXUP2(SCHEME_PTR1_VAL((Scheme_Object *)p), gc); + gcFIXUP2(SCHEME_PTR2_VAL((Scheme_Object *)p), gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Simple_Object)); } @@ -227,19 +227,19 @@ static int twoptr_obj_FIXUP(void *p) { #define twoptr_obj_IS_CONST_SIZE 1 -static int iptr_obj_SIZE(void *p) { +static int iptr_obj_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Simple_Object)); } -static int iptr_obj_MARK(void *p) { - gcMARK(SCHEME_IPTR_VAL((Scheme_Object *)p)); +static int iptr_obj_MARK(void *p, struct NewGC *gc) { + gcMARK2(SCHEME_IPTR_VAL((Scheme_Object *)p), gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Simple_Object)); } -static int iptr_obj_FIXUP(void *p) { - gcFIXUP(SCHEME_IPTR_VAL((Scheme_Object *)p)); +static int iptr_obj_FIXUP(void *p, struct NewGC *gc) { + gcFIXUP2(SCHEME_IPTR_VAL((Scheme_Object *)p), gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Simple_Object)); } @@ -248,20 +248,20 @@ static int iptr_obj_FIXUP(void *p) { #define iptr_obj_IS_CONST_SIZE 1 -static int small_object_SIZE(void *p) { +static int small_object_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Small_Object)); } -static int small_object_MARK(void *p) { - gcMARK(((Scheme_Small_Object *)p)->u.ptr_value); +static int small_object_MARK(void *p, struct NewGC *gc) { + gcMARK2(((Scheme_Small_Object *)p)->u.ptr_value, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Small_Object)); } -static int small_object_FIXUP(void *p) { - gcFIXUP(((Scheme_Small_Object *)p)->u.ptr_value); +static int small_object_FIXUP(void *p, struct NewGC *gc) { + gcFIXUP2(((Scheme_Small_Object *)p)->u.ptr_value, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Small_Object)); @@ -271,7 +271,7 @@ static int small_object_FIXUP(void *p) { #define small_object_IS_CONST_SIZE 1 -static int app_rec_SIZE(void *p) { +static int app_rec_SIZE(void *p, struct NewGC *gc) { Scheme_App_Rec *r = (Scheme_App_Rec *)p; return @@ -280,12 +280,12 @@ static int app_rec_SIZE(void *p) { + ((r->num_args + 1) * sizeof(char)))); } -static int app_rec_MARK(void *p) { +static int app_rec_MARK(void *p, struct NewGC *gc) { Scheme_App_Rec *r = (Scheme_App_Rec *)p; int i = r->num_args + 1; while (i--) - gcMARK(r->args[i]); + gcMARK2(r->args[i], gc); return gcBYTES_TO_WORDS((sizeof(Scheme_App_Rec) @@ -293,12 +293,12 @@ static int app_rec_MARK(void *p) { + ((r->num_args + 1) * sizeof(char)))); } -static int app_rec_FIXUP(void *p) { +static int app_rec_FIXUP(void *p, struct NewGC *gc) { Scheme_App_Rec *r = (Scheme_App_Rec *)p; int i = r->num_args + 1; while (i--) - gcFIXUP(r->args[i]); + gcFIXUP2(r->args[i], gc); return gcBYTES_TO_WORDS((sizeof(Scheme_App_Rec) @@ -310,24 +310,24 @@ static int app_rec_FIXUP(void *p) { #define app_rec_IS_CONST_SIZE 0 -static int app2_rec_SIZE(void *p) { +static int app2_rec_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_App2_Rec)); } -static int app2_rec_MARK(void *p) { +static int app2_rec_MARK(void *p, struct NewGC *gc) { Scheme_App2_Rec *r = (Scheme_App2_Rec *)p; - gcMARK(r->rator); - gcMARK(r->rand); + gcMARK2(r->rator, gc); + gcMARK2(r->rand, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_App2_Rec)); } -static int app2_rec_FIXUP(void *p) { +static int app2_rec_FIXUP(void *p, struct NewGC *gc) { Scheme_App2_Rec *r = (Scheme_App2_Rec *)p; - gcFIXUP(r->rator); - gcFIXUP(r->rand); + gcFIXUP2(r->rator, gc); + gcFIXUP2(r->rand, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_App2_Rec)); @@ -337,26 +337,26 @@ static int app2_rec_FIXUP(void *p) { #define app2_rec_IS_CONST_SIZE 1 -static int app3_rec_SIZE(void *p) { +static int app3_rec_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_App3_Rec)); } -static int app3_rec_MARK(void *p) { +static int app3_rec_MARK(void *p, struct NewGC *gc) { Scheme_App3_Rec *r = (Scheme_App3_Rec *)p; - gcMARK(r->rator); - gcMARK(r->rand1); - gcMARK(r->rand2); + gcMARK2(r->rator, gc); + gcMARK2(r->rand1, gc); + gcMARK2(r->rand2, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_App3_Rec)); } -static int app3_rec_FIXUP(void *p) { +static int app3_rec_FIXUP(void *p, struct NewGC *gc) { Scheme_App3_Rec *r = (Scheme_App3_Rec *)p; - gcFIXUP(r->rator); - gcFIXUP(r->rand1); - gcFIXUP(r->rand2); + gcFIXUP2(r->rator, gc); + gcFIXUP2(r->rand1, gc); + gcFIXUP2(r->rand2, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_App3_Rec)); @@ -366,7 +366,7 @@ static int app3_rec_FIXUP(void *p) { #define app3_rec_IS_CONST_SIZE 1 -static int seq_rec_SIZE(void *p) { +static int seq_rec_SIZE(void *p, struct NewGC *gc) { Scheme_Sequence *s = (Scheme_Sequence *)p; return @@ -374,24 +374,24 @@ static int seq_rec_SIZE(void *p) { + ((s->count - 1) * sizeof(Scheme_Object *)))); } -static int seq_rec_MARK(void *p) { +static int seq_rec_MARK(void *p, struct NewGC *gc) { Scheme_Sequence *s = (Scheme_Sequence *)p; int i = s->count; while (i--) - gcMARK(s->array[i]); + gcMARK2(s->array[i], gc); return gcBYTES_TO_WORDS((sizeof(Scheme_Sequence) + ((s->count - 1) * sizeof(Scheme_Object *)))); } -static int seq_rec_FIXUP(void *p) { +static int seq_rec_FIXUP(void *p, struct NewGC *gc) { Scheme_Sequence *s = (Scheme_Sequence *)p; int i = s->count; while (i--) - gcFIXUP(s->array[i]); + gcFIXUP2(s->array[i], gc); return gcBYTES_TO_WORDS((sizeof(Scheme_Sequence) @@ -402,28 +402,28 @@ static int seq_rec_FIXUP(void *p) { #define seq_rec_IS_CONST_SIZE 0 -static int branch_rec_SIZE(void *p) { +static int branch_rec_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Branch_Rec)); } -static int branch_rec_MARK(void *p) { +static int branch_rec_MARK(void *p, struct NewGC *gc) { Scheme_Branch_Rec *b = (Scheme_Branch_Rec *)p; - gcMARK(b->test); - gcMARK(b->tbranch); - gcMARK(b->fbranch); + gcMARK2(b->test, gc); + gcMARK2(b->tbranch, gc); + gcMARK2(b->fbranch, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Branch_Rec)); } -static int branch_rec_FIXUP(void *p) { +static int branch_rec_FIXUP(void *p, struct NewGC *gc) { Scheme_Branch_Rec *b = (Scheme_Branch_Rec *)p; - gcFIXUP(b->test); - gcFIXUP(b->tbranch); - gcFIXUP(b->fbranch); + gcFIXUP2(b->test, gc); + gcFIXUP2(b->tbranch, gc); + gcFIXUP2(b->fbranch, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Branch_Rec)); @@ -433,35 +433,35 @@ static int branch_rec_FIXUP(void *p) { #define branch_rec_IS_CONST_SIZE 1 -static int unclosed_proc_SIZE(void *p) { +static int unclosed_proc_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Closure_Data)); } -static int unclosed_proc_MARK(void *p) { +static int unclosed_proc_MARK(void *p, struct NewGC *gc) { Scheme_Closure_Data *d = (Scheme_Closure_Data *)p; - gcMARK(d->name); - gcMARK(d->code); - gcMARK(d->closure_map); + gcMARK2(d->name, gc); + gcMARK2(d->code, gc); + gcMARK2(d->closure_map, gc); #ifdef MZ_USE_JIT - gcMARK(d->u.native_code); - gcMARK(d->context); + gcMARK2(d->u.native_code, gc); + gcMARK2(d->context, gc); #endif return gcBYTES_TO_WORDS(sizeof(Scheme_Closure_Data)); } -static int unclosed_proc_FIXUP(void *p) { +static int unclosed_proc_FIXUP(void *p, struct NewGC *gc) { Scheme_Closure_Data *d = (Scheme_Closure_Data *)p; - gcFIXUP(d->name); - gcFIXUP(d->code); - gcFIXUP(d->closure_map); + gcFIXUP2(d->name, gc); + gcFIXUP2(d->code, gc); + gcFIXUP2(d->closure_map, gc); #ifdef MZ_USE_JIT - gcFIXUP(d->u.native_code); - gcFIXUP(d->context); + gcFIXUP2(d->u.native_code, gc); + gcFIXUP2(d->context, gc); #endif return @@ -472,26 +472,26 @@ static int unclosed_proc_FIXUP(void *p) { #define unclosed_proc_IS_CONST_SIZE 1 -static int let_value_SIZE(void *p) { +static int let_value_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Let_Value)); } -static int let_value_MARK(void *p) { +static int let_value_MARK(void *p, struct NewGC *gc) { Scheme_Let_Value *l = (Scheme_Let_Value *)p; - gcMARK(l->value); - gcMARK(l->body); + gcMARK2(l->value, gc); + gcMARK2(l->body, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Let_Value)); } -static int let_value_FIXUP(void *p) { +static int let_value_FIXUP(void *p, struct NewGC *gc) { Scheme_Let_Value *l = (Scheme_Let_Value *)p; - gcFIXUP(l->value); - gcFIXUP(l->body); + gcFIXUP2(l->value, gc); + gcFIXUP2(l->body, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Let_Value)); @@ -501,24 +501,24 @@ static int let_value_FIXUP(void *p) { #define let_value_IS_CONST_SIZE 1 -static int let_void_SIZE(void *p) { +static int let_void_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Let_Void)); } -static int let_void_MARK(void *p) { +static int let_void_MARK(void *p, struct NewGC *gc) { Scheme_Let_Void *l = (Scheme_Let_Void *)p; - gcMARK(l->body); + gcMARK2(l->body, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Let_Void)); } -static int let_void_FIXUP(void *p) { +static int let_void_FIXUP(void *p, struct NewGC *gc) { Scheme_Let_Void *l = (Scheme_Let_Void *)p; - gcFIXUP(l->body); + gcFIXUP2(l->body, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Let_Void)); @@ -528,26 +528,26 @@ static int let_void_FIXUP(void *p) { #define let_void_IS_CONST_SIZE 1 -static int letrec_SIZE(void *p) { +static int letrec_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Letrec)); } -static int letrec_MARK(void *p) { +static int letrec_MARK(void *p, struct NewGC *gc) { Scheme_Letrec *l = (Scheme_Letrec *)p; - gcMARK(l->procs); - gcMARK(l->body); + gcMARK2(l->procs, gc); + gcMARK2(l->body, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Letrec)); } -static int letrec_FIXUP(void *p) { +static int letrec_FIXUP(void *p, struct NewGC *gc) { Scheme_Letrec *l = (Scheme_Letrec *)p; - gcFIXUP(l->procs); - gcFIXUP(l->body); + gcFIXUP2(l->procs, gc); + gcFIXUP2(l->body, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Letrec)); @@ -557,26 +557,26 @@ static int letrec_FIXUP(void *p) { #define letrec_IS_CONST_SIZE 1 -static int let_one_SIZE(void *p) { +static int let_one_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Let_One)); } -static int let_one_MARK(void *p) { +static int let_one_MARK(void *p, struct NewGC *gc) { Scheme_Let_One *l = (Scheme_Let_One *)p; - gcMARK(l->value); - gcMARK(l->body); + gcMARK2(l->value, gc); + gcMARK2(l->body, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Let_One)); } -static int let_one_FIXUP(void *p) { +static int let_one_FIXUP(void *p, struct NewGC *gc) { Scheme_Let_One *l = (Scheme_Let_One *)p; - gcFIXUP(l->value); - gcFIXUP(l->body); + gcFIXUP2(l->value, gc); + gcFIXUP2(l->body, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Let_One)); @@ -586,28 +586,28 @@ static int let_one_FIXUP(void *p) { #define let_one_IS_CONST_SIZE 1 -static int with_cont_mark_SIZE(void *p) { +static int with_cont_mark_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_With_Continuation_Mark)); } -static int with_cont_mark_MARK(void *p) { +static int with_cont_mark_MARK(void *p, struct NewGC *gc) { Scheme_With_Continuation_Mark *w = (Scheme_With_Continuation_Mark *)p; - gcMARK(w->key); - gcMARK(w->val); - gcMARK(w->body); + gcMARK2(w->key, gc); + gcMARK2(w->val, gc); + gcMARK2(w->body, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_With_Continuation_Mark)); } -static int with_cont_mark_FIXUP(void *p) { +static int with_cont_mark_FIXUP(void *p, struct NewGC *gc) { Scheme_With_Continuation_Mark *w = (Scheme_With_Continuation_Mark *)p; - gcFIXUP(w->key); - gcFIXUP(w->val); - gcFIXUP(w->body); + gcFIXUP2(w->key, gc); + gcFIXUP2(w->val, gc); + gcFIXUP2(w->body, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_With_Continuation_Mark)); @@ -617,28 +617,28 @@ static int with_cont_mark_FIXUP(void *p) { #define with_cont_mark_IS_CONST_SIZE 1 -static int comp_let_value_SIZE(void *p) { +static int comp_let_value_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Compiled_Let_Value)); } -static int comp_let_value_MARK(void *p) { +static int comp_let_value_MARK(void *p, struct NewGC *gc) { Scheme_Compiled_Let_Value *c = (Scheme_Compiled_Let_Value *)p; - gcMARK(c->flags); - gcMARK(c->value); - gcMARK(c->body); + gcMARK2(c->flags, gc); + gcMARK2(c->value, gc); + gcMARK2(c->body, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Compiled_Let_Value)); } -static int comp_let_value_FIXUP(void *p) { +static int comp_let_value_FIXUP(void *p, struct NewGC *gc) { Scheme_Compiled_Let_Value *c = (Scheme_Compiled_Let_Value *)p; - gcFIXUP(c->flags); - gcFIXUP(c->value); - gcFIXUP(c->body); + gcFIXUP2(c->flags, gc); + gcFIXUP2(c->value, gc); + gcFIXUP2(c->body, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Compiled_Let_Value)); @@ -648,24 +648,24 @@ static int comp_let_value_FIXUP(void *p) { #define comp_let_value_IS_CONST_SIZE 1 -static int let_header_SIZE(void *p) { +static int let_header_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Let_Header)); } -static int let_header_MARK(void *p) { +static int let_header_MARK(void *p, struct NewGC *gc) { Scheme_Let_Header *h = (Scheme_Let_Header *)p; - gcMARK(h->body); + gcMARK2(h->body, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Let_Header)); } -static int let_header_FIXUP(void *p) { +static int let_header_FIXUP(void *p, struct NewGC *gc) { Scheme_Let_Header *h = (Scheme_Let_Header *)p; - gcFIXUP(h->body); + gcFIXUP2(h->body, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Let_Header)); @@ -675,7 +675,7 @@ static int let_header_FIXUP(void *p) { #define let_header_IS_CONST_SIZE 1 -static int prim_proc_SIZE(void *p) { +static int prim_proc_SIZE(void *p, struct NewGC *gc) { Scheme_Primitive_Proc *prim = (Scheme_Primitive_Proc *)p; return @@ -687,18 +687,18 @@ static int prim_proc_SIZE(void *p) { : gcBYTES_TO_WORDS(sizeof(Scheme_Primitive_Proc)))); } -static int prim_proc_MARK(void *p) { +static int prim_proc_MARK(void *p, struct NewGC *gc) { Scheme_Primitive_Proc *prim = (Scheme_Primitive_Proc *)p; - gcMARK(prim->name); + gcMARK2(prim->name, gc); if (prim->mina < 0) { - gcMARK(prim->mu.cases); + gcMARK2(prim->mu.cases, gc); } if (prim->pp.flags & SCHEME_PRIM_IS_CLOSURE) { Scheme_Primitive_Closure *cc = (Scheme_Primitive_Closure *)prim; int i; for (i = cc->count; i--; ) { - gcMARK(cc->val[i]); + gcMARK2(cc->val[i], gc); } } @@ -711,18 +711,18 @@ static int prim_proc_MARK(void *p) { : gcBYTES_TO_WORDS(sizeof(Scheme_Primitive_Proc)))); } -static int prim_proc_FIXUP(void *p) { +static int prim_proc_FIXUP(void *p, struct NewGC *gc) { Scheme_Primitive_Proc *prim = (Scheme_Primitive_Proc *)p; - gcFIXUP(prim->name); + gcFIXUP2(prim->name, gc); if (prim->mina < 0) { - gcFIXUP(prim->mu.cases); + gcFIXUP2(prim->mu.cases, gc); } if (prim->pp.flags & SCHEME_PRIM_IS_CLOSURE) { Scheme_Primitive_Closure *cc = (Scheme_Primitive_Closure *)prim; int i; for (i = cc->count; i--; ) { - gcFIXUP(cc->val[i]); + gcFIXUP2(cc->val[i], gc); } } @@ -739,7 +739,7 @@ static int prim_proc_FIXUP(void *p) { #define prim_proc_IS_CONST_SIZE 0 -static int closed_prim_proc_SIZE(void *p) { +static int closed_prim_proc_SIZE(void *p, struct NewGC *gc) { Scheme_Closed_Primitive_Proc *c = (Scheme_Closed_Primitive_Proc *)p; return @@ -750,13 +750,13 @@ static int closed_prim_proc_SIZE(void *p) { : gcBYTES_TO_WORDS(sizeof(Scheme_Closed_Primitive_Proc)))); } -static int closed_prim_proc_MARK(void *p) { +static int closed_prim_proc_MARK(void *p, struct NewGC *gc) { Scheme_Closed_Primitive_Proc *c = (Scheme_Closed_Primitive_Proc *)p; - gcMARK(c->name); - gcMARK(SCHEME_CLSD_PRIM_DATA(c)); + gcMARK2(c->name, gc); + gcMARK2(SCHEME_CLSD_PRIM_DATA(c), gc); if (c->mina == -2) { - gcMARK(((Scheme_Closed_Case_Primitive_Proc *)c)->cases); + gcMARK2(((Scheme_Closed_Case_Primitive_Proc *)c)->cases, gc); } return @@ -767,13 +767,13 @@ static int closed_prim_proc_MARK(void *p) { : gcBYTES_TO_WORDS(sizeof(Scheme_Closed_Primitive_Proc)))); } -static int closed_prim_proc_FIXUP(void *p) { +static int closed_prim_proc_FIXUP(void *p, struct NewGC *gc) { Scheme_Closed_Primitive_Proc *c = (Scheme_Closed_Primitive_Proc *)p; - gcFIXUP(c->name); - gcFIXUP(SCHEME_CLSD_PRIM_DATA(c)); + gcFIXUP2(c->name, gc); + gcFIXUP2(SCHEME_CLSD_PRIM_DATA(c), gc); if (c->mina == -2) { - gcFIXUP(((Scheme_Closed_Case_Primitive_Proc *)c)->cases); + gcFIXUP2(((Scheme_Closed_Case_Primitive_Proc *)c)->cases, gc); } return @@ -788,7 +788,7 @@ static int closed_prim_proc_FIXUP(void *p) { #define closed_prim_proc_IS_CONST_SIZE 0 -static int scm_closure_SIZE(void *p) { +static int scm_closure_SIZE(void *p, struct NewGC *gc) { Scheme_Closure *c = (Scheme_Closure *)p; int closure_size = (c->code ? ((Scheme_Closure_Data *)GC_resolve(c->code))->closure_size @@ -799,7 +799,7 @@ static int scm_closure_SIZE(void *p) { + (closure_size - 1) * sizeof(Scheme_Object *))); } -static int scm_closure_MARK(void *p) { +static int scm_closure_MARK(void *p, struct NewGC *gc) { Scheme_Closure *c = (Scheme_Closure *)p; int closure_size = (c->code ? ((Scheme_Closure_Data *)GC_resolve(c->code))->closure_size @@ -808,15 +808,15 @@ static int scm_closure_MARK(void *p) { int i = closure_size; while (i--) - gcMARK(c->vals[i]); - gcMARK(c->code); + gcMARK2(c->vals[i], gc); + gcMARK2(c->code, gc); return gcBYTES_TO_WORDS((sizeof(Scheme_Closure) + (closure_size - 1) * sizeof(Scheme_Object *))); } -static int scm_closure_FIXUP(void *p) { +static int scm_closure_FIXUP(void *p, struct NewGC *gc) { Scheme_Closure *c = (Scheme_Closure *)p; int closure_size = (c->code ? ((Scheme_Closure_Data *)GC_resolve(c->code))->closure_size @@ -825,8 +825,8 @@ static int scm_closure_FIXUP(void *p) { int i = closure_size; while (i--) - gcFIXUP(c->vals[i]); - gcFIXUP(c->code); + gcFIXUP2(c->vals[i], gc); + gcFIXUP2(c->code, gc); return gcBYTES_TO_WORDS((sizeof(Scheme_Closure) @@ -837,7 +837,7 @@ static int scm_closure_FIXUP(void *p) { #define scm_closure_IS_CONST_SIZE 0 -static int case_closure_SIZE(void *p) { +static int case_closure_SIZE(void *p, struct NewGC *gc) { Scheme_Case_Lambda *c = (Scheme_Case_Lambda *)p; return @@ -845,16 +845,16 @@ static int case_closure_SIZE(void *p) { + ((c->count - 1) * sizeof(Scheme_Object *)))); } -static int case_closure_MARK(void *p) { +static int case_closure_MARK(void *p, struct NewGC *gc) { Scheme_Case_Lambda *c = (Scheme_Case_Lambda *)p; int i; for (i = c->count; i--; ) - gcMARK(c->array[i]); - gcMARK(c->name); + gcMARK2(c->array[i], gc); + gcMARK2(c->name, gc); #ifdef MZ_USE_JIT - gcMARK(c->native_code); + gcMARK2(c->native_code, gc); #endif return @@ -862,16 +862,16 @@ static int case_closure_MARK(void *p) { + ((c->count - 1) * sizeof(Scheme_Object *)))); } -static int case_closure_FIXUP(void *p) { +static int case_closure_FIXUP(void *p, struct NewGC *gc) { Scheme_Case_Lambda *c = (Scheme_Case_Lambda *)p; int i; for (i = c->count; i--; ) - gcFIXUP(c->array[i]); - gcFIXUP(c->name); + gcFIXUP2(c->array[i], gc); + gcFIXUP2(c->name, gc); #ifdef MZ_USE_JIT - gcFIXUP(c->native_code); + gcFIXUP2(c->native_code, gc); #endif return @@ -883,86 +883,86 @@ static int case_closure_FIXUP(void *p) { #define case_closure_IS_CONST_SIZE 0 -static int cont_proc_SIZE(void *p) { +static int cont_proc_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Cont)); } -static int cont_proc_MARK(void *p) { +static int cont_proc_MARK(void *p, struct NewGC *gc) { Scheme_Cont *c = (Scheme_Cont *)p; - gcMARK(c->dw); - gcMARK(c->prompt_tag); - gcMARK(c->meta_continuation); - gcMARK(c->common_dw); - gcMARK(c->save_overflow); - gcMARK(c->runstack_copied); - gcMARK(c->runstack_owner); - gcMARK(c->cont_mark_stack_copied); - gcMARK(c->cont_mark_stack_owner); - gcMARK(c->init_config); - gcMARK(c->init_break_cell); + gcMARK2(c->dw, gc); + gcMARK2(c->prompt_tag, gc); + gcMARK2(c->meta_continuation, gc); + gcMARK2(c->common_dw, gc); + gcMARK2(c->save_overflow, gc); + gcMARK2(c->runstack_copied, gc); + gcMARK2(c->runstack_owner, gc); + gcMARK2(c->cont_mark_stack_copied, gc); + gcMARK2(c->cont_mark_stack_owner, gc); + gcMARK2(c->init_config, gc); + gcMARK2(c->init_break_cell, gc); #ifdef MZ_USE_JIT - gcMARK(c->native_trace); + gcMARK2(c->native_trace, gc); #endif - MARK_jmpup(&c->buf); - MARK_cjs(&c->cjs); - MARK_stack_state(&c->ss); - gcMARK(c->barrier_prompt); + MARK_jmpup(&c->buf, gc); + MARK_cjs(&c->cjs, gc); + MARK_stack_state(&c->ss, gc); + gcMARK2(c->barrier_prompt, gc); if (!GC_merely_accounting()) { - gcMARK(c->runstack_start); - gcMARK(c->runstack_saved); + gcMARK2(c->runstack_start, gc); + gcMARK2(c->runstack_saved, gc); } - gcMARK(c->prompt_id); - gcMARK(c->prompt_buf); + gcMARK2(c->prompt_id, gc); + gcMARK2(c->prompt_buf, gc); - gcMARK(c->value); - gcMARK(c->resume_to); - gcMARK(c->use_next_cont); - gcMARK(c->extra_marks); - gcMARK(c->shortcut_prompt); + gcMARK2(c->value, gc); + gcMARK2(c->resume_to, gc); + gcMARK2(c->use_next_cont, gc); + gcMARK2(c->extra_marks, gc); + gcMARK2(c->shortcut_prompt, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Cont)); } -static int cont_proc_FIXUP(void *p) { +static int cont_proc_FIXUP(void *p, struct NewGC *gc) { Scheme_Cont *c = (Scheme_Cont *)p; - gcFIXUP(c->dw); - gcFIXUP(c->prompt_tag); - gcFIXUP(c->meta_continuation); - gcFIXUP(c->common_dw); - gcFIXUP(c->save_overflow); - gcFIXUP(c->runstack_copied); - gcFIXUP(c->runstack_owner); - gcFIXUP(c->cont_mark_stack_copied); - gcFIXUP(c->cont_mark_stack_owner); - gcFIXUP(c->init_config); - gcFIXUP(c->init_break_cell); + gcFIXUP2(c->dw, gc); + gcFIXUP2(c->prompt_tag, gc); + gcFIXUP2(c->meta_continuation, gc); + gcFIXUP2(c->common_dw, gc); + gcFIXUP2(c->save_overflow, gc); + gcFIXUP2(c->runstack_copied, gc); + gcFIXUP2(c->runstack_owner, gc); + gcFIXUP2(c->cont_mark_stack_copied, gc); + gcFIXUP2(c->cont_mark_stack_owner, gc); + gcFIXUP2(c->init_config, gc); + gcFIXUP2(c->init_break_cell, gc); #ifdef MZ_USE_JIT - gcFIXUP(c->native_trace); + gcFIXUP2(c->native_trace, gc); #endif - FIXUP_jmpup(&c->buf); - FIXUP_cjs(&c->cjs); - FIXUP_stack_state(&c->ss); - gcFIXUP(c->barrier_prompt); + FIXUP_jmpup(&c->buf, gc); + FIXUP_cjs(&c->cjs, gc); + FIXUP_stack_state(&c->ss, gc); + gcFIXUP2(c->barrier_prompt, gc); if (!GC_merely_accounting()) { - gcFIXUP(c->runstack_start); - gcFIXUP(c->runstack_saved); + gcFIXUP2(c->runstack_start, gc); + gcFIXUP2(c->runstack_saved, gc); } - gcFIXUP(c->prompt_id); - gcFIXUP(c->prompt_buf); + gcFIXUP2(c->prompt_id, gc); + gcFIXUP2(c->prompt_buf, gc); - gcFIXUP(c->value); - gcFIXUP(c->resume_to); - gcFIXUP(c->use_next_cont); - gcFIXUP(c->extra_marks); - gcFIXUP(c->shortcut_prompt); + gcFIXUP2(c->value, gc); + gcFIXUP2(c->resume_to, gc); + gcFIXUP2(c->use_next_cont, gc); + gcFIXUP2(c->extra_marks, gc); + gcFIXUP2(c->shortcut_prompt, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Cont)); @@ -972,32 +972,32 @@ static int cont_proc_FIXUP(void *p) { #define cont_proc_IS_CONST_SIZE 1 -static int meta_cont_proc_SIZE(void *p) { +static int meta_cont_proc_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Meta_Continuation)); } -static int meta_cont_proc_MARK(void *p) { +static int meta_cont_proc_MARK(void *p, struct NewGC *gc) { Scheme_Meta_Continuation *c = (Scheme_Meta_Continuation *)p; - gcMARK(c->prompt_tag); - gcMARK(c->overflow); - gcMARK(c->next); - gcMARK(c->cont_mark_stack_copied); - gcMARK(c->cont); + gcMARK2(c->prompt_tag, gc); + gcMARK2(c->overflow, gc); + gcMARK2(c->next, gc); + gcMARK2(c->cont_mark_stack_copied, gc); + gcMARK2(c->cont, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Meta_Continuation)); } -static int meta_cont_proc_FIXUP(void *p) { +static int meta_cont_proc_FIXUP(void *p, struct NewGC *gc) { Scheme_Meta_Continuation *c = (Scheme_Meta_Continuation *)p; - gcFIXUP(c->prompt_tag); - gcFIXUP(c->overflow); - gcFIXUP(c->next); - gcFIXUP(c->cont_mark_stack_copied); - gcFIXUP(c->cont); + gcFIXUP2(c->prompt_tag, gc); + gcFIXUP2(c->overflow, gc); + gcFIXUP2(c->next, gc); + gcFIXUP2(c->cont_mark_stack_copied, gc); + gcFIXUP2(c->cont, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Meta_Continuation)); @@ -1007,34 +1007,34 @@ static int meta_cont_proc_FIXUP(void *p) { #define meta_cont_proc_IS_CONST_SIZE 1 -static int mark_dyn_wind_SIZE(void *p) { +static int mark_dyn_wind_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Dynamic_Wind)); } -static int mark_dyn_wind_MARK(void *p) { +static int mark_dyn_wind_MARK(void *p, struct NewGC *gc) { Scheme_Dynamic_Wind *dw = (Scheme_Dynamic_Wind *)p; - gcMARK(dw->id); - gcMARK(dw->data); - gcMARK(dw->prompt_tag); - gcMARK(dw->prev); + gcMARK2(dw->id, gc); + gcMARK2(dw->data, gc); + gcMARK2(dw->prompt_tag, gc); + gcMARK2(dw->prev, gc); - MARK_stack_state(&dw->envss); + MARK_stack_state(&dw->envss, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Dynamic_Wind)); } -static int mark_dyn_wind_FIXUP(void *p) { +static int mark_dyn_wind_FIXUP(void *p, struct NewGC *gc) { Scheme_Dynamic_Wind *dw = (Scheme_Dynamic_Wind *)p; - gcFIXUP(dw->id); - gcFIXUP(dw->data); - gcFIXUP(dw->prompt_tag); - gcFIXUP(dw->prev); + gcFIXUP2(dw->id, gc); + gcFIXUP2(dw->data, gc); + gcFIXUP2(dw->prompt_tag, gc); + gcFIXUP2(dw->prev, gc); - FIXUP_stack_state(&dw->envss); + FIXUP_stack_state(&dw->envss, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Dynamic_Wind)); @@ -1044,28 +1044,28 @@ static int mark_dyn_wind_FIXUP(void *p) { #define mark_dyn_wind_IS_CONST_SIZE 1 -static int mark_overflow_SIZE(void *p) { +static int mark_overflow_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Overflow)); } -static int mark_overflow_MARK(void *p) { +static int mark_overflow_MARK(void *p, struct NewGC *gc) { Scheme_Overflow *o = (Scheme_Overflow *)p; - gcMARK(o->prev); - gcMARK(o->jmp); - gcMARK(o->id); + gcMARK2(o->prev, gc); + gcMARK2(o->jmp, gc); + gcMARK2(o->id, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Overflow)); } -static int mark_overflow_FIXUP(void *p) { +static int mark_overflow_FIXUP(void *p, struct NewGC *gc) { Scheme_Overflow *o = (Scheme_Overflow *)p; - gcFIXUP(o->prev); - gcFIXUP(o->jmp); - gcFIXUP(o->id); + gcFIXUP2(o->prev, gc); + gcFIXUP2(o->jmp, gc); + gcFIXUP2(o->id, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Overflow)); @@ -1075,24 +1075,24 @@ static int mark_overflow_FIXUP(void *p) { #define mark_overflow_IS_CONST_SIZE 1 -static int mark_overflow_jmp_SIZE(void *p) { +static int mark_overflow_jmp_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Overflow_Jmp)); } -static int mark_overflow_jmp_MARK(void *p) { +static int mark_overflow_jmp_MARK(void *p, struct NewGC *gc) { Scheme_Overflow_Jmp *o = (Scheme_Overflow_Jmp *)p; - MARK_jmpup(&o->cont); + MARK_jmpup(&o->cont, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Overflow_Jmp)); } -static int mark_overflow_jmp_FIXUP(void *p) { +static int mark_overflow_jmp_FIXUP(void *p, struct NewGC *gc) { Scheme_Overflow_Jmp *o = (Scheme_Overflow_Jmp *)p; - FIXUP_jmpup(&o->cont); + FIXUP_jmpup(&o->cont, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Overflow_Jmp)); @@ -1102,34 +1102,34 @@ static int mark_overflow_jmp_FIXUP(void *p) { #define mark_overflow_jmp_IS_CONST_SIZE 1 -static int escaping_cont_proc_SIZE(void *p) { +static int escaping_cont_proc_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Escaping_Cont)); } -static int escaping_cont_proc_MARK(void *p) { +static int escaping_cont_proc_MARK(void *p, struct NewGC *gc) { Scheme_Escaping_Cont *c = (Scheme_Escaping_Cont *)p; #ifdef MZ_USE_JIT - gcMARK(c->native_trace); + gcMARK2(c->native_trace, gc); #endif - gcMARK(c->barrier_prompt); - MARK_stack_state(&c->envss); + gcMARK2(c->barrier_prompt, gc); + MARK_stack_state(&c->envss, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Escaping_Cont)); } -static int escaping_cont_proc_FIXUP(void *p) { +static int escaping_cont_proc_FIXUP(void *p, struct NewGC *gc) { Scheme_Escaping_Cont *c = (Scheme_Escaping_Cont *)p; #ifdef MZ_USE_JIT - gcFIXUP(c->native_trace); + gcFIXUP2(c->native_trace, gc); #endif - gcFIXUP(c->barrier_prompt); - FIXUP_stack_state(&c->envss); + gcFIXUP2(c->barrier_prompt, gc); + FIXUP_stack_state(&c->envss, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Escaping_Cont)); @@ -1139,17 +1139,17 @@ static int escaping_cont_proc_FIXUP(void *p) { #define escaping_cont_proc_IS_CONST_SIZE 1 -static int char_obj_SIZE(void *p) { +static int char_obj_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Small_Object)); } -static int char_obj_MARK(void *p) { +static int char_obj_MARK(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Small_Object)); } -static int char_obj_FIXUP(void *p) { +static int char_obj_FIXUP(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Small_Object)); } @@ -1158,7 +1158,7 @@ static int char_obj_FIXUP(void *p) { #define char_obj_IS_CONST_SIZE 1 -static int bignum_obj_SIZE(void *p) { +static int bignum_obj_SIZE(void *p, struct NewGC *gc) { Scheme_Bignum *b = (Scheme_Bignum *)p; return @@ -1167,11 +1167,11 @@ static int bignum_obj_SIZE(void *p) { : gcBYTES_TO_WORDS(sizeof(Small_Bignum))); } -static int bignum_obj_MARK(void *p) { +static int bignum_obj_MARK(void *p, struct NewGC *gc) { Scheme_Bignum *b = (Scheme_Bignum *)p; if (!SCHEME_BIGINLINE(b)) { - gcMARK(b->digits); + gcMARK2(b->digits, gc); } else { } @@ -1182,11 +1182,11 @@ static int bignum_obj_MARK(void *p) { : gcBYTES_TO_WORDS(sizeof(Small_Bignum))); } -static int bignum_obj_FIXUP(void *p) { +static int bignum_obj_FIXUP(void *p, struct NewGC *gc) { Scheme_Bignum *b = (Scheme_Bignum *)p; if (!SCHEME_BIGINLINE(b)) { - gcFIXUP(b->digits); + gcFIXUP2(b->digits, gc); } else { b->digits = ((Small_Bignum *)GC_fixup_self(b))->v; } @@ -1201,26 +1201,26 @@ static int bignum_obj_FIXUP(void *p) { #define bignum_obj_IS_CONST_SIZE 0 -static int rational_obj_SIZE(void *p) { +static int rational_obj_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Rational)); } -static int rational_obj_MARK(void *p) { +static int rational_obj_MARK(void *p, struct NewGC *gc) { Scheme_Rational *r = (Scheme_Rational *)p; - gcMARK(r->num); - gcMARK(r->denom); + gcMARK2(r->num, gc); + gcMARK2(r->denom, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Rational)); } -static int rational_obj_FIXUP(void *p) { +static int rational_obj_FIXUP(void *p, struct NewGC *gc) { Scheme_Rational *r = (Scheme_Rational *)p; - gcFIXUP(r->num); - gcFIXUP(r->denom); + gcFIXUP2(r->num, gc); + gcFIXUP2(r->denom, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Rational)); @@ -1230,7 +1230,7 @@ static int rational_obj_FIXUP(void *p) { #define rational_obj_IS_CONST_SIZE 1 -static int float_obj_SIZE(void *p) { +static int float_obj_SIZE(void *p, struct NewGC *gc) { return #ifdef MZ_USE_SINGLE_FLOATS gcBYTES_TO_WORDS(sizeof(Scheme_Float)); @@ -1239,7 +1239,7 @@ static int float_obj_SIZE(void *p) { #endif } -static int float_obj_MARK(void *p) { +static int float_obj_MARK(void *p, struct NewGC *gc) { return #ifdef MZ_USE_SINGLE_FLOATS gcBYTES_TO_WORDS(sizeof(Scheme_Float)); @@ -1248,7 +1248,7 @@ static int float_obj_MARK(void *p) { #endif } -static int float_obj_FIXUP(void *p) { +static int float_obj_FIXUP(void *p, struct NewGC *gc) { return #ifdef MZ_USE_SINGLE_FLOATS gcBYTES_TO_WORDS(sizeof(Scheme_Float)); @@ -1261,17 +1261,17 @@ static int float_obj_FIXUP(void *p) { #define float_obj_IS_CONST_SIZE 0 -static int double_obj_SIZE(void *p) { +static int double_obj_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Double)); } -static int double_obj_MARK(void *p) { +static int double_obj_MARK(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Double)); } -static int double_obj_FIXUP(void *p) { +static int double_obj_FIXUP(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Double)); } @@ -1280,26 +1280,26 @@ static int double_obj_FIXUP(void *p) { #define double_obj_IS_CONST_SIZE 1 -static int complex_obj_SIZE(void *p) { +static int complex_obj_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Complex)); } -static int complex_obj_MARK(void *p) { +static int complex_obj_MARK(void *p, struct NewGC *gc) { Scheme_Complex *c = (Scheme_Complex *)p; - gcMARK(c->r); - gcMARK(c->i); + gcMARK2(c->r, gc); + gcMARK2(c->i, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Complex)); } -static int complex_obj_FIXUP(void *p) { +static int complex_obj_FIXUP(void *p, struct NewGC *gc) { Scheme_Complex *c = (Scheme_Complex *)p; - gcFIXUP(c->r); - gcFIXUP(c->i); + gcFIXUP2(c->r, gc); + gcFIXUP2(c->i, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Complex)); @@ -1309,22 +1309,22 @@ static int complex_obj_FIXUP(void *p) { #define complex_obj_IS_CONST_SIZE 1 -static int string_obj_SIZE(void *p) { +static int string_obj_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Simple_Object)); } -static int string_obj_MARK(void *p) { +static int string_obj_MARK(void *p, struct NewGC *gc) { Scheme_Object *o = (Scheme_Object *)p; - gcMARK(SCHEME_CHAR_STR_VAL(o)); + gcMARK2(SCHEME_CHAR_STR_VAL(o), gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Simple_Object)); } -static int string_obj_FIXUP(void *p) { +static int string_obj_FIXUP(void *p, struct NewGC *gc) { Scheme_Object *o = (Scheme_Object *)p; - gcFIXUP(SCHEME_CHAR_STR_VAL(o)); + gcFIXUP2(SCHEME_CHAR_STR_VAL(o), gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Simple_Object)); @@ -1334,22 +1334,22 @@ static int string_obj_FIXUP(void *p) { #define string_obj_IS_CONST_SIZE 1 -static int bstring_obj_SIZE(void *p) { +static int bstring_obj_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Simple_Object)); } -static int bstring_obj_MARK(void *p) { +static int bstring_obj_MARK(void *p, struct NewGC *gc) { Scheme_Object *o = (Scheme_Object *)p; - gcMARK(SCHEME_BYTE_STR_VAL(o)); + gcMARK2(SCHEME_BYTE_STR_VAL(o), gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Simple_Object)); } -static int bstring_obj_FIXUP(void *p) { +static int bstring_obj_FIXUP(void *p, struct NewGC *gc) { Scheme_Object *o = (Scheme_Object *)p; - gcFIXUP(SCHEME_BYTE_STR_VAL(o)); + gcFIXUP2(SCHEME_BYTE_STR_VAL(o), gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Simple_Object)); @@ -1359,21 +1359,21 @@ static int bstring_obj_FIXUP(void *p) { #define bstring_obj_IS_CONST_SIZE 1 -static int symbol_obj_SIZE(void *p) { +static int symbol_obj_SIZE(void *p, struct NewGC *gc) { Scheme_Symbol *s = (Scheme_Symbol *)p; return gcBYTES_TO_WORDS(sizeof(Scheme_Symbol) + s->len - 3); } -static int symbol_obj_MARK(void *p) { +static int symbol_obj_MARK(void *p, struct NewGC *gc) { Scheme_Symbol *s = (Scheme_Symbol *)p; return gcBYTES_TO_WORDS(sizeof(Scheme_Symbol) + s->len - 3); } -static int symbol_obj_FIXUP(void *p) { +static int symbol_obj_FIXUP(void *p, struct NewGC *gc) { Scheme_Symbol *s = (Scheme_Symbol *)p; return @@ -1384,26 +1384,26 @@ static int symbol_obj_FIXUP(void *p) { #define symbol_obj_IS_CONST_SIZE 0 -static int cons_cell_SIZE(void *p) { +static int cons_cell_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Simple_Object)); } -static int cons_cell_MARK(void *p) { +static int cons_cell_MARK(void *p, struct NewGC *gc) { Scheme_Object *o = (Scheme_Object *)p; - gcMARK(SCHEME_CAR(o)); - gcMARK(SCHEME_CDR(o)); + gcMARK2(SCHEME_CAR(o), gc); + gcMARK2(SCHEME_CDR(o), gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Simple_Object)); } -static int cons_cell_FIXUP(void *p) { +static int cons_cell_FIXUP(void *p, struct NewGC *gc) { Scheme_Object *o = (Scheme_Object *)p; - gcFIXUP(SCHEME_CAR(o)); - gcFIXUP(SCHEME_CDR(o)); + gcFIXUP2(SCHEME_CAR(o), gc); + gcFIXUP2(SCHEME_CDR(o), gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Simple_Object)); @@ -1413,7 +1413,7 @@ static int cons_cell_FIXUP(void *p) { #define cons_cell_IS_CONST_SIZE 1 -static int vector_obj_SIZE(void *p) { +static int vector_obj_SIZE(void *p, struct NewGC *gc) { Scheme_Vector *vec = (Scheme_Vector *)p; return @@ -1421,24 +1421,24 @@ static int vector_obj_SIZE(void *p) { + ((vec->size - 1) * sizeof(Scheme_Object *)))); } -static int vector_obj_MARK(void *p) { +static int vector_obj_MARK(void *p, struct NewGC *gc) { Scheme_Vector *vec = (Scheme_Vector *)p; int i; for (i = vec->size; i--; ) - gcMARK(vec->els[i]); + gcMARK2(vec->els[i], gc); return gcBYTES_TO_WORDS((sizeof(Scheme_Vector) + ((vec->size - 1) * sizeof(Scheme_Object *)))); } -static int vector_obj_FIXUP(void *p) { +static int vector_obj_FIXUP(void *p, struct NewGC *gc) { Scheme_Vector *vec = (Scheme_Vector *)p; int i; for (i = vec->size; i--; ) - gcFIXUP(vec->els[i]); + gcFIXUP2(vec->els[i], gc); return gcBYTES_TO_WORDS((sizeof(Scheme_Vector) @@ -1449,7 +1449,7 @@ static int vector_obj_FIXUP(void *p) { #define vector_obj_IS_CONST_SIZE 0 -static int flvector_obj_SIZE(void *p) { +static int flvector_obj_SIZE(void *p, struct NewGC *gc) { Scheme_Double_Vector *vec = (Scheme_Double_Vector *)p; return @@ -1457,7 +1457,7 @@ static int flvector_obj_SIZE(void *p) { + ((vec->size - 1) * sizeof(double)))); } -static int flvector_obj_MARK(void *p) { +static int flvector_obj_MARK(void *p, struct NewGC *gc) { Scheme_Double_Vector *vec = (Scheme_Double_Vector *)p; return @@ -1465,7 +1465,7 @@ static int flvector_obj_MARK(void *p) { + ((vec->size - 1) * sizeof(double)))); } -static int flvector_obj_FIXUP(void *p) { +static int flvector_obj_FIXUP(void *p, struct NewGC *gc) { Scheme_Double_Vector *vec = (Scheme_Double_Vector *)p; return @@ -1477,56 +1477,56 @@ static int flvector_obj_FIXUP(void *p) { #define flvector_obj_IS_CONST_SIZE 0 -static int input_port_SIZE(void *p) { +static int input_port_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Input_Port)); } -static int input_port_MARK(void *p) { +static int input_port_MARK(void *p, struct NewGC *gc) { Scheme_Input_Port *ip = (Scheme_Input_Port *)p; - gcMARK(ip->sub_type); - gcMARK(ip->port_data); - gcMARK(ip->name); - gcMARK(ip->peeked_read); - gcMARK(ip->peeked_write); - gcMARK(ip->read_handler); - gcMARK(ip->mref); - gcMARK(ip->output_half); - gcMARK(ip->special); - gcMARK(ip->ungotten_special); - gcMARK(ip->progress_evt); - gcMARK(ip->input_lock); - gcMARK(ip->input_giveup); - gcMARK(ip->input_extras); - gcMARK(ip->input_extras_ready); - gcMARK(ip->unless); - gcMARK(ip->unless_cache); + gcMARK2(ip->sub_type, gc); + gcMARK2(ip->port_data, gc); + gcMARK2(ip->name, gc); + gcMARK2(ip->peeked_read, gc); + gcMARK2(ip->peeked_write, gc); + gcMARK2(ip->read_handler, gc); + gcMARK2(ip->mref, gc); + gcMARK2(ip->output_half, gc); + gcMARK2(ip->special, gc); + gcMARK2(ip->ungotten_special, gc); + gcMARK2(ip->progress_evt, gc); + gcMARK2(ip->input_lock, gc); + gcMARK2(ip->input_giveup, gc); + gcMARK2(ip->input_extras, gc); + gcMARK2(ip->input_extras_ready, gc); + gcMARK2(ip->unless, gc); + gcMARK2(ip->unless_cache, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Input_Port)); } -static int input_port_FIXUP(void *p) { +static int input_port_FIXUP(void *p, struct NewGC *gc) { Scheme_Input_Port *ip = (Scheme_Input_Port *)p; - gcFIXUP(ip->sub_type); - gcFIXUP(ip->port_data); - gcFIXUP(ip->name); - gcFIXUP(ip->peeked_read); - gcFIXUP(ip->peeked_write); - gcFIXUP(ip->read_handler); - gcFIXUP(ip->mref); - gcFIXUP(ip->output_half); - gcFIXUP(ip->special); - gcFIXUP(ip->ungotten_special); - gcFIXUP(ip->progress_evt); - gcFIXUP(ip->input_lock); - gcFIXUP(ip->input_giveup); - gcFIXUP(ip->input_extras); - gcFIXUP(ip->input_extras_ready); - gcFIXUP(ip->unless); - gcFIXUP(ip->unless_cache); + gcFIXUP2(ip->sub_type, gc); + gcFIXUP2(ip->port_data, gc); + gcFIXUP2(ip->name, gc); + gcFIXUP2(ip->peeked_read, gc); + gcFIXUP2(ip->peeked_write, gc); + gcFIXUP2(ip->read_handler, gc); + gcFIXUP2(ip->mref, gc); + gcFIXUP2(ip->output_half, gc); + gcFIXUP2(ip->special, gc); + gcFIXUP2(ip->ungotten_special, gc); + gcFIXUP2(ip->progress_evt, gc); + gcFIXUP2(ip->input_lock, gc); + gcFIXUP2(ip->input_giveup, gc); + gcFIXUP2(ip->input_extras, gc); + gcFIXUP2(ip->input_extras_ready, gc); + gcFIXUP2(ip->unless, gc); + gcFIXUP2(ip->unless_cache, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Input_Port)); @@ -1536,38 +1536,38 @@ static int input_port_FIXUP(void *p) { #define input_port_IS_CONST_SIZE 1 -static int output_port_SIZE(void *p) { +static int output_port_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Output_Port)); } -static int output_port_MARK(void *p) { +static int output_port_MARK(void *p, struct NewGC *gc) { Scheme_Output_Port *op = (Scheme_Output_Port *)p; - gcMARK(op->sub_type); - gcMARK(op->port_data); - gcMARK(op->name); - gcMARK(op->display_handler); - gcMARK(op->write_handler); - gcMARK(op->print_handler); - gcMARK(op->mref); - gcMARK(op->input_half); + gcMARK2(op->sub_type, gc); + gcMARK2(op->port_data, gc); + gcMARK2(op->name, gc); + gcMARK2(op->display_handler, gc); + gcMARK2(op->write_handler, gc); + gcMARK2(op->print_handler, gc); + gcMARK2(op->mref, gc); + gcMARK2(op->input_half, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Output_Port)); } -static int output_port_FIXUP(void *p) { +static int output_port_FIXUP(void *p, struct NewGC *gc) { Scheme_Output_Port *op = (Scheme_Output_Port *)p; - gcFIXUP(op->sub_type); - gcFIXUP(op->port_data); - gcFIXUP(op->name); - gcFIXUP(op->display_handler); - gcFIXUP(op->write_handler); - gcFIXUP(op->print_handler); - gcFIXUP(op->mref); - gcFIXUP(op->input_half); + gcFIXUP2(op->sub_type, gc); + gcFIXUP2(op->port_data, gc); + gcFIXUP2(op->name, gc); + gcFIXUP2(op->display_handler, gc); + gcFIXUP2(op->write_handler, gc); + gcFIXUP2(op->print_handler, gc); + gcFIXUP2(op->mref, gc); + gcFIXUP2(op->input_half, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Output_Port)); @@ -1578,17 +1578,17 @@ static int output_port_FIXUP(void *p) { -static int syntax_compiler_SIZE(void *p) { +static int syntax_compiler_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Simple_Object)); } -static int syntax_compiler_MARK(void *p) { +static int syntax_compiler_MARK(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Simple_Object)); } -static int syntax_compiler_FIXUP(void *p) { +static int syntax_compiler_FIXUP(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Simple_Object)); } @@ -1597,231 +1597,231 @@ static int syntax_compiler_FIXUP(void *p) { #define syntax_compiler_IS_CONST_SIZE 1 -static int thread_val_SIZE(void *p) { +static int thread_val_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Thread)); } -static int thread_val_MARK(void *p) { +static int thread_val_MARK(void *p, struct NewGC *gc) { Scheme_Thread *pr = (Scheme_Thread *)p; - gcMARK(pr->next); - gcMARK(pr->prev); + gcMARK2(pr->next, gc); + gcMARK2(pr->prev, gc); - gcMARK(pr->t_set_parent); - gcMARK(pr->t_set_next); - gcMARK(pr->t_set_prev); + gcMARK2(pr->t_set_parent, gc); + gcMARK2(pr->t_set_next, gc); + gcMARK2(pr->t_set_prev, gc); - MARK_cjs(&pr->cjs); - gcMARK(pr->decompose_mc); + MARK_cjs(&pr->cjs, gc); + gcMARK2(pr->decompose_mc, gc); - gcMARK(pr->cell_values); - gcMARK(pr->init_config); - gcMARK(pr->init_break_cell); + gcMARK2(pr->cell_values, gc); + gcMARK2(pr->init_config, gc); + gcMARK2(pr->init_break_cell, gc); if (!pr->runstack_owner || !GC_merely_accounting() || (*pr->runstack_owner == pr)) { Scheme_Object **rs = pr->runstack_start; - gcMARK( pr->runstack_start); + gcMARK2( pr->runstack_start, gc); if (pr->runstack != pr->runstack_start + (pr->runstack - rs)) pr->runstack = pr->runstack_start + (pr->runstack - rs); - gcMARK(pr->runstack_saved); + gcMARK2(pr->runstack_saved, gc); } - gcMARK(pr->runstack_owner); - gcMARK(pr->runstack_swapped); + gcMARK2(pr->runstack_owner, gc); + gcMARK2(pr->runstack_swapped, gc); pr->spare_runstack = NULL; /* just in case */ - gcMARK(pr->meta_prompt); - gcMARK(pr->meta_continuation); + gcMARK2(pr->meta_prompt, gc); + gcMARK2(pr->meta_continuation, gc); - gcMARK(pr->cont_mark_stack_segments); - gcMARK(pr->cont_mark_stack_owner); - gcMARK(pr->cont_mark_stack_swapped); + gcMARK2(pr->cont_mark_stack_segments, gc); + gcMARK2(pr->cont_mark_stack_owner, gc); + gcMARK2(pr->cont_mark_stack_swapped, gc); - MARK_jmpup(&pr->jmpup_buf); + MARK_jmpup(&pr->jmpup_buf, gc); - gcMARK(pr->dw); + gcMARK2(pr->dw, gc); - gcMARK(pr->nester); - gcMARK(pr->nestee); + gcMARK2(pr->nester, gc); + gcMARK2(pr->nestee, gc); - gcMARK(pr->blocker); - gcMARK(pr->overflow); + gcMARK2(pr->blocker, gc); + gcMARK2(pr->overflow, gc); - gcMARK(pr->return_marks_to); - gcMARK(pr->returned_marks); + gcMARK2(pr->return_marks_to, gc); + gcMARK2(pr->returned_marks, gc); - gcMARK(pr->current_local_env); - gcMARK(pr->current_local_mark); - gcMARK(pr->current_local_name); - gcMARK(pr->current_local_certs); - gcMARK(pr->current_local_modidx); - gcMARK(pr->current_local_menv); - gcMARK(pr->current_local_bindings); + gcMARK2(pr->current_local_env, gc); + gcMARK2(pr->current_local_mark, gc); + gcMARK2(pr->current_local_name, gc); + gcMARK2(pr->current_local_certs, gc); + gcMARK2(pr->current_local_modidx, gc); + gcMARK2(pr->current_local_menv, gc); + gcMARK2(pr->current_local_bindings, gc); - gcMARK(pr->current_mt); + gcMARK2(pr->current_mt, gc); - gcMARK(pr->constant_folding); - gcMARK(pr->reading_delayed); + gcMARK2(pr->constant_folding, gc); + gcMARK2(pr->reading_delayed, gc); - gcMARK(pr->overflow_reply); + gcMARK2(pr->overflow_reply, gc); - gcMARK(pr->values_buffer); + gcMARK2(pr->values_buffer, gc); - gcMARK(pr->tail_buffer); + gcMARK2(pr->tail_buffer, gc); - gcMARK(pr->ku.eval.wait_expr); + gcMARK2(pr->ku.eval.wait_expr, gc); - gcMARK(pr->ku.apply.tail_rator); - gcMARK(pr->ku.apply.tail_rands); + gcMARK2(pr->ku.apply.tail_rator, gc); + gcMARK2(pr->ku.apply.tail_rands, gc); - gcMARK(pr->ku.multiple.array); + gcMARK2(pr->ku.multiple.array, gc); - gcMARK(pr->ku.k.p1); - gcMARK(pr->ku.k.p2); - gcMARK(pr->ku.k.p3); - gcMARK(pr->ku.k.p4); - gcMARK(pr->ku.k.p5); + gcMARK2(pr->ku.k.p1, gc); + gcMARK2(pr->ku.k.p2, gc); + gcMARK2(pr->ku.k.p3, gc); + gcMARK2(pr->ku.k.p4, gc); + gcMARK2(pr->ku.k.p5, gc); - gcMARK(pr->list_stack); + gcMARK2(pr->list_stack, gc); - gcMARK(pr->kill_data); - gcMARK(pr->private_kill_data); - gcMARK(pr->private_kill_next); + gcMARK2(pr->kill_data, gc); + gcMARK2(pr->private_kill_data, gc); + gcMARK2(pr->private_kill_next, gc); - gcMARK(pr->user_tls); - gcMARK(pr->gmp_tls_data); + gcMARK2(pr->user_tls, gc); + gcMARK2(pr->gmp_tls_data, gc); - gcMARK(pr->mr_hop); - gcMARK(pr->mref); - gcMARK(pr->extra_mrefs); + gcMARK2(pr->mr_hop, gc); + gcMARK2(pr->mref, gc); + gcMARK2(pr->extra_mrefs, gc); - gcMARK(pr->name); + gcMARK2(pr->name, gc); - gcMARK(pr->transitive_resumes); + gcMARK2(pr->transitive_resumes, gc); - gcMARK(pr->suspended_box); - gcMARK(pr->resumed_box); - gcMARK(pr->dead_box); - gcMARK(pr->running_box); + gcMARK2(pr->suspended_box, gc); + gcMARK2(pr->resumed_box, gc); + gcMARK2(pr->dead_box, gc); + gcMARK2(pr->running_box, gc); - gcMARK(pr->mbox_first); - gcMARK(pr->mbox_last); - gcMARK(pr->mbox_sema); + gcMARK2(pr->mbox_first, gc); + gcMARK2(pr->mbox_last, gc); + gcMARK2(pr->mbox_sema, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Thread)); } -static int thread_val_FIXUP(void *p) { +static int thread_val_FIXUP(void *p, struct NewGC *gc) { Scheme_Thread *pr = (Scheme_Thread *)p; - gcFIXUP(pr->next); - gcFIXUP(pr->prev); + gcFIXUP2(pr->next, gc); + gcFIXUP2(pr->prev, gc); - gcFIXUP(pr->t_set_parent); - gcFIXUP(pr->t_set_next); - gcFIXUP(pr->t_set_prev); + gcFIXUP2(pr->t_set_parent, gc); + gcFIXUP2(pr->t_set_next, gc); + gcFIXUP2(pr->t_set_prev, gc); - FIXUP_cjs(&pr->cjs); - gcFIXUP(pr->decompose_mc); + FIXUP_cjs(&pr->cjs, gc); + gcFIXUP2(pr->decompose_mc, gc); - gcFIXUP(pr->cell_values); - gcFIXUP(pr->init_config); - gcFIXUP(pr->init_break_cell); + gcFIXUP2(pr->cell_values, gc); + gcFIXUP2(pr->init_config, gc); + gcFIXUP2(pr->init_break_cell, gc); if (!pr->runstack_owner || !GC_merely_accounting() || (*pr->runstack_owner == pr)) { Scheme_Object **rs = pr->runstack_start; - gcFIXUP_TYPED_NOW(Scheme_Object **, pr->runstack_start); + gcFIXUP2_TYPED_NOW(Scheme_Object **, pr->runstack_start, gc); if (pr->runstack != pr->runstack_start + (pr->runstack - rs)) pr->runstack = pr->runstack_start + (pr->runstack - rs); - gcFIXUP(pr->runstack_saved); + gcFIXUP2(pr->runstack_saved, gc); } - gcFIXUP(pr->runstack_owner); - gcFIXUP(pr->runstack_swapped); + gcFIXUP2(pr->runstack_owner, gc); + gcFIXUP2(pr->runstack_swapped, gc); pr->spare_runstack = NULL; /* just in case */ - gcFIXUP(pr->meta_prompt); - gcFIXUP(pr->meta_continuation); + gcFIXUP2(pr->meta_prompt, gc); + gcFIXUP2(pr->meta_continuation, gc); - gcFIXUP(pr->cont_mark_stack_segments); - gcFIXUP(pr->cont_mark_stack_owner); - gcFIXUP(pr->cont_mark_stack_swapped); + gcFIXUP2(pr->cont_mark_stack_segments, gc); + gcFIXUP2(pr->cont_mark_stack_owner, gc); + gcFIXUP2(pr->cont_mark_stack_swapped, gc); - FIXUP_jmpup(&pr->jmpup_buf); + FIXUP_jmpup(&pr->jmpup_buf, gc); - gcFIXUP(pr->dw); + gcFIXUP2(pr->dw, gc); - gcFIXUP(pr->nester); - gcFIXUP(pr->nestee); + gcFIXUP2(pr->nester, gc); + gcFIXUP2(pr->nestee, gc); - gcFIXUP(pr->blocker); - gcFIXUP(pr->overflow); + gcFIXUP2(pr->blocker, gc); + gcFIXUP2(pr->overflow, gc); - gcFIXUP(pr->return_marks_to); - gcFIXUP(pr->returned_marks); + gcFIXUP2(pr->return_marks_to, gc); + gcFIXUP2(pr->returned_marks, gc); - gcFIXUP(pr->current_local_env); - gcFIXUP(pr->current_local_mark); - gcFIXUP(pr->current_local_name); - gcFIXUP(pr->current_local_certs); - gcFIXUP(pr->current_local_modidx); - gcFIXUP(pr->current_local_menv); - gcFIXUP(pr->current_local_bindings); + gcFIXUP2(pr->current_local_env, gc); + gcFIXUP2(pr->current_local_mark, gc); + gcFIXUP2(pr->current_local_name, gc); + gcFIXUP2(pr->current_local_certs, gc); + gcFIXUP2(pr->current_local_modidx, gc); + gcFIXUP2(pr->current_local_menv, gc); + gcFIXUP2(pr->current_local_bindings, gc); - gcFIXUP(pr->current_mt); + gcFIXUP2(pr->current_mt, gc); - gcFIXUP(pr->constant_folding); - gcFIXUP(pr->reading_delayed); + gcFIXUP2(pr->constant_folding, gc); + gcFIXUP2(pr->reading_delayed, gc); - gcFIXUP(pr->overflow_reply); + gcFIXUP2(pr->overflow_reply, gc); - gcFIXUP(pr->values_buffer); + gcFIXUP2(pr->values_buffer, gc); - gcFIXUP(pr->tail_buffer); + gcFIXUP2(pr->tail_buffer, gc); - gcFIXUP(pr->ku.eval.wait_expr); + gcFIXUP2(pr->ku.eval.wait_expr, gc); - gcFIXUP(pr->ku.apply.tail_rator); - gcFIXUP(pr->ku.apply.tail_rands); + gcFIXUP2(pr->ku.apply.tail_rator, gc); + gcFIXUP2(pr->ku.apply.tail_rands, gc); - gcFIXUP(pr->ku.multiple.array); + gcFIXUP2(pr->ku.multiple.array, gc); - gcFIXUP(pr->ku.k.p1); - gcFIXUP(pr->ku.k.p2); - gcFIXUP(pr->ku.k.p3); - gcFIXUP(pr->ku.k.p4); - gcFIXUP(pr->ku.k.p5); + gcFIXUP2(pr->ku.k.p1, gc); + gcFIXUP2(pr->ku.k.p2, gc); + gcFIXUP2(pr->ku.k.p3, gc); + gcFIXUP2(pr->ku.k.p4, gc); + gcFIXUP2(pr->ku.k.p5, gc); - gcFIXUP(pr->list_stack); + gcFIXUP2(pr->list_stack, gc); - gcFIXUP(pr->kill_data); - gcFIXUP(pr->private_kill_data); - gcFIXUP(pr->private_kill_next); + gcFIXUP2(pr->kill_data, gc); + gcFIXUP2(pr->private_kill_data, gc); + gcFIXUP2(pr->private_kill_next, gc); - gcFIXUP(pr->user_tls); - gcFIXUP(pr->gmp_tls_data); + gcFIXUP2(pr->user_tls, gc); + gcFIXUP2(pr->gmp_tls_data, gc); - gcFIXUP(pr->mr_hop); - gcFIXUP(pr->mref); - gcFIXUP(pr->extra_mrefs); + gcFIXUP2(pr->mr_hop, gc); + gcFIXUP2(pr->mref, gc); + gcFIXUP2(pr->extra_mrefs, gc); - gcFIXUP(pr->name); + gcFIXUP2(pr->name, gc); - gcFIXUP(pr->transitive_resumes); + gcFIXUP2(pr->transitive_resumes, gc); - gcFIXUP(pr->suspended_box); - gcFIXUP(pr->resumed_box); - gcFIXUP(pr->dead_box); - gcFIXUP(pr->running_box); + gcFIXUP2(pr->suspended_box, gc); + gcFIXUP2(pr->resumed_box, gc); + gcFIXUP2(pr->dead_box, gc); + gcFIXUP2(pr->running_box, gc); - gcFIXUP(pr->mbox_first); - gcFIXUP(pr->mbox_last); - gcFIXUP(pr->mbox_sema); + gcFIXUP2(pr->mbox_first, gc); + gcFIXUP2(pr->mbox_last, gc); + gcFIXUP2(pr->mbox_sema, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Thread)); } @@ -1830,32 +1830,32 @@ static int thread_val_FIXUP(void *p) { #define thread_val_IS_CONST_SIZE 1 -static int runstack_val_SIZE(void *p) { +static int runstack_val_SIZE(void *p, struct NewGC *gc) { long *s = (long *)p; return s[1]; } -static int runstack_val_MARK(void *p) { +static int runstack_val_MARK(void *p, struct NewGC *gc) { long *s = (long *)p; void **a, **b; a = (void **)s + 4 + s[2]; b = (void **)s + 4 + s[3]; while (a < b) { - gcMARK(*a); + gcMARK2(*a, gc); a++; } return s[1]; } -static int runstack_val_FIXUP(void *p) { +static int runstack_val_FIXUP(void *p, struct NewGC *gc) { long *s = (long *)p; void **a, **b; a = (void **)s + 4 + s[2]; b = (void **)s + 4 + s[3]; while (a < b) { - gcFIXUP(*a); + gcFIXUP2(*a, gc); a++; } @@ -1881,29 +1881,29 @@ static int runstack_val_FIXUP(void *p) { #define runstack_val_IS_CONST_SIZE 0 -static int prompt_val_SIZE(void *p) { +static int prompt_val_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Prompt)); } -static int prompt_val_MARK(void *p) { +static int prompt_val_MARK(void *p, struct NewGC *gc) { Scheme_Prompt *pr = (Scheme_Prompt *)p; - gcMARK(pr->boundary_overflow_id); + gcMARK2(pr->boundary_overflow_id, gc); if (!GC_merely_accounting()) - gcMARK(pr->runstack_boundary_start); - gcMARK(pr->tag); - gcMARK(pr->id); + gcMARK2(pr->runstack_boundary_start, gc); + gcMARK2(pr->tag, gc); + gcMARK2(pr->id, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Prompt)); } -static int prompt_val_FIXUP(void *p) { +static int prompt_val_FIXUP(void *p, struct NewGC *gc) { Scheme_Prompt *pr = (Scheme_Prompt *)p; - gcFIXUP(pr->boundary_overflow_id); + gcFIXUP2(pr->boundary_overflow_id, gc); if (!GC_merely_accounting()) - gcFIXUP(pr->runstack_boundary_start); - gcFIXUP(pr->tag); - gcFIXUP(pr->id); + gcFIXUP2(pr->runstack_boundary_start, gc); + gcFIXUP2(pr->tag, gc); + gcFIXUP2(pr->id, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Prompt)); } @@ -1912,24 +1912,24 @@ static int prompt_val_FIXUP(void *p) { #define prompt_val_IS_CONST_SIZE 1 -static int cont_mark_set_val_SIZE(void *p) { +static int cont_mark_set_val_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Cont_Mark_Set)); } -static int cont_mark_set_val_MARK(void *p) { +static int cont_mark_set_val_MARK(void *p, struct NewGC *gc) { Scheme_Cont_Mark_Set *s = (Scheme_Cont_Mark_Set *)p; - gcMARK(s->chain); - gcMARK(s->native_stack_trace); + gcMARK2(s->chain, gc); + gcMARK2(s->native_stack_trace, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Cont_Mark_Set)); } -static int cont_mark_set_val_FIXUP(void *p) { +static int cont_mark_set_val_FIXUP(void *p, struct NewGC *gc) { Scheme_Cont_Mark_Set *s = (Scheme_Cont_Mark_Set *)p; - gcFIXUP(s->chain); - gcFIXUP(s->native_stack_trace); + gcFIXUP2(s->chain, gc); + gcFIXUP2(s->native_stack_trace, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Cont_Mark_Set)); @@ -1939,26 +1939,26 @@ static int cont_mark_set_val_FIXUP(void *p) { #define cont_mark_set_val_IS_CONST_SIZE 1 -static int sema_val_SIZE(void *p) { +static int sema_val_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Sema)); } -static int sema_val_MARK(void *p) { +static int sema_val_MARK(void *p, struct NewGC *gc) { Scheme_Sema *s = (Scheme_Sema *)p; - gcMARK(s->first); - gcMARK(s->last); + gcMARK2(s->first, gc); + gcMARK2(s->last, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Sema)); } -static int sema_val_FIXUP(void *p) { +static int sema_val_FIXUP(void *p, struct NewGC *gc) { Scheme_Sema *s = (Scheme_Sema *)p; - gcFIXUP(s->first); - gcFIXUP(s->last); + gcFIXUP2(s->first, gc); + gcFIXUP2(s->last, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Sema)); @@ -1968,30 +1968,30 @@ static int sema_val_FIXUP(void *p) { #define sema_val_IS_CONST_SIZE 1 -static int channel_val_SIZE(void *p) { +static int channel_val_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Channel)); } -static int channel_val_MARK(void *p) { +static int channel_val_MARK(void *p, struct NewGC *gc) { Scheme_Channel *s = (Scheme_Channel *)p; - gcMARK(s->get_first); - gcMARK(s->get_last); - gcMARK(s->put_first); - gcMARK(s->put_last); + gcMARK2(s->get_first, gc); + gcMARK2(s->get_last, gc); + gcMARK2(s->put_first, gc); + gcMARK2(s->put_last, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Channel)); } -static int channel_val_FIXUP(void *p) { +static int channel_val_FIXUP(void *p, struct NewGC *gc) { Scheme_Channel *s = (Scheme_Channel *)p; - gcFIXUP(s->get_first); - gcFIXUP(s->get_last); - gcFIXUP(s->put_first); - gcFIXUP(s->put_last); + gcFIXUP2(s->get_first, gc); + gcFIXUP2(s->get_last, gc); + gcFIXUP2(s->put_first, gc); + gcFIXUP2(s->put_last, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Channel)); @@ -2001,26 +2001,26 @@ static int channel_val_FIXUP(void *p) { #define channel_val_IS_CONST_SIZE 1 -static int channel_put_val_SIZE(void *p) { +static int channel_put_val_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Channel_Put)); } -static int channel_put_val_MARK(void *p) { +static int channel_put_val_MARK(void *p, struct NewGC *gc) { Scheme_Channel_Put *s = (Scheme_Channel_Put *)p; - gcMARK(s->ch); - gcMARK(s->val); + gcMARK2(s->ch, gc); + gcMARK2(s->val, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Channel_Put)); } -static int channel_put_val_FIXUP(void *p) { +static int channel_put_val_FIXUP(void *p, struct NewGC *gc) { Scheme_Channel_Put *s = (Scheme_Channel_Put *)p; - gcFIXUP(s->ch); - gcFIXUP(s->val); + gcFIXUP2(s->ch, gc); + gcFIXUP2(s->val, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Channel_Put)); @@ -2030,28 +2030,28 @@ static int channel_put_val_FIXUP(void *p) { #define channel_put_val_IS_CONST_SIZE 1 -static int hash_table_val_SIZE(void *p) { +static int hash_table_val_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Hash_Table)); } -static int hash_table_val_MARK(void *p) { +static int hash_table_val_MARK(void *p, struct NewGC *gc) { Scheme_Hash_Table *ht = (Scheme_Hash_Table *)p; - gcMARK(ht->keys); - gcMARK(ht->vals); - gcMARK(ht->mutex); + gcMARK2(ht->keys, gc); + gcMARK2(ht->vals, gc); + gcMARK2(ht->mutex, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Hash_Table)); } -static int hash_table_val_FIXUP(void *p) { +static int hash_table_val_FIXUP(void *p, struct NewGC *gc) { Scheme_Hash_Table *ht = (Scheme_Hash_Table *)p; - gcFIXUP(ht->keys); - gcFIXUP(ht->vals); - gcFIXUP(ht->mutex); + gcFIXUP2(ht->keys, gc); + gcFIXUP2(ht->vals, gc); + gcFIXUP2(ht->mutex, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Hash_Table)); @@ -2061,26 +2061,26 @@ static int hash_table_val_FIXUP(void *p) { #define hash_table_val_IS_CONST_SIZE 1 -static int bucket_table_val_SIZE(void *p) { +static int bucket_table_val_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Bucket_Table)); } -static int bucket_table_val_MARK(void *p) { +static int bucket_table_val_MARK(void *p, struct NewGC *gc) { Scheme_Bucket_Table *ht = (Scheme_Bucket_Table *)p; - gcMARK(ht->buckets); - gcMARK(ht->mutex); + gcMARK2(ht->buckets, gc); + gcMARK2(ht->mutex, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Bucket_Table)); } -static int bucket_table_val_FIXUP(void *p) { +static int bucket_table_val_FIXUP(void *p, struct NewGC *gc) { Scheme_Bucket_Table *ht = (Scheme_Bucket_Table *)p; - gcFIXUP(ht->buckets); - gcFIXUP(ht->mutex); + gcFIXUP2(ht->buckets, gc); + gcFIXUP2(ht->mutex, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Bucket_Table)); @@ -2090,83 +2090,83 @@ static int bucket_table_val_FIXUP(void *p) { #define bucket_table_val_IS_CONST_SIZE 1 -static int namespace_val_SIZE(void *p) { +static int namespace_val_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Env)); } -static int namespace_val_MARK(void *p) { +static int namespace_val_MARK(void *p, struct NewGC *gc) { Scheme_Env *e = (Scheme_Env *)p; - gcMARK(e->module); - gcMARK(e->module_registry); - gcMARK(e->export_registry); - gcMARK(e->insp); + gcMARK2(e->module, gc); + gcMARK2(e->module_registry, gc); + gcMARK2(e->export_registry, gc); + gcMARK2(e->insp, gc); - gcMARK(e->rename_set); - gcMARK(e->temp_marked_names); - gcMARK(e->post_ex_rename_set); + gcMARK2(e->rename_set, gc); + gcMARK2(e->temp_marked_names, gc); + gcMARK2(e->post_ex_rename_set, gc); - gcMARK(e->syntax); - gcMARK(e->exp_env); - gcMARK(e->template_env); - gcMARK(e->label_env); + gcMARK2(e->syntax, gc); + gcMARK2(e->exp_env, gc); + gcMARK2(e->template_env, gc); + gcMARK2(e->label_env, gc); - gcMARK(e->shadowed_syntax); + gcMARK2(e->shadowed_syntax, gc); - gcMARK(e->link_midx); - gcMARK(e->require_names); - gcMARK(e->et_require_names); - gcMARK(e->tt_require_names); - gcMARK(e->dt_require_names); - gcMARK(e->other_require_names); - gcMARK(e->did_starts); - gcMARK(e->available_next[0]); - gcMARK(e->available_next[1]); + gcMARK2(e->link_midx, gc); + gcMARK2(e->require_names, gc); + gcMARK2(e->et_require_names, gc); + gcMARK2(e->tt_require_names, gc); + gcMARK2(e->dt_require_names, gc); + gcMARK2(e->other_require_names, gc); + gcMARK2(e->did_starts, gc); + gcMARK2(e->available_next[0], gc); + gcMARK2(e->available_next[1], gc); - gcMARK(e->toplevel); - gcMARK(e->modchain); + gcMARK2(e->toplevel, gc); + gcMARK2(e->modchain, gc); - gcMARK(e->modvars); + gcMARK2(e->modvars, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Env)); } -static int namespace_val_FIXUP(void *p) { +static int namespace_val_FIXUP(void *p, struct NewGC *gc) { Scheme_Env *e = (Scheme_Env *)p; - gcFIXUP(e->module); - gcFIXUP(e->module_registry); - gcFIXUP(e->export_registry); - gcFIXUP(e->insp); + gcFIXUP2(e->module, gc); + gcFIXUP2(e->module_registry, gc); + gcFIXUP2(e->export_registry, gc); + gcFIXUP2(e->insp, gc); - gcFIXUP(e->rename_set); - gcFIXUP(e->temp_marked_names); - gcFIXUP(e->post_ex_rename_set); + gcFIXUP2(e->rename_set, gc); + gcFIXUP2(e->temp_marked_names, gc); + gcFIXUP2(e->post_ex_rename_set, gc); - gcFIXUP(e->syntax); - gcFIXUP(e->exp_env); - gcFIXUP(e->template_env); - gcFIXUP(e->label_env); + gcFIXUP2(e->syntax, gc); + gcFIXUP2(e->exp_env, gc); + gcFIXUP2(e->template_env, gc); + gcFIXUP2(e->label_env, gc); - gcFIXUP(e->shadowed_syntax); + gcFIXUP2(e->shadowed_syntax, gc); - gcFIXUP(e->link_midx); - gcFIXUP(e->require_names); - gcFIXUP(e->et_require_names); - gcFIXUP(e->tt_require_names); - gcFIXUP(e->dt_require_names); - gcFIXUP(e->other_require_names); - gcFIXUP(e->did_starts); - gcFIXUP(e->available_next[0]); - gcFIXUP(e->available_next[1]); + gcFIXUP2(e->link_midx, gc); + gcFIXUP2(e->require_names, gc); + gcFIXUP2(e->et_require_names, gc); + gcFIXUP2(e->tt_require_names, gc); + gcFIXUP2(e->dt_require_names, gc); + gcFIXUP2(e->other_require_names, gc); + gcFIXUP2(e->did_starts, gc); + gcFIXUP2(e->available_next[0], gc); + gcFIXUP2(e->available_next[1], gc); - gcFIXUP(e->toplevel); - gcFIXUP(e->modchain); + gcFIXUP2(e->toplevel, gc); + gcFIXUP2(e->modchain, gc); - gcFIXUP(e->modvars); + gcFIXUP2(e->modvars, gc); return @@ -2177,17 +2177,17 @@ static int namespace_val_FIXUP(void *p) { #define namespace_val_IS_CONST_SIZE 1 -static int random_state_val_SIZE(void *p) { +static int random_state_val_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Random_State)); } -static int random_state_val_MARK(void *p) { +static int random_state_val_MARK(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Random_State)); } -static int random_state_val_FIXUP(void *p) { +static int random_state_val_FIXUP(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Random_State)); } @@ -2196,24 +2196,24 @@ static int random_state_val_FIXUP(void *p) { #define random_state_val_IS_CONST_SIZE 1 -static int compilation_top_val_SIZE(void *p) { +static int compilation_top_val_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Compilation_Top)); } -static int compilation_top_val_MARK(void *p) { +static int compilation_top_val_MARK(void *p, struct NewGC *gc) { Scheme_Compilation_Top *t = (Scheme_Compilation_Top *)p; - gcMARK(t->code); - gcMARK(t->prefix); + gcMARK2(t->code, gc); + gcMARK2(t->prefix, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Compilation_Top)); } -static int compilation_top_val_FIXUP(void *p) { +static int compilation_top_val_FIXUP(void *p, struct NewGC *gc) { Scheme_Compilation_Top *t = (Scheme_Compilation_Top *)p; - gcFIXUP(t->code); - gcFIXUP(t->prefix); + gcFIXUP2(t->code, gc); + gcFIXUP2(t->prefix, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Compilation_Top)); @@ -2223,28 +2223,28 @@ static int compilation_top_val_FIXUP(void *p) { #define compilation_top_val_IS_CONST_SIZE 1 -static int resolve_prefix_val_SIZE(void *p) { +static int resolve_prefix_val_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Resolve_Prefix)); } -static int resolve_prefix_val_MARK(void *p) { +static int resolve_prefix_val_MARK(void *p, struct NewGC *gc) { Resolve_Prefix *rp = (Resolve_Prefix *)p; - gcMARK(rp->toplevels); - gcMARK(rp->stxes); - gcMARK(rp->delay_info_rpair); - gcMARK(rp->uses_unsafe); + gcMARK2(rp->toplevels, gc); + gcMARK2(rp->stxes, gc); + gcMARK2(rp->delay_info_rpair, gc); + gcMARK2(rp->uses_unsafe, gc); return gcBYTES_TO_WORDS(sizeof(Resolve_Prefix)); } -static int resolve_prefix_val_FIXUP(void *p) { +static int resolve_prefix_val_FIXUP(void *p, struct NewGC *gc) { Resolve_Prefix *rp = (Resolve_Prefix *)p; - gcFIXUP(rp->toplevels); - gcFIXUP(rp->stxes); - gcFIXUP(rp->delay_info_rpair); - gcFIXUP(rp->uses_unsafe); + gcFIXUP2(rp->toplevels, gc); + gcFIXUP2(rp->stxes, gc); + gcFIXUP2(rp->delay_info_rpair, gc); + gcFIXUP2(rp->uses_unsafe, gc); return gcBYTES_TO_WORDS(sizeof(Resolve_Prefix)); @@ -2254,26 +2254,26 @@ static int resolve_prefix_val_FIXUP(void *p) { #define resolve_prefix_val_IS_CONST_SIZE 1 -static int comp_prefix_val_SIZE(void *p) { +static int comp_prefix_val_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Comp_Prefix)); } -static int comp_prefix_val_MARK(void *p) { +static int comp_prefix_val_MARK(void *p, struct NewGC *gc) { Comp_Prefix *cp = (Comp_Prefix *)p; - gcMARK(cp->toplevels); - gcMARK(cp->stxes); - gcMARK(cp->uses_unsafe); + gcMARK2(cp->toplevels, gc); + gcMARK2(cp->stxes, gc); + gcMARK2(cp->uses_unsafe, gc); return gcBYTES_TO_WORDS(sizeof(Comp_Prefix)); } -static int comp_prefix_val_FIXUP(void *p) { +static int comp_prefix_val_FIXUP(void *p, struct NewGC *gc) { Comp_Prefix *cp = (Comp_Prefix *)p; - gcFIXUP(cp->toplevels); - gcFIXUP(cp->stxes); - gcFIXUP(cp->uses_unsafe); + gcFIXUP2(cp->toplevels, gc); + gcFIXUP2(cp->stxes, gc); + gcFIXUP2(cp->uses_unsafe, gc); return gcBYTES_TO_WORDS(sizeof(Comp_Prefix)); @@ -2283,24 +2283,24 @@ static int comp_prefix_val_FIXUP(void *p) { #define comp_prefix_val_IS_CONST_SIZE 1 -static int svector_val_SIZE(void *p) { +static int svector_val_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Simple_Object)); } -static int svector_val_MARK(void *p) { +static int svector_val_MARK(void *p, struct NewGC *gc) { Scheme_Object *o = (Scheme_Object *)p; - gcMARK(SCHEME_SVEC_VEC(o)); + gcMARK2(SCHEME_SVEC_VEC(o), gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Simple_Object)); } -static int svector_val_FIXUP(void *p) { +static int svector_val_FIXUP(void *p, struct NewGC *gc) { Scheme_Object *o = (Scheme_Object *)p; - gcFIXUP(SCHEME_SVEC_VEC(o)); + gcFIXUP2(SCHEME_SVEC_VEC(o), gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Simple_Object)); @@ -2310,33 +2310,33 @@ static int svector_val_FIXUP(void *p) { #define svector_val_IS_CONST_SIZE 1 -static int stx_val_SIZE(void *p) { +static int stx_val_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Stx)); } -static int stx_val_MARK(void *p) { +static int stx_val_MARK(void *p, struct NewGC *gc) { Scheme_Stx *stx = (Scheme_Stx *)p; - gcMARK(stx->val); - gcMARK(stx->srcloc); - gcMARK(stx->wraps); - gcMARK(stx->certs); - gcMARK(stx->props); + gcMARK2(stx->val, gc); + gcMARK2(stx->srcloc, gc); + gcMARK2(stx->wraps, gc); + gcMARK2(stx->certs, gc); + gcMARK2(stx->props, gc); if (!(MZ_OPT_HASH_KEY(&(stx)->iso) & STX_SUBSTX_FLAG)) - gcMARK(stx->u.modinfo_cache); + gcMARK2(stx->u.modinfo_cache, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Stx)); } -static int stx_val_FIXUP(void *p) { +static int stx_val_FIXUP(void *p, struct NewGC *gc) { Scheme_Stx *stx = (Scheme_Stx *)p; - gcFIXUP(stx->val); - gcFIXUP(stx->srcloc); - gcFIXUP(stx->wraps); - gcFIXUP(stx->certs); - gcFIXUP(stx->props); + gcFIXUP2(stx->val, gc); + gcFIXUP2(stx->srcloc, gc); + gcFIXUP2(stx->wraps, gc); + gcFIXUP2(stx->certs, gc); + gcFIXUP2(stx->props, gc); if (!(MZ_OPT_HASH_KEY(&(stx)->iso) & STX_SUBSTX_FLAG)) - gcFIXUP(stx->u.modinfo_cache); + gcFIXUP2(stx->u.modinfo_cache, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Stx)); } @@ -2345,21 +2345,21 @@ static int stx_val_FIXUP(void *p) { #define stx_val_IS_CONST_SIZE 1 -static int stx_off_val_SIZE(void *p) { +static int stx_off_val_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Stx_Offset)); } -static int stx_off_val_MARK(void *p) { +static int stx_off_val_MARK(void *p, struct NewGC *gc) { Scheme_Stx_Offset *o = (Scheme_Stx_Offset *)p; - gcMARK(o->src); + gcMARK2(o->src, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Stx_Offset)); } -static int stx_off_val_FIXUP(void *p) { +static int stx_off_val_FIXUP(void *p, struct NewGC *gc) { Scheme_Stx_Offset *o = (Scheme_Stx_Offset *)p; - gcFIXUP(o->src); + gcFIXUP2(o->src, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Stx_Offset)); } @@ -2368,99 +2368,99 @@ static int stx_off_val_FIXUP(void *p) { #define stx_off_val_IS_CONST_SIZE 1 -static int module_val_SIZE(void *p) { +static int module_val_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Module)); } -static int module_val_MARK(void *p) { +static int module_val_MARK(void *p, struct NewGC *gc) { Scheme_Module *m = (Scheme_Module *)p; - gcMARK(m->modname); + gcMARK2(m->modname, gc); - gcMARK(m->et_requires); - gcMARK(m->requires); - gcMARK(m->tt_requires); - gcMARK(m->dt_requires); - gcMARK(m->other_requires); + gcMARK2(m->et_requires, gc); + gcMARK2(m->requires, gc); + gcMARK2(m->tt_requires, gc); + gcMARK2(m->dt_requires, gc); + gcMARK2(m->other_requires, gc); - gcMARK(m->body); - gcMARK(m->et_body); + gcMARK2(m->body, gc); + gcMARK2(m->et_body, gc); - gcMARK(m->me); + gcMARK2(m->me, gc); - gcMARK(m->provide_protects); - gcMARK(m->indirect_provides); + gcMARK2(m->provide_protects, gc); + gcMARK2(m->indirect_provides, gc); - gcMARK(m->indirect_syntax_provides); + gcMARK2(m->indirect_syntax_provides, gc); - gcMARK(m->et_provide_protects); - gcMARK(m->et_indirect_provides); + gcMARK2(m->et_provide_protects, gc); + gcMARK2(m->et_indirect_provides, gc); - gcMARK(m->self_modidx); + gcMARK2(m->self_modidx, gc); - gcMARK(m->accessible); - gcMARK(m->et_accessible); + gcMARK2(m->accessible, gc); + gcMARK2(m->et_accessible, gc); - gcMARK(m->insp); + gcMARK2(m->insp, gc); - gcMARK(m->lang_info); + gcMARK2(m->lang_info, gc); - gcMARK(m->hints); - gcMARK(m->ii_src); + gcMARK2(m->hints, gc); + gcMARK2(m->ii_src, gc); - gcMARK(m->comp_prefix); - gcMARK(m->prefix); - gcMARK(m->dummy); + gcMARK2(m->comp_prefix, gc); + gcMARK2(m->prefix, gc); + gcMARK2(m->dummy, gc); - gcMARK(m->rn_stx); + gcMARK2(m->rn_stx, gc); - gcMARK(m->primitive); + gcMARK2(m->primitive, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Module)); } -static int module_val_FIXUP(void *p) { +static int module_val_FIXUP(void *p, struct NewGC *gc) { Scheme_Module *m = (Scheme_Module *)p; - gcFIXUP(m->modname); + gcFIXUP2(m->modname, gc); - gcFIXUP(m->et_requires); - gcFIXUP(m->requires); - gcFIXUP(m->tt_requires); - gcFIXUP(m->dt_requires); - gcFIXUP(m->other_requires); + gcFIXUP2(m->et_requires, gc); + gcFIXUP2(m->requires, gc); + gcFIXUP2(m->tt_requires, gc); + gcFIXUP2(m->dt_requires, gc); + gcFIXUP2(m->other_requires, gc); - gcFIXUP(m->body); - gcFIXUP(m->et_body); + gcFIXUP2(m->body, gc); + gcFIXUP2(m->et_body, gc); - gcFIXUP(m->me); + gcFIXUP2(m->me, gc); - gcFIXUP(m->provide_protects); - gcFIXUP(m->indirect_provides); + gcFIXUP2(m->provide_protects, gc); + gcFIXUP2(m->indirect_provides, gc); - gcFIXUP(m->indirect_syntax_provides); + gcFIXUP2(m->indirect_syntax_provides, gc); - gcFIXUP(m->et_provide_protects); - gcFIXUP(m->et_indirect_provides); + gcFIXUP2(m->et_provide_protects, gc); + gcFIXUP2(m->et_indirect_provides, gc); - gcFIXUP(m->self_modidx); + gcFIXUP2(m->self_modidx, gc); - gcFIXUP(m->accessible); - gcFIXUP(m->et_accessible); + gcFIXUP2(m->accessible, gc); + gcFIXUP2(m->et_accessible, gc); - gcFIXUP(m->insp); + gcFIXUP2(m->insp, gc); - gcFIXUP(m->lang_info); + gcFIXUP2(m->lang_info, gc); - gcFIXUP(m->hints); - gcFIXUP(m->ii_src); + gcFIXUP2(m->hints, gc); + gcFIXUP2(m->ii_src, gc); - gcFIXUP(m->comp_prefix); - gcFIXUP(m->prefix); - gcFIXUP(m->dummy); + gcFIXUP2(m->comp_prefix, gc); + gcFIXUP2(m->prefix, gc); + gcFIXUP2(m->dummy, gc); - gcFIXUP(m->rn_stx); + gcFIXUP2(m->rn_stx, gc); - gcFIXUP(m->primitive); + gcFIXUP2(m->primitive, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Module)); } @@ -2469,52 +2469,52 @@ static int module_val_FIXUP(void *p) { #define module_val_IS_CONST_SIZE 1 -static int module_phase_exports_val_SIZE(void *p) { +static int module_phase_exports_val_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Module_Phase_Exports)); } -static int module_phase_exports_val_MARK(void *p) { +static int module_phase_exports_val_MARK(void *p, struct NewGC *gc) { Scheme_Module_Phase_Exports *m = (Scheme_Module_Phase_Exports *)p; - gcMARK(m->phase_index); + gcMARK2(m->phase_index, gc); - gcMARK(m->src_modidx); + gcMARK2(m->src_modidx, gc); - gcMARK(m->provides); - gcMARK(m->provide_srcs); - gcMARK(m->provide_src_names); - gcMARK(m->provide_nominal_srcs); - gcMARK(m->provide_src_phases); - gcMARK(m->provide_insps); + gcMARK2(m->provides, gc); + gcMARK2(m->provide_srcs, gc); + gcMARK2(m->provide_src_names, gc); + gcMARK2(m->provide_nominal_srcs, gc); + gcMARK2(m->provide_src_phases, gc); + gcMARK2(m->provide_insps, gc); - gcMARK(m->kernel_exclusion); - gcMARK(m->kernel_exclusion2); + gcMARK2(m->kernel_exclusion, gc); + gcMARK2(m->kernel_exclusion2, gc); - gcMARK(m->ht); + gcMARK2(m->ht, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Module_Phase_Exports)); } -static int module_phase_exports_val_FIXUP(void *p) { +static int module_phase_exports_val_FIXUP(void *p, struct NewGC *gc) { Scheme_Module_Phase_Exports *m = (Scheme_Module_Phase_Exports *)p; - gcFIXUP(m->phase_index); + gcFIXUP2(m->phase_index, gc); - gcFIXUP(m->src_modidx); + gcFIXUP2(m->src_modidx, gc); - gcFIXUP(m->provides); - gcFIXUP(m->provide_srcs); - gcFIXUP(m->provide_src_names); - gcFIXUP(m->provide_nominal_srcs); - gcFIXUP(m->provide_src_phases); - gcFIXUP(m->provide_insps); + gcFIXUP2(m->provides, gc); + gcFIXUP2(m->provide_srcs, gc); + gcFIXUP2(m->provide_src_names, gc); + gcFIXUP2(m->provide_nominal_srcs, gc); + gcFIXUP2(m->provide_src_phases, gc); + gcFIXUP2(m->provide_insps, gc); - gcFIXUP(m->kernel_exclusion); - gcFIXUP(m->kernel_exclusion2); + gcFIXUP2(m->kernel_exclusion, gc); + gcFIXUP2(m->kernel_exclusion2, gc); - gcFIXUP(m->ht); + gcFIXUP2(m->ht, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Module_Phase_Exports)); @@ -2524,33 +2524,33 @@ static int module_phase_exports_val_FIXUP(void *p) { #define module_phase_exports_val_IS_CONST_SIZE 1 -static int module_exports_val_SIZE(void *p) { +static int module_exports_val_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Module_Exports)); } -static int module_exports_val_MARK(void *p) { +static int module_exports_val_MARK(void *p, struct NewGC *gc) { Scheme_Module_Exports *m = (Scheme_Module_Exports *)p; - gcMARK(m->rt); - gcMARK(m->et); - gcMARK(m->dt); - gcMARK(m->other_phases); + gcMARK2(m->rt, gc); + gcMARK2(m->et, gc); + gcMARK2(m->dt, gc); + gcMARK2(m->other_phases, gc); - gcMARK(m->src_modidx); + gcMARK2(m->src_modidx, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Module_Exports)); } -static int module_exports_val_FIXUP(void *p) { +static int module_exports_val_FIXUP(void *p, struct NewGC *gc) { Scheme_Module_Exports *m = (Scheme_Module_Exports *)p; - gcFIXUP(m->rt); - gcFIXUP(m->et); - gcFIXUP(m->dt); - gcFIXUP(m->other_phases); + gcFIXUP2(m->rt, gc); + gcFIXUP2(m->et, gc); + gcFIXUP2(m->dt, gc); + gcFIXUP2(m->other_phases, gc); - gcFIXUP(m->src_modidx); + gcFIXUP2(m->src_modidx, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Module_Exports)); } @@ -2559,31 +2559,31 @@ static int module_exports_val_FIXUP(void *p) { #define module_exports_val_IS_CONST_SIZE 1 -static int modidx_val_SIZE(void *p) { +static int modidx_val_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Modidx)); } -static int modidx_val_MARK(void *p) { +static int modidx_val_MARK(void *p, struct NewGC *gc) { Scheme_Modidx *modidx = (Scheme_Modidx *)p; - gcMARK(modidx->path); - gcMARK(modidx->base); - gcMARK(modidx->resolved); - gcMARK(modidx->shift_cache); - gcMARK(modidx->cache_next); + gcMARK2(modidx->path, gc); + gcMARK2(modidx->base, gc); + gcMARK2(modidx->resolved, gc); + gcMARK2(modidx->shift_cache, gc); + gcMARK2(modidx->cache_next, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Modidx)); } -static int modidx_val_FIXUP(void *p) { +static int modidx_val_FIXUP(void *p, struct NewGC *gc) { Scheme_Modidx *modidx = (Scheme_Modidx *)p; - gcFIXUP(modidx->path); - gcFIXUP(modidx->base); - gcFIXUP(modidx->resolved); - gcFIXUP(modidx->shift_cache); - gcFIXUP(modidx->cache_next); + gcFIXUP2(modidx->path, gc); + gcFIXUP2(modidx->base, gc); + gcFIXUP2(modidx->resolved, gc); + gcFIXUP2(modidx->shift_cache, gc); + gcFIXUP2(modidx->cache_next, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Modidx)); } @@ -2592,29 +2592,29 @@ static int modidx_val_FIXUP(void *p) { #define modidx_val_IS_CONST_SIZE 1 -static int guard_val_SIZE(void *p) { +static int guard_val_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Security_Guard)); } -static int guard_val_MARK(void *p) { +static int guard_val_MARK(void *p, struct NewGC *gc) { Scheme_Security_Guard *g = (Scheme_Security_Guard *)p; - gcMARK(g->parent); - gcMARK(g->file_proc); - gcMARK(g->network_proc); - gcMARK(g->link_proc); + gcMARK2(g->parent, gc); + gcMARK2(g->file_proc, gc); + gcMARK2(g->network_proc, gc); + gcMARK2(g->link_proc, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Security_Guard)); } -static int guard_val_FIXUP(void *p) { +static int guard_val_FIXUP(void *p, struct NewGC *gc) { Scheme_Security_Guard *g = (Scheme_Security_Guard *)p; - gcFIXUP(g->parent); - gcFIXUP(g->file_proc); - gcFIXUP(g->network_proc); - gcFIXUP(g->link_proc); + gcFIXUP2(g->parent, gc); + gcFIXUP2(g->file_proc, gc); + gcFIXUP2(g->network_proc, gc); + gcFIXUP2(g->link_proc, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Security_Guard)); } @@ -2623,24 +2623,24 @@ static int guard_val_FIXUP(void *p) { #define guard_val_IS_CONST_SIZE 1 -static int buf_holder_SIZE(void *p) { +static int buf_holder_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Jumpup_Buf_Holder)); } -static int buf_holder_MARK(void *p) { +static int buf_holder_MARK(void *p, struct NewGC *gc) { Scheme_Jumpup_Buf_Holder *h = (Scheme_Jumpup_Buf_Holder *)p; - MARK_jmpup(&h->buf); + MARK_jmpup(&h->buf, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Jumpup_Buf_Holder)); } -static int buf_holder_FIXUP(void *p) { +static int buf_holder_FIXUP(void *p, struct NewGC *gc) { Scheme_Jumpup_Buf_Holder *h = (Scheme_Jumpup_Buf_Holder *)p; - FIXUP_jmpup(&h->buf); + FIXUP_jmpup(&h->buf, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Jumpup_Buf_Holder)); @@ -2650,21 +2650,21 @@ static int buf_holder_FIXUP(void *p) { #define buf_holder_IS_CONST_SIZE 1 -static int mark_inspector_SIZE(void *p) { +static int mark_inspector_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Inspector)); } -static int mark_inspector_MARK(void *p) { +static int mark_inspector_MARK(void *p, struct NewGC *gc) { Scheme_Inspector *i = (Scheme_Inspector *)p; - gcMARK(i->superior); + gcMARK2(i->superior, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Inspector)); } -static int mark_inspector_FIXUP(void *p) { +static int mark_inspector_FIXUP(void *p, struct NewGC *gc) { Scheme_Inspector *i = (Scheme_Inspector *)p; - gcFIXUP(i->superior); + gcFIXUP2(i->superior, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Inspector)); } @@ -2673,28 +2673,28 @@ static int mark_inspector_FIXUP(void *p) { #define mark_inspector_IS_CONST_SIZE 1 -static int mark_pipe_SIZE(void *p) { +static int mark_pipe_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Pipe)); } -static int mark_pipe_MARK(void *p) { +static int mark_pipe_MARK(void *p, struct NewGC *gc) { Scheme_Pipe *pp = (Scheme_Pipe *)p; - gcMARK(pp->buf); - gcMARK(pp->wakeup_on_read); - gcMARK(pp->wakeup_on_write); + gcMARK2(pp->buf, gc); + gcMARK2(pp->wakeup_on_read, gc); + gcMARK2(pp->wakeup_on_write, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Pipe)); } -static int mark_pipe_FIXUP(void *p) { +static int mark_pipe_FIXUP(void *p, struct NewGC *gc) { Scheme_Pipe *pp = (Scheme_Pipe *)p; - gcFIXUP(pp->buf); - gcFIXUP(pp->wakeup_on_read); - gcFIXUP(pp->wakeup_on_write); + gcFIXUP2(pp->buf, gc); + gcFIXUP2(pp->wakeup_on_read, gc); + gcFIXUP2(pp->wakeup_on_write, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Pipe)); @@ -2704,27 +2704,27 @@ static int mark_pipe_FIXUP(void *p) { #define mark_pipe_IS_CONST_SIZE 1 -static int mark_logger_SIZE(void *p) { +static int mark_logger_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Logger)); } -static int mark_logger_MARK(void *p) { +static int mark_logger_MARK(void *p, struct NewGC *gc) { Scheme_Logger *l = (Scheme_Logger *)p; - gcMARK(l->name); - gcMARK(l->parent); - gcMARK(l->readers); - gcMARK(l->timestamp); + gcMARK2(l->name, gc); + gcMARK2(l->parent, gc); + gcMARK2(l->readers, gc); + gcMARK2(l->timestamp, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Logger)); } -static int mark_logger_FIXUP(void *p) { +static int mark_logger_FIXUP(void *p, struct NewGC *gc) { Scheme_Logger *l = (Scheme_Logger *)p; - gcFIXUP(l->name); - gcFIXUP(l->parent); - gcFIXUP(l->readers); - gcFIXUP(l->timestamp); + gcFIXUP2(l->name, gc); + gcFIXUP2(l->parent, gc); + gcFIXUP2(l->readers, gc); + gcFIXUP2(l->timestamp, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Logger)); } @@ -2733,25 +2733,25 @@ static int mark_logger_FIXUP(void *p) { #define mark_logger_IS_CONST_SIZE 1 -static int mark_log_reader_SIZE(void *p) { +static int mark_log_reader_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Log_Reader)); } -static int mark_log_reader_MARK(void *p) { +static int mark_log_reader_MARK(void *p, struct NewGC *gc) { Scheme_Log_Reader *lr = (Scheme_Log_Reader *)p; - gcMARK(lr->sema); - gcMARK(lr->head); - gcMARK(lr->tail); + gcMARK2(lr->sema, gc); + gcMARK2(lr->head, gc); + gcMARK2(lr->tail, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Log_Reader)); } -static int mark_log_reader_FIXUP(void *p) { +static int mark_log_reader_FIXUP(void *p, struct NewGC *gc) { Scheme_Log_Reader *lr = (Scheme_Log_Reader *)p; - gcFIXUP(lr->sema); - gcFIXUP(lr->head); - gcFIXUP(lr->tail); + gcFIXUP2(lr->sema, gc); + gcFIXUP2(lr->head, gc); + gcFIXUP2(lr->tail, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Log_Reader)); } @@ -2766,18 +2766,18 @@ static int mark_log_reader_FIXUP(void *p) { #ifdef MARKS_FOR_ENGINE_C -static int engine_val_SIZE(void *p) { +static int engine_val_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Engine)); } -static int engine_val_MARK(void *p) { +static int engine_val_MARK(void *p, struct NewGC *gc) { Scheme_Engine *en = (Scheme_Engine *)p; return gcBYTES_TO_WORDS(sizeof(Scheme_Engine)); } -static int engine_val_FIXUP(void *p) { +static int engine_val_FIXUP(void *p, struct NewGC *gc) { Scheme_Engine *en = (Scheme_Engine *)p; return gcBYTES_TO_WORDS(sizeof(Scheme_Engine)); @@ -2791,62 +2791,62 @@ static int engine_val_FIXUP(void *p) { #ifdef MARKS_FOR_ENV_C -static int mark_comp_env_SIZE(void *p) { +static int mark_comp_env_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Full_Comp_Env)); } -static int mark_comp_env_MARK(void *p) { +static int mark_comp_env_MARK(void *p, struct NewGC *gc) { Scheme_Full_Comp_Env *e = (Scheme_Full_Comp_Env *)p; - gcMARK(e->base.genv); - gcMARK(e->base.insp); - gcMARK(e->base.prefix); - gcMARK(e->base.next); - gcMARK(e->base.values); - gcMARK(e->base.certs); - gcMARK(e->base.renames); - gcMARK(e->base.uid); - gcMARK(e->base.uids); - gcMARK(e->base.dup_check); - gcMARK(e->base.intdef_name); - gcMARK(e->base.in_modidx); - gcMARK(e->base.skip_table); + gcMARK2(e->base.genv, gc); + gcMARK2(e->base.insp, gc); + gcMARK2(e->base.prefix, gc); + gcMARK2(e->base.next, gc); + gcMARK2(e->base.values, gc); + gcMARK2(e->base.certs, gc); + gcMARK2(e->base.renames, gc); + gcMARK2(e->base.uid, gc); + gcMARK2(e->base.uids, gc); + gcMARK2(e->base.dup_check, gc); + gcMARK2(e->base.intdef_name, gc); + gcMARK2(e->base.in_modidx, gc); + gcMARK2(e->base.skip_table, gc); - gcMARK(e->data.const_names); - gcMARK(e->data.const_vals); - gcMARK(e->data.const_uids); - gcMARK(e->data.sealed); - gcMARK(e->data.use); - gcMARK(e->data.lifts); + gcMARK2(e->data.const_names, gc); + gcMARK2(e->data.const_vals, gc); + gcMARK2(e->data.const_uids, gc); + gcMARK2(e->data.sealed, gc); + gcMARK2(e->data.use, gc); + gcMARK2(e->data.lifts, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Full_Comp_Env)); } -static int mark_comp_env_FIXUP(void *p) { +static int mark_comp_env_FIXUP(void *p, struct NewGC *gc) { Scheme_Full_Comp_Env *e = (Scheme_Full_Comp_Env *)p; - gcFIXUP(e->base.genv); - gcFIXUP(e->base.insp); - gcFIXUP(e->base.prefix); - gcFIXUP(e->base.next); - gcFIXUP(e->base.values); - gcFIXUP(e->base.certs); - gcFIXUP(e->base.renames); - gcFIXUP(e->base.uid); - gcFIXUP(e->base.uids); - gcFIXUP(e->base.dup_check); - gcFIXUP(e->base.intdef_name); - gcFIXUP(e->base.in_modidx); - gcFIXUP(e->base.skip_table); + gcFIXUP2(e->base.genv, gc); + gcFIXUP2(e->base.insp, gc); + gcFIXUP2(e->base.prefix, gc); + gcFIXUP2(e->base.next, gc); + gcFIXUP2(e->base.values, gc); + gcFIXUP2(e->base.certs, gc); + gcFIXUP2(e->base.renames, gc); + gcFIXUP2(e->base.uid, gc); + gcFIXUP2(e->base.uids, gc); + gcFIXUP2(e->base.dup_check, gc); + gcFIXUP2(e->base.intdef_name, gc); + gcFIXUP2(e->base.in_modidx, gc); + gcFIXUP2(e->base.skip_table, gc); - gcFIXUP(e->data.const_names); - gcFIXUP(e->data.const_vals); - gcFIXUP(e->data.const_uids); - gcFIXUP(e->data.sealed); - gcFIXUP(e->data.use); - gcFIXUP(e->data.lifts); + gcFIXUP2(e->data.const_names, gc); + gcFIXUP2(e->data.const_vals, gc); + gcFIXUP2(e->data.const_uids, gc); + gcFIXUP2(e->data.sealed, gc); + gcFIXUP2(e->data.use, gc); + gcFIXUP2(e->data.lifts, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Full_Comp_Env)); @@ -2856,40 +2856,40 @@ static int mark_comp_env_FIXUP(void *p) { #define mark_comp_env_IS_CONST_SIZE 1 -static int mark_resolve_info_SIZE(void *p) { +static int mark_resolve_info_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Resolve_Info)); } -static int mark_resolve_info_MARK(void *p) { +static int mark_resolve_info_MARK(void *p, struct NewGC *gc) { Resolve_Info *i = (Resolve_Info *)p; - gcMARK(i->prefix); - gcMARK(i->stx_map); - gcMARK(i->old_pos); - gcMARK(i->new_pos); - gcMARK(i->old_stx_pos); - gcMARK(i->flags); - gcMARK(i->lifts); - gcMARK(i->lifted); - gcMARK(i->next); + gcMARK2(i->prefix, gc); + gcMARK2(i->stx_map, gc); + gcMARK2(i->old_pos, gc); + gcMARK2(i->new_pos, gc); + gcMARK2(i->old_stx_pos, gc); + gcMARK2(i->flags, gc); + gcMARK2(i->lifts, gc); + gcMARK2(i->lifted, gc); + gcMARK2(i->next, gc); return gcBYTES_TO_WORDS(sizeof(Resolve_Info)); } -static int mark_resolve_info_FIXUP(void *p) { +static int mark_resolve_info_FIXUP(void *p, struct NewGC *gc) { Resolve_Info *i = (Resolve_Info *)p; - gcFIXUP(i->prefix); - gcFIXUP(i->stx_map); - gcFIXUP(i->old_pos); - gcFIXUP(i->new_pos); - gcFIXUP(i->old_stx_pos); - gcFIXUP(i->flags); - gcFIXUP(i->lifts); - gcFIXUP(i->lifted); - gcFIXUP(i->next); + gcFIXUP2(i->prefix, gc); + gcFIXUP2(i->stx_map, gc); + gcFIXUP2(i->old_pos, gc); + gcFIXUP2(i->new_pos, gc); + gcFIXUP2(i->old_stx_pos, gc); + gcFIXUP2(i->flags, gc); + gcFIXUP2(i->lifts, gc); + gcFIXUP2(i->lifted, gc); + gcFIXUP2(i->next, gc); return gcBYTES_TO_WORDS(sizeof(Resolve_Info)); @@ -2899,40 +2899,40 @@ static int mark_resolve_info_FIXUP(void *p) { #define mark_resolve_info_IS_CONST_SIZE 1 -static int mark_optimize_info_SIZE(void *p) { +static int mark_optimize_info_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Optimize_Info)); } -static int mark_optimize_info_MARK(void *p) { +static int mark_optimize_info_MARK(void *p, struct NewGC *gc) { Optimize_Info *i = (Optimize_Info *)p; - gcMARK(i->stat_dists); - gcMARK(i->sd_depths); - gcMARK(i->next); - gcMARK(i->use); - gcMARK(i->consts); - gcMARK(i->top_level_consts); - gcMARK(i->transitive_use); - gcMARK(i->transitive_use_len); - gcMARK(i->context); + gcMARK2(i->stat_dists, gc); + gcMARK2(i->sd_depths, gc); + gcMARK2(i->next, gc); + gcMARK2(i->use, gc); + gcMARK2(i->consts, gc); + gcMARK2(i->top_level_consts, gc); + gcMARK2(i->transitive_use, gc); + gcMARK2(i->transitive_use_len, gc); + gcMARK2(i->context, gc); return gcBYTES_TO_WORDS(sizeof(Optimize_Info)); } -static int mark_optimize_info_FIXUP(void *p) { +static int mark_optimize_info_FIXUP(void *p, struct NewGC *gc) { Optimize_Info *i = (Optimize_Info *)p; - gcFIXUP(i->stat_dists); - gcFIXUP(i->sd_depths); - gcFIXUP(i->next); - gcFIXUP(i->use); - gcFIXUP(i->consts); - gcFIXUP(i->top_level_consts); - gcFIXUP(i->transitive_use); - gcFIXUP(i->transitive_use_len); - gcFIXUP(i->context); + gcFIXUP2(i->stat_dists, gc); + gcFIXUP2(i->sd_depths, gc); + gcFIXUP2(i->next, gc); + gcFIXUP2(i->use, gc); + gcFIXUP2(i->consts, gc); + gcFIXUP2(i->top_level_consts, gc); + gcFIXUP2(i->transitive_use, gc); + gcFIXUP2(i->transitive_use_len, gc); + gcFIXUP2(i->context, gc); return gcBYTES_TO_WORDS(sizeof(Optimize_Info)); @@ -2942,28 +2942,28 @@ static int mark_optimize_info_FIXUP(void *p) { #define mark_optimize_info_IS_CONST_SIZE 1 -static int mark_sfs_info_SIZE(void *p) { +static int mark_sfs_info_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(SFS_Info)); } -static int mark_sfs_info_MARK(void *p) { +static int mark_sfs_info_MARK(void *p, struct NewGC *gc) { SFS_Info *i = (SFS_Info *)p; - gcMARK(i->max_used); - gcMARK(i->max_calls); - gcMARK(i->saved); + gcMARK2(i->max_used, gc); + gcMARK2(i->max_calls, gc); + gcMARK2(i->saved, gc); return gcBYTES_TO_WORDS(sizeof(SFS_Info)); } -static int mark_sfs_info_FIXUP(void *p) { +static int mark_sfs_info_FIXUP(void *p, struct NewGC *gc) { SFS_Info *i = (SFS_Info *)p; - gcFIXUP(i->max_used); - gcFIXUP(i->max_calls); - gcFIXUP(i->saved); + gcFIXUP2(i->max_used, gc); + gcFIXUP2(i->max_calls, gc); + gcFIXUP2(i->saved, gc); return gcBYTES_TO_WORDS(sizeof(SFS_Info)); @@ -2973,25 +2973,25 @@ static int mark_sfs_info_FIXUP(void *p) { #define mark_sfs_info_IS_CONST_SIZE 1 -static int mark_once_used_SIZE(void *p) { +static int mark_once_used_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Once_Used)); } -static int mark_once_used_MARK(void *p) { +static int mark_once_used_MARK(void *p, struct NewGC *gc) { Scheme_Once_Used *o = (Scheme_Once_Used *)p; - gcMARK(o->expr); - gcMARK(o->info); - gcMARK(o->next); + gcMARK2(o->expr, gc); + gcMARK2(o->info, gc); + gcMARK2(o->next, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Once_Used)); } -static int mark_once_used_FIXUP(void *p) { +static int mark_once_used_FIXUP(void *p, struct NewGC *gc) { Scheme_Once_Used *o = (Scheme_Once_Used *)p; - gcFIXUP(o->expr); - gcFIXUP(o->info); - gcFIXUP(o->next); + gcFIXUP2(o->expr, gc); + gcFIXUP2(o->info, gc); + gcFIXUP2(o->next, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Once_Used)); } @@ -3006,28 +3006,28 @@ static int mark_once_used_FIXUP(void *p) { #ifdef MARKS_FOR_EVAL_C -static int mark_comp_info_SIZE(void *p) { +static int mark_comp_info_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Compile_Info)); } -static int mark_comp_info_MARK(void *p) { +static int mark_comp_info_MARK(void *p, struct NewGC *gc) { Scheme_Compile_Info *i = (Scheme_Compile_Info *)p; - gcMARK(i->value_name); - gcMARK(i->certs); - gcMARK(i->observer); + gcMARK2(i->value_name, gc); + gcMARK2(i->certs, gc); + gcMARK2(i->observer, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Compile_Info)); } -static int mark_comp_info_FIXUP(void *p) { +static int mark_comp_info_FIXUP(void *p, struct NewGC *gc) { Scheme_Compile_Info *i = (Scheme_Compile_Info *)p; - gcFIXUP(i->value_name); - gcFIXUP(i->certs); - gcFIXUP(i->observer); + gcFIXUP2(i->value_name, gc); + gcFIXUP2(i->certs, gc); + gcFIXUP2(i->observer, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Compile_Info)); @@ -3037,26 +3037,26 @@ static int mark_comp_info_FIXUP(void *p) { #define mark_comp_info_IS_CONST_SIZE 1 -static int mark_saved_stack_SIZE(void *p) { +static int mark_saved_stack_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Saved_Stack)); } -static int mark_saved_stack_MARK(void *p) { +static int mark_saved_stack_MARK(void *p, struct NewGC *gc) { Scheme_Saved_Stack *saved = (Scheme_Saved_Stack *)p; - gcMARK(saved->prev); - gcMARK(saved->runstack_start); + gcMARK2(saved->prev, gc); + gcMARK2(saved->runstack_start, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Saved_Stack)); } -static int mark_saved_stack_FIXUP(void *p) { +static int mark_saved_stack_FIXUP(void *p, struct NewGC *gc) { Scheme_Saved_Stack *saved = (Scheme_Saved_Stack *)p; - gcFIXUP(saved->prev); - gcFIXUP(saved->runstack_start); + gcFIXUP2(saved->prev, gc); + gcFIXUP2(saved->runstack_start, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Saved_Stack)); @@ -3066,26 +3066,26 @@ static int mark_saved_stack_FIXUP(void *p) { #define mark_saved_stack_IS_CONST_SIZE 1 -static int mark_validate_clearing_SIZE(void *p) { +static int mark_validate_clearing_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Validate_Clearing)); } -static int mark_validate_clearing_MARK(void *p) { +static int mark_validate_clearing_MARK(void *p, struct NewGC *gc) { Validate_Clearing *vc = (Validate_Clearing *)p; - gcMARK(vc->stack); - gcMARK(vc->ncstack); + gcMARK2(vc->stack, gc); + gcMARK2(vc->ncstack, gc); return gcBYTES_TO_WORDS(sizeof(Validate_Clearing)); } -static int mark_validate_clearing_FIXUP(void *p) { +static int mark_validate_clearing_FIXUP(void *p, struct NewGC *gc) { Validate_Clearing *vc = (Validate_Clearing *)p; - gcFIXUP(vc->stack); - gcFIXUP(vc->ncstack); + gcFIXUP2(vc->stack, gc); + gcFIXUP2(vc->ncstack, gc); return gcBYTES_TO_WORDS(sizeof(Validate_Clearing)); @@ -3101,24 +3101,24 @@ static int mark_validate_clearing_FIXUP(void *p) { #ifdef MARKS_FOR_FILE_C -static int mark_reply_item_SIZE(void *p) { +static int mark_reply_item_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(ReplyItem)); } -static int mark_reply_item_MARK(void *p) { +static int mark_reply_item_MARK(void *p, struct NewGC *gc) { ReplyItem *r = (ReplyItem *)p; - gcMARK(r->next); + gcMARK2(r->next, gc); return gcBYTES_TO_WORDS(sizeof(ReplyItem)); } -static int mark_reply_item_FIXUP(void *p) { +static int mark_reply_item_FIXUP(void *p, struct NewGC *gc) { ReplyItem *r = (ReplyItem *)p; - gcFIXUP(r->next); + gcFIXUP2(r->next, gc); return gcBYTES_TO_WORDS(sizeof(ReplyItem)); @@ -3134,28 +3134,28 @@ static int mark_reply_item_FIXUP(void *p) { #ifdef MARKS_FOR_FUN_C -static int mark_closure_info_SIZE(void *p) { +static int mark_closure_info_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Closure_Info)); } -static int mark_closure_info_MARK(void *p) { +static int mark_closure_info_MARK(void *p, struct NewGC *gc) { Closure_Info *i = (Closure_Info *)p; - gcMARK(i->local_flags); - gcMARK(i->base_closure_map); - gcMARK(i->flonum_map); + gcMARK2(i->local_flags, gc); + gcMARK2(i->base_closure_map, gc); + gcMARK2(i->flonum_map, gc); return gcBYTES_TO_WORDS(sizeof(Closure_Info)); } -static int mark_closure_info_FIXUP(void *p) { +static int mark_closure_info_FIXUP(void *p, struct NewGC *gc) { Closure_Info *i = (Closure_Info *)p; - gcFIXUP(i->local_flags); - gcFIXUP(i->base_closure_map); - gcFIXUP(i->flonum_map); + gcFIXUP2(i->local_flags, gc); + gcFIXUP2(i->base_closure_map, gc); + gcFIXUP2(i->flonum_map, gc); return gcBYTES_TO_WORDS(sizeof(Closure_Info)); @@ -3165,26 +3165,26 @@ static int mark_closure_info_FIXUP(void *p) { #define mark_closure_info_IS_CONST_SIZE 1 -static int mark_dyn_wind_cell_SIZE(void *p) { +static int mark_dyn_wind_cell_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Dynamic_Wind_List)); } -static int mark_dyn_wind_cell_MARK(void *p) { +static int mark_dyn_wind_cell_MARK(void *p, struct NewGC *gc) { Scheme_Dynamic_Wind_List *l = (Scheme_Dynamic_Wind_List *)p; - gcMARK(l->dw); - gcMARK(l->next); + gcMARK2(l->dw, gc); + gcMARK2(l->next, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Dynamic_Wind_List)); } -static int mark_dyn_wind_cell_FIXUP(void *p) { +static int mark_dyn_wind_cell_FIXUP(void *p, struct NewGC *gc) { Scheme_Dynamic_Wind_List *l = (Scheme_Dynamic_Wind_List *)p; - gcFIXUP(l->dw); - gcFIXUP(l->next); + gcFIXUP2(l->dw, gc); + gcFIXUP2(l->next, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Dynamic_Wind_List)); @@ -3194,28 +3194,28 @@ static int mark_dyn_wind_cell_FIXUP(void *p) { #define mark_dyn_wind_cell_IS_CONST_SIZE 1 -static int mark_dyn_wind_info_SIZE(void *p) { +static int mark_dyn_wind_info_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Dyn_Wind)); } -static int mark_dyn_wind_info_MARK(void *p) { +static int mark_dyn_wind_info_MARK(void *p, struct NewGC *gc) { Dyn_Wind *d = (Dyn_Wind *)p; - gcMARK(d->pre); - gcMARK(d->act); - gcMARK(d->post); + gcMARK2(d->pre, gc); + gcMARK2(d->act, gc); + gcMARK2(d->post, gc); return gcBYTES_TO_WORDS(sizeof(Dyn_Wind)); } -static int mark_dyn_wind_info_FIXUP(void *p) { +static int mark_dyn_wind_info_FIXUP(void *p, struct NewGC *gc) { Dyn_Wind *d = (Dyn_Wind *)p; - gcFIXUP(d->pre); - gcFIXUP(d->act); - gcFIXUP(d->post); + gcFIXUP2(d->pre, gc); + gcFIXUP2(d->act, gc); + gcFIXUP2(d->post, gc); return gcBYTES_TO_WORDS(sizeof(Dyn_Wind)); @@ -3225,28 +3225,28 @@ static int mark_dyn_wind_info_FIXUP(void *p) { #define mark_dyn_wind_info_IS_CONST_SIZE 1 -static int mark_cont_mark_chain_SIZE(void *p) { +static int mark_cont_mark_chain_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Cont_Mark_Chain)); } -static int mark_cont_mark_chain_MARK(void *p) { +static int mark_cont_mark_chain_MARK(void *p, struct NewGC *gc) { Scheme_Cont_Mark_Chain *c = (Scheme_Cont_Mark_Chain *)p; - gcMARK(c->key); - gcMARK(c->val); - gcMARK(c->next); + gcMARK2(c->key, gc); + gcMARK2(c->val, gc); + gcMARK2(c->next, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Cont_Mark_Chain)); } -static int mark_cont_mark_chain_FIXUP(void *p) { +static int mark_cont_mark_chain_FIXUP(void *p, struct NewGC *gc) { Scheme_Cont_Mark_Chain *c = (Scheme_Cont_Mark_Chain *)p; - gcFIXUP(c->key); - gcFIXUP(c->val); - gcFIXUP(c->next); + gcFIXUP2(c->key, gc); + gcFIXUP2(c->val, gc); + gcFIXUP2(c->next, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Cont_Mark_Chain)); @@ -3262,26 +3262,26 @@ static int mark_cont_mark_chain_FIXUP(void *p) { #ifdef MARKS_FOR_HASH_C -static int hash_tree_val_SIZE(void *p) { +static int hash_tree_val_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Hash_Tree)); } -static int hash_tree_val_MARK(void *p) { +static int hash_tree_val_MARK(void *p, struct NewGC *gc) { Scheme_Hash_Tree *ht = (Scheme_Hash_Tree *)p; - gcMARK(ht->root); - gcMARK(ht->elems_box); + gcMARK2(ht->root, gc); + gcMARK2(ht->elems_box, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Hash_Tree)); } -static int hash_tree_val_FIXUP(void *p) { +static int hash_tree_val_FIXUP(void *p, struct NewGC *gc) { Scheme_Hash_Tree *ht = (Scheme_Hash_Tree *)p; - gcFIXUP(ht->root); - gcFIXUP(ht->elems_box); + gcFIXUP2(ht->root, gc); + gcFIXUP2(ht->elems_box, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Hash_Tree)); @@ -3291,40 +3291,40 @@ static int hash_tree_val_FIXUP(void *p) { #define hash_tree_val_IS_CONST_SIZE 1 -static int mark_rb_node_SIZE(void *p) { +static int mark_rb_node_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(RBNode)); } -static int mark_rb_node_MARK(void *p) { +static int mark_rb_node_MARK(void *p, struct NewGC *gc) { RBNode *rb = (RBNode *)p; /* Short-circuit on NULL pointers, which are especially likely */ if (rb->left) { - gcMARK(rb->left); + gcMARK2(rb->left, gc); } if (rb->right) { - gcMARK(rb->right); + gcMARK2(rb->right, gc); } - gcMARK(rb->key); - gcMARK(rb->val); + gcMARK2(rb->key, gc); + gcMARK2(rb->val, gc); return gcBYTES_TO_WORDS(sizeof(RBNode)); } -static int mark_rb_node_FIXUP(void *p) { +static int mark_rb_node_FIXUP(void *p, struct NewGC *gc) { RBNode *rb = (RBNode *)p; /* Short-circuit on NULL pointers, which are especially likely */ if (rb->left) { - gcFIXUP(rb->left); + gcFIXUP2(rb->left, gc); } if (rb->right) { - gcFIXUP(rb->right); + gcFIXUP2(rb->right, gc); } - gcFIXUP(rb->key); - gcFIXUP(rb->val); + gcFIXUP2(rb->key, gc); + gcFIXUP2(rb->val, gc); return gcBYTES_TO_WORDS(sizeof(RBNode)); @@ -3340,24 +3340,24 @@ static int mark_rb_node_FIXUP(void *p) { #ifdef MARKS_FOR_PLACES_C -static int place_bi_channel_val_SIZE(void *p) { +static int place_bi_channel_val_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Place_Bi_Channel)); } -static int place_bi_channel_val_MARK(void *p) { +static int place_bi_channel_val_MARK(void *p, struct NewGC *gc) { Scheme_Place_Bi_Channel *pbc = (Scheme_Place_Bi_Channel *)p; - gcMARK(pbc->sendch); - gcMARK(pbc->recvch); + gcMARK2(pbc->sendch, gc); + gcMARK2(pbc->recvch, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Place_Bi_Channel)); } -static int place_bi_channel_val_FIXUP(void *p) { +static int place_bi_channel_val_FIXUP(void *p, struct NewGC *gc) { Scheme_Place_Bi_Channel *pbc = (Scheme_Place_Bi_Channel *)p; - gcFIXUP(pbc->sendch); - gcFIXUP(pbc->recvch); + gcFIXUP2(pbc->sendch, gc); + gcFIXUP2(pbc->recvch, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Place_Bi_Channel)); @@ -3367,22 +3367,22 @@ static int place_bi_channel_val_FIXUP(void *p) { #define place_bi_channel_val_IS_CONST_SIZE 1 -static int place_val_SIZE(void *p) { +static int place_val_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Place)); } -static int place_val_MARK(void *p) { +static int place_val_MARK(void *p, struct NewGC *gc) { Scheme_Place *pr = (Scheme_Place *)p; - gcMARK(pr->channel); + gcMARK2(pr->channel, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Place)); } -static int place_val_FIXUP(void *p) { +static int place_val_FIXUP(void *p, struct NewGC *gc) { Scheme_Place *pr = (Scheme_Place *)p; - gcFIXUP(pr->channel); + gcFIXUP2(pr->channel, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Place)); @@ -3392,26 +3392,26 @@ static int place_val_FIXUP(void *p) { #define place_val_IS_CONST_SIZE 1 -static int place_async_channel_val_SIZE(void *p) { +static int place_async_channel_val_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Place_Async_Channel)); } -static int place_async_channel_val_MARK(void *p) { +static int place_async_channel_val_MARK(void *p, struct NewGC *gc) { Scheme_Place_Async_Channel *pac = (Scheme_Place_Async_Channel *)p; int i; for (i = pac->size; i--; ) - gcMARK(pac->msgs[i]); + gcMARK2(pac->msgs[i], gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Place_Async_Channel)); } -static int place_async_channel_val_FIXUP(void *p) { +static int place_async_channel_val_FIXUP(void *p, struct NewGC *gc) { Scheme_Place_Async_Channel *pac = (Scheme_Place_Async_Channel *)p; int i; for (i = pac->size; i--; ) - gcFIXUP(pac->msgs[i]); + gcFIXUP2(pac->msgs[i], gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Place_Async_Channel)); @@ -3427,34 +3427,34 @@ static int place_async_channel_val_FIXUP(void *p) { #ifdef MARKS_FOR_PORTFUN_C -static int mark_load_handler_data_SIZE(void *p) { +static int mark_load_handler_data_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(LoadHandlerData)); } -static int mark_load_handler_data_MARK(void *p) { +static int mark_load_handler_data_MARK(void *p, struct NewGC *gc) { LoadHandlerData *d = (LoadHandlerData *)p; - gcMARK(d->config); - gcMARK(d->port); - gcMARK(d->p); - gcMARK(d->stxsrc); - gcMARK(d->expected_module); - gcMARK(d->delay_load_info); + gcMARK2(d->config, gc); + gcMARK2(d->port, gc); + gcMARK2(d->p, gc); + gcMARK2(d->stxsrc, gc); + gcMARK2(d->expected_module, gc); + gcMARK2(d->delay_load_info, gc); return gcBYTES_TO_WORDS(sizeof(LoadHandlerData)); } -static int mark_load_handler_data_FIXUP(void *p) { +static int mark_load_handler_data_FIXUP(void *p, struct NewGC *gc) { LoadHandlerData *d = (LoadHandlerData *)p; - gcFIXUP(d->config); - gcFIXUP(d->port); - gcFIXUP(d->p); - gcFIXUP(d->stxsrc); - gcFIXUP(d->expected_module); - gcFIXUP(d->delay_load_info); + gcFIXUP2(d->config, gc); + gcFIXUP2(d->port, gc); + gcFIXUP2(d->p, gc); + gcFIXUP2(d->stxsrc, gc); + gcFIXUP2(d->expected_module, gc); + gcFIXUP2(d->delay_load_info, gc); return gcBYTES_TO_WORDS(sizeof(LoadHandlerData)); @@ -3464,24 +3464,24 @@ static int mark_load_handler_data_FIXUP(void *p) { #define mark_load_handler_data_IS_CONST_SIZE 1 -static int mark_indexed_string_SIZE(void *p) { +static int mark_indexed_string_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Indexed_String)); } -static int mark_indexed_string_MARK(void *p) { +static int mark_indexed_string_MARK(void *p, struct NewGC *gc) { Scheme_Indexed_String *is = (Scheme_Indexed_String *)p; - gcMARK(is->string); + gcMARK2(is->string, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Indexed_String)); } -static int mark_indexed_string_FIXUP(void *p) { +static int mark_indexed_string_FIXUP(void *p, struct NewGC *gc) { Scheme_Indexed_String *is = (Scheme_Indexed_String *)p; - gcFIXUP(is->string); + gcFIXUP2(is->string, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Indexed_String)); @@ -3491,43 +3491,43 @@ static int mark_indexed_string_FIXUP(void *p) { #define mark_indexed_string_IS_CONST_SIZE 1 -static int mark_user_input_SIZE(void *p) { +static int mark_user_input_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(User_Input_Port)); } -static int mark_user_input_MARK(void *p) { +static int mark_user_input_MARK(void *p, struct NewGC *gc) { User_Input_Port *uip = (User_Input_Port *)p; - gcMARK(uip->read_proc); - gcMARK(uip->peek_proc); - gcMARK(uip->progress_evt_proc); - gcMARK(uip->peeked_read_proc); - gcMARK(uip->location_proc); - gcMARK(uip->count_lines_proc); - gcMARK(uip->buffer_mode_proc); - gcMARK(uip->close_proc); - gcMARK(uip->reuse_str); - gcMARK(uip->peeked); - gcMARK(uip->prefix_pipe); + gcMARK2(uip->read_proc, gc); + gcMARK2(uip->peek_proc, gc); + gcMARK2(uip->progress_evt_proc, gc); + gcMARK2(uip->peeked_read_proc, gc); + gcMARK2(uip->location_proc, gc); + gcMARK2(uip->count_lines_proc, gc); + gcMARK2(uip->buffer_mode_proc, gc); + gcMARK2(uip->close_proc, gc); + gcMARK2(uip->reuse_str, gc); + gcMARK2(uip->peeked, gc); + gcMARK2(uip->prefix_pipe, gc); return gcBYTES_TO_WORDS(sizeof(User_Input_Port)); } -static int mark_user_input_FIXUP(void *p) { +static int mark_user_input_FIXUP(void *p, struct NewGC *gc) { User_Input_Port *uip = (User_Input_Port *)p; - gcFIXUP(uip->read_proc); - gcFIXUP(uip->peek_proc); - gcFIXUP(uip->progress_evt_proc); - gcFIXUP(uip->peeked_read_proc); - gcFIXUP(uip->location_proc); - gcFIXUP(uip->count_lines_proc); - gcFIXUP(uip->buffer_mode_proc); - gcFIXUP(uip->close_proc); - gcFIXUP(uip->reuse_str); - gcFIXUP(uip->peeked); - gcFIXUP(uip->prefix_pipe); + gcFIXUP2(uip->read_proc, gc); + gcFIXUP2(uip->peek_proc, gc); + gcFIXUP2(uip->progress_evt_proc, gc); + gcFIXUP2(uip->peeked_read_proc, gc); + gcFIXUP2(uip->location_proc, gc); + gcFIXUP2(uip->count_lines_proc, gc); + gcFIXUP2(uip->buffer_mode_proc, gc); + gcFIXUP2(uip->close_proc, gc); + gcFIXUP2(uip->reuse_str, gc); + gcFIXUP2(uip->peeked, gc); + gcFIXUP2(uip->prefix_pipe, gc); return gcBYTES_TO_WORDS(sizeof(User_Input_Port)); } @@ -3536,41 +3536,41 @@ static int mark_user_input_FIXUP(void *p) { #define mark_user_input_IS_CONST_SIZE 1 -static int mark_user_output_SIZE(void *p) { +static int mark_user_output_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(User_Output_Port)); } -static int mark_user_output_MARK(void *p) { +static int mark_user_output_MARK(void *p, struct NewGC *gc) { User_Output_Port *uop = (User_Output_Port *)p; - gcMARK(uop->evt); - gcMARK(uop->write_evt_proc); - gcMARK(uop->write_proc); - gcMARK(uop->write_special_evt_proc); - gcMARK(uop->write_special_proc); - gcMARK(uop->location_proc); - gcMARK(uop->count_lines_proc); - gcMARK(uop->buffer_mode_proc); - gcMARK(uop->close_proc); - gcMARK(uop->buffer_pipe); + gcMARK2(uop->evt, gc); + gcMARK2(uop->write_evt_proc, gc); + gcMARK2(uop->write_proc, gc); + gcMARK2(uop->write_special_evt_proc, gc); + gcMARK2(uop->write_special_proc, gc); + gcMARK2(uop->location_proc, gc); + gcMARK2(uop->count_lines_proc, gc); + gcMARK2(uop->buffer_mode_proc, gc); + gcMARK2(uop->close_proc, gc); + gcMARK2(uop->buffer_pipe, gc); return gcBYTES_TO_WORDS(sizeof(User_Output_Port)); } -static int mark_user_output_FIXUP(void *p) { +static int mark_user_output_FIXUP(void *p, struct NewGC *gc) { User_Output_Port *uop = (User_Output_Port *)p; - gcFIXUP(uop->evt); - gcFIXUP(uop->write_evt_proc); - gcFIXUP(uop->write_proc); - gcFIXUP(uop->write_special_evt_proc); - gcFIXUP(uop->write_special_proc); - gcFIXUP(uop->location_proc); - gcFIXUP(uop->count_lines_proc); - gcFIXUP(uop->buffer_mode_proc); - gcFIXUP(uop->close_proc); - gcFIXUP(uop->buffer_pipe); + gcFIXUP2(uop->evt, gc); + gcFIXUP2(uop->write_evt_proc, gc); + gcFIXUP2(uop->write_proc, gc); + gcFIXUP2(uop->write_special_evt_proc, gc); + gcFIXUP2(uop->write_special_proc, gc); + gcFIXUP2(uop->location_proc, gc); + gcFIXUP2(uop->count_lines_proc, gc); + gcFIXUP2(uop->buffer_mode_proc, gc); + gcFIXUP2(uop->close_proc, gc); + gcFIXUP2(uop->buffer_pipe, gc); return gcBYTES_TO_WORDS(sizeof(User_Output_Port)); } @@ -3586,24 +3586,24 @@ static int mark_user_output_FIXUP(void *p) { #ifdef MARKS_FOR_PORT_C #ifdef WINDOWS_PROCESSES -static int mark_thread_memory_SIZE(void *p) { +static int mark_thread_memory_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Thread_Memory)); } -static int mark_thread_memory_MARK(void *p) { +static int mark_thread_memory_MARK(void *p, struct NewGC *gc) { Scheme_Thread_Memory *tm = (Scheme_Thread_Memory *)p; - gcMARK(tm->prev); - gcMARK(tm->next); + gcMARK2(tm->prev, gc); + gcMARK2(tm->next, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Thread_Memory)); } -static int mark_thread_memory_FIXUP(void *p) { +static int mark_thread_memory_FIXUP(void *p, struct NewGC *gc) { Scheme_Thread_Memory *tm = (Scheme_Thread_Memory *)p; - gcFIXUP(tm->prev); - gcFIXUP(tm->next); + gcFIXUP2(tm->prev, gc); + gcFIXUP2(tm->next, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Thread_Memory)); @@ -3614,24 +3614,24 @@ static int mark_thread_memory_FIXUP(void *p) { #endif -static int mark_input_file_SIZE(void *p) { +static int mark_input_file_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Input_File)); } -static int mark_input_file_MARK(void *p) { +static int mark_input_file_MARK(void *p, struct NewGC *gc) { Scheme_Input_File *i = (Scheme_Input_File *)p; - gcMARK(i->f); + gcMARK2(i->f, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Input_File)); } -static int mark_input_file_FIXUP(void *p) { +static int mark_input_file_FIXUP(void *p, struct NewGC *gc) { Scheme_Input_File *i = (Scheme_Input_File *)p; - gcFIXUP(i->f); + gcFIXUP2(i->f, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Input_File)); @@ -3641,24 +3641,24 @@ static int mark_input_file_FIXUP(void *p) { #define mark_input_file_IS_CONST_SIZE 1 -static int mark_output_file_SIZE(void *p) { +static int mark_output_file_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Output_File)); } -static int mark_output_file_MARK(void *p) { +static int mark_output_file_MARK(void *p, struct NewGC *gc) { Scheme_Output_File *o = (Scheme_Output_File *)p; - gcMARK(o->f); + gcMARK2(o->f, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Output_File)); } -static int mark_output_file_FIXUP(void *p) { +static int mark_output_file_FIXUP(void *p, struct NewGC *gc) { Scheme_Output_File *o = (Scheme_Output_File *)p; - gcFIXUP(o->f); + gcFIXUP2(o->f, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Output_File)); @@ -3669,26 +3669,26 @@ static int mark_output_file_FIXUP(void *p) { #ifdef MZ_FDS -static int mark_input_fd_SIZE(void *p) { +static int mark_input_fd_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_FD)); } -static int mark_input_fd_MARK(void *p) { +static int mark_input_fd_MARK(void *p, struct NewGC *gc) { Scheme_FD *fd = (Scheme_FD *)p; - gcMARK(fd->buffer); - gcMARK(fd->refcount); + gcMARK2(fd->buffer, gc); + gcMARK2(fd->refcount, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_FD)); } -static int mark_input_fd_FIXUP(void *p) { +static int mark_input_fd_FIXUP(void *p, struct NewGC *gc) { Scheme_FD *fd = (Scheme_FD *)p; - gcFIXUP(fd->buffer); - gcFIXUP(fd->refcount); + gcFIXUP2(fd->buffer, gc); + gcFIXUP2(fd->refcount, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_FD)); @@ -3700,24 +3700,24 @@ static int mark_input_fd_FIXUP(void *p) { #endif #if defined(UNIX_PROCESSES) && !(defined(MZ_USE_PLACES) && defined(MZ_PRECISE_GC)) -static int mark_system_child_SIZE(void *p) { +static int mark_system_child_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(System_Child)); } -static int mark_system_child_MARK(void *p) { +static int mark_system_child_MARK(void *p, struct NewGC *gc) { System_Child *sc = (System_Child *)p; - gcMARK(sc->next); + gcMARK2(sc->next, gc); return gcBYTES_TO_WORDS(sizeof(System_Child)); } -static int mark_system_child_FIXUP(void *p) { +static int mark_system_child_FIXUP(void *p, struct NewGC *gc) { System_Child *sc = (System_Child *)p; - gcFIXUP(sc->next); + gcFIXUP2(sc->next, gc); return gcBYTES_TO_WORDS(sizeof(System_Child)); @@ -3729,26 +3729,26 @@ static int mark_system_child_FIXUP(void *p) { #endif #ifdef USE_OSKIT_CONSOLE -static int mark_oskit_console_input_SIZE(void *p) { +static int mark_oskit_console_input_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(osk_console_input)); } -static int mark_oskit_console_input_MARK(void *p) { +static int mark_oskit_console_input_MARK(void *p, struct NewGC *gc) { osk_console_input *c = (osk_console_input *)p; - gcMARK(c->buffer); - gcMARK(c->next); + gcMARK2(c->buffer, gc); + gcMARK2(c->next, gc); return gcBYTES_TO_WORDS(sizeof(osk_console_input)); } -static int mark_oskit_console_input_FIXUP(void *p) { +static int mark_oskit_console_input_FIXUP(void *p, struct NewGC *gc) { osk_console_input *c = (osk_console_input *)p; - gcFIXUP(c->buffer); - gcFIXUP(c->next); + gcFIXUP2(c->buffer, gc); + gcFIXUP2(c->next, gc); return gcBYTES_TO_WORDS(sizeof(osk_console_input)); @@ -3759,24 +3759,24 @@ static int mark_oskit_console_input_FIXUP(void *p) { #endif -static int mark_subprocess_SIZE(void *p) { +static int mark_subprocess_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Subprocess)); } -static int mark_subprocess_MARK(void *p) { +static int mark_subprocess_MARK(void *p, struct NewGC *gc) { #ifndef WINDOWS_PROCESSES Scheme_Subprocess *sp = (Scheme_Subprocess *)p; - gcMARK(sp->handle); + gcMARK2(sp->handle, gc); #endif return gcBYTES_TO_WORDS(sizeof(Scheme_Subprocess)); } -static int mark_subprocess_FIXUP(void *p) { +static int mark_subprocess_FIXUP(void *p, struct NewGC *gc) { #ifndef WINDOWS_PROCESSES Scheme_Subprocess *sp = (Scheme_Subprocess *)p; - gcFIXUP(sp->handle); + gcFIXUP2(sp->handle, gc); #endif return gcBYTES_TO_WORDS(sizeof(Scheme_Subprocess)); @@ -3786,25 +3786,25 @@ static int mark_subprocess_FIXUP(void *p) { #define mark_subprocess_IS_CONST_SIZE 1 -static int mark_read_write_evt_SIZE(void *p) { +static int mark_read_write_evt_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Read_Write_Evt)); } -static int mark_read_write_evt_MARK(void *p) { +static int mark_read_write_evt_MARK(void *p, struct NewGC *gc) { Scheme_Read_Write_Evt *rww = (Scheme_Read_Write_Evt *)p; - gcMARK(rww->port); - gcMARK(rww->v); - gcMARK(rww->str); + gcMARK2(rww->port, gc); + gcMARK2(rww->v, gc); + gcMARK2(rww->str, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Read_Write_Evt)); } -static int mark_read_write_evt_FIXUP(void *p) { +static int mark_read_write_evt_FIXUP(void *p, struct NewGC *gc) { Scheme_Read_Write_Evt *rww = (Scheme_Read_Write_Evt *)p; - gcFIXUP(rww->port); - gcFIXUP(rww->v); - gcFIXUP(rww->str); + gcFIXUP2(rww->port, gc); + gcFIXUP2(rww->v, gc); + gcFIXUP2(rww->str, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Read_Write_Evt)); } @@ -3819,25 +3819,25 @@ static int mark_read_write_evt_FIXUP(void *p) { #ifdef MARKS_FOR_PRINT_C -static int mark_print_params_SIZE(void *p) { +static int mark_print_params_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(PrintParams)); } -static int mark_print_params_MARK(void *p) { +static int mark_print_params_MARK(void *p, struct NewGC *gc) { PrintParams *pp = (PrintParams *)p; - gcMARK(pp->inspector); - gcMARK(pp->print_port); - gcMARK(pp->print_buffer); + gcMARK2(pp->inspector, gc); + gcMARK2(pp->print_port, gc); + gcMARK2(pp->print_buffer, gc); return gcBYTES_TO_WORDS(sizeof(PrintParams)); } -static int mark_print_params_FIXUP(void *p) { +static int mark_print_params_FIXUP(void *p, struct NewGC *gc) { PrintParams *pp = (PrintParams *)p; - gcFIXUP(pp->inspector); - gcFIXUP(pp->print_port); - gcFIXUP(pp->print_buffer); + gcFIXUP2(pp->inspector, gc); + gcFIXUP2(pp->print_port, gc); + gcFIXUP2(pp->print_buffer, gc); return gcBYTES_TO_WORDS(sizeof(PrintParams)); } @@ -3846,51 +3846,51 @@ static int mark_print_params_FIXUP(void *p) { #define mark_print_params_IS_CONST_SIZE 1 -static int mark_marshal_tables_SIZE(void *p) { +static int mark_marshal_tables_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Marshal_Tables)); } -static int mark_marshal_tables_MARK(void *p) { +static int mark_marshal_tables_MARK(void *p, struct NewGC *gc) { Scheme_Marshal_Tables *mt = (Scheme_Marshal_Tables *)p; - gcMARK(mt->symtab); - gcMARK(mt->rns); - gcMARK(mt->rn_refs); - gcMARK(mt->st_refs); - gcMARK(mt->st_ref_stack); - gcMARK(mt->reverse_map); - gcMARK(mt->same_map); - gcMARK(mt->cert_lists); - gcMARK(mt->shift_map); - gcMARK(mt->top_map); - gcMARK(mt->key_map); - gcMARK(mt->delay_map); - gcMARK(mt->cdata_map); - gcMARK(mt->rn_saved); - gcMARK(mt->shared_offsets); - gcMARK(mt->sorted_keys); + gcMARK2(mt->symtab, gc); + gcMARK2(mt->rns, gc); + gcMARK2(mt->rn_refs, gc); + gcMARK2(mt->st_refs, gc); + gcMARK2(mt->st_ref_stack, gc); + gcMARK2(mt->reverse_map, gc); + gcMARK2(mt->same_map, gc); + gcMARK2(mt->cert_lists, gc); + gcMARK2(mt->shift_map, gc); + gcMARK2(mt->top_map, gc); + gcMARK2(mt->key_map, gc); + gcMARK2(mt->delay_map, gc); + gcMARK2(mt->cdata_map, gc); + gcMARK2(mt->rn_saved, gc); + gcMARK2(mt->shared_offsets, gc); + gcMARK2(mt->sorted_keys, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Marshal_Tables)); } -static int mark_marshal_tables_FIXUP(void *p) { +static int mark_marshal_tables_FIXUP(void *p, struct NewGC *gc) { Scheme_Marshal_Tables *mt = (Scheme_Marshal_Tables *)p; - gcFIXUP(mt->symtab); - gcFIXUP(mt->rns); - gcFIXUP(mt->rn_refs); - gcFIXUP(mt->st_refs); - gcFIXUP(mt->st_ref_stack); - gcFIXUP(mt->reverse_map); - gcFIXUP(mt->same_map); - gcFIXUP(mt->cert_lists); - gcFIXUP(mt->shift_map); - gcFIXUP(mt->top_map); - gcFIXUP(mt->key_map); - gcFIXUP(mt->delay_map); - gcFIXUP(mt->cdata_map); - gcFIXUP(mt->rn_saved); - gcFIXUP(mt->shared_offsets); - gcFIXUP(mt->sorted_keys); + gcFIXUP2(mt->symtab, gc); + gcFIXUP2(mt->rns, gc); + gcFIXUP2(mt->rn_refs, gc); + gcFIXUP2(mt->st_refs, gc); + gcFIXUP2(mt->st_ref_stack, gc); + gcFIXUP2(mt->reverse_map, gc); + gcFIXUP2(mt->same_map, gc); + gcFIXUP2(mt->cert_lists, gc); + gcFIXUP2(mt->shift_map, gc); + gcFIXUP2(mt->top_map, gc); + gcFIXUP2(mt->key_map, gc); + gcFIXUP2(mt->delay_map, gc); + gcFIXUP2(mt->cdata_map, gc); + gcFIXUP2(mt->rn_saved, gc); + gcFIXUP2(mt->shared_offsets, gc); + gcFIXUP2(mt->sorted_keys, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Marshal_Tables)); } @@ -3905,28 +3905,28 @@ static int mark_marshal_tables_FIXUP(void *p) { #ifdef MARKS_FOR_NETWORK_C -static int mark_listener_SIZE(void *p) { +static int mark_listener_SIZE(void *p, struct NewGC *gc) { listener_t *l = (listener_t *)p; return gcBYTES_TO_WORDS(sizeof(listener_t) + ((l->count - 1) * sizeof(tcp_t))); } -static int mark_listener_MARK(void *p) { +static int mark_listener_MARK(void *p, struct NewGC *gc) { listener_t *l = (listener_t *)p; - gcMARK(l->mref); + gcMARK2(l->mref, gc); return gcBYTES_TO_WORDS(sizeof(listener_t) + ((l->count - 1) * sizeof(tcp_t))); } -static int mark_listener_FIXUP(void *p) { +static int mark_listener_FIXUP(void *p, struct NewGC *gc) { listener_t *l = (listener_t *)p; - gcFIXUP(l->mref); + gcFIXUP2(l->mref, gc); return gcBYTES_TO_WORDS(sizeof(listener_t) + ((l->count - 1) * sizeof(tcp_t))); @@ -3937,26 +3937,26 @@ static int mark_listener_FIXUP(void *p) { #ifdef USE_TCP -static int mark_tcp_SIZE(void *p) { +static int mark_tcp_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Tcp)); } -static int mark_tcp_MARK(void *p) { +static int mark_tcp_MARK(void *p, struct NewGC *gc) { Scheme_Tcp *tcp = (Scheme_Tcp *)p; - gcMARK(tcp->b.buffer); - gcMARK(tcp->b.out_buffer); + gcMARK2(tcp->b.buffer, gc); + gcMARK2(tcp->b.out_buffer, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Tcp)); } -static int mark_tcp_FIXUP(void *p) { +static int mark_tcp_FIXUP(void *p, struct NewGC *gc) { Scheme_Tcp *tcp = (Scheme_Tcp *)p; - gcFIXUP(tcp->b.buffer); - gcFIXUP(tcp->b.out_buffer); + gcFIXUP2(tcp->b.buffer, gc); + gcFIXUP2(tcp->b.out_buffer, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Tcp)); @@ -3967,26 +3967,26 @@ static int mark_tcp_FIXUP(void *p) { # ifdef UDP_IS_SUPPORTED -static int mark_udp_SIZE(void *p) { +static int mark_udp_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_UDP)); } -static int mark_udp_MARK(void *p) { +static int mark_udp_MARK(void *p, struct NewGC *gc) { Scheme_UDP *udp = (Scheme_UDP *)p; - gcMARK(udp->previous_from_addr); - gcMARK(udp->mref); + gcMARK2(udp->previous_from_addr, gc); + gcMARK2(udp->mref, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_UDP)); } -static int mark_udp_FIXUP(void *p) { +static int mark_udp_FIXUP(void *p, struct NewGC *gc) { Scheme_UDP *udp = (Scheme_UDP *)p; - gcFIXUP(udp->previous_from_addr); - gcFIXUP(udp->mref); + gcFIXUP2(udp->previous_from_addr, gc); + gcFIXUP2(udp->mref, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_UDP)); @@ -3996,28 +3996,28 @@ static int mark_udp_FIXUP(void *p) { #define mark_udp_IS_CONST_SIZE 1 -static int mark_udp_evt_SIZE(void *p) { +static int mark_udp_evt_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_UDP_Evt)); } -static int mark_udp_evt_MARK(void *p) { +static int mark_udp_evt_MARK(void *p, struct NewGC *gc) { Scheme_UDP_Evt *uw = (Scheme_UDP_Evt *)p; - gcMARK(uw->udp); - gcMARK(uw->str); - gcMARK(uw->dest_addr); + gcMARK2(uw->udp, gc); + gcMARK2(uw->str, gc); + gcMARK2(uw->dest_addr, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_UDP_Evt)); } -static int mark_udp_evt_FIXUP(void *p) { +static int mark_udp_evt_FIXUP(void *p, struct NewGC *gc) { Scheme_UDP_Evt *uw = (Scheme_UDP_Evt *)p; - gcFIXUP(uw->udp); - gcFIXUP(uw->str); - gcFIXUP(uw->dest_addr); + gcFIXUP2(uw->udp, gc); + gcFIXUP2(uw->str, gc); + gcFIXUP2(uw->dest_addr, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_UDP_Evt)); @@ -4035,34 +4035,34 @@ static int mark_udp_evt_FIXUP(void *p) { #ifdef MARKS_FOR_THREAD_C -static int mark_parameterization_SIZE(void *p) { +static int mark_parameterization_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS((sizeof(Scheme_Parameterization) + ((max_configs - 1) * sizeof(Scheme_Object*)))); } -static int mark_parameterization_MARK(void *p) { +static int mark_parameterization_MARK(void *p, struct NewGC *gc) { Scheme_Parameterization *c = (Scheme_Parameterization *)p; int i; for (i = max_configs; i--; ) { - gcMARK(c->prims[i]); + gcMARK2(c->prims[i], gc); } - gcMARK(c->extensions); + gcMARK2(c->extensions, gc); return gcBYTES_TO_WORDS((sizeof(Scheme_Parameterization) + ((max_configs - 1) * sizeof(Scheme_Object*)))); } -static int mark_parameterization_FIXUP(void *p) { +static int mark_parameterization_FIXUP(void *p, struct NewGC *gc) { Scheme_Parameterization *c = (Scheme_Parameterization *)p; int i; for (i = max_configs; i--; ) { - gcFIXUP(c->prims[i]); + gcFIXUP2(c->prims[i], gc); } - gcFIXUP(c->extensions); + gcFIXUP2(c->extensions, gc); return gcBYTES_TO_WORDS((sizeof(Scheme_Parameterization) @@ -4073,25 +4073,25 @@ static int mark_parameterization_FIXUP(void *p) { #define mark_parameterization_IS_CONST_SIZE 0 -static int mark_config_SIZE(void *p) { +static int mark_config_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Config)); } -static int mark_config_MARK(void *p) { +static int mark_config_MARK(void *p, struct NewGC *gc) { Scheme_Config *config = (Scheme_Config *)p; - gcMARK(config->key); - gcMARK(config->cell); - gcMARK(config->next); + gcMARK2(config->key, gc); + gcMARK2(config->cell, gc); + gcMARK2(config->next, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Config)); } -static int mark_config_FIXUP(void *p) { +static int mark_config_FIXUP(void *p, struct NewGC *gc) { Scheme_Config *config = (Scheme_Config *)p; - gcFIXUP(config->key); - gcFIXUP(config->cell); - gcFIXUP(config->next); + gcFIXUP2(config->key, gc); + gcFIXUP2(config->cell, gc); + gcFIXUP2(config->next, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Config)); } @@ -4100,28 +4100,28 @@ static int mark_config_FIXUP(void *p) { #define mark_config_IS_CONST_SIZE 1 -static int mark_will_executor_val_SIZE(void *p) { +static int mark_will_executor_val_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(WillExecutor)); } -static int mark_will_executor_val_MARK(void *p) { +static int mark_will_executor_val_MARK(void *p, struct NewGC *gc) { WillExecutor *e = (WillExecutor *)p; - gcMARK(e->sema); - gcMARK(e->first); - gcMARK(e->last); + gcMARK2(e->sema, gc); + gcMARK2(e->first, gc); + gcMARK2(e->last, gc); return gcBYTES_TO_WORDS(sizeof(WillExecutor)); } -static int mark_will_executor_val_FIXUP(void *p) { +static int mark_will_executor_val_FIXUP(void *p, struct NewGC *gc) { WillExecutor *e = (WillExecutor *)p; - gcFIXUP(e->sema); - gcFIXUP(e->first); - gcFIXUP(e->last); + gcFIXUP2(e->sema, gc); + gcFIXUP2(e->first, gc); + gcFIXUP2(e->last, gc); return gcBYTES_TO_WORDS(sizeof(WillExecutor)); @@ -4131,48 +4131,48 @@ static int mark_will_executor_val_FIXUP(void *p) { #define mark_will_executor_val_IS_CONST_SIZE 1 -static int mark_custodian_val_SIZE(void *p) { +static int mark_custodian_val_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Custodian)); } -static int mark_custodian_val_MARK(void *p) { +static int mark_custodian_val_MARK(void *p, struct NewGC *gc) { Scheme_Custodian *m = (Scheme_Custodian *)p; - gcMARK(m->boxes); - gcMARK(m->mrefs); - gcMARK(m->closers); - gcMARK(m->data); + gcMARK2(m->boxes, gc); + gcMARK2(m->mrefs, gc); + gcMARK2(m->closers, gc); + gcMARK2(m->data, gc); - gcMARK(m->parent); - gcMARK(m->sibling); - gcMARK(m->children); + gcMARK2(m->parent, gc); + gcMARK2(m->sibling, gc); + gcMARK2(m->children, gc); - gcMARK(m->global_next); - gcMARK(m->global_prev); + gcMARK2(m->global_next, gc); + gcMARK2(m->global_prev, gc); - gcMARK(m->cust_boxes); + gcMARK2(m->cust_boxes, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Custodian)); } -static int mark_custodian_val_FIXUP(void *p) { +static int mark_custodian_val_FIXUP(void *p, struct NewGC *gc) { Scheme_Custodian *m = (Scheme_Custodian *)p; - gcFIXUP(m->boxes); - gcFIXUP(m->mrefs); - gcFIXUP(m->closers); - gcFIXUP(m->data); + gcFIXUP2(m->boxes, gc); + gcFIXUP2(m->mrefs, gc); + gcFIXUP2(m->closers, gc); + gcFIXUP2(m->data, gc); - gcFIXUP(m->parent); - gcFIXUP(m->sibling); - gcFIXUP(m->children); + gcFIXUP2(m->parent, gc); + gcFIXUP2(m->sibling, gc); + gcFIXUP2(m->children, gc); - gcFIXUP(m->global_next); - gcFIXUP(m->global_prev); + gcFIXUP2(m->global_next, gc); + gcFIXUP2(m->global_prev, gc); - gcFIXUP(m->cust_boxes); + gcFIXUP2(m->cust_boxes, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Custodian)); @@ -4182,31 +4182,31 @@ static int mark_custodian_val_FIXUP(void *p) { #define mark_custodian_val_IS_CONST_SIZE 1 -static int mark_custodian_box_val_SIZE(void *p) { +static int mark_custodian_box_val_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Custodian_Box)); } -static int mark_custodian_box_val_MARK(void *p) { +static int mark_custodian_box_val_MARK(void *p, struct NewGC *gc) { Scheme_Custodian_Box *b = (Scheme_Custodian_Box *)p; int sd = ((Scheme_Custodian *)GC_resolve(b->cust))->shut_down; - gcMARK(b->cust); + gcMARK2(b->cust, gc); if (!sd) { - gcMARK(b->v); + gcMARK2(b->v, gc); } return gcBYTES_TO_WORDS(sizeof(Scheme_Custodian_Box)); } -static int mark_custodian_box_val_FIXUP(void *p) { +static int mark_custodian_box_val_FIXUP(void *p, struct NewGC *gc) { Scheme_Custodian_Box *b = (Scheme_Custodian_Box *)p; int sd = ((Scheme_Custodian *)GC_resolve(b->cust))->shut_down; - gcFIXUP(b->cust); + gcFIXUP2(b->cust, gc); if (!sd) { - gcFIXUP(b->v); + gcFIXUP2(b->v, gc); } return @@ -4217,24 +4217,24 @@ static int mark_custodian_box_val_FIXUP(void *p) { #define mark_custodian_box_val_IS_CONST_SIZE 1 -static int mark_thread_hop_SIZE(void *p) { +static int mark_thread_hop_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Thread_Custodian_Hop)); } -static int mark_thread_hop_MARK(void *p) { +static int mark_thread_hop_MARK(void *p, struct NewGC *gc) { Scheme_Thread_Custodian_Hop *hop = (Scheme_Thread_Custodian_Hop *)p; - gcMARK(hop->p); + gcMARK2(hop->p, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Thread_Custodian_Hop)); } -static int mark_thread_hop_FIXUP(void *p) { +static int mark_thread_hop_FIXUP(void *p, struct NewGC *gc) { Scheme_Thread_Custodian_Hop *hop = (Scheme_Thread_Custodian_Hop *)p; - gcFIXUP(hop->p); + gcFIXUP2(hop->p, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Thread_Custodian_Hop)); @@ -4244,30 +4244,30 @@ static int mark_thread_hop_FIXUP(void *p) { #define mark_thread_hop_IS_CONST_SIZE 1 -static int mark_param_data_SIZE(void *p) { +static int mark_param_data_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(ParamData)); } -static int mark_param_data_MARK(void *p) { +static int mark_param_data_MARK(void *p, struct NewGC *gc) { ParamData *d = (ParamData *)p; - gcMARK(d->key); - gcMARK(d->guard); - gcMARK(d->extract_guard); - gcMARK(d->defcell); + gcMARK2(d->key, gc); + gcMARK2(d->guard, gc); + gcMARK2(d->extract_guard, gc); + gcMARK2(d->defcell, gc); return gcBYTES_TO_WORDS(sizeof(ParamData)); } -static int mark_param_data_FIXUP(void *p) { +static int mark_param_data_FIXUP(void *p, struct NewGC *gc) { ParamData *d = (ParamData *)p; - gcFIXUP(d->key); - gcFIXUP(d->guard); - gcFIXUP(d->extract_guard); - gcFIXUP(d->defcell); + gcFIXUP2(d->key, gc); + gcFIXUP2(d->guard, gc); + gcFIXUP2(d->extract_guard, gc); + gcFIXUP2(d->defcell, gc); return gcBYTES_TO_WORDS(sizeof(ParamData)); @@ -4277,30 +4277,30 @@ static int mark_param_data_FIXUP(void *p) { #define mark_param_data_IS_CONST_SIZE 1 -static int mark_will_SIZE(void *p) { +static int mark_will_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(ActiveWill)); } -static int mark_will_MARK(void *p) { +static int mark_will_MARK(void *p, struct NewGC *gc) { ActiveWill *w = (ActiveWill *)p; - gcMARK(w->o); - gcMARK(w->proc); - gcMARK(w->w); - gcMARK(w->next); + gcMARK2(w->o, gc); + gcMARK2(w->proc, gc); + gcMARK2(w->w, gc); + gcMARK2(w->next, gc); return gcBYTES_TO_WORDS(sizeof(ActiveWill)); } -static int mark_will_FIXUP(void *p) { +static int mark_will_FIXUP(void *p, struct NewGC *gc) { ActiveWill *w = (ActiveWill *)p; - gcFIXUP(w->o); - gcFIXUP(w->proc); - gcFIXUP(w->w); - gcFIXUP(w->next); + gcFIXUP2(w->o, gc); + gcFIXUP2(w->proc, gc); + gcFIXUP2(w->w, gc); + gcFIXUP2(w->next, gc); return gcBYTES_TO_WORDS(sizeof(ActiveWill)); @@ -4310,17 +4310,17 @@ static int mark_will_FIXUP(void *p) { #define mark_will_IS_CONST_SIZE 1 -static int mark_evt_SIZE(void *p) { +static int mark_evt_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Evt)); } -static int mark_evt_MARK(void *p) { +static int mark_evt_MARK(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Evt)); } -static int mark_evt_FIXUP(void *p) { +static int mark_evt_FIXUP(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Evt)); } @@ -4329,34 +4329,34 @@ static int mark_evt_FIXUP(void *p) { #define mark_evt_IS_CONST_SIZE 1 -static int mark_syncing_SIZE(void *p) { +static int mark_syncing_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Syncing)); } -static int mark_syncing_MARK(void *p) { +static int mark_syncing_MARK(void *p, struct NewGC *gc) { Syncing *w = (Syncing *)p; - gcMARK(w->set); - gcMARK(w->wrapss); - gcMARK(w->nackss); - gcMARK(w->reposts); - gcMARK(w->accepts); - gcMARK(w->disable_break); + gcMARK2(w->set, gc); + gcMARK2(w->wrapss, gc); + gcMARK2(w->nackss, gc); + gcMARK2(w->reposts, gc); + gcMARK2(w->accepts, gc); + gcMARK2(w->disable_break, gc); return gcBYTES_TO_WORDS(sizeof(Syncing)); } -static int mark_syncing_FIXUP(void *p) { +static int mark_syncing_FIXUP(void *p, struct NewGC *gc) { Syncing *w = (Syncing *)p; - gcFIXUP(w->set); - gcFIXUP(w->wrapss); - gcFIXUP(w->nackss); - gcFIXUP(w->reposts); - gcFIXUP(w->accepts); - gcFIXUP(w->disable_break); + gcFIXUP2(w->set, gc); + gcFIXUP2(w->wrapss, gc); + gcFIXUP2(w->nackss, gc); + gcFIXUP2(w->reposts, gc); + gcFIXUP2(w->accepts, gc); + gcFIXUP2(w->disable_break, gc); return gcBYTES_TO_WORDS(sizeof(Syncing)); @@ -4366,26 +4366,26 @@ static int mark_syncing_FIXUP(void *p) { #define mark_syncing_IS_CONST_SIZE 1 -static int mark_evt_set_SIZE(void *p) { +static int mark_evt_set_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Evt_Set)); } -static int mark_evt_set_MARK(void *p) { +static int mark_evt_set_MARK(void *p, struct NewGC *gc) { Evt_Set *w = (Evt_Set *)p; - gcMARK(w->ws); - gcMARK(w->argv); + gcMARK2(w->ws, gc); + gcMARK2(w->argv, gc); return gcBYTES_TO_WORDS(sizeof(Evt_Set)); } -static int mark_evt_set_FIXUP(void *p) { +static int mark_evt_set_FIXUP(void *p, struct NewGC *gc) { Evt_Set *w = (Evt_Set *)p; - gcFIXUP(w->ws); - gcFIXUP(w->argv); + gcFIXUP2(w->ws, gc); + gcFIXUP2(w->argv, gc); return gcBYTES_TO_WORDS(sizeof(Evt_Set)); @@ -4395,34 +4395,34 @@ static int mark_evt_set_FIXUP(void *p) { #define mark_evt_set_IS_CONST_SIZE 1 -static int mark_thread_set_SIZE(void *p) { +static int mark_thread_set_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Thread_Set)); } -static int mark_thread_set_MARK(void *p) { +static int mark_thread_set_MARK(void *p, struct NewGC *gc) { Scheme_Thread_Set *ts = (Scheme_Thread_Set *)p; - gcMARK(ts->parent); - gcMARK(ts->first); - gcMARK(ts->next); - gcMARK(ts->prev); - gcMARK(ts->search_start); - gcMARK(ts->current); + gcMARK2(ts->parent, gc); + gcMARK2(ts->first, gc); + gcMARK2(ts->next, gc); + gcMARK2(ts->prev, gc); + gcMARK2(ts->search_start, gc); + gcMARK2(ts->current, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Thread_Set)); } -static int mark_thread_set_FIXUP(void *p) { +static int mark_thread_set_FIXUP(void *p, struct NewGC *gc) { Scheme_Thread_Set *ts = (Scheme_Thread_Set *)p; - gcFIXUP(ts->parent); - gcFIXUP(ts->first); - gcFIXUP(ts->next); - gcFIXUP(ts->prev); - gcFIXUP(ts->search_start); - gcFIXUP(ts->current); + gcFIXUP2(ts->parent, gc); + gcFIXUP2(ts->first, gc); + gcFIXUP2(ts->next, gc); + gcFIXUP2(ts->prev, gc); + gcFIXUP2(ts->search_start, gc); + gcFIXUP2(ts->current, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Thread_Set)); @@ -4432,24 +4432,24 @@ static int mark_thread_set_FIXUP(void *p) { #define mark_thread_set_IS_CONST_SIZE 1 -static int mark_thread_cell_SIZE(void *p) { +static int mark_thread_cell_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Thread_Cell)); } -static int mark_thread_cell_MARK(void *p) { +static int mark_thread_cell_MARK(void *p, struct NewGC *gc) { Thread_Cell *c = (Thread_Cell *)p; - gcMARK(c->def_val); + gcMARK2(c->def_val, gc); return gcBYTES_TO_WORDS(sizeof(Thread_Cell)); } -static int mark_thread_cell_FIXUP(void *p) { +static int mark_thread_cell_FIXUP(void *p, struct NewGC *gc) { Thread_Cell *c = (Thread_Cell *)p; - gcFIXUP(c->def_val); + gcFIXUP2(c->def_val, gc); return gcBYTES_TO_WORDS(sizeof(Thread_Cell)); @@ -4459,30 +4459,30 @@ static int mark_thread_cell_FIXUP(void *p) { #define mark_thread_cell_IS_CONST_SIZE 1 -static int mark_frozen_tramp_SIZE(void *p) { +static int mark_frozen_tramp_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(FrozenTramp)); } -static int mark_frozen_tramp_MARK(void *p) { +static int mark_frozen_tramp_MARK(void *p, struct NewGC *gc) { FrozenTramp *f = (FrozenTramp *)p; - gcMARK(f->do_data); - gcMARK(f->old_param); - gcMARK(f->config); - gcMARK(f->progress_cont); + gcMARK2(f->do_data, gc); + gcMARK2(f->old_param, gc); + gcMARK2(f->config, gc); + gcMARK2(f->progress_cont, gc); return gcBYTES_TO_WORDS(sizeof(FrozenTramp)); } -static int mark_frozen_tramp_FIXUP(void *p) { +static int mark_frozen_tramp_FIXUP(void *p, struct NewGC *gc) { FrozenTramp *f = (FrozenTramp *)p; - gcFIXUP(f->do_data); - gcFIXUP(f->old_param); - gcFIXUP(f->config); - gcFIXUP(f->progress_cont); + gcFIXUP2(f->do_data, gc); + gcFIXUP2(f->old_param, gc); + gcFIXUP2(f->config, gc); + gcFIXUP2(f->progress_cont, gc); return gcBYTES_TO_WORDS(sizeof(FrozenTramp)); @@ -4498,28 +4498,28 @@ static int mark_frozen_tramp_FIXUP(void *p) { #ifdef MARKS_FOR_SALLOC_C -static int mark_finalization_SIZE(void *p) { +static int mark_finalization_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Finalization)); } -static int mark_finalization_MARK(void *p) { +static int mark_finalization_MARK(void *p, struct NewGC *gc) { Finalization *f = (Finalization *)p; - gcMARK(f->data); - gcMARK(f->next); - gcMARK(f->prev); + gcMARK2(f->data, gc); + gcMARK2(f->next, gc); + gcMARK2(f->prev, gc); return gcBYTES_TO_WORDS(sizeof(Finalization)); } -static int mark_finalization_FIXUP(void *p) { +static int mark_finalization_FIXUP(void *p, struct NewGC *gc) { Finalization *f = (Finalization *)p; - gcFIXUP(f->data); - gcFIXUP(f->next); - gcFIXUP(f->prev); + gcFIXUP2(f->data, gc); + gcFIXUP2(f->next, gc); + gcFIXUP2(f->prev, gc); return gcBYTES_TO_WORDS(sizeof(Finalization)); @@ -4529,32 +4529,32 @@ static int mark_finalization_FIXUP(void *p) { #define mark_finalization_IS_CONST_SIZE 1 -static int mark_finalizations_SIZE(void *p) { +static int mark_finalizations_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Finalizations)); } -static int mark_finalizations_MARK(void *p) { +static int mark_finalizations_MARK(void *p, struct NewGC *gc) { Finalizations *f = (Finalizations *)p; - gcMARK(f->scheme_first); - gcMARK(f->scheme_last); - gcMARK(f->prim_first); - gcMARK(f->prim_last); - gcMARK(f->ext_data); + gcMARK2(f->scheme_first, gc); + gcMARK2(f->scheme_last, gc); + gcMARK2(f->prim_first, gc); + gcMARK2(f->prim_last, gc); + gcMARK2(f->ext_data, gc); return gcBYTES_TO_WORDS(sizeof(Finalizations)); } -static int mark_finalizations_FIXUP(void *p) { +static int mark_finalizations_FIXUP(void *p, struct NewGC *gc) { Finalizations *f = (Finalizations *)p; - gcFIXUP(f->scheme_first); - gcFIXUP(f->scheme_last); - gcFIXUP(f->prim_first); - gcFIXUP(f->prim_last); - gcFIXUP(f->ext_data); + gcFIXUP2(f->scheme_first, gc); + gcFIXUP2(f->scheme_last, gc); + gcFIXUP2(f->prim_first, gc); + gcFIXUP2(f->prim_last, gc); + gcFIXUP2(f->ext_data, gc); return gcBYTES_TO_WORDS(sizeof(Finalizations)); @@ -4570,32 +4570,32 @@ static int mark_finalizations_FIXUP(void *p) { #ifdef MARKS_FOR_SEMA_C -static int mark_channel_syncer_SIZE(void *p) { +static int mark_channel_syncer_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Channel_Syncer)); } -static int mark_channel_syncer_MARK(void *p) { +static int mark_channel_syncer_MARK(void *p, struct NewGC *gc) { Scheme_Channel_Syncer *w = (Scheme_Channel_Syncer *)p; - gcMARK(w->p); - gcMARK(w->prev); - gcMARK(w->next); - gcMARK(w->syncing); - gcMARK(w->obj); + gcMARK2(w->p, gc); + gcMARK2(w->prev, gc); + gcMARK2(w->next, gc); + gcMARK2(w->syncing, gc); + gcMARK2(w->obj, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Channel_Syncer)); } -static int mark_channel_syncer_FIXUP(void *p) { +static int mark_channel_syncer_FIXUP(void *p, struct NewGC *gc) { Scheme_Channel_Syncer *w = (Scheme_Channel_Syncer *)p; - gcFIXUP(w->p); - gcFIXUP(w->prev); - gcFIXUP(w->next); - gcFIXUP(w->syncing); - gcFIXUP(w->obj); + gcFIXUP2(w->p, gc); + gcFIXUP2(w->prev, gc); + gcFIXUP2(w->next, gc); + gcFIXUP2(w->syncing, gc); + gcFIXUP2(w->obj, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Channel_Syncer)); @@ -4605,17 +4605,17 @@ static int mark_channel_syncer_FIXUP(void *p) { #define mark_channel_syncer_IS_CONST_SIZE 1 -static int mark_alarm_SIZE(void *p) { +static int mark_alarm_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Alarm)); } -static int mark_alarm_MARK(void *p) { +static int mark_alarm_MARK(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Alarm)); } -static int mark_alarm_FIXUP(void *p) { +static int mark_alarm_FIXUP(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Alarm)); } @@ -4630,7 +4630,7 @@ static int mark_alarm_FIXUP(void *p) { #ifdef MARKS_FOR_STRUCT_C -static int mark_struct_val_SIZE(void *p) { +static int mark_struct_val_SIZE(void *p, struct NewGC *gc) { Scheme_Structure *s = (Scheme_Structure *)p; int num_slots = ((Scheme_Struct_Type *)GC_resolve(s->stype))->num_slots; @@ -4639,32 +4639,32 @@ static int mark_struct_val_SIZE(void *p) { + ((num_slots - 1) * sizeof(Scheme_Object *)))); } -static int mark_struct_val_MARK(void *p) { +static int mark_struct_val_MARK(void *p, struct NewGC *gc) { Scheme_Structure *s = (Scheme_Structure *)p; int num_slots = ((Scheme_Struct_Type *)GC_resolve(s->stype))->num_slots; int i; - gcMARK( s->stype); + gcMARK2( s->stype, gc); for(i = num_slots; i--; ) - gcMARK(s->slots[i]); + gcMARK2(s->slots[i], gc); return gcBYTES_TO_WORDS((sizeof(Scheme_Structure) + ((num_slots - 1) * sizeof(Scheme_Object *)))); } -static int mark_struct_val_FIXUP(void *p) { +static int mark_struct_val_FIXUP(void *p, struct NewGC *gc) { Scheme_Structure *s = (Scheme_Structure *)p; int num_slots = ((Scheme_Struct_Type *)GC_resolve(s->stype))->num_slots; int i; - gcFIXUP_TYPED_NOW(Scheme_Struct_Type *, s->stype); + gcFIXUP2_TYPED_NOW(Scheme_Struct_Type *, s->stype, gc); for(i = num_slots; i--; ) - gcFIXUP(s->slots[i]); + gcFIXUP2(s->slots[i], gc); return gcBYTES_TO_WORDS((sizeof(Scheme_Structure) @@ -4675,7 +4675,7 @@ static int mark_struct_val_FIXUP(void *p) { #define mark_struct_val_IS_CONST_SIZE 0 -static int mark_struct_type_val_SIZE(void *p) { +static int mark_struct_type_val_SIZE(void *p, struct NewGC *gc) { Scheme_Struct_Type *t = (Scheme_Struct_Type *)p; return @@ -4683,46 +4683,46 @@ static int mark_struct_type_val_SIZE(void *p) { + (t->name_pos * sizeof(Scheme_Struct_Type *)))); } -static int mark_struct_type_val_MARK(void *p) { +static int mark_struct_type_val_MARK(void *p, struct NewGC *gc) { Scheme_Struct_Type *t = (Scheme_Struct_Type *)p; int i; for (i = t->name_pos + 1; i--; ) { - gcMARK(t->parent_types[i]); + gcMARK2(t->parent_types[i], gc); } - gcMARK(t->name); - gcMARK(t->inspector); - gcMARK(t->accessor); - gcMARK(t->mutator); - gcMARK(t->prefab_key); - gcMARK(t->uninit_val); - gcMARK(t->props); - gcMARK(t->proc_attr); - gcMARK(t->guard); - gcMARK(t->immutables); + gcMARK2(t->name, gc); + gcMARK2(t->inspector, gc); + gcMARK2(t->accessor, gc); + gcMARK2(t->mutator, gc); + gcMARK2(t->prefab_key, gc); + gcMARK2(t->uninit_val, gc); + gcMARK2(t->props, gc); + gcMARK2(t->proc_attr, gc); + gcMARK2(t->guard, gc); + gcMARK2(t->immutables, gc); return gcBYTES_TO_WORDS((sizeof(Scheme_Struct_Type) + (t->name_pos * sizeof(Scheme_Struct_Type *)))); } -static int mark_struct_type_val_FIXUP(void *p) { +static int mark_struct_type_val_FIXUP(void *p, struct NewGC *gc) { Scheme_Struct_Type *t = (Scheme_Struct_Type *)p; int i; for (i = t->name_pos + 1; i--; ) { - gcFIXUP(t->parent_types[i]); + gcFIXUP2(t->parent_types[i], gc); } - gcFIXUP(t->name); - gcFIXUP(t->inspector); - gcFIXUP(t->accessor); - gcFIXUP(t->mutator); - gcFIXUP(t->prefab_key); - gcFIXUP(t->uninit_val); - gcFIXUP(t->props); - gcFIXUP(t->proc_attr); - gcFIXUP(t->guard); - gcFIXUP(t->immutables); + gcFIXUP2(t->name, gc); + gcFIXUP2(t->inspector, gc); + gcFIXUP2(t->accessor, gc); + gcFIXUP2(t->mutator, gc); + gcFIXUP2(t->prefab_key, gc); + gcFIXUP2(t->uninit_val, gc); + gcFIXUP2(t->props, gc); + gcFIXUP2(t->proc_attr, gc); + gcFIXUP2(t->guard, gc); + gcFIXUP2(t->immutables, gc); return gcBYTES_TO_WORDS((sizeof(Scheme_Struct_Type) @@ -4733,26 +4733,26 @@ static int mark_struct_type_val_FIXUP(void *p) { #define mark_struct_type_val_IS_CONST_SIZE 0 -static int mark_struct_proc_info_SIZE(void *p) { +static int mark_struct_proc_info_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Struct_Proc_Info)); } -static int mark_struct_proc_info_MARK(void *p) { +static int mark_struct_proc_info_MARK(void *p, struct NewGC *gc) { Struct_Proc_Info *i = (Struct_Proc_Info *)p; - gcMARK(i->struct_type); - gcMARK(i->func_name); + gcMARK2(i->struct_type, gc); + gcMARK2(i->func_name, gc); return gcBYTES_TO_WORDS(sizeof(Struct_Proc_Info)); } -static int mark_struct_proc_info_FIXUP(void *p) { +static int mark_struct_proc_info_FIXUP(void *p, struct NewGC *gc) { Struct_Proc_Info *i = (Struct_Proc_Info *)p; - gcFIXUP(i->struct_type); - gcFIXUP(i->func_name); + gcFIXUP2(i->struct_type, gc); + gcFIXUP2(i->func_name, gc); return gcBYTES_TO_WORDS(sizeof(Struct_Proc_Info)); @@ -4762,25 +4762,25 @@ static int mark_struct_proc_info_FIXUP(void *p) { #define mark_struct_proc_info_IS_CONST_SIZE 1 -static int mark_struct_property_SIZE(void *p) { +static int mark_struct_property_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Struct_Property)); } -static int mark_struct_property_MARK(void *p) { +static int mark_struct_property_MARK(void *p, struct NewGC *gc) { Scheme_Struct_Property *i = (Scheme_Struct_Property *)p; - gcMARK(i->name); - gcMARK(i->guard); - gcMARK(i->supers); + gcMARK2(i->name, gc); + gcMARK2(i->guard, gc); + gcMARK2(i->supers, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Struct_Property)); } -static int mark_struct_property_FIXUP(void *p) { +static int mark_struct_property_FIXUP(void *p, struct NewGC *gc) { Scheme_Struct_Property *i = (Scheme_Struct_Property *)p; - gcFIXUP(i->name); - gcFIXUP(i->guard); - gcFIXUP(i->supers); + gcFIXUP2(i->name, gc); + gcFIXUP2(i->guard, gc); + gcFIXUP2(i->supers, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Struct_Property)); } @@ -4789,26 +4789,26 @@ static int mark_struct_property_FIXUP(void *p) { #define mark_struct_property_IS_CONST_SIZE 1 -static int mark_wrapped_evt_SIZE(void *p) { +static int mark_wrapped_evt_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Wrapped_Evt)); } -static int mark_wrapped_evt_MARK(void *p) { +static int mark_wrapped_evt_MARK(void *p, struct NewGC *gc) { Wrapped_Evt *ww = (Wrapped_Evt *)p; - gcMARK(ww->evt); - gcMARK(ww->wrapper); + gcMARK2(ww->evt, gc); + gcMARK2(ww->wrapper, gc); return gcBYTES_TO_WORDS(sizeof(Wrapped_Evt)); } -static int mark_wrapped_evt_FIXUP(void *p) { +static int mark_wrapped_evt_FIXUP(void *p, struct NewGC *gc) { Wrapped_Evt *ww = (Wrapped_Evt *)p; - gcFIXUP(ww->evt); - gcFIXUP(ww->wrapper); + gcFIXUP2(ww->evt, gc); + gcFIXUP2(ww->wrapper, gc); return gcBYTES_TO_WORDS(sizeof(Wrapped_Evt)); @@ -4818,24 +4818,24 @@ static int mark_wrapped_evt_FIXUP(void *p) { #define mark_wrapped_evt_IS_CONST_SIZE 1 -static int mark_nack_guard_evt_SIZE(void *p) { +static int mark_nack_guard_evt_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Nack_Guard_Evt)); } -static int mark_nack_guard_evt_MARK(void *p) { +static int mark_nack_guard_evt_MARK(void *p, struct NewGC *gc) { Nack_Guard_Evt *nw = (Nack_Guard_Evt *)p; - gcMARK(nw->maker); + gcMARK2(nw->maker, gc); return gcBYTES_TO_WORDS(sizeof(Nack_Guard_Evt)); } -static int mark_nack_guard_evt_FIXUP(void *p) { +static int mark_nack_guard_evt_FIXUP(void *p, struct NewGC *gc) { Nack_Guard_Evt *nw = (Nack_Guard_Evt *)p; - gcFIXUP(nw->maker); + gcFIXUP2(nw->maker, gc); return gcBYTES_TO_WORDS(sizeof(Nack_Guard_Evt)); @@ -4845,30 +4845,30 @@ static int mark_nack_guard_evt_FIXUP(void *p) { #define mark_nack_guard_evt_IS_CONST_SIZE 1 -static int mark_chaperone_SIZE(void *p) { +static int mark_chaperone_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Chaperone)); } -static int mark_chaperone_MARK(void *p) { +static int mark_chaperone_MARK(void *p, struct NewGC *gc) { Scheme_Chaperone *px = (Scheme_Chaperone *)p; - gcMARK(px->val); - gcMARK(px->prev); - gcMARK(px->props); - gcMARK(px->redirects); + gcMARK2(px->val, gc); + gcMARK2(px->prev, gc); + gcMARK2(px->props, gc); + gcMARK2(px->redirects, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Chaperone)); } -static int mark_chaperone_FIXUP(void *p) { +static int mark_chaperone_FIXUP(void *p, struct NewGC *gc) { Scheme_Chaperone *px = (Scheme_Chaperone *)p; - gcFIXUP(px->val); - gcFIXUP(px->prev); - gcFIXUP(px->props); - gcFIXUP(px->redirects); + gcFIXUP2(px->val, gc); + gcFIXUP2(px->prev, gc); + gcFIXUP2(px->props, gc); + gcFIXUP2(px->redirects, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Chaperone)); @@ -4890,17 +4890,17 @@ static int mark_chaperone_FIXUP(void *p) { #ifdef MARKS_FOR_READ_C -static int mark_indent_SIZE(void *p) { +static int mark_indent_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Indent)); } -static int mark_indent_MARK(void *p) { +static int mark_indent_MARK(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Indent)); } -static int mark_indent_FIXUP(void *p) { +static int mark_indent_FIXUP(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Indent)); } @@ -4909,41 +4909,41 @@ static int mark_indent_FIXUP(void *p) { #define mark_indent_IS_CONST_SIZE 1 -static int mark_cport_SIZE(void *p) { +static int mark_cport_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(CPort)); } -static int mark_cport_MARK(void *p) { +static int mark_cport_MARK(void *p, struct NewGC *gc) { CPort *cp = (CPort *)p; - gcMARK(cp->start); - gcMARK(cp->orig_port); - gcMARK(cp->ht); - gcMARK(cp->ut); - gcMARK(cp->symtab); - gcMARK(cp->insp); - gcMARK(cp->relto); - gcMARK(cp->magic_sym); - gcMARK(cp->magic_val); - gcMARK(cp->shared_offsets); - gcMARK(cp->delay_info); + gcMARK2(cp->start, gc); + gcMARK2(cp->orig_port, gc); + gcMARK2(cp->ht, gc); + gcMARK2(cp->ut, gc); + gcMARK2(cp->symtab, gc); + gcMARK2(cp->insp, gc); + gcMARK2(cp->relto, gc); + gcMARK2(cp->magic_sym, gc); + gcMARK2(cp->magic_val, gc); + gcMARK2(cp->shared_offsets, gc); + gcMARK2(cp->delay_info, gc); return gcBYTES_TO_WORDS(sizeof(CPort)); } -static int mark_cport_FIXUP(void *p) { +static int mark_cport_FIXUP(void *p, struct NewGC *gc) { CPort *cp = (CPort *)p; - gcFIXUP(cp->start); - gcFIXUP(cp->orig_port); - gcFIXUP(cp->ht); - gcFIXUP(cp->ut); - gcFIXUP(cp->symtab); - gcFIXUP(cp->insp); - gcFIXUP(cp->relto); - gcFIXUP(cp->magic_sym); - gcFIXUP(cp->magic_val); - gcFIXUP(cp->shared_offsets); - gcFIXUP(cp->delay_info); + gcFIXUP2(cp->start, gc); + gcFIXUP2(cp->orig_port, gc); + gcFIXUP2(cp->ht, gc); + gcFIXUP2(cp->ut, gc); + gcFIXUP2(cp->symtab, gc); + gcFIXUP2(cp->insp, gc); + gcFIXUP2(cp->relto, gc); + gcFIXUP2(cp->magic_sym, gc); + gcFIXUP2(cp->magic_val, gc); + gcFIXUP2(cp->shared_offsets, gc); + gcFIXUP2(cp->delay_info, gc); return gcBYTES_TO_WORDS(sizeof(CPort)); } @@ -4952,27 +4952,27 @@ static int mark_cport_FIXUP(void *p) { #define mark_cport_IS_CONST_SIZE 1 -static int mark_readtable_SIZE(void *p) { +static int mark_readtable_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Readtable)); } -static int mark_readtable_MARK(void *p) { +static int mark_readtable_MARK(void *p, struct NewGC *gc) { Readtable *t = (Readtable *)p; - gcMARK(t->mapping); - gcMARK(t->fast_mapping); - gcMARK(t->symbol_parser); - gcMARK(t->names); + gcMARK2(t->mapping, gc); + gcMARK2(t->fast_mapping, gc); + gcMARK2(t->symbol_parser, gc); + gcMARK2(t->names, gc); return gcBYTES_TO_WORDS(sizeof(Readtable)); } -static int mark_readtable_FIXUP(void *p) { +static int mark_readtable_FIXUP(void *p, struct NewGC *gc) { Readtable *t = (Readtable *)p; - gcFIXUP(t->mapping); - gcFIXUP(t->fast_mapping); - gcFIXUP(t->symbol_parser); - gcFIXUP(t->names); + gcFIXUP2(t->mapping, gc); + gcFIXUP2(t->fast_mapping, gc); + gcFIXUP2(t->symbol_parser, gc); + gcFIXUP2(t->names, gc); return gcBYTES_TO_WORDS(sizeof(Readtable)); } @@ -4981,27 +4981,27 @@ static int mark_readtable_FIXUP(void *p) { #define mark_readtable_IS_CONST_SIZE 1 -static int mark_read_params_SIZE(void *p) { +static int mark_read_params_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(ReadParams)); } -static int mark_read_params_MARK(void *p) { +static int mark_read_params_MARK(void *p, struct NewGC *gc) { ReadParams *rp = (ReadParams *)p; - gcMARK(rp->table); - gcMARK(rp->magic_sym); - gcMARK(rp->magic_val); - gcMARK(rp->delay_load_info); + gcMARK2(rp->table, gc); + gcMARK2(rp->magic_sym, gc); + gcMARK2(rp->magic_val, gc); + gcMARK2(rp->delay_load_info, gc); return gcBYTES_TO_WORDS(sizeof(ReadParams)); } -static int mark_read_params_FIXUP(void *p) { +static int mark_read_params_FIXUP(void *p, struct NewGC *gc) { ReadParams *rp = (ReadParams *)p; - gcFIXUP(rp->table); - gcFIXUP(rp->magic_sym); - gcFIXUP(rp->magic_val); - gcFIXUP(rp->delay_load_info); + gcFIXUP2(rp->table, gc); + gcFIXUP2(rp->magic_sym, gc); + gcFIXUP2(rp->magic_val, gc); + gcFIXUP2(rp->delay_load_info, gc); return gcBYTES_TO_WORDS(sizeof(ReadParams)); } @@ -5010,37 +5010,37 @@ static int mark_read_params_FIXUP(void *p) { #define mark_read_params_IS_CONST_SIZE 1 -static int mark_delay_load_SIZE(void *p) { +static int mark_delay_load_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Load_Delay)); } -static int mark_delay_load_MARK(void *p) { +static int mark_delay_load_MARK(void *p, struct NewGC *gc) { Scheme_Load_Delay *ld = (Scheme_Load_Delay *)p; - gcMARK(ld->path); - gcMARK(ld->symtab); - gcMARK(ld->shared_offsets); - gcMARK(ld->insp); - gcMARK(ld->relto); - gcMARK(ld->ut); - gcMARK(ld->current_rp); - gcMARK(ld->cached); - gcMARK(ld->cached_port); + gcMARK2(ld->path, gc); + gcMARK2(ld->symtab, gc); + gcMARK2(ld->shared_offsets, gc); + gcMARK2(ld->insp, gc); + gcMARK2(ld->relto, gc); + gcMARK2(ld->ut, gc); + gcMARK2(ld->current_rp, gc); + gcMARK2(ld->cached, gc); + gcMARK2(ld->cached_port, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Load_Delay)); } -static int mark_delay_load_FIXUP(void *p) { +static int mark_delay_load_FIXUP(void *p, struct NewGC *gc) { Scheme_Load_Delay *ld = (Scheme_Load_Delay *)p; - gcFIXUP(ld->path); - gcFIXUP(ld->symtab); - gcFIXUP(ld->shared_offsets); - gcFIXUP(ld->insp); - gcFIXUP(ld->relto); - gcFIXUP(ld->ut); - gcFIXUP(ld->current_rp); - gcFIXUP(ld->cached); - gcFIXUP(ld->cached_port); + gcFIXUP2(ld->path, gc); + gcFIXUP2(ld->symtab, gc); + gcFIXUP2(ld->shared_offsets, gc); + gcFIXUP2(ld->insp, gc); + gcFIXUP2(ld->relto, gc); + gcFIXUP2(ld->ut, gc); + gcFIXUP2(ld->current_rp, gc); + gcFIXUP2(ld->cached, gc); + gcFIXUP2(ld->cached_port, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Load_Delay)); } @@ -5049,25 +5049,25 @@ static int mark_delay_load_FIXUP(void *p) { #define mark_delay_load_IS_CONST_SIZE 1 -static int mark_unmarshal_tables_SIZE(void *p) { +static int mark_unmarshal_tables_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Unmarshal_Tables)); } -static int mark_unmarshal_tables_MARK(void *p) { +static int mark_unmarshal_tables_MARK(void *p, struct NewGC *gc) { Scheme_Unmarshal_Tables *ut = (Scheme_Unmarshal_Tables *)p; - gcMARK(ut->rns); - gcMARK(ut->rp); - gcMARK(ut->decoded); + gcMARK2(ut->rns, gc); + gcMARK2(ut->rp, gc); + gcMARK2(ut->decoded, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Unmarshal_Tables)); } -static int mark_unmarshal_tables_FIXUP(void *p) { +static int mark_unmarshal_tables_FIXUP(void *p, struct NewGC *gc) { Scheme_Unmarshal_Tables *ut = (Scheme_Unmarshal_Tables *)p; - gcFIXUP(ut->rns); - gcFIXUP(ut->rp); - gcFIXUP(ut->decoded); + gcFIXUP2(ut->rns, gc); + gcFIXUP2(ut->rp, gc); + gcFIXUP2(ut->decoded, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Unmarshal_Tables)); } @@ -5082,24 +5082,24 @@ static int mark_unmarshal_tables_FIXUP(void *p) { #ifdef MARKS_FOR_REGEXP_C -static int mark_regexp_SIZE(void *p) { +static int mark_regexp_SIZE(void *p, struct NewGC *gc) { regexp *r = (regexp *)p; return gcBYTES_TO_WORDS((sizeof(regexp) + r->regsize)); } -static int mark_regexp_MARK(void *p) { +static int mark_regexp_MARK(void *p, struct NewGC *gc) { regexp *r = (regexp *)p; - gcMARK(r->source); - gcMARK(r->regstart); + gcMARK2(r->source, gc); + gcMARK2(r->regstart, gc); return gcBYTES_TO_WORDS((sizeof(regexp) + r->regsize)); } -static int mark_regexp_FIXUP(void *p) { +static int mark_regexp_FIXUP(void *p, struct NewGC *gc) { regexp *r = (regexp *)p; - gcFIXUP(r->source); - gcFIXUP(r->regstart); + gcFIXUP2(r->source, gc); + gcFIXUP2(r->regstart, gc); return gcBYTES_TO_WORDS((sizeof(regexp) + r->regsize)); } @@ -5108,37 +5108,37 @@ static int mark_regexp_FIXUP(void *p) { #define mark_regexp_IS_CONST_SIZE 0 -static int mark_regwork_SIZE(void *p) { +static int mark_regwork_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Regwork)); } -static int mark_regwork_MARK(void *p) { +static int mark_regwork_MARK(void *p, struct NewGC *gc) { Regwork *r = (Regwork *)p; - gcMARK(r->str); - gcMARK(r->instr); - gcMARK(r->port); - gcMARK(r->unless_evt); - gcMARK(r->startp); - gcMARK(r->maybep); - gcMARK(r->endp); - gcMARK(r->counters); - gcMARK(r->peekskip); + gcMARK2(r->str, gc); + gcMARK2(r->instr, gc); + gcMARK2(r->port, gc); + gcMARK2(r->unless_evt, gc); + gcMARK2(r->startp, gc); + gcMARK2(r->maybep, gc); + gcMARK2(r->endp, gc); + gcMARK2(r->counters, gc); + gcMARK2(r->peekskip, gc); return gcBYTES_TO_WORDS(sizeof(Regwork)); } -static int mark_regwork_FIXUP(void *p) { +static int mark_regwork_FIXUP(void *p, struct NewGC *gc) { Regwork *r = (Regwork *)p; - gcFIXUP(r->str); - gcFIXUP(r->instr); - gcFIXUP(r->port); - gcFIXUP(r->unless_evt); - gcFIXUP(r->startp); - gcFIXUP(r->maybep); - gcFIXUP(r->endp); - gcFIXUP(r->counters); - gcFIXUP(r->peekskip); + gcFIXUP2(r->str, gc); + gcFIXUP2(r->instr, gc); + gcFIXUP2(r->port, gc); + gcFIXUP2(r->unless_evt, gc); + gcFIXUP2(r->startp, gc); + gcFIXUP2(r->maybep, gc); + gcFIXUP2(r->endp, gc); + gcFIXUP2(r->counters, gc); + gcFIXUP2(r->peekskip, gc); return gcBYTES_TO_WORDS(sizeof(Regwork)); } @@ -5153,21 +5153,21 @@ static int mark_regwork_FIXUP(void *p) { #ifdef MARKS_FOR_STRING_C -static int mark_string_convert_SIZE(void *p) { +static int mark_string_convert_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Converter)); } -static int mark_string_convert_MARK(void *p) { +static int mark_string_convert_MARK(void *p, struct NewGC *gc) { Scheme_Converter *c = (Scheme_Converter *)p; - gcMARK(c->mref); + gcMARK2(c->mref, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Converter)); } -static int mark_string_convert_FIXUP(void *p) { +static int mark_string_convert_FIXUP(void *p, struct NewGC *gc) { Scheme_Converter *c = (Scheme_Converter *)p; - gcFIXUP(c->mref); + gcFIXUP2(c->mref, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Converter)); } @@ -5182,35 +5182,35 @@ static int mark_string_convert_FIXUP(void *p) { #ifdef MARKS_FOR_STXOBJ_C -static int mark_rename_table_SIZE(void *p) { +static int mark_rename_table_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Module_Renames)); } -static int mark_rename_table_MARK(void *p) { +static int mark_rename_table_MARK(void *p, struct NewGC *gc) { Module_Renames *rn = (Module_Renames *)p; - gcMARK(rn->phase); - gcMARK(rn->ht); - gcMARK(rn->nomarshal_ht); - gcMARK(rn->unmarshal_info); - gcMARK(rn->shared_pes); - gcMARK(rn->set_identity); - gcMARK(rn->marked_names); - gcMARK(rn->free_id_renames); + gcMARK2(rn->phase, gc); + gcMARK2(rn->ht, gc); + gcMARK2(rn->nomarshal_ht, gc); + gcMARK2(rn->unmarshal_info, gc); + gcMARK2(rn->shared_pes, gc); + gcMARK2(rn->set_identity, gc); + gcMARK2(rn->marked_names, gc); + gcMARK2(rn->free_id_renames, gc); return gcBYTES_TO_WORDS(sizeof(Module_Renames)); } -static int mark_rename_table_FIXUP(void *p) { +static int mark_rename_table_FIXUP(void *p, struct NewGC *gc) { Module_Renames *rn = (Module_Renames *)p; - gcFIXUP(rn->phase); - gcFIXUP(rn->ht); - gcFIXUP(rn->nomarshal_ht); - gcFIXUP(rn->unmarshal_info); - gcFIXUP(rn->shared_pes); - gcFIXUP(rn->set_identity); - gcFIXUP(rn->marked_names); - gcFIXUP(rn->free_id_renames); + gcFIXUP2(rn->phase, gc); + gcFIXUP2(rn->ht, gc); + gcFIXUP2(rn->nomarshal_ht, gc); + gcFIXUP2(rn->unmarshal_info, gc); + gcFIXUP2(rn->shared_pes, gc); + gcFIXUP2(rn->set_identity, gc); + gcFIXUP2(rn->marked_names, gc); + gcFIXUP2(rn->free_id_renames, gc); return gcBYTES_TO_WORDS(sizeof(Module_Renames)); } @@ -5219,29 +5219,29 @@ static int mark_rename_table_FIXUP(void *p) { #define mark_rename_table_IS_CONST_SIZE 1 -static int mark_rename_table_set_SIZE(void *p) { +static int mark_rename_table_set_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Module_Renames_Set)); } -static int mark_rename_table_set_MARK(void *p) { +static int mark_rename_table_set_MARK(void *p, struct NewGC *gc) { Module_Renames_Set *rns = (Module_Renames_Set *)p; - gcMARK(rns->et); - gcMARK(rns->rt); - gcMARK(rns->other_phases); - gcMARK(rns->share_marked_names); - gcMARK(rns->set_identity); + gcMARK2(rns->et, gc); + gcMARK2(rns->rt, gc); + gcMARK2(rns->other_phases, gc); + gcMARK2(rns->share_marked_names, gc); + gcMARK2(rns->set_identity, gc); return gcBYTES_TO_WORDS(sizeof(Module_Renames_Set)); } -static int mark_rename_table_set_FIXUP(void *p) { +static int mark_rename_table_set_FIXUP(void *p, struct NewGC *gc) { Module_Renames_Set *rns = (Module_Renames_Set *)p; - gcFIXUP(rns->et); - gcFIXUP(rns->rt); - gcFIXUP(rns->other_phases); - gcFIXUP(rns->share_marked_names); - gcFIXUP(rns->set_identity); + gcFIXUP2(rns->et, gc); + gcFIXUP2(rns->rt, gc); + gcFIXUP2(rns->other_phases, gc); + gcFIXUP2(rns->share_marked_names, gc); + gcFIXUP2(rns->set_identity, gc); return gcBYTES_TO_WORDS(sizeof(Module_Renames_Set)); } @@ -5250,21 +5250,21 @@ static int mark_rename_table_set_FIXUP(void *p) { #define mark_rename_table_set_IS_CONST_SIZE 1 -static int mark_srcloc_SIZE(void *p) { +static int mark_srcloc_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Stx_Srcloc)); } -static int mark_srcloc_MARK(void *p) { +static int mark_srcloc_MARK(void *p, struct NewGC *gc) { Scheme_Stx_Srcloc *s = (Scheme_Stx_Srcloc *)p; - gcMARK(s->src); + gcMARK2(s->src, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Stx_Srcloc)); } -static int mark_srcloc_FIXUP(void *p) { +static int mark_srcloc_FIXUP(void *p, struct NewGC *gc) { Scheme_Stx_Srcloc *s = (Scheme_Stx_Srcloc *)p; - gcFIXUP(s->src); + gcFIXUP2(s->src, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Stx_Srcloc)); } @@ -5273,27 +5273,27 @@ static int mark_srcloc_FIXUP(void *p) { #define mark_srcloc_IS_CONST_SIZE 1 -static int mark_wrapchunk_SIZE(void *p) { +static int mark_wrapchunk_SIZE(void *p, struct NewGC *gc) { Wrap_Chunk *wc = (Wrap_Chunk *)p; return gcBYTES_TO_WORDS(sizeof(Wrap_Chunk) + ((wc->len - 1) * sizeof(Scheme_Object *))); } -static int mark_wrapchunk_MARK(void *p) { +static int mark_wrapchunk_MARK(void *p, struct NewGC *gc) { Wrap_Chunk *wc = (Wrap_Chunk *)p; int i; for (i = wc->len; i--; ) { - gcMARK(wc->a[i]); + gcMARK2(wc->a[i], gc); } return gcBYTES_TO_WORDS(sizeof(Wrap_Chunk) + ((wc->len - 1) * sizeof(Scheme_Object *))); } -static int mark_wrapchunk_FIXUP(void *p) { +static int mark_wrapchunk_FIXUP(void *p, struct NewGC *gc) { Wrap_Chunk *wc = (Wrap_Chunk *)p; int i; for (i = wc->len; i--; ) { - gcFIXUP(wc->a[i]); + gcFIXUP2(wc->a[i], gc); } return gcBYTES_TO_WORDS(sizeof(Wrap_Chunk) + ((wc->len - 1) * sizeof(Scheme_Object *))); @@ -5303,31 +5303,31 @@ static int mark_wrapchunk_FIXUP(void *p) { #define mark_wrapchunk_IS_CONST_SIZE 0 -static int mark_cert_SIZE(void *p) { +static int mark_cert_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Cert)); } -static int mark_cert_MARK(void *p) { +static int mark_cert_MARK(void *p, struct NewGC *gc) { Scheme_Cert *c = (Scheme_Cert *)p; - gcMARK(c->mark); - gcMARK(c->modidx); - gcMARK(c->insp); - gcMARK(c->key); - gcMARK(c->mapped); - gcMARK(c->next); + gcMARK2(c->mark, gc); + gcMARK2(c->modidx, gc); + gcMARK2(c->insp, gc); + gcMARK2(c->key, gc); + gcMARK2(c->mapped, gc); + gcMARK2(c->next, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Cert)); } -static int mark_cert_FIXUP(void *p) { +static int mark_cert_FIXUP(void *p, struct NewGC *gc) { Scheme_Cert *c = (Scheme_Cert *)p; - gcFIXUP(c->mark); - gcFIXUP(c->modidx); - gcFIXUP(c->insp); - gcFIXUP(c->key); - gcFIXUP(c->mapped); - gcFIXUP(c->next); + gcFIXUP2(c->mark, gc); + gcFIXUP2(c->modidx, gc); + gcFIXUP2(c->insp, gc); + gcFIXUP2(c->key, gc); + gcFIXUP2(c->mapped, gc); + gcFIXUP2(c->next, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Cert)); } @@ -5336,29 +5336,29 @@ static int mark_cert_FIXUP(void *p) { #define mark_cert_IS_CONST_SIZE 1 -static int lex_rib_SIZE(void *p) { +static int lex_rib_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Lexical_Rib)); } -static int lex_rib_MARK(void *p) { +static int lex_rib_MARK(void *p, struct NewGC *gc) { Scheme_Lexical_Rib *rib = (Scheme_Lexical_Rib *)p; - gcMARK(rib->rename); - gcMARK(rib->timestamp); - gcMARK(rib->sealed); - gcMARK(rib->mapped_names); - gcMARK(rib->next); + gcMARK2(rib->rename, gc); + gcMARK2(rib->timestamp, gc); + gcMARK2(rib->sealed, gc); + gcMARK2(rib->mapped_names, gc); + gcMARK2(rib->next, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Lexical_Rib)); } -static int lex_rib_FIXUP(void *p) { +static int lex_rib_FIXUP(void *p, struct NewGC *gc) { Scheme_Lexical_Rib *rib = (Scheme_Lexical_Rib *)p; - gcFIXUP(rib->rename); - gcFIXUP(rib->timestamp); - gcFIXUP(rib->sealed); - gcFIXUP(rib->mapped_names); - gcFIXUP(rib->next); + gcFIXUP2(rib->rename, gc); + gcFIXUP2(rib->timestamp, gc); + gcFIXUP2(rib->sealed, gc); + gcFIXUP2(rib->mapped_names, gc); + gcFIXUP2(rib->next, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Lexical_Rib)); } @@ -5367,28 +5367,28 @@ static int lex_rib_FIXUP(void *p) { #define lex_rib_IS_CONST_SIZE 1 -static int mark_free_id_info_SIZE(void *p) { +static int mark_free_id_info_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS((sizeof(Scheme_Vector) + ((8 - 1) * sizeof(Scheme_Object *)))); } -static int mark_free_id_info_MARK(void *p) { +static int mark_free_id_info_MARK(void *p, struct NewGC *gc) { Scheme_Vector *vec = (Scheme_Vector *)p; int i; for (i = 8; i--; ) - gcMARK(vec->els[i]); + gcMARK2(vec->els[i], gc); return gcBYTES_TO_WORDS((sizeof(Scheme_Vector) + ((8 - 1) * sizeof(Scheme_Object *)))); } -static int mark_free_id_info_FIXUP(void *p) { +static int mark_free_id_info_FIXUP(void *p, struct NewGC *gc) { Scheme_Vector *vec = (Scheme_Vector *)p; int i; for (i = 8; i--; ) - gcFIXUP(vec->els[i]); + gcFIXUP2(vec->els[i], gc); return gcBYTES_TO_WORDS((sizeof(Scheme_Vector) @@ -5407,7 +5407,7 @@ static int mark_free_id_info_FIXUP(void *p) { #ifdef MARKS_FOR_JIT_C -static int native_closure_SIZE(void *p) { +static int native_closure_SIZE(void *p, struct NewGC *gc) { Scheme_Native_Closure *c = (Scheme_Native_Closure *)p; int closure_size = ((Scheme_Native_Closure_Data *)GC_resolve(c->code))->closure_size; @@ -5420,7 +5420,7 @@ static int native_closure_SIZE(void *p) { + (closure_size - 1) * sizeof(Scheme_Object *))); } -static int native_closure_MARK(void *p) { +static int native_closure_MARK(void *p, struct NewGC *gc) { Scheme_Native_Closure *c = (Scheme_Native_Closure *)p; int closure_size = ((Scheme_Native_Closure_Data *)GC_resolve(c->code))->closure_size; @@ -5432,16 +5432,16 @@ static int native_closure_MARK(void *p) { { int i = closure_size; while (i--) - gcMARK(c->vals[i]); + gcMARK2(c->vals[i], gc); } - gcMARK(c->code); + gcMARK2(c->code, gc); return gcBYTES_TO_WORDS((sizeof(Scheme_Native_Closure) + (closure_size - 1) * sizeof(Scheme_Object *))); } -static int native_closure_FIXUP(void *p) { +static int native_closure_FIXUP(void *p, struct NewGC *gc) { Scheme_Native_Closure *c = (Scheme_Native_Closure *)p; int closure_size = ((Scheme_Native_Closure_Data *)GC_resolve(c->code))->closure_size; @@ -5453,9 +5453,9 @@ static int native_closure_FIXUP(void *p) { { int i = closure_size; while (i--) - gcFIXUP(c->vals[i]); + gcFIXUP2(c->vals[i], gc); } - gcFIXUP(c->code); + gcFIXUP2(c->code, gc); return gcBYTES_TO_WORDS((sizeof(Scheme_Native_Closure) @@ -5466,23 +5466,23 @@ static int native_closure_FIXUP(void *p) { #define native_closure_IS_CONST_SIZE 0 -static int mark_jit_state_SIZE(void *p) { +static int mark_jit_state_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(mz_jit_state)); } -static int mark_jit_state_MARK(void *p) { +static int mark_jit_state_MARK(void *p, struct NewGC *gc) { mz_jit_state *j = (mz_jit_state *)p; - gcMARK(j->mappings); - gcMARK(j->self_data); + gcMARK2(j->mappings, gc); + gcMARK2(j->self_data, gc); return gcBYTES_TO_WORDS(sizeof(mz_jit_state)); } -static int mark_jit_state_FIXUP(void *p) { +static int mark_jit_state_FIXUP(void *p, struct NewGC *gc) { mz_jit_state *j = (mz_jit_state *)p; - gcFIXUP(j->mappings); - gcFIXUP(j->self_data); + gcFIXUP2(j->mappings, gc); + gcFIXUP2(j->self_data, gc); return gcBYTES_TO_WORDS(sizeof(mz_jit_state)); } @@ -5491,41 +5491,41 @@ static int mark_jit_state_FIXUP(void *p) { #define mark_jit_state_IS_CONST_SIZE 1 -static int native_unclosed_proc_SIZE(void *p) { +static int native_unclosed_proc_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Native_Closure_Data)); } -static int native_unclosed_proc_MARK(void *p) { +static int native_unclosed_proc_MARK(void *p, struct NewGC *gc) { Scheme_Native_Closure_Data *d = (Scheme_Native_Closure_Data *)p; int i; - gcMARK(d->u2.name); + gcMARK2(d->u2.name, gc); if (d->retained) { for (i = SCHEME_INT_VAL(d->retained[0]); i--; ) { - gcMARK(d->retained[i]); + gcMARK2(d->retained[i], gc); } } if (d->closure_size < 0) { - gcMARK(d->u.arities); + gcMARK2(d->u.arities, gc); } return gcBYTES_TO_WORDS(sizeof(Scheme_Native_Closure_Data)); } -static int native_unclosed_proc_FIXUP(void *p) { +static int native_unclosed_proc_FIXUP(void *p, struct NewGC *gc) { Scheme_Native_Closure_Data *d = (Scheme_Native_Closure_Data *)p; int i; - gcFIXUP(d->u2.name); + gcFIXUP2(d->u2.name, gc); if (d->retained) { for (i = SCHEME_INT_VAL(d->retained[0]); i--; ) { - gcFIXUP(d->retained[i]); + gcFIXUP2(d->retained[i], gc); } } if (d->closure_size < 0) { - gcFIXUP(d->u.arities); + gcFIXUP2(d->u.arities, gc); } return @@ -5536,26 +5536,26 @@ static int native_unclosed_proc_FIXUP(void *p) { #define native_unclosed_proc_IS_CONST_SIZE 1 -static int native_unclosed_proc_plus_case_SIZE(void *p) { +static int native_unclosed_proc_plus_case_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(Scheme_Native_Closure_Data_Plus_Case)); } -static int native_unclosed_proc_plus_case_MARK(void *p) { +static int native_unclosed_proc_plus_case_MARK(void *p, struct NewGC *gc) { Scheme_Native_Closure_Data_Plus_Case *d = (Scheme_Native_Closure_Data_Plus_Case *)p; - native_unclosed_proc_MARK(p); - gcMARK(d->case_lam); + native_unclosed_proc_MARK(p, gc); + gcMARK2(d->case_lam, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Native_Closure_Data_Plus_Case)); } -static int native_unclosed_proc_plus_case_FIXUP(void *p) { +static int native_unclosed_proc_plus_case_FIXUP(void *p, struct NewGC *gc) { Scheme_Native_Closure_Data_Plus_Case *d = (Scheme_Native_Closure_Data_Plus_Case *)p; - native_unclosed_proc_FIXUP(p); - gcFIXUP(d->case_lam); + native_unclosed_proc_FIXUP(p, gc); + gcFIXUP2(d->case_lam, gc); return gcBYTES_TO_WORDS(sizeof(Scheme_Native_Closure_Data_Plus_Case)); @@ -5573,53 +5573,53 @@ static int native_unclosed_proc_plus_case_FIXUP(void *p) { #ifdef MZ_USE_FUTURES -static int future_SIZE(void *p) { +static int future_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(future_t)); } -static int future_MARK(void *p) { +static int future_MARK(void *p, struct NewGC *gc) { future_t *f = (future_t *)p; - gcMARK(f->orig_lambda); - gcMARK(f->arg_s0); - gcMARK(f->arg_S0); - gcMARK(f->arg_b0); - gcMARK(f->arg_n0); - gcMARK(f->arg_s1); - gcMARK(f->arg_S1); - gcMARK(f->arg_s2); - gcMARK(f->arg_S2); - gcMARK(f->retval_s); - gcMARK(f->retval); - gcMARK(f->multiple_array); - gcMARK(f->tail_rator); - gcMARK(f->tail_rands); - gcMARK(f->prev); - gcMARK(f->next); - gcMARK(f->next_waiting_atomic); + gcMARK2(f->orig_lambda, gc); + gcMARK2(f->arg_s0, gc); + gcMARK2(f->arg_S0, gc); + gcMARK2(f->arg_b0, gc); + gcMARK2(f->arg_n0, gc); + gcMARK2(f->arg_s1, gc); + gcMARK2(f->arg_S1, gc); + gcMARK2(f->arg_s2, gc); + gcMARK2(f->arg_S2, gc); + gcMARK2(f->retval_s, gc); + gcMARK2(f->retval, gc); + gcMARK2(f->multiple_array, gc); + gcMARK2(f->tail_rator, gc); + gcMARK2(f->tail_rands, gc); + gcMARK2(f->prev, gc); + gcMARK2(f->next, gc); + gcMARK2(f->next_waiting_atomic, gc); return gcBYTES_TO_WORDS(sizeof(future_t)); } -static int future_FIXUP(void *p) { +static int future_FIXUP(void *p, struct NewGC *gc) { future_t *f = (future_t *)p; - gcFIXUP(f->orig_lambda); - gcFIXUP(f->arg_s0); - gcFIXUP(f->arg_S0); - gcFIXUP(f->arg_b0); - gcFIXUP(f->arg_n0); - gcFIXUP(f->arg_s1); - gcFIXUP(f->arg_S1); - gcFIXUP(f->arg_s2); - gcFIXUP(f->arg_S2); - gcFIXUP(f->retval_s); - gcFIXUP(f->retval); - gcFIXUP(f->multiple_array); - gcFIXUP(f->tail_rator); - gcFIXUP(f->tail_rands); - gcFIXUP(f->prev); - gcFIXUP(f->next); - gcFIXUP(f->next_waiting_atomic); + gcFIXUP2(f->orig_lambda, gc); + gcFIXUP2(f->arg_s0, gc); + gcFIXUP2(f->arg_S0, gc); + gcFIXUP2(f->arg_b0, gc); + gcFIXUP2(f->arg_n0, gc); + gcFIXUP2(f->arg_s1, gc); + gcFIXUP2(f->arg_S1, gc); + gcFIXUP2(f->arg_s2, gc); + gcFIXUP2(f->arg_S2, gc); + gcFIXUP2(f->retval_s, gc); + gcFIXUP2(f->retval, gc); + gcFIXUP2(f->multiple_array, gc); + gcFIXUP2(f->tail_rator, gc); + gcFIXUP2(f->tail_rands, gc); + gcFIXUP2(f->prev, gc); + gcFIXUP2(f->next, gc); + gcFIXUP2(f->next_waiting_atomic, gc); return gcBYTES_TO_WORDS(sizeof(future_t)); } @@ -5630,27 +5630,27 @@ static int future_FIXUP(void *p) { #else -static int sequential_future_SIZE(void *p) { +static int sequential_future_SIZE(void *p, struct NewGC *gc) { return gcBYTES_TO_WORDS(sizeof(future_t)); } -static int sequential_future_MARK(void *p) { +static int sequential_future_MARK(void *p, struct NewGC *gc) { future_t *f = (future_t *)p; - gcMARK(f->orig_lambda); - gcMARK(f->running_sema); - gcMARK(f->retval); - gcMARK(f->multiple_array); + gcMARK2(f->orig_lambda, gc); + gcMARK2(f->running_sema, gc); + gcMARK2(f->retval, gc); + gcMARK2(f->multiple_array, gc); return gcBYTES_TO_WORDS(sizeof(future_t)); } -static int sequential_future_FIXUP(void *p) { +static int sequential_future_FIXUP(void *p, struct NewGC *gc) { future_t *f = (future_t *)p; - gcFIXUP(f->orig_lambda); - gcFIXUP(f->running_sema); - gcFIXUP(f->retval); - gcFIXUP(f->multiple_array); + gcFIXUP2(f->orig_lambda, gc); + gcFIXUP2(f->running_sema, gc); + gcFIXUP2(f->retval, gc); + gcFIXUP2(f->multiple_array, gc); return gcBYTES_TO_WORDS(sizeof(future_t)); } @@ -5665,4 +5665,4 @@ static int sequential_future_FIXUP(void *p) { /**********************************************************************/ -#define GC_REG_TRAV(type, base) GC_register_traversers(type, base ## _SIZE, base ## _MARK, base ## _FIXUP, base ## _IS_CONST_SIZE, base ## _IS_ATOMIC) +#define GC_REG_TRAV(type, base) GC_register_traversers2(type, base ## _SIZE, base ## _MARK, base ## _FIXUP, base ## _IS_CONST_SIZE, base ## _IS_ATOMIC) diff --git a/src/mzscheme/src/mzmarksrc.c b/src/mzscheme/src/mzmarksrc.c index 6541904fa2..e7a2538c15 100644 --- a/src/mzscheme/src/mzmarksrc.c +++ b/src/mzscheme/src/mzmarksrc.c @@ -5,9 +5,9 @@ variable_obj { mark: Scheme_Bucket *b = (Scheme_Bucket *)p; - gcMARK(b->key); - gcMARK(b->val); - gcMARK(((Scheme_Bucket_With_Home *)b)->home); + gcMARK2(b->key, gc); + gcMARK2(b->val, gc); + gcMARK2(((Scheme_Bucket_With_Home *)b)->home, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Bucket_With_Home)); @@ -17,9 +17,9 @@ module_var { mark: Module_Variable *mv = (Module_Variable *)p; - gcMARK(mv->modidx); - gcMARK(mv->sym); - gcMARK(mv->insp); + gcMARK2(mv->modidx, gc); + gcMARK2(mv->sym, gc); + gcMARK2(mv->insp, gc); size: gcBYTES_TO_WORDS(sizeof(Module_Variable)); @@ -29,8 +29,8 @@ bucket_obj { mark: Scheme_Bucket *b = (Scheme_Bucket *)p; - gcMARK(b->key); - gcMARK(b->val); + gcMARK2(b->key, gc); + gcMARK2(b->val, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Bucket)); @@ -57,9 +57,9 @@ quotesyntax_obj { cpointer_obj { mark: if (!(SCHEME_CPTR_FLAGS(p) & 0x1)) { - gcMARK(SCHEME_CPTR_VAL(p)); + gcMARK2(SCHEME_CPTR_VAL(p), gc); } - gcMARK(SCHEME_CPTR_TYPE(p)); + gcMARK2(SCHEME_CPTR_TYPE(p), gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Cptr)); } @@ -67,31 +67,31 @@ cpointer_obj { offset_cpointer_obj { mark: if (!(SCHEME_CPTR_FLAGS(p) & 0x1)) { - gcMARK(SCHEME_CPTR_VAL(p)); + gcMARK2(SCHEME_CPTR_VAL(p), gc); } - gcMARK(SCHEME_CPTR_TYPE(p)); + gcMARK2(SCHEME_CPTR_TYPE(p), gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Offset_Cptr)); } twoptr_obj { mark: - gcMARK(SCHEME_PTR1_VAL((Scheme_Object *)p)); - gcMARK(SCHEME_PTR2_VAL((Scheme_Object *)p)); + gcMARK2(SCHEME_PTR1_VAL((Scheme_Object *)p), gc); + gcMARK2(SCHEME_PTR2_VAL((Scheme_Object *)p), gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Simple_Object)); } iptr_obj { mark: - gcMARK(SCHEME_IPTR_VAL((Scheme_Object *)p)); + gcMARK2(SCHEME_IPTR_VAL((Scheme_Object *)p), gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Simple_Object)); } small_object { mark: - gcMARK(((Scheme_Small_Object *)p)->u.ptr_value); + gcMARK2(((Scheme_Small_Object *)p)->u.ptr_value, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Small_Object)); @@ -103,7 +103,7 @@ app_rec { mark: int i = r->num_args + 1; while (i--) - gcMARK(r->args[i]); + gcMARK2(r->args[i], gc); size: gcBYTES_TO_WORDS((sizeof(Scheme_App_Rec) @@ -114,8 +114,8 @@ app_rec { app2_rec { mark: Scheme_App2_Rec *r = (Scheme_App2_Rec *)p; - gcMARK(r->rator); - gcMARK(r->rand); + gcMARK2(r->rator, gc); + gcMARK2(r->rand, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_App2_Rec)); @@ -124,9 +124,9 @@ app2_rec { app3_rec { mark: Scheme_App3_Rec *r = (Scheme_App3_Rec *)p; - gcMARK(r->rator); - gcMARK(r->rand1); - gcMARK(r->rand2); + gcMARK2(r->rator, gc); + gcMARK2(r->rand1, gc); + gcMARK2(r->rand2, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_App3_Rec)); @@ -138,7 +138,7 @@ seq_rec { mark: int i = s->count; while (i--) - gcMARK(s->array[i]); + gcMARK2(s->array[i], gc); size: gcBYTES_TO_WORDS((sizeof(Scheme_Sequence) @@ -149,9 +149,9 @@ branch_rec { mark: Scheme_Branch_Rec *b = (Scheme_Branch_Rec *)p; - gcMARK(b->test); - gcMARK(b->tbranch); - gcMARK(b->fbranch); + gcMARK2(b->test, gc); + gcMARK2(b->tbranch, gc); + gcMARK2(b->fbranch, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Branch_Rec)); @@ -161,12 +161,12 @@ unclosed_proc { mark: Scheme_Closure_Data *d = (Scheme_Closure_Data *)p; - gcMARK(d->name); - gcMARK(d->code); - gcMARK(d->closure_map); + gcMARK2(d->name, gc); + gcMARK2(d->code, gc); + gcMARK2(d->closure_map, gc); #ifdef MZ_USE_JIT - gcMARK(d->u.native_code); - gcMARK(d->context); + gcMARK2(d->u.native_code, gc); + gcMARK2(d->context, gc); #endif size: @@ -177,8 +177,8 @@ let_value { mark: Scheme_Let_Value *l = (Scheme_Let_Value *)p; - gcMARK(l->value); - gcMARK(l->body); + gcMARK2(l->value, gc); + gcMARK2(l->body, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Let_Value)); @@ -188,7 +188,7 @@ let_void { mark: Scheme_Let_Void *l = (Scheme_Let_Void *)p; - gcMARK(l->body); + gcMARK2(l->body, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Let_Void)); @@ -198,8 +198,8 @@ letrec { mark: Scheme_Letrec *l = (Scheme_Letrec *)p; - gcMARK(l->procs); - gcMARK(l->body); + gcMARK2(l->procs, gc); + gcMARK2(l->body, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Letrec)); @@ -209,8 +209,8 @@ let_one { mark: Scheme_Let_One *l = (Scheme_Let_One *)p; - gcMARK(l->value); - gcMARK(l->body); + gcMARK2(l->value, gc); + gcMARK2(l->body, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Let_One)); @@ -220,9 +220,9 @@ with_cont_mark { mark: Scheme_With_Continuation_Mark *w = (Scheme_With_Continuation_Mark *)p; - gcMARK(w->key); - gcMARK(w->val); - gcMARK(w->body); + gcMARK2(w->key, gc); + gcMARK2(w->val, gc); + gcMARK2(w->body, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_With_Continuation_Mark)); @@ -232,9 +232,9 @@ comp_let_value { mark: Scheme_Compiled_Let_Value *c = (Scheme_Compiled_Let_Value *)p; - gcMARK(c->flags); - gcMARK(c->value); - gcMARK(c->body); + gcMARK2(c->flags, gc); + gcMARK2(c->value, gc); + gcMARK2(c->body, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Compiled_Let_Value)); @@ -244,7 +244,7 @@ let_header { mark: Scheme_Let_Header *h = (Scheme_Let_Header *)p; - gcMARK(h->body); + gcMARK2(h->body, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Let_Header)); @@ -254,15 +254,15 @@ prim_proc { Scheme_Primitive_Proc *prim = (Scheme_Primitive_Proc *)p; mark: - gcMARK(prim->name); + gcMARK2(prim->name, gc); if (prim->mina < 0) { - gcMARK(prim->mu.cases); + gcMARK2(prim->mu.cases, gc); } if (prim->pp.flags & SCHEME_PRIM_IS_CLOSURE) { Scheme_Primitive_Closure *cc = (Scheme_Primitive_Closure *)prim; int i; for (i = cc->count; i--; ) { - gcMARK(cc->val[i]); + gcMARK2(cc->val[i], gc); } } @@ -279,10 +279,10 @@ closed_prim_proc { Scheme_Closed_Primitive_Proc *c = (Scheme_Closed_Primitive_Proc *)p; mark: - gcMARK(c->name); - gcMARK(SCHEME_CLSD_PRIM_DATA(c)); + gcMARK2(c->name, gc); + gcMARK2(SCHEME_CLSD_PRIM_DATA(c), gc); if (c->mina == -2) { - gcMARK(((Scheme_Closed_Case_Primitive_Proc *)c)->cases); + gcMARK2(((Scheme_Closed_Case_Primitive_Proc *)c)->cases, gc); } size: @@ -303,8 +303,8 @@ scm_closure { int i = closure_size; while (i--) - gcMARK(c->vals[i]); - gcMARK(c->code); + gcMARK2(c->vals[i], gc); + gcMARK2(c->code, gc); size: gcBYTES_TO_WORDS((sizeof(Scheme_Closure) @@ -318,10 +318,10 @@ case_closure { int i; for (i = c->count; i--; ) - gcMARK(c->array[i]); - gcMARK(c->name); + gcMARK2(c->array[i], gc); + gcMARK2(c->name, gc); #ifdef MZ_USE_JIT - gcMARK(c->native_code); + gcMARK2(c->native_code, gc); #endif size: @@ -333,38 +333,38 @@ cont_proc { mark: Scheme_Cont *c = (Scheme_Cont *)p; - gcMARK(c->dw); - gcMARK(c->prompt_tag); - gcMARK(c->meta_continuation); - gcMARK(c->common_dw); - gcMARK(c->save_overflow); - gcMARK(c->runstack_copied); - gcMARK(c->runstack_owner); - gcMARK(c->cont_mark_stack_copied); - gcMARK(c->cont_mark_stack_owner); - gcMARK(c->init_config); - gcMARK(c->init_break_cell); + gcMARK2(c->dw, gc); + gcMARK2(c->prompt_tag, gc); + gcMARK2(c->meta_continuation, gc); + gcMARK2(c->common_dw, gc); + gcMARK2(c->save_overflow, gc); + gcMARK2(c->runstack_copied, gc); + gcMARK2(c->runstack_owner, gc); + gcMARK2(c->cont_mark_stack_copied, gc); + gcMARK2(c->cont_mark_stack_owner, gc); + gcMARK2(c->init_config, gc); + gcMARK2(c->init_break_cell, gc); #ifdef MZ_USE_JIT - gcMARK(c->native_trace); + gcMARK2(c->native_trace, gc); #endif - MARK_jmpup(&c->buf); - MARK_cjs(&c->cjs); - MARK_stack_state(&c->ss); - gcMARK(c->barrier_prompt); + MARK_jmpup(&c->buf, gc); + MARK_cjs(&c->cjs, gc); + MARK_stack_state(&c->ss, gc); + gcMARK2(c->barrier_prompt, gc); if (!GC_merely_accounting()) { - gcMARK(c->runstack_start); - gcMARK(c->runstack_saved); + gcMARK2(c->runstack_start, gc); + gcMARK2(c->runstack_saved, gc); } - gcMARK(c->prompt_id); - gcMARK(c->prompt_buf); + gcMARK2(c->prompt_id, gc); + gcMARK2(c->prompt_buf, gc); - gcMARK(c->value); - gcMARK(c->resume_to); - gcMARK(c->use_next_cont); - gcMARK(c->extra_marks); - gcMARK(c->shortcut_prompt); + gcMARK2(c->value, gc); + gcMARK2(c->resume_to, gc); + gcMARK2(c->use_next_cont, gc); + gcMARK2(c->extra_marks, gc); + gcMARK2(c->shortcut_prompt, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Cont)); @@ -374,11 +374,11 @@ meta_cont_proc { mark: Scheme_Meta_Continuation *c = (Scheme_Meta_Continuation *)p; - gcMARK(c->prompt_tag); - gcMARK(c->overflow); - gcMARK(c->next); - gcMARK(c->cont_mark_stack_copied); - gcMARK(c->cont); + gcMARK2(c->prompt_tag, gc); + gcMARK2(c->overflow, gc); + gcMARK2(c->next, gc); + gcMARK2(c->cont_mark_stack_copied, gc); + gcMARK2(c->cont, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Meta_Continuation)); @@ -388,12 +388,12 @@ mark_dyn_wind { mark: Scheme_Dynamic_Wind *dw = (Scheme_Dynamic_Wind *)p; - gcMARK(dw->id); - gcMARK(dw->data); - gcMARK(dw->prompt_tag); - gcMARK(dw->prev); + gcMARK2(dw->id, gc); + gcMARK2(dw->data, gc); + gcMARK2(dw->prompt_tag, gc); + gcMARK2(dw->prev, gc); - MARK_stack_state(&dw->envss); + MARK_stack_state(&dw->envss, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Dynamic_Wind)); @@ -403,9 +403,9 @@ mark_overflow { mark: Scheme_Overflow *o = (Scheme_Overflow *)p; - gcMARK(o->prev); - gcMARK(o->jmp); - gcMARK(o->id); + gcMARK2(o->prev, gc); + gcMARK2(o->jmp, gc); + gcMARK2(o->id, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Overflow)); @@ -415,7 +415,7 @@ mark_overflow_jmp { mark: Scheme_Overflow_Jmp *o = (Scheme_Overflow_Jmp *)p; - MARK_jmpup(&o->cont); + MARK_jmpup(&o->cont, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Overflow_Jmp)); @@ -426,11 +426,11 @@ escaping_cont_proc { Scheme_Escaping_Cont *c = (Scheme_Escaping_Cont *)p; #ifdef MZ_USE_JIT - gcMARK(c->native_trace); + gcMARK2(c->native_trace, gc); #endif - gcMARK(c->barrier_prompt); - MARK_stack_state(&c->envss); + gcMARK2(c->barrier_prompt, gc); + MARK_stack_state(&c->envss, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Escaping_Cont)); @@ -447,7 +447,7 @@ bignum_obj { mark: if (!SCHEME_BIGINLINE(b)) { - gcMARK(b->digits); + gcMARK2(b->digits, gc); } else { FIXUP_ONLY(b->digits = ((Small_Bignum *)GC_fixup_self(b))->v;) } @@ -462,8 +462,8 @@ rational_obj { mark: Scheme_Rational *r = (Scheme_Rational *)p; - gcMARK(r->num); - gcMARK(r->denom); + gcMARK2(r->num, gc); + gcMARK2(r->denom, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Rational)); @@ -489,8 +489,8 @@ complex_obj { mark: Scheme_Complex *c = (Scheme_Complex *)p; - gcMARK(c->r); - gcMARK(c->i); + gcMARK2(c->r, gc); + gcMARK2(c->i, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Complex)); @@ -499,7 +499,7 @@ complex_obj { string_obj { mark: Scheme_Object *o = (Scheme_Object *)p; - gcMARK(SCHEME_CHAR_STR_VAL(o)); + gcMARK2(SCHEME_CHAR_STR_VAL(o), gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Simple_Object)); @@ -508,7 +508,7 @@ string_obj { bstring_obj { mark: Scheme_Object *o = (Scheme_Object *)p; - gcMARK(SCHEME_BYTE_STR_VAL(o)); + gcMARK2(SCHEME_BYTE_STR_VAL(o), gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Simple_Object)); @@ -526,8 +526,8 @@ cons_cell { mark: Scheme_Object *o = (Scheme_Object *)p; - gcMARK(SCHEME_CAR(o)); - gcMARK(SCHEME_CDR(o)); + gcMARK2(SCHEME_CAR(o), gc); + gcMARK2(SCHEME_CDR(o), gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Simple_Object)); @@ -539,7 +539,7 @@ vector_obj { mark: int i; for (i = vec->size; i--; ) - gcMARK(vec->els[i]); + gcMARK2(vec->els[i], gc); size: gcBYTES_TO_WORDS((sizeof(Scheme_Vector) @@ -559,23 +559,23 @@ input_port { mark: Scheme_Input_Port *ip = (Scheme_Input_Port *)p; - gcMARK(ip->sub_type); - gcMARK(ip->port_data); - gcMARK(ip->name); - gcMARK(ip->peeked_read); - gcMARK(ip->peeked_write); - gcMARK(ip->read_handler); - gcMARK(ip->mref); - gcMARK(ip->output_half); - gcMARK(ip->special); - gcMARK(ip->ungotten_special); - gcMARK(ip->progress_evt); - gcMARK(ip->input_lock); - gcMARK(ip->input_giveup); - gcMARK(ip->input_extras); - gcMARK(ip->input_extras_ready); - gcMARK(ip->unless); - gcMARK(ip->unless_cache); + gcMARK2(ip->sub_type, gc); + gcMARK2(ip->port_data, gc); + gcMARK2(ip->name, gc); + gcMARK2(ip->peeked_read, gc); + gcMARK2(ip->peeked_write, gc); + gcMARK2(ip->read_handler, gc); + gcMARK2(ip->mref, gc); + gcMARK2(ip->output_half, gc); + gcMARK2(ip->special, gc); + gcMARK2(ip->ungotten_special, gc); + gcMARK2(ip->progress_evt, gc); + gcMARK2(ip->input_lock, gc); + gcMARK2(ip->input_giveup, gc); + gcMARK2(ip->input_extras, gc); + gcMARK2(ip->input_extras_ready, gc); + gcMARK2(ip->unless, gc); + gcMARK2(ip->unless_cache, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Input_Port)); @@ -585,14 +585,14 @@ output_port { mark: Scheme_Output_Port *op = (Scheme_Output_Port *)p; - gcMARK(op->sub_type); - gcMARK(op->port_data); - gcMARK(op->name); - gcMARK(op->display_handler); - gcMARK(op->write_handler); - gcMARK(op->print_handler); - gcMARK(op->mref); - gcMARK(op->input_half); + gcMARK2(op->sub_type, gc); + gcMARK2(op->port_data, gc); + gcMARK2(op->name, gc); + gcMARK2(op->display_handler, gc); + gcMARK2(op->write_handler, gc); + gcMARK2(op->print_handler, gc); + gcMARK2(op->mref, gc); + gcMARK2(op->input_half, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Output_Port)); @@ -609,111 +609,111 @@ thread_val { mark: Scheme_Thread *pr = (Scheme_Thread *)p; - gcMARK(pr->next); - gcMARK(pr->prev); + gcMARK2(pr->next, gc); + gcMARK2(pr->prev, gc); - gcMARK(pr->t_set_parent); - gcMARK(pr->t_set_next); - gcMARK(pr->t_set_prev); + gcMARK2(pr->t_set_parent, gc); + gcMARK2(pr->t_set_next, gc); + gcMARK2(pr->t_set_prev, gc); - MARK_cjs(&pr->cjs); - gcMARK(pr->decompose_mc); + MARK_cjs(&pr->cjs, gc); + gcMARK2(pr->decompose_mc, gc); - gcMARK(pr->cell_values); - gcMARK(pr->init_config); - gcMARK(pr->init_break_cell); + gcMARK2(pr->cell_values, gc); + gcMARK2(pr->init_config, gc); + gcMARK2(pr->init_break_cell, gc); if (!pr->runstack_owner || !GC_merely_accounting() || (*pr->runstack_owner == pr)) { Scheme_Object **rs = pr->runstack_start; - gcFIXUP_TYPED_NOW(Scheme_Object **, pr->runstack_start); + gcFIXUP2_TYPED_NOW(Scheme_Object **, pr->runstack_start, gc); if (pr->runstack != pr->runstack_start + (pr->runstack - rs)) pr->runstack = pr->runstack_start + (pr->runstack - rs); - gcMARK(pr->runstack_saved); + gcMARK2(pr->runstack_saved, gc); } - gcMARK(pr->runstack_owner); - gcMARK(pr->runstack_swapped); + gcMARK2(pr->runstack_owner, gc); + gcMARK2(pr->runstack_swapped, gc); pr->spare_runstack = NULL; /* just in case */ - gcMARK(pr->meta_prompt); - gcMARK(pr->meta_continuation); + gcMARK2(pr->meta_prompt, gc); + gcMARK2(pr->meta_continuation, gc); - gcMARK(pr->cont_mark_stack_segments); - gcMARK(pr->cont_mark_stack_owner); - gcMARK(pr->cont_mark_stack_swapped); + gcMARK2(pr->cont_mark_stack_segments, gc); + gcMARK2(pr->cont_mark_stack_owner, gc); + gcMARK2(pr->cont_mark_stack_swapped, gc); - MARK_jmpup(&pr->jmpup_buf); + MARK_jmpup(&pr->jmpup_buf, gc); - gcMARK(pr->dw); + gcMARK2(pr->dw, gc); - gcMARK(pr->nester); - gcMARK(pr->nestee); + gcMARK2(pr->nester, gc); + gcMARK2(pr->nestee, gc); - gcMARK(pr->blocker); - gcMARK(pr->overflow); + gcMARK2(pr->blocker, gc); + gcMARK2(pr->overflow, gc); - gcMARK(pr->return_marks_to); - gcMARK(pr->returned_marks); + gcMARK2(pr->return_marks_to, gc); + gcMARK2(pr->returned_marks, gc); - gcMARK(pr->current_local_env); - gcMARK(pr->current_local_mark); - gcMARK(pr->current_local_name); - gcMARK(pr->current_local_certs); - gcMARK(pr->current_local_modidx); - gcMARK(pr->current_local_menv); - gcMARK(pr->current_local_bindings); + gcMARK2(pr->current_local_env, gc); + gcMARK2(pr->current_local_mark, gc); + gcMARK2(pr->current_local_name, gc); + gcMARK2(pr->current_local_certs, gc); + gcMARK2(pr->current_local_modidx, gc); + gcMARK2(pr->current_local_menv, gc); + gcMARK2(pr->current_local_bindings, gc); - gcMARK(pr->current_mt); + gcMARK2(pr->current_mt, gc); - gcMARK(pr->constant_folding); - gcMARK(pr->reading_delayed); + gcMARK2(pr->constant_folding, gc); + gcMARK2(pr->reading_delayed, gc); - gcMARK(pr->overflow_reply); + gcMARK2(pr->overflow_reply, gc); - gcMARK(pr->values_buffer); + gcMARK2(pr->values_buffer, gc); - gcMARK(pr->tail_buffer); + gcMARK2(pr->tail_buffer, gc); - gcMARK(pr->ku.eval.wait_expr); + gcMARK2(pr->ku.eval.wait_expr, gc); - gcMARK(pr->ku.apply.tail_rator); - gcMARK(pr->ku.apply.tail_rands); + gcMARK2(pr->ku.apply.tail_rator, gc); + gcMARK2(pr->ku.apply.tail_rands, gc); - gcMARK(pr->ku.multiple.array); + gcMARK2(pr->ku.multiple.array, gc); - gcMARK(pr->ku.k.p1); - gcMARK(pr->ku.k.p2); - gcMARK(pr->ku.k.p3); - gcMARK(pr->ku.k.p4); - gcMARK(pr->ku.k.p5); + gcMARK2(pr->ku.k.p1, gc); + gcMARK2(pr->ku.k.p2, gc); + gcMARK2(pr->ku.k.p3, gc); + gcMARK2(pr->ku.k.p4, gc); + gcMARK2(pr->ku.k.p5, gc); - gcMARK(pr->list_stack); + gcMARK2(pr->list_stack, gc); - gcMARK(pr->kill_data); - gcMARK(pr->private_kill_data); - gcMARK(pr->private_kill_next); + gcMARK2(pr->kill_data, gc); + gcMARK2(pr->private_kill_data, gc); + gcMARK2(pr->private_kill_next, gc); - gcMARK(pr->user_tls); - gcMARK(pr->gmp_tls_data); + gcMARK2(pr->user_tls, gc); + gcMARK2(pr->gmp_tls_data, gc); - gcMARK(pr->mr_hop); - gcMARK(pr->mref); - gcMARK(pr->extra_mrefs); + gcMARK2(pr->mr_hop, gc); + gcMARK2(pr->mref, gc); + gcMARK2(pr->extra_mrefs, gc); - gcMARK(pr->name); + gcMARK2(pr->name, gc); - gcMARK(pr->transitive_resumes); + gcMARK2(pr->transitive_resumes, gc); - gcMARK(pr->suspended_box); - gcMARK(pr->resumed_box); - gcMARK(pr->dead_box); - gcMARK(pr->running_box); + gcMARK2(pr->suspended_box, gc); + gcMARK2(pr->resumed_box, gc); + gcMARK2(pr->dead_box, gc); + gcMARK2(pr->running_box, gc); - gcMARK(pr->mbox_first); - gcMARK(pr->mbox_last); - gcMARK(pr->mbox_sema); + gcMARK2(pr->mbox_first, gc); + gcMARK2(pr->mbox_last, gc); + gcMARK2(pr->mbox_sema, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Thread)); } @@ -725,7 +725,7 @@ runstack_val { a = (void **)s + 4 + s[2]; b = (void **)s + 4 + s[3]; while (a < b) { - gcMARK(*a); + gcMARK2(*a, gc); a++; } more: @@ -751,11 +751,11 @@ runstack_val { prompt_val { mark: Scheme_Prompt *pr = (Scheme_Prompt *)p; - gcMARK(pr->boundary_overflow_id); + gcMARK2(pr->boundary_overflow_id, gc); if (!GC_merely_accounting()) - gcMARK(pr->runstack_boundary_start); - gcMARK(pr->tag); - gcMARK(pr->id); + gcMARK2(pr->runstack_boundary_start, gc); + gcMARK2(pr->tag, gc); + gcMARK2(pr->id, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Prompt)); } @@ -763,8 +763,8 @@ prompt_val { cont_mark_set_val { mark: Scheme_Cont_Mark_Set *s = (Scheme_Cont_Mark_Set *)p; - gcMARK(s->chain); - gcMARK(s->native_stack_trace); + gcMARK2(s->chain, gc); + gcMARK2(s->native_stack_trace, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Cont_Mark_Set)); @@ -774,8 +774,8 @@ sema_val { mark: Scheme_Sema *s = (Scheme_Sema *)p; - gcMARK(s->first); - gcMARK(s->last); + gcMARK2(s->first, gc); + gcMARK2(s->last, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Sema)); @@ -785,10 +785,10 @@ channel_val { mark: Scheme_Channel *s = (Scheme_Channel *)p; - gcMARK(s->get_first); - gcMARK(s->get_last); - gcMARK(s->put_first); - gcMARK(s->put_last); + gcMARK2(s->get_first, gc); + gcMARK2(s->get_last, gc); + gcMARK2(s->put_first, gc); + gcMARK2(s->put_last, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Channel)); @@ -798,8 +798,8 @@ channel_put_val { mark: Scheme_Channel_Put *s = (Scheme_Channel_Put *)p; - gcMARK(s->ch); - gcMARK(s->val); + gcMARK2(s->ch, gc); + gcMARK2(s->val, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Channel_Put)); @@ -809,9 +809,9 @@ hash_table_val { mark: Scheme_Hash_Table *ht = (Scheme_Hash_Table *)p; - gcMARK(ht->keys); - gcMARK(ht->vals); - gcMARK(ht->mutex); + gcMARK2(ht->keys, gc); + gcMARK2(ht->vals, gc); + gcMARK2(ht->mutex, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Hash_Table)); @@ -821,8 +821,8 @@ bucket_table_val { mark: Scheme_Bucket_Table *ht = (Scheme_Bucket_Table *)p; - gcMARK(ht->buckets); - gcMARK(ht->mutex); + gcMARK2(ht->buckets, gc); + gcMARK2(ht->mutex, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Bucket_Table)); @@ -832,36 +832,36 @@ namespace_val { mark: Scheme_Env *e = (Scheme_Env *)p; - gcMARK(e->module); - gcMARK(e->module_registry); - gcMARK(e->export_registry); - gcMARK(e->insp); + gcMARK2(e->module, gc); + gcMARK2(e->module_registry, gc); + gcMARK2(e->export_registry, gc); + gcMARK2(e->insp, gc); - gcMARK(e->rename_set); - gcMARK(e->temp_marked_names); - gcMARK(e->post_ex_rename_set); + gcMARK2(e->rename_set, gc); + gcMARK2(e->temp_marked_names, gc); + gcMARK2(e->post_ex_rename_set, gc); - gcMARK(e->syntax); - gcMARK(e->exp_env); - gcMARK(e->template_env); - gcMARK(e->label_env); + gcMARK2(e->syntax, gc); + gcMARK2(e->exp_env, gc); + gcMARK2(e->template_env, gc); + gcMARK2(e->label_env, gc); - gcMARK(e->shadowed_syntax); + gcMARK2(e->shadowed_syntax, gc); - gcMARK(e->link_midx); - gcMARK(e->require_names); - gcMARK(e->et_require_names); - gcMARK(e->tt_require_names); - gcMARK(e->dt_require_names); - gcMARK(e->other_require_names); - gcMARK(e->did_starts); - gcMARK(e->available_next[0]); - gcMARK(e->available_next[1]); + gcMARK2(e->link_midx, gc); + gcMARK2(e->require_names, gc); + gcMARK2(e->et_require_names, gc); + gcMARK2(e->tt_require_names, gc); + gcMARK2(e->dt_require_names, gc); + gcMARK2(e->other_require_names, gc); + gcMARK2(e->did_starts, gc); + gcMARK2(e->available_next[0], gc); + gcMARK2(e->available_next[1], gc); - gcMARK(e->toplevel); - gcMARK(e->modchain); + gcMARK2(e->toplevel, gc); + gcMARK2(e->modchain, gc); - gcMARK(e->modvars); + gcMARK2(e->modvars, gc); size: @@ -877,8 +877,8 @@ random_state_val { compilation_top_val { mark: Scheme_Compilation_Top *t = (Scheme_Compilation_Top *)p; - gcMARK(t->code); - gcMARK(t->prefix); + gcMARK2(t->code, gc); + gcMARK2(t->prefix, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Compilation_Top)); @@ -887,10 +887,10 @@ compilation_top_val { resolve_prefix_val { mark: Resolve_Prefix *rp = (Resolve_Prefix *)p; - gcMARK(rp->toplevels); - gcMARK(rp->stxes); - gcMARK(rp->delay_info_rpair); - gcMARK(rp->uses_unsafe); + gcMARK2(rp->toplevels, gc); + gcMARK2(rp->stxes, gc); + gcMARK2(rp->delay_info_rpair, gc); + gcMARK2(rp->uses_unsafe, gc); size: gcBYTES_TO_WORDS(sizeof(Resolve_Prefix)); @@ -899,9 +899,9 @@ resolve_prefix_val { comp_prefix_val { mark: Comp_Prefix *cp = (Comp_Prefix *)p; - gcMARK(cp->toplevels); - gcMARK(cp->stxes); - gcMARK(cp->uses_unsafe); + gcMARK2(cp->toplevels, gc); + gcMARK2(cp->stxes, gc); + gcMARK2(cp->uses_unsafe, gc); size: gcBYTES_TO_WORDS(sizeof(Comp_Prefix)); @@ -911,7 +911,7 @@ svector_val { mark: Scheme_Object *o = (Scheme_Object *)p; - gcMARK(SCHEME_SVEC_VEC(o)); + gcMARK2(SCHEME_SVEC_VEC(o), gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Simple_Object)); @@ -920,13 +920,13 @@ svector_val { stx_val { mark: Scheme_Stx *stx = (Scheme_Stx *)p; - gcMARK(stx->val); - gcMARK(stx->srcloc); - gcMARK(stx->wraps); - gcMARK(stx->certs); - gcMARK(stx->props); + gcMARK2(stx->val, gc); + gcMARK2(stx->srcloc, gc); + gcMARK2(stx->wraps, gc); + gcMARK2(stx->certs, gc); + gcMARK2(stx->props, gc); if (!(MZ_OPT_HASH_KEY(&(stx)->iso) & STX_SUBSTX_FLAG)) - gcMARK(stx->u.modinfo_cache); + gcMARK2(stx->u.modinfo_cache, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Stx)); } @@ -934,7 +934,7 @@ stx_val { stx_off_val { mark: Scheme_Stx_Offset *o = (Scheme_Stx_Offset *)p; - gcMARK(o->src); + gcMARK2(o->src, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Stx_Offset)); } @@ -942,46 +942,46 @@ stx_off_val { module_val { mark: Scheme_Module *m = (Scheme_Module *)p; - gcMARK(m->modname); + gcMARK2(m->modname, gc); - gcMARK(m->et_requires); - gcMARK(m->requires); - gcMARK(m->tt_requires); - gcMARK(m->dt_requires); - gcMARK(m->other_requires); + gcMARK2(m->et_requires, gc); + gcMARK2(m->requires, gc); + gcMARK2(m->tt_requires, gc); + gcMARK2(m->dt_requires, gc); + gcMARK2(m->other_requires, gc); - gcMARK(m->body); - gcMARK(m->et_body); + gcMARK2(m->body, gc); + gcMARK2(m->et_body, gc); - gcMARK(m->me); + gcMARK2(m->me, gc); - gcMARK(m->provide_protects); - gcMARK(m->indirect_provides); + gcMARK2(m->provide_protects, gc); + gcMARK2(m->indirect_provides, gc); - gcMARK(m->indirect_syntax_provides); + gcMARK2(m->indirect_syntax_provides, gc); - gcMARK(m->et_provide_protects); - gcMARK(m->et_indirect_provides); + gcMARK2(m->et_provide_protects, gc); + gcMARK2(m->et_indirect_provides, gc); - gcMARK(m->self_modidx); + gcMARK2(m->self_modidx, gc); - gcMARK(m->accessible); - gcMARK(m->et_accessible); + gcMARK2(m->accessible, gc); + gcMARK2(m->et_accessible, gc); - gcMARK(m->insp); + gcMARK2(m->insp, gc); - gcMARK(m->lang_info); + gcMARK2(m->lang_info, gc); - gcMARK(m->hints); - gcMARK(m->ii_src); + gcMARK2(m->hints, gc); + gcMARK2(m->ii_src, gc); - gcMARK(m->comp_prefix); - gcMARK(m->prefix); - gcMARK(m->dummy); + gcMARK2(m->comp_prefix, gc); + gcMARK2(m->prefix, gc); + gcMARK2(m->dummy, gc); - gcMARK(m->rn_stx); + gcMARK2(m->rn_stx, gc); - gcMARK(m->primitive); + gcMARK2(m->primitive, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Module)); } @@ -990,21 +990,21 @@ module_phase_exports_val { mark: Scheme_Module_Phase_Exports *m = (Scheme_Module_Phase_Exports *)p; - gcMARK(m->phase_index); + gcMARK2(m->phase_index, gc); - gcMARK(m->src_modidx); + gcMARK2(m->src_modidx, gc); - gcMARK(m->provides); - gcMARK(m->provide_srcs); - gcMARK(m->provide_src_names); - gcMARK(m->provide_nominal_srcs); - gcMARK(m->provide_src_phases); - gcMARK(m->provide_insps); + gcMARK2(m->provides, gc); + gcMARK2(m->provide_srcs, gc); + gcMARK2(m->provide_src_names, gc); + gcMARK2(m->provide_nominal_srcs, gc); + gcMARK2(m->provide_src_phases, gc); + gcMARK2(m->provide_insps, gc); - gcMARK(m->kernel_exclusion); - gcMARK(m->kernel_exclusion2); + gcMARK2(m->kernel_exclusion, gc); + gcMARK2(m->kernel_exclusion2, gc); - gcMARK(m->ht); + gcMARK2(m->ht, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Module_Phase_Exports)); @@ -1014,12 +1014,12 @@ module_exports_val { mark: Scheme_Module_Exports *m = (Scheme_Module_Exports *)p; - gcMARK(m->rt); - gcMARK(m->et); - gcMARK(m->dt); - gcMARK(m->other_phases); + gcMARK2(m->rt, gc); + gcMARK2(m->et, gc); + gcMARK2(m->dt, gc); + gcMARK2(m->other_phases, gc); - gcMARK(m->src_modidx); + gcMARK2(m->src_modidx, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Module_Exports)); } @@ -1028,11 +1028,11 @@ modidx_val { mark: Scheme_Modidx *modidx = (Scheme_Modidx *)p; - gcMARK(modidx->path); - gcMARK(modidx->base); - gcMARK(modidx->resolved); - gcMARK(modidx->shift_cache); - gcMARK(modidx->cache_next); + gcMARK2(modidx->path, gc); + gcMARK2(modidx->base, gc); + gcMARK2(modidx->resolved, gc); + gcMARK2(modidx->shift_cache, gc); + gcMARK2(modidx->cache_next, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Modidx)); } @@ -1041,10 +1041,10 @@ guard_val { mark: Scheme_Security_Guard *g = (Scheme_Security_Guard *)p; - gcMARK(g->parent); - gcMARK(g->file_proc); - gcMARK(g->network_proc); - gcMARK(g->link_proc); + gcMARK2(g->parent, gc); + gcMARK2(g->file_proc, gc); + gcMARK2(g->network_proc, gc); + gcMARK2(g->link_proc, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Security_Guard)); } @@ -1053,7 +1053,7 @@ buf_holder { mark: Scheme_Jumpup_Buf_Holder *h = (Scheme_Jumpup_Buf_Holder *)p; - MARK_jmpup(&h->buf); + MARK_jmpup(&h->buf, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Jumpup_Buf_Holder)); @@ -1062,7 +1062,7 @@ buf_holder { mark_inspector { mark: Scheme_Inspector *i = (Scheme_Inspector *)p; - gcMARK(i->superior); + gcMARK2(i->superior, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Inspector)); } @@ -1071,9 +1071,9 @@ mark_pipe { mark: Scheme_Pipe *pp = (Scheme_Pipe *)p; - gcMARK(pp->buf); - gcMARK(pp->wakeup_on_read); - gcMARK(pp->wakeup_on_write); + gcMARK2(pp->buf, gc); + gcMARK2(pp->wakeup_on_read, gc); + gcMARK2(pp->wakeup_on_write, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Pipe)); @@ -1082,10 +1082,10 @@ mark_pipe { mark_logger { mark: Scheme_Logger *l = (Scheme_Logger *)p; - gcMARK(l->name); - gcMARK(l->parent); - gcMARK(l->readers); - gcMARK(l->timestamp); + gcMARK2(l->name, gc); + gcMARK2(l->parent, gc); + gcMARK2(l->readers, gc); + gcMARK2(l->timestamp, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Logger)); } @@ -1093,9 +1093,9 @@ mark_logger { mark_log_reader { mark: Scheme_Log_Reader *lr = (Scheme_Log_Reader *)p; - gcMARK(lr->sema); - gcMARK(lr->head); - gcMARK(lr->tail); + gcMARK2(lr->sema, gc); + gcMARK2(lr->head, gc); + gcMARK2(lr->tail, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Log_Reader)); } @@ -1121,26 +1121,26 @@ mark_comp_env { mark: Scheme_Full_Comp_Env *e = (Scheme_Full_Comp_Env *)p; - gcMARK(e->base.genv); - gcMARK(e->base.insp); - gcMARK(e->base.prefix); - gcMARK(e->base.next); - gcMARK(e->base.values); - gcMARK(e->base.certs); - gcMARK(e->base.renames); - gcMARK(e->base.uid); - gcMARK(e->base.uids); - gcMARK(e->base.dup_check); - gcMARK(e->base.intdef_name); - gcMARK(e->base.in_modidx); - gcMARK(e->base.skip_table); + gcMARK2(e->base.genv, gc); + gcMARK2(e->base.insp, gc); + gcMARK2(e->base.prefix, gc); + gcMARK2(e->base.next, gc); + gcMARK2(e->base.values, gc); + gcMARK2(e->base.certs, gc); + gcMARK2(e->base.renames, gc); + gcMARK2(e->base.uid, gc); + gcMARK2(e->base.uids, gc); + gcMARK2(e->base.dup_check, gc); + gcMARK2(e->base.intdef_name, gc); + gcMARK2(e->base.in_modidx, gc); + gcMARK2(e->base.skip_table, gc); - gcMARK(e->data.const_names); - gcMARK(e->data.const_vals); - gcMARK(e->data.const_uids); - gcMARK(e->data.sealed); - gcMARK(e->data.use); - gcMARK(e->data.lifts); + gcMARK2(e->data.const_names, gc); + gcMARK2(e->data.const_vals, gc); + gcMARK2(e->data.const_uids, gc); + gcMARK2(e->data.sealed, gc); + gcMARK2(e->data.use, gc); + gcMARK2(e->data.lifts, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Full_Comp_Env)); @@ -1150,15 +1150,15 @@ mark_resolve_info { mark: Resolve_Info *i = (Resolve_Info *)p; - gcMARK(i->prefix); - gcMARK(i->stx_map); - gcMARK(i->old_pos); - gcMARK(i->new_pos); - gcMARK(i->old_stx_pos); - gcMARK(i->flags); - gcMARK(i->lifts); - gcMARK(i->lifted); - gcMARK(i->next); + gcMARK2(i->prefix, gc); + gcMARK2(i->stx_map, gc); + gcMARK2(i->old_pos, gc); + gcMARK2(i->new_pos, gc); + gcMARK2(i->old_stx_pos, gc); + gcMARK2(i->flags, gc); + gcMARK2(i->lifts, gc); + gcMARK2(i->lifted, gc); + gcMARK2(i->next, gc); size: gcBYTES_TO_WORDS(sizeof(Resolve_Info)); @@ -1168,15 +1168,15 @@ mark_optimize_info { mark: Optimize_Info *i = (Optimize_Info *)p; - gcMARK(i->stat_dists); - gcMARK(i->sd_depths); - gcMARK(i->next); - gcMARK(i->use); - gcMARK(i->consts); - gcMARK(i->top_level_consts); - gcMARK(i->transitive_use); - gcMARK(i->transitive_use_len); - gcMARK(i->context); + gcMARK2(i->stat_dists, gc); + gcMARK2(i->sd_depths, gc); + gcMARK2(i->next, gc); + gcMARK2(i->use, gc); + gcMARK2(i->consts, gc); + gcMARK2(i->top_level_consts, gc); + gcMARK2(i->transitive_use, gc); + gcMARK2(i->transitive_use_len, gc); + gcMARK2(i->context, gc); size: gcBYTES_TO_WORDS(sizeof(Optimize_Info)); @@ -1186,9 +1186,9 @@ mark_sfs_info { mark: SFS_Info *i = (SFS_Info *)p; - gcMARK(i->max_used); - gcMARK(i->max_calls); - gcMARK(i->saved); + gcMARK2(i->max_used, gc); + gcMARK2(i->max_calls, gc); + gcMARK2(i->saved, gc); size: gcBYTES_TO_WORDS(sizeof(SFS_Info)); @@ -1197,9 +1197,9 @@ mark_sfs_info { mark_once_used { mark: Scheme_Once_Used *o = (Scheme_Once_Used *)p; - gcMARK(o->expr); - gcMARK(o->info); - gcMARK(o->next); + gcMARK2(o->expr, gc); + gcMARK2(o->info, gc); + gcMARK2(o->next, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Once_Used)); } @@ -1214,9 +1214,9 @@ mark_comp_info { mark: Scheme_Compile_Info *i = (Scheme_Compile_Info *)p; - gcMARK(i->value_name); - gcMARK(i->certs); - gcMARK(i->observer); + gcMARK2(i->value_name, gc); + gcMARK2(i->certs, gc); + gcMARK2(i->observer, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Compile_Info)); @@ -1226,8 +1226,8 @@ mark_saved_stack { mark: Scheme_Saved_Stack *saved = (Scheme_Saved_Stack *)p; - gcMARK(saved->prev); - gcMARK(saved->runstack_start); + gcMARK2(saved->prev, gc); + gcMARK2(saved->runstack_start, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Saved_Stack)); @@ -1237,8 +1237,8 @@ mark_validate_clearing { mark: Validate_Clearing *vc = (Validate_Clearing *)p; - gcMARK(vc->stack); - gcMARK(vc->ncstack); + gcMARK2(vc->stack, gc); + gcMARK2(vc->ncstack, gc); size: gcBYTES_TO_WORDS(sizeof(Validate_Clearing)); @@ -1254,7 +1254,7 @@ mark_reply_item { mark: ReplyItem *r = (ReplyItem *)p; - gcMARK(r->next); + gcMARK2(r->next, gc); size: gcBYTES_TO_WORDS(sizeof(ReplyItem)); @@ -1270,9 +1270,9 @@ mark_closure_info { mark: Closure_Info *i = (Closure_Info *)p; - gcMARK(i->local_flags); - gcMARK(i->base_closure_map); - gcMARK(i->flonum_map); + gcMARK2(i->local_flags, gc); + gcMARK2(i->base_closure_map, gc); + gcMARK2(i->flonum_map, gc); size: gcBYTES_TO_WORDS(sizeof(Closure_Info)); @@ -1282,8 +1282,8 @@ mark_dyn_wind_cell { mark: Scheme_Dynamic_Wind_List *l = (Scheme_Dynamic_Wind_List *)p; - gcMARK(l->dw); - gcMARK(l->next); + gcMARK2(l->dw, gc); + gcMARK2(l->next, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Dynamic_Wind_List)); @@ -1293,9 +1293,9 @@ mark_dyn_wind_info { mark: Dyn_Wind *d = (Dyn_Wind *)p; - gcMARK(d->pre); - gcMARK(d->act); - gcMARK(d->post); + gcMARK2(d->pre, gc); + gcMARK2(d->act, gc); + gcMARK2(d->post, gc); size: gcBYTES_TO_WORDS(sizeof(Dyn_Wind)); @@ -1305,9 +1305,9 @@ mark_cont_mark_chain { mark: Scheme_Cont_Mark_Chain *c = (Scheme_Cont_Mark_Chain *)p; - gcMARK(c->key); - gcMARK(c->val); - gcMARK(c->next); + gcMARK2(c->key, gc); + gcMARK2(c->val, gc); + gcMARK2(c->next, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Cont_Mark_Chain)); @@ -1323,8 +1323,8 @@ hash_tree_val { mark: Scheme_Hash_Tree *ht = (Scheme_Hash_Tree *)p; - gcMARK(ht->root); - gcMARK(ht->elems_box); + gcMARK2(ht->root, gc); + gcMARK2(ht->elems_box, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Hash_Tree)); @@ -1336,13 +1336,13 @@ mark_rb_node { /* Short-circuit on NULL pointers, which are especially likely */ if (rb->left) { - gcMARK(rb->left); + gcMARK2(rb->left, gc); } if (rb->right) { - gcMARK(rb->right); + gcMARK2(rb->right, gc); } - gcMARK(rb->key); - gcMARK(rb->val); + gcMARK2(rb->key, gc); + gcMARK2(rb->val, gc); size: gcBYTES_TO_WORDS(sizeof(RBNode)); @@ -1357,8 +1357,8 @@ START places; place_bi_channel_val { mark: Scheme_Place_Bi_Channel *pbc = (Scheme_Place_Bi_Channel *)p; - gcMARK(pbc->sendch); - gcMARK(pbc->recvch); + gcMARK2(pbc->sendch, gc); + gcMARK2(pbc->recvch, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Place_Bi_Channel)); @@ -1367,7 +1367,7 @@ place_bi_channel_val { place_val { mark: Scheme_Place *pr = (Scheme_Place *)p; - gcMARK(pr->channel); + gcMARK2(pr->channel, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Place)); @@ -1378,7 +1378,7 @@ place_async_channel_val { Scheme_Place_Async_Channel *pac = (Scheme_Place_Async_Channel *)p; int i; for (i = pac->size; i--; ) - gcMARK(pac->msgs[i]); + gcMARK2(pac->msgs[i], gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Place_Async_Channel)); @@ -1394,12 +1394,12 @@ mark_load_handler_data { mark: LoadHandlerData *d = (LoadHandlerData *)p; - gcMARK(d->config); - gcMARK(d->port); - gcMARK(d->p); - gcMARK(d->stxsrc); - gcMARK(d->expected_module); - gcMARK(d->delay_load_info); + gcMARK2(d->config, gc); + gcMARK2(d->port, gc); + gcMARK2(d->p, gc); + gcMARK2(d->stxsrc, gc); + gcMARK2(d->expected_module, gc); + gcMARK2(d->delay_load_info, gc); size: gcBYTES_TO_WORDS(sizeof(LoadHandlerData)); @@ -1409,7 +1409,7 @@ mark_indexed_string { mark: Scheme_Indexed_String *is = (Scheme_Indexed_String *)p; - gcMARK(is->string); + gcMARK2(is->string, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Indexed_String)); @@ -1419,17 +1419,17 @@ mark_user_input { mark: User_Input_Port *uip = (User_Input_Port *)p; - gcMARK(uip->read_proc); - gcMARK(uip->peek_proc); - gcMARK(uip->progress_evt_proc); - gcMARK(uip->peeked_read_proc); - gcMARK(uip->location_proc); - gcMARK(uip->count_lines_proc); - gcMARK(uip->buffer_mode_proc); - gcMARK(uip->close_proc); - gcMARK(uip->reuse_str); - gcMARK(uip->peeked); - gcMARK(uip->prefix_pipe); + gcMARK2(uip->read_proc, gc); + gcMARK2(uip->peek_proc, gc); + gcMARK2(uip->progress_evt_proc, gc); + gcMARK2(uip->peeked_read_proc, gc); + gcMARK2(uip->location_proc, gc); + gcMARK2(uip->count_lines_proc, gc); + gcMARK2(uip->buffer_mode_proc, gc); + gcMARK2(uip->close_proc, gc); + gcMARK2(uip->reuse_str, gc); + gcMARK2(uip->peeked, gc); + gcMARK2(uip->prefix_pipe, gc); size: gcBYTES_TO_WORDS(sizeof(User_Input_Port)); } @@ -1438,16 +1438,16 @@ mark_user_output { mark: User_Output_Port *uop = (User_Output_Port *)p; - gcMARK(uop->evt); - gcMARK(uop->write_evt_proc); - gcMARK(uop->write_proc); - gcMARK(uop->write_special_evt_proc); - gcMARK(uop->write_special_proc); - gcMARK(uop->location_proc); - gcMARK(uop->count_lines_proc); - gcMARK(uop->buffer_mode_proc); - gcMARK(uop->close_proc); - gcMARK(uop->buffer_pipe); + gcMARK2(uop->evt, gc); + gcMARK2(uop->write_evt_proc, gc); + gcMARK2(uop->write_proc, gc); + gcMARK2(uop->write_special_evt_proc, gc); + gcMARK2(uop->write_special_proc, gc); + gcMARK2(uop->location_proc, gc); + gcMARK2(uop->count_lines_proc, gc); + gcMARK2(uop->buffer_mode_proc, gc); + gcMARK2(uop->close_proc, gc); + gcMARK2(uop->buffer_pipe, gc); size: gcBYTES_TO_WORDS(sizeof(User_Output_Port)); } @@ -1462,8 +1462,8 @@ START port; mark_thread_memory { mark: Scheme_Thread_Memory *tm = (Scheme_Thread_Memory *)p; - gcMARK(tm->prev); - gcMARK(tm->next); + gcMARK2(tm->prev, gc); + gcMARK2(tm->next, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Thread_Memory)); @@ -1474,7 +1474,7 @@ mark_input_file { mark: Scheme_Input_File *i = (Scheme_Input_File *)p; - gcMARK(i->f); + gcMARK2(i->f, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Input_File)); @@ -1484,7 +1484,7 @@ mark_output_file { mark: Scheme_Output_File *o = (Scheme_Output_File *)p; - gcMARK(o->f); + gcMARK2(o->f, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Output_File)); @@ -1495,8 +1495,8 @@ mark_input_fd { mark: Scheme_FD *fd = (Scheme_FD *)p; - gcMARK(fd->buffer); - gcMARK(fd->refcount); + gcMARK2(fd->buffer, gc); + gcMARK2(fd->refcount, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_FD)); @@ -1508,7 +1508,7 @@ mark_system_child { mark: System_Child *sc = (System_Child *)p; - gcMARK(sc->next); + gcMARK2(sc->next, gc); size: gcBYTES_TO_WORDS(sizeof(System_Child)); @@ -1520,8 +1520,8 @@ mark_oskit_console_input { mark: osk_console_input *c = (osk_console_input *)p; - gcMARK(c->buffer); - gcMARK(c->next); + gcMARK2(c->buffer, gc); + gcMARK2(c->next, gc); size: gcBYTES_TO_WORDS(sizeof(osk_console_input)); @@ -1532,7 +1532,7 @@ mark_subprocess { mark: #ifndef WINDOWS_PROCESSES Scheme_Subprocess *sp = (Scheme_Subprocess *)p; - gcMARK(sp->handle); + gcMARK2(sp->handle, gc); #endif size: gcBYTES_TO_WORDS(sizeof(Scheme_Subprocess)); @@ -1541,9 +1541,9 @@ mark_subprocess { mark_read_write_evt { mark: Scheme_Read_Write_Evt *rww = (Scheme_Read_Write_Evt *)p; - gcMARK(rww->port); - gcMARK(rww->v); - gcMARK(rww->str); + gcMARK2(rww->port, gc); + gcMARK2(rww->v, gc); + gcMARK2(rww->str, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Read_Write_Evt)); } @@ -1557,9 +1557,9 @@ START print; mark_print_params { mark: PrintParams *pp = (PrintParams *)p; - gcMARK(pp->inspector); - gcMARK(pp->print_port); - gcMARK(pp->print_buffer); + gcMARK2(pp->inspector, gc); + gcMARK2(pp->print_port, gc); + gcMARK2(pp->print_buffer, gc); size: gcBYTES_TO_WORDS(sizeof(PrintParams)); } @@ -1567,22 +1567,22 @@ mark_print_params { mark_marshal_tables { mark: Scheme_Marshal_Tables *mt = (Scheme_Marshal_Tables *)p; - gcMARK(mt->symtab); - gcMARK(mt->rns); - gcMARK(mt->rn_refs); - gcMARK(mt->st_refs); - gcMARK(mt->st_ref_stack); - gcMARK(mt->reverse_map); - gcMARK(mt->same_map); - gcMARK(mt->cert_lists); - gcMARK(mt->shift_map); - gcMARK(mt->top_map); - gcMARK(mt->key_map); - gcMARK(mt->delay_map); - gcMARK(mt->cdata_map); - gcMARK(mt->rn_saved); - gcMARK(mt->shared_offsets); - gcMARK(mt->sorted_keys); + gcMARK2(mt->symtab, gc); + gcMARK2(mt->rns, gc); + gcMARK2(mt->rn_refs, gc); + gcMARK2(mt->st_refs, gc); + gcMARK2(mt->st_ref_stack, gc); + gcMARK2(mt->reverse_map, gc); + gcMARK2(mt->same_map, gc); + gcMARK2(mt->cert_lists, gc); + gcMARK2(mt->shift_map, gc); + gcMARK2(mt->top_map, gc); + gcMARK2(mt->key_map, gc); + gcMARK2(mt->delay_map, gc); + gcMARK2(mt->cdata_map, gc); + gcMARK2(mt->rn_saved, gc); + gcMARK2(mt->shared_offsets, gc); + gcMARK2(mt->sorted_keys, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Marshal_Tables)); } @@ -1598,7 +1598,7 @@ mark_listener { mark: - gcMARK(l->mref); + gcMARK2(l->mref, gc); size: gcBYTES_TO_WORDS(sizeof(listener_t) + ((l->count - 1) * sizeof(tcp_t))); @@ -1609,8 +1609,8 @@ mark_tcp { mark: Scheme_Tcp *tcp = (Scheme_Tcp *)p; - gcMARK(tcp->b.buffer); - gcMARK(tcp->b.out_buffer); + gcMARK2(tcp->b.buffer, gc); + gcMARK2(tcp->b.out_buffer, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Tcp)); @@ -1621,8 +1621,8 @@ mark_udp { mark: Scheme_UDP *udp = (Scheme_UDP *)p; - gcMARK(udp->previous_from_addr); - gcMARK(udp->mref); + gcMARK2(udp->previous_from_addr, gc); + gcMARK2(udp->mref, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_UDP)); @@ -1632,9 +1632,9 @@ mark_udp_evt { mark: Scheme_UDP_Evt *uw = (Scheme_UDP_Evt *)p; - gcMARK(uw->udp); - gcMARK(uw->str); - gcMARK(uw->dest_addr); + gcMARK2(uw->udp, gc); + gcMARK2(uw->str, gc); + gcMARK2(uw->dest_addr, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_UDP_Evt)); @@ -1654,9 +1654,9 @@ mark_parameterization { int i; for (i = max_configs; i--; ) { - gcMARK(c->prims[i]); + gcMARK2(c->prims[i], gc); } - gcMARK(c->extensions); + gcMARK2(c->extensions, gc); size: gcBYTES_TO_WORDS((sizeof(Scheme_Parameterization) @@ -1666,9 +1666,9 @@ mark_parameterization { mark_config { mark: Scheme_Config *config = (Scheme_Config *)p; - gcMARK(config->key); - gcMARK(config->cell); - gcMARK(config->next); + gcMARK2(config->key, gc); + gcMARK2(config->cell, gc); + gcMARK2(config->next, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Config)); } @@ -1677,9 +1677,9 @@ mark_will_executor_val { mark: WillExecutor *e = (WillExecutor *)p; - gcMARK(e->sema); - gcMARK(e->first); - gcMARK(e->last); + gcMARK2(e->sema, gc); + gcMARK2(e->first, gc); + gcMARK2(e->last, gc); size: gcBYTES_TO_WORDS(sizeof(WillExecutor)); @@ -1689,19 +1689,19 @@ mark_custodian_val { mark: Scheme_Custodian *m = (Scheme_Custodian *)p; - gcMARK(m->boxes); - gcMARK(m->mrefs); - gcMARK(m->closers); - gcMARK(m->data); + gcMARK2(m->boxes, gc); + gcMARK2(m->mrefs, gc); + gcMARK2(m->closers, gc); + gcMARK2(m->data, gc); - gcMARK(m->parent); - gcMARK(m->sibling); - gcMARK(m->children); + gcMARK2(m->parent, gc); + gcMARK2(m->sibling, gc); + gcMARK2(m->children, gc); - gcMARK(m->global_next); - gcMARK(m->global_prev); + gcMARK2(m->global_next, gc); + gcMARK2(m->global_prev, gc); - gcMARK(m->cust_boxes); + gcMARK2(m->cust_boxes, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Custodian)); @@ -1712,9 +1712,9 @@ mark_custodian_box_val { Scheme_Custodian_Box *b = (Scheme_Custodian_Box *)p; int sd = ((Scheme_Custodian *)GC_resolve(b->cust))->shut_down; - gcMARK(b->cust); + gcMARK2(b->cust, gc); if (!sd) { - gcMARK(b->v); + gcMARK2(b->v, gc); } size: @@ -1725,7 +1725,7 @@ mark_thread_hop { mark: Scheme_Thread_Custodian_Hop *hop = (Scheme_Thread_Custodian_Hop *)p; - gcMARK(hop->p); + gcMARK2(hop->p, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Thread_Custodian_Hop)); @@ -1735,10 +1735,10 @@ mark_param_data { mark: ParamData *d = (ParamData *)p; - gcMARK(d->key); - gcMARK(d->guard); - gcMARK(d->extract_guard); - gcMARK(d->defcell); + gcMARK2(d->key, gc); + gcMARK2(d->guard, gc); + gcMARK2(d->extract_guard, gc); + gcMARK2(d->defcell, gc); size: gcBYTES_TO_WORDS(sizeof(ParamData)); @@ -1748,10 +1748,10 @@ mark_will { mark: ActiveWill *w = (ActiveWill *)p; - gcMARK(w->o); - gcMARK(w->proc); - gcMARK(w->w); - gcMARK(w->next); + gcMARK2(w->o, gc); + gcMARK2(w->proc, gc); + gcMARK2(w->w, gc); + gcMARK2(w->next, gc); size: gcBYTES_TO_WORDS(sizeof(ActiveWill)); @@ -1767,12 +1767,12 @@ mark_syncing { mark: Syncing *w = (Syncing *)p; - gcMARK(w->set); - gcMARK(w->wrapss); - gcMARK(w->nackss); - gcMARK(w->reposts); - gcMARK(w->accepts); - gcMARK(w->disable_break); + gcMARK2(w->set, gc); + gcMARK2(w->wrapss, gc); + gcMARK2(w->nackss, gc); + gcMARK2(w->reposts, gc); + gcMARK2(w->accepts, gc); + gcMARK2(w->disable_break, gc); size: gcBYTES_TO_WORDS(sizeof(Syncing)); @@ -1782,8 +1782,8 @@ mark_evt_set { mark: Evt_Set *w = (Evt_Set *)p; - gcMARK(w->ws); - gcMARK(w->argv); + gcMARK2(w->ws, gc); + gcMARK2(w->argv, gc); size: gcBYTES_TO_WORDS(sizeof(Evt_Set)); @@ -1793,12 +1793,12 @@ mark_thread_set { mark: Scheme_Thread_Set *ts = (Scheme_Thread_Set *)p; - gcMARK(ts->parent); - gcMARK(ts->first); - gcMARK(ts->next); - gcMARK(ts->prev); - gcMARK(ts->search_start); - gcMARK(ts->current); + gcMARK2(ts->parent, gc); + gcMARK2(ts->first, gc); + gcMARK2(ts->next, gc); + gcMARK2(ts->prev, gc); + gcMARK2(ts->search_start, gc); + gcMARK2(ts->current, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Thread_Set)); @@ -1808,7 +1808,7 @@ mark_thread_cell { mark: Thread_Cell *c = (Thread_Cell *)p; - gcMARK(c->def_val); + gcMARK2(c->def_val, gc); size: gcBYTES_TO_WORDS(sizeof(Thread_Cell)); @@ -1818,10 +1818,10 @@ mark_frozen_tramp { mark: FrozenTramp *f = (FrozenTramp *)p; - gcMARK(f->do_data); - gcMARK(f->old_param); - gcMARK(f->config); - gcMARK(f->progress_cont); + gcMARK2(f->do_data, gc); + gcMARK2(f->old_param, gc); + gcMARK2(f->config, gc); + gcMARK2(f->progress_cont, gc); size: gcBYTES_TO_WORDS(sizeof(FrozenTramp)); @@ -1837,9 +1837,9 @@ mark_finalization { mark: Finalization *f = (Finalization *)p; - gcMARK(f->data); - gcMARK(f->next); - gcMARK(f->prev); + gcMARK2(f->data, gc); + gcMARK2(f->next, gc); + gcMARK2(f->prev, gc); size: gcBYTES_TO_WORDS(sizeof(Finalization)); @@ -1849,11 +1849,11 @@ mark_finalizations { mark: Finalizations *f = (Finalizations *)p; - gcMARK(f->scheme_first); - gcMARK(f->scheme_last); - gcMARK(f->prim_first); - gcMARK(f->prim_last); - gcMARK(f->ext_data); + gcMARK2(f->scheme_first, gc); + gcMARK2(f->scheme_last, gc); + gcMARK2(f->prim_first, gc); + gcMARK2(f->prim_last, gc); + gcMARK2(f->ext_data, gc); size: gcBYTES_TO_WORDS(sizeof(Finalizations)); @@ -1869,11 +1869,11 @@ mark_channel_syncer { mark: Scheme_Channel_Syncer *w = (Scheme_Channel_Syncer *)p; - gcMARK(w->p); - gcMARK(w->prev); - gcMARK(w->next); - gcMARK(w->syncing); - gcMARK(w->obj); + gcMARK2(w->p, gc); + gcMARK2(w->prev, gc); + gcMARK2(w->next, gc); + gcMARK2(w->syncing, gc); + gcMARK2(w->obj, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Channel_Syncer)); @@ -1898,10 +1898,10 @@ mark_struct_val { mark: int i; - gcFIXUP_TYPED_NOW(Scheme_Struct_Type *, s->stype); + gcFIXUP2_TYPED_NOW(Scheme_Struct_Type *, s->stype, gc); for(i = num_slots; i--; ) - gcMARK(s->slots[i]); + gcMARK2(s->slots[i], gc); size: gcBYTES_TO_WORDS((sizeof(Scheme_Structure) @@ -1914,18 +1914,18 @@ mark_struct_type_val { mark: int i; for (i = t->name_pos + 1; i--; ) { - gcMARK(t->parent_types[i]); + gcMARK2(t->parent_types[i], gc); } - gcMARK(t->name); - gcMARK(t->inspector); - gcMARK(t->accessor); - gcMARK(t->mutator); - gcMARK(t->prefab_key); - gcMARK(t->uninit_val); - gcMARK(t->props); - gcMARK(t->proc_attr); - gcMARK(t->guard); - gcMARK(t->immutables); + gcMARK2(t->name, gc); + gcMARK2(t->inspector, gc); + gcMARK2(t->accessor, gc); + gcMARK2(t->mutator, gc); + gcMARK2(t->prefab_key, gc); + gcMARK2(t->uninit_val, gc); + gcMARK2(t->props, gc); + gcMARK2(t->proc_attr, gc); + gcMARK2(t->guard, gc); + gcMARK2(t->immutables, gc); size: gcBYTES_TO_WORDS((sizeof(Scheme_Struct_Type) @@ -1936,8 +1936,8 @@ mark_struct_proc_info { mark: Struct_Proc_Info *i = (Struct_Proc_Info *)p; - gcMARK(i->struct_type); - gcMARK(i->func_name); + gcMARK2(i->struct_type, gc); + gcMARK2(i->func_name, gc); size: gcBYTES_TO_WORDS(sizeof(Struct_Proc_Info)); @@ -1946,9 +1946,9 @@ mark_struct_proc_info { mark_struct_property { mark: Scheme_Struct_Property *i = (Scheme_Struct_Property *)p; - gcMARK(i->name); - gcMARK(i->guard); - gcMARK(i->supers); + gcMARK2(i->name, gc); + gcMARK2(i->guard, gc); + gcMARK2(i->supers, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Struct_Property)); } @@ -1957,8 +1957,8 @@ mark_wrapped_evt { mark: Wrapped_Evt *ww = (Wrapped_Evt *)p; - gcMARK(ww->evt); - gcMARK(ww->wrapper); + gcMARK2(ww->evt, gc); + gcMARK2(ww->wrapper, gc); size: gcBYTES_TO_WORDS(sizeof(Wrapped_Evt)); @@ -1968,7 +1968,7 @@ mark_nack_guard_evt { mark: Nack_Guard_Evt *nw = (Nack_Guard_Evt *)p; - gcMARK(nw->maker); + gcMARK2(nw->maker, gc); size: gcBYTES_TO_WORDS(sizeof(Nack_Guard_Evt)); @@ -1978,10 +1978,10 @@ mark_chaperone { mark: Scheme_Chaperone *px = (Scheme_Chaperone *)p; - gcMARK(px->val); - gcMARK(px->prev); - gcMARK(px->props); - gcMARK(px->redirects); + gcMARK2(px->val, gc); + gcMARK2(px->prev, gc); + gcMARK2(px->props, gc); + gcMARK2(px->redirects, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Chaperone)); @@ -2008,17 +2008,17 @@ mark_indent { mark_cport { mark: CPort *cp = (CPort *)p; - gcMARK(cp->start); - gcMARK(cp->orig_port); - gcMARK(cp->ht); - gcMARK(cp->ut); - gcMARK(cp->symtab); - gcMARK(cp->insp); - gcMARK(cp->relto); - gcMARK(cp->magic_sym); - gcMARK(cp->magic_val); - gcMARK(cp->shared_offsets); - gcMARK(cp->delay_info); + gcMARK2(cp->start, gc); + gcMARK2(cp->orig_port, gc); + gcMARK2(cp->ht, gc); + gcMARK2(cp->ut, gc); + gcMARK2(cp->symtab, gc); + gcMARK2(cp->insp, gc); + gcMARK2(cp->relto, gc); + gcMARK2(cp->magic_sym, gc); + gcMARK2(cp->magic_val, gc); + gcMARK2(cp->shared_offsets, gc); + gcMARK2(cp->delay_info, gc); size: gcBYTES_TO_WORDS(sizeof(CPort)); } @@ -2026,10 +2026,10 @@ mark_cport { mark_readtable { mark: Readtable *t = (Readtable *)p; - gcMARK(t->mapping); - gcMARK(t->fast_mapping); - gcMARK(t->symbol_parser); - gcMARK(t->names); + gcMARK2(t->mapping, gc); + gcMARK2(t->fast_mapping, gc); + gcMARK2(t->symbol_parser, gc); + gcMARK2(t->names, gc); size: gcBYTES_TO_WORDS(sizeof(Readtable)); } @@ -2037,10 +2037,10 @@ mark_readtable { mark_read_params { mark: ReadParams *rp = (ReadParams *)p; - gcMARK(rp->table); - gcMARK(rp->magic_sym); - gcMARK(rp->magic_val); - gcMARK(rp->delay_load_info); + gcMARK2(rp->table, gc); + gcMARK2(rp->magic_sym, gc); + gcMARK2(rp->magic_val, gc); + gcMARK2(rp->delay_load_info, gc); size: gcBYTES_TO_WORDS(sizeof(ReadParams)); } @@ -2048,15 +2048,15 @@ mark_read_params { mark_delay_load { mark: Scheme_Load_Delay *ld = (Scheme_Load_Delay *)p; - gcMARK(ld->path); - gcMARK(ld->symtab); - gcMARK(ld->shared_offsets); - gcMARK(ld->insp); - gcMARK(ld->relto); - gcMARK(ld->ut); - gcMARK(ld->current_rp); - gcMARK(ld->cached); - gcMARK(ld->cached_port); + gcMARK2(ld->path, gc); + gcMARK2(ld->symtab, gc); + gcMARK2(ld->shared_offsets, gc); + gcMARK2(ld->insp, gc); + gcMARK2(ld->relto, gc); + gcMARK2(ld->ut, gc); + gcMARK2(ld->current_rp, gc); + gcMARK2(ld->cached, gc); + gcMARK2(ld->cached_port, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Load_Delay)); } @@ -2064,9 +2064,9 @@ mark_delay_load { mark_unmarshal_tables { mark: Scheme_Unmarshal_Tables *ut = (Scheme_Unmarshal_Tables *)p; - gcMARK(ut->rns); - gcMARK(ut->rp); - gcMARK(ut->decoded); + gcMARK2(ut->rns, gc); + gcMARK2(ut->rp, gc); + gcMARK2(ut->decoded, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Unmarshal_Tables)); } @@ -2080,8 +2080,8 @@ START regexp; mark_regexp { regexp *r = (regexp *)p; mark: - gcMARK(r->source); - gcMARK(r->regstart); + gcMARK2(r->source, gc); + gcMARK2(r->regstart, gc); size: gcBYTES_TO_WORDS((sizeof(regexp) + r->regsize)); } @@ -2089,15 +2089,15 @@ mark_regexp { mark_regwork { mark: Regwork *r = (Regwork *)p; - gcMARK(r->str); - gcMARK(r->instr); - gcMARK(r->port); - gcMARK(r->unless_evt); - gcMARK(r->startp); - gcMARK(r->maybep); - gcMARK(r->endp); - gcMARK(r->counters); - gcMARK(r->peekskip); + gcMARK2(r->str, gc); + gcMARK2(r->instr, gc); + gcMARK2(r->port, gc); + gcMARK2(r->unless_evt, gc); + gcMARK2(r->startp, gc); + gcMARK2(r->maybep, gc); + gcMARK2(r->endp, gc); + gcMARK2(r->counters, gc); + gcMARK2(r->peekskip, gc); size: gcBYTES_TO_WORDS(sizeof(Regwork)); } @@ -2111,7 +2111,7 @@ START string; mark_string_convert { mark: Scheme_Converter *c = (Scheme_Converter *)p; - gcMARK(c->mref); + gcMARK2(c->mref, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Converter)); } @@ -2125,14 +2125,14 @@ START stxobj; mark_rename_table { mark: Module_Renames *rn = (Module_Renames *)p; - gcMARK(rn->phase); - gcMARK(rn->ht); - gcMARK(rn->nomarshal_ht); - gcMARK(rn->unmarshal_info); - gcMARK(rn->shared_pes); - gcMARK(rn->set_identity); - gcMARK(rn->marked_names); - gcMARK(rn->free_id_renames); + gcMARK2(rn->phase, gc); + gcMARK2(rn->ht, gc); + gcMARK2(rn->nomarshal_ht, gc); + gcMARK2(rn->unmarshal_info, gc); + gcMARK2(rn->shared_pes, gc); + gcMARK2(rn->set_identity, gc); + gcMARK2(rn->marked_names, gc); + gcMARK2(rn->free_id_renames, gc); size: gcBYTES_TO_WORDS(sizeof(Module_Renames)); } @@ -2140,11 +2140,11 @@ mark_rename_table { mark_rename_table_set { mark: Module_Renames_Set *rns = (Module_Renames_Set *)p; - gcMARK(rns->et); - gcMARK(rns->rt); - gcMARK(rns->other_phases); - gcMARK(rns->share_marked_names); - gcMARK(rns->set_identity); + gcMARK2(rns->et, gc); + gcMARK2(rns->rt, gc); + gcMARK2(rns->other_phases, gc); + gcMARK2(rns->share_marked_names, gc); + gcMARK2(rns->set_identity, gc); size: gcBYTES_TO_WORDS(sizeof(Module_Renames_Set)); } @@ -2152,7 +2152,7 @@ mark_rename_table_set { mark_srcloc { mark: Scheme_Stx_Srcloc *s = (Scheme_Stx_Srcloc *)p; - gcMARK(s->src); + gcMARK2(s->src, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Stx_Srcloc)); } @@ -2162,7 +2162,7 @@ mark_wrapchunk { mark: int i; for (i = wc->len; i--; ) { - gcMARK(wc->a[i]); + gcMARK2(wc->a[i], gc); } size: gcBYTES_TO_WORDS(sizeof(Wrap_Chunk) + ((wc->len - 1) * sizeof(Scheme_Object *))); @@ -2171,12 +2171,12 @@ mark_wrapchunk { mark_cert { mark: Scheme_Cert *c = (Scheme_Cert *)p; - gcMARK(c->mark); - gcMARK(c->modidx); - gcMARK(c->insp); - gcMARK(c->key); - gcMARK(c->mapped); - gcMARK(c->next); + gcMARK2(c->mark, gc); + gcMARK2(c->modidx, gc); + gcMARK2(c->insp, gc); + gcMARK2(c->key, gc); + gcMARK2(c->mapped, gc); + gcMARK2(c->next, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Cert)); } @@ -2184,11 +2184,11 @@ mark_cert { lex_rib { mark: Scheme_Lexical_Rib *rib = (Scheme_Lexical_Rib *)p; - gcMARK(rib->rename); - gcMARK(rib->timestamp); - gcMARK(rib->sealed); - gcMARK(rib->mapped_names); - gcMARK(rib->next); + gcMARK2(rib->rename, gc); + gcMARK2(rib->timestamp, gc); + gcMARK2(rib->sealed, gc); + gcMARK2(rib->mapped_names, gc); + gcMARK2(rib->next, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Lexical_Rib)); } @@ -2198,7 +2198,7 @@ mark_free_id_info { Scheme_Vector *vec = (Scheme_Vector *)p; int i; for (i = 8; i--; ) - gcMARK(vec->els[i]); + gcMARK2(vec->els[i], gc); size: gcBYTES_TO_WORDS((sizeof(Scheme_Vector) @@ -2226,9 +2226,9 @@ native_closure { { int i = closure_size; while (i--) - gcMARK(c->vals[i]); + gcMARK2(c->vals[i], gc); } - gcMARK(c->code); + gcMARK2(c->code, gc); size: gcBYTES_TO_WORDS((sizeof(Scheme_Native_Closure) @@ -2238,8 +2238,8 @@ native_closure { mark_jit_state { mark: mz_jit_state *j = (mz_jit_state *)p; - gcMARK(j->mappings); - gcMARK(j->self_data); + gcMARK2(j->mappings, gc); + gcMARK2(j->self_data, gc); size: gcBYTES_TO_WORDS(sizeof(mz_jit_state)); } @@ -2249,14 +2249,14 @@ native_unclosed_proc { Scheme_Native_Closure_Data *d = (Scheme_Native_Closure_Data *)p; int i; - gcMARK(d->u2.name); + gcMARK2(d->u2.name, gc); if (d->retained) { for (i = SCHEME_INT_VAL(d->retained[0]); i--; ) { - gcMARK(d->retained[i]); + gcMARK2(d->retained[i], gc); } } if (d->closure_size < 0) { - gcMARK(d->u.arities); + gcMARK2(d->u.arities, gc); } size: @@ -2267,8 +2267,8 @@ native_unclosed_proc_plus_case { mark: Scheme_Native_Closure_Data_Plus_Case *d = (Scheme_Native_Closure_Data_Plus_Case *)p; - native_unclosed_proc_MARK(p); - gcMARK(d->case_lam); + native_unclosed_proc_MARK(p, gc); + gcMARK2(d->case_lam, gc); size: gcBYTES_TO_WORDS(sizeof(Scheme_Native_Closure_Data_Plus_Case)); @@ -2285,23 +2285,23 @@ START future; future { mark: future_t *f = (future_t *)p; - gcMARK(f->orig_lambda); - gcMARK(f->arg_s0); - gcMARK(f->arg_S0); - gcMARK(f->arg_b0); - gcMARK(f->arg_n0); - gcMARK(f->arg_s1); - gcMARK(f->arg_S1); - gcMARK(f->arg_s2); - gcMARK(f->arg_S2); - gcMARK(f->retval_s); - gcMARK(f->retval); - gcMARK(f->multiple_array); - gcMARK(f->tail_rator); - gcMARK(f->tail_rands); - gcMARK(f->prev); - gcMARK(f->next); - gcMARK(f->next_waiting_atomic); + gcMARK2(f->orig_lambda, gc); + gcMARK2(f->arg_s0, gc); + gcMARK2(f->arg_S0, gc); + gcMARK2(f->arg_b0, gc); + gcMARK2(f->arg_n0, gc); + gcMARK2(f->arg_s1, gc); + gcMARK2(f->arg_S1, gc); + gcMARK2(f->arg_s2, gc); + gcMARK2(f->arg_S2, gc); + gcMARK2(f->retval_s, gc); + gcMARK2(f->retval, gc); + gcMARK2(f->multiple_array, gc); + gcMARK2(f->tail_rator, gc); + gcMARK2(f->tail_rands, gc); + gcMARK2(f->prev, gc); + gcMARK2(f->next, gc); + gcMARK2(f->next_waiting_atomic, gc); size: gcBYTES_TO_WORDS(sizeof(future_t)); } @@ -2311,10 +2311,10 @@ future { sequential_future { mark: future_t *f = (future_t *)p; - gcMARK(f->orig_lambda); - gcMARK(f->running_sema); - gcMARK(f->retval); - gcMARK(f->multiple_array); + gcMARK2(f->orig_lambda, gc); + gcMARK2(f->running_sema, gc); + gcMARK2(f->retval, gc); + gcMARK2(f->multiple_array, gc); size: gcBYTES_TO_WORDS(sizeof(future_t)); } @@ -2325,4 +2325,4 @@ END future; /**********************************************************************/ -#define GC_REG_TRAV(type, base) GC_register_traversers(type, base ## _SIZE, base ## _MARK, base ## _FIXUP, base ## _IS_CONST_SIZE, base ## _IS_ATOMIC) +#define GC_REG_TRAV(type, base) GC_register_traversers2(type, base ## _SIZE, base ## _MARK, base ## _FIXUP, base ## _IS_CONST_SIZE, base ## _IS_ATOMIC) diff --git a/src/mzscheme/src/salloc.c b/src/mzscheme/src/salloc.c index d48096b199..39733ed410 100644 --- a/src/mzscheme/src/salloc.c +++ b/src/mzscheme/src/salloc.c @@ -210,7 +210,8 @@ void scheme_set_thread_local_variables(Thread_Local_Variables *tlvs) XFORM_SKIP_ } #endif -#if defined(IMPLEMENT_THREAD_LOCAL_VIA_PTHREADS) && defined(INLINE_GETSPECIFIC_ASSEMBLY_CODE) +#if 0 && defined(IMPLEMENT_THREAD_LOCAL_VIA_PTHREADS) && defined(INLINE_GETSPECIFIC_ASSEMBLY_CODE) +/* This code is dsiabled */ static void macosx_get_thread_local_key_for_assembly_code() XFORM_SKIP_PROC { /* Our [highly questionable] strategy for inlining pthread_getspecific() is taken from @@ -265,44 +266,21 @@ Thread_Local_Variables *scheme_external_get_thread_local_variables() XFORM_SKIP_ void scheme_setup_thread_local_key_if_needed() XFORM_SKIP_PROC { #ifdef IMPLEMENT_THREAD_LOCAL_VIA_PTHREADS -# ifdef INLINE_GETSPECIFIC_ASSEMBLY_CODE -# if defined(linux) - scheme_thread_local_key = 0; - if (pthread_key_create(&scheme_thread_local_key, NULL)) { - fprintf(stderr, "pthread key create failed\n"); - abort(); - } - /* - if (scheme_thread_local_key != 0) { - fprintf(stderr, "pthread getspecific inline hack failed scheme_thread_local_key %i\n", scheme_thread_local_key); - abort(); - } - */ - pthread_setspecific(scheme_thread_local_key, (void *)0xaced); - if (scheme_get_thread_local_variables() != (Thread_Local_Variables *)0xaced) { - fprintf(stderr, "pthread getspecific inline hack failed to return set data\n"); - abort(); - } -# else - macosx_get_thread_local_key_for_assembly_code(); -# endif -# else - if (pthread_key_create(&scheme_thread_local_key, NULL)) { - fprintf(stderr, "pthread key create failed\n"); - abort(); - } -# endif + scheme_thread_local_key = 0; + if (pthread_key_create(&scheme_thread_local_key, NULL)) { + fprintf(stderr, "pthread key create failed\n"); + abort(); + } #endif #ifdef IMPLEMENT_THREAD_LOCAL_VIA_WIN_TLS - { - void **base; + { + void **base; - __asm { mov ecx, FS:[0x2C] - mov base, ecx } - scheme_tls_delta -= (unsigned long)base[scheme_tls_index]; - scheme_tls_index *= sizeof(void*); - - } + __asm { mov ecx, FS:[0x2C] + mov base, ecx } + scheme_tls_delta -= (unsigned long)base[scheme_tls_index]; + scheme_tls_index *= sizeof(void*); + } #endif } diff --git a/src/mzscheme/src/type.c b/src/mzscheme/src/type.c index 42bc8f09f7..66f75a63e4 100644 --- a/src/mzscheme/src/type.c +++ b/src/mzscheme/src/type.c @@ -400,19 +400,19 @@ int scheme_num_types(void) START_XFORM_SKIP; -static int bad_trav_SIZE(void *p) +static int bad_trav_SIZE(void *p, struct NewGC *gc) { printf("Shouldn't get here.\n"); exit(1); } -static int bad_trav_MARK(void *p) +static int bad_trav_MARK(void *p, struct NewGC *gc) { printf("Shouldn't get here.\n"); exit(1); } -static int bad_trav_FIXUP(void *p) +static int bad_trav_FIXUP(void *p, struct NewGC *gc) { printf("Shouldn't get here.\n"); exit(1); @@ -421,59 +421,61 @@ static int bad_trav_FIXUP(void *p) #define bad_trav_IS_CONST_SIZE 0 #define bad_trav_IS_ATOMIC 0 -static void MARK_cjs(Scheme_Continuation_Jump_State *cjs) +static void MARK_cjs(Scheme_Continuation_Jump_State *cjs, struct NewGC *gc) { - gcMARK(cjs->jumping_to_continuation); - gcMARK(cjs->val); + gcMARK2(cjs->jumping_to_continuation, gc); + gcMARK2(cjs->val, gc); } -static void FIXUP_cjs(Scheme_Continuation_Jump_State *cjs) +static void FIXUP_cjs(Scheme_Continuation_Jump_State *cjs, struct NewGC *gc) { - gcFIXUP(cjs->jumping_to_continuation); - gcFIXUP(cjs->val); + gcFIXUP2(cjs->jumping_to_continuation, gc); + gcFIXUP2(cjs->val, gc); } -static void MARK_stack_state(Scheme_Stack_State *ss) +static void MARK_stack_state(Scheme_Stack_State *ss, struct NewGC *gc) { } -static void FIXUP_stack_state(Scheme_Stack_State *ss) +static void FIXUP_stack_state(Scheme_Stack_State *ss, struct NewGC *gc) { } -static void MARK_jmpup(Scheme_Jumpup_Buf *buf) +static void MARK_jmpup(Scheme_Jumpup_Buf *buf, struct NewGC *gc) { - gcMARK(buf->stack_copy); - gcMARK(buf->cont); - gcMARK(buf->external_stack); + gcMARK2(buf->stack_copy, gc); + gcMARK2(buf->cont, gc); + gcMARK2(buf->external_stack, gc); /* IMPORTANT: the buf->stack_copy pointer must be the only instance of this stack to be traversed. If you copy a jmpup buffer (as in fun.c), don't let a GC happen until the old copy is zeroed out. */ if (buf->stack_copy) - GC_mark_variable_stack(buf->gc_var_stack, - (long)buf->stack_copy - (long)buf->stack_from, - /* FIXME: stack direction */ - (char *)buf->stack_copy + buf->stack_size, - buf->stack_copy); + GC_mark2_variable_stack(buf->gc_var_stack, + (long)buf->stack_copy - (long)buf->stack_from, + /* FIXME: stack direction */ + (char *)buf->stack_copy + buf->stack_size, + buf->stack_copy, + gc); } -static void FIXUP_jmpup(Scheme_Jumpup_Buf *buf) +static void FIXUP_jmpup(Scheme_Jumpup_Buf *buf, struct NewGC *gc) { void *new_stack; new_stack = GC_resolve(buf->stack_copy); - gcFIXUP_TYPED_NOW(void *, buf->stack_copy); - gcFIXUP(buf->cont); - gcFIXUP(buf->external_stack); + gcFIXUP2_TYPED_NOW(void *, buf->stack_copy, gc); + gcFIXUP2(buf->cont, gc); + gcFIXUP2(buf->external_stack, gc); if (buf->stack_copy) - GC_fixup_variable_stack(buf->gc_var_stack, - (long)new_stack - (long)buf->stack_from, - /* FIXME: stack direction */ - (char *)new_stack + buf->stack_size, - new_stack); + GC_fixup2_variable_stack(buf->gc_var_stack, + (long)new_stack - (long)buf->stack_from, + /* FIXME: stack direction */ + (char *)new_stack + buf->stack_size, + new_stack, + gc); } #define RUNSTACK_ZERO_VAL NULL From 25ede3dc509dd7a707c3f9b6e2597afa418238ac Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Mon, 29 Mar 2010 20:39:42 +0000 Subject: [PATCH 015/202] fix reporting for some syntactic misuses of syntax-case svn: r18662 --- collects/scheme/private/stxcase-scheme.ss | 8 ++++---- collects/scheme/private/stxcase.ss | 2 +- collects/scheme/private/stxloc.ss | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/collects/scheme/private/stxcase-scheme.ss b/collects/scheme/private/stxcase-scheme.ss index 53eb04f0f1..be7fb0a3dc 100644 --- a/collects/scheme/private/stxcase-scheme.ss +++ b/collects/scheme/private/stxcase-scheme.ss @@ -29,7 +29,7 @@ (-define-syntax syntax-rules (lambda (stx) (syntax-case** syntax-rules #t stx () free-identifier=? - ((_ (k ...) ((keyword . pattern) template) ...) + ((sr (k ...) ((keyword . pattern) template) ...) (andmap identifier? (syntax->list (syntax (k ...)))) (begin (for-each (lambda (id) @@ -42,19 +42,19 @@ (syntax->list (syntax (keyword ...)))) (syntax/loc stx (lambda (x) - (syntax-case** _ #t x (k ...) free-identifier=? + (syntax-case** sr #t x (k ...) free-identifier=? ((_ . pattern) (syntax/loc x template)) ...)))))))) (-define-syntax syntax-id-rules (lambda (x) (syntax-case** syntax-id-rules #t x () free-identifier=? - ((_ (k ...) (pattern template) ...) + ((sidr (k ...) (pattern template) ...) (andmap identifier? (syntax->list (syntax (k ...)))) (syntax/loc x (make-set!-transformer (lambda (x) - (syntax-case** _ #t x (k ...) free-identifier=? + (syntax-case** sidr #t x (k ...) free-identifier=? (pattern (syntax/loc x template)) ...)))))))) diff --git a/collects/scheme/private/stxcase.ss b/collects/scheme/private/stxcase.ss index b5de2bfbef..5ca9410a52 100644 --- a/collects/scheme/private/stxcase.ss +++ b/collects/scheme/private/stxcase.ss @@ -273,7 +273,7 @@ (<= 2 (length (stx->list clause)) 3)) (raise-syntax-error (syntax-e who) - "bad clause" + "expected a clause containing a pattern, an optional guard expression, and an expression" clause))) clauses) (let ([patterns (map stx-car clauses)] diff --git a/collects/scheme/private/stxloc.ss b/collects/scheme/private/stxloc.ss index ee4f6bab8a..0fbb69fa96 100644 --- a/collects/scheme/private/stxloc.ss +++ b/collects/scheme/private/stxloc.ss @@ -10,15 +10,15 @@ (-define-syntax syntax-case* (lambda (stx) (syntax-case** #f #t stx () free-identifier=? - [(_ stxe kl id=? clause ...) - (syntax (syntax-case** _ #f stxe kl id=? clause ...))]))) + [(sc stxe kl id=? clause ...) + (syntax (syntax-case** sc #f stxe kl id=? clause ...))]))) ;; Regular syntax-case (-define-syntax syntax-case (lambda (stx) (syntax-case** #f #t stx () free-identifier=? - [(_ stxe kl clause ...) - (syntax (syntax-case** _ #f stxe kl free-identifier=? clause ...))]))) + [(sc stxe kl clause ...) + (syntax (syntax-case** sc #f stxe kl free-identifier=? clause ...))]))) (-define (relocate loc stx) (if (or (syntax-source loc) From 67cf037da6aff47d88fbe80fa7bc11bfda27f8ce Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Mon, 29 Mar 2010 21:23:13 +0000 Subject: [PATCH 016/202] fix chaperone-procedure GC bug svn: r18663 --- src/mzscheme/src/struct.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mzscheme/src/struct.c b/src/mzscheme/src/struct.c index 940250f835..b60db7af6f 100644 --- a/src/mzscheme/src/struct.c +++ b/src/mzscheme/src/struct.c @@ -4788,6 +4788,7 @@ static void register_traversers(void) GC_REG_TRAV(scheme_rt_struct_proc_info, mark_struct_proc_info); GC_REG_TRAV(scheme_chaperone_type, mark_chaperone); + GC_REG_TRAV(scheme_proc_chaperone_type, mark_chaperone); } END_XFORM_SKIP; From 22ce2af1a7f2c47c1aaf24a2066810e1311ff9cc Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 30 Mar 2010 00:10:40 +0000 Subject: [PATCH 017/202] restore lost adjustment in optimizer that enables lifting of constant functions, especially loop functions svn: r18664 --- src/mzscheme/src/eval.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/mzscheme/src/eval.c b/src/mzscheme/src/eval.c index b5c0282d6a..64a5bfeeaa 100644 --- a/src/mzscheme/src/eval.c +++ b/src/mzscheme/src/eval.c @@ -2880,9 +2880,34 @@ static Scheme_Object *check_app_let_rator(Scheme_Object *app, Scheme_Object *rat in optimize_for_inline() after optimizing a rator. */ if (SAME_TYPE(SCHEME_TYPE(rator), scheme_compiled_let_void_type)) { Scheme_Let_Header *head = (Scheme_Let_Header *)rator; - Scheme_Compiled_Let_Value *clv = NULL; + Scheme_Compiled_Let_Value *clv; int i; + /* Handle ((let ([f ...]) f) arg ...) specially, so we can + adjust the flags for `f': */ + if ((head->count == 1) && (head->num_clauses == 1)) { + clv = (Scheme_Compiled_Let_Value *)head->body; + rator = clv->body; + if (SAME_TYPE(SCHEME_TYPE(rator), scheme_local_type) + && (SCHEME_LOCAL_POS(rator) == 0) + && scheme_is_compiled_procedure(clv->value, 1, 1)) { + + reset_rator(app, scheme_false); + app = scheme_optimize_shift(app, 1, 0); + reset_rator(app, scheme_make_local(scheme_local_type, 0, 0)); + + clv->body = app; + + if (clv->flags[0] & SCHEME_WAS_APPLIED_EXCEPT_ONCE) { + clv->flags[0] -= SCHEME_WAS_APPLIED_EXCEPT_ONCE; + clv->flags[0] |= SCHEME_WAS_ONLY_APPLIED; + } + + return scheme_optimize_expr((Scheme_Object *)head, info, context); + } + } + + clv = NULL; rator = head->body; for (i = head->num_clauses; i--; ) { clv = (Scheme_Compiled_Let_Value *)rator; From ef2c882562335b07d4a99dbe17cd1ec96ff58170 Mon Sep 17 00:00:00 2001 From: Philippe Meunier Date: Tue, 30 Mar 2010 04:06:55 +0000 Subject: [PATCH 018/202] Quaterly update... svn: r18665 --- collects/string-constants/french-string-constants.ss | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/collects/string-constants/french-string-constants.ss b/collects/string-constants/french-string-constants.ss index 8b8fe3f662..584a50be62 100644 --- a/collects/string-constants/french-string-constants.ss +++ b/collects/string-constants/french-string-constants.ss @@ -730,6 +730,7 @@ (most-recent-window "Fenêtre la plus récente") (next-tab "Onglet suivant") (prev-tab "Onglet précédent") + (tab-i "Onglet ~a: ~a") ;; menu item in the windows menu under mac os x. first ~a is filled with a number between 1 and 9; second one is the filename of the tab (view-menu-label "&Montrer") (show-overview "Montrer le contour du &programme") @@ -886,7 +887,7 @@ (reindent-menu-item-label "&Réindenter") (reindent-all-menu-item-label "Réindenter &tout") (semicolon-comment-out-menu-item-label "&Commenter à l'aide de points-virgules") - (box-comment-out-menu-item-label "&Commenter à l'aide d'une boite") + (box-comment-out-menu-item-label "Commenter à l'aide d'une &boite") (uncomment-menu-item-label "&Décommenter") (convert-to-semicolon-comment "Convertir en un commentaire avec points-virgules") @@ -1055,7 +1056,8 @@ (initial-language-category "Langage initial") (no-language-chosen "Aucun langage sélectionné") - ;(module-language-one-line-summary "Exécuter crée une fenêtre d'interaction dans le contexte du module, incluant le langage du module lui-même") + (module-language-name "Déterminer le langage à partir du code source") + (module-language-one-line-summary "Le langage utilisé est spécifié par la ligne #lang") (module-language-auto-text "Ligne #lang automatique") ;; shows up in the details section of the module language ;;; from the `not a language language' used initially in drscheme. @@ -1183,7 +1185,7 @@ (module-browser-laying-out-graph-label "Tracer le graph") (module-browser-open-file-format "Ouvrir ~a") (module-browser "Navigateur de modules") ;; frame title - (module-browser... "Navigateur de modules...") ;; menu item title + (module-browser... "Navigateur de &modules...") ;; menu item title (module-browser-error-expanding "Erreur durant l'expansion du programme :\n\n~a") (module-browser-show-lib-paths "Montrer les fichiers chargés à l'aide de chemins de fichiers du type (lib ..)") (module-browser-progress "Navigateur de modules : ~a") ;; prefix in the status line From 3a0b16d4ce968611564d38e9f8fd54a45e8181b0 Mon Sep 17 00:00:00 2001 From: Philippe Meunier Date: Tue, 30 Mar 2010 08:39:54 +0000 Subject: [PATCH 019/202] Fixed some weird unicode double-quotes which I can't produce on my computer. svn: r18666 --- collects/string-constants/french-string-constants.ss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collects/string-constants/french-string-constants.ss b/collects/string-constants/french-string-constants.ss index 584a50be62..9f004395bc 100644 --- a/collects/string-constants/french-string-constants.ss +++ b/collects/string-constants/french-string-constants.ss @@ -1076,7 +1076,7 @@ ; the three string constants are concatenated together and the middle ; one is hyperlinked to the dialog that suggests various languages - (get-guidance-before "Choisissez l'entrée Sélectionner le langage...” dans le menu Langage, ou ") + (get-guidance-before "Choisissez l'entrée \"Sélectionner le langage...\" dans le menu \"Langage\", ou ") (get-guidance-during "recevez de l'aide") (get-guidance-after ".") From cfab7a8d97c62814973a8b0e74089233873a896e Mon Sep 17 00:00:00 2001 From: Noel Welsh Date: Tue, 30 Mar 2010 13:33:45 +0000 Subject: [PATCH 020/202] Add type definition for unsafe-vector*-ref and unsafe-vector*-length, which have recently been introduced, and a test case for in-vector (which uses the above). svn: r18667 --- collects/tests/typed-scheme/succeed/sequences.ss | 1 + collects/typed-scheme/private/base-env.ss | 2 ++ 2 files changed, 3 insertions(+) diff --git a/collects/tests/typed-scheme/succeed/sequences.ss b/collects/tests/typed-scheme/succeed/sequences.ss index c584ad8543..00a162efd4 100644 --- a/collects/tests/typed-scheme/succeed/sequences.ss +++ b/collects/tests/typed-scheme/succeed/sequences.ss @@ -7,3 +7,4 @@ (ann (for ([z (open-input-string "foobar")]) (add1 z)) Void) (ann (for ([z (in-list (list 1 2 3))]) (add1 z)) Void) +(ann (for ([z (in-vector (vector 1 2 3))]) (add1 z)) Void) \ No newline at end of file diff --git a/collects/typed-scheme/private/base-env.ss b/collects/typed-scheme/private/base-env.ss index 0c2b5c9d9a..959ea1fb1c 100644 --- a/collects/typed-scheme/private/base-env.ss +++ b/collects/typed-scheme/private/base-env.ss @@ -651,7 +651,9 @@ ;; unsafe [unsafe-vector-ref (-poly (a) ((-vec a) -Nat . -> . a))] +[unsafe-vector*-ref (-poly (a) ((-vec a) -Nat . -> . a))] [unsafe-vector-length (-poly (a) ((-vec a) . -> . -Nat))] +[unsafe-vector*-length (-poly (a) ((-vec a) . -> . -Nat))] [unsafe-car (-poly (a b) (cl->* (->acc (list (-pair a b)) a (list -car))))] From 3c1d0b079caf65e6abd3e0b4528d063a87284aa0 Mon Sep 17 00:00:00 2001 From: Matthias Felleisen Date: Tue, 30 Mar 2010 13:43:47 +0000 Subject: [PATCH 021/202] 10834 fixed svn: r18668 --- collects/2htdp/image.ss | 26 +++++++++++++++++++------- collects/2htdp/tests/bad-draw.ss | 2 +- collects/2htdp/tests/mp.ss | 22 +++++++++++++--------- collects/2htdp/tests/test-image.ss | 3 ++- collects/2htdp/universe.ss | 17 +++++++++-------- 5 files changed, 44 insertions(+), 26 deletions(-) diff --git a/collects/2htdp/image.ss b/collects/2htdp/image.ss index 4c96dcc3c5..d2f5adc208 100644 --- a/collects/2htdp/image.ss +++ b/collects/2htdp/image.ss @@ -46,12 +46,14 @@ and they all have good sample contracts. (It is amazing what we can do with kids |# -(require "../mrlib/image-core.ss" +(require (except-in "../mrlib/image-core.ss" make-color make-pen) "private/image-more.ss" "private/img-err.ss" + (only-in lang/prim provide-primitive provide-primitives define-primitive) htdp/error) -(provide overlay +(provide-primitives + overlay overlay/align overlay/xy underlay @@ -93,7 +95,6 @@ and they all have good sample contracts. (It is amazing what we can do with kids scene+curve text text/font - bitmap x-place? y-place? @@ -105,12 +106,23 @@ and they all have good sample contracts. (It is amazing what we can do with kids pen-style? pen-cap? pen-join? - (rename-out [build-color make-color]) color-red color-blue color-green color? color - - (rename-out [build-pen make-pen]) pen-color pen-width pen-style pen-cap pen-join pen image-width image-height - image-baseline) + image-baseline + + make-color + make-pen + ) + +(provide bitmap) + + +(define-primitive make-color build-color) +(define-primitive make-pen build-pen) + +#; +(provide (rename-out [build-color make-color]) + (rename-out [build-pen make-pen])) diff --git a/collects/2htdp/tests/bad-draw.ss b/collects/2htdp/tests/bad-draw.ss index 64904b408c..a1c9730dd8 100644 --- a/collects/2htdp/tests/bad-draw.ss +++ b/collects/2htdp/tests/bad-draw.ss @@ -5,7 +5,7 @@ (define s "") (define x 0) -(with-handlers ((exn? void)) +(with-handlers ((exn? (lambda _ "success!"))) (big-bang 0 (on-tick (lambda (w) (begin (set! x (+ x 1)) w))) (on-draw (lambda (w) (set! s (number->string w)))))) diff --git a/collects/2htdp/tests/mp.ss b/collects/2htdp/tests/mp.ss index e25abd9357..b435f75cc6 100644 --- a/collects/2htdp/tests/mp.ss +++ b/collects/2htdp/tests/mp.ss @@ -1,9 +1,8 @@ -;; The first three lines of this file were inserted by DrScheme. They record metadata -;; about the language level of this file in a form that our tools can easily process. -#reader(lib "htdp-beginner-reader.ss" "lang")((modname mp) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ()))) +#lang scheme (require test-engine/scheme-tests) (require 2htdp/universe) (require htdp/image) + ;; WorldState = Image ;; graphical constants @@ -13,11 +12,11 @@ ;; add a dot at (x,y) to ws (check-expect - (clack mt 10 20 "something mousy") + (clack mt 10 20 "button-down") (place-image (circle 1 "solid" "red") 10 20 mt)) (check-expect - (clack (place-image (circle 1 "solid" "red") 1 2 mt) 3 3 "") + (clack (place-image (circle 1 "solid" "red") 1 2 mt) 3 3 "button-down") (place-image (circle 1 "solid" "red") 3 3 (place-image (circle 1 "solid" "red") 1 2 mt))) @@ -34,8 +33,13 @@ (define (show ws) ws) +(test) + ;; run program run -(big-bang (empty-scene 100 100) - (on-draw show) - (record? true) - (on-mouse clack)) +(define (main x) + (big-bang (empty-scene 100 100) + (on-draw show) + (record? x) + (on-mouse clack))) + +(main false) diff --git a/collects/2htdp/tests/test-image.ss b/collects/2htdp/tests/test-image.ss index 4b518e507c..e5dd1c84e5 100644 --- a/collects/2htdp/tests/test-image.ss +++ b/collects/2htdp/tests/test-image.ss @@ -38,7 +38,8 @@ (only-in "../private/image-more.ss" bring-between swizzle) - "../private/img-err.ss" + (only-in "../private/img-err.ss" image-snip->image) + ; "../private/img-err.ss" "../../mrlib/private/image-core-bitmap.ss" lang/posn scheme/math diff --git a/collects/2htdp/universe.ss b/collects/2htdp/universe.ss index 2b217ca393..0a04c65e7a 100644 --- a/collects/2htdp/universe.ss +++ b/collects/2htdp/universe.ss @@ -11,10 +11,7 @@ -- what if the initial world or universe state is omitted? the error message is bad then. |# -(require (for-syntax "private/syn-aux.ss" - scheme/function - #; - (rename-in lang/prim (first-order->higher-order f2h))) +(require (for-syntax "private/syn-aux.ss" scheme/function) "private/syn-aux-aux.ss" "private/syn-aux.ss" "private/check-aux.ss" @@ -26,8 +23,9 @@ htdp/error (rename-in lang/prim (first-order->higher-order f2h))) -(provide - (rename-out (make-stop-the-world stop-with))) ;; World -> STOP +(define-primitive stop-with make-stop-the-world) + +(provide stop-with) ;; World -> STOP (provide launch-many-worlds @@ -35,7 +33,7 @@ ;; run expressions e1 through e2 in parallel, produce all values in same order ) -(provide +(provide-primitive sexp? ;; Any -> Boolean ) @@ -71,6 +69,9 @@ ; (provide big-bang ;; : see below + ) + +(provide-primitives make-package ;; World Sexp -> Package package? ;; Any -> Boolean run-movie ;; [Listof Image] -> true @@ -235,7 +236,7 @@ ; ; -(provide +(provide-primitives ;; type World iworld? ;; Any -> Boolean iworld=? ;; World World -> Boolean From 047794b11a894bf5637c666ec51b1e57cacf16fe Mon Sep 17 00:00:00 2001 From: Casey Klein Date: Tue, 30 Mar 2010 15:05:07 +0000 Subject: [PATCH 022/202] v4.2.5 changes (please merge to release branch) svn: r18669 --- doc/release-notes/redex/HISTORY.txt | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/doc/release-notes/redex/HISTORY.txt b/doc/release-notes/redex/HISTORY.txt index c24fc4365f..94f22016e6 100644 --- a/doc/release-notes/redex/HISTORY.txt +++ b/doc/release-notes/redex/HISTORY.txt @@ -1,4 +1,24 @@ - * Renamed the #:attempts keyword #:attempt-num in the `generate-term' form +v4.2.5 + + * reversed the order in which `where' and `side-condition' clauses + appear in typeset definitions + + * added support for `where' and `side-condition' clauses that do not + appear in the metafunction's typeset definition + + * added a #:print? flag to redex-check, to control whether it prints + or returns its result + + * renamed the #:attempts keyword to #:attempt-num in the `generate-term' form + + * changed typesetting to render `where' clauses as `fresh' clauses + when the right-hand side is a call to `variable-not-in' or + `variables-not-in' + + * changed typesetting of meta-variables to render anything following + a caret (^) as a superscript + + * minor bug fixes v4.2.4 From 18276161b857e362aa214fe6c826eebf38a5a7c0 Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Tue, 30 Mar 2010 15:26:08 +0000 Subject: [PATCH 023/202] - Limiting the size of DrDr emails svn: r18670 --- collects/meta/drdr/analyze.ss | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/collects/meta/drdr/analyze.ss b/collects/meta/drdr/analyze.ss index 4c7c6d99d2..25ea753910 100644 --- a/collects/meta/drdr/analyze.ss +++ b/collects/meta/drdr/analyze.ss @@ -107,6 +107,7 @@ [responsible-ht-id->str (hash/c symbol? string?)] [responsible-ht-difference (responsible-ht/c responsible-ht/c . -> . responsible-ht/c)]) +(define ERROR-LIMIT 50) (define (notify cur-rev start end duration @@ -174,7 +175,8 @@ (if (empty? paths) empty (list (format "\t~a" id) - (for/list ([f (in-list paths)]) + (for/list ([f (in-list paths)] + [i (in-range ERROR-LIMIT)]) (format "\t\t~a" (path->url f))) "")))) "") @@ -185,7 +187,8 @@ (for/list ([(id files) (in-hash (hash-ref responsible-ht r))] #:when (not (symbol=? id 'changes))) (list (format "\t~a:" id) - (for/list ([f (in-list files)]) + (for/list ([f (in-list files)] + [i (in-range ERROR-LIMIT)]) (format "\t\t~a" (path->url f))) "")) "")))))) From 04d1fa6a268a63a420c5cbf9918194e9e2055a72 Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Tue, 30 Mar 2010 17:05:51 +0000 Subject: [PATCH 024/202] Parsing patch from Dave Gurnell svn: r18671 --- collects/srfi/19/time.ss | 3 +++ collects/tests/srfi/19/tests.ss | 46 +++++++++++++++++++++++---------- doc/srfi-std/srfi-19.html | 5 ++++ 3 files changed, 40 insertions(+), 14 deletions(-) diff --git a/collects/srfi/19/time.ss b/collects/srfi/19/time.ss index aade919c7a..c352413573 100644 --- a/collects/srfi/19/time.ss +++ b/collects/srfi/19/time.ss @@ -1493,6 +1493,9 @@ (char=? c #\-))) tm:zone-reader (lambda (val object) (tm:set-date-zone-offset! object val))) + ; PLT-specific extension for 2- or 4-digit years: + (list #\? char-numeric? ireader4 (lambda (val object) + (tm:set-date-year! object (tm:natural-year val)))) ))) (define (tm:string->date date index format-string str-len port template-string) diff --git a/collects/tests/srfi/19/tests.ss b/collects/tests/srfi/19/tests.ss index 379d730c2d..7ef340b0a7 100644 --- a/collects/tests/srfi/19/tests.ss +++ b/collects/tests/srfi/19/tests.ss @@ -1,11 +1,12 @@ #lang scheme/base ;; Tests by Will Fitzgerald, augmented by: -;; John Clements -- 2004-08-16 -;; Dave Gurnell (string->date, date->string) -- 2007-09-14 -;; Dave Gurnell (time{=,<,>,<=,>=}?) -- 2009-11-26 -;; John Clements (nanoseconds off by x100) -- 2009-12-15 - +;; John Clements -- 2004-08-16 +;; Dave Gurnell (string->date, date->string) -- 2007-09-14 +;; Dave Gurnell (time{=,<,>,<=,>=}?) -- 2009-11-26 +;; John Clements (nanoseconds off by x100) -- 2009-12-15 +;; Dave Gurnell (serializable dates and times) -- 2010-03-03 +;; Dave Gurnell (added ~x for string->date) -- 2010-03-10 (require scheme/serialize srfi/19/time) @@ -148,7 +149,7 @@ - (test-case "[DJG] date->string conversions of dates with nanosecond components" + (test-case "date->string conversions of dates with nanosecond components" (check-equal? (date->string (srfi:make-date 123456789 2 3 4 5 6 2007 0) "~N") "123456789") (check-equal? (date->string (srfi:make-date 12345678 2 3 4 5 6 2007 0) "~N") "012345678") (check-equal? (date->string (srfi:make-date 1234567 2 3 4 5 6 2007 0) "~N") "001234567") @@ -159,7 +160,7 @@ (check-equal? (date->string (srfi:make-date 12 2 3 4 5 6 2007 0) "~N") "000000012") (check-equal? (date->string (srfi:make-date 1 2 3 4 5 6 2007 0) "~N") "000000001")) - (test-case "[DJG] string->date conversions of dates with nanosecond components" + (test-case "string->date conversions of dates with nanosecond components" (check-equal? (string->date "12:00:00.123456789" "~H:~M:~S.~N") (srfi:make-date 123456789 0 0 12 #t #t #t cur-tz) "check 1") (check-equal? (string->date "12:00:00.12345678" "~H:~M:~S.~N") (srfi:make-date 123456780 0 0 12 #t #t #t cur-tz) "check 2") (check-equal? (string->date "12:00:00.1234567" "~H:~M:~S.~N") (srfi:make-date 123456700 0 0 12 #t #t #t cur-tz) "check 3") @@ -179,6 +180,23 @@ (check-equal? (string->date "12:00:00.000000012" "~H:~M:~S.~N") (srfi:make-date 12 0 0 12 #t #t #t cur-tz) "check 17") (check-equal? (string->date "12:00:00.000000001" "~H:~M:~S.~N") (srfi:make-date 1 0 0 12 #t #t #t cur-tz) "check 18")) + (test-case "interpretation of 1- to 4-digit years by ~y, ~Y and ~?:" + ; ~y: + (check-exn exn:fail? (lambda () (string->date "1-03-02" "~y-~m-~d"))) + (check-not-exn (lambda () (check-equal? (string->date "10-03-02" "~y-~m-~d") (srfi:make-date 0 0 0 0 2 3 2010 cur-tz)))) + (check-exn exn:fail? (lambda () (string->date "100-03-02" "~y-~m-~d"))) + (check-exn exn:fail? (lambda () (string->date "1000-03-02" "~y-~m-~d"))) + ; ~Y: + (check-not-exn (lambda () (check-equal? (string->date "1-03-02" "~Y-~m-~d") (srfi:make-date 0 0 0 0 2 3 1 cur-tz)))) + (check-not-exn (lambda () (check-equal? (string->date "10-03-02" "~Y-~m-~d") (srfi:make-date 0 0 0 0 2 3 10 cur-tz)))) + (check-not-exn (lambda () (check-equal? (string->date "100-03-02" "~Y-~m-~d") (srfi:make-date 0 0 0 0 2 3 100 cur-tz)))) + (check-not-exn (lambda () (check-equal? (string->date "1000-03-02" "~Y-~m-~d") (srfi:make-date 0 0 0 0 2 3 1000 cur-tz)))) + ; ~? (PLT-specific extension for 2- or 4-digit years: + (check-not-exn (lambda () (check-equal? (string->date "1-03-02" "~?-~m-~d") (srfi:make-date 0 0 0 0 2 3 2001 cur-tz)))) + (check-not-exn (lambda () (check-equal? (string->date "10-03-02" "~?-~m-~d") (srfi:make-date 0 0 0 0 2 3 2010 cur-tz)))) + (check-not-exn (lambda () (check-equal? (string->date "100-03-02" "~?-~m-~d") (srfi:make-date 0 0 0 0 2 3 100 cur-tz)))) + (check-not-exn (lambda () (check-equal? (string->date "1000-03-02" "~?-~m-~d") (srfi:make-date 0 0 0 0 2 3 1000 cur-tz))))) + (test-case "date<->julian-day conversion" (check = 365 (- (date->julian-day (srfi:make-date 0 0 0 0 1 1 2004 0)) (date->julian-day (srfi:make-date 0 0 0 0 1 1 2003 0)))) @@ -198,17 +216,17 @@ ;; nanosecnds off by a factor of 100... (test-case "nanosecond order-of-magnitude" - ;; half a second should be within 1/10th of 10^9 / 2 nanoseconds (currently off by a factor of 100) - (check-within (let ([t (date-nanosecond (current-date))]) - (sleep 0.5) - (abs (- (date-nanosecond (current-date)) t))) - (* 1/2 (expt 10 9)) - (* 1/10 (expt 10 9)))))) + ;; half a second should be within 1/10th of 10^9 / 2 nanoseconds (currently off by a factor of 100) + (check-within (let ([t (date-nanosecond (current-date))]) + (sleep 0.5) + (abs (- (date-nanosecond (current-date)) t))) + (* 1/2 (expt 10 9)) + (* 1/10 (expt 10 9)))))) ; Helper checks and procedures ----------------- (define-simple-check (check-within actual expected epsilon) - (< (abs (- actual expected)) epsilon)) + (< (abs (- actual expected)) epsilon)) (define-check (check-one-utc-tai-edge utc tai-diff tai-last-diff) (let* (;; right on the edge they should be the same diff --git a/doc/srfi-std/srfi-19.html b/doc/srfi-std/srfi-19.html index ddd656c152..e48dc26021 100644 --- a/doc/srfi-std/srfi-19.html +++ b/doc/srfi-std/srfi-19.html @@ -463,6 +463,10 @@ sting as is; except escape characters (indicate by the tilde) indicate special c converters; implementations are free to extend this list. +

PLT-specific extensions

+ +

The ~? wildcard is specific to the PLT implementation of string->date: it parses 1 and 2 digit years like ~y and 3 and 4 digit years like ~Y.

+ @@ -534,6 +538,7 @@ converters; implementations are free to extend this list. + From 0b33e155539b5895b77d5c84ae97a8760706917e Mon Sep 17 00:00:00 2001 From: Matthias Felleisen Date: Tue, 30 Mar 2010 17:41:31 +0000 Subject: [PATCH 025/202] committed rest of fix svn: r18672 --- collects/2htdp/universe.ss | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/collects/2htdp/universe.ss b/collects/2htdp/universe.ss index 0a04c65e7a..4145ed508c 100644 --- a/collects/2htdp/universe.ss +++ b/collects/2htdp/universe.ss @@ -80,7 +80,9 @@ key-event? ;; Any -> Boolean : KEY-EVTS key=? ;; KEY-EVTS KEY-EVTS -> Boolean ;; IP : a string that points to a machine on the net - LOCALHOST ;; IP + ) + +(provide LOCALHOST ;; IP ) (provide-higher-order-primitive @@ -241,15 +243,18 @@ iworld? ;; Any -> Boolean iworld=? ;; World World -> Boolean iworld-name ;; World -> Symbol - iworld1 ;; sample worlds - iworld2 - iworld3 ;; type Bundle = (make-bundle [Listof World] Universe [Listof Mail]) ;; type Mail = (make-mail World S-expression) make-bundle ;; [Listof World] Universe [Listof Mail] -> Bundle bundle? ;; is this a bundle? make-mail ;; World S-expression -> Mail mail? ;; is this a real mail? + ) + +(provide + iworld1 ;; sample worlds + iworld2 + iworld3 universe ;; : see below ) From 0289edf0cb33dedd42476f87685ba9553adb776f Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Tue, 30 Mar 2010 17:42:16 +0000 Subject: [PATCH 026/202] Repairing SchemeUnit tests re: DrDr svn: r18673 --- collects/schemeunit/text-ui.ss | 204 ++++++++++-------- .../tests/schemeunit/all-schemeunit-tests.ss | 8 +- collects/tests/schemeunit/run-tests.ss | 6 +- collects/tests/schemeunit/text-ui-test.ss | 139 ++++++------ 4 files changed, 184 insertions(+), 173 deletions(-) diff --git a/collects/schemeunit/text-ui.ss b/collects/schemeunit/text-ui.ss index fb900d342a..0115b0130f 100644 --- a/collects/schemeunit/text-ui.ss +++ b/collects/schemeunit/text-ui.ss @@ -57,12 +57,12 @@ ;; Prints a summary of the test result (define (display-ticker result) (cond - ((test-error? result) - (display "!")) - ((test-failure? result) - (display "-")) - (else - (display ".")))) + ((test-error? result) + (display "!")) + ((test-failure? result) + (display "-")) + (else + (display ".")))) ;; display-test-preamble : test-result -> (hash-monad-of void) (define (display-test-preamble result) @@ -72,7 +72,7 @@ (begin (display-delimiter) hash)))) - + ;; display-test-postamble : test-result -> (hash-monad-of void) (define (display-test-postamble result) (lambda (hash) @@ -86,16 +86,16 @@ ;; display-result : test-result -> void (define (display-result result) (cond - ((test-error? result) - (display-test-name (test-result-test-case-name result)) - (display-error) - (newline)) - ((test-failure? result) - (display-test-name (test-result-test-case-name result)) - (display-failure) - (newline)) - (else - (void)))) + ((test-error? result) + (display-test-name (test-result-test-case-name result)) + (display-error) + (newline)) + ((test-failure? result) + (display-test-name (test-result-test-case-name result)) + (display-failure) + (newline)) + (else + (void)))) ;; strip-redundant-parms : (list-of check-info) -> (list-of check-info) @@ -107,66 +107,66 @@ (define (binary-check-this-frame? stack) (let loop ([stack stack]) (cond - [(null? stack) #f] - [(check-name? (car stack)) #f] - [(check-actual? (car stack)) #t] - [else (loop (cdr stack))]))) + [(null? stack) #f] + [(check-name? (car stack)) #f] + [(check-actual? (car stack)) #t] + [else (loop (cdr stack))]))) (let loop ([stack stack]) (cond - [(null? stack) null] - [(check-params? (car stack)) - (if (binary-check-this-frame? stack) - (loop (cdr stack)) - (cons (car stack) (loop (cdr stack))))] - [else (cons (car stack) (loop (cdr stack)))]))) - - + [(null? stack) null] + [(check-params? (car stack)) + (if (binary-check-this-frame? stack) + (loop (cdr stack)) + (cons (car stack) (loop (cdr stack))))] + [else (cons (car stack) (loop (cdr stack)))]))) + + ;; display-context : test-result [(U #t #f)] -> void (define (display-context result [verbose? #f]) (cond - [(test-failure? result) - (let* ([exn (test-failure-result result)] - [stack (exn:test:check-stack exn)]) - (textui-display-check-info-stack stack verbose?))] - [(test-error? result) - (let ([exn (test-error-result result)]) - (textui-display-check-info-stack (check-info-stack (exn-continuation-marks exn))) - (display-exn exn))] - [else (void)])) + [(test-failure? result) + (let* ([exn (test-failure-result result)] + [stack (exn:test:check-stack exn)]) + (textui-display-check-info-stack stack verbose?))] + [(test-error? result) + (let ([exn (test-error-result result)]) + (textui-display-check-info-stack (check-info-stack (exn-continuation-marks exn))) + (display-exn exn))] + [else (void)])) (define (textui-display-check-info-stack stack [verbose? #f]) (for-each (lambda (info) (cond - [(check-name? info) - (display-check-info info)] - [(check-location? info) - (display-check-info-name-value - 'location - (trim-current-directory - (location->string - (check-info-value info))) - display)] - [(check-params? info) - (display-check-info-name-value - 'params - (check-info-value info) - (lambda (v) (map pretty-print v)))] - [(check-actual? info) - (display-check-info-name-value - 'actual - (check-info-value info) - pretty-print)] - [(check-expected? info) - (display-check-info-name-value - 'expected - (check-info-value info) - pretty-print)] - [(and (check-expression? info) - (not verbose?)) - (void)] - [else - (display-check-info info)])) + [(check-name? info) + (display-check-info info)] + [(check-location? info) + (display-check-info-name-value + 'location + (trim-current-directory + (location->string + (check-info-value info))) + display)] + [(check-params? info) + (display-check-info-name-value + 'params + (check-info-value info) + (lambda (v) (map pretty-print v)))] + [(check-actual? info) + (display-check-info-name-value + 'actual + (check-info-value info) + pretty-print)] + [(check-expected? info) + (display-check-info-name-value + 'expected + (check-info-value info) + pretty-print)] + [(and (check-expression? info) + (not verbose?)) + (void)] + [else + (display-check-info info)])) (if verbose? stack (strip-redundant-params stack)))) @@ -174,27 +174,27 @@ ;; display-verbose-check-info : test-result -> void (define (display-verbose-check-info result) (cond - ((test-failure? result) - (let* ((exn (test-failure-result result)) - (stack (exn:test:check-stack exn))) - (for-each - (lambda (info) - (cond - ((check-location? info) - (display "location: ") - (display (trim-current-directory - (location->string - (check-info-value info))))) - (else - (display (check-info-name info)) - (display ": ") - (write (check-info-value info)))) - (newline)) - stack))) - ((test-error? result) - (display-exn (test-error-result result))) - (else - (void)))) + ((test-failure? result) + (let* ((exn (test-failure-result result)) + (stack (exn:test:check-stack exn))) + (for-each + (lambda (info) + (cond + ((check-location? info) + (display "location: ") + (display (trim-current-directory + (location->string + (check-info-value info))))) + (else + (display (check-info-name info)) + (display ": ") + (write (check-info-value info)))) + (newline)) + stack))) + ((test-error? result) + (display-exn (test-error-result result))) + (else + (void)))) (define (std-test/text-ui display-context test) (parameterize ([current-output-port (current-error-port)]) @@ -221,23 +221,37 @@ (monad-value ((compose (sequence* - (display-counter) + (display-counter*) (counter->vector)) (match-lambda - ((vector s f e) - (return-hash (+ f e))))) + ((vector s f e) + (return-hash (+ f e))))) monad))) - + +(define (display-counter*) + (compose (counter->vector) + (match-lambda + [(vector s f e) + (if (and (zero? f) (zero? e)) + (display-counter) + (lambda args + (parameterize ([current-output-port (current-error-port)]) + (apply (display-counter) args))))]))) + ;; run-tests : test [(U 'quiet 'normal 'verbose)] -> integer (define (run-tests test [mode 'normal]) (monad-value ((compose (sequence* - (display-counter) + (case mode + [(normal verbose) + (display-counter*)] + [(quiet) + (lambda (a) a)]) (counter->vector)) (match-lambda - ((vector s f e) - (return-hash (+ f e))))) + ((vector s f e) + (return-hash (+ f e))))) (case mode ((quiet) (fold-test-results diff --git a/collects/tests/schemeunit/all-schemeunit-tests.ss b/collects/tests/schemeunit/all-schemeunit-tests.ss index 1b8282f295..d943eaf8eb 100644 --- a/collects/tests/schemeunit/all-schemeunit-tests.ss +++ b/collects/tests/schemeunit/all-schemeunit-tests.ss @@ -18,7 +18,7 @@ "text-ui-util-test.ss") (provide all-schemeunit-tests - success-and-failure-tests) + failure-tests) (define all-schemeunit-tests (test-suite @@ -41,11 +41,9 @@ format-tests )) -;; These tests fail. The are intended to do this so a human can manually check the output they produce. They should not be run by DrDr as they will generate bogus warnings. -(define success-and-failure-tests +(define failure-tests (test-suite - "Successes and Failures" - all-schemeunit-tests + "Failures" (test-case "Intended to fail" (fail)) (test-case "Also intended to fail" (check-eq? 'apples 'orange)) (test-equal? "Yet again intended to fail" "apples" "oranges") diff --git a/collects/tests/schemeunit/run-tests.ss b/collects/tests/schemeunit/run-tests.ss index e5346f38ad..3852cb9dd3 100644 --- a/collects/tests/schemeunit/run-tests.ss +++ b/collects/tests/schemeunit/run-tests.ss @@ -6,5 +6,7 @@ (run-tests all-schemeunit-tests) -;; Don't run the failing tests by default. Switch the comments if you want to inspect the visual appearance of failing test's output. -;(run-tests success-and-failure-tests) +;; These tests should all error, so we switch the meaning of correct and incorrect. If the error display changes significantly, DrDr will catch it +(parameterize ([current-error-port (current-output-port)] + [current-output-port (current-error-port)]) + (run-tests failure-tests)) diff --git a/collects/tests/schemeunit/text-ui-test.ss b/collects/tests/schemeunit/text-ui-test.ss index ca7d336a82..c5daf759eb 100644 --- a/collects/tests/schemeunit/text-ui-test.ss +++ b/collects/tests/schemeunit/text-ui-test.ss @@ -29,6 +29,8 @@ #lang scheme/base (require scheme/runtime-path + scheme/pretty + scheme/port srfi/1 srfi/13 schemeunit @@ -36,35 +38,22 @@ (provide text-ui-tests) +(define-syntax-rule (with-all-output-to-string e ...) + (with-all-output-to-string* (lambda () e ...))) -;; Reimplement with-output-to-string to avoid dependency on -;; io.plt, which in turn depends on SchemeUnit 1.2, which -;; has not been ported to PLT 4. -(define-syntax with-output-to-string - (syntax-rules () - [(with-output-to-string expr ...) - (let ([p (open-output-string)]) - (parameterize ([current-output-port p]) - expr ...) - (get-output-string p))])) - -(define-syntax with-error-to-string - (syntax-rules () - [(with-error-to-string expr ...) - (let ([p (open-output-string)]) - (parameterize ([current-error-port p]) - expr ...) - (get-output-string p))])) +(define (with-all-output-to-string* thnk) + (with-output-to-string + (lambda () + (parameterize ([current-error-port (current-output-port)]) + (thnk))))) (define-runtime-path here ".") ;; with-silent-output (() -> any) -> any (define (with-silent-output thunk) - (let ([out (open-output-string)] - [err (open-output-string)]) - (parameterize ([current-output-port out] - [current-error-port err]) - (thunk)))) + (parameterize ([current-output-port (open-output-nowhere)] + [current-error-port (open-output-nowhere)]) + (thunk))) (define (failing-test) (run-tests @@ -109,7 +98,7 @@ (test-case "Binary check displays actual and expected in failure error message" - (let ((op (with-error-to-string (failing-test)))) + (let ((op (with-all-output-to-string (failing-test)))) (check string-contains op "expected") @@ -119,14 +108,15 @@ (test-case "Binary check doesn't display params" - (let ((op (with-error-to-string (failing-test)))) + (let ((op (with-all-output-to-string (failing-test)))) (check (lambda (out str) (not (string-contains out str))) op "params"))) (test-case "Binary check output is pretty printed" - (let ([op (with-error-to-string (failing-binary-test/complex-params))]) + (let ([op (parameterize ([pretty-print-columns 80]) + (with-all-output-to-string (failing-binary-test/complex-params)))]) (check string-contains op "((0 1 2 3 4 5 6 7 8 9 10 11 12 13 14) @@ -135,7 +125,8 @@ (test-case "Non-binary check output is pretty printed" - (let ([op (with-error-to-string (failing-test/complex-params))]) + (let ([op (parameterize ([pretty-print-columns 80]) + (with-all-output-to-string (failing-test/complex-params)))]) (check string-contains op "((0 1 2 3 4 5 6 7 8 9 10 11 12 13 14) @@ -145,14 +136,14 @@ (test-case "Location trimmed when file is under current directory" (parameterize ((current-directory here)) - (let ((op (with-error-to-string (failing-test)))) + (let ((op (with-all-output-to-string (failing-test)))) (check string-contains op "location: text-ui-test.ss")))) (test-case "Name and location displayed before actual/expected" - (let ((op (with-error-to-string (failing-test)))) + (let ((op (with-all-output-to-string (failing-test)))) (let ((name-idx (string-contains op "name:")) (loc-idx (string-contains op "location:")) (actual-idx (string-contains op "actual:")) @@ -163,65 +154,71 @@ (test-case "Quiet mode is quiet" - (let ((op1 (with-error-to-string (quiet-failing-test))) - (op2 (with-error-to-string (quiet-error-test)))) + (let ((op1 (with-all-output-to-string (quiet-failing-test))) + (op2 (with-all-output-to-string (quiet-error-test)))) (check string=? op1 "") (check string=? op2 ""))) - + (test-case "Number of unsuccessful tests returned" (check-equal? (with-silent-output failing-test) 1) (check-equal? (with-silent-output quiet-failing-test) 1) (check-equal? (with-silent-output quiet-error-test) 1) (check-equal? (with-silent-output - (lambda () - (run-tests - (test-suite - "Dummy" - (test-case "Dummy" (check-equal? 1 1))) - 'quiet))) + (lambda () + (run-tests + (test-suite + "Dummy" + (test-case "Dummy" (check-equal? 1 1))) + 'quiet))) 0)) (test-case "run-tests runs suite before/after actions in quiet mode" - (let ([foo 1]) - (run-tests - (test-suite - "Foo" - #:before (lambda () (set! foo 2)) - #:after (lambda () (set! foo 3)) - (test-case - "Foo check" - (check = foo 2))) - 'quiet) - (check = foo 3))) + (with-silent-output + (λ () + (let ([foo 1]) + (run-tests + (test-suite + "Foo" + #:before (lambda () (set! foo 2)) + #:after (lambda () (set! foo 3)) + (test-case + "Foo check" + (check = foo 2))) + 'quiet) + (check = foo 3))))) (test-case "run-tests runs suite before/after actions in normal mode" - (let ([foo 1]) - (run-tests - (test-suite - "Foo" - #:before (lambda () (set! foo 2)) - #:after (lambda () (set! foo 3)) - (test-case - "Foo check" - (check = foo 2))) - 'normal) - (check = foo 3))) + (with-silent-output + (λ () + (let ([foo 1]) + (run-tests + (test-suite + "Foo" + #:before (lambda () (set! foo 2)) + #:after (lambda () (set! foo 3)) + (test-case + "Foo check" + (check = foo 2))) + 'normal) + (check = foo 3))))) (test-case "run-tests runs suite before/after actions in verbose mode" - (let ([foo 1]) - (run-tests - (test-suite - "Foo" - #:before (lambda () (set! foo 2)) - #:after (lambda () (set! foo 3)) - (test-case - "Foo check" - (check = foo 2))) - 'verbose) - (check = foo 3))) + (with-silent-output + (λ () + (let ([foo 1]) + (run-tests + (test-suite + "Foo" + #:before (lambda () (set! foo 2)) + #:after (lambda () (set! foo 3)) + (test-case + "Foo check" + (check = foo 2))) + 'verbose) + (check = foo 3))))) )) From a10c42a852136a31dbbc9a2dfdedc71fb16e0e10 Mon Sep 17 00:00:00 2001 From: Kevin Tew Date: Tue, 30 Mar 2010 17:55:59 +0000 Subject: [PATCH 027/202] simplify _make_struct_type signature svn: r18674 --- src/mzscheme/src/struct.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/mzscheme/src/struct.c b/src/mzscheme/src/struct.c index b60db7af6f..19a24aa87f 100644 --- a/src/mzscheme/src/struct.c +++ b/src/mzscheme/src/struct.c @@ -3518,7 +3518,7 @@ static Scheme_Object *add_struct_type_chaperone_guards(Scheme_Object *o, Scheme_ return scheme_make_pair(orig_guard, first); } -static Scheme_Object *_make_struct_type(Scheme_Object *basesym, const char *base, int blen, +static Scheme_Object *_make_struct_type(Scheme_Object *base, Scheme_Object *parent, Scheme_Object *inspector, int num_fields, @@ -3554,14 +3554,8 @@ static Scheme_Object *_make_struct_type(Scheme_Object *basesym, const char *base struct_type->parent_types[j] = parent_type->parent_types[j]; } - { - Scheme_Object *tn; - if (basesym) - tn = basesym; - else - tn = scheme_intern_exact_symbol(base, blen); - struct_type->name = tn; - } + struct_type->name = base; + struct_type->num_slots = num_fields + num_uninit_fields + (parent_type ? parent_type->num_slots : 0); struct_type->num_islots = num_fields + (parent_type ? parent_type->num_islots : 0); if (parent_type) @@ -3856,7 +3850,7 @@ Scheme_Object *scheme_make_struct_type(Scheme_Object *base, Scheme_Object *properties, Scheme_Object *guard) { - return _make_struct_type(base, NULL, 0, + return _make_struct_type(base, parent, inspector, num_fields, num_uninit, uninit_val, properties, @@ -3872,7 +3866,7 @@ Scheme_Object *scheme_make_proc_struct_type(Scheme_Object *base, Scheme_Object *proc_attr, Scheme_Object *guard) { - return _make_struct_type(base, NULL, 0, + return _make_struct_type(base, parent, inspector, num_fields, num_uninit, uninit_val, scheme_null, @@ -3887,6 +3881,7 @@ Scheme_Object *scheme_make_struct_type_from_string(const char *base, Scheme_Object *guard, int immutable) { + Scheme_Object *basesym; Scheme_Object *imm = scheme_null; int i; @@ -3896,7 +3891,9 @@ Scheme_Object *scheme_make_struct_type_from_string(const char *base, } } - return _make_struct_type(NULL, base, strlen(base), + basesym = scheme_intern_exact_symbol(base, strlen(base)); + + return _make_struct_type(basesym, parent, scheme_false, num_fields, 0, NULL, props, @@ -4070,7 +4067,7 @@ static Scheme_Object *make_struct_type(int argc, Scheme_Object **argv) } } - type = (Scheme_Struct_Type *)_make_struct_type(argv[0], NULL, 0, + type = (Scheme_Struct_Type *)_make_struct_type(argv[0], SCHEME_FALSEP(argv[1]) ? NULL : argv[1], inspector, initc, uninitc, @@ -4274,7 +4271,7 @@ Scheme_Struct_Type *scheme_lookup_prefab_type(Scheme_Object *key, int field_coun if (parent && (icnt + parent->num_slots > MAX_STRUCT_FIELD_COUNT)) return NULL; - parent = (Scheme_Struct_Type *)_make_struct_type(name, NULL, 0, + parent = (Scheme_Struct_Type *)_make_struct_type(name, (Scheme_Object *)parent, scheme_false, icnt, ucnt, From 5695d71ebc43272ad2435f118e18816009185e95 Mon Sep 17 00:00:00 2001 From: Kevin Tew Date: Tue, 30 Mar 2010 17:56:13 +0000 Subject: [PATCH 028/202] [struct.c] convert to char* immutable_array earlier svn: r18675 --- src/mzscheme/src/struct.c | 184 ++++++++++++++++++++------------------ 1 file changed, 96 insertions(+), 88 deletions(-) diff --git a/src/mzscheme/src/struct.c b/src/mzscheme/src/struct.c index 19a24aa87f..3e9dd33ebe 100644 --- a/src/mzscheme/src/struct.c +++ b/src/mzscheme/src/struct.c @@ -3526,7 +3526,7 @@ static Scheme_Object *_make_struct_type(Scheme_Object *base, Scheme_Object *uninit_val, Scheme_Object *props, Scheme_Object *proc_attr, - Scheme_Object *immutable_pos_list, + char *immutable_array, Scheme_Object *guard) { Scheme_Struct_Type *struct_type, *parent_type; @@ -3601,10 +3601,7 @@ static Scheme_Object *_make_struct_type(Scheme_Object *base, struct_type->uninit_val = uninit_val; if ((struct_type->proc_attr && SCHEME_INTP(struct_type->proc_attr)) - || !SCHEME_NULLP(immutable_pos_list) || (proc_attr && SCHEME_INTP(proc_attr))) { - Scheme_Object *l, *a; - char *ims; int n, ni, p; n = struct_type->num_slots; @@ -3613,43 +3610,19 @@ static Scheme_Object *_make_struct_type(Scheme_Object *base, n -= parent_type->num_slots; ni -= parent_type->num_islots; } - ims = (char *)scheme_malloc_atomic(n); - memset(ims, 0, n); if (proc_attr && SCHEME_INTP(proc_attr)) { p = SCHEME_INT_VAL(proc_attr); - if (p < ni) - ims[p] = 1; - } - - for (l = immutable_pos_list; SCHEME_PAIRP(l); l = SCHEME_CDR(l)) { - a = SCHEME_CAR(l); - if (SCHEME_INTP(a)) - p = SCHEME_INT_VAL(a); - else - p = n; /* too big */ - - if (p >= n) { - scheme_raise_exn(MZEXN_FAIL_CONTRACT, - "make-struct-type: index %V for immutable field >= initialized-field count %d in list: %V", - a, - ni, - immutable_pos_list); - return NULL; + if (p < ni) { + if (!immutable_array) { + immutable_array= (char *)scheme_malloc_atomic(n); + memset(immutable_array, 0, n); + } + immutable_array[p] = 1; } - - if (ims[p]) { - scheme_raise_exn(MZEXN_FAIL_CONTRACT, - "make-struct-type: redundant immutable field index %V in list: %V", - a, immutable_pos_list); - return NULL; - } - - ims[p] = 1; } - - struct_type->immutables = ims; } + struct_type->immutables = immutable_array; /* We add properties last, because a property guard receives a struct-type descriptor. */ @@ -3854,7 +3827,7 @@ Scheme_Object *scheme_make_struct_type(Scheme_Object *base, parent, inspector, num_fields, num_uninit, uninit_val, properties, - NULL, scheme_null, + NULL, NULL, guard); } @@ -3870,7 +3843,7 @@ Scheme_Object *scheme_make_proc_struct_type(Scheme_Object *base, parent, inspector, num_fields, num_uninit, uninit_val, scheme_null, - proc_attr, scheme_null, + proc_attr, NULL, guard); } @@ -3882,13 +3855,11 @@ Scheme_Object *scheme_make_struct_type_from_string(const char *base, int immutable) { Scheme_Object *basesym; - Scheme_Object *imm = scheme_null; - int i; + char *immutable_array = NULL; if (immutable) { - for (i = 0; i < num_fields; i++) { - imm = scheme_make_pair(scheme_make_integer(i), imm); - } + immutable_array = (char *)scheme_malloc_atomic(num_fields); + memset(immutable_array, 1, num_fields); } basesym = scheme_intern_exact_symbol(base, strlen(base)); @@ -3896,8 +3867,8 @@ Scheme_Object *scheme_make_struct_type_from_string(const char *base, return _make_struct_type(basesym, parent, scheme_false, num_fields, 0, - NULL, props, - NULL, imm, + NULL, props, + NULL, immutable_array, guard); } @@ -3927,6 +3898,47 @@ Scheme_Struct_Type *hash_prefab(Scheme_Struct_Type *type) return type; } + +static char* immutable_pos_list_to_immutable_array(Scheme_Object *immutable_pos_list, int localfieldc) { + char* ia; + Scheme_Object *l; + ia = (char *)scheme_malloc_atomic(localfieldc); + memset(ia, 0, localfieldc); + + for (l = immutable_pos_list; l && SCHEME_PAIRP(l); l = SCHEME_CDR(l)) { + int a_val; + Scheme_Object *a; + a = SCHEME_CAR(l); + if (!SCHEME_INTP(a)) { + scheme_raise_exn(MZEXN_FAIL_CONTRACT, + "make-struct-type: index %V for immutable field is not a exact non-negative fixnum integer in list %V", + a, immutable_pos_list); + return NULL; + } + a_val = SCHEME_INT_VAL(a); + if (a_val < 0) { + scheme_raise_exn(MZEXN_FAIL_CONTRACT, + "make-struct-type: index %d for immutable field < 0 in list: %V", + a_val, immutable_pos_list); + return NULL; + } + if (a_val >= localfieldc) { + scheme_raise_exn(MZEXN_FAIL_CONTRACT, + "make-struct-type: index %d for immutable field >= initialized-field count %d in list: %V", + a_val, localfieldc, immutable_pos_list); + return NULL; + } + if (ia[a_val]) { + scheme_raise_exn(MZEXN_FAIL_CONTRACT, + "make-struct-type: redundant immutable field index %d in list: %V", + a_val, immutable_pos_list); + return NULL; + } + ia[a_val] = 1; + } + + return ia; +} static Scheme_Object *make_struct_type(int argc, Scheme_Object **argv) { @@ -3935,6 +3947,7 @@ static Scheme_Object *make_struct_type(int argc, Scheme_Object **argv) Scheme_Object *inspector = NULL, **names, *uninit_val; Scheme_Struct_Type *type; Scheme_Object *proc_attr = NULL, *immutable_pos_list = scheme_null, *guard = NULL; + char* immutable_array; if (!SCHEME_SYMBOLP(argv[0])) scheme_wrong_type("make-struct-type", "symbol", 0, argc, argv); @@ -4005,18 +4018,7 @@ static Scheme_Object *make_struct_type(int argc, Scheme_Object **argv) if (argc > 8) { l = immutable_pos_list = argv[8]; - if (scheme_proper_list_length(l) < 0) - l = NULL; - for (; l && SCHEME_PAIRP(l); l = SCHEME_CDR(l)) { - a = SCHEME_CAR(l); - if (!((SCHEME_INTP(a) && (SCHEME_INT_VAL(a) >= 0)) - || (SCHEME_BIGNUMP(a) && !SCHEME_BIGPOS(a)))) { - l = NULL; - break; - } - } - - if (!l) { + if (scheme_proper_list_length(l) < 0) { scheme_wrong_type("make-struct-type", "list of exact non-negative integers", 8, argc, argv); @@ -4043,6 +4045,8 @@ static Scheme_Object *make_struct_type(int argc, Scheme_Object **argv) if (!inspector) inspector = scheme_get_param(scheme_current_config(), MZCONFIG_INSPECTOR); + immutable_array = immutable_pos_list_to_immutable_array(immutable_pos_list, initc + uninitc); + if (prefab) { const char *bad = NULL; Scheme_Object *parent = argv[1]; @@ -4073,7 +4077,7 @@ static Scheme_Object *make_struct_type(int argc, Scheme_Object **argv) initc, uninitc, uninit_val, props, proc_attr, - immutable_pos_list, + immutable_array, guard); if (prefab) { @@ -4156,11 +4160,42 @@ static Scheme_Object *make_prefab_key(Scheme_Struct_Type *type) return key; } +static char *mutability_data_to_immutability_data(int icnt, Scheme_Object *mutables) { + char *immutable_array = NULL; + + if (icnt > 0) { + immutable_array = (char *)scheme_malloc_atomic(icnt); + memset(immutable_array, 1, icnt); + + if (mutables) { + int i; + int len; + len = SCHEME_VEC_SIZE(mutables); + if (len > icnt) + return NULL; + + for (i = 0; i < len; i++) { + int a_val; + Scheme_Object *a; + a = SCHEME_VEC_ELS(mutables)[i]; + if (!SCHEME_INTP(a) + || (SCHEME_INT_VAL(a) < 0) + || (SCHEME_INT_VAL(a) >= icnt)) + return NULL; + a_val = SCHEME_INT_VAL(a); + immutable_array[a_val] = 0; + } + } + } + return immutable_array; +} + Scheme_Struct_Type *scheme_lookup_prefab_type(Scheme_Object *key, int field_count) { Scheme_Struct_Type *parent = NULL; - Scheme_Object *a, *uninit_val, *mutables, *immutable_pos_list, *name; - int i, ucnt, icnt, prev; + Scheme_Object *a, *uninit_val, *mutables, *name; + int ucnt, icnt; + char *immutable_array = NULL; if (SCHEME_SYMBOLP(key)) key = scheme_make_pair(key, scheme_null); @@ -4239,34 +4274,7 @@ Scheme_Struct_Type *scheme_lookup_prefab_type(Scheme_Object *key, int field_coun return NULL; name = a; - /* convert mutability data to immutability data */ - immutable_pos_list = scheme_null; - prev = -1; - if (mutables) { - int len; - len = SCHEME_VEC_SIZE(mutables); - if (len > icnt) - return NULL; - for (i = 0; i < len; i++) { - a = SCHEME_VEC_ELS(mutables)[i]; - if (!SCHEME_INTP(a) - || (SCHEME_INT_VAL(a) < 0) - || (SCHEME_INT_VAL(a) >= icnt) - || (SCHEME_INT_VAL(a) <= prev)) - return NULL; - while (prev + 1 < SCHEME_INT_VAL(a)) { - immutable_pos_list = scheme_make_pair(scheme_make_integer(prev + 1), - immutable_pos_list); - prev++; - } - prev++; - } - } - while (prev + 1 < icnt) { - immutable_pos_list = scheme_make_pair(scheme_make_integer(prev + 1), - immutable_pos_list); - prev++; - } + immutable_array = mutability_data_to_immutability_data(icnt + ucnt, mutables); if (parent && (icnt + parent->num_slots > MAX_STRUCT_FIELD_COUNT)) return NULL; @@ -4277,7 +4285,7 @@ Scheme_Struct_Type *scheme_lookup_prefab_type(Scheme_Object *key, int field_coun icnt, ucnt, uninit_val, scheme_null, NULL, - immutable_pos_list, + immutable_array, NULL); parent = hash_prefab(parent); From 7aedbc7d4c3940d74ae4915235039aead07db7af Mon Sep 17 00:00:00 2001 From: John Clements Date: Tue, 30 Mar 2010 18:04:27 +0000 Subject: [PATCH 029/202] release notes: goes in 4.2.5 release svn: r18676 --- doc/release-notes/stepper/HISTORY.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/release-notes/stepper/HISTORY.txt b/doc/release-notes/stepper/HISTORY.txt index 85223adce9..5ea0810eaa 100644 --- a/doc/release-notes/stepper/HISTORY.txt +++ b/doc/release-notes/stepper/HISTORY.txt @@ -1,6 +1,10 @@ Stepper ------- +Changse for v4.2.5: + +Non. + Changes for v4.2.4: Bug fixes. From cafd09299427b7b389c9d28d995024b28543a41e Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Tue, 30 Mar 2010 19:55:56 +0000 Subject: [PATCH 030/202] Adding another kind of error in xexpr svn: r18677 --- collects/web-server/private/xexpr.ss | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/collects/web-server/private/xexpr.ss b/collects/web-server/private/xexpr.ss index 5ce48bbea4..9fd5e15888 100644 --- a/collects/web-server/private/xexpr.ss +++ b/collects/web-server/private/xexpr.ss @@ -95,7 +95,11 @@ l)])) (define (format-elements l) - (map format-xexpr l)) + (if (list? l) + (map format-xexpr l) + (mark-error + "Expected a list of elements" + l))) (define (format-attributes l) (match l From 417be5d8e2726c12f84e7e3fa6f24aa74f463abc Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 30 Mar 2010 20:21:28 +0000 Subject: [PATCH 031/202] move definedness check for imported variable to link time instead of access time; add errortrace meta-language; tweak errortrace to avoid an unnecessary and loop-obscuring annotation; improve slightly bytecode optimizer's handling of w-c-m; improve JIT handling of w-c-m svn: r18678 --- collects/errortrace/errortrace-lib.ss | 1 + collects/errortrace/lang/body.ss | 20 + collects/errortrace/lang/reader.ss | 30 + .../errortrace/scribblings/errortrace.scrbl | 8 + collects/errortrace/stacktrace.ss | 560 +++++++++--------- collects/tests/future/future.ss | 50 +- src/mzscheme/src/env.c | 23 +- src/mzscheme/src/eval.c | 94 ++- src/mzscheme/src/future.c | 190 ++++-- src/mzscheme/src/future.h | 15 +- src/mzscheme/src/jit.c | 179 +++++- src/mzscheme/src/jit_ts.c | 78 +-- src/mzscheme/src/mzmark.c | 2 + src/mzscheme/src/mzmarksrc.c | 1 + src/mzscheme/src/schpriv.h | 8 +- src/mzscheme/src/schvers.h | 4 +- src/mzscheme/src/syntax.c | 42 +- 17 files changed, 842 insertions(+), 463 deletions(-) create mode 100644 collects/errortrace/lang/body.ss create mode 100644 collects/errortrace/lang/reader.ss diff --git a/collects/errortrace/errortrace-lib.ss b/collects/errortrace/errortrace-lib.ss index 9fa0f402e4..364f671256 100644 --- a/collects/errortrace/errortrace-lib.ss +++ b/collects/errortrace/errortrace-lib.ss @@ -8,6 +8,7 @@ scheme/contract scheme/unit scheme/runtime-path + (for-template scheme/base) (for-syntax scheme/base)) (define oprintf diff --git a/collects/errortrace/lang/body.ss b/collects/errortrace/lang/body.ss new file mode 100644 index 0000000000..c89d5b359e --- /dev/null +++ b/collects/errortrace/lang/body.ss @@ -0,0 +1,20 @@ +#lang scheme/base +(require (for-syntax scheme/base + syntax/strip-context + "../errortrace-lib.ss")) + +(provide (rename-out [module-begin #%module-begin])) + +(define-syntax (module-begin stx) + (syntax-case stx () + [(_ lang . body) + (let ([e (annotate-top + (local-expand #`(module . #,(strip-context #`(n lang . body))) + 'top-level + null) + 0)]) + (syntax-case e () + [(mod nm lang (mb . body)) + #'(#%plain-module-begin + (require (only-in lang) errortrace/errortrace-key) + . body)]))])) diff --git a/collects/errortrace/lang/reader.ss b/collects/errortrace/lang/reader.ss new file mode 100644 index 0000000000..b0f8dc71fd --- /dev/null +++ b/collects/errortrace/lang/reader.ss @@ -0,0 +1,30 @@ +(module reader scheme/base + (require syntax/module-reader) + + (provide (rename-out [et-read read] + [et-read-syntax read-syntax] + [et-get-info get-info])) + + (define (wrap-reader p) + (lambda args + (let ([r (apply p args)]) + ;; Re-write module to use `errortrace': + (if (syntax? r) + (syntax-case r () + [(mod name lang . body) + (quasisyntax/loc r + (mod name errortrace/lang/body (#,(datum->syntax #f '#%module-begin) lang . body)))]) + `(,(car r) ,(cadr r) errortrace/lang/body (#%module-begin . ,(cddr r))))))) + + (define-values (et-read et-read-syntax et-get-info) + (make-meta-reader + 'errortrace + "language path" + (lambda (str) + (let ([s (string->symbol + (string-append (bytes->string/latin-1 str) + "/lang/reader"))]) + (and (module-path? s) s))) + wrap-reader + wrap-reader + values))) diff --git a/collects/errortrace/scribblings/errortrace.scrbl b/collects/errortrace/scribblings/errortrace.scrbl index 92fbe8514d..aea23f9b09 100644 --- a/collects/errortrace/scribblings/errortrace.scrbl +++ b/collects/errortrace/scribblings/errortrace.scrbl @@ -99,6 +99,14 @@ top-level. The functions also can be accessed by importing @schememodname[errortrace/errortrace-lib], which does not install any handlers. +As a language name, @schememodname[errortrace] chains to another +language that is specified immediately after @schememodname[at-exp], +but instruments the module for debugging in the same way as if +@schememodname[errortrace] is required before loading the module from +source. Using the @schememodname[errortrace] meta-language is one way +to ensure that debugging instrumentation is present when the module is +compiled.} + @; --------------------------------------------- @subsection[#:tag "instrumentation-and-profiling"]{Instrumentation and Profiling} diff --git a/collects/errortrace/stacktrace.ss b/collects/errortrace/stacktrace.ss index 3d5e69db48..5b68746492 100644 --- a/collects/errortrace/stacktrace.ss +++ b/collects/errortrace/stacktrace.ss @@ -2,6 +2,7 @@ (require scheme/unit syntax/kerncase syntax/stx + (for-template scheme/base) (for-syntax scheme/base)) ; for matching (provide stacktrace@ stacktrace^ stacktrace-imports^) @@ -154,54 +155,54 @@ (with-syntax ([expr sexpr] [e se]) (kernel-syntax-case/phase sexpr phase - ;; negligible time to eval - [id - (identifier? sexpr) - (syntax (begin e expr))] - [(quote _) (syntax (begin e expr))] - [(quote-syntax _) (syntax (begin e expr))] - [(#%top . d) (syntax (begin e expr))] - [(#%variable-reference . d) (syntax (begin e expr))] - - ;; No tail effect, and we want to account for the time - [(#%plain-lambda . _) (syntax (begin0 expr e))] - [(case-lambda . _) (syntax (begin0 expr e))] - [(set! . _) (syntax (begin0 expr e))] - - [(let-values bindings . body) - (insert-at-tail* se sexpr phase)] - [(letrec-values bindings . body) - (insert-at-tail* se sexpr phase)] - - [(begin . _) - (insert-at-tail* se sexpr phase)] - [(with-continuation-mark . _) - (insert-at-tail* se sexpr phase)] - - [(begin0 body ...) - (certify sexpr (syntax (begin0 body ... e)))] - - [(if test then else) - ;; WARNING: se inserted twice! - (certify - sexpr - (rebuild - sexpr - (list - (cons #'then (insert-at-tail se (syntax then) phase)) - (cons #'else (insert-at-tail se (syntax else) phase)))))] - - [(#%plain-app . rest) - (if (stx-null? (syntax rest)) - ;; null constant - (syntax (begin e expr)) - ;; application; exploit guaranteed left-to-right evaluation - (insert-at-tail* se sexpr phase))] - - [_else - (error 'errortrace - "unrecognized (non-top-level) expression form: ~e" - (syntax->datum sexpr))]))) + ;; negligible time to eval + [id + (identifier? sexpr) + (syntax (begin e expr))] + [(quote _) (syntax (begin e expr))] + [(quote-syntax _) (syntax (begin e expr))] + [(#%top . d) (syntax (begin e expr))] + [(#%variable-reference . d) (syntax (begin e expr))] + + ;; No tail effect, and we want to account for the time + [(#%plain-lambda . _) (syntax (begin0 expr e))] + [(case-lambda . _) (syntax (begin0 expr e))] + [(set! . _) (syntax (begin0 expr e))] + + [(let-values bindings . body) + (insert-at-tail* se sexpr phase)] + [(letrec-values bindings . body) + (insert-at-tail* se sexpr phase)] + + [(begin . _) + (insert-at-tail* se sexpr phase)] + [(with-continuation-mark . _) + (insert-at-tail* se sexpr phase)] + + [(begin0 body ...) + (certify sexpr (syntax (begin0 body ... e)))] + + [(if test then else) + ;; WARNING: se inserted twice! + (certify + sexpr + (rebuild + sexpr + (list + (cons #'then (insert-at-tail se (syntax then) phase)) + (cons #'else (insert-at-tail se (syntax else) phase)))))] + + [(#%plain-app . rest) + (if (stx-null? (syntax rest)) + ;; null constant + (syntax (begin e expr)) + ;; application; exploit guaranteed left-to-right evaluation + (insert-at-tail* se sexpr phase))] + + [_else + (error 'errortrace + "unrecognized (non-top-level) expression form: ~e" + (syntax->datum sexpr))]))) (define (profile-annotate-lambda name expr clause bodys-stx phase) (let* ([bodys (stx->list bodys-stx)] @@ -329,234 +330,241 @@ (lambda (expr phase) (test-coverage-point (kernel-syntax-case/phase expr phase - [_ - (identifier? expr) - (let ([b (identifier-binding expr phase)]) - (cond - [(eq? 'lexical b) - ;; lexical variable - no error possile - expr] - [(and (pair? b) (eq? '#%kernel (car b))) - ;; built-in - no error possible - expr] - [else - ;; might be undefined/uninitialized - (with-mark expr expr)]))] - - [(#%top . id) - ;; might be undefined/uninitialized - (with-mark expr expr)] - [(#%variable-reference . _) - ;; no error possible - expr] - - [(define-values names rhs) - top? - ;; Can't put annotation on the outside - (let* ([marked - (with-mark expr - (annotate-named - (one-name #'names) - (syntax rhs) - phase))] - [with-coverage - (let loop ([stx #'names] - [obj marked]) - (cond - [(not (syntax? stx)) obj] - [(identifier? stx) - (test-coverage-point obj stx phase)] - [(pair? (syntax-e stx)) - (loop (car (syntax-e stx)) - (loop (cdr (syntax-e stx)) - obj))] - [else obj]))]) - (certify - expr - (rebuild - expr - (list (cons #'rhs with-coverage)))))] - [(begin . exprs) - top? - (certify - expr - (annotate-seq expr - (syntax exprs) - annotate-top phase))] - [(define-syntaxes (name ...) rhs) - top? - (let ([marked (with-mark expr - (annotate-named - (one-name #'(name ...)) - (syntax rhs) - (add1 phase)))]) - (certify - expr - (rebuild expr (list (cons #'rhs marked)))))] - - [(define-values-for-syntax (name ...) rhs) - top? - (let ([marked (with-mark expr - (annotate-named - (one-name (syntax (name ...))) - (syntax rhs) - (add1 phase)))]) - (certify - expr - (rebuild expr (list (cons #'rhs marked)))))] - - [(module name init-import (__plain-module-begin body ...)) - ;; Just wrap body expressions - (let ([bodys (syntax->list (syntax (body ...)))] - [mb (list-ref (syntax->list expr) 3)]) - (let ([bodyl (map (lambda (b) - (annotate-top b 0)) - bodys)]) - (certify - expr - (rebuild - expr - (list (cons - mb - (certify - mb - (rebuild mb (map cons bodys bodyl)))))))))] - - [(#%expression e) - top? - (certify expr #`(#%expression #,(annotate (syntax e) phase)))] - - ;; No way to wrap - [(#%require i ...) expr] - ;; No error possible (and no way to wrap) - [(#%provide i ...) expr] - - - ;; No error possible - [(quote _) - expr] - [(quote-syntax _) - expr] - - ;; Wrap body, also a profile point - [(#%plain-lambda args . body) - (certify - expr - (keep-lambda-properties - expr - (profile-annotate-lambda name expr expr (syntax body) - phase)))] - [(case-lambda clause ...) - (with-syntax ([([args . body] ...) - (syntax (clause ...))]) - (let* ([clauses (syntax->list (syntax (clause ...)))] - [clausel (map - (lambda (body clause) - (profile-annotate-lambda - name expr clause body phase)) - (syntax->list (syntax (body ...))) - clauses)]) - (certify - expr - (keep-lambda-properties - expr - (rebuild expr (map cons clauses clausel))))))] - - ;; Wrap RHSs and body - [(let-values ([vars rhs] ...) . body) - (with-mark expr - (certify - expr - (annotate-let expr phase - (syntax (vars ...)) - (syntax (rhs ...)) - (syntax body))))] - [(letrec-values ([vars rhs] ...) . body) - (with-mark expr - (certify - expr - (annotate-let expr phase - (syntax (vars ...)) - (syntax (rhs ...)) - (syntax body))))] - - ;; Wrap RHS - [(set! var rhs) - (let ([new-rhs (annotate-named - (syntax var) - (syntax rhs) - phase)]) - ;; set! might fail on undefined variable, or too many values: - (with-mark expr - (certify - expr - (rebuild expr (list (cons #'rhs new-rhs))))))] - - ;; Wrap subexpressions only - [(begin e) - ;; Single expression: no mark - (certify - expr - #`(begin #,(annotate (syntax e) phase)))] - [(begin . body) - (with-mark expr - (certify - expr - (annotate-seq expr #'body annotate phase)))] - [(begin0 . body) - (with-mark expr - (certify - expr - (annotate-seq expr #'body annotate phase)))] - [(if tst thn els) - (let ([w-tst (annotate (syntax tst) phase)] - [w-thn (annotate (syntax thn) phase)] - [w-els (annotate (syntax els) phase)]) - (with-mark expr - (certify - expr - (rebuild expr (list (cons #'tst w-tst) - (cons #'thn w-thn) - (cons #'els w-els))))))] - [(if tst thn) - (let ([w-tst (annotate (syntax tst) phase)] - [w-thn (annotate (syntax thn) phase)]) - (with-mark expr - (certify - expr - (rebuild expr (list (cons #'tst w-tst) - (cons #'thn w-thn))))))] - [(with-continuation-mark . body) - (with-mark expr - (certify - expr - (annotate-seq expr (syntax body) - annotate phase)))] - - ;; Wrap whole application, plus subexpressions - [(#%plain-app . body) - (cond - [(stx-null? (syntax body)) - ;; It's a null: - expr] - [(syntax-case* expr (#%plain-app void) - (if (positive? phase) - free-transformer-identifier=? - free-identifier=?) - [(#%plain-app void) #t] - [_else #f]) - ;; It's (void): - expr] - [else - (with-mark expr (certify - expr - (annotate-seq expr (syntax body) - annotate phase)))])] - - [_else - (error 'errortrace "unrecognized expression form~a: ~e" - (if top? " at top-level" "") - (syntax->datum expr))]) + [_ + (identifier? expr) + (let ([b (identifier-binding expr phase)]) + (cond + [(eq? 'lexical b) + ;; lexical variable - no error possile + expr] + [(and (pair? b) (let-values ([(base rel) (module-path-index-split (car b))]) + (equal? '(quote #%kernel) base))) + ;; built-in - no error possible + expr] + [else + ;; might be undefined/uninitialized + (with-mark expr expr)]))] + + [(#%top . id) + ;; might be undefined/uninitialized + (with-mark expr expr)] + [(#%variable-reference . _) + ;; no error possible + expr] + + [(define-values names rhs) + top? + ;; Can't put annotation on the outside + (let* ([marked + (with-mark expr + (annotate-named + (one-name #'names) + (syntax rhs) + phase))] + [with-coverage + (let loop ([stx #'names] + [obj marked]) + (cond + [(not (syntax? stx)) obj] + [(identifier? stx) + (test-coverage-point obj stx phase)] + [(pair? (syntax-e stx)) + (loop (car (syntax-e stx)) + (loop (cdr (syntax-e stx)) + obj))] + [else obj]))]) + (certify + expr + (rebuild + expr + (list (cons #'rhs with-coverage)))))] + [(begin . exprs) + top? + (certify + expr + (annotate-seq expr + (syntax exprs) + annotate-top phase))] + [(define-syntaxes (name ...) rhs) + top? + (let ([marked (with-mark expr + (annotate-named + (one-name #'(name ...)) + (syntax rhs) + (add1 phase)))]) + (certify + expr + (rebuild expr (list (cons #'rhs marked)))))] + + [(define-values-for-syntax (name ...) rhs) + top? + (let ([marked (with-mark expr + (annotate-named + (one-name (syntax (name ...))) + (syntax rhs) + (add1 phase)))]) + (certify + expr + (rebuild expr (list (cons #'rhs marked)))))] + + [(module name init-import (__plain-module-begin body ...)) + ;; Just wrap body expressions + (let ([bodys (syntax->list (syntax (body ...)))] + [mb (list-ref (syntax->list expr) 3)]) + (let ([bodyl (map (lambda (b) + (annotate-top b 0)) + bodys)]) + (certify + expr + (rebuild + expr + (list (cons + mb + (certify + mb + (rebuild mb (map cons bodys bodyl)))))))))] + + [(#%expression e) + top? + (certify expr #`(#%expression #,(annotate (syntax e) phase)))] + + ;; No way to wrap + [(#%require i ...) expr] + ;; No error possible (and no way to wrap) + [(#%provide i ...) expr] + + + ;; No error possible + [(quote _) + expr] + [(quote-syntax _) + expr] + + ;; Wrap body, also a profile point + [(#%plain-lambda args . body) + (certify + expr + (keep-lambda-properties + expr + (profile-annotate-lambda name expr expr (syntax body) + phase)))] + [(case-lambda clause ...) + (with-syntax ([([args . body] ...) + (syntax (clause ...))]) + (let* ([clauses (syntax->list (syntax (clause ...)))] + [clausel (map + (lambda (body clause) + (profile-annotate-lambda + name expr clause body phase)) + (syntax->list (syntax (body ...))) + clauses)]) + (certify + expr + (keep-lambda-properties + expr + (rebuild expr (map cons clauses clausel))))))] + + ;; Wrap RHSs and body + [(let-values ([vars rhs] ...) . body) + (with-mark expr + (certify + expr + (annotate-let expr phase + (syntax (vars ...)) + (syntax (rhs ...)) + (syntax body))))] + [(letrec-values ([vars rhs] ...) . body) + (let ([fm (certify + expr + (annotate-let expr phase + (syntax (vars ...)) + (syntax (rhs ...)) + (syntax body)))]) + (kernel-syntax-case/phase expr phase + [(lv ([(var1) (#%plain-lambda . _)]) var2) + (and (identifier? #'var2) + (free-identifier=? #'var1 #'var2)) + fm] + [_ + (with-mark expr fm)]))] + + ;; Wrap RHS + [(set! var rhs) + (let ([new-rhs (annotate-named + (syntax var) + (syntax rhs) + phase)]) + ;; set! might fail on undefined variable, or too many values: + (with-mark expr + (certify + expr + (rebuild expr (list (cons #'rhs new-rhs))))))] + + ;; Wrap subexpressions only + [(begin e) + ;; Single expression: no mark + (certify + expr + #`(begin #,(annotate (syntax e) phase)))] + [(begin . body) + (with-mark expr + (certify + expr + (annotate-seq expr #'body annotate phase)))] + [(begin0 . body) + (with-mark expr + (certify + expr + (annotate-seq expr #'body annotate phase)))] + [(if tst thn els) + (let ([w-tst (annotate (syntax tst) phase)] + [w-thn (annotate (syntax thn) phase)] + [w-els (annotate (syntax els) phase)]) + (with-mark expr + (certify + expr + (rebuild expr (list (cons #'tst w-tst) + (cons #'thn w-thn) + (cons #'els w-els))))))] + [(if tst thn) + (let ([w-tst (annotate (syntax tst) phase)] + [w-thn (annotate (syntax thn) phase)]) + (with-mark expr + (certify + expr + (rebuild expr (list (cons #'tst w-tst) + (cons #'thn w-thn))))))] + [(with-continuation-mark . body) + (with-mark expr + (certify + expr + (annotate-seq expr (syntax body) + annotate phase)))] + + ;; Wrap whole application, plus subexpressions + [(#%plain-app . body) + (cond + [(stx-null? (syntax body)) + ;; It's a null: + expr] + [(syntax-case* expr (#%plain-app void) + (if (positive? phase) + free-transformer-identifier=? + free-identifier=?) + [(#%plain-app void) #t] + [_else #f]) + ;; It's (void): + expr] + [else + (with-mark expr (certify + expr + (annotate-seq expr (syntax body) + annotate phase)))])] + + [_else + (error 'errortrace "unrecognized expression form~a: ~e" + (if top? " at top-level" "") + (syntax->datum expr))]) expr phase))) diff --git a/collects/tests/future/future.ss b/collects/tests/future/future.ss index 761b14b93c..69fd4463c5 100644 --- a/collects/tests/future/future.ss +++ b/collects/tests/future/future.ss @@ -103,15 +103,47 @@ We should also test deep continuations. [f3 (future (λ () (< (touch f2) 1)))]) (touch f3))) +(check-equal? + '((1) (1)) + (let ([f1 (future (lambda () + (with-continuation-mark + 'x 1 + (current-continuation-marks))))] + [f2 (future (lambda () + (with-continuation-mark + 'x 1 + (current-continuation-marks))))]) + (list (continuation-mark-set->list (touch f1) 'x) + (continuation-mark-set->list (touch f2) 'x)))) +(check-equal? + '((1 0) (1 0)) + (let ([f1 (future (lambda () + (with-continuation-mark + 'x 1 + (current-continuation-marks))))] + [f2 (future (lambda () + (with-continuation-mark + 'x 1 + (current-continuation-marks))))]) + (with-continuation-mark + 'x 0 + (list (continuation-mark-set->list (touch f1) 'x) + (continuation-mark-set->list (touch f2) 'x))))) - - - - - - - - - +(check-equal? + '((1 0) (1) ()) + (let ([f1 (future (lambda () + (with-continuation-mark + 'x 1 + (current-continuation-marks))))] + [f2 (future (lambda () + (with-continuation-mark + 'x 1 + (current-continuation-marks))))]) + (list (continuation-mark-set->list (with-continuation-mark 'x 0 + (touch f1)) + 'x) + (continuation-mark-set->list (touch f2) 'x) + (continuation-mark-set->list (current-continuation-marks) 'x)))) diff --git a/src/mzscheme/src/env.c b/src/mzscheme/src/env.c index 9d15f93356..63edb919ad 100644 --- a/src/mzscheme/src/env.c +++ b/src/mzscheme/src/env.c @@ -1817,7 +1817,8 @@ static Scheme_Object *make_toplevel(mzshort depth, int position, int resolved, i } Scheme_Object *scheme_register_toplevel_in_prefix(Scheme_Object *var, Scheme_Comp_Env *env, - Scheme_Compile_Info *rec, int drec) + Scheme_Compile_Info *rec, int drec, + int imported) { Comp_Prefix *cp = env->prefix; Scheme_Hash_Table *ht; @@ -1838,7 +1839,7 @@ Scheme_Object *scheme_register_toplevel_in_prefix(Scheme_Object *var, Scheme_Com if (o) return o; - o = make_toplevel(0, cp->num_toplevels, 0, 0); + o = make_toplevel(0, cp->num_toplevels, 0, imported ? SCHEME_TOPLEVEL_READY : 0); cp->num_toplevels++; scheme_hash_set(ht, var, o); @@ -3094,6 +3095,24 @@ scheme_lookup_binding(Scheme_Object *find_id, Scheme_Comp_Env *env, int flags, return (Scheme_Object *)b; } +int scheme_is_imported(Scheme_Object *var, Scheme_Comp_Env *env) +{ + if (env->genv->module) { + if (SAME_TYPE(SCHEME_TYPE(var), scheme_module_variable_type)) { + if (!SAME_OBJ(((Module_Variable *)var)->modidx, env->genv->module->self_modidx)) + return 1; + } else + return 1; + } else { + if (SAME_TYPE(SCHEME_TYPE(var), scheme_variable_type)) { + if (!SAME_OBJ(((Scheme_Bucket_With_Home *)var)->home, env->genv)) + return 1; + } else + return 1; + } + return 0; +} + Scheme_Object *scheme_extract_unsafe(Scheme_Object *o) { Scheme_Env *home = ((Scheme_Bucket_With_Home *)o)->home; diff --git a/src/mzscheme/src/eval.c b/src/mzscheme/src/eval.c index 64a5bfeeaa..433b7df1e3 100644 --- a/src/mzscheme/src/eval.c +++ b/src/mzscheme/src/eval.c @@ -124,6 +124,9 @@ #include "schpriv.h" #include "schrunst.h" #include "schexpobs.h" +#ifdef MZ_USE_FUTURES +# include "future.h" +#endif #ifdef USE_STACKAVAIL #include @@ -959,8 +962,8 @@ int scheme_omittable_expr(Scheme_Object *o, int vals, int fuel, int resolved, && (1 <= ((Scheme_Primitive_Proc *)app->rator)->mu.maxa)) { note_match(1, vals, warn_info); if ((vals == 1) || (vals < 0)) { - /* can omit an unsafe op */ - return 1; + if (scheme_omittable_expr(app->rand, 1, fuel - 1, resolved, warn_info)) + return 1; } } return 0; @@ -998,8 +1001,9 @@ int scheme_omittable_expr(Scheme_Object *o, int vals, int fuel, int resolved, && (2 <= ((Scheme_Primitive_Proc *)app->rator)->mu.maxa)) { note_match(1, vals, warn_info); if ((vals == 1) || (vals < 0)) { - /* can omit an unsafe op */ - return 1; + if (scheme_omittable_expr(app->rand1, 1, fuel - 1, resolved, warn_info) + && scheme_omittable_expr(app->rand2, 1, fuel - 1, resolved, warn_info)) + return 1; } } } @@ -1844,6 +1848,7 @@ static Scheme_Object *link_module_variable(Scheme_Object *modidx, { Scheme_Object *modname; Scheme_Env *menv; + Scheme_Bucket *bkt; int self = 0; /* If it's a name id, resolve the name. */ @@ -1893,7 +1898,23 @@ static Scheme_Object *link_module_variable(Scheme_Object *modidx, } } - return (Scheme_Object *)scheme_global_bucket(varname, menv); + bkt = scheme_global_bucket(varname, menv); + if (!self) { + if (!bkt->val) { + scheme_wrong_syntax("link", NULL, varname, + "reference (phase %d) to a variable in module" + " %D that is uninitialized (phase level %d); reference" + " appears in module: %D", + env->phase, + exprs ? SCHEME_CDR(modname) : modname, + mod_phase, + env->module ? env->module->modname : scheme_false); + } + if (!(((Scheme_Bucket_With_Flags *)bkt)->flags & (GLOB_IS_IMMUTATED | GLOB_IS_LINKED))) + ((Scheme_Bucket_With_Flags *)bkt)->flags |= GLOB_IS_LINKED; + } + + return (Scheme_Object *)bkt; } static Scheme_Object *link_toplevel(Scheme_Object **exprs, int which, Scheme_Env *env, @@ -4082,6 +4103,11 @@ static Scheme_Object *optimize_wcm(Scheme_Object *o, Optimize_Info *info, int co b = scheme_optimize_expr(wcm->body, info, scheme_optimize_tail_context(context)); + if (scheme_omittable_expr(k, 1, 20, 0, info) + && scheme_omittable_expr(v, 1, 20, 0, info) + && scheme_omittable_expr(b, -1, 20, 0, info)) + return b; + /* info->single_result is already set */ info->preserves_marks = 0; @@ -4426,6 +4452,27 @@ Scheme_Object *scheme_optimize_clone(int dup_ok, Scheme_Object *expr, Optimize_I return (Scheme_Object *)b2; } + case scheme_with_cont_mark_type: + { + Scheme_With_Continuation_Mark *wcm = (Scheme_With_Continuation_Mark *)expr, *wcm2; + + wcm2 = MALLOC_ONE_TAGGED(Scheme_With_Continuation_Mark); + wcm2->so.type = scheme_with_cont_mark_type; + + expr = scheme_optimize_clone(dup_ok, wcm->key, info, delta, closure_depth); + if (!expr) return NULL; + wcm2->key = expr; + + expr = scheme_optimize_clone(dup_ok, wcm->val, info, delta, closure_depth); + if (!expr) return NULL; + wcm2->val = expr; + + expr = scheme_optimize_clone(dup_ok, wcm->body, info, delta, closure_depth); + if (!expr) return NULL; + wcm2->body = expr; + + return (Scheme_Object *)wcm2; + } case scheme_compiled_unclosed_procedure_type: return scheme_clone_closure_compilation(dup_ok, expr, info, delta, closure_depth); case scheme_compiled_toplevel_type: @@ -6590,7 +6637,8 @@ scheme_compile_expand_expr(Scheme_Object *form, Scheme_Comp_Env *env, return scheme_extract_flfxnum(var); } else if (SAME_TYPE(SCHEME_TYPE(var), scheme_variable_type) || SAME_TYPE(SCHEME_TYPE(var), scheme_module_variable_type)) - return scheme_register_toplevel_in_prefix(var, env, rec, drec); + return scheme_register_toplevel_in_prefix(var, env, rec, drec, + scheme_is_imported(var, env)); else return var; } else { @@ -7293,7 +7341,7 @@ top_syntax(Scheme_Object *form, Scheme_Comp_Env *env, Scheme_Compile_Info *rec, c = (Scheme_Object *)scheme_global_bucket(c, env->genv); } - return scheme_register_toplevel_in_prefix(c, env, rec, drec); + return scheme_register_toplevel_in_prefix(c, env, rec, drec, 0); } static Scheme_Object * @@ -8018,13 +8066,10 @@ static MZ_MARK_STACK_TYPE clone_meta_cont_set_mark(Scheme_Meta_Continuation *mc, return 0; } -static MZ_MARK_STACK_TYPE new_segment_set_mark(long segpos, long pos, Scheme_Object *key, Scheme_Object *val) +void scheme_new_mark_segment(Scheme_Thread *p) { - Scheme_Thread *p = scheme_current_thread; - Scheme_Cont_Mark *cm = NULL; int c = p->cont_mark_seg_count; Scheme_Cont_Mark **segs, *seg; - long findpos; /* Note: we perform allocations before changing p to avoid GC trouble, since MzScheme adjusts a thread's cont_mark_stack_segments on GC. */ @@ -8036,22 +8081,22 @@ static MZ_MARK_STACK_TYPE new_segment_set_mark(long segpos, long pos, Scheme_Obj p->cont_mark_seg_count++; p->cont_mark_stack_segments = segs; - - seg = p->cont_mark_stack_segments[segpos]; - cm = seg + pos; - findpos = MZ_CONT_MARK_STACK; - MZ_CONT_MARK_STACK++; - - cm->key = key; - cm->val = val; - cm->pos = MZ_CONT_MARK_POS; /* always odd */ - cm->cache = NULL; - - return findpos; } +#ifdef MZ_USE_FUTURES +static void ts_scheme_new_mark_segment(Scheme_Thread *p) XFORM_SKIP_PROC +{ + if (scheme_use_rtcall) + scheme_rtcall_new_mark_segment(p); + else + scheme_new_mark_segment(p); +} +#else +# define ts_scheme_new_mark_segment scheme_new_mark_segment +#endif MZ_MARK_STACK_TYPE scheme_set_cont_mark(Scheme_Object *key, Scheme_Object *val) +/* This function can be called inside a future thread */ { Scheme_Thread *p = scheme_current_thread; Scheme_Cont_Mark *cm = NULL; @@ -8116,8 +8161,7 @@ MZ_MARK_STACK_TYPE scheme_set_cont_mark(Scheme_Object *key, Scheme_Object *val) pos = ((long)findpos) & SCHEME_MARK_SEGMENT_MASK; if (segpos >= p->cont_mark_seg_count) { - /* Need a new segment */ - return new_segment_set_mark(segpos, pos, key, val); + ts_scheme_new_mark_segment(p); } seg = p->cont_mark_stack_segments[segpos]; diff --git a/src/mzscheme/src/future.c b/src/mzscheme/src/future.c index 2c8e8e1ac4..ea0a90b2e0 100644 --- a/src/mzscheme/src/future.c +++ b/src/mzscheme/src/future.c @@ -20,9 +20,6 @@ #include "schpriv.h" -//This will be TRUE if primitive tracking has been enabled -//by the program - static Scheme_Object *future_p(int argc, Scheme_Object *argv[]) { if (SAME_TYPE(SCHEME_TYPE(argv[0]), scheme_future_type)) @@ -290,8 +287,7 @@ typedef struct future_thread_params_t { /* Plumbing for MzScheme initialization */ /**********************************************************************/ -//Invoked by the runtime on startup to make -//primitives known +/* Invoked by the runtime on startup to make primitives known */ void scheme_init_futures(Scheme_Env *env) { Scheme_Object *v; @@ -378,8 +374,8 @@ static void init_future_thread(Scheme_Future_State *fs, int i) Scheme_Thread *skeleton; Scheme_Object **runstack_start; - //Create the worker thread pool. These threads will - //'queue up' and wait for futures to become available + /* Create the worker thread pool. These threads will + 'queue up' and wait for futures to become available. */ fts = (Scheme_Future_Thread_State *)malloc(sizeof(Scheme_Future_Thread_State)); memset(fts, 0, sizeof(Scheme_Future_Thread_State)); @@ -454,12 +450,19 @@ static void end_gc_not_ok(Scheme_Future_Thread_State *fts, Scheme_Object **current_rs) /* must have mutex_lock */ { + Scheme_Thread *p; + scheme_set_runstack_limits(MZ_RUNSTACK_START, fts->runstack_size, (current_rs ? current_rs XFORM_OK_MINUS MZ_RUNSTACK_START : fts->runstack_size), fts->runstack_size); + p = scheme_current_thread; + p->runstack = MZ_RUNSTACK; + p->runstack_start = MZ_RUNSTACK_START; + p->cont_mark_stack = MZ_CONT_MARK_STACK; + p->cont_mark_pos = MZ_CONT_MARK_POS; /* FIXME: clear scheme_current_thread->ku.multiple.array ? */ @@ -543,7 +546,7 @@ void scheme_future_gc_pause() } /**********************************************************************/ -/* Primitive implementations */ +/* Primitive implementations */ /**********************************************************************/ Scheme_Object *future(int argc, Scheme_Object *argv[]) @@ -556,7 +559,7 @@ Scheme_Object *future(int argc, Scheme_Object *argv[]) Scheme_Native_Closure_Data *ncd; Scheme_Object *lambda = argv[0]; - //Input validation + /* Input validation */ scheme_check_proc_arity("future", 0, 0, argc, argv); if (fs->future_threads_created < THREAD_POOL_SIZE) { @@ -572,7 +575,7 @@ Scheme_Object *future(int argc, Scheme_Object *argv[]) nc = (Scheme_Native_Closure*)lambda; ncd = nc->code; - //Create the future descriptor and add to the queue as 'pending' + /* Create the future descriptor and add to the queue as 'pending' */ ft = MALLOC_ONE_TAGGED(future_t); ft->so.type = scheme_future_type; @@ -581,7 +584,7 @@ Scheme_Object *future(int argc, Scheme_Object *argv[]) ft->orig_lambda = lambda; ft->status = PENDING; - //JIT compile the code if not already jitted + /* JIT the code if not already JITted */ if (ncd->code == scheme_on_demand_jit_code) { scheme_on_demand_generate_lambda(nc, 0, NULL); @@ -596,7 +599,7 @@ Scheme_Object *future(int argc, Scheme_Object *argv[]) mzrt_mutex_lock(fs->future_mutex); enqueue_future(fs, ft); - //Signal that a future is pending + /* Signal that a future is pending */ mzrt_sema_post(fs->future_pending_sema); mzrt_mutex_unlock(fs->future_mutex); @@ -682,8 +685,8 @@ Scheme_Object *touch(int argc, Scheme_Object *argv[]) } mzrt_mutex_unlock(fs->future_mutex); - //Spin waiting for primitive calls or a return value from - //the worker thread + /* Spin waiting for primitive calls or a return value from + the worker thread */ while (1) { scheme_block_until(future_ready, NULL, (Scheme_Object*)ft, 0); mzrt_mutex_lock(fs->future_mutex); @@ -692,16 +695,15 @@ Scheme_Object *touch(int argc, Scheme_Object *argv[]) retval = ft->retval; LOG("Successfully touched future %d\n", ft->id); - // fflush(stdout); mzrt_mutex_unlock(fs->future_mutex); break; } else if (ft->rt_prim) { - //Invoke the primitive and stash the result - //Release the lock so other threads can manipulate the queue - //while the runtime call executes + /* Invoke the primitive and stash the result. + Release the lock so other threads can manipulate the queue + while the runtime call executes. */ mzrt_mutex_unlock(fs->future_mutex); LOG2("Invoking primitive %p on behalf of future %d...", ft->rt_prim, ft->id); invoke_rtcall(fs, ft); @@ -756,9 +758,9 @@ Scheme_Object *processor_count(int argc, Scheme_Object *argv[]) return scheme_make_integer(cpucount); } -//Entry point for a worker thread allocated for -//executing futures. This function will never terminate -//(until the process dies). +/* Entry point for a worker thread allocated for + executing futures. This function will never terminate + (until the process dies). */ void *worker_thread_future_loop(void *arg) XFORM_SKIP_PROC /* Called in future thread; runtime thread is blocked until ready_sema @@ -779,7 +781,7 @@ void *worker_thread_future_loop(void *arg) GC_instance = params->shared_GC; scheme_current_thread = params->thread_skeleton; - //Set processor affinity + /* Set processor affinity */ /*mzrt_mutex_lock(fs->future_mutex); static unsigned long cur_cpu_mask = 1; if (pthread_setaffinity_np(pthread_self(), sizeof(g_cur_cpu_mask), &g_cur_cpu_mask)) @@ -823,31 +825,32 @@ void *worker_thread_future_loop(void *arg) if (ft) { LOG0("Got a signal that a future is pending..."); - //Work is available for this thread + /* Work is available for this thread */ ft->status = RUNNING; mzrt_mutex_unlock(fs->future_mutex); ft->thread_short_id = fts->id; - //Set up the JIT compiler for this thread + /* Set up the JIT compiler for this thread */ scheme_jit_fill_threadlocal_table(); jitcode = (Scheme_Object* (*)(Scheme_Object*, int, Scheme_Object**))(ft->code); fts->current_ft = ft; - //Run the code - //Passing no arguments for now. - //The lambda passed to a future will always be a parameterless - //function. - //From this thread's perspective, this call will never return - //until all the work to be done in the future has been completed, - //including runtime calls. - //If jitcode asks the runrtime thread to do work, then - //a GC can occur. + /* Run the code: + The lambda passed to a future will always be a parameterless + function. + From this thread's perspective, this call will never return + until all the work to be done in the future has been completed, + including runtime calls. + If jitcode asks the runrtime thread to do work, then + a GC can occur. */ LOG("Running JIT code at %p...\n", ft->code); MZ_RUNSTACK = MZ_RUNSTACK_START + fts->runstack_size; + MZ_CONT_MARK_STACK = 0; + MZ_CONT_MARK_POS = (MZ_MARK_POS_TYPE)1; scheme_current_thread->error_buf = &newbuf; if (scheme_future_setjmp(newbuf)) { @@ -862,10 +865,10 @@ void *worker_thread_future_loop(void *arg) LOG("Finished running JIT code at %p.\n", ft->code); - // Get future again, since a GC may have occurred + /* Get future again, since a GC may have occurred */ ft = fts->current_ft; - //Set the return val in the descriptor + /* Set the return val in the descriptor */ mzrt_mutex_lock(fs->future_mutex); ft->work_completed = 1; ft->retval = v; @@ -873,10 +876,14 @@ void *worker_thread_future_loop(void *arg) /* In case of multiple values: */ send_special_result(ft, v); - //Update the status + /* Update the status */ ft->status = FINISHED; dequeue_future(fs, ft); + /* Clear stacks */ + MZ_RUNSTACK = MZ_RUNSTACK_START + fts->runstack_size; + MZ_CONT_MARK_STACK = 0; + scheme_signal_received_at(fs->signal_handle); } @@ -918,10 +925,6 @@ void scheme_check_future_work() } } -//Returns 0 if the call isn't actually executed by this function, -//i.e. if we are already running on the runtime thread. Otherwise returns -//1, and 'retval' is set to point to the return value of the runtime -//call invocation. static void future_do_runtimecall(Scheme_Future_Thread_State *fts, void *func, int is_atomic) @@ -931,11 +934,11 @@ static void future_do_runtimecall(Scheme_Future_Thread_State *fts, future_t *future; Scheme_Future_State *fs = scheme_future_state; - //Fetch the future descriptor for this thread + /* Fetch the future descriptor for this thread */ future = fts->current_ft; - //set up the arguments for the runtime call - //to be picked up by the main rt thread + /* Set up the arguments for the runtime call + to be picked up by the main rt thread */ mzrt_mutex_lock(fs->future_mutex); future->prim_func = func; @@ -950,14 +953,16 @@ static void future_do_runtimecall(Scheme_Future_Thread_State *fts, } } - //Update the future's status to waiting + /* Update the future's status to waiting */ future->status = WAITING_FOR_PRIM; scheme_signal_received_at(fs->signal_handle); - //Wait for the signal that the RT call is finished + future->arg_p = scheme_current_thread; + + /* Wait for the signal that the RT call is finished */ future->can_continue_sema = fts->worker_can_continue_sema; - end_gc_not_ok(fts, fs, MZ_RUNSTACK); + end_gc_not_ok(fts, fs, MZ_RUNSTACK); /* we rely on this putting MZ_CONT_MARK_STACK into the thread record */ mzrt_mutex_unlock(fs->future_mutex); mzrt_sema_wait(fts->worker_can_continue_sema); @@ -966,7 +971,7 @@ static void future_do_runtimecall(Scheme_Future_Thread_State *fts, start_gc_not_ok(fs); mzrt_mutex_unlock(fs->future_mutex); - //Fetch the future instance again, in case the GC has moved the pointer + /* Fetch the future instance again, in case the GC has moved the pointer */ future = fts->current_ft; if (future->no_retval) { @@ -1057,6 +1062,62 @@ unsigned long scheme_rtcall_alloc(const char *who, int src_type) #endif +void scheme_rtcall_new_mark_segment(Scheme_Thread *p) + XFORM_SKIP_PROC +/* Called in future thread */ +{ + future_t *future; + Scheme_Future_Thread_State *fts = scheme_future_thread_state; + + future = fts->current_ft; + future->time_of_request = scheme_get_inexact_milliseconds(); + future->source_of_request = "[allocate_mark_segment]"; + future->source_type = FSRC_OTHER; + + future->prim_protocol = SIG_ALLOC_MARK_SEGMENT; + future->arg_s0 = (Scheme_Object *)p; + + future_do_runtimecall(fts, (void*)scheme_new_mark_segment, 1); +} + +static int push_marks(future_t *f, Scheme_Cont_Frame_Data *d) +{ + Scheme_Thread *p2, *p; + long i, pos, delta; + Scheme_Cont_Mark *seg; + + if (f->arg_p) { + p2 = f->arg_p; + if (p2->cont_mark_stack) { + scheme_push_continuation_frame(d); + + p = scheme_current_thread; + + delta = MZ_CONT_MARK_POS - p2->cont_mark_pos; + if (delta < 0) delta = 0; + + for (i = p2->cont_mark_stack; i--; ) { + seg = p2->cont_mark_stack_segments[i >> SCHEME_LOG_MARK_SEGMENT_SIZE]; + pos = i & SCHEME_MARK_SEGMENT_MASK; + + MZ_CONT_MARK_POS = seg[pos].pos + delta; + scheme_set_cont_mark(seg[pos].key, seg[pos].val); + } + + MZ_CONT_MARK_POS = p2->cont_mark_pos + delta; + + return 1; + } + } + + return 0; +} + +static void pop_marks(Scheme_Cont_Frame_Data *d) +{ + scheme_pop_continuation_frame(d); +} + static void receive_special_result(future_t *f, Scheme_Object *retval, int clear) XFORM_SKIP_PROC /* Called in future or runtime thread */ @@ -1106,12 +1167,15 @@ static void send_special_result(future_t *f, Scheme_Object *retval) } } -//Does the work of actually invoking a primitive on behalf of a -//future. This function is always invoked on the main (runtime) -//thread. +/* Does the work of actually invoking a primitive on behalf of a + future. This function is always invoked on the main (runtime) + thread. */ static void do_invoke_rtcall(Scheme_Future_State *fs, future_t *future) /* Called in runtime thread */ { + Scheme_Cont_Frame_Data mark_d; + int need_pop; + #ifdef DEBUG_FUTURES g_rtcall_count++; #endif @@ -1141,6 +1205,13 @@ static void do_invoke_rtcall(Scheme_Future_State *fs, future_t *future) future->time_of_request, src); } + + if ((future->source_type == FSRC_RATOR) + || (future->source_type == FSRC_MARKS)) + need_pop = push_marks(future, &mark_d); + else + need_pop = 0; + future->arg_p = NULL; switch (future->prim_protocol) { @@ -1162,15 +1233,26 @@ static void do_invoke_rtcall(Scheme_Future_State *fs, future_t *future) break; } #endif + case SIG_ALLOC_MARK_SEGMENT: + { + Scheme_Thread *p_seg; + p_seg = (Scheme_Thread *)future->arg_s0; + future->arg_s0 = NULL; + scheme_new_mark_segment(p_seg); + break; + } # include "jit_ts_runtime_glue.c" default: scheme_signal_error("unknown protocol %d", future->prim_protocol); break; } + if (need_pop) + pop_marks(&mark_d); + mzrt_mutex_lock(fs->future_mutex); - //Signal the waiting worker thread that it - //can continue running machine code + /* Signal the waiting worker thread that it + can continue running machine code */ if (future->can_continue_sema) { mzrt_sema_post(future->can_continue_sema); future->can_continue_sema= NULL; @@ -1202,8 +1284,8 @@ static void invoke_rtcall(Scheme_Future_State * volatile fs, future_t * volatile if (scheme_setjmp(newbuf)) { mzrt_mutex_lock(fs->future_mutex); future->no_retval = 1; - //Signal the waiting worker thread that it - //can continue running machine code + /* Signal the waiting worker thread that it + can continue running machine code */ mzrt_sema_post(future->can_continue_sema); future->can_continue_sema = NULL; mzrt_mutex_unlock(fs->future_mutex); diff --git a/src/mzscheme/src/future.h b/src/mzscheme/src/future.h index 7e6a9b494f..751085e3f2 100644 --- a/src/mzscheme/src/future.h +++ b/src/mzscheme/src/future.h @@ -37,6 +37,7 @@ typedef void* (*prim_pvoid_pvoid_pvoid_t)(void*, void*); #define FSRC_OTHER 0 #define FSRC_RATOR 1 #define FSRC_PRIM 2 +#define FSRC_MARKS 3 typedef struct future_t { Scheme_Object so; @@ -50,7 +51,7 @@ typedef struct future_t { Scheme_Object *orig_lambda; void *code; - //Runtime call stuff + /* Runtime call stuff */ int rt_prim; /* flag to indicate waiting for a prim call */ int rt_prim_is_atomic; double time_of_request; @@ -76,6 +77,7 @@ typedef struct future_t { Scheme_Object *arg_s2; Scheme_Object **arg_S2; int arg_i2; + Scheme_Thread *arg_p; Scheme_Object *retval_s; void *retval_p; /* use only with conservative GC */ @@ -97,12 +99,12 @@ typedef struct future_t { struct future_t *next_waiting_atomic; } future_t; -//Primitive instrumentation stuff +/* Primitive instrumentation stuff */ -//Signature flags for primitive invocations -//Here the convention is SIG_[arg1type]_[arg2type]..._[return type] -#define SIG_VOID_VOID_3ARGS 1 //void -> void, copy 3 args from runstack -#define SIG_ALLOC 2 //void -> void* +/* Signature flags for primitive invocations */ +#define SIG_VOID_VOID_3ARGS 1 +#define SIG_ALLOC 2 +#define SIG_ALLOC_MARK_SEGMENT 3 # include "jit_ts_protos.h" @@ -120,6 +122,7 @@ extern Scheme_Object *scheme_ts_scheme_force_value_same_mark(Scheme_Object *v); extern void scheme_rtcall_void_void_3args(const char *who, int src_type, prim_void_void_3args_t f); extern unsigned long scheme_rtcall_alloc(const char *who, int src_type); +extern void scheme_rtcall_new_mark_segment(Scheme_Thread *p); #else diff --git a/src/mzscheme/src/jit.c b/src/mzscheme/src/jit.c index 211d407f0f..a303552e52 100644 --- a/src/mzscheme/src/jit.c +++ b/src/mzscheme/src/jit.c @@ -170,6 +170,7 @@ SHARED_OK static void *finish_tail_call_code, *finish_tail_call_fixup_code; SHARED_OK static void *module_run_start_code, *module_exprun_start_code, *module_start_start_code; SHARED_OK static void *box_flonum_from_stack_code; SHARED_OK static void *fl1_fail_code, *fl2rr_fail_code[2], *fl2fr_fail_code[2], *fl2rf_fail_code[2]; +SHARED_OK static void *wcm_code, *wcm_nontail_code; typedef struct { MZTAG_IF_REQUIRED @@ -828,7 +829,7 @@ static void raise_bad_call_with_values(Scheme_Object *f) static Scheme_Object *call_with_values_from_multiple_result(Scheme_Object *f) { - Scheme_Thread *p = scheme_current_thread; + Scheme_Thread *p = scheme_current_thread; if (SAME_OBJ(p->ku.multiple.array, p->values_buffer)) p->values_buffer = NULL; return _scheme_apply(f, p->ku.multiple.count, p->ku.multiple.array); @@ -836,7 +837,7 @@ static Scheme_Object *call_with_values_from_multiple_result(Scheme_Object *f) static Scheme_Object *call_with_values_from_multiple_result_multi(Scheme_Object *f) { - Scheme_Thread *p = scheme_current_thread; + Scheme_Thread *p = scheme_current_thread; if (SAME_OBJ(p->ku.multiple.array, p->values_buffer)) p->values_buffer = NULL; return _scheme_apply_multi(f, p->ku.multiple.count, p->ku.multiple.array); @@ -1003,7 +1004,7 @@ static void mz_pushr_p_it(mz_jit_state *jitter, int reg) jitter->need_set_rs = 1; } -static void mz_popr_p_it(mz_jit_state *jitter, int reg) +static void mz_popr_p_it(mz_jit_state *jitter, int reg, int discard) /* de-sync's rs */ { int v; @@ -1019,7 +1020,8 @@ static void mz_popr_p_it(mz_jit_state *jitter, int reg) else jitter->mappings[jitter->num_mappings] = ((v << 2) | 0x1); - mz_rs_ldr(reg); + if (!discard) + mz_rs_ldr(reg); mz_rs_inc(1); jitter->need_set_rs = 1; @@ -1314,7 +1316,8 @@ static int stack_safety(mz_jit_state *jitter, int cnt, int offset) /* de-sync's rs: */ #define mz_pushr_p(x) mz_pushr_p_it(jitter, x) -#define mz_popr_p(x) mz_popr_p_it(jitter, x) +#define mz_popr_p(x) mz_popr_p_it(jitter, x, 0) +#define mz_popr_x() mz_popr_p_it(jitter, JIT_R1, 1) #if 0 /* Debugging: at each _finish(), double-check that the runstack register has been @@ -6197,6 +6200,7 @@ static int generate_inlined_type_test(mz_jit_state *jitter, Scheme_App2_Rec *app jit_ldxi_p(JIT_R1, JIT_R0, (long)&((Scheme_Chaperone *)0x0)->val); jit_ldxi_s(JIT_R1, JIT_R1, &((Scheme_Object *)0x0)->type); mz_patch_branch(ref3); + CHECK_LIMIT(); __END_INNER_TINY__(branch_short); } if (lo_ty == hi_ty) { @@ -6673,6 +6677,7 @@ static int generate_inlined_unary(mz_jit_state *jitter, Scheme_App2_Rec *app, in mz_patch_branch(ref); __END_TINY_JUMPS__(1); } + CHECK_LIMIT(); if (!for_fl) (void)jit_ldxi_i(JIT_R0, JIT_R0, &SCHEME_VEC_SIZE(0x0)); @@ -6768,6 +6773,7 @@ static int generate_inlined_unary(mz_jit_state *jitter, Scheme_App2_Rec *app, in (void)jit_calli(unbox_code); ref2 = jit_jmpi(jit_forward()); mz_patch_branch(ref); + CHECK_LIMIT(); __END_TINY_JUMPS__(1); (void)jit_ldxi_p(JIT_R0, JIT_R0, &SCHEME_BOX_VAL(0x0)); @@ -9226,7 +9232,7 @@ static int generate(Scheme_Object *obj, mz_jit_state *jitter, int is_tail, int m /* de-sync's; result goes to target */ { Scheme_Type type; - int result_ignored, orig_target; + int result_ignored, orig_target, not_wmc_again; #ifdef DO_STACK_CHECK # include "mzstkchk.h" @@ -9267,6 +9273,8 @@ static int generate(Scheme_Object *obj, mz_jit_state *jitter, int is_tail, int m CHECK_LIMIT(); } + not_wmc_again = !is_tail; + type = SCHEME_TYPE(obj); switch (type) { case scheme_toplevel_type: @@ -10179,27 +10187,23 @@ static int generate(Scheme_Object *obj, mz_jit_state *jitter, int is_tail, int m /* Key: */ generate_non_tail(wcm->key, jitter, 0, 1, 0); /* sync'd below */ + mz_pushr_p(JIT_R0); /* sync'd below */ CHECK_LIMIT(); - if (SCHEME_TYPE(wcm->val) > _scheme_values_types_) { - /* No need to push mark onto value stack: */ - jit_movr_p(JIT_V1, JIT_R0); - generate_non_tail(wcm->val, jitter, 0, 1, 0); /* sync'd below */ - CHECK_LIMIT(); - } else { - mz_pushr_p(JIT_R0); - generate_non_tail(wcm->val, jitter, 0, 1, 0); /* sync'd below */ - CHECK_LIMIT(); - mz_popr_p(JIT_V1); /* sync'd below */ - } + /* Value: */ + generate_non_tail(wcm->val, jitter, 0, 1, 0); /* sync'd below */ + CHECK_LIMIT(); + mz_pushr_p(JIT_R0); /* sync'd below */ + /* Key and value are on runstack */ mz_rs_sync(); - JIT_UPDATE_THREAD_RSPTR_IF_NEEDED(); - - mz_prepare(2); - jit_pusharg_p(JIT_R0); - jit_pusharg_p(JIT_V1); - (void)mz_finish(ts_scheme_set_cont_mark); - CHECK_LIMIT(); + if (not_wmc_again) { + (void)jit_calli(wcm_nontail_code); + not_wmc_again = 0; + } else + (void)jit_calli(wcm_code); + + mz_popr_x(); + mz_popr_x(); END_JIT_DATA(18); @@ -11745,6 +11749,133 @@ static int do_generate_common(mz_jit_state *jitter, void *_data) } } + /* wcm_[nontail_]code */ + /* key and value are on runstack */ + { + GC_CAN_IGNORE jit_insn *refloop, *ref, *ref2, *ref3, *ref4, *ref5, *ref7, *ref8; + + wcm_code = jit_get_ip().ptr; + + mz_prolog(JIT_R2); + + (void)mz_tl_ldi_p(JIT_R2, tl_scheme_current_cont_mark_stack); + /* R2 has counter for search */ + + refloop = _jit.x.pc; + (void)mz_tl_ldi_p(JIT_R1, tl_scheme_current_thread); + jit_ldxi_i(JIT_R0, JIT_R1, &((Scheme_Thread *)0x0)->cont_mark_stack_bottom); + ref = jit_bler_i(jit_forward(), JIT_R2, JIT_R0); /* => double-check meta-continuation */ + CHECK_LIMIT(); + + jit_subi_l(JIT_R2, JIT_R2, 1); + + jit_ldxi_p(JIT_R0, JIT_R1, &((Scheme_Thread *)0x0)->cont_mark_stack_segments); + jit_rshi_l(JIT_V1, JIT_R2, SCHEME_LOG_MARK_SEGMENT_SIZE); + jit_lshi_l(JIT_V1, JIT_V1, JIT_LOG_WORD_SIZE); + jit_ldxr_p(JIT_R0, JIT_R0, JIT_V1); /* R0 now points to the right array */ + CHECK_LIMIT(); + + jit_andi_l(JIT_V1, JIT_R2, SCHEME_MARK_SEGMENT_MASK); + jit_movi_l(JIT_R1, sizeof(Scheme_Cont_Mark)); + jit_mulr_l(JIT_V1, JIT_V1, JIT_R1); + jit_addr_l(JIT_R0, JIT_R0, JIT_V1); + CHECK_LIMIT(); + /* R0 now points to the right record */ + + (void)mz_tl_ldi_l(JIT_R1, tl_scheme_current_cont_mark_pos); + jit_ldxi_l(JIT_V1, JIT_R0, &((Scheme_Cont_Mark *)0x0)->pos); + ref2 = jit_bltr_l(jit_forward(), JIT_V1, JIT_R1); /* => try to allocate new slot */ + + jit_ldxi_p(JIT_R1, JIT_RUNSTACK, WORDS_TO_BYTES(1)); + jit_ldxi_p(JIT_V1, JIT_R0, &((Scheme_Cont_Mark *)0x0)->key); + ref3 = jit_beqr_p(jit_forward(), JIT_V1, JIT_R1); /* => found right destination */ + + CHECK_LIMIT(); + (void)jit_jmpi(refloop); + + /* Double-check meta-continuation */ + /* R1 has thread pointer */ + mz_patch_branch(ref); + jit_ldxi_i(JIT_R0, JIT_R1, &((Scheme_Thread *)0x0)->cont_mark_pos_bottom); + (void)mz_tl_ldi_l(JIT_R2, tl_scheme_current_cont_mark_pos); + jit_subi_l(JIT_R2, JIT_R2, 2); + ref = jit_bner_i(jit_forward(), JIT_R2, JIT_R0); /* => try to allocate new slot */ + jit_ldxi_p(JIT_R1, JIT_R1, &((Scheme_Thread *)0x0)->meta_continuation); + ref7 = jit_beqi_l(jit_forward(), JIT_R1, NULL); /* => try to allocate new slot */ + /* we need to check a meta-continuation... take the slow path. */ + ref8 = jit_jmpi(jit_forward()); + CHECK_LIMIT(); + + /* Entry point when we know we're not in non-tail position with respect + to any enclosing wcm: */ + wcm_nontail_code = jit_get_ip().ptr; + mz_prolog(JIT_R2); + + /* Try to allocate new slot: */ + mz_patch_branch(ref); + mz_patch_branch(ref2); + mz_patch_branch(ref7); + (void)mz_tl_ldi_p(JIT_R2, tl_scheme_current_cont_mark_stack); + jit_rshi_l(JIT_V1, JIT_R2, SCHEME_LOG_MARK_SEGMENT_SIZE - JIT_LOG_WORD_SIZE); + (void)mz_tl_ldi_p(JIT_R1, tl_scheme_current_thread); + jit_ldxi_i(JIT_R0, JIT_R1, &((Scheme_Thread *)0x0)->cont_mark_seg_count); + ref4 = jit_bger_i(jit_forward(), JIT_V1, JIT_R0); /* => take slow path */ + CHECK_LIMIT(); + + jit_ldxi_p(JIT_R0, JIT_R1, &((Scheme_Thread *)0x0)->cont_mark_stack_segments); + jit_rshi_l(JIT_V1, JIT_R2, SCHEME_LOG_MARK_SEGMENT_SIZE); + jit_lshi_l(JIT_V1, JIT_V1, JIT_LOG_WORD_SIZE); + jit_ldxr_p(JIT_R0, JIT_R0, JIT_V1); + CHECK_LIMIT(); + /* R0 now points to the right array */ + + jit_andi_l(JIT_V1, JIT_R2, SCHEME_MARK_SEGMENT_MASK); + jit_movi_l(JIT_R1, sizeof(Scheme_Cont_Mark)); + jit_mulr_l(JIT_V1, JIT_V1, JIT_R1); + jit_addr_l(JIT_R0, JIT_R0, JIT_V1); + CHECK_LIMIT(); + /* R0 now points to the right record */ + + /* Increment counter: */ + jit_addi_l(JIT_R2, JIT_R2, 1); + mz_tl_sti_p(tl_scheme_current_cont_mark_stack, JIT_R2, JIT_R1); + + /* Fill in record at R0: */ + mz_patch_branch(ref3); + (void)mz_tl_ldi_l(JIT_R1, tl_scheme_current_cont_mark_pos); + jit_stxi_l(&((Scheme_Cont_Mark *)0x0)->pos, JIT_R0, JIT_R1); + jit_ldxi_p(JIT_R1, JIT_RUNSTACK, WORDS_TO_BYTES(1)); + jit_stxi_p(&((Scheme_Cont_Mark *)0x0)->key, JIT_R0, JIT_R1); + jit_ldxi_p(JIT_R1, JIT_RUNSTACK, WORDS_TO_BYTES(0)); + jit_stxi_p(&((Scheme_Cont_Mark *)0x0)->val, JIT_R0, JIT_R1); + jit_movi_p(JIT_R1, NULL); + jit_stxi_p(&((Scheme_Cont_Mark *)0x0)->cache, JIT_R0, JIT_R1); + ref5 = jit_jmpi(jit_forward()); + CHECK_LIMIT(); + + /* slow path: */ + + mz_patch_branch(ref4); + mz_patch_ucbranch(ref8); + JIT_UPDATE_THREAD_RSPTR_IF_NEEDED(); + + jit_ldxi_p(JIT_R0, JIT_RUNSTACK, WORDS_TO_BYTES(0)); + jit_ldxi_p(JIT_V1, JIT_RUNSTACK, WORDS_TO_BYTES(1)); + CHECK_LIMIT(); + + mz_prepare(2); + jit_pusharg_p(JIT_R0); + jit_pusharg_p(JIT_V1); + (void)mz_finish(scheme_set_cont_mark); + CHECK_LIMIT(); + + mz_patch_ucbranch(ref5); + + mz_epilog(JIT_R2); + + register_sub_func(jitter, wcm_code, scheme_false); + } + return 1; } diff --git a/src/mzscheme/src/jit_ts.c b/src/mzscheme/src/jit_ts.c index b2b66c2e7d..50e8fafaf0 100644 --- a/src/mzscheme/src/jit_ts.c +++ b/src/mzscheme/src/jit_ts.c @@ -16,8 +16,8 @@ define_ts_siS_s(_scheme_apply_multi_from_native, FSRC_RATOR) define_ts_siS_s(_scheme_apply_from_native, FSRC_RATOR) define_ts_siS_s(_scheme_tail_apply_from_native, FSRC_RATOR) -define_ts_s_s(scheme_force_value_same_mark, FSRC_OTHER) -define_ts_s_s(scheme_force_one_value_same_mark, FSRC_OTHER) +define_ts_s_s(scheme_force_value_same_mark, FSRC_MARKS) +define_ts_s_s(scheme_force_one_value_same_mark, FSRC_MARKS) #if defined(INLINE_FP_OPS) && !defined(CAN_INLINE_ALLOC) define_ts__s(malloc_double, FSRC_OTHER) #endif @@ -41,46 +41,45 @@ define_ts_z_p(GC_malloc_one_small_tagged, FSRC_OTHER) #endif define_ts_n_s(scheme_make_native_closure, FSRC_OTHER) define_ts_n_s(scheme_make_native_case_closure, FSRC_OTHER) -define_ts_bsi_v(call_set_global_bucket, FSRC_OTHER) +define_ts_bsi_v(call_set_global_bucket, FSRC_MARKS) define_ts_s_s(scheme_make_envunbox, FSRC_OTHER) define_ts_s_s(make_global_ref, FSRC_OTHER) -define_ts_iiS_v(lexical_binding_wrong_return_arity, FSRC_OTHER) -define_ts_ss_m(scheme_set_cont_mark, FSRC_OTHER) -define_ts_iiS_v(call_wrong_return_arity, FSRC_OTHER) -define_ts_b_v(scheme_unbound_global, FSRC_OTHER) +define_ts_iiS_v(lexical_binding_wrong_return_arity, FSRC_MARKS) +define_ts_iiS_v(call_wrong_return_arity, FSRC_MARKS) +define_ts_b_v(scheme_unbound_global, FSRC_MARKS) define_ts_Sl_s(scheme_delayed_rename, FSRC_OTHER) -define_ts_iS_s(scheme_checked_car, FSRC_OTHER) -define_ts_iS_s(scheme_checked_cdr, FSRC_OTHER) -define_ts_iS_s(scheme_checked_caar, FSRC_OTHER) -define_ts_iS_s(scheme_checked_cadr, FSRC_OTHER) -define_ts_iS_s(scheme_checked_cdar, FSRC_OTHER) -define_ts_iS_s(scheme_checked_cddr, FSRC_OTHER) -define_ts_iS_s(scheme_checked_mcar, FSRC_OTHER) -define_ts_iS_s(scheme_checked_mcdr, FSRC_OTHER) -define_ts_iS_s(scheme_checked_set_mcar, FSRC_OTHER) -define_ts_iS_s(scheme_checked_set_mcdr, FSRC_OTHER) -define_ts_s_s(scheme_unbox, FSRC_OTHER) -define_ts_s_s(scheme_vector_length, FSRC_OTHER) -define_ts_s_s(scheme_flvector_length, FSRC_OTHER) -define_ts_si_s(scheme_struct_ref, FSRC_OTHER) -define_ts_sis_v(scheme_struct_set, FSRC_OTHER) -define_ts_s_s(tail_call_with_values_from_multiple_result, FSRC_OTHER) -define_ts_s_v(raise_bad_call_with_values, FSRC_OTHER) -define_ts_s_s(call_with_values_from_multiple_result_multi, FSRC_OTHER) -define_ts_s_s(call_with_values_from_multiple_result, FSRC_OTHER) -define_ts_iS_s(scheme_checked_vector_ref, FSRC_OTHER) -define_ts_iS_s(scheme_checked_vector_set, FSRC_OTHER) -define_ts_iS_s(scheme_checked_string_ref, FSRC_OTHER) -define_ts_iS_s(scheme_checked_string_set, FSRC_OTHER) -define_ts_iS_s(scheme_checked_byte_string_ref, FSRC_OTHER) -define_ts_iS_s(scheme_checked_byte_string_set, FSRC_OTHER) -define_ts_iS_s(scheme_checked_flvector_ref, FSRC_OTHER) -define_ts_iS_s(scheme_checked_flvector_set, FSRC_OTHER) -define_ts_iS_s(scheme_checked_syntax_e, FSRC_OTHER) -define_ts_iS_s(scheme_extract_checked_procedure, FSRC_OTHER) -define_ts_S_s(apply_checked_fail, FSRC_OTHER) +define_ts_iS_s(scheme_checked_car, FSRC_MARKS) +define_ts_iS_s(scheme_checked_cdr, FSRC_MARKS) +define_ts_iS_s(scheme_checked_caar, FSRC_MARKS) +define_ts_iS_s(scheme_checked_cadr, FSRC_MARKS) +define_ts_iS_s(scheme_checked_cdar, FSRC_MARKS) +define_ts_iS_s(scheme_checked_cddr, FSRC_MARKS) +define_ts_iS_s(scheme_checked_mcar, FSRC_MARKS) +define_ts_iS_s(scheme_checked_mcdr, FSRC_MARKS) +define_ts_iS_s(scheme_checked_set_mcar, FSRC_MARKS) +define_ts_iS_s(scheme_checked_set_mcdr, FSRC_MARKS) +define_ts_s_s(scheme_unbox, FSRC_MARKS) +define_ts_s_s(scheme_vector_length, FSRC_MARKS) +define_ts_s_s(scheme_flvector_length, FSRC_MARKS) +define_ts_si_s(scheme_struct_ref, FSRC_MARKS) +define_ts_sis_v(scheme_struct_set, FSRC_MARKS) +define_ts_s_s(tail_call_with_values_from_multiple_result, FSRC_MARKS) +define_ts_s_v(raise_bad_call_with_values, FSRC_MARKS) +define_ts_s_s(call_with_values_from_multiple_result_multi, FSRC_MARKS) +define_ts_s_s(call_with_values_from_multiple_result, FSRC_MARKS) +define_ts_iS_s(scheme_checked_vector_ref, FSRC_MARKS) +define_ts_iS_s(scheme_checked_vector_set, FSRC_MARKS) +define_ts_iS_s(scheme_checked_string_ref, FSRC_MARKS) +define_ts_iS_s(scheme_checked_string_set, FSRC_MARKS) +define_ts_iS_s(scheme_checked_byte_string_ref, FSRC_MARKS) +define_ts_iS_s(scheme_checked_byte_string_set, FSRC_MARKS) +define_ts_iS_s(scheme_checked_flvector_ref, FSRC_MARKS) +define_ts_iS_s(scheme_checked_flvector_set, FSRC_MARKS) +define_ts_iS_s(scheme_checked_syntax_e, FSRC_MARKS) +define_ts_iS_s(scheme_extract_checked_procedure, FSRC_MARKS) +define_ts_S_s(apply_checked_fail, FSRC_MARKS) define_ts_iSi_s(scheme_build_list_offset, FSRC_OTHER) -define_ts_siS_v(wrong_argument_count, FSRC_OTHER) +define_ts_siS_v(wrong_argument_count, FSRC_MARKS) #else # define ts__scheme_apply_multi_from_native _scheme_apply_multi_from_native # define ts__scheme_apply_from_native _scheme_apply_from_native @@ -110,7 +109,6 @@ define_ts_siS_v(wrong_argument_count, FSRC_OTHER) # define ts_scheme_make_envunbox scheme_make_envunbox # define ts_make_global_ref make_global_ref # define ts_lexical_binding_wrong_return_arity lexical_binding_wrong_return_arity -# define ts_scheme_set_cont_mark scheme_set_cont_mark # define ts_call_wrong_return_arity call_wrong_return_arity # define ts_scheme_unbound_global scheme_unbound_global # define ts_scheme_delayed_rename scheme_delayed_rename @@ -127,6 +125,8 @@ define_ts_siS_v(wrong_argument_count, FSRC_OTHER) # define ts_scheme_unbox scheme_unbox # define ts_scheme_vector_length scheme_vector_length # define ts_scheme_flvector_length scheme_flvector_length +# define ts_scheme_struct_ref scheme_struct_ref +# define ts_scheme_struct_set scheme_struct_set # define ts_tail_call_with_values_from_multiple_result tail_call_with_values_from_multiple_result # define ts_raise_bad_call_with_values raise_bad_call_with_values # define ts_call_with_values_from_multiple_result_multi call_with_values_from_multiple_result_multi diff --git a/src/mzscheme/src/mzmark.c b/src/mzscheme/src/mzmark.c index 1c0210a27d..fd4c86c588 100644 --- a/src/mzscheme/src/mzmark.c +++ b/src/mzscheme/src/mzmark.c @@ -5589,6 +5589,7 @@ static int future_MARK(void *p, struct NewGC *gc) { gcMARK2(f->arg_S1, gc); gcMARK2(f->arg_s2, gc); gcMARK2(f->arg_S2, gc); + gcMARK2(f->arg_p, gc); gcMARK2(f->retval_s, gc); gcMARK2(f->retval, gc); gcMARK2(f->multiple_array, gc); @@ -5612,6 +5613,7 @@ static int future_FIXUP(void *p, struct NewGC *gc) { gcFIXUP2(f->arg_S1, gc); gcFIXUP2(f->arg_s2, gc); gcFIXUP2(f->arg_S2, gc); + gcFIXUP2(f->arg_p, gc); gcFIXUP2(f->retval_s, gc); gcFIXUP2(f->retval, gc); gcFIXUP2(f->multiple_array, gc); diff --git a/src/mzscheme/src/mzmarksrc.c b/src/mzscheme/src/mzmarksrc.c index e7a2538c15..2a3a6d771a 100644 --- a/src/mzscheme/src/mzmarksrc.c +++ b/src/mzscheme/src/mzmarksrc.c @@ -2294,6 +2294,7 @@ future { gcMARK2(f->arg_S1, gc); gcMARK2(f->arg_s2, gc); gcMARK2(f->arg_S2, gc); + gcMARK2(f->arg_p, gc); gcMARK2(f->retval_s, gc); gcMARK2(f->retval, gc); gcMARK2(f->multiple_array, gc); diff --git a/src/mzscheme/src/schpriv.h b/src/mzscheme/src/schpriv.h index dcc6e14287..9cc124afcf 100644 --- a/src/mzscheme/src/schpriv.h +++ b/src/mzscheme/src/schpriv.h @@ -600,6 +600,8 @@ extern Scheme_Object *scheme_apply_thread_thunk(Scheme_Object *rator); #define GLOB_HAS_HOME_PTR 32 /* Scheme-level constant (cannot be changed further): */ #define GLOB_IS_IMMUTATED 64 +/* Linked from other (cannot be undefined): */ +#define GLOB_IS_LINKED 128 typedef struct { Scheme_Bucket bucket; @@ -1249,6 +1251,8 @@ typedef struct Scheme_Cont_Mark { MZ_MARK_POS_TYPE pos; /* Odd numbers - so they look like non-pointers */ } Scheme_Cont_Mark; +void scheme_new_mark_segment(Scheme_Thread *p); + typedef struct Scheme_Cont_Mark_Chain { Scheme_Inclhash_Object iso; /* 0x1 => next is from different meta-continuation */ Scheme_Object *key; @@ -2216,6 +2220,7 @@ Scheme_Object *scheme_lookup_binding(Scheme_Object *symbol, Scheme_Comp_Env *env Scheme_Object *certs, Scheme_Object *in_modidx, Scheme_Env **_menv, int *_protected, Scheme_Object **_lexical_binding_id); +int scheme_is_imported(Scheme_Object *var, Scheme_Comp_Env *env); Scheme_Object *scheme_extract_unsafe(Scheme_Object *o); Scheme_Object *scheme_extract_flfxnum(Scheme_Object *o); @@ -2268,7 +2273,8 @@ void scheme_delay_load_closure(Scheme_Closure_Data *data); Scheme_Object *scheme_compiled_void(void); Scheme_Object *scheme_register_toplevel_in_prefix(Scheme_Object *var, Scheme_Comp_Env *env, - Scheme_Compile_Info *rec, int drec); + Scheme_Compile_Info *rec, int drec, + int imported); Scheme_Object *scheme_register_stx_in_prefix(Scheme_Object *var, Scheme_Comp_Env *env, Scheme_Compile_Info *rec, int drec); void scheme_register_unsafe_in_prefix(Scheme_Comp_Env *env, diff --git a/src/mzscheme/src/schvers.h b/src/mzscheme/src/schvers.h index 78095ec7fd..3b2cffeec1 100644 --- a/src/mzscheme/src/schvers.h +++ b/src/mzscheme/src/schvers.h @@ -13,12 +13,12 @@ consistently.) */ -#define MZSCHEME_VERSION "4.2.5.3" +#define MZSCHEME_VERSION "4.2.5.4" #define MZSCHEME_VERSION_X 4 #define MZSCHEME_VERSION_Y 2 #define MZSCHEME_VERSION_Z 5 -#define MZSCHEME_VERSION_W 3 +#define MZSCHEME_VERSION_W 4 #define MZSCHEME_VERSION_MAJOR ((MZSCHEME_VERSION_X * 100) + MZSCHEME_VERSION_Y) #define MZSCHEME_VERSION_MINOR ((MZSCHEME_VERSION_Z * 1000) + MZSCHEME_VERSION_W) diff --git a/src/mzscheme/src/syntax.c b/src/mzscheme/src/syntax.c index d1b4ed06b7..0b7bc83c84 100644 --- a/src/mzscheme/src/syntax.c +++ b/src/mzscheme/src/syntax.c @@ -640,7 +640,8 @@ void scheme_set_global_bucket(char *who, Scheme_Bucket *b, Scheme_Object *val, { if ((b->val || set_undef) && ((b->so.type != scheme_variable_type) - || !(((Scheme_Bucket_With_Flags *)b)->flags & GLOB_IS_IMMUTATED))) + || !(((Scheme_Bucket_With_Flags *)b)->flags & GLOB_IS_IMMUTATED)) + && (val || !(((Scheme_Bucket_With_Flags *)b)->flags & GLOB_IS_LINKED))) b->val = val; else { if (((Scheme_Bucket_With_Home *)b)->home->module) { @@ -658,17 +659,21 @@ void scheme_set_global_bucket(char *who, Scheme_Bucket *b, Scheme_Object *val, msg, who, (b->val - ? (is_set - ? "modify a constant" - : "re-define a constant") - : "set identifier before its definition"), + ? (!val + ? "undefine variable that is used by other modules" + : (is_set + ? "modify a constant" + : "re-define a constant")) + : "set variable before its definition"), (Scheme_Object *)b->key, ((Scheme_Bucket_With_Home *)b)->home->module->modname); } else { scheme_raise_exn(MZEXN_FAIL_CONTRACT_VARIABLE, b->key, - "%s: cannot %s identifier: %S", + "%s: cannot %s variable: %S", who, - b->val ? "change constant" : "set undefined", + (val + ? (b->val ? "change constant" : "set undefined") + : "undefine"), (Scheme_Object *)b->key); } } @@ -1124,7 +1129,7 @@ defn_targets_syntax (Scheme_Object *var, Scheme_Comp_Env *env, Scheme_Compile_In -1, env->genv->mod_phase); } /* Get indirection through the prefix: */ - bucket = scheme_register_toplevel_in_prefix(bucket, env, rec, drec); + bucket = scheme_register_toplevel_in_prefix(bucket, env, rec, drec, 0); pr = cons(bucket, scheme_null); if (last) @@ -1729,7 +1734,7 @@ set_syntax (Scheme_Object *form, Scheme_Comp_Env *env, Scheme_Compile_Info *rec, if (SAME_TYPE(SCHEME_TYPE(var), scheme_variable_type) || SAME_TYPE(SCHEME_TYPE(var), scheme_module_variable_type)) { - var = scheme_register_toplevel_in_prefix(var, env, rec, drec); + var = scheme_register_toplevel_in_prefix(var, env, rec, drec, 0); if (env->genv->module) SCHEME_TOPLEVEL_FLAGS(var) |= SCHEME_TOPLEVEL_MUTATED; } @@ -1987,23 +1992,10 @@ ref_syntax (Scheme_Object *form, Scheme_Comp_Env *env, Scheme_Compile_Info *rec, if (SAME_TYPE(SCHEME_TYPE(var), scheme_variable_type) || SAME_TYPE(SCHEME_TYPE(var), scheme_module_variable_type)) { int imported = 0; - /* It must be in the module being compiled/expanded. */ - if (env->genv->module) { - if (SAME_TYPE(SCHEME_TYPE(var), scheme_module_variable_type)) { - if (!SAME_OBJ(((Module_Variable *)var)->modidx, env->genv->module->self_modidx)) - imported = 1; - } else - imported = 1; - } else { - if (SAME_TYPE(SCHEME_TYPE(var), scheme_variable_type)) { - if (!SAME_OBJ(((Scheme_Bucket_With_Home *)var)->home, env->genv)) - imported = 1; - } else - imported = 1; - } + imported = scheme_is_imported(var, env); if (rec[drec].comp) { - var = scheme_register_toplevel_in_prefix(var, env, rec, drec); + var = scheme_register_toplevel_in_prefix(var, env, rec, drec, 0); if (!imported && env->genv->module) SCHEME_TOPLEVEL_FLAGS(var) |= SCHEME_TOPLEVEL_MUTATED; } @@ -5858,7 +5850,7 @@ Scheme_Object *scheme_make_environment_dummy(Scheme_Comp_Env *env) /* Get a prefixed-based accessor for a dummy top-level bucket. It's used to "link" to the right environment at run time. The #f as a toplevel is handled in the prefix linker specially. */ - return scheme_register_toplevel_in_prefix(scheme_false, env, NULL, 0); + return scheme_register_toplevel_in_prefix(scheme_false, env, NULL, 0, 0); } Scheme_Env *scheme_environment_from_dummy(Scheme_Object *dummy) From 164e998cbd795fe4afa6fa8859708f80e5389e01 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 30 Mar 2010 21:33:59 +0000 Subject: [PATCH 032/202] fix syntax-case docs on how the exception is raised svn: r18679 --- collects/scribblings/reference/stx-patterns.scrbl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/collects/scribblings/reference/stx-patterns.scrbl b/collects/scribblings/reference/stx-patterns.scrbl index 7e07de976b..c41ecf5903 100644 --- a/collects/scribblings/reference/stx-patterns.scrbl +++ b/collects/scribblings/reference/stx-patterns.scrbl @@ -36,10 +36,12 @@ Finds the first @scheme[pattern] that matches the syntax object produced by @scheme[stx-expr], and for which the corresponding -@scheme[fender-expr] (if any) produces a true value; the result is from -the corresponding @scheme[result-expr], which is in tail position for -the @scheme[syntax-case] form. If no @scheme[clause] matches, then the -@exnraise[exn:fail:syntax]. +@scheme[fender-expr] (if any) produces a true value; the result is +from the corresponding @scheme[result-expr], which is in tail position +for the @scheme[syntax-case] form. If no @scheme[clause] matches, then +the @exnraise[exn:fail:syntax]; the exception is generated by calling +@scheme[raise-syntax-error] with @scheme[#f] as the ``name'' argument, +a string with a error message, and the result of @scheme[stx-expr]. A syntax object matches a @scheme[pattern] as follows: From f7afbfa207b3b0af37558fe68ef156356e06fb33 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 30 Mar 2010 21:48:13 +0000 Subject: [PATCH 033/202] fix for non-futures build svn: r18680 --- src/mzscheme/src/jit_ts.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mzscheme/src/jit_ts.c b/src/mzscheme/src/jit_ts.c index 50e8fafaf0..1bfd714c2a 100644 --- a/src/mzscheme/src/jit_ts.c +++ b/src/mzscheme/src/jit_ts.c @@ -123,6 +123,7 @@ define_ts_siS_v(wrong_argument_count, FSRC_MARKS) # define ts_scheme_checked_set_mcar scheme_checked_set_mcar # define ts_scheme_checked_set_mcdr scheme_checked_set_mcdr # define ts_scheme_unbox scheme_unbox +# define ts_scheme_set_box scheme_set_box # define ts_scheme_vector_length scheme_vector_length # define ts_scheme_flvector_length scheme_flvector_length # define ts_scheme_struct_ref scheme_struct_ref From 9bc587b53db5daf6e01c6f7dbbf7c366bd766276 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 30 Mar 2010 21:51:20 +0000 Subject: [PATCH 034/202] fix variable initialization in implementation of JIT svn: r18681 --- src/mzscheme/src/jit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mzscheme/src/jit.c b/src/mzscheme/src/jit.c index a303552e52..d911527471 100644 --- a/src/mzscheme/src/jit.c +++ b/src/mzscheme/src/jit.c @@ -7994,7 +7994,7 @@ static int generate_inlined_nary(mz_jit_state *jitter, Scheme_App_Rec *app, int int simple, constval, can_delay_vec, can_delay_index; int which, unsafe = 0, base_offset = ((int)&SCHEME_VEC_ELS(0x0)); int pushed, flonum_arg; - int can_chaperone, for_struct = 0; + int can_chaperone = 1, for_struct = 0; if (IS_NAMED_PRIM(rator, "vector-set!")) which = 0; @@ -11848,7 +11848,7 @@ static int do_generate_common(mz_jit_state *jitter, void *_data) jit_stxi_p(&((Scheme_Cont_Mark *)0x0)->key, JIT_R0, JIT_R1); jit_ldxi_p(JIT_R1, JIT_RUNSTACK, WORDS_TO_BYTES(0)); jit_stxi_p(&((Scheme_Cont_Mark *)0x0)->val, JIT_R0, JIT_R1); - jit_movi_p(JIT_R1, NULL); + (void)jit_movi_p(JIT_R1, NULL); jit_stxi_p(&((Scheme_Cont_Mark *)0x0)->cache, JIT_R0, JIT_R1); ref5 = jit_jmpi(jit_forward()); CHECK_LIMIT(); From 62fb1bed65060fc058e0a01c5313adb6bb5b710d Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Tue, 30 Mar 2010 22:30:37 +0000 Subject: [PATCH 035/202] svn: r18682 --- collects/scribblings/reference/stx-patterns.scrbl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collects/scribblings/reference/stx-patterns.scrbl b/collects/scribblings/reference/stx-patterns.scrbl index c41ecf5903..e646968916 100644 --- a/collects/scribblings/reference/stx-patterns.scrbl +++ b/collects/scribblings/reference/stx-patterns.scrbl @@ -41,7 +41,7 @@ from the corresponding @scheme[result-expr], which is in tail position for the @scheme[syntax-case] form. If no @scheme[clause] matches, then the @exnraise[exn:fail:syntax]; the exception is generated by calling @scheme[raise-syntax-error] with @scheme[#f] as the ``name'' argument, -a string with a error message, and the result of @scheme[stx-expr]. +a string with a generic error message, and the result of @scheme[stx-expr]. A syntax object matches a @scheme[pattern] as follows: From 6886f6540a5f3521128f5446effcd88d00a07e6d Mon Sep 17 00:00:00 2001 From: Casey Klein Date: Wed, 31 Mar 2010 01:03:25 +0000 Subject: [PATCH 036/202] Fixes handling of where/hidden and side-condition/hidden clauses in reduction-relation. svn: r18683 --- collects/redex/private/pict.ss | 5 +-- collects/redex/private/reduction-semantics.ss | 39 ++++++++--------- collects/redex/redex.scrbl | 40 ++++++++---------- collects/redex/tests/bitmap-test.ss | 16 +++++++ .../metafunction-Name-vertical.png | Bin 4823 -> 4744 bytes .../tests/bmps-macosx/metafunction-Name.png | Bin 4440 -> 4437 bytes .../tests/bmps-macosx/metafunction-T.png | Bin 4705 -> 4700 bytes .../bmps-macosx/metafunctions-multiple.png | Bin 9319 -> 9314 bytes .../redex/tests/bmps-macosx/mf-hidden.png | Bin 0 -> 1622 bytes .../redex/tests/bmps-macosx/rr-hidden.png | Bin 0 -> 394 bytes .../redex/tests/bmps-macosx/var-not-in.png | Bin 5086 -> 5086 bytes 11 files changed, 53 insertions(+), 47 deletions(-) create mode 100644 collects/redex/tests/bmps-macosx/mf-hidden.png create mode 100644 collects/redex/tests/bmps-macosx/rr-hidden.png diff --git a/collects/redex/private/pict.ss b/collects/redex/private/pict.ss index 5614499d40..234479f153 100644 --- a/collects/redex/private/pict.ss +++ b/collects/redex/private/pict.ss @@ -792,10 +792,7 @@ (* 2 sep))))) lhss rhss linebreak-list))] [scs (map (lambda (eqn) - (let ([scs (filter (lambda (v) - (not (or (metafunc-extra-side-cond/hidden? v) - (metafunc-extra-where/hidden? v)))) - (reverse (list-ref eqn 1)))]) + (let ([scs (reverse (list-ref eqn 1))]) (if (null? scs) #f (let-values ([(fresh where/sc) (partition metafunc-extra-fresh? scs)]) diff --git a/collects/redex/private/reduction-semantics.ss b/collects/redex/private/reduction-semantics.ss index 38c6f72a5d..d17da17341 100644 --- a/collects/redex/private/reduction-semantics.ss +++ b/collects/redex/private/reduction-semantics.ss @@ -406,7 +406,9 @@ (cond [(null? stuffs) (values label (reverse scs/withs) (reverse fvars))] [else - (syntax-case (car stuffs) (fresh variable-not-in) + (syntax-case (car stuffs) (where where/hidden + side-condition side-condition/hidden + fresh variable-not-in) [(fresh xs ...) (loop (cdr stuffs) label @@ -433,21 +435,21 @@ #'y)]))) (syntax->list #'(xs ...)))) fvars))] - [(-where x e) - (or (free-identifier=? #'-where #'where) - (free-identifier=? #'-where #'where/hidden)) + [(where x e) (loop (cdr stuffs) label (cons #`(cons #,(to-lw/proc #'x) #,(to-lw/proc #'e)) scs/withs) fvars)] - [(-side-condition sc) - (or (free-identifier=? #'-side-condition #'side-condition) - (free-identifier=? #'-side-condition #'side-condition/hidden)) + [(where/hidden x e) + (loop (cdr stuffs) label scs/withs fvars)] + [(side-condition sc) (loop (cdr stuffs) label (cons (to-lw/uq/proc #'sc) scs/withs) fvars)] + [(side-condition/hidden sc) + (loop (cdr stuffs) label scs/withs fvars)] [x (identifier? #'x) (loop (cdr stuffs) @@ -1051,9 +1053,7 @@ ;; Intermediate structures recording clause "extras" for typesetting. (define-struct metafunc-extra-side-cond (expr)) -(define-struct (metafunc-extra-side-cond/hidden metafunc-extra-side-cond) ()) (define-struct metafunc-extra-where (lhs rhs)) -(define-struct (metafunc-extra-where/hidden metafunc-extra-where) ()) (define-struct metafunc-extra-fresh (vars)) (define-syntax (in-domain? stx) @@ -1289,9 +1289,7 @@ (map (λ (hm) (map (λ (lst) - (syntax-case lst (unquote - side-condition where - side-condition/hidden where/hidden) + (syntax-case lst (unquote side-condition where) [(where pat (unquote (f _ _))) (and (or (identifier? #'pat) (andmap identifier? (syntax->list #'pat))) @@ -1307,16 +1305,17 @@ [(where pat exp) #`(make-metafunc-extra-where #,(to-lw/proc #'pat) #,(to-lw/proc #'exp))] - [(where/hidden pat exp) - #`(make-metafunc-extra-where/hidden - #,(to-lw/proc #'pat) #,(to-lw/proc #'exp))] [(side-condition x) #`(make-metafunc-extra-side-cond - #,(to-lw/uq/proc #'x))] - [(side-condition/hidden x) - #`(make-metafunc-extra-side-cond/hidden #,(to-lw/uq/proc #'x))])) - (reverse (syntax->list hm)))) + (reverse + (filter (λ (lst) + (syntax-case lst (where/hidden + side-condition/hidden) + [(where/hidden pat exp) #f] + [(side-condition/hidden x) #f] + [_ #t])) + (syntax->list hm))))) (syntax->list #'(... seq-of-tl-side-cond/binds)))] [(((rhs-bind-id/lw . rhs-bind-pat/lw/uq) ...) ...) @@ -2185,9 +2184,7 @@ (struct-out metafunc-case) (struct-out metafunc-extra-side-cond) - (struct-out metafunc-extra-side-cond/hidden) (struct-out metafunc-extra-where) - (struct-out metafunc-extra-where/hidden) (struct-out metafunc-extra-fresh) (struct-out binds)) diff --git a/collects/redex/redex.scrbl b/collects/redex/redex.scrbl index 5607b322df..5ccef04d8d 100644 --- a/collects/redex/redex.scrbl +++ b/collects/redex/redex.scrbl @@ -682,7 +682,9 @@ all non-GUI portions of Redex) and also exported by [extras name (fresh fresh-clause ...) (side-condition scheme-expression) - (where tl-pat @#,tttterm)] + (where tl-pat @#,tttterm) + (side-condition/hidden scheme-expression) + (where/hidden tl-pat @#,tttterm)] [fresh-clause var ((var1 ...) (var2 ...))] [tl-pat identifier (tl-pat-ele ...)] [tl-pat-ele tl-pat (code:line tl-pat ... (code:comment "a literal ellipsis"))])]{ @@ -717,15 +719,22 @@ a sequence of variables. The variable @scheme[var2] is used to determine the number of variables generated and @scheme[var2] must be bound by the left-hand side of the rule. -The side-conditions are expected to all hold, and have the -format of the second argument to the @pattech[side-condition] pattern, -described above. +All side-conditions provided with @scheme[side-condition] and +@scheme[hidden-side-condition] are collected with @scheme[and] and +used as guards on the case being matched. The argument to each +side-condition should be a Scheme expression, and the pattern +variables in the @|ttpattern| are bound in that expression. A +@scheme[side-condition/hidden] form is the same as +@scheme[side-condition], except that the side condition is not +rendered when typesetting via @schememodname[redex/pict]. Each @scheme[where] clause acts as a side condition requiring a successful pattern match, and it can bind pattern variables in the side-conditions (and @scheme[where] clauses) that follow and in the -reduction result. The bindings are the same as bindings in a -@scheme[term-let] expression. +metafunction result. The bindings are the same as bindings in a +@scheme[term-let] expression. A @scheme[where/hidden] clause is the +same as a @scheme[where] clause, but the clause is not +rendered when typesetting via @schememodname[redex/pict]. As an example, this @@ -905,22 +914,9 @@ expressions. The first argument indicates the language used to resolve non-terminals in the pattern expressions. Each of the rhs-expressions is implicitly wrapped in @|tttterm|. -All side-conditions provided with @scheme[side-condition] and -@scheme[hidden-side-condition] are collected with @scheme[and] and -used as guards on the case being matched. The argument to each -side-condition should be a Scheme expression, and the pattern -variables in the @|ttpattern| are bound in that expression. A -@scheme[side-condition/hidden] form is the same as -@scheme[side-condition], except that the side condition is not -rendered when typesetting via @schememodname[redex/pict]. - -Each @scheme[where] clause acts as a side condition requiring a -successful pattern match, and it can bind pattern variables in the -side-conditions (and @scheme[where] clauses) that follow and in the -metafunction result. The bindings are the same as bindings in a -@scheme[term-let] expression. A @scheme[where/hidden] clause is the -same as a @scheme[where] clause, but the clause is not -rendered when typesetting via @schememodname[redex/pict]. +The @scheme[side-condition], @scheme[hidden-side-condition], +@scheme[where], and @scheme[where/hidden] clauses behave as +in the @scheme[reduction-relation] form. Raises an exception recognized by @scheme[exn:fail:redex?] if no clauses match, if one of the clauses matches multiple ways diff --git a/collects/redex/tests/bitmap-test.ss b/collects/redex/tests/bitmap-test.ss index 9bc12d9697..350708f8c8 100644 --- a/collects/redex/tests/bitmap-test.ss +++ b/collects/redex/tests/bitmap-test.ss @@ -178,5 +178,21 @@ (where x ,(variable-not-in 'y 'x))]) (test (render-metafunction g) "var-not-in-rebound.png")) +;; hidden `where' and `side-condition' clauses +(define-metafunction lang + [(mf-hidden 1) + 2 + (where/hidden number 7) + (side-condition/hidden (= 1 2))]) +(test (render-metafunction mf-hidden) "mf-hidden.png") +(test (render-reduction-relation + (reduction-relation + lang + (--> 1 + 2 + (where/hidden number 7) + (side-condition/hidden (= 1 2))))) + "rr-hidden.png") + (printf "bitmap-test.ss: ") (done) diff --git a/collects/redex/tests/bmps-macosx/metafunction-Name-vertical.png b/collects/redex/tests/bmps-macosx/metafunction-Name-vertical.png index 631aa05f6d046212897bbdfc96ffbae590c03971..32fe0babfcdd86b90e7a48514df0940a2ac1fb20 100644 GIT binary patch literal 4744 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 Kg{+W&9{xYJ4^3DA diff --git a/collects/redex/tests/bmps-macosx/metafunction-Name.png b/collects/redex/tests/bmps-macosx/metafunction-Name.png index e4f7dc5331411cc3d70ad2ac520c16b4fd70e938..58452d8229e8b32380b071d0d2043c69b644fa82 100644 GIT binary patch literal 4437 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 H*2Dh+uluN& literal 4440 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 G;r{`2*`}QU diff --git a/collects/redex/tests/bmps-macosx/metafunction-T.png b/collects/redex/tests/bmps-macosx/metafunction-T.png index 23606d0bd557bf61c3efc56bcf6a8d00c535c1b6..a9d5a093b69982f9ed2749fcf1a5cdab64a0c4c6 100644 GIT binary patch delta 4678 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 delta 4683 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 diff --git a/collects/redex/tests/bmps-macosx/metafunctions-multiple.png b/collects/redex/tests/bmps-macosx/metafunctions-multiple.png index 84b93559ce224c7d523af16043f399c169936ad1..3b40817a406418496066ead288c88085ce662e49 100644 GIT binary patch delta 4312 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 P7#Ie+COQ=tu~Gj61Hp*9 delta 4341 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 diff --git a/collects/redex/tests/bmps-macosx/mf-hidden.png b/collects/redex/tests/bmps-macosx/mf-hidden.png new file mode 100644 index 0000000000000000000000000000000000000000..8545f0f19bf47b9a01949e5a375068ff1924acb5 GIT binary patch literal 1622 zcmV-c2C4apP)kj2t=%eD#A?d`*f_di~j&D;O?>G%BJ=RD_}=bSy~oY4q^ zfarkZxL7O>R|tY|xm+9$hfb$c^ofZH48v$NTDTqv1pIzKo6V*~_IkZ^Iz1*PCd!dS z34$Pk!61XdSlF->cs!o}W<*2*v)L?@$uJC~=ytmu0B{_SsGH4ZivH}`Gm%I%J$^|^ z$(b`}q8SMV3WcJywDif7Cm9(ThJ|JC(+v4IzB$`bULG4E)Iv&+}zCP^XIbG zvqW)m@qq&e7z_p?%a<<)fU&VLnM^h`G(@_krKOdXmF?KEgU{z9LPY(ej0lUxVzF2{ zIy$UY>&VE+_3PIGfbMiU6$-`Mw{MGzijtF)bvm8hZZ9k>Oh`yjsZ?IC_wnP$H*el_ zxm^49?TZ+`Fz)|U30tL05Cc_s#dEvY}imzQev~&$X2gk zzs}0aN=;4G>2#q`h}5lCE9!mEo;@8M9Z1w_wM|V;<>lpKu~;sbx3{;?Jk_|kI7(3> zK^7lM6`Cz@9KU$+BAd+?2m}WY9(?oW4FJ$5CnpUC!;vFL6bgk(rK+i^NlQyxzkdCt zOPAigdw1o^m2KO$?b@}A&*z^waUx>eQ>RYt+_|&5y1J*Q=j_?D01yZS+S}WGK3^yl z%E`$w8jYtFet&C@8=%tfHc#rKRQR)2B#xI2;)n831tW)-AbQo|~I% zGMNBiXlO{I(M(KCT)ldAYHCWQQq3n33xd47yd_JPAkOFWv$C=P;7^6FuC6XCD+7Q> zj~)qy!n(RT05BK~{r&wHE?kgEBwxOKDJUq27+0s$9X@;*0LI3~T3cJgKfQeUa&T}E z$8nKJq|s;`4#(i&AOO_W)up7Qyn6Kt0F+84hr>bs_4V~E7VG)*=QJ8^@7}!w0|U2j z-`>7`I{;*6X6p5N0FX!|8#ivW*=&nZNxHkcl}aT=+`M@++IoLOS63HW;6K^ix^*ie zD^{%7y?Zy}91drAcsRV7+wIQJ&qutbrba520zi6tI#PH%-uLg{!~Km$V`5^WNF+jL zc6K((rqO6DEG$IgvSrKUayjBAlPNAP?(*f!$n^XDA3uIX9OV=M;^X51V03hJF|wJO zn%dUZMiG}TT{=S(o6Qyo1hTWUfy^e0#Uek?a8qG2nOnAOL7d!Bv9Ym;Os_<4w_6|( zkmjmYt7g`nPA5SSBO@coOiD`P@py=17#1FRo@dD45EBz4kw~KV4+ev^wY4{H+(72+ z?qVz!tD&KRG$}iAI)p;u{rmT)rl!!Pud}n0)Zf2 zRiOeuTLgo_Ikbw8k3V+o7)3<4uIadY_pVGPi;azSyWQWueH$JgUfgVo#bUi)uhD4E zpFjWe=g*3YipIu9062Q|Xm@vaQc@C^%U!#6ty--{{z|3NXf)>L=5o1QkH@3cYPDMJ z9Qyt7;|JPJjg5^bPo7LjNQkl_m&=`g3PnUqON&OMA=iw-VAyQ7sNO>Jgxl@z?d|pZ z{S+O?@lT&Vg+d{U?r=B^27}#h|7T={Lh<6oi*PbCii?ZU6Nn@Wi>Tg0^8}mCPESv# z93ucA5{Wi#+BE&_TDfv%W@hG^HEW^?-qqFh`Sa&cD1=BL5QymJa=9!P3y$MHpAV5a zOyr-S5sPy;{y#9A&A)#A0stnHIXO8A08*)R`mzCl&1OUY9*~|wp>Xx;)eAeG-zQ3j UeS4BrtN;K207*qoM6N<$f}Fz{*Z=?k literal 0 HcmV?d00001 diff --git a/collects/redex/tests/bmps-macosx/rr-hidden.png b/collects/redex/tests/bmps-macosx/rr-hidden.png new file mode 100644 index 0000000000000000000000000000000000000000..46e14cf70397c41c828ae06d48432c0ef290fe3d GIT binary patch literal 394 zcmV;50d@X~P)HEGAB93Dk>nN_ON(d1}5t$VLH~_3x zD^*pWdoE*aD&n_D&-G0pB4g|g;#poO9)kWU?xoH1IB!e#eku7<@#B}W+&3|%y6^kn zp1Xtx*OdUEu4~tI0pNH%=6U`UJcez}K@%?@$5K92yd7cnLQIzZT8by)s`xL1T of4-7&x-}DX;4gdfE07*qoM6N<$f>_b7d;kCd literal 0 HcmV?d00001 diff --git a/collects/redex/tests/bmps-macosx/var-not-in.png b/collects/redex/tests/bmps-macosx/var-not-in.png index e6efc40fecc0b31e9d3bdabe7c23b99ec26b28e7..0b27baf53813efe057991c7bc89f91a0ce69bf4b 100644 GIT binary patch literal 5086 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 From 658fc0717d470d0b4f4cf1f19cec4a5ff3336187 Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Wed, 31 Mar 2010 06:36:58 +0000 Subject: [PATCH 037/202] Hack for chrome: catch errors when reading/writing cookies and just treat it as if there is no cookie. This is what chrome effectively did until recently -- so the relying on cookies for the return path to the user-specific pages was and still is broken. svn: r18684 --- collects/scribble/scribble-common.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/collects/scribble/scribble-common.js b/collects/scribble/scribble-common.js index cc37899a09..09c3390902 100644 --- a/collects/scribble/scribble-common.js +++ b/collects/scribble/scribble-common.js @@ -54,8 +54,11 @@ function MergePageArgsIntoLink(a) { // Cookies -------------------------------------------------------------------- function GetCookie(key, def) { - if (document.cookie.length <= 0) return def; - var i, cookiestrs = document.cookie.split(/; */); + var i, cookiestrs; + try { + if (document.cookie.length <= 0) return def; + cookiestrs = document.cookie.split(/; */); + } catch (e) { return def; } for (i = 0; i < cookiestrs.length; i++) { var cur = cookiestrs[i]; var eql = cur.indexOf('='); @@ -68,8 +71,10 @@ function GetCookie(key, def) { function SetCookie(key, val) { var d = new Date(); d.setTime(d.getTime()+(365*24*60*60*1000)); - document.cookie = - key + "=" + escape(val) + "; expires="+ d.toGMTString() + "; path=/"; + try { + document.cookie = + key + "=" + escape(val) + "; expires="+ d.toGMTString() + "; path=/"; + } catch (e) {} } // note that this always stores a directory name, ending with a "/" From e7e30384e15af838e05d07b47849f70de8f73cc2 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Wed, 31 Mar 2010 10:59:49 +0000 Subject: [PATCH 038/202] per-regstry lock for lazy module instantiation (fixes DrScheme start-up problems); adjust configure for better pthread flags; merge to 4.2.5 svn: r18688 --- src/configure | 30 +++++++++++++----------------- src/mzscheme/configure.ac | 24 ++++++++++++------------ src/mzscheme/src/module.c | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 29 deletions(-) diff --git a/src/configure b/src/configure index 9a2e8798ae..40e6229ce0 100755 --- a/src/configure +++ b/src/configure @@ -5839,8 +5839,9 @@ case $OS in EXTRALIBS="-Wl,-brtl,-bE:\$(srcdir)/../mzscheme/include/mzscheme.exp" ;; FreeBSD) - LIBS="$LIBS -rdynamic -pthread" + LIBS="$LIBS -rdynamic" DYN_CFLAGS="-fPIC" + enable_pthread=yes ;; OpenBSD) LIBS="$LIBS -rdynamic -Wl,--export-dynamic" @@ -10712,18 +10713,6 @@ if test "${enable_gl}" = "yes" ; then MROPTIONS="$MROPTIONS -DUSE_GL" fi -############### pthread ################### - -if test "${enable_pthread}" = "yes" ; then - PREFLAGS="$PREFLAGS -D_THREAD_SAFE" - X_EXTRA_LIBS="$X_EXTRA_LIBS -pthread" - -cat >>confdefs.h <<\_ACEOF -#define USE_PTHREAD_INSTEAD_OF_ITIMER 1 -_ACEOF - -fi - ############### places ################### if test "${enable_places}" = "yes" ; then @@ -10732,7 +10721,6 @@ cat >>confdefs.h <<\_ACEOF #define MZ_USE_PLACES 1 _ACEOF - LDFLAGS="$LDFLAGS -pthread" enable_mzrt=yes fi @@ -10756,14 +10744,22 @@ fi ############### OS threads ################### if test "${enable_mzrt}" = "yes" ; then + MZRT_CGC_FLAGS="$GC_THREADS_FLAG -DTHREAD_LOCAL_ALLOC" + LIBATOM="LIBATOM_USE" + enable_pthread=yes +fi + +############### pthread ################### + +if test "${enable_pthread}" = "yes" ; then + # FIXME: the following two flags are GCC-specific: + PREFLAGS="$PREFLAGS -pthread" + LDFLAGS="$LDFLAGS -pthread" cat >>confdefs.h <<\_ACEOF #define USE_PTHREAD_INSTEAD_OF_ITIMER 1 _ACEOF - LDFLAGS="$LDFLAGS -pthread" - MZRT_CGC_FLAGS="$GC_THREADS_FLAG -DTHREAD_LOCAL_ALLOC" - LIBATOM="LIBATOM_USE" fi ################ Xrender ################## diff --git a/src/mzscheme/configure.ac b/src/mzscheme/configure.ac index 354e16487f..bf8c72adcf 100644 --- a/src/mzscheme/configure.ac +++ b/src/mzscheme/configure.ac @@ -549,8 +549,9 @@ case $OS in EXTRALIBS="-Wl,-brtl,-bE:\$(srcdir)/../mzscheme/include/mzscheme.exp" ;; FreeBSD) - LIBS="$LIBS -rdynamic -pthread" + LIBS="$LIBS -rdynamic" DYN_CFLAGS="-fPIC" + enable_pthread=yes ;; OpenBSD) LIBS="$LIBS -rdynamic -Wl,--export-dynamic" @@ -1142,19 +1143,10 @@ if test "${enable_gl}" = "yes" ; then MROPTIONS="$MROPTIONS -DUSE_GL" fi -############### pthread ################### - -if test "${enable_pthread}" = "yes" ; then - PREFLAGS="$PREFLAGS -D_THREAD_SAFE" - X_EXTRA_LIBS="$X_EXTRA_LIBS -pthread" - AC_DEFINE(USE_PTHREAD_INSTEAD_OF_ITIMER, 1, [Pthread timer enabled]) -fi - ############### places ################### if test "${enable_places}" = "yes" ; then AC_DEFINE(MZ_USE_PLACES,1,[Places enabled]) - LDFLAGS="$LDFLAGS -pthread" enable_mzrt=yes fi @@ -1174,10 +1166,18 @@ fi ############### OS threads ################### if test "${enable_mzrt}" = "yes" ; then - AC_DEFINE(USE_PTHREAD_INSTEAD_OF_ITIMER, 1, [Pthread timer enabled]) - LDFLAGS="$LDFLAGS -pthread" MZRT_CGC_FLAGS="$GC_THREADS_FLAG -DTHREAD_LOCAL_ALLOC" LIBATOM="LIBATOM_USE" + enable_pthread=yes +fi + +############### pthread ################### + +if test "${enable_pthread}" = "yes" ; then + # FIXME: the following two flags are GCC-specific: + PREFLAGS="$PREFLAGS -pthread" + LDFLAGS="$LDFLAGS -pthread" + AC_DEFINE(USE_PTHREAD_INSTEAD_OF_ITIMER, 1, [Pthread timer enabled]) fi ################ Xrender ################## diff --git a/src/mzscheme/src/module.c b/src/mzscheme/src/module.c index 624e6a94df..dc24280353 100644 --- a/src/mzscheme/src/module.c +++ b/src/mzscheme/src/module.c @@ -3748,6 +3748,37 @@ void scheme_module_force_lazy(Scheme_Env *env, int previous) /* not anymore */ } +static void wait_registry(Scheme_Env *env) +{ + Scheme_Object *lock, *a[1]; + + while (1) { + lock = scheme_hash_get(env->module_registry, scheme_false); + if (!lock) + return; + + a[0] = SCHEME_CAR(lock); + a[1] = SCHEME_CDR(lock); + (void)scheme_sync(1, a); + } +} + +static void lock_registry(Scheme_Env *env) +{ + Scheme_Object *lock; + lock = scheme_make_pair(scheme_make_sema(0), + scheme_current_thread); + scheme_hash_set(env->module_registry, scheme_false, lock); +} + +static void unlock_registry(Scheme_Env *env) +{ + Scheme_Object *lock; + lock = scheme_hash_get(env->module_registry, scheme_false); + scheme_post_sema(SCHEME_CAR(lock)); + scheme_hash_set(env->module_registry, scheme_false, NULL); +} + XFORM_NONGCING static long make_key(int base_phase, int eval_exp, int eval_run) { return ((base_phase << 3) @@ -4364,6 +4395,8 @@ static void do_prepare_compile_env(Scheme_Env *env, int base_phase, int pos) Scheme_Object *v, *prev; Scheme_Env *menv; + wait_registry(env); + v = MODCHAIN_AVAIL(env->modchain, pos); if (!SCHEME_FALSEP(v)) { MODCHAIN_AVAIL(env->modchain, pos) = scheme_false; @@ -4380,6 +4413,8 @@ static void do_prepare_compile_env(Scheme_Env *env, int base_phase, int pos) } v = prev; + lock_registry(env); + while (SCHEME_NAMESPACEP(v)) { menv = (Scheme_Env *)v; v = menv->available_next[pos]; @@ -4388,6 +4423,8 @@ static void do_prepare_compile_env(Scheme_Env *env, int base_phase, int pos) NULL, 1, 0, base_phase, scheme_null); } + + unlock_registry(env); } } From b1801db3044b2e069d89b22bab21ef60504626e8 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Wed, 31 Mar 2010 11:24:49 +0000 Subject: [PATCH 039/202] fix unsafe-vector*-set! svn: r18689 --- src/mzscheme/src/jit.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/mzscheme/src/jit.c b/src/mzscheme/src/jit.c index d911527471..898e1f4bf6 100644 --- a/src/mzscheme/src/jit.c +++ b/src/mzscheme/src/jit.c @@ -7098,8 +7098,6 @@ static int generate_vector_op(mz_jit_state *jitter, int set, int int_ready, int GC_CAN_IGNORE jit_insn *ref, *reffail, *pref; if (!skip_checks && (!unsafe || can_chaperone)) { - if (set && !unbox_flonum) - mz_rs_str(JIT_R2); if (set && !unbox_flonum) mz_rs_str(JIT_R2); __START_TINY_JUMPS__(1); @@ -7189,7 +7187,7 @@ static int generate_vector_op(mz_jit_state *jitter, int set, int int_ready, int jit_addi_p(JIT_V1, JIT_V1, base_offset); } if (set) { - if (!unbox_flonum && !unsafe) + if (!unbox_flonum && (!unsafe || can_chaperone)) jit_ldr_p(JIT_R2, JIT_RUNSTACK); if (!for_fl) { jit_stxr_p(JIT_V1, JIT_R0, JIT_R2); @@ -7635,7 +7633,7 @@ static int generate_inlined_binary(mz_jit_state *jitter, Scheme_App3_Rec *app, i generate_two_args(app->rand1, app->rand2, jitter, 1, 2); CHECK_LIMIT(); - if (!unsafe) + if (!unsafe || can_chaperone) mz_rs_sync(); if (!which) { @@ -7682,7 +7680,8 @@ static int generate_inlined_binary(mz_jit_state *jitter, Scheme_App3_Rec *app, i generate_non_tail(app->rand1, jitter, 0, 1, 0); CHECK_LIMIT(); - mz_rs_sync(); + if (!unsafe || can_chaperone) + mz_rs_sync(); offset = SCHEME_INT_VAL(app->rand2); if (!unsafe) @@ -8073,7 +8072,7 @@ static int generate_inlined_nary(mz_jit_state *jitter, Scheme_App_Rec *app, int else pushed = 1; - if (!pushed && !flonum_arg && !unsafe) + if (!pushed && !flonum_arg && (!unsafe || can_chaperone)) pushed = 1; /* need temporary space */ mz_runstack_skipped(jitter, 3 - pushed); @@ -8150,7 +8149,8 @@ static int generate_inlined_nary(mz_jit_state *jitter, Scheme_App_Rec *app, int /* All pieces are in place */ - mz_rs_sync(); + if (!unsafe || can_chaperone) + mz_rs_sync(); if (!simple) { if (!which) { From 860f81bcef1043d36445f4dac8677dce096b58df Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Wed, 31 Mar 2010 12:36:44 +0000 Subject: [PATCH 040/202] updated the unix bitmaps svn: r18690 --- .../bmps-unix/metafunction-Name-vertical.png | Bin 5085 -> 4924 bytes .../tests/bmps-unix/metafunction-Name.png | Bin 4692 -> 4695 bytes .../redex/tests/bmps-unix/metafunction-T.png | Bin 5793 -> 5781 bytes .../bmps-unix/metafunctions-multiple.png | Bin 13163 -> 13153 bytes collects/redex/tests/bmps-unix/mf-hidden.png | Bin 0 -> 1628 bytes collects/redex/tests/bmps-unix/rr-hidden.png | Bin 0 -> 551 bytes .../tests/bmps-unix/var-not-in-rebound.png | Bin 0 -> 3831 bytes collects/redex/tests/bmps-unix/var-not-in.png | Bin 0 -> 5332 bytes 8 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 collects/redex/tests/bmps-unix/mf-hidden.png create mode 100644 collects/redex/tests/bmps-unix/rr-hidden.png create mode 100644 collects/redex/tests/bmps-unix/var-not-in-rebound.png create mode 100644 collects/redex/tests/bmps-unix/var-not-in.png diff --git a/collects/redex/tests/bmps-unix/metafunction-Name-vertical.png b/collects/redex/tests/bmps-unix/metafunction-Name-vertical.png index 3698cfbc26224d3d3350882053720a208b9749e0..ec6d387b6bb142364cf6f9baccfb226fa0c4b0d7 100644 GIT binary patch literal 4924 zcmV-C6T|F@P) zXFyX|AIASDgAg_{1w=vi6hRP+;;cmxaTN!3)H>?hq9R(Ywpz8dPHbtZ;;dj>wH2#H z)QSrcq>3VlgC!y&n?M3dNOIl}Nq|5INmv2$`xL^t=REiPbMHO(JZB(`F(~N=5PDjG zl5RpVBF%pOtsO#I77mUs9)l3lvT$(n`Xs)xXYMxjX||?0umF1E5z^^xRLbJK!}m@OoN9Pa%x7bI8Yo61QxH?4k;?T8%s(GNT3 zIP0q*^2n${4&a)!pM!@DKnRgd$Aq3dG?A(~`+BV$mDj5fMw;rfCVVb8dhJhHEYSo! z7RP+ncNfy~3Ubpgt~ZNc@xl6}re_wX_*B^M141vPr(fT0ePi8}X#v5pgTIVRe|&kf z*|pFG2cNM40B~*cCf|TVc)^L(>{r>zKfnKK>-#f~y4SV!2*d#f6;A*>=|}Fg6Fj7@wd#}A4ihaKZq&fwE3Lom7W=^YP|9u17nOig@@e% zybizSV2m-Ye-JtdNaJFPxfo-N>4_if6FrX=aWUqVo|&Yk_fY~(m<==IYb%n|{v5XO z3klC@ZsqlrW?&e&ZiX?Kd~&6n+wKENj7aZeZ#csIicX9oQvJ@A3Nos_yTS<6XZ>3v znn`=lX=MbiBihwTmVk~-KTXG|4z`3ZvGP+m{-n$q2%^{ zi3Hv8yMGUf8@)f)Jmk*4_w@(>P;+^T;na8*007~==(mZ%1~iExja=<@iGn|vh5zO8 zEJIxdGC{+Bk{vOo{VSpcNY&WZ*;wYodJvJfEcFo^_xaZxUVAi$E%*l0ZhYn!a@%3Y z&DYgTF2=ODDHOzO>TE#-5)lbMBR~XFV}=L;2-0CL53Ihb>iJ3 z0H}PKOXEM>HGHGep9(k~pbzbdB$7#}t=#2=nHFZ=#@$=@quYx3N+$ZqBN|WNz0uzJ zn@w>({5EPs(Y@3fyJcZ>JqD2hfK`z4g2l6vu?)%(9|v;e`MCVePIf9X9*Y?dz75)v z>woNu=P%P%Ej;XV?SED(1a&i8ho&^_EEz$-?`dm)F%I>)Stur?X_8NGj7Gk)93A9Kdhar8rLLk3Hq)y==_aElXb_0 zUvmka|HHUD>m5`@QpqHeU_5ohOx3_u%Omu6&oZyRvHR20B_R71-^=gb002nGck8Zk z!b=Ys1ROfG0(QIWYU!B_Uz0t3+eE4y)uQRWEAiG|@9aH+!-fvFaG3Pj@t4}x`mLJK zE#OsN51V_Cx%6~IfDsW?tX4!vPI$g4==-#~7TL=rl3);U^m@d^+^yqm2iXK3p|06A zMunu>>9=>qqla38qV!-NS$*1u!9>SBFWI7B_q{%{_O7e$0g*I~3>jzUy2n$s$oh;k zbKS4#dhd-t;y0ixE;Z)!(i`R^fT$F-H^D1v|`Cxj)3zp>6GQfQkrzl+q*f@ZR28FN=IdOGKyv=_pBbG(bP?IDi3V@r&KNx1c3U? z=yPwar+erkklGTixjI{0GvJ?U004H@b{m9r=HI9V;CBeCj5u7#@1bVppIhxSkcbe$ z(CgDb@*8hGZQ0f0>}2V^ZRy0A~lEsymfcO%{X={RN zJ9Q+!8Ffd#VON+_5a|Zm^KS^d2Dl}E2OFXxpWmwDRNq-`f%NB|f5&OrWakz~kER$c zPhw!qDLm>$LR7NFx`*``H{^!9kcWPi!Q|V8l!3nMPbWUfOpab@11i2J3ON{KUd_FA z))dp3doDf9ewCeicEdgZqc*jQ*X!oWF49#?U=tXf8cgv4TyN<8M3#CVhRm)@ld z{**);*3Ex=Y-;A?%R7A4z;63fmKbTg@-sdp-G#U5l1pr% zO%&Gi@9e<%(`1IYf3^eQx(92`z--NbbxqYJg(b{>x!Zwc{moMruDs|!z;5;SF*>dX zavFFgzmHQjSaOFhs3Xrq1^kNUm7N_=rcR5eNw%w7*~#sD+bxhryl8F8q(^#JzEz=3 zk(N}V#7J|Cj*S4~q>I&UoV+9mfY}T-5LKFW{PHbf%7y*0Dj|O~S;DFUSB~ftQ-aB6 z<0crrin~`@`|Q#qwXw5i&9QuSF}1QL$fQSbUJ_k-dKsN7u~3;$N(dsV zkbqlXFVAp45)f20D8ONHM5Hvgghy+W1eS0O7XW~uZl;fbXghTz_4tM4^rA$j`+jFj z)AtQ_T)3ZRmc($_?5@rK*)(^r0r5ZKM!P!m8>d!HKrXbjlO-f>11ZE;h#Vl3o|fm; zrYqm7&}ykll=uk792N&inria&VH1FCXk!Sq?`j%bIZc-EPP>Fv3lHb8`C@Gy_}C5B zA_9PhYoKdG^3kJz7TX36(^4He*_)7b%P65B3NU{~jykIR?l)ljCyQi~@L z34pmg`HGN|)-@*GNr`A{0jKs|4H(!M%Ifk101$wv?>^eBE+?moA8Mf`d@^d$K;0?8sr1rs+1g_!SxCP6_;z*XCjX^BUQN$? z{pwlDrC+{SwfC{uJ{Fl0ODi5xO|7&m?_W*LD=90lV(Q6KL}wuBq(rsViN0m93Lh7% z4I4jHReZjZ!5G&)2(!@k`?HLPF}LE{GE*@5a%*3(mnmPdhPg-J#@Ir( zn4=^nZq;6qUVQ!YsJRYW003aQ`3X}7JuSXz$PITU4cYiuV6!qaw_1_xzkeY{Uh}rM z#FJ{NtyzWN|J;1Q^b2J?F(=)5#uQ&xsvE>oyJDJ4zRKl*mj5v$1aYwYCg$!z9Ya%+pqh$hBrz29^1i*Tx5 zSF4%p%im$G^r!m^{ldFa0?J7DAC!^qFUT5cc6Q_pS2HqFof==$C4#yH#UB8}tw@Pl z6X5AG-21(euGY4rmmPjo)4A_Kvi6{=Sg(prw47!)h!qEmT| zb2ICnomw@{+1bO>&ECdyL3nZ%518qjED%D7^1;b-o5qiJQ@T2f)-nTtB3ZD%V?hOYAsr(k<>F z@3dQP*_E&bXGfm6xxz{w7rJd)&7Zak2r%9G*X8F^X^*UDZujC%(mwXbjhta=*=`H% znru--AQFV*N{9$S(^v_U#b+M==-F~!bVKt)nh>A31-)|s3^Ogv#(jUGxPR#c-ztpu z)e!R^UUky8>FcUD$Dj0qx zy_x>1mOfTcl9Agu3YPJ3&x&n{)nYr=rA*vw2f$Dq!v1aJ?tO2Uhq$W5^t8P*mu4)E zJvPsr4D8&qk#TR@UEWCsTHnxX5*FwJs7*Ov&cm2jcJ6%&fX~}q9W6Uc%H<1hg`b+N6F_t(if>(1d%m&cV;2*9$&MnB#O1>Dm z;nO{j>cku+F>yz!%lc`u(UAF33CSrbDJdx_HzGc8Thml@Z9}E;=Aejzd{C8niM1Z{>0BBkIge5aD<}sd~ z`rlYvOGkH454Vv)yYG~9njd245q$P-V=%=fZceWr03#c`lG8q|+~Q_MH{?gSsaSpW zM9xtN7%OMh_6oRV@he9xt={|ak2wS7etawY$P^!3UsO1F=k=4b;F0d*YaBG@C7+osQ=}DR-B1Zg<4-RT=`xndas~h?cOIa(EVQZW zB$X&t1$W09(h48xKE1|4<0;BxX3L18M_QUS`vJFJ<3P?W0wmC?(58ytJw%^h|LQ+M81WK*!R-Wy04Fg(uLKldbf!`VAV~6gtwqZBKaxk)<`v|oUp+X-lwh(lk-rB)YeSk_df`J|FbE7!cvg^;a&ozoCV)n(oyPgu%4i#R zk&Mnk!6V&cd&={3>d40NohPGnQ20n=%%dfS3<3c2kUQ1O_LT2t8UF{#`F;kB4B(Ie0000 zcR*9u7st=bAcTz!*($P!iYSQ1JrP7)1(iDLtgWMnR%=^ZwY5&Hv{n&E1zV9;s1|YI zLIn9KiXfmY5fRx05=cUl`}-pakdRG~AbkD`;k>% z-V>_fX=dJ!4j860$jN!g2ulpp8RX>RxgxQ)d+s*P89OEqb+I?WFijVCR~LH|4ATj^ zMeP@UL>2Y)Ghxb&mSlH!fJTdLS zq{h|{-L0szw6*D?!y(ZntnT~Cy$?7oEu8Mw&|UC7?YjO`%j9o%+^!S8V={}PKcDPm zOu{e>Q@0qsGBS(GGhx4p7(p~!^=IT~UM2(#)3lv)=nQGtusqu_g*JY-{75IgG2Uvn6O z1{?;BH#VS7=`d7b@_{_|kJ8f@mnlaNqIBvk#37Jo? zY`3@`vgmLw6951;rfwVOe+(@;ou2QL;85j+MO|wnFY{k`Tw$ulb2$5bV->~@Qm7N}qC;P-!@(OCazq&tY&b`qf zSctUeG^e>d?^&iua!RSvMZSO9H4mcor(tXNdwum&s{hYz-*W2HkA{4CAof8CzmX8h zb*;Bgyvgt(26zAfAm~}>;mzEg^l+_zVrf-WHUO*m{`01q8g^Lm?-U+ zh|{0A_pkK{V-Chyt-p6*ssRoF8m`PR_Dy5}0N_4~dYc?JLJns*B>Hms2 z)*(ZAGC|96iUU4cdW#SOQ#Y}9HIe(UZbaZMOLOGb1AYz1zl(=dp`2*jjChAsVN@}UHPApk%$a<(NECtQ8G-p-j+mlpO# zSRr8YdKzc!w|j%#=xu(>$-jmAIqEXrX5EQPq%JtPd6<+|jT%zE3H+%t@Zzl{)AYxN zT^|y%@RteqHan>cSji<4XX3kMj(Wh_RpEwv=UUa@+WXnL3Xs3W_wc(n005>pZpWSp z{HBK)`5!yG8uq&D>ll~~-!RPkkgbePQBE%HSExZ z7J^fIGc@Qhefha?|NeMTvsoQ=bW+~7z@Iakgo>9-B+ke`@@Dwt!W|RrE$sqMkT>ob zt42^)`t4oy=%${aAl*1d)||0r0N#1uOQzu0AKn<5w08A=zzEv?jcGAK?uld_q9H9N z$o;Cm*Z#y4KK;6)snPS!oyoSIINC<1IsfW`Rfpbs9GWw*?IoZ&W5>*8|CBXW>h)uP zzPo>F-9XcmU6TiCb5CF2dDi#W-oCH#{q6)qeevnuLAxFqv#Q`V zwbup!RGpTp7q4lZX_P!qb87E?GksS03x;HCIbgqu7(p~&|G#FXmDs~UH5bMZ`z^Vr z;Fvi3UEIn^D`QHS(oIE!0{~#X`EzM-lJBW~Qw&sNWa0v9qiW&g?$v|u@4Ib&?V+vzRVpL`2hf}y z75mn9)(CwJWDW^8T$`t>?f+jr001**ryYjrExgqTz#R})8+p8xJ3`GUj@{sGipMaV zvFB&!i(79!;=&A;f8T zu*sHWK4;(M$N8`F(=Tipr9mF^dl3`ygN$H0|HRWe7MsyXYms0q0-3}kPDQjA!EpI~ zD(_Eu^zhGX;@1~avomiV@X-aMG2`9*cE+V=KfSVRoCY}Te9jOdjZ+=tP0(L_mnykN zA#H*%@_upvlh0CVqW&obKuwRnv;d2Z|7&WyTrz}&nJ@P`5o~{W&Oo)7{Q5a;*f~~j z=%IoZPQ_mn)Qy(iqw=ni$FUObh2~UUm`EhgOr%H-S9b^}OOI^}A&Ypyt0|Wr*`x9u zDsA($q#7l9nq78sB;co9suy$elE49C(wKl(Yd7%A4GELt55}pjKi?J-R_8_K@ZQlC zh-fikQvX*84=NjTFF(;3KX>kY>sOc3Ya6oueS#a|@5~M6;7#0z8gc`}7}?ldtEH}? z1%O_B|9MkQ)FfSgm`~kxX926GsG4_^6$~d!G46mY;suY8OAqh7Bu3?_RaCabO65K& zJ{Vq&0PN;wMW*`^0H>x!0v3ZMAf{6)821xu4OeIX;L@QB$OhqXvIJu>$RNH(-~hSw z2%neOsCt(7@;v*Qb7%U)YYbY{?jRT^woiQ}NYiRA|w1tFsJ0z`Le7u0k6>IOr z#bJOB9ssn41`KUUjg0)e+&*BKj{4wfUbvJKk(b|D`Fv!I7hfSSTwQQ6p;(qzL%ED) z7LUW@0I@lWRUsoCub6BnC7?|RR^z({FtRh2H_8tHfCIdt`xuL+f`U4(tN9_}GZ9Os zZT>54WO~TLUvfmf!r=@&{cLKl|B-Dr)5{14nlAn>m6!j_*Bv`$kmT0K4OeGx^ILx8 zT4vGfSGj4IfB$Oj{-+|xSmZL6RXj#Ex6!SAcrCrCqN=)%ZXiz;%0SXd32JK+e9K^z zJ}uW6HgT}J=yD~45Ndi9I!M>&?L_=PK5+8WFHH zu9PX_D2c`$`YW=FZ_bMda?$|+0PF3~=yK>0`lh8Y%#|>3>r-Bsm7cxBhT!<~3lZ|# z_q`>al(4pT7yRKmtA4ZMt2iP~UMhePLag%Gc~--BJ!_I?-A6aVdK2Ym>9s$XF5OfV zH~;{=$=s8%AE&Jexl*N4V^V#z(fs7cB`0i-Ufk%Q;7De>s3p6xtO{>tqS5nX?jIto zy4Up@R)&fXSog)JdkeiHcGU;;dAj$|=jq;pyq;#}ADunaf{3a6CN^}5pgy_?c|EOW zyEZO4a=HT3`}^o#de_}sMJBOyi;Q-jW|c+<+Non0X5upI$O|T*+DrcWmh01-0hk5H zW;^O*B%66>UhyJk?22pK#+%|XOxtD2*`n69nN7K8*G_PC9pT~TXy>sgEVYgU^vrF8 zFbu;;)6c|in_z~=Fbo@Wp$3UG7NDo)L{JeKVh|WHYk76lonX8wg@zD9lxrXB01Vvv zl#USMRK^C3+s7Txr6l^PgSN-oKXdA7cXmwaA&n@=x=7C}^o5A8c9p?&kkqqS^w1$KE za-TEK;>$-(2sPea?Kx?zA!ffjmw`C7mxIRqz*_-LN%SLu%Yl3*LfmytIQv~W41`*W zj<{i3^RDryQq(8-se}8`S1jHk{E>earL?qxF5XyxZpw+kEvYk!50ocEIS9qHiB>*y zt+$^0w_uM`Q(T_M)^CSqO}lWlbcKW|2_vuPcR!_>?jjEDdLcx_{Cj6q`}0D95= z0z@rXJ<3HB2LON=b>w~qMU_k#005Ypl}mr_AvzWoKur>BEU?tJJ98q)yL47c{)jF} z%^(LI)=%5``XEi8)R@Hqaw5cnGhHZfSo=8={SckUEEin-d{*&L6kW`@5R!lBidFjc2o!kQ0HP5o+gtuvFB) z^n&k{Mvc>I{}t*g8OotU-&@^ru8-l1sACbymUD+`YY$&Aj{M}r?-7}fb6lmZ^jEj` zwtsYed z$bHW{tgYr${yjre-TQDhje}SA$5p;r@;W0H9;-9hyo*h(pUg`}uf#YiD z+#cEIkT75Wv%%Yxq^8x+c!1}p2MyeO+I zFGxAP#+g9$IwE$VKzGUDG(I`LE9yB_p($e`>5ZONk(>zcSw`QSliot_ig5I1`aG>D zoy>92`TCoSE^ZpFgW2!Qk!kVC2jS_SnB$;xw7fdE+2OMH5fKroOlVT%AYP$0(vcjp1BaHVaRPEw6B zUEueTLt5oM{XyqAXgx)_0^y3G>YkP*XFs5hISv%uB0vHiDsB5Hu|`Qb4q6L%4?6&; zwx?yw+21aYfSrqunx=uGTLdVIq)iEgwCU?>h)4~h%)2-BR*?CW*WqRN7n=z7&1HF* zcM~6cj)P7>Nm}jc>}W*>06lA`A(Os)%s&BfQSH76#|H(wDsj!o<@Ng?pPz3kbnj5< zk&`~;1T~kH4%mJ3%sgQ?L*GjI-a}uT?k)6ry0_3fJgxd02(W9?A~yPa3>ohA(Ws%e z_G4Baf6}1bIGbv}Pxl^Z>AON>&0?O$`5565C1vYK?{S~#y}TG`A~7+iJoJt>tqi(0 zn2pyTHutNLiAHz;z;r!Uu6Aimh)AI*u?Cg)bdTOZKt41_{dju4BY)H!BajGy;gstf zc^?X`m$d@b7cDkD}gjP*eIkbE3zI(uS0k<`!%2Jr5tQJO0m# z`kO&|8a{C~9KC_Pix|O8sDF{)*T_q#>#?K znYh;3Y1QQlWv$ZTqtef5E>icD$AE0_JBs`~J~i`3GTnWqtM!jRk4$a0ART69u*;pY2`T$4?^t#8yx)0)u)9e z#W|^$j&AvE-;*X0M@cm9EKNDTPU}B#VMJ1DT3T9KTH3Af>24d-mH1dtWl#6$4Fu$a zQ*q9_LuL%&syjztEUUNB1A1hAD1|;x_ZI#S#|a|uszrp400000NkvXXu0mjf3l;4I diff --git a/collects/redex/tests/bmps-unix/metafunction-Name.png b/collects/redex/tests/bmps-unix/metafunction-Name.png index 0271369025207cd6b05896a93ff1decd2816df6b..8847fd8d82fcc07f7b336b875cae2652178c7683 100644 GIT binary patch literal 4695 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 Z zcR-UzAIE=}K@#@fpdx#S2!dEp5v{dQK-8j@T5Dakt&>`PwXb!w)@^HFtB9kDZG|e< z39YzLL8>^QfU-nX_D&!PN$&k412PCn1R3V@S4i%;``+*Fx#zii?)ic+#-K)xnl~6i zZwq*XVOJMEqw{)Og&NtkRX={lctfs`ePa}0=YQ*rknRvyw_!du2qE9$@=t5G<=D@` zwF!Y_!;fw-R6Cqoku*Pe{>f5y_p0iX5CED|!f6PhpGY!;l#%DEFa*$}(BcgZp5Y0l?Ot0Iu`g~QN3Q7+k90fd<%(Y2d zxBhCqQ-5<3LRt=yyY4nN=N_Kt zYf3_hWFI=>ZvX&b=WcXFNdJQ?%>V$*tQcF3kq657@nn@GE)B3CB1ACt z`}Fq`(d}$!@s|}J#T!d8@l7cagQC+pHHQMU5khF_x@?vbdRWSIGdajEQI@uLXig!c z@YUEGy)-v{ePG;}97YA-xJPGa8WP+#<}fkF^t6wS(6BwlZ5X%a9{GM>(yg50(xQhc zd!}0vEElCUV~jE8lpXK}pjeFmPeOXm!^=A+>w!t&IIqx+NtrnhE^ZpD3CO}xK(G~Hvp4}-Klw{g&9W|xa$CDPyM?|JV$Q% zQ9q;;mD()&AYCfPt@pkh+(}%GW?!SrIs{`*={_&e`{0T&M}_LhEk7PeFw0jtN=-1gyVRMZA@{L^%X?Ai|$M5Dmrm&~Fc zN0GJOiGRWAI0}ftt2#N3YQE?;17l%>`5k!1Z}rx@D{O!i6kpE87-LLNn`=z;J@kT$ zF|X?6L`|a)QyYcZFth(_PjcT`DC$|Ajsh5S>n<;{2GfX@Q_R6~UUCh$%PPqb>3`_C zuxoN(92rfdO-`&5WYm0fp&4kYI12Du%kv*Slu2$Gy%VV|cb8j(^|F6jl&T~9$yQgA z!-juZxbAGIq4Uy>WAr_D6}Isze+#0Te0+m0sHyM%QhrT&)d}OtwD&GG%8$QPe7bHd z2^0}8ex@mnEcgu=^gK| zcnz69&3$XI4nhbaf@#z>W^HM`=#GzQK4O>=5dZ*4`quhHOK(?wg6K~~ucmVWm?by= zZK*vTtcL_pJvJ6{YKvyF3jSc0{Zq`d3-T1m1Z|gz&P3^A6$4Stojiug#Kl^xlZ8LbX0U;%L26%fRHTk% z>!4t>rx$KlHRqkXuQ_h&)aiCl&t}#&W&e4f;1lMi$*-xox2G|`Hi%|wrQKHF)Yf(U z#p9!FV=2@?Vko6YP%j0#nVdpZ?tzG?K>}`T>i}ObBX#^kYvk%3p@(NJkDIqu@C|Of z^7-T?>5;!&{XNXXN{>Rn7-Bkw+rH5V5lBQ~Z$=0Zfh6ks2muJvVJ;8s|C^n&!CjT* zFy^zgn=b&M?nzN2H&BlRpglJB;lE8>004rPwJ~%hl1L`?%;N@TR*a+f&N5j)=|^8H zJ3dxh#xDd7Z3=K$9ITQ!vXYOQK-(t9~_15Fp zuVZrn;(x+&2J3uKtlJ)Aen@JVgpiqf&r~H`1;s8lUlO!)u|400K zMKllJy4odc!w08b48P=R7L6t0NS1ro^9!IaetIMMGV)a4xQvrxOFh@T!roA zw@l^U%_tRrWgAN|@dP3PFqfxV5egz5F~uq+rcDA)b43%FIGSp7tI|G)&j zL*!qzm5RS|jisP?M6aG_92t7{l^xexU1VNUft!G8GD$YoY)&?Mg$G}g~#^==dX$SKC4AMopK@xCSh@x_f9BU zALL}?7;%ucY|9u8619h>3^Jj)MbEG)Jd;_E6|W-z0NFYy*b=}Zc)Tqc0O|XLy8}>0 z3Ks=BN2&NLkyvr@S|itNi9&nF4>dP6@%b)KL#6)k3dpOJxVGGmPYPS}&SjD&E)49Y z{cEp}-d>)>7|VS|(9^VLtr|ph+xA3a30$#f1ggR*Pn>2uV$-9Ru9K?iH8{_YhuZjW z&tvwskRGRRY+yws9WztL$r;{WQRm6VjFU6Gd-6R3X8wu&f22QoSzS?d`{?oycfIso z7&(|M`nff0{RGcpK^uzo4U4|=9~QKs*uc_|(ydnmqWRQAiSK7DT5+*@pl?g-x3u2> z_M?OL`%W)&?rS?dyB~z#yf=$mA8Zbb+;+L782}92!k6y)dF|U4y|4<*ZGKTrv^3Wo z=(n5w6HfiJ22ESzfjh-oQKP0KePc$TMva=@Lp=(pQS+vw9tG5>dDBsL6kr$Z zo8oCrM%0i?O+6w=O+V%p?R{Ro{MO>rD@W@hr;WL<(ITi{xIA%dGh&y8`3@W5|JEo^ z2dBXK2ktkCo=+(|3TQYiPD+b=M}@6JYF;b-(cb6PXnT6%lYsDp&sc2v?*_b?FfupA zB${nV{U`la#)G?uM_*qw_QS*q!A{9HYevvVymb1A44L$0ZSvu9bRy%^6P9|)dWEa6 z)8k<$8VsNM)r#>ZL;yf~zVjElH(!Xo)yV&`!zjQhi;r@oB81G{!+(6t23&VG%)n+z zW-9=@aQ_q+14OZ(cJ!&>B};B)%9?Q&M1*wQKRQ+{y#K;2dB+w9d3gBvdbv3I&f1+` z&jaSeHA4_Wi1N39+T}@U zv_^e zV~iUwg;GJsck!>e4UF>C6?ULA?NS5A7;`JnM49LYA1GvDjM*iJC+X-;j(^S(9-=*b zPFz+Eqx}5Gj^j_(a5_!gfnM_(;%BR*l~51KkYIq@`=}ax0ra$wjlf}pOnE9rvah;4 zsTd!OF~+=_r1x}mLQYl)%vmJfBVa$-=0>nyezyhV=Iaang2xymr_FgR%&R*$BXC1D ze@AuWrBDjE?{i#I~=cn$G$QpHNB`(;QmpzVD`d8rnBWk!L1?eg>rowMb^H^Yp_{jWe2BZ-Z( zWZTJ8?N*=ovv7-ROH#h?>aRVsCnY48t+FgR^?dXf_M+{SNW;q6gbV;c)G^gTECw3` zFpF;%VtV1iQSSVgYB8&xW@uDg#fCuufHZ8~&G?7tT3Z7>wbR73j*9qJHWvbSCfP2z z(Qaj98ghvR06=)__{+3tlg7+_E0*s_yj?2%w*h3DT(6-O;$B1Xvd2_JHFxqb?_|K0 z0k5G)WJsY%OlFC#-}23N{tnhV-tk+D;u;PN)sWQ2S1aG%C!?Cq1)xh7+TNYym8j5e zZDoV65(@P$>!4t>br)_|Eq6V4Uvu25scvaIPi5B4HU0BG!Doq^CP2Lmm#30;mnQ|o zE-x_|q);_J-0I|*SqY<#TwQ1{a!rtI5Q=?RnAPS}7xP0J?>j_p^y5v`JM{aN!r@s3 zUbCIs-?ByoB0*?xLqrJLEn6(-oV@p=FHIubwvLCiBRjDKz2`NgoRv_QzD(U{c{G6S zeMD7M#m7l``mM{8O7Y<}-1;VbWy9J_M?*V0(?|`=RF|ofjej`4Ki0rz`YIhAm^qdf zdGP00lFI^*u3lrO+6CCdsqCU=?8|?W$hfy{#X0}2>jU+bO5CwKwp-cw{`}tJ*#`pt z`pjN~pk?jk+Mb4;EAkp50|>l^>^l=_Gt!Q5leRKGT*A z?4pFY{L%A6tjQqDU!W;QVQst=N~6Aekw1TFE86Wr z8oc^JE5?{xnG|J2a{u~HBM)OzBAAkOnz+NUSM|rcTGW6&ISd}=)TVD4qYXfwbiM&&{_Kln`9)?2!{4ei(+$8R zV$apbWkq*>S>U0q=(1cFbi0h^)F@qo|1ag@b3Dajf-(KZM@GnH?Uka6s_HsMThr|r zM?gcPe@K2%R9cdoesk!@7-;;8OXFof&G{AzQp>1e7$Zzh>9TR98ot}Oe z^BV8%o#~+m07Q#`rHA&8(a@iDwL4ryx>rV9$zCrF`>!8~nOrCy6Wp2~JHu5M008XP zK4Rjw%4<8K{jB)YI&E8@h}B7D!o}(y7zHryv_xrb-9lsPLO(YbTN(i9+qn)4{_j0u z1zs_d7`J48VF_UI`JEPFegKroN&J&S&L|)!2(r3_oQS<5yvh>+QqxgU>3zd%s2AzP zYpB;{aH=lO8)Px9!=R}~HPn&pk^ye9EE8t_iK97o<44=;wiYDsSg`A*@2-wsLw!O9 zZhcWUX!GSg(=1f}X9;QmKpjbi=h&pi000(TNkl zXFyX)7lzMGLI@>vkt)&!DI!%A!H&HlqNuB%SXM<{by>?=P_eCw-4(HStZM;X1w>sz zL6jmznh1!}TM|;|`#}*x5=aa|cJurSlXK_HxjC7cJM(715JDhD3NLV7-2f>+E&`K- zkrC7f!;}my``S3@W0;bmrIoW^M1|P88d~D!;kH)hS{SBaWp8a|u7zPrK2dezs=gUS z%e}SQRS7fSn#K@&<^N)EE*Ni=XGGTl0ATtHZzjGCo2-E8FT9zU`YLp^8YV91a{U9J zBqhh}cE<2lf5axo>~!a=z3Hlcg?d|RD`&;)?1cJ)9KMfQG z3^{c#Ryt~67>4P(ZHTW-5BAi--Wl{r$+}l%JVdr zwOoDegeMWR+Zu7r&qxN8-F}&4H}c@CgfruNbgTvSi2;Uu20)FUVkn|TAw@6*k*_4# zEZg9=f5Dccx3W{O81B0`SsO3NT)}LRAqsw$Lz}Cu!2W#W_ghXu;U+R2_9kn&>S6LM zIP_fQIhuioiq(O?K$~>+fJl;2U^Rv<4Lohof;+P;+9{_ zyiRTwJO;Hz)^g3`2T4DIa+P{Bst^3rf~K`^vuLyZqwl z10R$_<&~)}-e*6uSY>G+>Wzlmsq(58r($Vu(97@mntqa4kVB`wJFx!!%%DkHE#9OhZXRxHGbAuqMJ?yI0X9Pdb5(WJWF?$CQuu;( z_Le;=|7)_jcWjTomcut(*gsWI=-GypE~C?vLrV8Wy5}H;FW<33Dgj~=y1E6D#od8- zxv=*^O!Y{64k>&QHaQqs$0pnA$zY_h5jCCCAU<%49K3uA` z_+ln^L_ErcO%9^zlH1QiJ>?|)yh%&l8T#IJ?j-Z?7zWv8cN~X}_D`ov(l4w0<@Rm= zGw^i8JRFr~uL^uq$riCDae>qGSTwcb+=f?Goc7AQ#jt`(vy}K_a9pAH3Eq=?!-GA40_2VJQV(}=&@QY7AvD+zcksPdoi_^_W7=~$CO+1vz z090{zf~x-V*E9e|_Mek2R54i-ud^Q;yB+q|N9#Pa@fb$7`ssXblWrGL)6Xv%Vr}i< zWM^UKt|0&YBB1AIqX}0GLG=tvnnFUO@@$vLina z!aN)?k2#@b?P<_>_yyop##~w7f3gea;VAF3WX-eUhK>l)^G@%YrS9Q~d3w({ci3j= zs73GV0YJ&&_Xlfyr`ej@SPWV1V^5?OeWVIX4xSRbcG}4U-qO3KcV$f7+%-PjxnIha z9o*$Dl7pZ>>(b+3dxGY~kSoj0iBOwxDWOl{@1M&zd-`4}lCj;HR~<2q#Q5i6 zxXJ#M+T#23%!vGqd3CzRk_Okc{rE)Ti;R8yg((8q1EqKu_b*)AN2B?e&^G{L+)oFCBH2 z;uUZ{`)b$&Z}O$B%Y$+l0QK>qE9O5}Te~kT>&Rm5XO~mjBp#246ye#}iIt`%i-K~7b!5aCu@8>Z9 zRlT}dK6JD})A}X?1MgqFER^N7TxWS1P*M^;GXPlm*8;<6BLjSli2xwed&+WmMnv%4 zLU!XN`abLC*s05Fc^-&7H(K$NAmf&BsD&9dM13tX_b$KHyZ{Gv8BC$yuu*2TjM!2p z&@)dwDl(g~Zk>yXv4Q=v6-!-eBM-c*5v?ER;g|Yu$BhE_m0Q*hFf-ON95QLu7Nf#* zkMrv3nI|6?_nEnRg}tGP$vyqkrt{wB>EY8X+sPY)RY06bZfjL|6!1W=#*A{*6ZFLJR` zzySatdZnD2dTt2=3;+Nl_Oj~PaEX$h9@IthHRjs1MNAqU2=WB3aUUaVYARv?063x| z3Fy@fgs7k2R}sxEG>OpQ$HZQZ`FCzPbFeZ|=$p&KFQY6ixvoAVa3ntPo0+0^HG^9I zzM5!erqSR?E2kX6Kx6QQc$V^^1i5)+9Nbex&P2-ywK|u!UsZ8z; zu5~&0EL_%P!UWyzH^Vc=R=+i!velV0LiyCysO)};S$1>!kiJ!d!{e}~R~QD+{F@M+ zx!2wta^jAN+47Qa@HXZGM^aV7(JN?NeG1m*HX{IW?gjAni)pU-^VR|LR{PGVGF+fz z=9m0(OuL_XN1yQ;C3assCb8p(oXKEgh=|E5bA1+6wd_hO=^dxOj0R*?dG3$Db$Ofd zk7O}*v_|HIKSQ4DPwhu0_n+Y|_x9xRkR*#K*6r!7NJfK9;A=`wZBs;)H+vRsd0xdc zz>XVZa(YfZIQh9{?fzN~lhd(OW@M(9G+450a^6%B42;wo215)Z;DE#8bo73=^-I*S zu$C){PAXw?Tk2RUGd_H1w4{Dc&2ROUB-#J8FMN@$Vu##*li1-Rx1C56=E1u)4br>B zi(7t8^a`5NYO5Sk3sY+ptW4Cnl7p+f?c_+_din^Z_kUhhn&PMopzQ4Hip3v}(DSlu zH#UO7^i9)MUhFs$UxNS;?S06qqlLysWS-v_A&iLzP~d_~lYltL=Kp3$a9?TBA_yY>s)_+%Y6E>8 z333B{9hCq8fL(ljwuj$CTK(S(hRnNLn0{pHxa}#dkH@Br_%)7-)0}wv#cB8FbL^}g zoSg>xy&8M*{7hZ=c8Rm&?CZr%&q+LudCu14942~dez+Ui{(X{j@;iKfB=z`zCO9c(r1Fj@*N=s zDz+K~06C`x2SeS;cdVLby!80z!82`I-B)&bUee2)iuQWGdVUhS_S(q@zS6t8R}bTH zF4Ko7VS>wl>@EA|jUsmO@fEX94nF(JTVJAr5Rv?HD(<^ZJ8XOCuM>Sq?OV4*yc=(n z*Xu?H_Yb=`tyy3dlK=qh@`%y%PP+tO+G^Ztn%=g&Tda@*;I)7HWxiGZn|ulHadeg6 z?}3@mS9%8k!1 zbOqAnkiwV$OmZ+vvp>~!_E{j3fLWUPiF?DWllV`Z3C5|2`Q3Bk;Y`t28-F0!Uv4iL zw%}U6Bu+PT=2NcZ6IDx3-)@fSuYN;oeu2afyZEd#MxGv7+x$Yz4wwZO#_PH4O|KVo zy*X?Etk zKr&~732iSvXsH*je>R=yp!#j8nECPAnu)FsF0L-N#(EYLcD}6S0HE@l!(}iG!_0oW z6zprOf?=5EknQnxNYn$(I@61s`B)be9r8?kBRp@Kx)5gGAzL7h39oL^tq2@eXo&&6 zL1FxjuWVLH`0|m9ZhdA6?4$VEcWhXpz4^5_p9s|FJgwvFm6dUcCHtC#*RLq^>ZvmU>m*{iJb{1w0&ztJrj&knpFy9_m(O$yv~fv z_f&Mr7y!s>nrh;z3aeNEM5xb=dC$<95fn7rUI9342Oa!PA|3dtDgb@0KF)w2HcBq>BC#{Ugg!&8 zHKLvgCZlPl3AJBp8bu_`+^c*4M&ll>8r(w$0P52I&cs>#W<&x2Mq%vRI)ho34RRxD zW@Hw@a-DJG$IjOfy=3wz2H@P>jLZRlj9Hj9|&}m0{~#veyM>T&YB`f zV}(G(o`auYsV>S#8Si@j3-|o`y9G`dNz2^Yh9?$!3jCwMYuLN#QM0ofe`v;`Qy4%m zEv#k%a4KK!Uwgf(w}*uy27qeQp5`mq4$vb405A$;-%$+QEfkxDLOfMfwCsN>`Z#ED z&kMxt1sI>7o;vz~=o>Ibv(b`X@UB?C-%w*AcYTGWd3N35rxnWUb?zq0fa^6eG`A*Y z_b5YI0FXEHI+Mp_<{h>pnruvNwcaGa9-+=(1fwRbF;pIXqm768+>Ul38wX^bLni9s*F$VyIAz3hsF zt9xdf7<%uypHJuVDLyZVQ~h$|Kz-{mGv~~iK4$8vd=^3oQD6D@Qk!_El!H1I5cH;y zE2ONFa6bcWudsHWX}Re16;f95b+2CiwJ=OF~EiG+ata_;FnOgRBnjc=yCto?WZ%=Hy@V>6&=}djIX_!slK88J1 z4ICV-`t~vGp=SQ`3;v51qQa?uwQH>F;s+&cVXv&u2;Fo(yPooP`>^rHa|Ew!h>lQR zsEL8Y2CuwV%4SLI`oHUIdr|dBWAsUIOVP1jZsAR)hzy+HdM_ ztA_T#0|2J%v|y1{?Sqhis=K;bA|WuAZg3`;WQ1Enpx_d8X1PVvz9B}CB>;x&*te{k z#nP&iVSYSjPtaWW4+SBFsvmhP0rXz`t{x%8DY-t$eNQF>A%v^d3sXPGr*&LX5oAqsU65FBYY|^H#D(~Qha}&+0bicEWXCA zk$`YZRGAq<2yx18k0+DIUi;FK)z@wo3)h^3@nKJ2oZc@9RD^0{7C8?atbv(tPp2bJ z#XTRlz?6oSx$1~bosA8XiZp zxVPSTBfeM!xDa0~Km3_sk`Qi*Dl=o3K3wA)=5i)_kx7Sy6=I8phc>KJV&P67TEZ%Q zoaL@}aqHauqHAg*eO2+!A!*Tz2l~Hk%Gg#XA;c~^?M&2L5l=-3q1s3v71Hn>bG5DdTQXHY4oTmlbiXZlO41X`=)qSxg8lDLKju~$2O&=B^^vjwD$^cTH5>5jIS~8n?dj?S ztBtR!IS6s6srv`_8gssBLdv}~!r%BC^~oEJLB{>mCniGdihnlSTr(T7#zHTO4n1%xrr>K~skL1l|5~|0+m3Ji$U80F;adt%;=|#G$00U+Q6Q z)Ysn0!Oms+?q_AJmY4K#nAJiG#LJiq$q2WEgY)&$pf<G(G%2TwVi7-Qk74eOLx z{-t^j$q2W2A(|Xc5M39`ziWk5z<;8Y5PbecrU-O>EF$f#{IEzyxFs2WgjoI$1l;Av TNaPh~00000NkvXXu0mjfCAMIm literal 5793 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 diff --git a/collects/redex/tests/bmps-unix/metafunctions-multiple.png b/collects/redex/tests/bmps-unix/metafunctions-multiple.png index f16230041834ee382bdd71ef18f6cd88a3d99091..f812f212250bc5ddbe07298049a5961aa8202911 100644 GIT binary patch literal 13153 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 S$w3d%06_YkXtl6Gz<&c_Me^JL diff --git a/collects/redex/tests/bmps-unix/mf-hidden.png b/collects/redex/tests/bmps-unix/mf-hidden.png new file mode 100644 index 0000000000000000000000000000000000000000..80a146c8025ede2535caf795073f8dd0cd1a8692 GIT binary patch literal 1628 zcmV-i2BZ0jP)DZB2M1-ORl!i?KMFc@fMW`%+5J+SpqR-O26b2d^7%4V2qDzndrve>lRl5NBrV)`U!=gSEp0W4>hou}0+*dx zP88M6IbD;JCP`n-cgrAD(`SEVVyOqAnm(Ijy_5GZ-Ybyk>D3@xHOM+%)i-D&;)kv? z<**nKDswEBb65-r)wbjc-#wQ>q-{m9``xTe%xzY2O^sNq{bEWxWdq`*3WHj+0uS&O zMU)EKUe`oeP$p^z$x9r)J?$1?lLCUM8-ihG!1!1@D7v3!@D@m};-)+Aw{U0eV zPO32dZI7EIOnZAagQ}r6k2rBd6{|z%qx@Lp$po7nWD?a)mkQGYOjTw-Hc`{eBP7s4 zn+O1a>Q;WcI9=Cc?{?rK0dGON{#WAn*f1~%m5nz2T+-21m9W!_jzLH(c}5bchfV=+=8u>haz%ypA3sz4BZ-;xDq+tX&Sff7c1g zu6kCTwzc(SP;T$|66z{EXzvz{yb|x#Hq;hIZDLh_STW0jS6&A~NYXm{f4V8mfMAt4n^N=*NV~3$_M9ehZ6U38ka9qs}ZRx-(A<004wl z$;}0x001Jx!jy*lffV{emHzt9{^3^Q#^NV3g8)k!?hUG$Ih=1= zoMlR5JD)qq?BJUf-eN^7m_#+0Kc*cL@*_6wsN8-n#d8q}^wp)s*Vy_wGfD4Kn5jWv zIEQ!yc?A8Ccl*Q|YES98;B$=ttQ=3GyMzZUwLR#vgAx_&VyrH1uFT8i2|Z6AFq`nl z)QmE&PMz928cruN6r%nTOmv)6x}@L1i5HVw{stf4d zsaq^~6g3j9J9Uf24NaQ}UYsL!%=tjX4|Vm;c+u6OL6wHsm{s4J-lMqNn=FfuX{sd9kBl1PURq$`Op1fj0{|NY*&VkjT zXyz&`;Q#;s!~`b`0|UeF2TRj~JDw}C{bCq^5+34E{Nc*Pz`*eD4{y+tdf<>{tdLV(82$Y+q`(CQntPN z^Z)<sk%gUwfstvDC08`({Qr1i*Ii!sR4ajjaSkqk60+YeH0X&qOuhYcfMOOGKyu}u zSKG6+wbC}f99%i)|9^xl|Gqy`W2qIj?BTBgbq)@|@c;k+|NlOp?Qm50pLz59|NsC0 z|Gcwu>XyfY%C#&E4BxL$3-OvE**sV8{l$|f85q8uop+T{KJ{Y<^9TR{002ovPDHLkV1k^s4^jXC literal 0 HcmV?d00001 diff --git a/collects/redex/tests/bmps-unix/var-not-in-rebound.png b/collects/redex/tests/bmps-unix/var-not-in-rebound.png new file mode 100644 index 0000000000000000000000000000000000000000..0d3eb033b8d0a13a9f831c4677a97495c7f6353b GIT binary patch literal 3831 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 literal 0 HcmV?d00001 diff --git a/collects/redex/tests/bmps-unix/var-not-in.png b/collects/redex/tests/bmps-unix/var-not-in.png new file mode 100644 index 0000000000000000000000000000000000000000..86a389b45abc77072b7dcea0eaa44b4c5026397f GIT binary patch literal 5332 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 m>aUIN?I|&Za6&M==ktGG*m0bLw^7aj0000 Date: Wed, 31 Mar 2010 14:36:58 +0000 Subject: [PATCH 041/202] updated to match new error message svn: r18691 --- collects/tests/drscheme/repl-test.ss | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/collects/tests/drscheme/repl-test.ss b/collects/tests/drscheme/repl-test.ss index 3178157731..b0f424202b 100644 --- a/collects/tests/drscheme/repl-test.ss +++ b/collects/tests/drscheme/repl-test.ss @@ -262,12 +262,12 @@ This produces an ACK message ;; top-level semantics test (mktest "(define (f) (+ 1 1)) (define + -) (f)" - ("define-values: cannot change constant identifier: +" - "define-values: cannot change constant identifier: +" - "define-values: cannot change constant identifier: +" - "define-values: cannot change constant identifier: +" - #rx"{stop-multi.png} {stop-22x22.png} .*mred/private/snipfile.ss:[0-9]+:[0-9]+: define-values: cannot change constant identifier: \\+" - #rx"{stop-multi.png} {stop-22x22.png} .*mred/private/snipfile.ss:[0-9]+:[0-9]+: define-values: cannot change constant identifier: \\+") + ("define-values: cannot change constant variable: +" + "define-values: cannot change constant variable: +" + "define-values: cannot change constant variable: +" + "define-values: cannot change constant variable: +" + #rx"{stop-multi.png} {stop-22x22.png} .*mred/private/snipfile.ss:[0-9]+:[0-9]+: define-values: cannot change constant variable: \\+" + #rx"{stop-multi.png} {stop-22x22.png} .*mred/private/snipfile.ss:[0-9]+:[0-9]+: define-values: cannot change constant variable: \\+") 'interactions #f void From a9096f2e072e089c79b7638dd6eed9d6ea051a38 Mon Sep 17 00:00:00 2001 From: Casey Klein Date: Wed, 31 Mar 2010 16:02:24 +0000 Subject: [PATCH 042/202] Adds to examples directory and cleans up tests svn: r18693 --- collects/redex/examples/beginner.ss | 16 +- .../examples/mzscheme-machine/grammar.ss | 43 + .../mzscheme-machine/reduction-test.ss | 731 ++++++ .../examples/mzscheme-machine/reduction.ss | 418 ++++ .../mzscheme-machine/verification-test.ss | 502 ++++ .../examples/mzscheme-machine/verification.ss | 354 +++ collects/redex/examples/pi-calculus.ss | 2 +- collects/redex/examples/r6rs/README | 25 + collects/redex/examples/r6rs/r6rs-tests.ss | 2066 +++++++++++++++++ collects/redex/examples/r6rs/r6rs.ss | 979 ++++++++ collects/redex/examples/r6rs/show-examples.ss | 65 + collects/redex/examples/r6rs/test.ss | 213 ++ collects/redex/tests/bitmap-test-util.ss | 7 +- collects/redex/tests/config.ss | 5 - collects/redex/tests/hole-test.ss | 2 + collects/redex/tests/run-tests.ss | 57 +- 16 files changed, 5447 insertions(+), 38 deletions(-) create mode 100644 collects/redex/examples/mzscheme-machine/grammar.ss create mode 100644 collects/redex/examples/mzscheme-machine/reduction-test.ss create mode 100644 collects/redex/examples/mzscheme-machine/reduction.ss create mode 100644 collects/redex/examples/mzscheme-machine/verification-test.ss create mode 100644 collects/redex/examples/mzscheme-machine/verification.ss create mode 100644 collects/redex/examples/r6rs/README create mode 100644 collects/redex/examples/r6rs/r6rs-tests.ss create mode 100644 collects/redex/examples/r6rs/r6rs.ss create mode 100644 collects/redex/examples/r6rs/show-examples.ss create mode 100644 collects/redex/examples/r6rs/test.ss delete mode 100644 collects/redex/tests/config.ss diff --git a/collects/redex/examples/beginner.ss b/collects/redex/examples/beginner.ss index 0ffc83aa75..1257573043 100644 --- a/collects/redex/examples/beginner.ss +++ b/collects/redex/examples/beginner.ss @@ -14,7 +14,8 @@ reflects the (broken) spec). (provide run-tests run-big-test - reductions) + reductions + main) #| @@ -47,12 +48,8 @@ reflects the (broken) spec). (if e e e) (and e e e ...) (or e e e ...) - empty x - 'x - number - boolean - string) + v) (prim-op + * / cons first rest empty? struct? symbol=?) @@ -920,7 +917,6 @@ reflects the (broken) spec). true false))))) -;; timing test -#; -(time (run-tests) - (run-big-test)) +(define (main) + (run-tests) + (run-big-test)) diff --git a/collects/redex/examples/mzscheme-machine/grammar.ss b/collects/redex/examples/mzscheme-machine/grammar.ss new file mode 100644 index 0000000000..4327938883 --- /dev/null +++ b/collects/redex/examples/mzscheme-machine/grammar.ss @@ -0,0 +1,43 @@ +#lang scheme + +(require redex/reduction-semantics) + +(define-language bytecode + (e (loc n) + (loc-noclr n) + (loc-clr n) + (loc-box n) + (loc-box-noclr n) + (loc-box-clr n) + + (let-one e e) + (let-void n e) + (let-void-box n e) + + (boxenv n e) + (install-value n e e) + (install-value-box n e e) + + (application e e ...) + (seq e e e ...) + (branch e e e) + (let-rec (l ...) e) + (indirect x) + (proc-const (τ ...) e) + (case-lam l ...) + l + v) + + (l (lam (τ ...) (n ...) e)) + + (v number + void + 'variable + b) + + (τ val ref) + (n natural) + (b #t #f) + ((x y) variable)) + +(provide bytecode) \ No newline at end of file diff --git a/collects/redex/examples/mzscheme-machine/reduction-test.ss b/collects/redex/examples/mzscheme-machine/reduction-test.ss new file mode 100644 index 0000000000..3b65b351de --- /dev/null +++ b/collects/redex/examples/mzscheme-machine/reduction-test.ss @@ -0,0 +1,731 @@ +#lang scheme + +(require redex/reduction-semantics + "reduction.ss") + +; +; +; ;;; ;;; ;;; ; +; ;; ;; ; ; ; +; ;; ;; ;;; ;;;;; ;;; ;;;;; ;; ;; ;; ;; ;;;; ;;;;; ;;; ;;; ;; ;; ;;;; +; ; ; ; ; ; ; ; ; ; ; ; ;; ; ; ; ; ; ; ; ;; ; ; ; +; ; ; ; ;;;;; ; ;;;; ; ; ; ; ; ; ; ; ; ; ; ; ;;; +; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; +; ; ; ; ; ; ; ; ; ; ;; ; ; ; ; ; ; ; ; ; ; ; ; ; +; ;;; ;;; ;;;; ;;; ;;;;; ;;;;; ;; ;;;;; ;;; ;;; ;;; ;;;;; ;;; ;;; ;;; ;;;; +; +; +; +; + + +;; heap-ref +(test-equal (term (heap-ref (box y) ((w 0) (x 1) (y 2) (z 3)))) 2) + +;; heap-set +(test-equal (term (heap-set 7 (box y) ((w 0) (x 1) (y 2) (z 3)))) + (term ((w 0) (x 1) (y 7) (z 3)))) + +;; push +(test-equal (term (push (1 2 3) (4 5 ε))) + (term (1 2 3 4 5 ε))) + +;; push-uninit +(test-equal (term (push-uninit 2 (1 2 (3 uninit 4 ε)))) + (term (uninit uninit 1 2 (3 uninit 4 ε)))) + +;; stack-ref +(test-equal (term (stack-ref 1 (1 2 3 (ε)))) 2) +(test-equal (term (stack-ref 3 (1 2 (3 4 (ε))))) 4) + +;; stack-set +(test-equal (term (stack-set 2 1 (1 uninit uninit 4 ε))) + (term (1 2 uninit 4 ε))) +(test-equal (term (stack-set 4 3 (1 2 (3 uninit 5 ε)))) + (term (1 2 (3 4 5 ε)))) + +;; load + +(define-syntax test-load + (syntax-rules () + [(_ e (e* h t)) + (test-predicate + (redex-match runtime (uninit (((ε))) h t (e*))) + (term (load e ())))])) + +(test-load + (proc-const (val ref) 'body) + ((clos x_1) ((x_1 ((clos 2 () x_2)))) ((x_2 'body)))) + +(test-load + (application + (proc-const (val ref) 'body1) + (proc-const (val) 'body2)) + ((application (clos x_1) (clos x_2)) + ((x_1 ((clos 2 () x_3))) + (x_2 ((clos 1 () x_4)))) + ((x_3 'body1) (x_4 'body2)))) + +(test-load + (seq + (proc-const (val ref) 'body1) + (proc-const (val) 'body2)) + ((seq (clos x_1) (clos x_2)) + ((x_1 ((clos 2 () x_3))) + (x_2 ((clos 1 () x_4)))) + ((x_3 'body1) (x_4 'body2)))) + +(test-load + (let-rec ((lam () (1) 'body1) + (lam (val) (0) 'body2)) + (lam (val val) (0) 'body3)) + ((let-rec ((lam 0 (1) x_1) + (lam 1 (0) x_2)) + (lam 2 (0) x_3)) + () + ((x_3 'body3) (x_1 'body1) (x_2 'body2)))) + +(test-load + (let-one + (proc-const (val ref) 'body1) + (proc-const (val) 'body2)) + ((let-one (clos x_1) (clos x_2)) + ((x_1 ((clos 2 () x_3))) + (x_2 ((clos 1 () x_4)))) + ((x_3 'body1) (x_4 'body2)))) + +(test-load + (let-void 0 (proc-const (val ref) 'body)) + ((let-void 0 (clos x_1)) + ((x_1 ((clos 2 () x_2)))) + ((x_2 'body)))) + +(test-load + (boxenv 0 (proc-const (val ref) 'body)) + ((boxenv 0 (clos x_1)) + ((x_1 ((clos 2 () x_2)))) + ((x_2 'body)))) + +(test-load + (install-value 0 + (proc-const (val ref) 'body1) + (proc-const (val) 'body2)) + ((install-value 0 (clos x_1) (clos x_2)) + ((x_1 ((clos 2 () x_3))) + (x_2 ((clos 1 () x_4)))) + ((x_3 'body1) (x_4 'body2)))) + +(test-load + (branch + (proc-const (val ref) 'body1) + (proc-const (val) 'body2) + (proc-const () 'body3)) + ((branch (clos x_1) (clos x_2) (clos x_3)) + ((x_1 ((clos 2 () x_4))) + (x_2 ((clos 1 () x_5))) + (x_3 ((clos 0 () x_6)))) + ((x_4 'body1) (x_5 'body2) (x_6 'body3)))) + +(test-load + (let-void 1 (let-rec ((lam () (0) (application (loc-noclr 0)))) 'x)) + ((let-void 1 (let-rec ((lam 0 (0) x_1)) 'x)) + () + ((x_1 (self-app x_1 (loc-noclr 0)))))) + +(test-load + (let-void 1 (let-rec ((lam (val) (0) (application (loc-noclr 1) 'x))) 'y)) + ((let-void 1 (let-rec ((lam 1 (0) x_1)) 'y)) + () + ((x_1 (self-app x_1 (loc-noclr 1) 'x))))) + +(test-load + (let-void 1 (let-rec ((lam () (0) (application (loc-noclr 0) 'x))) 'y)) + ((let-void 1 (let-rec ((lam 0 (0) x_1)) 'y)) + () + ((x_1 (application (loc-noclr 0) 'x))))) + +(test-load + (let-void 1 (let-rec ((lam () (0) (boxenv 0 (application (loc-box-noclr 0))))) 'x)) + ((let-void 1 (let-rec ((lam 0 (0) x_1)) 'x)) + () + ((x_1 (boxenv 0 (application (loc-box-noclr 0))))))) + +(test-load + (let-void 1 (let-rec ((lam (val) (0) (application (loc-noclr 0)))) 'x)) + ((let-void 1 (let-rec ((lam 1 (0) x_1)) 'x)) + () + ((x_1 (application (loc-noclr 0)))))) + +(test-load + (let-one 'x (let-void 1 (let-rec ((lam () (1 0) (application (loc-noclr 1)))) 42))) + ((let-one 'x (let-void 1 (let-rec ((lam 0 (1 0) x_1)) 42))) + () + ((x_1 (self-app x_1 (loc-noclr 1)))))) + +(test-load + (let-one 'x (let-void 1 (let-rec ((lam () (1) (application (loc-noclr 0)))) 42))) + ((let-one 'x (let-void 1 (let-rec ((lam 0 (1) x_1)) 42))) + () + ((x_1 (application (loc-noclr 0)))))) + +(test-load + (let-one 'x (let-void 1 (let-rec ((lam () (1) (application (loc-noclr 0)))) 42))) + ((let-one 'x (let-void 1 (let-rec ((lam 0 (1) x_1)) 42))) + () + ((x_1 (application (loc-noclr 0)))))) + +(test-load + (let-void 1 (let-rec ((lam () (0) (lam () (0) (application (loc-noclr 0))))) 'x)) + ((let-void 1 (let-rec ((lam 0 (0) x_1)) 'x)) + () + ((x_1 (lam 0 (0) x_2)) + (x_2 (application (loc-noclr 0)))))) + +(test-load + (let-void 1 (let-rec ((lam () (0 0) (application (loc-noclr 0)))) 'y)) + ((let-void 1 (let-rec ((lam 0 (0 0) x_1)) 'y)) + () + ((x_1 (application (loc-noclr 0)))))) + +(test-load + (let-void 1 (let-rec ((lam () (0 0) (application (loc-noclr 1)))) 'y)) + ((let-void 1 (let-rec ((lam 0 (0 0) x_1)) 'y)) + () + ((x_1 (self-app x_1 (loc-noclr 1)))))) + +(test-load + (let-void 1 (let-rec ((lam () (0) (let-one 'x (boxenv 0 (application (loc-noclr 1)))))) 'y)) + ((let-void 1 (let-rec ((lam 0 (0) x_1)) 'y)) + () + ((x_1 (let-one 'x (boxenv 0 (self-app x_1 (loc-noclr 1)))))))) + +(test-load + (let-void 1 (let-rec ((lam () (0) (let-one (application (loc-noclr 1)) 'x))) 'y)) + ((let-void 1 (let-rec ((lam 0 (0) x_1)) 'y)) + () + ((x_1 (let-one (application (loc-noclr 1)) 'x))))) + +(test-load + (let-void 1 (let-rec ((lam () (0) (application (application (loc-noclr 0))))) 'x)) + ((let-void 1 (let-rec ((lam 0 (0) x_1)) 'x)) + () + ((x_1 (application (application (loc-noclr 0))))))) + +(test-load + (let-void 1 (let-rec ((lam () (0) (let-rec () (application (loc-noclr 0))))) 'x)) + ((let-void 1 (let-rec ((lam 0 (0) x_1)) 'x)) + () + ((x_1 (let-rec () (self-app x_1 (loc-noclr 0))))))) + +(test-load + (let-void 1 (let-rec ((lam () (0) (let-void 1 (install-value 1 'x (application (loc-noclr 1)))))) 'y)) + ((let-void 1 (let-rec ((lam 0 (0) x_1)) 'y)) + () + ((x_1 (let-void 1 (install-value 1 'x (self-app x_1 (loc-noclr 1)))))))) + +(test-load + (let-void 1 (let-rec ((lam () (0) (let-void 1 (install-value 1 (application (loc-noclr 1)) 'x)))) 'y)) + ((let-void 1 (let-rec ((lam 0 (0) x_1)) 'y)) + () + ((x_1 (let-void 1 (install-value 1 (application (loc-noclr 1)) 'x)))))) + +(test-load + (let-void 1 (let-rec ((lam () (0) (seq 'x (application (loc-noclr 0))))) 'y)) + ((let-void 1 (let-rec ((lam 0 (0) x_1)) 'y)) + () + ((x_1 (seq 'x (self-app x_1 (loc-noclr 0))))))) + +(test-load + (let-void 1 (let-rec ((lam () (0) (seq (application (loc-noclr 0)) 'x))) 'y)) + ((let-void 1 (let-rec ((lam 0 (0) x_1)) 'y)) + () + ((x_1 (seq (application (loc-noclr 0)) 'x))))) + +(test-load + (case-lam (lam (val) () (lam (val) (0) 'x)) (lam (val val) () 'y)) + ((case-lam (lam 1 () x_1) (lam 2 () x_3)) + () + ((x_1 (lam 1 (0) x_2)) (x_2 'x) (x_3 'y)))) + +; +; +; ;;;;; ;; ; +; ; ; ; ; +; ; ; ;;; ;; ; ;; ;; ;;;; ;;;;; ;;; ;;; ;; ;; +; ; ; ; ; ; ;; ; ; ; ; ; ; ; ; ;; ; +; ;;;; ;;;;; ; ; ; ; ; ; ; ; ; ; ; +; ; ; ; ; ; ; ; ; ; ; ; ; ; ; +; ; ; ; ; ; ; ;; ; ; ; ; ; ; ; ; ; +; ;;; ; ;;;; ;;;;; ;; ;; ;;; ;;; ;;;;; ;;; ;;; ;;; +; +; +; +; + +(define step (compose car (curry apply-reduction-relation ->))) + +;; application +(test--> + -> + (term (uninit (((ε))) () () ((application 1 2 3)))) + (term (uninit (uninit uninit ((ε))) () () ((reorder (call 2) (1 ?) (2 0) (3 1)))))) + +;; self-app +(test--> + -> + (term + ((clos x) + ('a ((clos x) ('b ε))) + ((x ((clos 0 ((clos x)) x1)))) + ((x1 (self-app x1 (loc-noclr 1) 'c))) + ((self-app x1 (loc-noclr 1) 'c)))) + (term + ((clos x) + ('a ((clos x) ('b ε))) + ((x ((clos 0 ((clos x)) x1)))) + ((x1 (self-app x1 (loc-noclr 1) 'c))) + ((application (loc-noclr 1) 'c)))) + (term + ((clos x) + (uninit 'a ((clos x) ('b ε))) + ((x ((clos 0 ((clos x)) x1)))) + ((x1 (self-app x1 (loc-noclr 1) 'c))) + ((reorder (self-call x1) ('c 0)))))) + +;; reorder +(test--> + -> + (term (uninit (((ε))) () () ((reorder (call 1) ('x 0) ((loc-noclr 0) ?))))) + (term (uninit (((ε))) () () (framepush 'x framepop (set 0) + framepush (loc-noclr 0) framepop + (call 1))))) +(test--> + -> + (term (uninit (((ε))) () () ((reorder (call 1) ((loc-noclr 0) ?) ('x 0))))) + (term (uninit (((ε))) () () ((reorder (call 1) ('x 0) ((loc-noclr 0) ?))))) + (term (uninit (((ε))) () () (framepush (loc-noclr 0) framepop (set 0) + framepush 'x framepop + (swap 0) (call 1))))) + +(test--> + -> + (term (uninit (((ε))) () ((x 'q)) ((reorder (self-call x) ('x 0) ((loc-noclr 0) 1))))) + (term (uninit (((ε))) () ((x 'q)) (framepush 'x framepop (set 0) + framepush (loc-noclr 0) framepop (set 1) + (self-call x))))) +(test--> + -> + (term (uninit (((ε))) () ((x 'q)) ((reorder (self-call x) ((loc-noclr 0) 1) ('x 0))))) + (term (uninit (((ε))) () ((x 'q)) ((reorder (self-call x) ('x 0) ((loc-noclr 0) 1))))) + (term (uninit (((ε))) () ((x 'q)) (framepush (loc-noclr 0) framepop (set 1) + framepush 'x framepop (set 0) + (self-call x))))) + +(test-equal + (sort + (map + car + (apply-reduction-relation/tag-with-names + -> + (term + (uninit + (uninit uninit 'a 'b 'c ε) + () + () + ((reorder (call 2) ((loc-noclr 0) ?) ((loc-noclr 1) 0) ((loc-noclr 2) 1))))))) + string<=?) + '("finalize-app-not-last" "reorder" "reorder")) + +;; swap +(test--> + -> + (term ('z ('a 'b 'c ε) () () ((swap 1)))) + (term ('b ('a 'z 'c ε) () () ()))) + +;; call +(test--> + -> + (term ((clos x1) ('x 'y 'z ('q ('r ε))) ((x1 ((clos 2 ('w) x2)))) ((x2 'z)) ((call 2)))) + (term ((clos x1) (('w ('x 'y ε))) ((x1 ((clos 2 ('w) x2)))) ((x2 'z)) ('z)))) + +(test--> + -> + (term ((clos x1) + ('x 'y 'z ('q ('r ε))) + ((x1 ((clos 1 () x2) (clos 2 ('w) x3) (clos 2 ('w) x4)))) + ((x2 'a) (x3 'b) (x4 'c)) + ((call 2)))) + (term ((clos x1) + (('w ('x 'y ε))) + ((x1 ((clos 1 () x2) (clos 2 ('w) x3) (clos 2 ('w) x4)))) + ((x2 'a) (x3 'b) (x4 'c)) + ('b)))) + +(test-equal + (caar + (apply-reduction-relation* + -> + (term (load (application (lam (val) () (loc-noclr 0)) (application (lam (val) () (loc-noclr 0)) 'x)) ())))) + ''x) + +;; self-call +(test--> + -> + (term + ('c + ('d 'b ((clos x) ('c ε))) + ((x ((clos 0 ((clos x)) x1)))) + ((x1 (self-app x1 (loc-noclr 1) 'c))) + ((self-call x1)))) + (term + ('c + (((clos x) ('d ε))) + ((x ((clos 0 ((clos x)) x1)))) + ((x1 (self-app x1 (loc-noclr 1) 'c))) + ((self-app x1 (loc-noclr 1) 'c))))) + +(test-equal + (map + car + (apply-reduction-relation* + -> + (term (load (let-void 1 (let-rec ((lam (val val) (0) + (branch (loc-noclr 1) + (loc-noclr 2) + (application (loc-noclr 2) #t (loc-noclr 3))))) + (application (loc-noclr 2) #f #t))) ())))) + '(#f)) + +;; arity +(test-equal + (step (term ((clos x1) ('y 'q ε) ((x1 ((clos 2 ('w) x2)))) ((x2 'z)) ((call 1))))) + (term error)) + +(test-->> + -> + (term (uninit (((ε))) () ((x 'x)) ((let-one 7 (boxenv 0 (application (lam 0 (1) x) 'y)))))) + (term error)) + +(test--> + -> + (term + ((clos x170017) + (19 ((ε))) + ((x170017 + ((clos 4 () x170018))) + (x170015 + ((clos 9 () x170016)))) + ((x170018 (clos x170015)) + (x170016 void)) + ((call 1)))) + (term error)) + +;; non-closure +(test-equal + (step (term ('f ('x 'y 'q ε) () () ((call 2))))) + (term error)) + +;; localref +(test--> + -> + (term (uninit (1 ε) () () ((loc 0)))) + (term (1 (1 ε) () () ()))) + +;; loc-box +(test--> + -> + (term (uninit ((box x) ε) ((x 1)) () ((loc-box 0)))) + (term (1 ((box x) ε) ((x 1)) () ()))) + +;; loc-clr +(test-equal + (step (term (uninit (1 ε) () () ((loc-clr 0))))) + (term (1 (uninit ε) () () ()))) + +;; loc-box-clr +(test-equal + (step (term (uninit ((box x) ε) ((x 1)) () ((loc-box-clr 0))))) + (term (1 (uninit ε) ((x 1)) () ()))) + +;; value +(test-equal + (step (term (uninit (((ε))) () () (3)))) + (term (3 (((ε))) () () ()))) + +;; close-lam +(test-equal + (step (term (uninit ('x 'y ('z ε)) () ((x 'q)) ((lam 3 (0 2) x))))) + (term ((clos x1) ('x 'y ('z ε)) ((x1 ((clos 3 ('x 'z) x)))) ((x 'q)) ()))) + +;; close-case-lam +(test-equal + (step (term (uninit ('x 'y ('z ε)) ((x1 'a)) ((x2 'b) (x3 'c)) ((case-lam (lam 3 (0 2) x2) (lam 2 (1 0) x3)))))) + (term ((clos x4) ('x 'y ('z ε)) ((x4 ((clos 3 ('x 'z) x2) (clos 2 ('y 'x) x3))) (x1 'a)) ((x2 'b) (x3 'c)) ()))) + +;; let-one +(test-equal + (step (term (uninit ('x ε) () () ((let-one 'y 'z))))) + (term (uninit (uninit 'x ε) () () (framepush 'y framepop (set 0) 'z)))) + +;; framepop +(test-equal + (step (term (uninit ('u ('w ('x 'y ('z ε)))) () () (framepop)))) + (term (uninit ('z ε) () () ()))) + +;; framepush +(test-equal + (step (term (7 ('x uninit ('y ε)) () () (framepush)))) + (term (7 (((('x uninit ('y ε))))) () () ()))) + +;; set +(test-equal + (step (term ('z ('x ('y ε)) () () ((set 1))))) + (term ('z ('x ('z ε)) () () ()))) + +;; set-box +(test-equal + (step (term ('x ((box y) ε) ((y 'z)) () ((set-box 0))))) + (term ('x ((box y) ε) ((y 'x)) () ()))) + +;; boxenv +(test-equal + (step (term (uninit (9 ε) ((y 8)) () ((boxenv 0 'z))))) + (term (uninit ((box x) ε) ((x 9) (y 8)) () ('z)))) + +;; let-void +(test-equal + (step (term (uninit ('x 'y ε) () () ((let-void 3 'z))))) + (term (uninit (uninit uninit uninit 'x 'y ε) () () ('z)))) + +;; let-void-box +(test-predicate + (redex-match + runtime + (uninit + ((box variable_1) (box variable_2) (box x) ε) + ((variable_1 undefined) (variable_2 undefined) (x 'y)) + () + ('z))) + (step (term (uninit ((box x) ε) ((x 'y)) () ((let-void-box 2 'z)))))) + +;; install-value +(test--> + -> + (term (uninit (uninit ε) () () ((install-value 0 'r 'b) 'q))) + (term (uninit (uninit ε) () () (framepush 'r framepop (set 0) 'b 'q)))) +(test--> + -> + (term (uninit (uninit ε) () () ((install-value-box 0 'r 'b) 'q))) + (term (uninit (uninit ε) () () (framepush 'r framepop (set-box 0) 'b 'q)))) + +;; seq-many +(test-equal + (step (term (uninit (((ε))) () () ((seq 'x 'y 'z) 'w)))) + (term (uninit (((ε))) () () (framepush 'x framepop (seq 'y 'z) 'w)))) + +;; seq-one +(test-equal + (step (term (uninit ((((ε)))) () () ((seq 'x 'y) 'z)))) + (term (uninit ((((ε)))) () () (framepush 'x framepop 'y 'z)))) + +;; branch +(let ([test-branch (λ (cond res) + (test-->> + -> + `(uninit + ('t 'f ε) + () + () + ((branch (let-one 'q ,cond) + (loc 0) + (loc 1)))) + `(',res ('t 'f ε) () () ())))]) + (test-branch ''not-false 't) + (test-branch #f 'f)) + +;; let-rec +(test--> + -> + (term + ('x + (uninit uninit (box x1) ε) + ((x1 'x)) + ((x2 'f) (x3 'g)) + ((let-rec + ((lam 1 (1 2) x2) + (lam 1 (0 2) x3)) + (loc-noclr 0))))) + (term + ('x + ((clos x4) (clos x5) (box x1) ε) + ((x1 'x) + (x4 ((clos 1 ((clos x5) (box x1)) x2))) + (x5 ((clos 1 ((clos x4) (box x1)) x3)))) + ((x2 'f) (x3 'g)) + ((loc-noclr 0))))) + +(test--> + -> + (term + (uninit + (uninit ((ε))) + ((x1 ((clos 0 () x2)))) + ((x2 'x) (x3 'y)) + ((let-rec ((lam 0 (0) x3)) 'z)))) + (term + (uninit + ((clos x4) ((ε))) + ((x1 ((clos 0 () x2))) (x4 ((clos 0 ((clos x4)) x3)))) + ((x2 'x) (x3 'y)) + ('z)))) + +(test-->> + -> + #:cycles-ok + (term + (uninit + (((ε))) + () + ((x1 (application (loc-noclr 0))) + (x2 (application (loc-noclr 0)))) + ((let-void + 2 + (let-rec ((lam 0 (1) x1) + (lam 0 (0) x2)) + (application (loc-noclr 1)))))))) + +;; indirect +(test-->> + -> + #:cycles-ok + (term + (uninit + (((ε))) + ((x1 ((clos 0 () x2)))) + ((x2 (application (indirect x3))) + (x3 (clos x1))) + ((application (indirect x3)))))) + +;; loops +(test-->> + -> + #:cycles-ok + (term + (uninit + (((ε))) + () + ((x1 (application + (loc-noclr 1) + (loc-noclr 1))) + (x2 (let-one + 7 + (application + (let-one 8 (loc-noclr 3)) + (let-one 9 (loc-noclr 3)))))) + ((application (lam 1 () x1) (lam 1 () x2)))))) + +(test-->> + -> + #:cycles-ok + (term (load (let-one (indirect x57042) (application (loc-noclr 1) (loc-noclr 1))) + ((x57042 (proc-const (val) (application (loc-noclr 1) (loc-noclr 1)))))))) + +(test-->> + -> + #:cycles-ok + (term (load (let-void 1 (let-rec ((lam () (0) (application (loc-noclr 0)))) (application (loc-noclr 0)))) ()))) + +; mutable variables +(test-->> + -> + `(uninit (((ε))) () + () + ((let-void + 1 + (install-value 0 777 (boxenv 0 (install-value-box 0 888 (loc-box-noclr 0))))))) + (term (888 ((box x) ((ε))) ((x 888)) () ()))) + +(test-->> + -> + `(uninit (((ε))) () () + ((let-one + (let-void + 1 + (install-value + 0 + 'foo + (boxenv + 0 + (let-one + (install-value-box 1 7 void) + (seq (loc-clr 0) (let-one (loc-box-noclr 2) (loc-noclr 0))))))) + (loc-noclr 0)))) + (term (7 (7 ((ε))) ((x 7)) () ()))) + +;; locals pushed for seq sub-exprs should be popped +(test-->> + -> + (term (uninit (((ε))) () () ((seq (let-one 1 (loc 0)) (let-one 2 (loc 0)) 3)))) + (term (3 (((ε))) () () ()))) + +; closure-captured value is above explicit arguments +(test-equal + (caar + (apply-reduction-relation* + -> + (term (load (application + (let-void + 1 + (install-value + 0 + 777 + (boxenv + 0 + (lam + (val val val) + (0) + (install-value-box 0 (loc-noclr 3) (loc-box-noclr 0)))))) + 111 + 222 + 333) + ())))) + 333) + +;; ref arg +(test-->> + -> + #:cycles-ok + (term (uninit (((ε))) () ((x1 (loc-box-noclr 0))) ((let-one 'x (boxenv 0 (application (lam 1 () x1) (loc-noclr 1))))))) + (term ('x ((((box x2) ε))) ((x3 ((clos 1 () x1))) (x2 'x)) ((x1 (loc-box-noclr 0))) ()))) + +;; case-lam +(test-equal + (map + car + (apply-reduction-relation* + -> + (term + (load (application + (let-one 'a + (let-one 'b + (let-one 'c + (case-lam (lam () (2) (loc-noclr 0)) + (lam (val) (1) (loc-noclr 0)) + (lam (val) (0) (loc-noclr 0)))))) + 'x) + ())))) + '('b)) + +(test-equal + (apply-reduction-relation* + -> + (term (load (application (case-lam (lam (val) () 1) (lam (val val) () 2))) ()))) + '(error)) + +(test-equal + (apply-reduction-relation* + -> + (term (load (application (case-lam)) ()))) + '(error)) + +(test-results) diff --git a/collects/redex/examples/mzscheme-machine/reduction.ss b/collects/redex/examples/mzscheme-machine/reduction.ss new file mode 100644 index 0000000000..6635ad11e2 --- /dev/null +++ b/collects/redex/examples/mzscheme-machine/reduction.ss @@ -0,0 +1,418 @@ +#lang scheme + +(require redex/reduction-semantics) +(require "grammar.ss") + +(define-extended-language runtime bytecode + (p (V S H T C) error) + + (V v uninit (box x)) + + (S (u ... s)) + (s ε S) + (u v uninit (box x)) + + (H ((x h) ...)) + (h v ((clos n (u ...) x) ...)) + + (T ((x e) ...)) + + (C (i ...)) + + (i e + (swap n) (reorder i (e m) ...) + (set n) (set-box n) + (branch e e) + framepop framepush + (call n) (self-call x)) + + (l (lam n (n ...) x)) + (v .... + undefined + (clos x)) + (e .... + (self-app x e_0 e_1 ...)) + (m n ?)) + +(define-metafunction bytecode + [(count-up number) + ,(build-list (term number) (λ (x) x))]) + +(define procedure-rules + (reduction-relation + runtime + (--> (V S ((x_0 h_0) ...) T ((lam n (n_0 ...) x_i) i ...)) + ((clos x) S ((x ((clos n ((stack-ref n_0 S) ...) x_i))) (x_0 h_0) ...) T (i ...)) + (fresh x) + "lam") + (--> (V S ((x_0 h_0) ...) T ((case-lam (lam n (n_0 ...) x_i) ...) i ...)) + ((clos x) S ((x ((clos n ((stack-ref n_0 S) ...) x_i) ...)) (x_0 h_0) ...) T (i ...)) + (fresh x) + "case-lam") + (--> (V S ((x_0 h_0) ...) T ((let-rec ((name l_0 (lam n_0 (n_00 ...) y_0)) ...) e) i ...)) + (V S_* ((x_0 h_0) ... (x ((clos n_0 ((stack-ref n_00 S_*) ...) y_0))) ...) T (e i ...)) + (fresh ((x ...) (l_0 ...))) + (where (n ...) (count-up ,(length (term (l_0 ...))))) + (where S_* (stack-set* ((clos x) n) ... S)) + "let-rec"))) + +;; hide the 'apply append' in a metafunction +(define-metafunction runtime + [(flatten ((any ...) ...)) + (any ... ...)]) + +(define application-rules + (reduction-relation + runtime + (--> (V S H T ((application e_0 e_1 ...) i ...)) + (V (push-uninit n S) H T ((reorder (call n) (e_0 ?) (e_1 n_1) ...) i ...)) + (where n ,(length (term (e_1 ...)))) + (where (n_1 ...) (count-up n)) + "application") + (--> (V S H T ((self-app x e_0 e_1 ...) i ...)) + (V S H T ((application e_0 e_1 ...) i ...)) + "self-app") + (--> (V S H T ((self-app x e_0 e_1 ...) i ...)) + (V (push-uninit n S) H T ((reorder (self-call x) (e_1 n_1) ...) i ...)) + (where n ,(length (term (e_1 ...)))) + (where (n_1 ...) (count-up n)) + "self-app-opt") + (--> (V S H T ((reorder i_r (e_0 m_1) ... ((loc-noclr n) m_i) (e_i+1 m_i+1) (e_i+2 m_i+2) ...) i ...)) + (V S H T ((reorder i_r (e_0 m_1) ... (e_i+1 m_i+1) (e_i+2 m_i+2) ... ((loc-noclr n) m_i)) i ...)) + "reorder") + (--> (V S H T ((reorder (call n) (e_0 n_0) ... (e_i ?) (e_i+1 n_i+1) ... (e_j n_j)) i ...)) + (V S H T (,@(term (flatten ((framepush e_0 framepop (set n_0)) ...))) + framepush e_i framepop (set n_j) + ,@(term (flatten ((framepush e_i+1 framepop (set n_i+1)) ...))) + framepush e_j framepop + (swap n_j) (call n) i ...)) + "finalize-app-not-last") + (--> (V S H T ((reorder (call n) (e_0 n_0) ... (e_n ?)) i ...)) + (V S H T (,@(term (flatten ((framepush e_0 framepop (set n_0)) ...))) + framepush e_n framepop (call n) i ...)) + "finalize-app-is-last") + (--> (V S H T ((reorder (self-call x) (e_0 n_0) ...) i ...)) + (V S H T (,@(term (flatten ((framepush e_0 framepop (set n_0)) ...))) + (self-call x) i ...)) + "finalize-self-app") + (--> (V (u_0 ... u_i ... (u_j ... (u_k ... s))) H (name T ((x_0 e_0) ... (x_i e_i) (x_i+1 e_i+1) ...)) ((self-call x_i) i ...)) + (V ((u_j ... (u_0 ... s))) H T (e_i i ...)) + (side-condition (= (length (term (u_0 ...))) (length (term (u_k ...))))) + "self-call") + (--> ((clos x_i) (u_1 ... u_n+1 ... (u_m ... (u_k ... s))) (name H ((x_0 h_0) ... + (x_i ((clos n_0 (u_0 ...) y_0) ... + (clos n_i (u_i ...) y_i) + (clos n_i+1 (u_i+1 ...) y_i+1) ...)) + (x_i+1 h_i+1) ...)) (name T ((y_j e_j) ... (y_i e_i) (y_k e_k) ...)) ((call n_i) i ...)) + ((clos x_i) ((u_i ... (u_1 ... s))) H T (e_i i ...)) + (side-condition (not (memq (term n_i) (term (n_0 ...))))) + (side-condition (= (term n_i) (length (term (u_1 ...))))) + "call") + (--> (v S H T ((call n) i ...)) + error + "non-closure" + (side-condition (not (clos? (term v))))) + (--> ((clos x_i) + S + ((x_0 h_0) ... (x_i ((clos n_0 (u_0 ...) y_0) ...)) (x_i+1 h_i+1) ...) + T + ((call n) i ...)) + error + (side-condition (not (memq (term n) (term (n_0 ...))))) + "app-arity"))) + +(define stack-ref-rules + (reduction-relation + runtime + (--> (V S H T ((loc n) i ...)) + ((stack-ref n S) S H T (i ...)) + "loc") + (--> (V S H T ((loc-noclr n) i ...)) + ((stack-ref n S) S H T (i ...)) + "loc-noclr") + (--> (V S H T ((loc-clr n) i ...)) + ((stack-ref n S) (stack-set uninit n S) H T (i ...)) + "loc-clr") + + (--> (V S H T ((loc-box n) i ...)) + ((heap-ref (stack-ref n S) H) S H T (i ...)) + "loc-box") + (--> (V S H T ((loc-box-noclr n) i ...)) + ((heap-ref (stack-ref n S) H) S H T (i ...)) + "loc-box-noclr") + (--> (V S H T ((loc-box-clr n) i ...)) + ((heap-ref (stack-ref n S) H) (stack-set uninit n S) H T (i ...)) + "loc-box-clr"))) + +(define stack-instructions + (reduction-relation + runtime + (--> (V S H T ((set n) i ...)) + (V (stack-set V n S) H T (i ...)) + "set") + (--> (v S H T ((set-box n) i ...)) + (v S (heap-set v (stack-ref n S) H) T (i ...)) + "set-box") + (--> (V S H T ((swap n) i ...)) + ((stack-ref n S) (stack-set V n S) H T (i ...)) + "swap") + (--> (V (u_0 ... (u_i ... (u_j ... s))) H T (framepop i ...)) + (V s H T (i ...)) + "framepop") + (--> (V S H T (framepush i ...)) + (V (((S))) H T (i ...)) + "framepush"))) + +(define stack-change-rules + (reduction-relation + runtime + (--> (V S H T ((install-value n e_r e_b) i ...)) + (V S H T (framepush e_r framepop (set n) e_b i ...)) + "install-value") + (--> (V S H T ((install-value-box n e_r e_b) i ...)) + (V S H T (framepush e_r framepop (set-box n) e_b i ...)) + "install-value-box") + (--> (V S ((x_0 h_0) ...) T ((boxenv n e) i ...)) + (V (stack-set (box x) n S) ((x v) (x_0 h_0) ...) T (e i ...)) + (fresh x) + (where v (stack-ref n S)) + "boxenv"))) + +(define stack-push-rules + (reduction-relation + runtime + (--> (V S H T ((let-one e_r e_b) i ...)) + (V (push-uninit 1 S) H T (framepush e_r framepop (set 0) e_b i ...)) + "let-one") + (--> (V S H T ((let-void n e) i ...)) + (V (push-uninit n S) H T (e i ...)) + "let-void") + (--> (V S ((x_0 h_0) ...) T ((let-void-box n e) i ...)) + (V (push ((box x_n) ...) S) ((x_n undefined) ... (x_0 h_0) ...) T (e i ...)) + (where (x_n ...) (n-gensyms n)) + "let-void-box"))) + +(define-metafunction runtime + [(n-gensyms n) + ,(build-list (term n) (λ (_) (gensym 'x)))]) + +(define miscellaneous-rules + (reduction-relation + runtime + (--> (V S H T (v i ...)) + (v S H T (i ...)) + "value") + (--> (V S H T ((branch e_c e_t e_f) i ...)) + (V S H T (framepush e_c framepop (branch e_t e_f) i ...)) + "branch") + (--> (v S H T ((branch e_t e_f) i ...)) + (v S H T (e_t i ...)) + (side-condition (≠ (term v) (term #f))) + "branch-true") + (--> (#f S H T ((branch e_t e_f) i ...)) + (#f S H T (e_f i ...)) + "branch-false") + (--> (V S H T ((seq e_1 e_2 e_3 e_4 ...) i ...)) + (V S H T (framepush e_1 framepop (seq e_2 e_3 e_4 ...) i ...)) + "seq-many") + (--> (V S H T ((seq e_1 e_2) i ...)) + (V S H T (framepush e_1 framepop e_2 i ...)) + "seq-two") + (--> (V S H (name T ((x_0 e_0) ... (x_i e_i) (x_i+1 e_i+1) ...)) ((indirect x_i) i ...)) + (V S H T (e_i i ...)) + "indirect"))) + +(define -> + (union-reduction-relations + stack-ref-rules + stack-instructions + stack-push-rules + stack-change-rules + procedure-rules + application-rules + miscellaneous-rules)) + +(define (≠ a b) (not (equal? a b))) + +(define clos? + (redex-match runtime (clos x))) + +(define-extended-language loader bytecode + (φ - (n n x)) + (e any) + (H any) + (h any) + (T any) + (l any)) + +(define-metafunction loader + concat : (any ...) ... -> (any ...) + [(concat any ...) ,(apply append (term (any ...)))]) + +(define-metafunction loader + [(load e ((x_0 e_0) ...)) + (uninit + (((ε))) + (concat H H_0 ...) + (concat T ((x_0 e_0*) ...) T_0 ...) + (e_*)) + (where (e_* H T) (load* e -)) + (where ((e_0* H_0 T_0) ...) ((load* e_0 -) ...))]) + +(define-metafunction loader + [(φ+ - n) -] + [(φ+ (n_p n_a x) n) (,(+ (term n) (term n_p)) n_a x)]) + +(define-metafunction loader + [(load-lam-rec (lam (τ_0 ...) (n_0 ... n_i n_i+1 ...) e) n_i) + ; When a closure captures itself multiple times, only the last + ; occurrence is considered a self-reference. + ((lam n (n_0 ... n_i n_i+1 ...) x) H ((x e_*) (x_0 e_0) ...)) + (where n ,(length (term (τ_0 ...)))) + (where x ,(gensym 'x)) + (where (e_* H ((x_0 e_0) ...)) + (load* e (,(length (term (n_0 ...))) n x))) + (side-condition (not (memq (term n_i) (term (n_i+1 ...)))))] + [(load-lam-rec l n_j) (load* l -)]) + +(define-metafunction loader + [(load* (application (loc-noclr n) e_1 ...) (n_p n_a x)) + ((self-app x (loc-noclr n) e_1* ...) + (concat H_1 ...) + (concat T_1 ...)) + (side-condition (= (term n) (+ (term n_p) (length (term (e_1 ...)))))) + (side-condition (= (term n_a) (length (term (e_1 ...))))) + (where ((e_1* H_1 T_1) ...) ((load* e_1 -) ...))] + + [(load* (let-rec (l_0 ...) e) φ) + ((let-rec (l_0* ...) e_*) + (concat H H_0 ...) + (concat T T_0 ...)) + (where (e_* H T) (load* e φ)) + (where (n_0 ...) (count-up ,(length (term (l_0 ...))))) + (where ((l_0* H_0 T_0) ...) ((load-lam-rec l_0 n_0) ...))] + + [(load* (application e_0 e_1 ...) φ) + ((application e_0* ...) + (concat H_0 ...) + (concat T_0 ...)) + (where ((e_0* H_0 T_0) ...) ((load* e_0 -) (load* e_1 -) ...))] + + [(load* (let-one e_r e_b) φ) + ((let-one e_r* e_b*) (concat H_r H_b) (concat T_r T_b)) + (where (e_r* H_r T_r) (load* e_r -)) + (where (e_b* H_b T_b) (load* e_b (φ+ φ 1)))] + + [(load* (let-void n e) φ) + ((let-void n e_*) H T) + (where (e_* H T) (load* e (φ+ φ n)))] + [(load* (let-void-box n e) φ) + ((let-void-box n e_*) H T) + (where (e_* H T) (load* e (φ+ φ n)))] + + [(load* (boxenv n e) φ) + ((boxenv n e_*) H T) + (where (e_* H T) (load* e φ))] + + [(load* (install-value n e_r e_b) φ) + ((install-value n e_r* e_b*) + (concat H_r H_b) + (concat T_r T_b)) + (where (e_r* H_r T_r) (load* e_r -)) + (where (e_b* H_b T_b) (load* e_b φ))] + [(load* (install-value-box n e_r e_b) φ) + ((install-value-box n e_r* e_b*) + (concat H_r H_b) + (concat T_r T_b)) + (where (e_r* H_r T_r) (load* e_r -)) + (where (e_b* H_b T_b) (load* e_b φ))] + + [(load* (seq e_0 ... e_n) φ) + ((seq e_0* ... e_n*) + (concat H_0 ... H_n) + (concat T_0 ... T_n)) + (where ((e_0* H_0 T_0) ...) ((load* e_0 -) ...)) + (where (e_n* H_n T_n) (load* e_n φ))] + + [(load* (branch e_c e_t e_f) φ) + ((branch e_c* e_t* e_f*) + (concat H_c H_t H_f) + (concat T_c T_t T_f )) + (where (e_c* H_c T_c) (load* e_c -)) + (where (e_t* H_t T_t) (load* e_t φ)) + (where (e_f* H_f T_f) (load* e_f φ))] + + [(load* (lam (τ_0 ...) (n_0 ...) e) φ) + ((lam n (n_0 ...) x) H ((x e_*) (x_0 e_0) ...)) + (where x ,(gensym 'x)) + (where n ,(length (term (τ_0 ...)))) + (where (e_* H ((x_0 e_0) ...)) (load* e -))] + + [(load* (proc-const (τ_0 ...) e) φ) + ((clos x) + ((x ((clos n () x_*))) (x_0 h_0) ...) + ((x_* e_*) (x_i e_i) ...)) + (where x ,(gensym 'x)) + (where x_* ,(gensym 'x)) + (where n ,(length (term (τ_0 ...)))) + (where (e_* ((x_0 h_0) ...) ((x_i e_i) ...)) (load* e -))] + + [(load* (case-lam l_0 ...) φ) + ((case-lam l_0* ...) (concat H_0 ...) (concat T_0 ...)) + (where ((l_0* H_0 T_0) ...) ((load* l_0 φ) ...))] + + [(load* e φ) (e () ())]) + +(define-metafunction + runtime + heap-ref : (box x) H -> h + [(heap-ref (box x_i) ((x_0 h_0) ... (x_i h_i) (x_i+1 h_i+1) ...)) h_i]) + +(define-metafunction + runtime + heap-set : h (box x) H -> H + [(heap-set h (box x_i) ((x_0 h_0) ... (x_i h_i) (x_i+1 h_i+1) ...)) + ((x_0 h_0) ... (x_i h) (x_i+1 h_i+1) ...)]) + +(define-metafunction + runtime + push : (u ...) (u ... s) -> (u ... s) + [(push (u_0 ...) (u_i ... s)) + (u_0 ... u_i ... s)]) + +(define-metafunction + runtime + push-uninit : n (u ... s) -> (uninit ... u ... s) + [(push-uninit 0 S) S] + [(push-uninit n (u ... s)) + (push-uninit ,(- (term n) (term 1)) (uninit u ... s))]) + +(define-metafunction + runtime + stack-ref : n S -> u + [(stack-ref 0 (v u ... s)) v] + [(stack-ref 0 ((box x) u ... s)) (box x)] + [(stack-ref n (u_0 u_1 ... s)) + (stack-ref ,(- (term n) (term 1)) (u_1 ... s)) + (side-condition (> (term n) (term 0)))] + [(stack-ref n ((u ... s))) + (stack-ref n (u ... s))]) + +(define-metafunction + runtime + stack-set : u n S -> S + [(stack-set u n (u_0 ... u_n u_n+1 ... s)) + (u_0 ... u u_n+1 ... s) + (side-condition + (= (term n) (length (term (u_0 ...)))))] + [(stack-set u n (u_0 ... s)) + (u_0 ... (stack-set u ,(- (term n) (length (term (u_0 ...)))) s))]) + +(define-metafunction + runtime + stack-set* : (u n) ... S -> S + [(stack-set* S) S] + [(stack-set* (u_0 n_0) (u_1 n_1) ... S) + (stack-set* (u_1 n_1) ... (stack-set u_0 n_0 S))]) + +(provide (all-defined-out)) diff --git a/collects/redex/examples/mzscheme-machine/verification-test.ss b/collects/redex/examples/mzscheme-machine/verification-test.ss new file mode 100644 index 0000000000..3e4e1b8ed3 --- /dev/null +++ b/collects/redex/examples/mzscheme-machine/verification-test.ss @@ -0,0 +1,502 @@ +#lang scheme + +(require redex/reduction-semantics) +(require "grammar.ss" "verification.ss") + +;; localrefs +(test-predicate + (negate bytecode-ok?) + '(loc 0)) + +(test-predicate + bytecode-ok? + '(let-one 7 (loc 0))) + +(test-predicate + (negate bytecode-ok?) + '(let-one 7 (loc 1))) + +(test-predicate + (negate bytecode-ok?) + '(let-one 7 (loc-box 0))) + +(test-predicate + bytecode-ok? + '(let-one 7 (boxenv 0 (loc-box 0)))) + +(test-predicate + (negate bytecode-ok?) + '(let-one 7 (boxenv 0 (loc 0)))) + +(test-predicate + bytecode-ok? + '(let-one (let-one 7 (loc 0)) (loc 0))) + +(test-predicate + (negate bytecode-ok?) + '(let-one (let-one 7 (loc 0)) (loc 1))) + +(test-predicate + (negate bytecode-ok?) + '(let-void-box 2 (seq (loc-box-clr 0) (loc-box-clr 0)))) + +(test-predicate + (negate bytecode-ok?) + '(let-one 'x (seq (loc-noclr 0) (loc-clr 0)))) + +(test-predicate + bytecode-ok? + '(let-one 'x (seq (loc-noclr 0) (loc-noclr 0)))) + +(test-predicate + (negate bytecode-ok?) + '(let-one 'x (seq (loc-noclr 0) (loc-noclr 0) (loc-clr 0)))) + +(test-predicate + (negate bytecode-ok?) + '(let-void-box 1 (seq (loc-box-noclr 0) (loc-box-clr 0)))) + +(test-predicate + (negate bytecode-ok?) + '(let-void-box 1 (seq (loc-box-noclr 0) (loc-noclr 0) (loc-box-clr 0)))) + +(test-predicate + bytecode-ok? + '(let-void-box 1 (seq (loc-clr 0) 'x))) + +(test-predicate + bytecode-ok? + '(let-void-box 1 (branch 'q (seq (loc-box-noclr 0) (loc-box-noclr 0)) 'q))) + +;; let-one +(test-predicate + bytecode-ok? + '(let-one 'x (loc-noclr 0))) + +(test-predicate + (negate bytecode-ok?) + '(let-one (loc 0) 'z)) + +;; application +(test-predicate + bytecode-ok? + '(application 'w 'x 'y 'z)) + +(test-predicate + bytecode-ok? + '(let-one 7 (application (loc 3) 'x (loc 3) 'z))) + +(test-predicate + (negate bytecode-ok?) + '(let-one 7 (application (loc 0) 'x 'y 'z))) + +(test-predicate + (negate bytecode-ok?) + '(let-void 1 (application (let-one 'x 'y) (loc-noclr 0)))) + +(test-predicate + (negate bytecode-ok?) + '(application (lam (ref) () 'x) 'y)) + +(test-predicate + (negate bytecode-ok?) + '(let-one 'x (application (lam (ref) () 'y) (loc-noclr 0)))) + +(test-predicate + (negate bytecode-ok?) + '(application (lam (val val) () 'a) (let-void 2 'b) (install-value 2 'c 'd))) + +(test-predicate + (negate bytecode-ok?) + '(let-one 'x (boxenv 0 (application (lam (ref) () 'y) (loc-box-noclr 1))))) + +(test-predicate + bytecode-ok? + '(application (lam (ref) () 'x))) + +(test-predicate + (negate bytecode-ok?) + '(let-one 'x (boxenv 0 (application (lam () () 'body) (loc-noclr 0))))) + +(test-predicate + (negate bytecode-ok?) + '(application + (let-one 'x (boxenv 0 (proc-const (val) 'y))) + (loc-box-noclr 0))) + +(test-predicate + (negate bytecode-ok?) + '(application + (proc-const (val val) (branch (loc-noclr 0) 'a 'b)) + 'x + (install-value 0 'y (boxenv 0 'z)))) + +; self-app +(test-predicate + bytecode-ok? + '(let-void 1 (let-rec ((lam () (0) (application (loc-noclr 0)))) 'x))) + +(test-predicate + bytecode-ok? + '(let-void 1 (let-rec ((lam () (0) (seq 'x (application (loc-noclr 0))))) 'y))) + +(test-predicate + bytecode-ok? + '(let-void 1 (let-rec ((lam () (0) (let-one 'x (boxenv 0 (application (loc-noclr 1)))))) 'y))) + +(test-predicate + bytecode-ok? + '(let-void 1 (let-rec ((lam () (0) (let-void 1 (install-value 0 'x (application (loc-noclr 0)))))) 'y))) + +(test-predicate + bytecode-ok? + '(let-void 1 (let-rec ((lam () (0) (branch 'x (application (loc-noclr 0)) (application (loc-noclr 0))))) 'y))) + +(test-predicate + bytecode-ok? + '(let-void 1 (let-rec ((lam () (0) (let-rec () (application (loc-noclr 0))))) 'y))) + +(test-predicate + (negate bytecode-ok?) + '(let-void 1 (let-rec ((lam () (0) (boxenv 0 (application (loc-noclr 0))))) 'x))) + +(test-predicate + (negate bytecode-ok?) + '(let-one 'x (let-void 1 (let-rec ((lam () (0 1) (seq (loc-clr 1) (application (loc-noclr 0))))) 'y)))) + +(test-predicate + (negate bytecode-ok?) + '(let-one 'x (let-rec ((lam () (0) (application (loc-noclr 0)))) 'x))) + +(test-predicate + (negate bytecode-ok?) + '(let-void + 1 + (let-rec ((lam () (0) + (install-value + 0 + (proc-const () 'x) + (application (loc-noclr 0))))) + (application (loc-noclr 0))))) + +(test-predicate + (negate bytecode-ok?) + '(let-one 'x + (let-void 1 + (let-rec ((lam (val) (1 0) + (seq (loc-clr 0) + (application (loc-noclr 2) 'y)))) + (application (loc-noclr 1) 'z))))) + +(test-predicate + bytecode-ok? + '(let-one 'x + (let-void 1 + (let-rec ((lam (val) (1 0) + (application (loc-noclr 2) 'y))) + (application (loc-noclr 1) 'z))))) + +(test-predicate + bytecode-ok? + '(let-one 'x + (let-void 2 + (let-rec ((lam () (1 2) (loc-clr 1)) + (lam () (0 2) (loc-clr 1))) + 'x)))) + +(test-predicate + bytecode-ok? + '(let-void 1 (let-rec ((lam () (0 0) 'x)) 'y))) + +(test-predicate + (negate bytecode-ok?) + '(let-one (proc-const () void) + (let-void 1 + (let-rec ((lam () (0 1) + (seq (application (loc 1)) + (boxenv 1 + (application (loc-noclr 0)))))) + (application (loc 0)))))) + +(let ([lr '(let-rec ((lam () (0 1 2) + (seq (application (loc-box-noclr 1)) + (application (loc-noclr 2)) + (application (loc-noclr 0))))) + (application (loc 0)))]) + (test-predicate + bytecode-ok? + `(let-one 'x (let-one 'y (boxenv 0 (let-void 1 ,lr)))))) + +; seq +(test-predicate + (negate bytecode-ok?) + '(let-one 7 (boxenv 0 (seq 'x (loc 0))))) + +(test-predicate + bytecode-ok? + '(let-one 7 (boxenv 0 (seq (loc 0) 'x)))) + +(test-predicate + (negate bytecode-ok?) + '(let-void 1 (seq (let-one 'x 'y) (loc-noclr 0)))) + +;; install-value +(test-predicate + bytecode-ok? + '(let-void 1 (install-value 0 'x (loc 0)))) + +(test-predicate + (negate bytecode-ok?) + '(let-one 7 (install-value 0 'x (loc 0)))) + +(test-predicate + (negate bytecode-ok?) + '(let-one 7 (install-value-box 0 'x 'y))) + +(test-predicate + (negate bytecode-ok?) + '(let-one 7 (install-value 1 'x 'y))) + +(test-predicate + bytecode-ok? + '(let-one 7 (boxenv 0 (install-value-box 0 'x (loc-box 0))))) + +(test-predicate + bytecode-ok? + '(let-one + 'x + (install-value-box 0 (boxenv 0 'y) (loc-box 0)))) + +(test-predicate + (negate bytecode-ok?) + '(let-one 7 (boxenv 0 (install-value 0 'x 'y)))) + +(test-predicate + (negate bytecode-ok?) + '(let-void-box 1 (install-value-box 0 (loc-box-clr 0) 'x))) + +(test-predicate + (negate bytecode-ok?) + '(application (loc-box 0) (install-value-box 0 'x 'y))) + +;; let-void +(test-predicate + (negate bytecode-ok?) + '(let-void 2 (application (loc 0) (loc 2)))) + +(test-predicate + bytecode-ok? + '(let-void-box 2 (application (loc-box 1) (loc-box 2)))) + +;; box-env +(test-predicate + (negate bytecode-ok?) + '(let-one 'x (boxenv 1 'y))) + +;; lam +(test-predicate + bytecode-ok? + '(let-one + 'x + (let-one + 'y + (let-one + 'z + (boxenv + 2 + (lam + (val val) (0 2) + (application + (loc 3) + (loc-box 4) + (loc 5) + (loc 6)))))))) + +(test-predicate + (negate bytecode-ok?) + '(let-one 'x (lam () (1) 'n))) + +(test-predicate + (negate bytecode-ok?) + '(lam () (0) 'n)) + +(test-predicate + (negate bytecode-ok?) + '(let-void 1 (application (lam (val) (0) 'x) 'y))) + +;; proc-const +(test-predicate + bytecode-ok? + '(proc-const (val val) (application (loc-noclr 1) (loc-noclr 2)))) + +;; branch +(test-predicate + bytecode-ok? + '(let-one 'x (branch 'x (loc-noclr 0) (loc-clr 0)))) + +(test-predicate + bytecode-ok? + '(let-one 'x (branch 'y (loc-clr 0) (loc-clr 0)))) + +(test-predicate + (negate bytecode-ok?) + '(let-one 'x (seq (branch 'y 'z (loc-noclr 0)) (loc-clr 0)))) + +(test-predicate + bytecode-ok? + '(let-one 'x (seq (branch 'y (loc-noclr 0) 'z) (loc-clr 0)))) + +(test-predicate + (negate bytecode-ok?) + '(let-one 'x (seq (branch 'y 'z (loc-clr 0)) (loc 0)))) + +(test-predicate + (negate bytecode-ok?) + '(let-one 'x (seq (branch 'y (loc-clr 0) 'z) (loc 0)))) + +(test-predicate + (negate bytecode-ok?) + '(let-void 1 (branch 'w (install-value-box 0 'x 'y) 'z))) + +(test-predicate + (negate bytecode-ok?) + '(let-void 1 (branch 'w 'z (install-value-box 0 'x 'y)))) + +(test-predicate + (negate bytecode-ok?) + '(let-one 'w (branch 'x (boxenv 0 'y) (loc-clr 0)))) + +; let-rec +(test-predicate + bytecode-ok? + '(let-void 1 (let-rec ((lam () (0) (application (loc-noclr 0)))) (application (loc-noclr 0))))) + +(test-predicate + (negate bytecode-ok?) + '(let-void 0 (let-rec ((lam () (0) (application (loc-noclr 0)))) (application (loc-noclr 0))))) + +(test-predicate + (negate bytecode-ok?) + '(let-void + 1 + (let-rec ((lam (ref) () 'x)) + 'y))) + +(test-predicate + (negate bytecode-ok?) + '(let-void 1 (branch #f (let-rec ((lam () (0) 'x)) 'y) (loc-noclr 0)))) + +;; ignored? properly maintained +(test-predicate + (negate bytecode-ok?) + '(let-one 7 (boxenv 0 (seq (application (loc 0)) 'x)))) + +(test-predicate + (negate bytecode-ok?) + '(let-one 7 (boxenv 0 (seq (application 'w (loc 0)) 'x)))) + +(test-predicate + bytecode-ok? + '(seq (let-void-box 1 (install-value-box 0 'x (loc 0))) 'y)) + +(test-predicate + (negate bytecode-ok?) + '(let-one 7 (boxenv 0 (seq (install-value 0 (loc 0) 'x) 'y)))) + +(test-predicate + bytecode-ok? + '(seq (let-one 'x (boxenv 0 (loc 0))) 'y)) + +(test-predicate + bytecode-ok? + '(let-one 'x (boxenv 0 (seq (let-one 'y (loc 0)) 'z)))) + +(test-predicate + (negate bytecode-ok?) + '(let-one 'x (boxenv 0 (seq (let-one (loc 0) 'y) 'z)))) + +(test-predicate + (negate bytecode-ok?) + '(let-void-box 1 (seq (branch (loc 0) 'x 'y) 'z))) + +(test-predicate + bytecode-ok? + '(let-void-box 1 (seq (branch 'x (loc 0) (loc 0)) 'y))) + +(test-predicate + bytecode-ok? + '(let-one 'x (boxenv 0 (seq (let-void 1 (let-rec ((lam () (0) 'y)) (loc-noclr 0))) 'z)))) + +;; ref args +(test-predicate + bytecode-ok? + '(let-one 'x (boxenv 0 (application (lam (ref) () (loc-box-noclr 0)) (loc-noclr 1))))) + +(test-predicate + bytecode-ok? + '(let-one 'x (boxenv 0 (application (proc-const (ref) (loc-box-noclr 0)) (loc-noclr 1))))) + +(test-predicate + (negate bytecode-ok?) + '(let-one 'x (boxenv 0 (application (lam (ref) () (loc-box-noclr 0)) (loc-noclr 0))))) + +(test-predicate + bytecode-ok? + '(let-one + 'x + (boxenv + 0 + (application + (lam (ref val) () 'y) + (loc-noclr 2) + (loc-box-noclr 2))))) + +(test-predicate + (negate bytecode-ok?) + '(let-one + 'x + (boxenv + 0 + (application + (lam (ref val) () 'y) + (loc-clr 2) + (loc-box-noclr 2))))) + +(test-predicate + (negate bytecode-ok?) + '(let-one + 'x + (boxenv + 0 + (application + (lam (ref ref) () 'y) + (loc-clr 2) + (loc-noclr 2))))) + +(test-predicate + (negate bytecode-ok?) + '(lam (val ref) () 'y)) + +; case-lam +(test-predicate bytecode-ok? '(case-lam)) + +(test-predicate + bytecode-ok? + '(let-one 'x (case-lam (lam (val) () 'y) (lam () (0) 'z)))) + +(test-predicate + (negate bytecode-ok?) + '(let-one 'x (case-lam (lam (val) () 'y) (lam () (1) 'z)))) + +(test-predicate + (negate bytecode-ok?) + '(let-one 'x (case-lam (lam (val) () (loc-noclr 34))))) + +(test-predicate + (negate bytecode-ok?) + '(let-void-box 1 (application (case-lam (lam (ref) () (loc-box-noclr 0))) (loc-noclr 1)))) + +; literals +(test-predicate bytecode-ok? #t) + +(test-results) \ No newline at end of file diff --git a/collects/redex/examples/mzscheme-machine/verification.ss b/collects/redex/examples/mzscheme-machine/verification.ss new file mode 100644 index 0000000000..0c3dd89a0d --- /dev/null +++ b/collects/redex/examples/mzscheme-machine/verification.ss @@ -0,0 +1,354 @@ +#lang scheme + +(require redex/reduction-semantics) +(require "grammar.ss") + +(define (bytecode-ok? e) + (not (eq? 'invalid (car (term (verify ,e () 0 #f () () ∅)))))) + +(define-extended-language verification + bytecode + (s (ṽ ...) invalid) + (ṽ uninit imm box imm-nc box-nc not) + (γ ((n ṽ) ...)) + (η (n ...)) + (f (n n (ṽ ...)) ∅) + (m n ?)) + +(define-metafunction verification + verify : e s n b γ η f -> (s γ η) + + ; localrefs + [(verify (loc n) (ṽ_0 ... ṽ_n ṽ_n+1 ...) n_l #f γ η f) + ((ṽ_0 ... ṽ_n ṽ_n+1 ...) γ η) + (side-condition (= (length (term (ṽ_0 ...))) (term n))) + (side-condition (memq (term ṽ_n) '(imm imm-nc)))] + [(verify (loc n) (ṽ_0 ... ṽ_n ṽ_n+1 ...) n_l #t γ η f) + ((ṽ_0 ... ṽ_n ṽ_n+1 ...) γ η) + (side-condition (= (length (term (ṽ_0 ...))) (term n))) + (side-condition (memq (term ṽ_n) '(imm imm-nc box box-nc)))] + [(verify (loc-box n) (ṽ_0 ... ṽ_n ṽ_n+1 ...) n_l b γ η f) + ((ṽ_0 ... ṽ_n ṽ_n+1 ...) γ η) + (side-condition (= (length (term (ṽ_0 ...))) (term n))) + (side-condition (memq (term ṽ_n) '(box box-nc)))] + + [(verify (loc-noclr n) (ṽ_0 ... ṽ_n ṽ_n+1 ...) n_l #f γ η f) + ((ṽ_0 ... (nc ṽ_n) ṽ_n+1 ...) γ (log-noclear n n_l η)) + (side-condition (= (length (term (ṽ_0 ...))) (term n))) + (side-condition (memq (term ṽ_n) '(imm imm-nc)))] + [(verify (loc-noclr n) (ṽ_0 ... ṽ_n ṽ_n+1 ...) n_l #t γ η f) + ((ṽ_0 ... (nc ṽ_n) ṽ_n+1 ...) γ (log-noclear n n_l η)) + (side-condition (= (length (term (ṽ_0 ...))) (term n))) + (side-condition (memq (term ṽ_n) '(imm imm-nc box box-nc)))] + [(verify (loc-box-noclr n) (ṽ_0 ... ṽ_n ṽ_n+1 ...) n_l b γ η f) + ((ṽ_0 ... box-nc ṽ_n+1 ...) γ (log-noclear n n_l η)) + (side-condition (= (length (term (ṽ_0 ...))) (term n))) + (side-condition (memq (term ṽ_n) '(box box-nc)))] + + [(verify (loc-clr n) (ṽ_0 ... imm ṽ_n+1 ...) n_l #f γ η f) + ((ṽ_0 ... not ṽ_n+1 ...) (log-clear n imm n_l γ) η) + (side-condition (= (length (term (ṽ_0 ...))) (term n)))] + [(verify (loc-clr n) (ṽ_0 ... ṽ_n ṽ_n+1 ...) n_l #t γ η f) + ((ṽ_0 ... not ṽ_n+1 ...) (log-clear n ṽ_n n_l γ) η) + (side-condition (= (length (term (ṽ_0 ...))) (term n))) + (side-condition (memq (term ṽ_n) '(imm box)))] + [(verify (loc-box-clr n) (ṽ_0 ... box ṽ_n+1 ...) n_l b γ η f) + ((ṽ_0 ... not ṽ_n+1 ...) (log-clear n box n_l γ) η) + (side-condition (= (length (term (ṽ_0 ...))) (term n)))] + + ; branch + [(verify (branch e_c e_t e_e) s n_l b γ η f) + ; FIXME: should redo γ_2? + ((redo-clears γ_3 (trim s_3 s)) γ_1 η_3) + (where (s_1 γ_1 η_1) (verify e_c s n_l #f γ η ∅)) + (where (s_2 γ_2 η_2) (verify e_t (trim s_1 s) 0 b () () f)) + (where (s_3 γ_3 η_3) (verify e_e (undo-noclears η_2 (undo-clears γ_2 (trim s_2 s))) 0 b γ_2 η_1 f))] + + ; let-one + [(verify (let-one e_r e_b) (ṽ_1 ...) n_l b γ η f) + (verify e_b (imm ṽ_1* ...) ,(add1 (term n_l)) b γ η (shift 1 f)) + (where (s_1 γ_1 η_1) (verify e_r (uninit ṽ_1 ...) ,(add1 (term n_l)) #f γ η ∅)) + (side-condition (term (valid? s_1))) + ;; MRF: MzScheme implementation checks that s_1 starts with uninit + (where (ṽ_1* ...) (trim s_1 (ṽ_1 ...)))] + + ; seq + [(verify (seq e_0 ... e_n) s n_l b γ η f) + (verify e_n s_1 n_l b γ_1 η_1 f) + (where (s_1 γ_1 η_1) (verify* (e_0 ...) s n_l #t γ η))] + + ; application + [(verify (application (name e_0 (loc-noclr n)) e_1 ...) s n_l b_i γ η (n_f n_s (ṽ ...))) + (verify-self-app (application e_0 e_1 ...) s n_l γ η (n_f n_s (ṽ ...))) + (side-condition (= (term n) (+ (term n_f) (length (term (e_1 ...))))))] + [(verify (application (lam (τ_0 ...) (n_0 ...) e) e_0 ...) (name s (ṽ_0 ...)) n_l b γ η f) + (verify*-ref (e_0 ...) (τ_0 ...) s_1 n_l* γ η) + (where n ,(length (term (e_0 ...)))) + (where n_l* ,(+ (term n) (term n_l))) + (where s_1 (abs-push n not s)) + (side-condition (term (verify-lam (lam (τ_0 ...) (n_0 ...) e) s_1 ?)))] + [(verify (application (proc-const (τ_0 ...) e) e_0 ...) s n_l b γ η f) + (verify (application (lam (τ_0 ...) () e) e_0 ...) s n_l b γ η f)] + [(verify (application e_0 e_1 ...) (name s (ṽ_0 ...)) n_l b γ η f) + (verify* (e_0 e_1 ...) (abs-push n not s) n_l* #f γ η) + (where n ,(length (term (e_1 ...)))) + (where n_l* ,(+ (term n) (term n_l)))] + + ; let-void + [(verify (let-void n e) (name s (ṽ_0 ...)) n_l b_i γ η f) + (verify e (abs-push n uninit s) ,(+ (term n) (term n_l)) b_i γ η (shift n f))] + [(verify (let-void-box n e) (name s (ṽ_0 ...)) n_l b_i γ η f) + (verify e (abs-push n box s) ,(+ (term n) (term n_l)) b_i γ η (shift n f))] + + ; procedures in arbitrary context + [(verify (lam ((name τ val) ...) (n_0 ...) e) s n_l b γ η f) + (s γ η) + (side-condition (term (verify-lam (lam (τ ...) (n_0 ...) e) s ?)))] + [(verify (proc-const ((name τ val) ...) e) s n_l b γ η f) + (verify (lam (τ ...) () e) s n_l b γ η f)] + + ; case-lam + [(verify (case-lam l ...) s n_l b γ η f) + (s γ η) + (side-condition (term (AND (verify-lam l s ?) ...)))] + + ; literals + [(verify number s n_l b γ η f) (s γ η)] + [(verify b s n_l b_i γ η f) (s γ η)] + [(verify (quote variable) s n_l b γ η f) (s γ η)] + [(verify void s n_l b γ η f) (s γ η)] + + ; install-value + [(verify (install-value n e_r e_b) s n_l b γ η f) + (verify e_b (set imm n s_2) n_l b γ η f) + (side-condition (< (term n) (term n_l))) + (where (s_1 γ_1 η_1) (verify e_r s n_l #f γ η ∅)) + (where s_2 (trim s_1 s)) + (side-condition (term (valid? s_2))) + (where uninit (stack-ref n s_2))] + [(verify (install-value-box n e_r e_b) (name s (ṽ_0 ...)) n_l b γ η f) + (verify e_b s_2 n_l b γ_1 η_1 f) + (side-condition (< (term n) (length (term s)))) + (where (s_1 γ_1 η_1) (verify e_r s n_l #f γ η ∅)) + (where s_2 (trim s_1 s)) + (side-condition (term (valid? s_2))) + (side-condition (memq (term (stack-ref n s_2)) '(box box-nc)))] + + ; boxenv + [(verify (boxenv n_p e) (ṽ_0 ... imm ṽ_n+1 ...) n_l b γ η f) + (verify e (ṽ_0 ... box ṽ_n+1 ...) n_l b γ η f) + (side-condition (= (length (term (ṽ_0 ...))) (term n_p))) + (side-condition (< (term n_p) (term n_l)))] + + ; let-rec + [(verify (let-rec ((name l (lam ((name v val) ...) (n_0 ...) e_0)) ...) e) (ṽ_0 ... ṽ_n ...) n_l b γ η f) + (verify e s_1 n_l b γ η f) + (where n ,(length (term (l ...)))) + (side-condition (= (length (term (ṽ_0 ...))) (term n))) + (side-condition (term (AND (same? ṽ_0 uninit) ...))) + (side-condition (<= (term n) (term n_l))) + (where s_1 (abs-push n imm (ṽ_n ...))) + (where (n_i ...) (count-up ,(length (term (l ...))))) + (side-condition (term (AND (verify-lam l s_1 n_i) ...)))] + + ; indirect + [(verify (indirect x) s n_l b γ η f) (s γ η)] + + ; else + [(verify e s n_l b γ η f) (invalid γ η)]) + +(define-metafunction verification + verify* : (e ...) s n_l b γ η -> (s γ η) + [(verify* () s n_l b γ η) (s γ η)] + [(verify* (e_0 e_1 ...) s n_l b γ η) + (verify* (e_1 ...) (trim s_1 s) n_l b γ_1 η_1) + (where (s_1 γ_1 η_1) (verify e_0 s n_l b γ η ∅))]) + +(define-metafunction verification + verify*-ref : (e ...) (τ ...) s n_l γ η -> (s γ η) + [(verify*-ref () () s n_l γ η) (s γ η)] + [(verify*-ref (e_0 e_1 ...) (val τ_1 ...) s n_l γ η) + (verify*-ref (e_1 ...) (τ_1 ...) (trim s_1 s) n_l γ_1 η_1) + (where (s_1 γ_1 η_1) (verify e_0 s n_l #f γ η ∅))] + [(verify*-ref (e_0 e_1 ...) () s n_l γ η) + (verify* (e_0 e_1 ...) s n_l #f γ η)] + [(verify*-ref () (τ_0 τ_1 ...) s n_l γ η) (s γ η)] + [(verify*-ref ((loc n) e_1 ...) (ref τ_1 ...) s n_l γ η) + (verify*-ref (e_1 ...) (τ_1 ...) s_1 n_l γ_1 η_1) + ; Require the reference to load a box. + (where (s_1 γ_1 η_1) (verify (loc-box n) s n_l #f γ η ∅))] + [(verify*-ref ((loc-noclr n) e_1 ...) (ref τ_1 ...) s n_l γ η) + (verify*-ref (e_1 ...) (τ_1 ...) s_1 n_l γ_1 η_1) + ; Require the reference to load a box. + (where (s_1 γ_1 η_1) (verify (loc-box-noclr n) s n_l #f γ η ∅))] + [(verify*-ref ((loc-clr n) e_1 ...) (ref τ_1 ...) s n_l γ η) + (verify*-ref (e_1 ...) (τ_1 ...) s_1 n_l γ_1 η_1) + ; Require the reference to load a box. + (where (s_1 γ_1 η_1) (verify (loc-box-clr n) s n_l #f γ η ∅))] + [(verify*-ref (e ...) (τ ...) s n_l γ η) (invalid γ η)]) + +(define-metafunction verification + [(verify-lam (lam (τ_0 ...) (n_0 ...) e) (name s (ṽ_0 ...)) m) + (valid? s_1) + (where n_d ,(length (term s))) + (where n_d* ,(+ (length (term (τ_0 ...))) (length (term (n_0 ...))))) + (side-condition (term (AND (less-than? n_0 n_d) ...))) + (side-condition (term (AND (not-member? (stack-ref n_0 s) (uninit not)) ...))) + (where (ṽ ...) ((drop-noclear (stack-ref n_0 s)) ...)) + (where f (extract-self m (n_0 ...) (τ_0 ...) (ṽ ...))) + (where (s_1 γ_1 η_1) (verify e (ṽ ... (arg τ_0) ...) n_d* #f () () f))] + [(verify-lam any s m) #f]) + +(define-metafunction verification + [(extract-self ? (n_0 ...) (τ_0 ...) (ṽ_0 ...)) ∅] + [(extract-self n_i (n_0 ... n_i n_i+1 ...) (τ_0 ...) (ṽ_0 ...)) + (,(length (term (n_0 ...))) ,(length (term (τ_0 ...))) (ṽ_0 ...)) + ; When a closure captures itself multiple times, only the last + ; occurrence is considered a self-reference. + (side-condition (term (not-member? n_i (n_i+1 ...))))] + [(extract-self n (n_0 ...) (τ_0 ...) (ṽ_0 ...)) ∅]) + +(define-metafunction verification + drop-noclear : ṽ -> ṽ + [(drop-noclear imm-nc) imm] + [(drop-noclear box-nc) box] + [(drop-noclear ṽ) ṽ]) + +(define-metafunction verification + [(verify-self-app (application e_0 e_1 ...) (name s (ṽ_0 ...)) n_l γ η (n_f n_s (ṽ_j ...))) + (s_1 γ_1 η_1) + (where n ,(length (term (e_1 ...)))) + (where n_l* ,(+ (term n) (term n_l))) + (where (s_1 γ_1 η_1) (verify* (e_0 e_1 ...) (abs-push n not s) n_l* #f γ η)) + (side-condition (term (valid? s_1))) + (where (n_j ...) (count-up ,(length (term (ṽ_j ...))))) + (side-condition (term (closure-intact? ((stack-ref (plus n_j n_s) s_1) ...) (ṽ_j ...))))] + [(verify-self-app e s n_l γ η f) (invalid γ η)]) + +(define-metafunction verification + closure-intact? : (ṽ ...) (ṽ ...) -> b + [(closure-intact? () ()) #t] + [(closure-intact? (imm-nc ṽ_1 ...) (imm ṽ_2 ...)) + (closure-intact? (ṽ_1 ...) (ṽ_2 ...))] + [(closure-intact? (box-nc ṽ_1 ...) (box ṽ_2 ...)) + (closure-intact? (ṽ_1 ...) (ṽ_2 ...))] + [(closure-intact? (ṽ ṽ_1 ...) (ṽ ṽ_2 ...)) + (closure-intact? (ṽ_1 ...) (ṽ_2 ...))] + [(closure-intact? (ṽ_1 ...) (ṽ_2 ...)) #f]) + +(define-metafunction verification + shift : n f -> f + [(shift n ∅) ∅] + [(shift n (n_f n_s (ṽ ...))) + (,(+ (term n) (term n_f)) ,(+ (term n) (term n_s)) (ṽ ...))]) + +(define-metafunction verification + arg : τ -> ṽ + [(arg val) imm] + [(arg ref) box]) + +(define-metafunction verification + abs-push : n ṽ (ṽ ...) -> s + [(abs-push 0 ṽ (ṽ_0 ...)) (ṽ_0 ...)] + [(abs-push n ṽ (ṽ_0 ...)) + (abs-push ,(sub1 (term n)) ṽ (ṽ ṽ_0 ...))]) + +(define-metafunction verification + stack-ref : n (ṽ ...) -> ṽ + [(stack-ref n (ṽ_0 ... ṽ_n ṽ_n+1 ...)) + ṽ_n + (side-condition (= (length (term (ṽ_0 ...))) (term n)))]) + +(define-metafunction verification + set : ṽ n (ṽ ...) -> (ṽ ...) + [(set ṽ n (ṽ_0 ... ṽ_n ṽ_n+1 ...)) + (ṽ_0 ... ṽ ṽ_n+1 ...) + (side-condition (= (length (term (ṽ_0 ...))) (term n)))]) + +(define-metafunction verification + nc : ṽ -> ṽ + [(nc imm) imm-nc] + [(nc imm-nc) imm-nc] + [(nc box) box-nc] + [(nc box-nc) box-nc]) + +(define-metafunction verification + log-noclear : n n η -> η + [(log-noclear n_p n_l (n_0 ...)) + (,(- (term n_p) (term n_l)) n_0 ...) + (side-condition (>= (term n_p) (term n_l)))] + [(log-noclear n_p n_l η) η]) + +(define-metafunction verification + undo-noclears : η s -> s + [(undo-noclears η invalid) invalid] + [(undo-noclears () s) s] + [(undo-noclears (n_0 n_1 ...) (ṽ_0 ... imm-nc ṽ_i ...)) + (undo-noclears (n_1 ...) (ṽ_0 ... imm ṽ_i ...)) + (side-condition (= (length (term (ṽ_0 ...))) (term n_0)))] + [(undo-noclears (n_0 n_1 ...) (ṽ_0 ... box-nc ṽ_i ...)) + (undo-noclears (n_1 ...) (ṽ_0 ... box ṽ_i ...)) + (side-condition (= (length (term (ṽ_0 ...))) (term n_0)))] + [(undo-noclears (n_0 n_1 ...) s) + (undo-noclears (n_1 ...) s)]) + +(define-metafunction verification + log-clear : n ṽ n γ -> γ + [(log-clear n_p ṽ n_l ((n_0 ṽ_0) ...)) + ((,(- (term n_p) (term n_l)) ṽ) (n_0 ṽ_0) ...) + (side-condition (>= (term n_p) (term n_l)))] + [(log-clear n_p ṽ n_l γ) γ]) + +(define-metafunction verification + undo-clears : γ s -> s + [(undo-clears γ invalid) invalid] + [(undo-clears () s) s] + [(undo-clears ((n_0 ṽ_0) (n_1 ṽ_1) ...) s) + (undo-clears ((n_1 ṽ_1) ...) (set ṽ_0 n_0 s))]) + +(define-metafunction verification + redo-clears : γ s -> s + [(redo-clears γ invalid) invalid] + [(redo-clears () s) s] + [(redo-clears ((n_0 ṽ_0) (n_1 ṽ_1) ...) s) + (redo-clears ((n_1 ṽ_1) ...) (set uninit n_0 s))]) + +(define-metafunction verification + trim : s s -> s + [(trim invalid s) invalid] + [(trim (ṽ_f ...) (ṽ_t ...)) + ,(take-right (term (ṽ_f ...)) + (length (term (ṽ_t ...))))]) + +(define-metafunction verification + [(valid? invalid) #f] + [(valid? (ṽ ...)) #t]) + + +;; Typsetting tricks: + +(define-metafunction verification + [(AND) #t] + [(AND #t any_1 ...) (AND any_1 ...)] + [(AND any_0 any_1 ...) #f]) + +(define-metafunction verification + [(same? any_1 any_1) #t] + [(same? any_1 any_2) #f]) + +(define-metafunction verification + [(less-than? n_1 n_2) ,(< (term n_1) (term n_2))]) + +(define-metafunction verification + [(plus n_1 n_2) ,(+ (term n_1) (term n_2))]) + +(define-metafunction verification + [(not-member? any_1 (any_2 ...)) + ,(not (member (term any_1) (term (any_2 ...))))]) + +;; Shouldn't have copied from "reduction.ss": +(define-metafunction bytecode + [(count-up number) + ,(build-list (term number) (λ (x) x))]) + +(provide (all-defined-out)) diff --git a/collects/redex/examples/pi-calculus.ss b/collects/redex/examples/pi-calculus.ss index ef00df522e..df3857157a 100644 --- a/collects/redex/examples/pi-calculus.ss +++ b/collects/redex/examples/pi-calculus.ss @@ -381,4 +381,4 @@ ;; observe that the bang clause can be collected: it's listening on a channel that can't escape. So (observes Milner) this ;; is equivalent to (encode-as-π (lam y y) chan). - +(test-results) diff --git a/collects/redex/examples/r6rs/README b/collects/redex/examples/r6rs/README new file mode 100644 index 0000000000..7091e03c9d --- /dev/null +++ b/collects/redex/examples/r6rs/README @@ -0,0 +1,25 @@ +This directory contains the PLT Redex implementation of the +R6RS operational semantics and a test suite for the +semantics. + +== r6rs.ss: the semantics itself. + +== r6rs-tests.ss: the test suite for the semantics. Use: + + mzscheme -t r6rs-tests.ss -m + + to run the tests and see a single period shown per test + run (each test that explores more than 100 states shows a + colon for each 100 states it explores). To see a more + verbose output (that shows each test), use: + + mzscheme -t r6rs-tests.ss -m #t + +== show-examples.ss: use this file to explore particular + examples in a GUI. Its content shows how to use it and + gives a few examples. Either run it in DrScheme's module + language, or like this from the commandline: + + mred show-examples.ss + +== test.ss: test suite infrastructure diff --git a/collects/redex/examples/r6rs/r6rs-tests.ss b/collects/redex/examples/r6rs/r6rs-tests.ss new file mode 100644 index 0000000000..cbb24e5441 --- /dev/null +++ b/collects/redex/examples/r6rs/r6rs-tests.ss @@ -0,0 +1,2066 @@ +(module r6rs-tests mzscheme + (require (lib "match.ss") + (lib "list.ss") + (lib "etc.ss") + redex/reduction-semantics + "test.ss" + "r6rs.ss") + + ;; ============================================================ + ;; TESTING APPARATUS + + (define-struct r6test (test expected)) + + (define (make-r6test/v t expected) + (make-r6test `(store () ,t) + (list `(store () (values ,expected))))) + (define (make-r6test/e t err) + (make-r6test `(store () ,t) + (list `(uncaught-exception (make-cond ,err))))) + + (define (run-a-test test verbose?) + (unless verbose? + (printf ".") + (flush-output)) + (let ([t (r6test-test test)] + [expected (r6test-expected test)]) + (set! test-count (+ test-count 1)) + (when verbose? (printf "testing ~s ... " t)) + (flush-output) + (with-handlers ([exn:fail:duplicate? + (lambda (e) + (set! failed-tests (+ failed-tests 1)) + (unless verbose? + (printf "\ntesting ~s ... " t)) + (raise e))]) + (let* ([results (evaluate reductions + t + (or verbose? 'dots) + (verify-p* t))] + [rewritten-results (remove-duplicates (map rewrite-actual results))]) + (for-each (verify-a* t) results) + (unless (set-same? expected rewritten-results equal?) + (set! failed-tests (+ failed-tests 1)) + (unless verbose? + (printf "\ntesting ~s ... " t)) + (printf "TEST FAILED!~nexpected:~a\nrewritten-received:~a\nreceived:~a\n\n" + (combine-in-lines expected) + (combine-in-lines rewritten-results) + (combine-in-lines results))))))) + + (define p*-pattern (redex-match lang p*)) + (define a*-pattern (redex-match lang a*)) + (define r*-pattern (redex-match lang r*)) + (define verified-terms 0) + (define ((verify-p* orig) sexp) + (let ([m (p*-pattern sexp)]) + (unless (and m + (= 1 (length m))) + (newline) + (error 'verify-p* "matched ~a times\n ~s\norig\n ~s" + (if m + (length m) + "0") + sexp orig)) + (set! verified-terms (+ verified-terms 1)))) + + (define ((verify-a* orig-sexp) sexp) + (unless (a*-pattern sexp) + (newline) + (error 'verify-a* "didn't match ~s\noriginal term ~s" sexp orig-sexp)) + + ;; verify that observable is defined for this value + (let ([candidate-r* (term-let ((sexp sexp)) + (term (observable sexp)))]) + (unless (r*-pattern candidate-r*) + (error 'verify-a* "observable of ~s is ~s, but isn't an r*\noriginal term ~s" + sexp + candidate-r* + orig-sexp)))) + + (define (remove-duplicates lst) + (let ([ht (make-hash-table 'equal)]) + (for-each (λ (x) (hash-table-put! ht x #t)) lst) + (hash-table-map ht (λ (x y) x)))) + + (define (combine-in-lines strs) (apply string-append (map (λ (x) (format "\n ~s" x)) strs))) + + (define (rewrite-actual actual) + (match actual + [`(unknown ,str) actual] + [`(uncaught-exception ,v) actual] + [`(store ,@(xs ...)) + (let loop ([actual actual]) + (subst-:-vars actual))] + [_ + (error 'rewrite-actual "unknown actual ~s\n" actual)])) + + (define (subst-:-vars exp) + (match exp + [`(store ,str ,exps ...) + (let* ([pp-var? (λ (x) (regexp-match #rx"^[qmi]p" (format "~a" (car x))))] + [pp-bindings (filter pp-var? str)] + [with-out-pp (fp-sub pp-bindings `(store ,(filter (λ (x) (not (pp-var? x))) str) ,@exps))] + [with-out-app-vars (remove-unassigned-app-vars with-out-pp)] + [without-ri-vars (remove-unused-ri-vars with-out-app-vars)]) + without-ri-vars)] + [`(unknown ,string) string] + [_ (error 'subst-:-vars "unknown exp ~s" exp)])) + + (define (is-ri-var? x) (regexp-match #rx"^ri" (symbol->string x))) + + (define (remove-unused-ri-vars exp) + (match exp + [`(store ,str ,exps ...) + (let ([ri-vars (filter is-ri-var? (map car str))] + [str-without-ri-binders + (filter (λ (binding) (not (is-ri-var? (car binding)))) str)]) + `(store ,(filter (λ (binding) + (cond + [(is-ri-var? (car binding)) + (not (not-in (car binding) (cons str-without-ri-binders exps)))] + [else #t])) + str) + ,@exps))])) + + (define (remove-unassigned-app-vars term) + (match term + [`(store ,bindings ,body) + (let* ([binding-rhss (map cadr bindings)] + [bindings-to-sub + (filter (λ (binding) (not (appears-in-set? (car binding) body))) + (filter (λ (binding) (regexp-match #rx"^bp" (format "~a" (car binding)))) bindings))] + [vars-to-sub (map car bindings-to-sub)]) + `(store ,(filter (λ (binding) (not (memq (car binding) vars-to-sub))) bindings) + ,(r6-all bindings-to-sub body)))])) + + (define (not-in var e) + (cond + [(pair? e) (and (not-in var (car e)) + (not-in var (cdr e)))] + [else (not (eq? var e))])) + + (define (appears-in-set? x e) + (let loop ([e e]) + (match e + [`(set! ,x2 ,e2) (or (eq? x x2) + (loop e2))] + [else + (and (list? e) + (ormap loop e))]))) + + + (define (fp-sub bindings term) + (let loop ([term term]) + (let ([next (do-one-subst bindings term)]) + (cond + [(equal? term next) next] + [else (loop next)])))) + + (define (r6-all sub-vars body) + (term-let ([(sub-vars ...) sub-vars] + [body body]) + (term (r6rs-subst-many (sub-vars ... body))))) + + (define (do-one-subst sub-vars term) + (match term + [`(store ,str ,exps ...) + (let* ([keep-vars + (map (λ (pr) + `(,(car pr) + ,(r6-all sub-vars (cadr pr)))) + str)]) + `(store ,keep-vars ,@(r6-all sub-vars exps)))])) + + (define test-count 0) + (define failed-tests 0) + + (define arithmetic-tests + (list + (make-r6test/v '(+) 0) + (make-r6test/v '(+ 1) 1) + (make-r6test/v '(+ 1 2) 3) + (make-r6test/v '(+ 1 2 3) 6) + + (make-r6test/v '(- 1) -1) + (make-r6test/v '(- 1 2) -1) + (make-r6test/v '(- 1 2 3) -4) + + (make-r6test/v '(*) 1) + (make-r6test/v '(* 2) 2) + (make-r6test/v '(* 2 3) 6) + (make-r6test/v '(* 2 3 4) 24) + + (make-r6test/v '(/ 2) 1/2) + (make-r6test/v '(/ 1 2) 1/2) + (make-r6test/v '(/ 1 2 3) 1/6) + + (make-r6test/e '(/ #f) "arith-op applied to non-number") + + (make-r6test/e '(/ 1 2 3 4 5 0 6) "divison by zero") + (make-r6test/e '(/ 0) "divison by zero") + + (make-r6test '(store () ((lambda (x) (+ x x)) #f)) + (list '(uncaught-exception (make-cond "arith-op applied to non-number")))))) + + (define assignment-results-tests + (list + ;; begin + (make-r6test/v '((lambda (x) (begin x (set! x 2) x)) 3) + 2) + (make-r6test '(store () (letrec ([x 1]) (begin 2 (set! x 2)))) + (list '(unknown "unspecified result"))) + + ;; begin0 + (make-r6test/v '((lambda (x) (begin0 x (set! x 2))) 3) + 3) + (make-r6test '(store () (letrec ([x 1]) (begin0 (set! x 2) 2 3))) + (list '(unknown "unspecified result"))) + (make-r6test/v '((lambda (x) (begin (begin0 (set! x 1) (set! x 2)) x)) 3) + 2) + + + ;; application + (make-r6test '(store () (letrec ([x 1]) ((lambda (x) 1) (set! x 2)))) + (list '(unknown "unspecified result"))) + (make-r6test '(store () (letrec ([x 1]) ((set! x 2) 2))) + (list '(unknown "unspecified result"))) + + ;; if + (make-r6test '(store () (letrec ([x 1]) (if (set! x 2) 2 3))) + (list '(unknown "unspecified result"))) + + ;; set! + (make-r6test '(store () (letrec ([x 1]) (set! x (set! x 2)))) + (list '(unknown "unspecified result"))) + + (make-r6test '(store () (letrec ([x '(1)]) (set! x (set-car! x 2)))) + (list '(unknown "unspecified result") + '(uncaught-exception (make-cond "can't set-car! on a non-pair or an immutable pair")))) + + ;; handlers + (make-r6test '(store () (letrec ([x 1]) (with-exception-handler (lambda (e) (set! x 2)) (lambda () (car 'x))))) + (list '(uncaught-exception (make-cond "handler returned")))) + + ;; call with values + (make-r6test '(store () (letrec ([x 1]) (call-with-values (lambda () (set! x 2)) +))) + (list '(unknown "unspecified result"))) + + ;; dynamic-wind + (make-r6test/v '((lambda (x) (dynamic-wind (lambda () (set! x 0)) (lambda () x) (lambda () (set! x 2)))) 1) + 0) + (make-r6test '(store () (letrec ([x 1]) (dynamic-wind (lambda () 0) (lambda () (set! x 2)) (lambda () 1)))) + (list '(unknown "unspecified result"))) + (make-r6test '(store () (letrec ([x 1]) (begin (dynamic-wind (lambda () 0) (lambda () (set! x 2)) (lambda () 1)) 5))) + (list '(store ((lx-x 2)) (values 5)))))) + + (define basic-form-tests + (list + + (make-r6test/e '((lambda (x y) x) (lambda (x) x)) + "arity mismatch") + + (make-r6test/v '(if #t 12 13) 12) + (make-r6test/v '(if #f 12 13) 13) + (make-r6test/v '(begin (if #f 12 14) 14) 14) + (make-r6test/v '((lambda (x) (if #t (set! x 45) 'x) x) 1) 45) + (make-r6test/v '((lambda (x) (if #f (set! x 45) 'z) x) 1) 1) + + ;; begin0 tests + (make-r6test/v '(begin0 (+ 1 1)) + 2) + (make-r6test/v '(begin0 (+ 1 1) (+ 2 3)) + 2) + (make-r6test/v '((lambda (x) (begin0 x (set! x 4))) 2) + 2) + (make-r6test/v '(((lambda (x) (begin0 (lambda () x) (set! x (+ x 1)) (set! x (+ x 1)) (set! x (+ x 1)))) + 2)) + 5))) + + (define pair-tests + (list + (make-r6test/v '(if (null? (cons 1 (cons 2 (cons (lambda (x) x) null)))) 0 1) + 1) + (make-r6test/v '(null? (cons 1 (cons 2 (cons (lambda (x) x) null)))) #f) + (make-r6test/v '(null? (cons 1 2)) #f) + (make-r6test/v '(null? null) #t) + (make-r6test/v '(pair? null) #f) + (make-r6test/v '(pair? (cons 1 1)) #t) + (make-r6test/v '(null? (list 1 2)) #f) + (make-r6test/v '(pair? (list 1)) #t) + (make-r6test/v '(pair? (list)) #f) + (make-r6test/v '(null? (list)) #t) + + (make-r6test/v '((lambda (x) ((lambda (y) (car (cdr x))) (begin (set-car! (cdr x) 400) 11))) + (cons 1 (cons 2 null))) + 400) + (make-r6test/v '((lambda (x) ((lambda (y) (cdr (cdr x))) (begin (set-cdr! (cdr x) 400) 12))) + (cons 1 (cons 2 null))) + 400) + (make-r6test '(store () ((lambda (x) (set-cdr! x 4) (cdr x)) '(3))) + (list '(store () (values 4)) + '(uncaught-exception (make-cond "can't set-cdr! on a non-pair or an immutable pair")))) + (make-r6test '(store () ((lambda (x) (set-car! x 4) (car x)) '(3))) + (list '(store () (values 4)) + '(uncaught-exception (make-cond "can't set-car! on a non-pair or an immutable pair")))) + + (make-r6test '(store () + (letrec ([first-time? #t] + [f (lambda y (if first-time? + (begin + (set! first-time? #f) + (set-car! y 2)) + (car y)))] + [g (lambda () (apply f '(1)))]) + (g) + (g))) + (list '(store ((lx-first-time? #f) + (lx-f (lambda y (if lx-first-time? + (begin + (set! lx-first-time? #f) + (set-car! y 2)) + (car y)))) + (lx-g (lambda () (apply lx-f (cons 1 null))))) + (values 1)))))) + + (define quote-tests + (list + (make-r6test/v ''#f #f) + (make-r6test/v ''#t #t) + (make-r6test/v ''1 1) + (make-r6test/v ''x ''x) + (make-r6test/v ''null ''null) + (make-r6test/v '(null? 'null) #f) + (make-r6test/v ''unspecified ''unspecified) + (make-r6test/v '((lambda (x) (eqv? 'x 1)) 1) #f))) + + (define eqv-tests + (list + (make-r6test '(store () (eqv? (lambda (x) x) (lambda (x) x))) + (list '(unknown "equivalence of procedures"))) + (make-r6test '(store () (eqv? (lambda (x) x) (lambda (x) x))) + (list '(unknown "equivalence of procedures"))) + (make-r6test '(store () ((lambda (x) (eqv? x x)) (lambda (x) x))) + (list '(unknown "equivalence of procedures"))) + + (make-r6test/v '(eqv? (cons 1 2) (cons 1 2)) #f) + (make-r6test/v '((lambda (x) (eqv? x x)) (cons 1 2)) #t) + + (make-r6test '(store () (apply apply values '(()))) + (list '(store () (values)))) + + (make-r6test/v '(eqv? #t #t) #t) + (make-r6test/v '(eqv? #t #f) #f) + + (make-r6test/v '(eqv? 'x 'y) #f) + (make-r6test/v '(eqv? 'y 'y) #t) + + (make-r6test/v '(eqv? (lambda (x) x) #t) #f) + (make-r6test/v '(eqv? #t (lambda (x) x)) #f) + (make-r6test/v '(eqv? '() null) #t) + + (make-r6test '(store () (eqv? '(a) '(a))) + (list '(store () (values #f)))) + (make-r6test '(store () (eqv? '(a) '(b))) + (list '(store () (values #f)))) + (make-r6test '(store () ((lambda (x) (eqv? x x)) '(a))) + (list '(store () (values #t)))) + + (make-r6test '(store () + (eqv? + (call/cc + (lambda (k) + (with-exception-handler + k + (lambda () (car 'x))))) + (call/cc + (lambda (k) + (with-exception-handler + k + (lambda () (car))))))) + (list '(store () (values #f)) + '(store () (values #t)))) + (make-r6test '(store () + ((lambda (x) (eqv? x x)) + (call/cc + (lambda (k) + (with-exception-handler + k + (lambda () (car 'x))))))) + (list '(store () (values #f)) + '(store () (values #t)))) + + (make-r6test/v '(eqv? + (call/cc + (lambda (k) + (with-exception-handler + k + (lambda () (car 'x))))) + #f) + #f) + (make-r6test/v '(eqv? + #f + (call/cc + (lambda (k) + (with-exception-handler + k + (lambda () (car 'x)))))) + #f) + (make-r6test/v '(eqv? + (lambda (x) x) + (call/cc + (lambda (k) + (with-exception-handler + k + (lambda () (car 'x)))))) + #f) + (make-r6test/v '(eqv? + (call/cc + (lambda (k) + (with-exception-handler + k + (lambda () (car 'x))))) + (lambda (x) x)) + #f))) + + (define err-tests + (list + + (make-r6test/e '(call-with-values (lambda (x) x) (lambda (y) y)) + "arity mismatch") + (make-r6test/e '(/) "arity mismatch") + (make-r6test/e '(-) "arity mismatch") + (make-r6test/e '(cons) "arity mismatch") + (make-r6test/e '(null?) "arity mismatch") + (make-r6test/e '(pair?) "arity mismatch") + (make-r6test/e '(car) "arity mismatch") + (make-r6test/e '(cdr) "arity mismatch") + (make-r6test/e '(set-car!) "arity mismatch") + (make-r6test/e '(set-cdr!) "arity mismatch") + (make-r6test/e '(call/cc) "arity mismatch") + (make-r6test/e '(eqv?) "arity mismatch") + (make-r6test/e '(apply) "arity mismatch") + (make-r6test/e '(apply values) "arity mismatch") + (make-r6test/e '(call-with-values) "arity mismatch") + + (make-r6test/e '(dynamic-wind 1) "arity mismatch") + + (make-r6test/e '(apply 1 2) "can't apply non-procedure") + (make-r6test/e '(apply 1 null) "can't apply non-procedure") + (make-r6test/e '(apply values 2) "apply's last argument non-list") + (make-r6test/e '(car 1) "can't take car of non-pair") + (make-r6test/e '(cdr 1) "can't take cdr of non-pair") + (make-r6test/e '(set-car! 2 1) "can't set-car! on a non-pair or an immutable pair") + (make-r6test/e '(set-cdr! 1 2) "can't set-cdr! on a non-pair or an immutable pair") + + (make-r6test/e '(call/cc 1) "can't call non-procedure") + (make-r6test/e '(call-with-values 1 2) "can't call non-procedure"))) + + (define r5-tests + (list + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; + ;; tests from R5RS + ;; + + ; ---- + ; 4.1.3 + (make-r6test/v '(+ 3 4) 7) + (make-r6test/v '((if #f + *) 3 4) 12) + + + ; ---- + ; 4.1.4 + (make-r6test/v '(lambda (x) (+ x x)) '(lambda (x) (+ x x))) + (make-r6test/v '((lambda (x) (+ x x)) 4) 8) + + (make-r6test '(store () + (letrec* ([reverse-subtract + (lambda (x y) (- y x))]) + (reverse-subtract 7 10))) + (list + '(store ((lx-reverse-subtract (lambda (x y) (- y x)))) + (values 3)))) + + (make-r6test '(store () + (letrec* ([add4 + ((lambda (x) + (lambda (y) + (+ x y))) + 4)]) + (add4 6))) + (list + '(store ((lx-add4 (lambda (y) (+ 4 y)))) + (values 10)))) + + (make-r6test/v '((lambda x x) 3 4 5 6) + '(cons 3 (cons 4 (cons 5 (cons 6 null))))) + (make-r6test/v '((lambda (x y dot z) z) 3 4 5 6) + '(cons 5 (cons 6 null))) + + ; ---- + ; 4.2.2 + + (make-r6test '(store () + (letrec* ([even? + (lambda (n) + (if (eqv? 0 n) + #t + (odd? (- n 1))))] + [odd? + (lambda (n) + (if (eqv? 0 n) + #f + (even? (- n 1))))]) + ;; using 88 here runs, but isn't really much more useful + ;; for testing purposes (it also takes > 1000 reductions) + (even? 2))) + (list + '(store ((lx-even? + (lambda (n) + (if (eqv? 0 n) + #t + (lx-odd? (- n 1))))) + (lx-odd? + (lambda (n) + (if (eqv? 0 n) + #f + (lx-even? (- n 1)))))) + + (values #t)))) + + ; ---- + ; 4.2.3 + (make-r6test '(store () (letrec* ([x 0]) (begin (set! x 5) (+ x 1)))) + (list '(store ((lx-x 5)) (values 6)))) + + + ; ---- + ; 5.2.1 + + (make-r6test '(store () + (letrec* ([add3 (lambda (x) (+ x 3))]) + (add3 3))) + (list '(store ((lx-add3 (lambda (x) (+ x 3)))) (values 6)))) + (make-r6test '(store () (letrec* ((first car)) + (first '(1 2)))) + (list '(store ((lx-first car)) (values 1)))) + + + ; ---- + ; 6.1 + + (make-r6test/v '(eqv? 'a 'a) #t) + (make-r6test/v '(eqv? 'a 'b) #f) + (make-r6test/v '(eqv? 2 2) #t) + (make-r6test/v '(eqv? '() '()) #t) + (make-r6test/v '(eqv? 100000000 100000000) #t) + (make-r6test/v '(eqv? (cons 1 2) (cons 1 2)) #f) + (make-r6test '(store () (eqv? (lambda () 1) (lambda () 2))) + (list '(unknown "equivalence of procedures"))) + (make-r6test/v '(eqv? #f 'nil) #f) + (make-r6test/v '(eqv? #f '()) #f) + (make-r6test '(store () ((lambda (p) (eqv? p p)) (lambda (x) x))) + (list '(unknown "equivalence of procedures"))) + + (make-r6test + '(store () + (letrec* ([gen-counter + (lambda () + ((lambda (n) + (lambda () (set! n (+ n 1)) n)) + 0))]) + ((lambda (g) (eqv? g g)) + (gen-counter)))) + (list '(unknown "equivalence of procedures"))) + + (make-r6test + '(store () + (letrec* ((gen-counter + (lambda () + ((lambda (n) + (lambda () (set! n (+ n 1)) n)) + 0)))) + (eqv? (gen-counter) (gen-counter)))) + (list '(unknown "equivalence of procedures"))) + + + + ; ---- + ; 6.3.2 + + (make-r6test '(store () + (letrec* ([x (list 'a 'b 'c)] + [y x]) + y)) + (list + '(store ((lx-x (cons 'a (cons 'b (cons 'c null)))) + (lx-y (cons 'a (cons 'b (cons 'c null))))) + (values (cons 'a (cons 'b (cons 'c null))))))) + + (make-r6test '(store () + (letrec* ((x (list 'a 'b 'c)) + (y x)) + (set-cdr! x 4) + x)) + (list + '(store ((lx-x (cons 'a 4)) + (lx-y (cons 'a 4))) + (values (cons 'a 4))))) + + (make-r6test '(store () + (letrec* ((x (list 'a 'b 'c)) + (y x)) + (set-cdr! x 4) + (eqv? x y))) + (list + '(store ((lx-x (cons 'a 4)) + (lx-y (cons 'a 4))) + (values #t)))) + + (make-r6test '(store () + (letrec* ((x (list 'a 'b 'c)) + (y x)) + (set-cdr! x 4) + y)) + (list + '(store ((lx-x (cons 'a 4)) + (lx-y (cons 'a 4))) + (values (cons 'a 4))))) + + ; ---- + ; 6.4 + (make-r6test/v '(apply + (list 3 4)) 7) + + (make-r6test + '(store () + (letrec* ([compose + (lambda (f g) + (lambda args + (f (apply g args))))] + + [sqrt (lambda (x) (if (eqv? x 900) 30 #f))]) + ((compose sqrt *) 12 75))) + (list '(store ((lx-compose (lambda (f g) + (lambda args + (f (apply g args))))) + (lx-sqrt (lambda (x) (if (eqv? x 900) 30 #f)))) + (values 30)))))) + + (define (conv-base base vec) + (let loop ([i (vector-length vec)] + [acc 0]) + (cond + [(zero? i) acc] + [else (loop (- i 1) + (+ acc (* (expt base (- i 1)) + (vector-ref vec (- i 1)))))]))) + + (define (deconv-base base number) + (list->vector + (let loop ([i number]) + (cond + [(zero? i) '()] + [else (cons (modulo i base) + (loop (quotient i base)))])))) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; + ;; app tests + ;; + + (define app-tests + (list + (make-r6test/v '((lambda () 1)) 1) + (make-r6test/v '(((lambda (x) (lambda (x) x)) 1) 2) 2) + (make-r6test/v '(((lambda (x) (lambda (x dot y) x)) 1) 2) 2) + (make-r6test/v '(((lambda (x) (lambda (y dot x) (car x))) 1) 2 3) 3) + (make-r6test/e '((lambda (x y) x) 1) "arity mismatch") + (make-r6test/v '(car ((lambda (x) (cons x null)) 3)) 3) + (make-r6test/v '((lambda (x) x) 3) 3) + (make-r6test/v '((lambda (x y) (- x y)) 6 5) 1) + (make-r6test/e '((lambda () (+ x y z)) 3 4 5) + "arity mismatch") + (make-r6test/v '((lambda (x y z) (+ x y z)) 3 4 5) 12) + (make-r6test/v '((lambda (x y) (+ x y)) (+ 1 2) (+ 3 4)) 10) + (make-r6test/v '((lambda (x1 x2 dot y) (car y)) 1 2 3 4) 3) + (make-r6test/v '((lambda (x dot y) (car y)) 1 2 3 4) 2) + (make-r6test/v '((lambda (x dot y) x) 1) 1) + (make-r6test/e '((lambda (x y dot z) x) 1) + "arity mismatch") + (make-r6test/v '((lambda args (car (cdr args))) 1 2 3 4 5 6) 2) + (make-r6test/v '((lambda args (eqv? args args)) 1 2) #t) + (make-r6test/v '((lambda args ((lambda (y) args) (begin (set! args 50) 123)))) 50) + (make-r6test '(store () ((lambda args ((lambda (y) args) (set! args 50))))) + (list '(unknown "unspecified result"))) + (make-r6test/v '(if ((lambda (x) x) 74) ((lambda () 6)) (6 54)) 6) + (make-r6test/e '(1 1) "can't call non-procedure") + (make-r6test/e '(if ((lambda (x) x) #f) ((lambda () 6)) (6 54)) + "can't call non-procedure") + + (make-r6test '(store () (- 1)) + (list '(store () (values -1)))) + + (make-r6test '(store () (- (- 1))) + (list '(store () (values 1)))) + + (make-r6test '(store ((x 1)) (begin (set! x (begin (set! x (- x)) (- x))) x)) + (list '(store ((x 1)) (values 1)))) + + (make-r6test '(store ((x 1)) + ((lambda (p q) x) + (begin (set! x (- x)) 1) + (begin (set! x (- x)) 1))) + (list '(store ((x 1)) + (values 1)))) + + (make-r6test '(store ((x 1)) + ((lambda (p q) 1) + (begin (set! x 5) 1) + (begin (set! x 6) 2))) + (list '(store ((x 5)) (values 1)) + '(store ((x 6)) (values 1)))) + + (make-r6test/v '(call/cc + (lambda (k) + (with-exception-handler + (lambda (e) (k e)) + (lambda () (apply (lambda (x y) x) 1 null))))) + '(make-cond "arity mismatch")) + + (make-r6test/v '((lambda (x) ((lambda (y) x) (begin (set! x 5) 'whatever))) 3) 5) + (make-r6test '(store () + (((lambda (a b ret) ((lambda (x y) ret) (begin (set! ret a) #f) + (begin (set! ret b) #t))) + (lambda () 1) + (lambda () 3) + 5))) + '((store () (values 1)) + (store () (values 3)))) + + (make-r6test/v (let ([Y '(lambda (le) + ((lambda (f) (f f)) + (lambda (f) + (le (lambda (z) ((f f) z))))))]) + `((,Y + (lambda (length) + (lambda (l) + (if (null? l) + 0 + (+ (length (cdr l)) 1))))) + (cons 1 null))) + 1) + (make-r6test/v '((lambda (x y) (+ x y)) ((lambda (x) x) 3) ((lambda (x) x) 4)) + 7) + (make-r6test/v '((lambda (x) ((lambda (a b) x) (begin (set! x (- x)) 'x) + (begin (set! x (- x)) 'y))) + 1) + 1) + + (make-r6test/v '((lambda (x) (begin (set! x 5) (set! x 4) (set! x 3) x)) 0) 3) + (make-r6test/v '((lambda (x y) (x y)) + 0) 0) + (make-r6test/v '(apply + (cons 1 (cons 2 null))) 3) + (make-r6test '(store () + ((lambda (x) (set-cdr! x x) (apply + x)) + (cons 1 #f))) + (list '(uncaught-exception (make-cond "apply called on circular list")))) + + (make-r6test '(store () + ((lambda (x) + (set-cdr! (cdr x) x) + (apply + x)) + (cons 1 (cons 2 #f)))) + (list '(uncaught-exception (make-cond "apply called on circular list")))) + + ;; app + (make-r6test/v '((lambda args (apply + args)) 1 2 3 4) 10) + (make-r6test/v '((lambda (f) (eqv? (f 1) (f 1))) (lambda args (car args))) #t) + (make-r6test '(store () + (letrec* ((length + (lambda (l) + (if (null? l) + 0 + (+ 1 (length (cdr l))))))) + (length (list 1 2 3)))) + (list '(store ((lx-length + (lambda (l) + (if (null? l) + 0 + (+ 1 (lx-length (cdr l))))))) + (values 3)))) + (make-r6test '(store () ((lambda (x) + (set! x (x + (begin (set! x +) 4) + (begin (set! x *) 2))) + x) + /)) + (list '(store () (values 2)) + '(store () (values 6)) + '(store () (values 8)))) + + (make-r6test '(store () ((lambda (x) + (set! x (x + (begin (set! x +) 12) + (begin (set! x *) 2) + (begin (set! x -) 2))) + x) + /)) + (list '(store () (values 3)) + '(store () (values 16)) + '(store () (values 8)) + '(store () (values 48)))) + + (make-r6test '(store () + ((lambda (x) + (set! x (x (begin (set! x *) 2))) + x) + /)) + (list '(store () (values 2)) + '(store () (values 1/2)))) + + ;; test non-determinism in spec (a single application can go two different ways + ;; at two different times) + (make-r6test '(store () + (letrec ((x null) + (twice (lambda (f) (f) (f)))) + (twice + (lambda () + ((lambda (p q) 1) + (begin (set! x (cons 1 x)) 'foo) + (begin (set! x (cons 2 x)) 'bar)))))) + (list + '(store ((lx-x (cons 1 (cons 2 (cons 1 (cons 2 null))))) + (lx-twice (lambda (f) (f) (f)))) + (values 1)) + '(store ((lx-x (cons 2 (cons 1 (cons 1 (cons 2 null))))) + (lx-twice (lambda (f) (f) (f)))) + (values 1)) + '(store ((lx-x (cons 1 (cons 2 (cons 2 (cons 1 null))))) + (lx-twice (lambda (f) (f) (f)))) + (values 1)) + '(store ((lx-x (cons 2 (cons 1 (cons 2 (cons 1 null))))) + (lx-twice (lambda (f) (f) (f)))) + (values 1)))) + + (make-r6test/v '(condition? (make-cond "xyz")) #t) + (make-r6test/v '(condition? 1) #f) + (make-r6test/v '(procedure? + (call/cc + (lambda (k) + (with-exception-handler k (lambda () (car 'x)))))) + #f) + (make-r6test/v '(condition? + (call/cc + (lambda (k) + (with-exception-handler k (lambda () (car 'x)))))) + #t) + + ;; test capture avoiding substitution + (make-r6test '(store () + (letrec ((x 1)) + (((lambda (f) (lambda (x) (+ x (f)))) + (lambda () x)) + 2))) + (list '(store ((lx-x 1)) (values 3)))) + + (make-r6test '(store () + (((lambda (x1) (lambda (x) x)) + 3) + 4)) + (list '(store () (values 4)))) + (make-r6test '(store () + (((lambda (x) + (lambda args (car args))) + 1) + 2)) + (list '(store () (values 2)))) + + (make-r6test '(store () + (letrec ((x 1)) + (((lambda (f) (lambda (y dot x) (f))) + (lambda () x)) + 2))) + (list '(store ((lx-x 1)) (values 1)))) + + (make-r6test/v '((lambda (x y dot z) (set! z (cons x z)) (set! z (cons y z)) (apply + z)) + 1 2 3 4) + '10) + + (make-r6test '(store () + (letrec ((g (lambda (y) y)) + (f (lambda (x) (g 1)))) + (((lambda (x) (lambda (g) (g x))) f) + (lambda (x) 17)))) + (list '(store ((lx-g (lambda (y) y)) + (lx-f (lambda (x) (lx-g 1)))) + (values 17)))))) + + (define mv-tests + (list + (make-r6test + '(store () ((lambda (x) x) (values (lambda (y) y)))) + (list '(store () (values (lambda (y) y))))) + (make-r6test + '(store () (call-with-values (lambda () (lambda (y) y)) (lambda (x) x))) + (list '(store () (values (lambda (y) y))))) + (make-r6test + '(store () (call-with-values + (lambda () + (call-with-values + (lambda () ((lambda (z) z) (lambda (q) q))) + (lambda (y) y))) + (lambda (x) x))) + (list '(store () (values (lambda (q) q))))) + (make-r6test + '(store () (call-with-values + (lambda () + (call-with-values (lambda () (values (lambda (p) p))) + (((lambda (z) z) (lambda (a) (a a))) (lambda (m) m)))) + (call-with-values (lambda () (values (lambda (q) q))) (lambda (x) (lambda (y) x))))) + (list '(store () (values (lambda (q) q))))) + + + (make-r6test + '(store () ((lambda (x) x) call-with-values)) + (list '(store () (values call-with-values)))) + (make-r6test + '(store () (values)) + (list '(store () (values)))) + (make-r6test + '(store () (values (lambda (x) x))) + (list '(store () (values (lambda (x) x))))) + (make-r6test + '(store () (values (lambda (x) x) (lambda (q) q))) + (list '(store () (values (lambda (x) x) (lambda (q) q))))) + + (make-r6test + '(store () (call-with-values (values values) (lambda () (lambda (x) x)))) + (list '(store () (values (lambda (x) x))))) + (make-r6test + '(store () ((lambda (x) x) (values (lambda (y) y)))) + (list '(store () (values (lambda (y) y))))) + (make-r6test + '(store () (call-with-values (lambda () (lambda (y) y)) (lambda (x) x))) + (list '(store () (values (lambda (y) y))))) + + (make-r6test + '(store () + (call-with-values + (lambda () + (call-with-values + (lambda () + ((lambda (z) z) (lambda (q) q))) + (lambda (y) y))) + (lambda (x) x))) + (list '(store () (values (lambda (q) q))))) + + (make-r6test + '(store () + (call-with-values + (lambda () + (call-with-values (lambda () + (values (lambda (p) p))) + (((lambda (x) x) (lambda (x) (x x))) (lambda (m) m)))) + (call-with-values (lambda () (values (lambda (q) q))) + (lambda (x) (lambda (y) x))))) + (list '(store () (values (lambda (q) q))))) + + (make-r6test + '(store () (call-with-values (lambda () (values values values)) call-with-values)) + (list '(store () (values)))) + + (make-r6test + '(store () ((lambda (x y) x) (values (lambda (z) z) (lambda (q) q)))) + (list '(unknown "context expected one value, received 2"))) + + (make-r6test + '(store () (begin (if #t 1 2) 3)) + (list '(store () (values 3)))) + + + (make-r6test + '(store () ((if (values 1 2 3 4 5 6 7 8 9 10) 11 12))) + (list '(unknown "context expected one value, received 10"))) + + + (make-r6test + '(store () (if (begin 1 2) 1 2)) + (list '(store () (values 1)))) + + (make-r6test + '(store () ((lambda (x) (begin (set! x (begin 1 2)) x)) 1)) + (list '(store () (values 2)))) + + (make-r6test/v '(call/cc (lambda (k) (cons 1 (cons 2 (cons 3 (k 5)))))) 5) + (make-r6test/v '(call-with-values (lambda () (call/cc (lambda (k) (k)))) +) 0) + (make-r6test/v '(call-with-values (lambda () (call/cc (lambda (k) (k 1 2)))) +) 3) + (make-r6test/v '((call/cc values) values) 'values) + (make-r6test '(store () + (letrec ((x 0) + (f + (lambda () + (set! x (+ x 1)) + (values x x)))) + (call-with-values f (lambda (x y) x)) + (call-with-values f (lambda (x y) x)))) + (list + '(store ((lx-x 2) + (lx-f (lambda () + (set! lx-x (+ lx-x 1)) + (values lx-x lx-x)))) + (values 2)))) + (make-r6test/v '((lambda (x) (call-with-values x (lambda (x y) x))) + (lambda () (values (+ 1 2) 2))) + 3) + + (make-r6test/v '((if #t call-with-values +) (lambda () (+ 1 1)) (lambda (x) x)) + 2) + + (make-r6test/v '(call-with-values (lambda () (values (+ 1 2) (+ 2 3))) +) 8) + (make-r6test/v '(call-with-values * +) 1) + (make-r6test/v '(call-with-values (lambda () (apply values (cons 1 (cons 2 null)))) +) 3) + (make-r6test/v '(call-with-values (lambda () 1) +) 1) + + (make-r6test/e + '(call-with-values (lambda () + ((lambda (f) + (f ((lambda (id) id) (lambda (x) (x x))) + (lambda (x y) x))) + values)) + (lambda (a b) (a b))) + "arity mismatch") + + (make-r6test/v '((lambda (x) x) (values 1)) 1) + (make-r6test '(store () (values 1 2)) + (list '(store () (values 1 2)))) + (make-r6test '(store () (begin ((lambda (x) (values x x x)) 1) 1)) + (list '(store () (values 1)))) + (make-r6test '(store () ((lambda (x) (values x x x)) 1)) + (list '(store () (values 1 1 1)))) + + (make-r6test/v '(begin (values) 1) 1) + (make-r6test/v '(+ 1 (begin (values 1 2 3) 1)) 2))) + + (define dw-tests + (list + + ;; an infinite loop that produces a finite (circular) reduction graph + (make-r6test + '(store () + ((lambda (x) ((call/cc call/cc) x)) (call/cc call/cc))) + (list)) + + ;; next examples is one a continuation example that mz gets wrong + (make-r6test + '(store () + ((lambda (count) + ((lambda (first-time? k) + (if first-time? + (begin + (set! first-time? #f) + (set! count (+ count 1)) + (k values)) + 1234)) + #t + (call/cc values)) + count) + 0)) + (list '(store () (values 2)))) + + (make-r6test + '(store ([x 2]) x) + (list '(store ((x 2)) (values 2)))) + (make-r6test + '(store ([x 2]) (begin (set! x (+ x 1)) x)) + (list '(store ((x 3)) (values 3)))) + + (make-r6test + '(store () (begin ((lambda (x) (+ x x)) 1) 2)) + (list '(store () (values 2)))) + + (make-r6test + '(store () (+ (call/cc (lambda (k) (+ (k 1) 1))) 1)) + (list '(store () (values 2)))) + (make-r6test + '(store () ((call/cc (lambda (x) x)) (lambda (y) 1))) + (list '(store () (values 1)))) + + (make-r6test + '(store ((x 0)) + (begin + (dynamic-wind (lambda () (set! x 1)) + (lambda () (begin (set! x 2) 'whatever)) + (lambda () (set! x 3))) + x)) + (list '(store ((x 3)) (values 3)))) + + + (make-r6test + '(store ((x 0)) (dynamic-wind (lambda () (set! x (+ x 1))) + (lambda () (begin (set! x (+ x 1)) x)) + (lambda () (set! x (+ x 1))))) + (list '(store ((x 3)) (values 2)))) + + ;; dynamic wind and multiple values + (make-r6test '(store () (dynamic-wind values (lambda () (values 1 2)) values)) + (list '(store () (values 1 2)))) + + ;; dynamic-wind given non-lambda procedure values + (make-r6test '(store () (dynamic-wind values values values)) + (list '(store () (values)))) + (make-r6test '(store () (dynamic-wind values (lambda x x) values)) + (list '(store () (values null)))) + + + (make-r6test/e '(dynamic-wind 1 1 1) "dynamic-wind expects procs") + (make-r6test/e '(dynamic-wind (lambda () (car 'x)) 1 1) "dynamic-wind expects procs") + + ;; make sure that dynamic wind signals non-proc errors directly + ;; instead of calling procedures + (make-r6test/e '(dynamic-wind (lambda () (car 'x)) 1 2) + "dynamic-wind expects procs") + (make-r6test/e '(dynamic-wind (lambda () (car 1)) (lambda (x) x) (lambda (y) y)) + "can't take car of non-pair") + + (make-r6test/e '(dynamic-wind (lambda () (car 1)) (lambda (x dot y) x) (lambda () 1)) + "can't take car of non-pair") + (make-r6test/v '(dynamic-wind + (lambda y 2) *) + 2) + (make-r6test/v '(dynamic-wind values list (lambda y y)) + 'null) + + + (make-r6test ; "in thunk isn't really in" + '(store ((n 0)) + + (begin + (call/cc + (lambda (k) + (dynamic-wind + (lambda () (begin + (set! n (+ n 1)) + (k 11))) + + + (lambda () (set! n (+ n 1)))))) + n)) + (list '(store ((n 1)) (values 1)))) + + (make-r6test ; "out thunk is really out" + '(store ((n 0) + (do-jump? #t) + (k-out #f)) + + (begin + (call/cc + (lambda (k) + (dynamic-wind + (lambda () (set! n (+ n 1))) + + + (lambda () + (begin + (set! n (+ n 1)) + (call/cc (lambda (k) (set! k-out k)))))))) + (if do-jump? + (begin + (set! do-jump? #f) + (k-out 0)) + 11) + (set! k-out #f) + n)) + (list '(store ((n 2) (do-jump? #f) (k-out #f)) (values 2)))) + + (make-r6test ; "out thunk is really out during trimming" + '(store ((n 0) + (do-jump? #t) + (k-out #f)) + + (begin + (call/cc + (lambda (k) + (dynamic-wind + (lambda () (set! n (+ n 1))) + + + (lambda () + (begin + (set! n (+ n 1)) + (call/cc (lambda (k) (set! k-out k)))))))) + (if do-jump? + (begin + (set! do-jump? #f) + (k-out 0)) + 11) + (set! k-out #f) + n)) + (list '(store ((n 2) (do-jump? #f) (k-out #f)) (values 2)))) + + (make-r6test ; "jumping during the results of trimming, pre-thunk" + '(store ((pre-count 0) + (pre-jump? #f) + (after-jump? #t) + (grab? #t) + (the-k #f)) + + (begin + (dynamic-wind + (lambda () + (begin + (set! pre-count (+ pre-count 1)) + (if pre-jump? + (begin + (set! pre-jump? #f) + (set! after-jump? #f) + (the-k 999)) + 999))) + (lambda () + (if grab? + (call/cc + (lambda (k) + (begin + (set! grab? #f) + (set! the-k k) + 'ignoreme))) + 999)) + +) + (if after-jump? + (begin + (set! pre-jump? #t) + (the-k 999)) + 999) + (set! the-k #f) ;; just to make testing simpler + pre-count)) + (list '(store ((pre-count 3) (pre-jump? #f) (after-jump? #f) (grab? #f) (the-k #f)) (values 3)))) + + (make-r6test ; "jumping during the results of trimming, post-thunk" + '(store ((post-count 0) + (post-jump? #t) + (jump-main? #t) + (grab? #t) + (the-k #f)) + + (begin + (if grab? + (call/cc + (lambda (k) + (begin + (set! grab? #f) + (set! the-k k)))) + 999) + (dynamic-wind + + + (lambda () + (if jump-main? + (begin + (set! jump-main? #f) + (the-k 999)) + 999)) + (lambda () + (begin + (set! post-count (+ post-count 1)) + (if post-jump? + (begin + (set! post-jump? #f) + (the-k 999)) + 999)))) + (set! the-k #f) ;; just to make testing simpler + post-count)) + (list '(store ((post-count 2) (post-jump? #f) (jump-main? #f) (grab? #f) (the-k #f)) (values 2)))) + + (make-r6test ; "dynamic-wind gets a continuation" + '(store () (call/cc (lambda (k) (dynamic-wind + k +)))) + (list '(store () (values)))) + + #| + +to read the following tests, read the argument to conv-base from right to left +each corresponding set! should happen in that order. +in case of a test case failure, turn the number back into a sequence +of digits with deconv-base + +|# + + (make-r6test ; "hop out one level" + '(store ((x 0) + (one 0) + (two 0) + (three 0)) + + (begin + (set! one (lambda () (set! x (+ (* x 2) 0)))) + (set! two (lambda () (call/cc (lambda (k) k)))) + (set! three (lambda () (set! x (+ (* x 2) 1)))) + ((dynamic-wind one two three) + (lambda (y) x)))) + (list (let ([final-x (conv-base 2 #(1 0 1 0))]) + `(store ((x ,final-x) + (one (lambda () (set! x (+ (* x 2) 0)))) + (two (lambda () (call/cc (lambda (k) k)))) + (three (lambda () (set! x (+ (* x 2) 1))))) + (values ,final-x))))) + + (make-r6test ;"hop out two levels" + '(store ((x 0) + (one 0) + (two 0) + (three 0) + (four 0)) + + (begin + (set! one (lambda () (set! x (+ (* x 5) 1)))) + (set! two (lambda () (set! x (+ (* x 5) 2)))) + (set! three (lambda () (set! x (+ (* x 5) 3)))) + (set! four (lambda () (set! x (+ (* x 5) 4)))) + ((dynamic-wind + one + (lambda () + (dynamic-wind + two + (lambda () (call/cc (lambda (k) k))) + three)) + four) + (lambda (y) x)))) + (list + (let ([final-x (conv-base 5 #(4 3 2 1 4 3 2 1))]) + `(store ((x ,final-x) + (one (lambda () (set! x (+ (* x 5) 1)))) + (two (lambda () (set! x (+ (* x 5) 2)))) + (three (lambda () (set! x (+ (* x 5) 3)))) + (four (lambda () (set! x (+ (* x 5) 4))))) + (values ,final-x))))) + + (make-r6test ; "don't duplicate tail" + '(store ((x 0) + (one 0) + (two 0) + (three 0) + (four 0)) + + (begin + (set! one (lambda () (set! x (+ (* x 5) 1)))) + (set! two (lambda () (set! x (+ (* x 5) 2)))) + (set! three (lambda () (set! x (+ (* x 5) 3)))) + (set! four (lambda () (set! x (+ (* x 5) 4)))) + (dynamic-wind + one + (lambda () + ((dynamic-wind two + (lambda () (call/cc (lambda (k) k))) + three) + (lambda (y) x))) + four))) + (list `(store ((x ,(conv-base 5 #(4 3 2 3 2 1))) + (one (lambda () (set! x (+ (* x 5) 1)))) + (two (lambda () (set! x (+ (* x 5) 2)))) + (three (lambda () (set! x (+ (* x 5) 3)))) + (four (lambda () (set! x (+ (* x 5) 4))))) + + (values ,(conv-base 5 #(3 2 3 2 1)))))) + + (make-r6test ; "dont' duplicate tail, 2 deep" + '(store ((x 0) + (one 0) + (two 0) + (three 0) + (four 0) + (five 0) + (six 0)) + + (begin + (set! one (lambda () (set! x (+ (* x 7) 1)))) + (set! two (lambda () (set! x (+ (* x 7) 2)))) + (set! three (lambda () (set! x (+ (* x 7) 3)))) + (set! four (lambda () (set! x (+ (* x 7) 4)))) + (set! five (lambda () (set! x (+ (* x 7) 5)))) + (set! six (lambda () (set! x (+ (* x 7) 6)))) + (dynamic-wind + one + (lambda () + (dynamic-wind + two + (lambda () + ((dynamic-wind three + (lambda () (call/cc (lambda (k) k))) + four) + (lambda (y) x))) + five)) + six))) + + (list `(store ((x ,(conv-base 7 #(6 5 4 3 4 3 2 1))) + (one (lambda () (set! x (+ (* x 7) 1)))) + (two (lambda () (set! x (+ (* x 7) 2)))) + (three (lambda () (set! x (+ (* x 7) 3)))) + (four (lambda () (set! x (+ (* x 7) 4)))) + (five (lambda () (set! x (+ (* x 7) 5)))) + (six (lambda () (set! x (+ (* x 7) 6))))) + (values ,(conv-base 7 #(4 3 4 3 2 1)))))) + + (make-r6test ; "hop out and back into another one" + '(store ((x 0) + (one 0) + (two 0) + (three 0) + (four 0)) + + (begin + (set! one (lambda () (set! x (+ (* x 5) 1)))) + (set! two (lambda () (set! x (+ (* x 5) 2)))) + (set! three (lambda () (set! x (+ (* x 5) 3)))) + (set! four (lambda () (set! x (+ (* x 5) 4)))) + ((lambda (ok) + (dynamic-wind one + (lambda () (ok (lambda (y) x))) + two)) + (dynamic-wind three + (lambda () (call/cc (lambda (k) k))) + four)))) + (list `(store ((x ,(conv-base 5 #(2 1 4 3 2 1 4 3))) + (one (lambda () (set! x (+ (* x 5) 1)))) + (two (lambda () (set! x (+ (* x 5) 2)))) + (three (lambda () (set! x (+ (* x 5) 3)))) + (four (lambda () (set! x (+ (* x 5) 4))))) + (values ,(conv-base 5 #(1 4 3 2 1 4 3)))))) + + (make-r6test ; "hop out one level and back in two levels" + '(store ((x 0) + (one 0) + (two 0) + (three 0) + (four 0)) + + (begin + (set! one (lambda () (set! x (+ (* x 5) 1)))) + (set! two (lambda () (set! x (+ (* x 5) 2)))) + (set! three (lambda () (set! x (+ (* x 5) 3)))) + (set! four (lambda () (set! x (+ (* x 5) 4)))) + ((lambda (ok) + (dynamic-wind + one + (lambda () + (dynamic-wind + two + (lambda () (ok (lambda (y) x))) + three)) + four)) + (call/cc (lambda (k) k))))) + (list `(store ((x ,(conv-base 5 #(4 3 2 1 4 3 2 1))) + (one (lambda () (set! x (+ (* x 5) 1)))) + (two (lambda () (set! x (+ (* x 5) 2)))) + (three (lambda () (set! x (+ (* x 5) 3)))) + (four (lambda () (set! x (+ (* x 5) 4))))) + (values ,(conv-base 5 #(2 1 4 3 2 1)))))) + + (make-r6test ; "hop out two levels and back in two levels" + '(store ((x 0) + (one 0) + (two 0) + (three 0) + (four 0) + (five 0) + (six 0) + (seven 0) + (eight 0)) + + (begin + (set! one (lambda () (set! x (+ (* x 9) 1)))) + (set! two (lambda () (set! x (+ (* x 9) 2)))) + (set! three (lambda () (set! x (+ (* x 9) 3)))) + (set! four (lambda () (set! x (+ (* x 9) 4)))) + (set! five (lambda () (set! x (+ (* x 9) 5)))) + (set! six (lambda () (set! x (+ (* x 9) 6)))) + (set! seven (lambda () (set! x (+ (* x 9) 7)))) + (set! eight (lambda () (set! x (+ (* x 9) 8)))) + ((lambda (ok) + (dynamic-wind + one + (lambda () + (dynamic-wind + two + (lambda () (ok (lambda (y) x))) + three)) + four)) + (dynamic-wind + five + (lambda () + (dynamic-wind + six + (lambda () (call/cc (lambda (k) k))) + seven)) + eight)))) + (list `(store ((x ,(conv-base 9 #(4 3 2 1 8 7 6 5 4 3 2 1 8 7 6 5))) + (one (lambda () (set! x (+ (* x 9) 1)))) + (two (lambda () (set! x (+ (* x 9) 2)))) + (three (lambda () (set! x (+ (* x 9) 3)))) + (four (lambda () (set! x (+ (* x 9) 4)))) + (five (lambda () (set! x (+ (* x 9) 5)))) + (six (lambda () (set! x (+ (* x 9) 6)))) + (seven (lambda () (set! x (+ (* x 9) 7)))) + (eight (lambda () (set! x (+ (* x 9) 8))))) + (values ,(conv-base 9 #(2 1 8 7 6 5 4 3 2 1 8 7 6 5)))))))) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; + ;; exception tests + ;; + + (define exn-tests + (list + (make-r6test/v '(with-exception-handler (lambda (x) 1) (lambda () 2)) + 2) + (make-r6test/v '(with-exception-handler (lambda (x) 1) (lambda () (raise-continuable 2))) + 1) + (make-r6test/v '(with-exception-handler (lambda (x) x) (lambda () (raise-continuable 2))) + 2) + (make-r6test/v '(with-exception-handler values (lambda () (raise-continuable 2))) + 2) + (make-r6test '(store () (with-exception-handler (lambda (x) x) values)) + (list '(store () (values)))) + (make-r6test '(store () (with-exception-handler (lambda (x) (values x x)) (lambda () (raise-continuable 1)))) + (list '(store () (values 1 1)))) + (make-r6test/v '(+ 1 (with-exception-handler + (lambda (x) (+ 2 x)) + (lambda () (+ 3 (raise-continuable (+ 2 2)))))) + 10) + + (make-r6test '(store () + (call/cc + (lambda (k) + (with-exception-handler + (lambda (x) + (with-exception-handler + (lambda (y) (k (eqv? x y))) + (lambda () (car 1)))) + (lambda () (car 1)))))) + (list '(store () (values #t)) + '(store () (values #f)))) + + ;; nested handlers + (make-r6test/v '(with-exception-handler + (lambda (x) (+ 2 x)) + (lambda () + (with-exception-handler + (lambda (x) (+ 3 x)) + (lambda () (raise-continuable 1))))) + 4) + + (make-r6test/v '(with-exception-handler + (lambda (y) (with-exception-handler + (lambda (x) (+ 3 x y)) + (lambda () (raise-continuable 1)))) + (lambda () (raise-continuable 17))) + 21) + + (make-r6test/v '(with-exception-handler + values + (lambda () + (with-exception-handler + (lambda (y) (raise-continuable y)) + (lambda () (raise-continuable 1))))) + 1) + + (make-r6test '(store () + (with-exception-handler + (lambda (y) (raise-continuable y)) + (lambda () (raise 2)))) + (list '(uncaught-exception 2))) + + (make-r6test '(store () + (with-exception-handler + (lambda (y) (raise y)) + (lambda () (raise-continuable 2)))) + (list '(uncaught-exception 2))) + + (make-r6test '(store () (raise 2)) + (list '(uncaught-exception 2))) + + (make-r6test '(store () (raise-continuable 2)) + (list '(uncaught-exception 2))) + + (make-r6test '(store () (letrec* ([w 3] + [x (+ 1 (raise-continuable 2))] + [y 2]) + 1)) + (list '(uncaught-exception 2))) + + (make-r6test '(store () + (with-exception-handler + (lambda (x) x) + (lambda () (raise 2)))) + (list '(uncaught-exception (make-cond "handler returned")))) + + (make-r6test/e '((lambda (c e) + (with-exception-handler + (lambda (x) (if (eqv? c 0) + (set! c 1) + (if (eqv? c 1) + (begin (set! c 2) + (set! e x)) + (raise e)))) + (lambda () (raise 2)))) + 0 #f) + "handler returned") + + (make-r6test/v '(call/cc + (lambda (k) + (with-exception-handler + (lambda (x) (k (eqv? x 2))) + (lambda () (car 1))))) + #f) + + (make-r6test/v '((lambda (sx first-time?) + ((lambda (k) + (if first-time? + (begin + (set! first-time? #f) + (with-exception-handler + (lambda (x) (k values)) + (lambda () + (dynamic-wind + + + (lambda () (raise-continuable 1)) + (lambda () (set! sx (+ sx 1))))))) + sx)) + (call/cc values))) + 1 #t) + 2) + + (make-r6test/v '(with-exception-handler + (lambda (x) (begin (set! x (+ x 1)) x)) + (lambda () + (raise-continuable 1))) + 2) + + (make-r6test/v '(call/cc + (lambda (k) + (with-exception-handler + (lambda (x) (set! x (+ x 1)) (k x)) + (lambda () + (raise 1))))) + 2) + + (make-r6test/v '(with-exception-handler + (lambda (x) 2) + (lambda () + (dynamic-wind + + + (lambda () (raise-continuable 1)) + +))) + 2) + + (make-r6test '(store () + (with-exception-handler + (lambda (x) (raise (+ x 1))) + (lambda () + (dynamic-wind + + + (lambda () (raise 1)) + +)))) + (list '(uncaught-exception 2))) + + (make-r6test/v '(with-exception-handler + (lambda (x) x) + (lambda () + (dynamic-wind + + + (lambda () (raise-continuable 1)) + +))) + 1) + + (make-r6test/v '(with-exception-handler + (lambda (x) (begin (set! x 2) x)) + (lambda () + (dynamic-wind + + + (lambda () (raise-continuable 1)) + +))) + 2) + + (make-r6test/v '(with-exception-handler + (lambda (x) (with-exception-handler + (lambda (x) x) + (lambda () (raise-continuable 1)))) + (lambda () (raise-continuable 2))) + 1) + + (make-r6test/v '(with-exception-handler + (lambda (y) + (with-exception-handler + (lambda (x) y) + (lambda () + (raise-continuable 1)))) + (lambda () + (raise-continuable 2))) + 2) + + (make-r6test/v '(with-exception-handler + (lambda (y) + (with-exception-handler + (lambda (x) x) + (lambda () + (raise-continuable 1)))) + (lambda () + (raise-continuable 2))) + 1) + + (make-r6test/e '(with-exception-handler 2 +) + "with-exception-handler expects procs") + (make-r6test/e '(with-exception-handler + 2) + "with-exception-handler expects procs") + (make-r6test/e '(with-exception-handler 1 2) + "with-exception-handler expects procs") + (make-r6test/v '(with-exception-handler (lambda (wrench crowbar) wrench) (lambda () 1)) + 1) + (make-r6test/e '(with-exception-handler (lambda (wrench crowbar) wrench) (lambda () (raise 1))) + "arity mismatch") + (make-r6test/e '(with-exception-handler 3 (lambda () 1)) + "with-exception-handler expects procs") + + (make-r6test/v '((lambda (y) + (with-exception-handler + (lambda (x) (set! y (+ x y))) + (lambda () + (raise-continuable 1) + (raise-continuable 2) + y))) + 0) + 3) + + (make-r6test '(store () + (with-exception-handler + (lambda (x) (raise x)) + (lambda () (raise 1)))) + (list '(uncaught-exception 1))) + + ;; make sure that the inner handler is called twice, + ;; rather than the inner handler called once and the outer one called once. + (make-r6test/v '((lambda (o) + (with-exception-handler + (lambda (x) (set! o (* 3 o))) + (lambda () + (with-exception-handler + (lambda (x) (set! o (* 2 o)) x) + (lambda () + (raise-continuable 4) + (raise-continuable 4))))) + o) + 1) + 4) + + (make-r6test + '(store () + (letrec* ([k #f] + [ans #f] + [first-time? #t]) + (with-exception-handler + (lambda (x) + (begin + (call/cc (lambda (k2) (set! k k2))) + (set! x (+ x 1)) + (set! ans x))) + (lambda () + (raise-continuable 1))) + (if first-time? + (begin + (set! first-time? #f) + (k 1)) + (set! k #f)) + ans)) + (list '(store ((lx-k #f) (lx-ans 3) (lx-first-time? #f)) + (values 3)))) + + ;; test trimming function in the presence of exceptions when trimming handlers + ;; this test belongs in the dw section. have to move it there after changing its syntax + (make-r6test '(store () + (letrec* ((phase 0) + (k #f) + (l '())) + (with-exception-handler + (lambda (x) (if (eqv? phase 0) + (begin + (set! phase 1) + (call/cc (lambda (k2) (begin (set! k k2) 'whatever)))) + (if (eqv? phase 1) + (begin + (set! phase 2) + (k 1)) + 1234))) + (lambda () + (dynamic-wind + (lambda () (set! l (cons 1 l))) + (lambda () + (dynamic-wind + (lambda () (set! l (cons 2 l))) + (lambda () (raise-continuable 1)) + (lambda () (set! l (cons 3 l)))) + (dynamic-wind + (lambda () (set! l (cons 4 l))) + (lambda () (raise-continuable 1)) + (lambda () (set! l (cons 5 l))))) + (lambda () (set! l (cons 6 l)))))) + (set! k #f) + (apply values l))) + (list '(store ((lx-phase 2) + (lx-k #f) + (lx-l (cons 6 (cons 5 (cons 4 (cons 3 (cons 2 (cons 5 (cons 4 (cons 3 (cons 2 (cons 1 null)))))))))))) + (values 6 5 4 3 2 5 4 3 2 1)))))) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; + ;; letrec tests + ;; + + (define letrec-tests + (list + (make-r6test '(store () (letrec ([x 1] [y 2]) (+ x y))) + (list '(store ((lx-x 1) (lx-y 2)) (values 3)))) + (make-r6test '(store () + (letrec ([flip (lambda (x) (if x (flop #f) #t))] + [flop (lambda (x) (if x (flip x) x))]) + (begin0 (flop #t) + (set! flip 1) + (set! flop 2)))) + (list '(store ((lx-flip 1) + (lx-flop 2)) + (values #f)))) + (make-r6test '(store () (letrec ([x (begin (set! x 1) 2)]) x)) + (list '(store ((lx-x 2)) (values 2)) + '(uncaught-exception (make-cond "letrec variable touched")))) + (make-r6test '(store () + (letrec ([x (begin (set! y 2) 5)] + [y (begin (set! x 3) 7)]) + (* x y))) + (list '(store ((lx-x 5) (lx-y 7)) (values 35)) + '(uncaught-exception (make-cond "letrec variable touched")))) + (make-r6test '(store () (letrec ([x x]) x)) + (list '(uncaught-exception (make-cond "letrec variable touched")))) + (make-r6test '(store () (letrec ([x y] [y x]) x)) + (list '(uncaught-exception (make-cond "letrec variable touched")))) + (make-r6test '(store () (letrec ([x 1] [y x]) y)) + (list '(uncaught-exception (make-cond "letrec variable touched")))) + + (make-r6test '(store () (letrec ([x 1] [y 2]) (set! x 3) (set! y 4) (+ x y))) + (list '(store ((lx-x 3) (lx-y 4)) (values 7)))) + + (make-r6test '(store () (letrec* ([x 1] [y 2]) (+ x y))) + (list '(store ((lx-x 1) (lx-y 2)) (values 3)))) + (make-r6test '(store () + (letrec* ([flip (lambda (x) (if x (flop #f) #t))] + [flop (lambda (x) (if x (flip x) x))]) + (begin0 (flop #t) + (set! flip 1) + (set! flop 2)))) + (list '(store ((lx-flip 1) (lx-flop 2)) (values #f)))) + (make-r6test '(store () (letrec* ([x (begin (set! x 1) 2)]) x)) + (list '(store ((lx-x 2)) (values 2)) + '(uncaught-exception (make-cond "letrec variable touched")))) + (make-r6test '(store () + (letrec* ([x (begin (set! y 2) 5)] + [y (begin (set! x 3) 7)]) + (* x y))) + (list '(store ((lx-x 3) (lx-y 7)) (values 21)) + '(uncaught-exception (make-cond "letrec variable touched")))) + (make-r6test '(store () (letrec* ([x x]) x)) + (list '(uncaught-exception (make-cond "letrec variable touched")))) + (make-r6test '(store () (letrec* ([x y] [y x]) x)) + (list '(uncaught-exception (make-cond "letrec variable touched")))) + (make-r6test '(store () (letrec* ([x 1] [y x]) y)) + (list '(store ((lx-x 1) (lx-y 1)) (values 1)))) + + (make-r6test '(store () ((lambda (x y) (letrec ([q (begin (set! x 2) 23)]) (begin (set! y 3) (* x y)))) + 5 7)) + (list '(store ((lx-q 23)) (values 6)))) + (make-r6test '(store () ((lambda (x y) (letrec* ([q (begin (set! x 2) 23)]) (begin (set! y 3) (* x y)))) + 5 7)) + (list '(store ((lx-q 23)) (values 6)))) + (make-r6test '(store () (letrec* ([x 1] [y 2]) (set! x 3) (set! y 4) (+ x y))) + (list '(store ((lx-x 3) (lx-y 4)) (values 7)))) + + + (make-r6test '(store () + (letrec* ([k (call/cc (lambda (x) x))]) + (k (lambda (x) x)) + (k 2))) + (list '(uncaught-exception (make-cond "reinvoked continuation of letrec init")) + '(store ((lx-k (lambda (x) x))) (values 2)))) + (make-r6test '(store () + (letrec ([k (call/cc (lambda (x) x))]) + (k (lambda (x) x)) + (k 2))) + (list '(uncaught-exception (make-cond "reinvoked continuation of letrec init")) + '(store ((lx-k (lambda (x2) x2))) (values 2)))) + + (make-r6test '(store () + ((lambda (flag) + (letrec* ([k + ((lambda (k) + (if flag + 'nothing-doing + (car 'not-a-pair)) + k) + (call/cc (lambda (x) x)))]) + (set! flag #f) + (k (lambda (x) x)) + (k 2))) + #t)) + (list '(uncaught-exception (make-cond "can't take car of non-pair")))) + (make-r6test '(store () + ((lambda (flag) + (letrec ([k + ((lambda (k) + (if flag + 'nothing-doing + (car 'not-a-pair)) + k) + (call/cc (lambda (x) x)))]) + (set! flag #f) + (k (lambda (x) x)) + (k 2))) + #t)) + (list '(uncaught-exception (make-cond "can't take car of non-pair")))) + + + (make-r6test '(store () + ((lambda (flag) + (letrec ([k (call/cc (lambda (x) x))] + [x (if flag + 'nothing-doing + (car 'not-a-pair))]) + (set! flag #f) + (k (lambda (x) x)) + (k 2))) + #t)) + (list '(uncaught-exception (make-cond "reinvoked continuation of letrec init")) + '(uncaught-exception (make-cond "can't take car of non-pair")) + '(store ((lx-k (lambda (x2) x2)) (lx-x 'nothing-doing)) (values 2)))) + + (make-r6test '(store () + ((lambda (flag) + (letrec* ([k (call/cc (lambda (x) x))] + [x (if flag + 'nothing-doing + (car 'not-a-pair))]) + (set! flag #f) + (k (lambda (x) x)) + (k 2))) + #t)) + (list '(uncaught-exception (make-cond "reinvoked continuation of letrec init")) + '(uncaught-exception (make-cond "can't take car of non-pair")))) + + (make-r6test '(store () + (letrec* ([x (values 1 2)]) + x)) + (list '(unknown "context expected one value, received 2"))) + (make-r6test '(store () + (letrec ([x (values 1 2)]) + x)) + (list '(unknown "context expected one value, received 2"))))) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; + ;; testing functions + ;; + + + (define-syntax (test-fn stx) + (syntax-case stx () + [(_ test-case expected) + (with-syntax ([line (syntax-line stx)]) + (syntax (test-fn/proc (λ () test-case) expected line)))])) + + (define (test-fn/proc tc expected line) + (let ([got (tc)]) + (unless (equal? got expected) + (set! failed-tests (+ failed-tests 1)) + (fprintf (current-error-port) + "line ~s failed\nexpected ~s\n got ~s\n" + line + expected + got)))) + + + (define (test-fns) + (begin + (test-fn (term (Var-set!d? (x (set! x 1)))) #t) + (test-fn (term (Var-set!d? (x (set! y 1)))) #f) + (test-fn (term (Var-set!d? (x (lambda (x) (set! x 2))))) #f) + (test-fn (term (Var-set!d? (x (lambda (z dot x) (set! x 2))))) #f) + (test-fn (term (Var-set!d? (x (lambda (x dot z) (set! x 2))))) #f) + (test-fn (term (Var-set!d? (x (lambda (y) (set! x 2))))) #t) + (test-fn (term (Var-set!d? (x + (if (begin (set! x 2)) + 1 + 2)))) + #t) + (test-fn (term (Var-set!d? (x (begin0 (begin (begin0 1 2) 3) 4)))) + #f) + (test-fn (term (Var-set!d? (x (dw x1 1 2 3)))) #f) + (test-fn (term (Var-set!d? (y (throw x ((set! z x)))))) #f))) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; + ;; all of the tests + ;; + + (define the-sets + (list (list "app" app-tests) + (list "exn" exn-tests) + (list "dw" dw-tests) + (list "eqv" eqv-tests) + (list "r5" r5-tests) + (list "mv" mv-tests) + (list "letrec" letrec-tests) + (list "unspec" assignment-results-tests) + (list "quote" quote-tests) + (list "arith" arithmetic-tests) + (list "basic" basic-form-tests) + (list "pair" pair-tests) + (list "err" err-tests))) + + (define the-tests (apply append (map cadr the-sets))) + + (define main + (opt-lambda ([verbose? #f]) + (time + (let () + (define first? #t) + (define (run-a-set name set) + (unless first? + (if verbose? + (printf "\n\n") + (printf "\n"))) + (if verbose? + (printf "~a\n~a tests\n\n" + (apply string (build-list 60 (λ (i) #\-))) + name) + (begin (printf "~a tests " name) + (flush-output))) + (set! first? #f) + (for-each (λ (x) (run-a-test x verbose?)) set)) + + (set! failed-tests 0) + (set! verified-terms 0) + (test-fns) + (for-each (λ (set) (apply run-a-set set)) the-sets) + (unless verbose? (printf "\n")) + + (if (= 0 failed-tests) + (printf "~a tests, all passed\n" test-count) + (fprintf (current-error-port) "~a tests, ~a tests failed\n" test-count failed-tests)) + (printf "verified that ~a terms are p*\n" verified-terms))) + (when verbose? + (collect-garbage) (collect-garbage) (collect-garbage) + (printf "mem ~s\n" (current-memory-use)) + (let ([v (make-vector 10)]) + (vector-set-performance-stats! v) + (printf "ht searches ~a\nslots searched ~a\n" (vector-ref v 8) (vector-ref v 9)))))) + + (provide main + the-tests + + ;; the 'test' and the 'expected' are not compared with equal?. + ;; instead, the result of running the test is first simplified + ;; by substituting all of the variables with a colon in their + ;; names thru the term, and then the results from the test are + ;; compared with equal? to the elements of `expected' + (struct r6test (test ;; p (from the r6 grammar) [the test] + expected)))) ;; (list-of p) + diff --git a/collects/redex/examples/r6rs/r6rs.ss b/collects/redex/examples/r6rs/r6rs.ss new file mode 100644 index 0000000000..f51aba515a --- /dev/null +++ b/collects/redex/examples/r6rs/r6rs.ss @@ -0,0 +1,979 @@ +(module r6rs mzscheme + (require redex/reduction-semantics + (lib "plt-match.ss")) + + (provide lang + reductions + r6rs-subst-one + r6rs-subst-many + Var-set!d?) + + (provide Arithmetic + Basic--syntactic--forms + Cons + Eqv + Procedure--application + Apply + Call-cc--and--dynamic-wind + Exceptions + Multiple--values--and--call-with-values + Quote + Letrec + Underspecification + observable) + + (define-syntax (metafunction-type stx) + ;; these are only used in the figures + #''ignore) + + (define-language lang + (p* (store (sf ...) es) (uncaught-exception v) (unknown string)) + (a* (store (sf ...) (values v ...)) (uncaught-exception v) (unknown string)) + (r* (values r*v ...) exception unknown) + (r*v pair null 'sym sqv condition procedure) + (sf (x b) (pp (cons v v))) + (b v bh) + + (es 'seq 'sqv '() + (begin es es ...) (begin0 es es ...) (es es ...) + (if es es es) (set! x es) x + nonproc pproc (lambda f es es ...) + (side-condition + (letrec ([x_1 es] ...) es es ...) + (unique? (term (x_1 ...)))) + (side-condition + (letrec* ([x_1 es] ...) es es ...) + (unique? (term (x_1 ...)))) + + ;; intermediate states + (dw x e e e) + (throw x_1 (in-hole E x_1)) + unspecified + (handlers proc ... e) + (l! x es) + (reinit x)) + (f (side-condition + (x_1 ...) + (unique? (term (x_1 ...)))) + (side-condition + (x_1 x_2 ... dot x_3) + (unique? (term (x_1 x_2 ... x_3)))) + x) + + (s seq () sqv sym) + (seq (s s ...) (s s ... dot sqv) (s s ... dot sym)) + (sqv n #t #f) + + (p (store (sf ...) e)) + (e (begin e e ...) (begin0 e e ...) + (e e ...) (if e e e) + (set! x e) (handlers proc ... e) + x nonproc proc (dw x e e e) + unspecified + (side-condition + (letrec ([x_1 e] ...) e e ...) + (unique? (term (x_1 ...)))) + (side-condition + (letrec* ([x_1 e] ...) e e ...) + (unique? (term (x_1 ...)))) + (l! x e) + (reinit x)) + (v nonproc proc) + (nonproc pp null 'sym sqv (make-cond string)) + + (proc (lambda f e e ...) pproc (throw x_1 (in-hole E x_1))) + (pproc aproc proc1 proc2 list dynamic-wind apply values) + (proc1 null? pair? car cdr call/cc procedure? condition? raise*) + (proc2 cons consi set-car! set-cdr! eqv? call-with-values with-exception-handler) + (aproc + - / *) + (raise* raise-continuable raise) + + ; pair pointers, both mutable and immutable + (pp ip mp) + (ip (variable-prefix ip)) + (mp (variable-prefix mp)) + + (sym (variable-except dot)) + + (x (side-condition + (name var_none + (variable-except + dot ; the . in dotted pairs + lambda if loc set! ; core syntax names + quote + begin begin0 + + null ; non-function values + unspecified + pair closure + + error ; signal an error + + letrec letrec* l! reinit + + procedure? condition? + cons consi pair? null? car cdr ; list functions + set-car! set-cdr! list + + - * / ; math functions + call/cc throw dw dynamic-wind ; call/cc functions + values call-with-values ; values functions + apply eqv? + + with-exception-handler handlers + raise-continuable raise make-cond)) + (not (pp? (term var_none))))) + + (n number) + + (P (store (sf ...) E)) + (Po (store (sf ...) (in-hole E Fo))) + (P* (store (sf ...) (in-hole E E*)) (store (sf ...) hole)) + + (E (in-hole Fo E) (in-hole E* E) hole) + (E* F* (handlers proc ... hole) (dw x e hole e)) + + (F (in-hole Fo F) (in-hole F* F) hole) + (Fo (v ... hole v ...) (if hole e e) (set! x hole) (l! x hole)) + (F* (begin hole e e ...) (begin0 hole e e ...) + (begin0 (values v ...) hole e ...) (begin0 unspecified hole e ...) + (call-with-values (lambda () hole e ...) v)) + + ;; all of the one-layer contexts that "demand" their values, + ;; (maybe just "demand" it enough to ensure it is the right # of values) + ;; which requires unspecified to blow up. + (U (v ... hole v ...) (if hole e e) (set! x hole) (l! x hole) + (call-with-values (lambda () hole) v)) + + ;; everything except exception handler bodies + (PG (store (sf ...) G)) + (G (in-hole F (dw x e G e)) + F) + + ;; everything except dw + (H (in-hole F (handlers proc ... H)) F) + + (S hole (begin e e ... S es ...) (begin S es ...) + (begin0 e e ... S es ...) (begin0 S es ...) + (e ... S es ...) (if S es es) (if e S es) (if e e S) + (set! x S) (l! x S) + (lambda f S es ...) (lambda f e e ... S es ...) + (side-condition + (letrec ([x_1 e] ... [x_2 S] [x_3 es] ...) es es ...) + (unique? (term (x_1 ... x_2 x_3 ...)))) + (side-condition + (letrec ([x_1 e] ...) S es ...) + (unique? (term (x_1 ...)))) + (side-condition + (letrec ([x_1 e] ...) e e ... S es ...) + (unique? (term (x_1 ...)))) + (side-condition + (letrec* ([x_1 e] ... [x_2 S] [x_3 es] ...) es es ...) + (unique? (term (x_1 ... x_2 x_3 ...)))) + (side-condition + (letrec* ([x_1 e] ...) S es ...) + (unique? (term (x_1 ...)))) + (side-condition + (letrec* ([x_1 e] ...) e e ... S es ...) + (unique? (term (x_1 ...))))) + + (B E (in-hole E (begin e B)))) + + (define Basic--syntactic--forms + (reduction-relation + lang + ;; if + (--> (in-hole P_1 (if v_1 e_1 e_2)) (in-hole P_1 e_1) "6if3t" + (side-condition (not (eq? (term v_1) #f)))) + (--> (in-hole P_1 (if #f e_1 e_2)) + (in-hole P_1 e_2) + "6if3f") + + ;; begin + (--> (in-hole P_1 (begin (values v ...) e_1 e_2 ...)) + (in-hole P_1 (begin e_1 e_2 ...)) + "6beginc") + (--> (in-hole P_1 (begin e_1)) (in-hole P_1 e_1) "6begind") + + ;; begin0 + (--> (in-hole P_1 (begin0 (values v_1 ...) (values v_2 ...) e_2 ...)) + (in-hole P_1 (begin0 (values v_1 ...) e_2 ...)) + "6begin0n") + (--> (in-hole P_1 (begin0 e_1)) (in-hole P_1 e_1) "6begin01"))) + + (define Arithmetic + (reduction-relation + lang + ;; primitives for numbers + (--> (in-hole P_1 (+)) (in-hole P_1 0) "6+0") + (--> (in-hole P_1 (+ n_1 n_2 ...)) (in-hole P_1 ,(sum-of (term (n_1 n_2 ...)))) "6+") + + (--> (in-hole P_1 (- n_1)) (in-hole P_1 ,(- (term n_1))) "6u-") + (--> (in-hole P_1 (- n_1 n_2 n_3 ...)) + (in-hole P_1 ,(- (term n_1) (sum-of (term (n_2 n_3 ...))))) + "6-") + (--> (in-hole P_1 (-)) + (in-hole P_1 (raise (make-cond "arity mismatch"))) + "6-arity") + + (--> (in-hole P_1 (*)) (in-hole P_1 1) "6*1") + (--> (in-hole P_1 (* n_1 n_2 ...)) (in-hole P_1 ,(product-of (term (n_1 n_2 ...)))) "6*") + + (--> (in-hole P_1 (/ n_1)) (in-hole P_1 (/ 1 n_1)) + "6u/") + (--> (in-hole P_1 (/ n_1 n_2 n_3 ...)) + (in-hole P_1 ,(/ (term n_1) (product-of (term (n_2 n_3 ...))))) + "6/" + (side-condition (not (member 0 (term (n_2 n_3 ...)))))) + (--> (in-hole P_1 (/ n_1 n_2 ... 0 n_3 ...)) + (in-hole P_1 (raise (make-cond "divison by zero"))) + "6/0") + (--> (in-hole P_1 (/)) + (in-hole P_1 (raise (make-cond "arity mismatch"))) + "6/arity") + + (--> (in-hole P_1 (aproc v_1 ...)) + (in-hole P_1 (raise (make-cond "arith-op applied to non-number"))) + "6ae" + (side-condition + (ormap (lambda (v) (not (number? v))) + (term (v_1 ...))))))) + + (define (sum-of x) (apply + x)) + (define (product-of x) (apply * x)) + + (define Eqv + (reduction-relation + lang + + (--> (in-hole P_1 (eqv? v_1 v_1)) + (in-hole P_1 #t) + "6eqt" + (side-condition (not (proc? (term v_1)))) + (side-condition (not (condition? (term v_1))))) + + (--> (in-hole P_1 (eqv? v_1 v_2)) + (in-hole P_1 #f) + "6eqf" + (side-condition (not (equal? (term v_1) (term v_2)))) + (side-condition (or (not (proc? (term v_1))) + (not (proc? (term v_2))))) + (side-condition (or (not (condition? (term v_1))) + (not (condition? (term v_2)))))) + + (--> (in-hole P_1 (eqv? (make-cond string_1) (make-cond string_2))) + (in-hole P_1 #t) + "6eqct") + (--> (in-hole P_1 (eqv? (make-cond string_1) (make-cond string_2))) + (in-hole P_1 #f) + "6eqcf"))) + + (define Cons + (reduction-relation + lang + + (--> (in-hole P_1 (list v_1 v_2 ...)) + (in-hole P_1 (cons v_1 (list v_2 ...))) + "6listc") + (--> (in-hole P_1 (list)) + (in-hole P_1 null) + "6listn") + + (--> (store (sf_1 ...) (in-hole E_1 (cons v_1 v_2))) + (store (sf_1 ... (mp (cons v_1 v_2))) (in-hole E_1 mp)) + "6cons" + (fresh mp)) + + (--> (store (sf_1 ...) (in-hole E_1 (consi v_1 v_2))) + (store (sf_1 ... (ip (cons v_1 v_2))) (in-hole E_1 ip)) + "6consi" + (fresh ip)) + + ;; car + (--> (store (sf_1 ... (pp_i (cons v_1 v_2)) sf_2 ...) (in-hole E_1 (car pp_i))) + (store (sf_1 ... (pp_i (cons v_1 v_2)) sf_2 ...) (in-hole E_1 v_1)) + "6car") + + ;; cdr + (--> (store (sf_1 ... (pp_i (cons v_1 v_2)) sf_2 ...) (in-hole E_1 (cdr pp_i))) + (store (sf_1 ... (pp_i (cons v_1 v_2)) sf_2 ...) (in-hole E_1 v_2)) + "6cdr") + + (--> (store (sf_1 ... (mp_1 (cons v_1 v_2)) sf_2 ...) (in-hole E_1 (set-car! mp_1 v_3))) + (store (sf_1 ... (mp_1 (cons v_3 v_2)) sf_2 ...) (in-hole E_1 unspecified)) + "6setcar") + + (--> (store (sf_1 ... (mp_1 (cons v_1 v_2)) sf_2 ...) (in-hole E_1 (set-cdr! mp_1 v_3))) + (store (sf_1 ... (mp_1 (cons v_1 v_3)) sf_2 ...) (in-hole E_1 unspecified)) + "6setcdr") + + ;; null? + (--> (in-hole P_1 (null? null)) + (in-hole P_1 #t) + "6null?t") + (--> (in-hole P_1 (null? v_1)) + (in-hole P_1 #f) + "6null?f" + (side-condition (not (null-v? (term v_1))))) + + (--> (in-hole P_1 (pair? pp)) + (in-hole P_1 #t) + "6pair?t") + (--> (in-hole P_1 (pair? v_1)) + (in-hole P_1 #f) + "6pair?f" + (side-condition (not (pp? (term v_1))))) + + (--> (in-hole P_1 (car v_i)) + (in-hole P_1 (raise (make-cond "can't take car of non-pair"))) + "6care" + (side-condition (not (pp? (term v_i))))) + + (--> (in-hole P_1 (cdr v_i)) + (in-hole P_1 (raise (make-cond "can't take cdr of non-pair"))) + "6cdre" + (side-condition (not (pp? (term v_i))))) + + (--> (in-hole P_1 (set-car! v_1 v_2)) + (in-hole P_1 (raise (make-cond "can't set-car! on a non-pair or an immutable pair"))) + "6scare" + (side-condition (not (mp? (term v_1))))) + + (--> (in-hole P_1 (set-cdr! v_1 v_2)) + (in-hole P_1 (raise (make-cond "can't set-cdr! on a non-pair or an immutable pair"))) + "6scdre" + (side-condition (not (mp? (term v_1))))))) + + (define Procedure--application + (reduction-relation + lang + + (--> (in-hole P_1 (e_1 ... e_i e_i+1 ...)) + (in-hole P_1 ((lambda (x) (e_1 ... x e_i+1 ...)) e_i)) + "6mark" + (fresh (x lifted)) + (side-condition (not (v? (term e_i)))) + (side-condition + (ormap (lambda (e) (not (v? e))) (term (e_1 ... e_i+1 ...))))) + + (--> (store (sf_1 ...) (in-hole E_1 ((lambda (x_1 x_2 ..._1) e_1 e_2 ...) v_1 v_2 ..._1))) + (store (sf_1 ... (bp v_1)) + (in-hole E_1 + ((r6rs-subst-one (x_1 bp (lambda (x_2 ...) e_1 e_2 ...))) + v_2 ...))) + "6appN!" + (fresh bp) + (side-condition + (and (unique? (term (x_1 x_2 ...))) + (term (Var-set!d? (x_1 (lambda (x_2 ...) e_1 e_2 ...))))))) + + (--> (in-hole P_1 ((lambda (x_1 x_2 ..._1) e_1 e_2 ...) v_1 v_2 ..._1)) + (in-hole P_1 ((r6rs-subst-one (x_1 v_1 (lambda (x_2 ...) e_1 e_2 ...))) v_2 ...)) + "6appN" + (side-condition + (and (unique? (term (x_1 x_2 ...))) + (not (term (Var-set!d? (x_1 (lambda (x_2 ...) e_1 e_2 ...)))))))) + + (--> (in-hole P_1 ((lambda () e_1 e_2 ...))) + (in-hole P_1 (begin e_1 e_2 ...)) + "6app0") + + (--> (in-hole P_1 ((lambda (x_1 x_2 ..._1 dot x_r) e_1 e_2 ...) v_1 v_2 ..._1 v_3 ...)) + (in-hole P_1 ((lambda (x_1 x_2 ... x_r) e_1 e_2 ...) v_1 v_2 ... (list v_3 ...))) + "6μapp" + (side-condition (unique? (term (x_1 x_2 ... x_r))))) + + (--> (in-hole P_1 ((lambda x_1 e_1 e_2 ...) v_1 ...)) + (in-hole P_1 ((lambda (x_1) e_1 e_2 ...) (list v_1 ...))) + "6μapp1") + + ;; variable lookup + (--> (store (sf_1 ... (x_1 v_1) sf_2 ...) (in-hole E_1 x_1)) + (store (sf_1 ... (x_1 v_1) sf_2 ...) (in-hole E_1 v_1)) + "6var") + + ;; set! + (--> (store (sf_1 ... (x_1 v_1) sf_2 ...) (in-hole E_1 (set! x_1 v_2))) + (store (sf_1 ... (x_1 v_2) sf_2 ...) (in-hole E_1 unspecified)) + "6set") + + (--> (in-hole P_1 (procedure? proc)) (in-hole P_1 #t) "6proct") + (--> (in-hole P_1 (procedure? nonproc)) (in-hole P_1 #f) "6procf") + + ;; mu-lambda too few arguments case + (--> (in-hole P_1 ((lambda (x_1 ...) e_1 e_2 ...) v_1 ...)) + (in-hole P_1 (raise (make-cond "arity mismatch"))) + "6arity" + (side-condition + (not (= (length (term (x_1 ...))) + (length (term (v_1 ...))))))) + + (--> (in-hole P_1 ((lambda (x_1 x_2 ... dot x) e_1 e_2 ...) v_1 ...)) + (in-hole P_1 (raise (make-cond "arity mismatch"))) + "6μarity" + (side-condition + (< (length (term (v_1 ...))) + (length (term (x_1 x_2 ...)))))) + + (--> (in-hole P_1 (nonproc v ...)) + (in-hole P_1 (raise (make-cond "can't call non-procedure"))) + "6appe") + + (--> (in-hole P_1 (proc1 v_1 ...)) + (in-hole P_1 (raise (make-cond "arity mismatch"))) + "61arity" + (side-condition (not (= (length (term (v_1 ...))) 1)))) + (--> (in-hole P_1 (proc2 v_1 ...)) + (in-hole P_1 (raise (make-cond "arity mismatch"))) + "62arity" + (side-condition (not (= (length (term (v_1 ...))) 2)))))) + + (define Apply + (reduction-relation + lang + + (--> (in-hole P_1 (apply proc_1 v_1 ... null)) + (in-hole P_1 (proc_1 v_1 ...)) + "6applyf") + + (--> (store (sf_1 ... (pp_1 (cons v_2 v_3)) sf_2 ...) (in-hole E_1 (apply proc_1 v_1 ... pp_1))) + (store (sf_1 ... (pp_1 (cons v_2 v_3)) sf_2 ...) (in-hole E_1 (apply proc_1 v_1 ... v_2 v_3))) + "6applyc" + (side-condition (not (term (circular? (pp_1 v_3 (sf_1 ... (pp_1 (cons v_2 v_3)) sf_2 ...))))))) + + (--> (store (sf_1 ... (pp_1 (cons v_2 v_3)) sf_2 ...) (in-hole E_1 (apply proc_1 v_1 ... pp_1))) + (store (sf_1 ... (pp_1 (cons v_2 v_3)) sf_2 ...) (in-hole E_1 (raise (make-cond "apply called on circular list")))) + "6applyce" + (side-condition (term (circular? (pp_1 v_3 (sf_1 ... (pp_1 (cons v_2 v_3)) sf_2 ...)))))) + + (--> (in-hole P_1 (apply nonproc v ...)) + (in-hole P_1 (raise (make-cond "can't apply non-procedure"))) + "6applynf") + + (--> (in-hole P_1 (apply proc v_1 ... v_2)) + (in-hole P_1 (raise (make-cond "apply's last argument non-list"))) + "6applye" + (side-condition (not (list-v? (term v_2))))) + + (--> (in-hole P_1 (apply)) (in-hole P_1 (raise (make-cond "arity mismatch"))) "6apparity0") + (--> (in-hole P_1 (apply v)) (in-hole P_1 (raise (make-cond "arity mismatch"))) "6apparity1"))) + + ;; circular? : pp val store -> boolean + ;; returns #t if pp is reachable via val in the store + (metafunction-type circular? (pp val (sf ...))) + (define-metafunction lang + circular? : (pp v (sf ...)) -> any + [(circular? (pp_1 pp_2 (sf_1 ... (pp_2 (cons v_1 v_2)) sf_2 ...))) + #t + (side-condition (equal? (term pp_1) (term v_2)))] + [(circular? (pp_1 pp_2 (sf_1 ... (pp_2 (cons v_1 v_2)) sf_2 ...))) + (circular? (pp_1 v_2 (sf_1 ... (pp_2 (cons v_1 v_2)) sf_2 ...))) + (side-condition (not (equal? (term pp_1) (term v_2))))] + [(circular? (pp_1 v_1 (sf_1 ...))) + #f]) ;; otherwise + + ;; Var-set!d? : e -> boolean + (metafunction-type Var-set!d? (x e)) + (define-metafunction lang + Var-set!d? : (x e) -> any + [(Var-set!d? (x_1 (set! x_2 e_1))) + #t + (side-condition (equal? (term x_1) (term x_2)))] + [(Var-set!d? (x_1 (set! x_2 e_1))) + (Var-set!d? (x_1 e_1)) + (side-condition (not (equal? (term x_1) (term x_2))))] + [(Var-set!d? (x_1 (begin e_1 e_2 e_3 ...))) + ,(or (term (Var-set!d? (x_1 e_1))) + (term (Var-set!d? (x_1 (begin e_2 e_3 ...)))))] + [(Var-set!d? (x_1 (begin e_1))) + (Var-set!d? (x_1 e_1))] + [(Var-set!d? (x_1 (e_1 e_2 ...))) + (Var-set!d? (x_1 (begin e_1 e_2 ...)))] + [(Var-set!d? (x_1 (if e_1 e_2 e_3))) + ,(or (term (Var-set!d? (x_1 e_1))) + (term (Var-set!d? (x_1 e_2))) + (term (Var-set!d? (x_1 e_3))))] + [(Var-set!d? (x_1 (begin0 e_1 e_2 ...))) + (Var-set!d? (x_1 (begin e_1 e_2 ...)))] + + [(Var-set!d? (x_1 (lambda (x_2 ...) e_1 e_2 ...))) + (Var-set!d? (x_1 (begin e_1 e_2 ...))) + (side-condition (not (memq (term x_1) (term (x_2 ...)))))] + [(Var-set!d? (x_1 (lambda (x_2 ... dot x_3) e_1 e_2 ...))) + (Var-set!d? (x_1 (begin e_1 e_2 ...))) + (side-condition (not (memq (term x_1) (term (x_2 ... x_3)))))] + [(Var-set!d? (x_1 (lambda x_2 e_1 e_2 ...))) + (Var-set!d? (x_1 (begin e_1 e_2 ...))) + (side-condition (not (equal? (term x_1) (term x_2))))] + [(Var-set!d? (x_1 (letrec ([x_2 e_1] ...) e_2 e_3 ...))) + (Var-set!d? (x_1 (begin e_1 ... e_2 e_3 ...))) + (side-condition (not (memq (term x_1) (term (x_2 ...)))))] + [(Var-set!d? (x_1 (letrec* ([x_2 e_1] ...) e_2 e_3 ...))) + (Var-set!d? (x_1 (begin e_1 ... e_2 e_3 ...))) + (side-condition (not (memq (term x_1) (term (x_2 ...)))))] + [(Var-set!d? (x_1 (l! x_2 e_1))) + (Var-set!d? (x_1 (set! x_2 e_1)))] + [(Var-set!d? (x_1 (reinit x_2 e_1))) + (Var-set!d? (x_1 (set! x_2 e_1)))] + [(Var-set!d? (x_1 (dw x_2 e_1 e_2 e_3))) + ,(or (term (Var-set!d? (x_1 e_1))) + (term (Var-set!d? (x_1 e_2))) + (term (Var-set!d? (x_1 e_3))))] + [(Var-set!d? (x_1 any_1)) #f]) + + + (define Call-cc--and--dynamic-wind + (reduction-relation + lang + (--> (in-hole P_1 (dynamic-wind proc_1 proc_2 proc_3)) + (in-hole P_1 + (begin (proc_1) + (begin0 + (dw x (proc_1) (proc_2) (proc_3)) + (proc_3)))) + "6wind" + (fresh x)) + (--> (in-hole P_1 (dynamic-wind v_1 v_2 v_3)) + (in-hole P_1 (raise (make-cond "dynamic-wind expects procs"))) + "6winde" + (side-condition (or (not (proc? (term v_1))) + (not (proc? (term v_2))) + (not (proc? (term v_3)))))) + + (--> (in-hole P_1 (dynamic-wind v_1 ...)) + (in-hole P_1 (raise (make-cond "arity mismatch"))) + "6dwarity" + (side-condition (not (= (length (term (v_1 ...))) 3)))) + + (--> (in-hole P_1 (dw x e_1 (values v_1 ...) e_2)) + (in-hole P_1 (values v_1 ...)) + "6dwdone") + + (--> (store (sf_1 ...) (in-hole E_1 (call/cc v_1))) + (store (sf_1 ...) (in-hole E_1 (v_1 (throw x (in-hole E_1 x))))) + "6call/cc" + (fresh x)) + + (--> (store (sf_1 ...) (in-hole E_1 ((throw x_1 (in-hole E_2 x_1)) v_1 ...))) + (store (sf_1 ...) (in-hole (Trim (E_1 E_2)) (values v_1 ...))) + "6throw"))) + + (metafunction-type pRe (-> E E)) + (define-metafunction lang + pRe : E -> B + [(pRe (in-hole H_1 (dw x_1 e_1 E_1 e_2))) + (in-hole H_1 + (begin e_1 + (dw x_1 e_1 (pRe E_1) e_2)))] + [(pRe (in-hole H_1 hole)) H_1]) + + (metafunction-type poSt (-> E E)) + (define-metafunction lang + poSt : E -> E + [(poSt (in-hole E_1 (dw x_1 e_1 H_2 e_2))) + (in-hole (poSt E_1) (begin0 (dw x_1 e_1 hole e_2) e_2))] + [(poSt H_1) hole]) + + (metafunction-type Trim (-> E E E)) + (define-metafunction lang + Trim : (E E) -> B + [(Trim ((in-hole H_1 (dw x_1 e_1 E_1 e_2)) + (in-hole H_2 (dw x_1 e_3 E_2 e_4)))) + (in-hole H_2 (dw x_1 e_3 (Trim (E_1 E_2)) e_4))] + [(Trim ((in-hole E_1 hole) + (in-hole E_2 hole))) + (begin (in-hole (poSt E_1) 1) + (pRe E_2))]) + + (define Exceptions + (reduction-relation + lang + + (--> (in-hole PG (raise* v_1)) + (uncaught-exception v_1) + "6xunee") + + (--> (in-hole P (handlers (in-hole G (raise* v_1)))) + (uncaught-exception v_1) + "6xuneh") + + (--> (in-hole PG_1 (with-exception-handler proc_1 proc_2)) + (in-hole PG_1 (handlers proc_1 (proc_2))) + "6xwh1") + + (--> (in-hole P_1 (handlers proc_1 ... (in-hole G_1 (with-exception-handler proc_2 proc_3)))) + (in-hole P_1 (handlers proc_1 ... (in-hole G_1 (handlers proc_1 ... proc_2 (proc_3))))) + "6xwhn") + + (--> (in-hole P_1 (handlers proc_1 ... (in-hole G_1 (with-exception-handler v_1 v_2)))) + (in-hole P_1 (handlers proc_1 ... (in-hole G_1 (raise (make-cond "with-exception-handler expects procs"))))) + "6xwhne" + (side-condition (or (not (proc? (term v_1))) + (not (proc? (term v_2)))))) + + (--> (in-hole P_1 (handlers proc_1 ... proc_2 (in-hole G_1 (raise-continuable v_1)))) + (in-hole P_1 (handlers proc_1 ... proc_2 (in-hole G_1 (handlers proc_1 ... (proc_2 v_1))))) + "6xrc") + + (--> (in-hole P_1 (handlers + proc_1 ... proc_2 + (in-hole G_1 (raise v_1)))) + (in-hole P_1 (handlers + proc_1 ... proc_2 + (in-hole G_1 + (handlers proc_1 ... + (begin (proc_2 v_1) + (raise (make-cond "handler returned"))))))) + "6xr") + + (--> (in-hole P_1 (condition? (make-cond string))) + (in-hole P_1 #t) + "6ct") + + (--> (in-hole P_1 (condition? v_1)) + (in-hole P_1 #f) + "6cf" + (side-condition (not (condition? (term v_1))))) + + (--> (in-hole P_1 (handlers proc_1 ... (values v_1 ...))) + (in-hole P_1 (values v_1 ...)) + "6xdone") + + (--> (in-hole PG_1 (with-exception-handler v_1 v_2)) + (in-hole PG_1 (raise (make-cond "with-exception-handler expects procs"))) + "6weherr" + (side-condition (or (not (proc? (term v_1))) + (not (proc? (term v_2)))))))) + + (define Multiple--values--and--call-with-values + (reduction-relation + lang + ;; values promotion + (--> (in-hole P* v) + (in-hole P* (values v)) + "6promote") + + ;; values demotion + (--> (in-hole Po (values v)) + (in-hole Po v) + "6demote") + + ; resolving call-with-values statements + (--> (in-hole P_1 (call-with-values (lambda () (values v_2 ...)) v_1)) + (in-hole P_1 (v_1 v_2 ...)) + "6cwvd") + + (--> (in-hole P_1 (call-with-values v_1 v_2)) + (in-hole P_1 (call-with-values (lambda () (v_1)) v_2)) + "6cwvw" + (side-condition (not (lambda-null? (term v_1))))))) + + (define Letrec + (reduction-relation + lang + (--> (store (sf_1 ... (x_1 bh) sf_2 ...) (in-hole E_1 (l! x_1 v_2))) + (store (sf_1 ... (x_1 v_2) sf_2 ...) (in-hole E_1 unspecified)) + "6initdt") + (--> (store (sf_1 ... (x_1 v_1) sf_2 ...) (in-hole E_1 (l! x_1 v_2))) + (store (sf_1 ... (x_1 v_2) sf_2 ...) (in-hole E_1 unspecified)) + "6initv") + (--> (store (sf_1 ... (x_1 bh) sf_2 ...) (in-hole E_1 (set! x_1 v_1))) + (store (sf_1 ... (x_1 v_1) sf_2 ...) (in-hole E_1 unspecified)) + "6setdt") + (--> (store (sf_1 ... (x_1 bh) sf_2 ...) (in-hole E_1 (set! x_1 v_1))) + (store (sf_1 ... (x_1 bh) sf_2 ...) (in-hole E_1 (raise (make-cond "letrec variable touched")))) + "6setdte") + (--> (store (sf_1 ... (x_1 bh) sf_2 ...) (in-hole E_1 x_1)) + (store (sf_1 ... (x_1 bh) sf_2 ...) (in-hole E_1 (raise (make-cond "letrec variable touched")))) + "6dt") + + (--> (store (sf_1 ... (x_1 #f) sf_2 ...) (in-hole E_1 (reinit x_1))) + (store (sf_1 ... (x_1 #t) sf_2 ...) (in-hole E_1 'ignore)) + "6init") + (--> (store (sf_1 ... (x_1 b) sf_2 ...) (in-hole E_1 (reinit x_1))) + (store (sf_1 ... (x_1 b) sf_2 ...) (in-hole E_1 'ignore)) + "6reinit" + (side-condition (term b))) + (--> (store (sf_1 ... (x_1 b) sf_2 ...) (in-hole E_1 (reinit x_1))) + (store (sf_1 ... (x_1 b) sf_2 ...) (in-hole E_1 (raise (make-cond "reinvoked continuation of letrec init")))) + "6reinite" + (side-condition (term b))) + + (--> (store (sf_1 ...) (in-hole E_1 (letrec ([x_1 e_1] ...) e_2 e_3 ...))) + (store (sf_1 ... (lx bh) ... (ri #f) ...) + (in-hole E_1 + ((lambda (x_1 ...) + (l! lx x_1) ... + (r6rs-subst-many ((x_1 lx) ... e_2)) + (r6rs-subst-many ((x_1 lx) ... e_3)) ...) + (begin0 + (r6rs-subst-many ((x_1 lx) ... e_1)) + (reinit ri)) + ...))) + "6letrec" + (side-condition (unique? (term (x_1 ...)))) + (fresh ((lx ...) + (x_1 ...) + ,(map (λ (x) (string->symbol (format "lx-~a" x))) (term (x_1 ...))))) + (fresh ((ri ...) + (x_1 ...) + ,(map (λ (x) (string->symbol (format "ri-~a" x))) (term (x_1 ...)))))) + (--> (store (sf_1 ...) (in-hole E_1 (letrec* ([x_1 e_1] ...) e_2 e_3 ...))) + (store (sf_1 ... (lx bh) ... (ri #f) ...) + (in-hole E_1 + (r6rs-subst-many + ((x_1 lx) ... + (begin + (begin + (l! lx e_1) + (reinit ri)) + ... + e_2 + e_3 ...))))) + "6letrec*" + (fresh ((lx ...) + (x_1 ...) + ,(map (λ (x) (string->symbol (format "lx-~a" x))) (term (x_1 ...))))) + (fresh ((ri ...) + (x_1 ...) + ,(map (λ (x) (string->symbol (format "ri-~a" x))) (term (x_1 ...)))))))) + + (define Underspecification + (reduction-relation + lang + (--> (in-hole P (eqv? proc_1 proc_2)) + (unknown "equivalence of procedures") + "6ueqv") + (--> (in-hole Po (values v_1 ...)) + (unknown ,(format "context expected one value, received ~a" (length (term (v_1 ...))))) + "6uval" + (side-condition (not (= (length (term (v_1 ...))) 1)))) + (--> (in-hole P (in-hole U unspecified)) + (unknown "unspecified result") + "6udemand") + (--> (store (sf ...) unspecified) + (unknown "unspecified result") + "6udemandtl") + + (--> (in-hole P_1 (begin unspecified e_1 e_2 ...)) + (in-hole P_1 (begin e_1 e_2 ...)) + "6ubegin") + (--> (in-hole P_1 (handlers v ... unspecified)) + (in-hole P_1 unspecified) + "6uhandlers") + (--> (in-hole P_1 (dw x e_1 unspecified e_2)) + (in-hole P_1 unspecified) + "6udw") + (--> (in-hole P_1 (begin0 (values v_1 ...) unspecified e_1 ...)) + (in-hole P_1 (begin0 (values v_1 ...) e_1 ...)) + "6ubegin0") + (--> (in-hole P_1 (begin0 unspecified (values v_2 ...) e_2 ...)) + (in-hole P_1 (begin0 unspecified e_2 ...)) + "6ubegin0u") + (--> (in-hole P_1 (begin0 unspecified unspecified e_2 ...)) + (in-hole P_1 (begin0 unspecified e_2 ...)) + "6ubegin0uu"))) + + (define Quote + (reduction-relation + lang + (--> (store (sf_1 ...) (in-hole S_1 'sqv_1)) + (store (sf_1 ...) (in-hole S_1 sqv_1)) + "6sqv") + (--> (store (sf_1 ...) (in-hole S_1 '())) + (store (sf_1 ...) (in-hole S_1 null)) + "6eseq") + (--> (store (sf_1 ...) (in-hole S_1 'seq_1)) + (store (sf_1 ...) ((lambda (qp) (in-hole S_1 qp)) (Qtoc seq_1))) + "6qcons" + (fresh qp)) + (--> (store (sf_1 ...) (in-hole S_1 'seq_1)) + (store (sf_1 ...) ((lambda (qp) (in-hole S_1 qp)) (Qtoic seq_1))) + "6qconsi" + (fresh qp)))) + + (metafunction-type Qtoc (-> seq e)) + (define-metafunction lang + Qtoc : s -> e + [(Qtoc ()) null] + [(Qtoc (s_1 s_2 ...)) (cons (Qtoc s_1) (Qtoc (s_2 ...)))] + [(Qtoc (s_1 dot sqv_1)) (cons (Qtoc s_1) sqv_1)] + [(Qtoc (s_1 s_2 s_3 ... dot sqv_1)) (cons (Qtoc s_1) (Qtoc (s_2 s_3 ... dot sqv_1)))] + [(Qtoc (s_1 dot sym_1)) (cons (Qtoc s_1) 'sym_1)] + [(Qtoc (s_1 s_2 s_3 ... dot sym_1)) (cons (Qtoc s_1) (Qtoc (s_2 s_3 ... dot sym_1)))] + [(Qtoc sym_1) 'sym_1] + [(Qtoc sqv_1) sqv_1]) + + (metafunction-type Qtoic (-> s e)) + (define-metafunction lang + Qtoic : s -> e + [(Qtoic ()) null] + [(Qtoic (s_1 s_2 ...)) (consi (Qtoic s_1) (Qtoic (s_2 ...)))] + [(Qtoic (s_1 dot sqv_1)) (consi (Qtoic s_1) sqv_1)] + [(Qtoic (s_1 s_2 s_3 ... dot sqv_1)) (consi (Qtoic s_1) (Qtoic (s_2 s_3 ... dot sqv_1)))] + [(Qtoic (s_1 dot sym_1)) (consi (Qtoic s_1) 'sym_1)] + [(Qtoic (s_1 s_2 s_3 ... dot sym_1)) (consi (Qtoic s_1) (Qtoic (s_2 s_3 ... dot sym_1)))] + [(Qtoic sym_1) 'sym_1] + [(Qtoic sqv_1) sqv_1]) + + (define reductions + (union-reduction-relations + Arithmetic + Basic--syntactic--forms + Cons + Eqv + Procedure--application + Apply + Call-cc--and--dynamic-wind + Exceptions + Multiple--values--and--call-with-values + Quote + Letrec + Underspecification)) + + (define-metafunction lang + + ;; variable cases + [(r6rs-subst-one (variable_1 e_1 variable_1)) e_1] + [(r6rs-subst-one (variable_1 e_1 variable_2)) variable_2] + + ;; dont substitute inside quoted expressions + [(r6rs-subst-one (variable_1 e_1 'any_1)) 'any_1] + + ;; when the lambda/letrec binds the variable, stop stubstituting + [(r6rs-subst-one (variable_1 e (lambda (variable_2 ... variable_1 variable_3 ...) e_2 e_3 ...))) + (lambda (variable_2 ... variable_1 variable_3 ...) e_2 e_3 ...) + (side-condition (not (memq (term variable_1) (term (variable_2 ...)))))] + [(r6rs-subst-one (variable_1 e (lambda (variable_2 ... dot variable_1) e_2 e_3 ...))) + (lambda (variable_2 ... dot variable_1) e_2 e_3 ...)] + [(r6rs-subst-one (variable_1 e (lambda (variable_2 ... variable_1 variable_3 ... dot variable_4) e_2 e_3 ...))) + (lambda (variable_2 ... variable_1 variable_3 ... dot variable_4) e_2 e_3 ...) + (side-condition (not (memq (term variable_1) (term (variable_2 ...)))))] + [(r6rs-subst-one (variable_1 e (lambda variable_1 e_2 e_3 ...))) + (lambda variable_1 e_2 e_3 ...)] + [(r6rs-subst-one (variable_1 e (letrec ([variable_2 e_2] ... [variable_1 e_1] [variable_3 e_3] ...) e_4 e_5 ...))) + (letrec ([variable_2 e_2] ... [variable_1 e_1] [variable_3 e_3] ...) e_4 e_5 ...) + (side-condition (not (memq (term variable_1) (term (variable_2 ...)))))] + [(r6rs-subst-one (variable_1 e (letrec* ([variable_2 e_2] ... [variable_1 e_1] [variable_3 e_3] ...) e_4 e_5 ...))) + (letrec* ([variable_2 e_2] ... [variable_1 e_1] [variable_3 e_3] ...) e_4 e_5 ...) + (side-condition (not (memq (term variable_1) (term (variable_2 ...)))))] + + ;; next 3 cases: we know no capture can occur, so we just recur + [(r6rs-subst-one (variable_1 e_1 (lambda (variable_2 ...) e_2 e_3 ...))) + (lambda (variable_2 ...) + (r6rs-subst-one (variable_1 e_1 e_2)) + (r6rs-subst-one (variable_1 e_1 e_3)) ...) + (side-condition (andmap (λ (x) (equal? (variable-not-in (term e_1) x) x)) + (term (variable_2 ...))))] + [(r6rs-subst-one (variable_1 e_1 (lambda (variable_2 ... dot variable_3) e_2 e_3 ...))) + (lambda (variable_2 ...) + (r6rs-subst-one (variable_1 e_1 e_2)) + (r6rs-subst-one (variable_1 e_1 e_3)) ...) + (side-condition (andmap (λ (x) (equal? (variable-not-in (term e_1) x) x)) + (term (variable_2 ... variable_3))))] + [(r6rs-subst-one (variable_1 e_1 (lambda variable_2 e_2 e_3 ...))) + (lambda variable_2 + (r6rs-subst-one (variable_1 e_1 e_2)) + (r6rs-subst-one (variable_1 e_1 e_3)) ...) + (side-condition (equal? (variable-not-in (term e_1) (term variable_2)) + (term variable_2)))] + [(r6rs-subst-one (variable_1 e_1 (letrec ([variable_2 e_2] ...) e_3 e_4 ...))) + (letrec ([variable_2 (r6rs-subst-one (variable_1 e_1 e_2))] ...) + (r6rs-subst-one (variable_1 e_1 e_3)) + (r6rs-subst-one (variable_1 e_1 e_4)) ...) + (side-condition (andmap (λ (x) (equal? (variable-not-in (term e_1) x) x)) + (term (variable_2 ...))))] + [(r6rs-subst-one (variable_1 e_1 (letrec* ([variable_2 e_2] ...) e_3 e_4 ...))) + (letrec* ([variable_2 (r6rs-subst-one (variable_1 e_1 e_2))] ...) + (r6rs-subst-one (variable_1 e_1 e_3)) + (r6rs-subst-one (variable_1 e_1 e_4)) ...) + (side-condition (andmap (λ (x) (equal? (variable-not-in (term e_1) x) x)) + (term (variable_2 ...))))] + + ;; capture avoiding cases + [(r6rs-subst-one (variable_1 e_1 (lambda (variable_2 ... dot variable_3) e_2 e_3 ...))) + ,(term-let ([(variable_new ... variable_new_dot) (variables-not-in (term (variable_1 e_1 e_2 e_3 ...)) + (term (variable_2 ... variable_3)))]) + (term (lambda (variable_new ... dot variable_new_dot) + (r6rs-subst-one (variable_1 + e_1 + (r6rs-subst-many ((variable_2 variable_new) ... (variable_3 variable_new_dot) e_2)))) + (r6rs-subst-one (variable_1 + e_1 + (r6rs-subst-many ((variable_2 variable_new) ... (variable_3 variable_new_dot) e_3)))) + ...)))] + [(r6rs-subst-one (variable_1 e_1 (lambda (variable_2 ...) e_2 e_3 ...))) + ,(term-let ([(variable_new ...) (variables-not-in (term (variable_1 e_1 e_2 e_3 ...)) + (term (variable_2 ...)))]) + (term (lambda (variable_new ...) + (r6rs-subst-one (variable_1 e_1 (r6rs-subst-many ((variable_2 variable_new) ... e_2)))) + (r6rs-subst-one (variable_1 e_1 (r6rs-subst-many ((variable_2 variable_new) ... e_3)))) ...)))] + [(r6rs-subst-one (variable_1 e_1 (lambda variable_2 e_2 e_3 ...))) + ,(term-let ([variable_new (variable-not-in (term (variable_1 e_1 e_2 e_3 ...)) + (term variable_2))]) + (term (lambda variable_new + (r6rs-subst-one (variable_1 e_1 (r6rs-subst-one (variable_2 variable_new e_2)))) + (r6rs-subst-one (variable_1 e_1 (r6rs-subst-one (variable_2 variable_new e_3)))) ...)))] + [(r6rs-subst-one (variable_1 e_1 (letrec ([variable_2 e_2] ...) e_3 e_4 ...))) + ,(term-let ([(variable_new ...) (variables-not-in (term (variable_1 e_1 e_2 ... e_3 e_4 ...)) + (term (variable_2 ...)))]) + (term (letrec ([variable_new (r6rs-subst-one + (variable_1 + e_1 + (r6rs-subst-many ((variable_2 variable_new) ... e_2))))] ...) + (r6rs-subst-one (variable_1 e_1 (r6rs-subst-many ((variable_2 variable_new) ... e_3)))) + (r6rs-subst-one (variable_1 e_1 (r6rs-subst-many ((variable_2 variable_new) ... e_4)))) ...)))] + [(r6rs-subst-one (variable_1 e_1 (letrec* ([variable_2 e_2] ...) e_3 e_4 ...))) + ,(term-let ([(variable_new ...) (variables-not-in (term (variable_1 e_1 e_2 ... e_3 e_4 ...)) + (term (variable_2 ...)))]) + (term (letrec* ([variable_new (r6rs-subst-one + (variable_1 + e_1 + (r6rs-subst-many ((variable_2 variable_new) ... e_2))))] ...) + (r6rs-subst-one (variable_1 e_1 (r6rs-subst-many ((variable_2 variable_new) ... e_3)))) + (r6rs-subst-one (variable_1 e_1 (r6rs-subst-many ((variable_2 variable_new) ... e_4)))) ...)))] + + ;; last two cases cover all other expressions -- they don't have any variables, + ;; so we don't care about their structure. + [(r6rs-subst-one (variable_1 e_1 (any_1 ...))) ((r6rs-subst-one (variable_1 e_1 any_1)) ...)] + [(r6rs-subst-one (variable_1 e_1 any_1)) any_1]) + + (define-metafunction lang + [(r6rs-subst-many ((variable_1 e_1) (variable_2 e_2) ... e_3)) + (r6rs-subst-one (variable_1 e_1 (r6rs-subst-many ((variable_2 e_2) ... e_3))))] + [(r6rs-subst-many (e_1)) e_1]) + + (metafunction-type observable (-> a* r*)) + (define-metafunction lang + observable : a* -> r* + [(observable (store (sf ...) (values v_1 ...))) + (values (observable-value v_1) ...)] + [(observable (uncaught-exception v)) + exception] + [(observable (unknown string)) + unknown]) + + (metafunction-type observable-value (-> v r*v)) + (define-metafunction lang + observable-value : v -> r*v + [(observable-value pp_1) pair] + [(observable-value null) null] + [(observable-value 'sym_1) 'sym_1] + [(observable-value sqv_1) sqv_1] + [(observable-value (make-cond string)) condition] + [(observable-value proc) procedure]) + + (define condition? (redex-match lang (make-cond string))) + (define lambda-null? (redex-match lang (lambda () e))) + (define null-v? (redex-match lang null)) + + (define v? (redex-match lang v)) + (define proc? (redex-match lang proc)) + (define pp? (redex-match lang pp)) + (define mp? (redex-match lang mp)) + (define ip? (redex-match lang ip)) + (define es? (redex-match lang es)) + (define (list-v? v) (or (pp? v) (null-v? v))) + (define (unique? l) + (or (null? l) + (and (andmap (lambda (e) (not (equal? (car l) e))) (cdr l)) + (unique? (cdr l)))))) diff --git a/collects/redex/examples/r6rs/show-examples.ss b/collects/redex/examples/r6rs/show-examples.ss new file mode 100644 index 0000000000..884c8c38db --- /dev/null +++ b/collects/redex/examples/r6rs/show-examples.ss @@ -0,0 +1,65 @@ +#lang scheme + +(require redex + "r6rs.ss") +(provide show show-expression + step step-expression) + + + +;; the number of steps to produce automatically (the GUI lets you produce more if you wish) +(reduction-steps-cutoff 100) + +;; the width of the boxes in the GUI (used when pretty-printing their contents) +;; defaults to 40 if unspecified +(initial-char-width 60) + +;; show : sexp -> void +;; shows the reduction sequence for its argument; any terms +;; that don't match the script p (p*) non-terminal are turned pink +(define (show x) + (traces reductions + x + #:pred (λ (x) + (let ([m (tm x)]) + (and m + (= 1 (length m))))))) +(define tm (redex-match lang p*)) +(define (show-expression x) (show `(store () ,x))) + +(define (step x) (stepper reductions x)) +(define (step-expression x) (step `(store () ,x))) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; example uses of the above functions +;; if any of the terms in the graph don't +;; match p*, they will be colored red +;; #; comments out an entire sexpression. +;; + +#; +(show '(store () (((lambda (x y) (set! x (+ x y)) x) 2 3)))) + +;; an infinite, tail-recursive loop +#; +(show-expression '((lambda (x) ((call/cc call/cc) x)) (call/cc call/cc))) + +;; two infinite loops, one in left-to-right and one in right-to-left evaluation order +;; one goes into a non-tail infinite loop, the other's reduction graph has a cycle +#; +(step '(store () + ((call/cc call/cc) + (call/cc call/cc)))) + + +;; demonstrates sharing +#; +(show-expression + '((lambda (c) + ((lambda (x y) + (set-car! x 3) + (car y)) + c c)) + (cons 1 2))) diff --git a/collects/redex/examples/r6rs/test.ss b/collects/redex/examples/r6rs/test.ss new file mode 100644 index 0000000000..e5363104f8 --- /dev/null +++ b/collects/redex/examples/r6rs/test.ss @@ -0,0 +1,213 @@ +(module test mzscheme + (require redex/reduction-semantics + (lib "etc.ss") + (lib "contract.ss")) + + (define-struct test-suite (name reductions to-mz equal? tests)) + (define-struct test (name input expecteds run-mz? around file line)) + + (define (show-dup-error from dup) + (string->immutable-string + (format "FOUND DUPLICATE!\n----\n~s\nwent to this twice:\n~s\n----\n" + from + dup))) + + (define (uniq from lot) + (let loop ((thelist lot)) + (unless (null? thelist) + (when (member (car thelist) (cdr thelist)) + (raise (make-exn:fail:duplicate + (show-dup-error from (car thelist)) + (current-continuation-marks)))) + (loop (cdr thelist))))) + (define-struct (exn:fail:duplicate exn:fail) ()) + + (define evaluate + (opt-lambda (reductions t progress? [intermediate-state-test void]) + (let ([cache (make-hash-table 'equal)] + [count 0] + [results (make-hash-table 'equal)]) + + (let loop ([t t] + [depth 0]) + (unless (hash-table-get cache t (λ () #f)) + (hash-table-put! cache t #t) + (set! count (+ count 1)) + (intermediate-state-test t) + (when progress? + (cond + [(eq? progress? 'dots) + (when (= 0 (modulo count 100)) + (printf ":") + (flush-output))] + [else + (when (= 0 (modulo count 5000)) + (printf "~s states ... " count) + (flush-output))])) + (let ([nexts (apply-reduction-relation reductions t)]) + (cond + [(null? nexts) + (hash-table-put! results t #t)] + [else + (uniq t nexts) + (for-each (λ (t) (loop t (+ depth 1))) + nexts)])))) + + (when progress? + (unless (eq? progress? 'dots) + (printf "~s state~a total\n" count (if (= 1 count) "" "s")))) + (hash-table-map results (λ (x y) x))))) + + (define (set-same? s1 s2 same?) + (define (in-s1? s2-ele) (ormap (lambda (s1-ele) (same? s1-ele s2-ele)) s1)) + (define (in-s2? s1-ele) (ormap (lambda (s2-ele) (same? s1-ele s2-ele)) s2)) + (and (andmap in-s1? s2) + (andmap in-s2? s1) + #t)) + + (define-syntax (-test stx) + (syntax-case stx () + [(_ name term expected) + (with-syntax ([line (syntax-line stx)] + [source (syntax-source stx)]) + (syntax (build-test name term (list expected) #t #f line source)))] + [(_ name term expected mz?) + (with-syntax ([line (syntax-line stx)] + [source (syntax-source stx)]) + (syntax (build-test name term (list expected) mz? #f line source)))] + [(_ name term expected mz? around) + (with-syntax ([line (syntax-line stx)] + [source (syntax-source stx)]) + (syntax (build-test name term (list expected) mz? around line source)))])) + + (define-syntax (test/anss stx) + (syntax-case stx () + [(_ name term expecteds) + (with-syntax ([line (syntax-line stx)] + [source (syntax-source stx)]) + (syntax (build-test name term expecteds #t #f line source)))])) + + (define (build-test name term expecteds mz? around line source) + (make-test name term expecteds mz? (or around (λ (t) (t))) + (cond + [(path? source) + (let-values ([(base name dir?) (split-path source)]) + (path->string name))] + [else ""]) + line)) + + (define (run-test-suite test-suite) + (printf "running test suite: ~a\n" (test-suite-name test-suite)) + (let ([count 0]) + (for-each (λ (test) + (set! count (+ count 1)) + (run-test test-suite test)) + (test-suite-tests test-suite)) + (printf "ran ~a tests\n" count))) + + (define-struct multiple-values (lst) (make-inspector)) + + (define (run-test test-suite test) + (let* ([name (test-name test)] + [input (test-input test)] + [expecteds (test-expecteds test)] + [file (test-file test)] + [line (test-line test)] + [got + ((test-around test) + (λ () + (evaluate (test-suite-reductions test-suite) + input + #f)))]) + (unless (set-same? got expecteds (test-suite-equal? test-suite)) + (fprintf (current-error-port) "line ~a of ~a ~a\n test: ~s\n got: ~s\nexpected: ~s\n\n" + line + file + name + input + (separate-lines got) + (separate-lines expecteds))) + (when (test-run-mz? test) + (let* ([mv-wrap + (λ vals + (if (= 1 (length vals)) + (car vals) + (make-multiple-values vals)))] + [mz-got + (with-handlers ([exn? values]) + (call-with-values + (λ () (eval ((test-suite-to-mz test-suite) input))) + mv-wrap))] + [expected (car expecteds)] + [mz-expected (with-handlers ([exn? values]) + (call-with-values + (λ () (eval ((test-suite-to-mz test-suite) expected))) + mv-wrap))]) + (unless (same-mz? mz-got mz-expected) + (parameterize ([print-struct #t]) + (fprintf (current-error-port) "line ~s of ~a ~a\nMZ test: ~s\n got: ~s\nexpected: ~s\n\n" + line + file + name + input + (if (exn? mz-got) (exn-message mz-got) mz-got) + (if (exn? mz-expected) (exn-message mz-expected) mz-expected)))))))) + + (define (separate-lines sexps) + (cond + [(null? sexps) ""] + [(null? (cdr sexps)) (car sexps)] + [else (apply string-append (map (λ (x) (format "\n~s" x)) sexps))])) + + (define (same-mz? mz-got mz-expected) + (or (same-mz-single-value? mz-got mz-expected) + + (and (multiple-values? mz-got) + (multiple-values? mz-expected) + (andmap same-mz-single-value? + (multiple-values-lst mz-got) + (multiple-values-lst mz-expected))) + + (and (exn? mz-got) + (exn? mz-expected) + (equal? (exn-message mz-got) + (exn-message mz-expected))) + + (and (exn? mz-got) + (regexp? mz-expected) + (regexp-match mz-expected (exn-message mz-got))))) + + (define (same-mz-single-value? mz-got mz-expected) + (or (equal? mz-got mz-expected) + (and (procedure? mz-got) + (procedure? mz-expected) + (equal? (procedure-arity mz-got) + (procedure-arity mz-expected))))) + + + (define (-test-suite n a b e? . c) (make-test-suite n a b e? c)) + + (provide (rename -test test)) + (provide/contract [rename -test-suite + test-suite + (->* (string? + reduction-relation? + (-> any/c any) + (-> any/c any/c boolean?)) + (listof test?) + (test-suite?))] + [run-test-suite (-> test-suite? any)]) + + (provide test-suite-tests + test? + test-name + test-input + test-expecteds + test-file + test-line + test/anss + + evaluate + exn:fail:duplicate? + set-same?)) + diff --git a/collects/redex/tests/bitmap-test-util.ss b/collects/redex/tests/bitmap-test-util.ss index 468149ea02..943bdbb9a9 100644 --- a/collects/redex/tests/bitmap-test-util.ss +++ b/collects/redex/tests/bitmap-test-util.ss @@ -1,9 +1,8 @@ #lang scheme/gui (require framework - slideshow + slideshow/pict "../pict.ss" - "../reduction-semantics.ss" - "config.ss") + "../reduction-semantics.ss") (provide test done) @@ -149,7 +148,7 @@ (define (update-gui) (send sp active-child (list-ref failed current-index))) (set! test-result-single-panel sp) - (when (get-show-bitmaps?) (send f show #t)) + (send f show #t) sp)])) (define (make-failed-panel line-number filename old-bitmap new-bitmap diff-bitmap) diff --git a/collects/redex/tests/config.ss b/collects/redex/tests/config.ss deleted file mode 100644 index 721ab32da1..0000000000 --- a/collects/redex/tests/config.ss +++ /dev/null @@ -1,5 +0,0 @@ -#lang scheme -(provide set-show-bitmaps? get-show-bitmaps?) -(define show-bitmaps? #t) -(define (set-show-bitmaps? sb?) (set! show-bitmaps? sb?)) -(define (get-show-bitmaps?) show-bitmaps?) \ No newline at end of file diff --git a/collects/redex/tests/hole-test.ss b/collects/redex/tests/hole-test.ss index 7536526d5a..77342bade7 100644 --- a/collects/redex/tests/hole-test.ss +++ b/collects/redex/tests/hole-test.ss @@ -30,3 +30,5 @@ (test--> test2 (term ((cont hole) (explode))) (term okay)) + +(test-results) diff --git a/collects/redex/tests/run-tests.ss b/collects/redex/tests/run-tests.ss index 46fe598acd..806f31ef1d 100644 --- a/collects/redex/tests/run-tests.ss +++ b/collects/redex/tests/run-tests.ss @@ -2,22 +2,37 @@ #lang scheme/base (require scheme/runtime-path - "config.ss" + scheme/cmdline + scheme/match "test-util.ss") -(set-show-bitmaps? #f) +(define test-bitmaps? #t) +(define test-examples? #f) + +(command-line + #:once-each + [("--no-bitmaps") "executes bitmap-test.ss" (set! test-bitmaps? #f)] + [("--examples") "executes the tests in the examples directory" (set! test-examples? #t)]) (define test-files - '("lw-test.ss" - "matcher-test.ss" - "tl-test.ss" - "term-test.ss" - "rg-test.ss" - "keyword-macros-test.ss" - "core-layout-test.ss" - "bitmap-test.ss" - "pict-test.ss" - "hole-test.ss")) + (append + '("lw-test.ss" + "matcher-test.ss" + "tl-test.ss" + "term-test.ss" + "rg-test.ss" + "keyword-macros-test.ss" + "core-layout-test.ss" + "pict-test.ss" + "hole-test.ss") + (if test-bitmaps? '("bitmap-test.ss") '()) + (if test-examples? + '("../examples/pi-calculus.ss" + ("../examples/beginner.ss" main) + "../examples/mzscheme-machine/reduction-test.ss" + "../examples/mzscheme-machine/verification-test.ss" + ("../examples/r6rs/r6rs-tests.ss" main)) + '()))) (define-runtime-path here ".") @@ -30,12 +45,18 @@ (for-each (λ (test-file) - (flush) - (printf "requiring ~a\n" test-file) - (flush) - (dynamic-require (build-path here test-file) #f) - (flush)) + (let-values ([(file provided action) + (match test-file + [(list (? string? file) id) + (values file id (λ (x) (x)))] + [(? string?) + (values test-file #f values)])]) + (flush) + (printf "testing ~a\n" file) + (flush) + (action (dynamic-require (build-path here file) provided)) + (flush))) test-files) -(printf "\nWARNING: didn't run color-test.ss or subst-test.ss\n") +(printf "\nWARNING: didn't run color-test.ss\n") (flush) From d34db39be1911339a9e110a8daab8181e60a9d81 Mon Sep 17 00:00:00 2001 From: Kevin Tew Date: Wed, 31 Mar 2010 16:10:29 +0000 Subject: [PATCH 043/202] Compiler Warning Fixes svn: r18695 --- src/mzscheme/src/module.c | 2 +- src/mzscheme/src/thread.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mzscheme/src/module.c b/src/mzscheme/src/module.c index dc24280353..bdbd848180 100644 --- a/src/mzscheme/src/module.c +++ b/src/mzscheme/src/module.c @@ -3767,7 +3767,7 @@ static void lock_registry(Scheme_Env *env) { Scheme_Object *lock; lock = scheme_make_pair(scheme_make_sema(0), - scheme_current_thread); + (Scheme_Object *) scheme_current_thread); scheme_hash_set(env->module_registry, scheme_false, lock); } diff --git a/src/mzscheme/src/thread.c b/src/mzscheme/src/thread.c index f95c097f00..158b3e5b4c 100644 --- a/src/mzscheme/src/thread.c +++ b/src/mzscheme/src/thread.c @@ -7903,7 +7903,8 @@ int scheme_is_in_frozen_stack() static unsigned long get_deeper_base() { long here; - return (unsigned long)&here; + unsigned long here_addr = (unsigned long)&here; + return here_addr; } #ifdef _MSC_VER From ba57548bc75a6e91bd812a4e419cd6135a4304eb Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Wed, 31 Mar 2010 21:36:56 +0000 Subject: [PATCH 044/202] loa is gone svn: r18697 --- collects/meta/dist-specs.ss | 1 - 1 file changed, 1 deletion(-) diff --git a/collects/meta/dist-specs.ss b/collects/meta/dist-specs.ss index e106861395..e55ff4a1de 100644 --- a/collects/meta/dist-specs.ss +++ b/collects/meta/dist-specs.ss @@ -593,7 +593,6 @@ plt-extras :+= (package: "algol60/") ;; -------------------- games plt-extras :+= (- (+ (package: "games/" #:executable "plt-games") (doc+src: "gl-board-game/" "cards/")) - "loa/" "paint-by-numbers/{hattori|solution-sets|raw-problems}") ;; -------------------- texpict & slideshow From 6234c57b692f6e6a91729151309d7412b9708c82 Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Wed, 31 Mar 2010 21:38:02 +0000 Subject: [PATCH 045/202] places docs in user directory since its not on by default. svn: r18698 --- collects/scribblings/places/info.ss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collects/scribblings/places/info.ss b/collects/scribblings/places/info.ss index 22fe7bf873..62a79f4cb6 100644 --- a/collects/scribblings/places/info.ss +++ b/collects/scribblings/places/info.ss @@ -1,3 +1,3 @@ #lang setup/infotab -(define scribblings '(("places.scrbl" ()))) +(define scribblings '(("places.scrbl" (user-doc)))) From 3f20bc5eb62f0a10734cc18ca43e4d82ba44e628 Mon Sep 17 00:00:00 2001 From: Matthias Felleisen Date: Wed, 31 Mar 2010 21:59:07 +0000 Subject: [PATCH 046/202] fixes 10836 svn: r18700 --- collects/2htdp/private/syn-aux.ss | 18 +++++++++++++- collects/2htdp/tests/clause-once.ss | 38 +++++++++++++++++++++++++++++ collects/2htdp/universe.ss | 4 +-- 3 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 collects/2htdp/tests/clause-once.ss diff --git a/collects/2htdp/private/syn-aux.ss b/collects/2htdp/private/syn-aux.ss index dfaaffc22e..30e3a761f4 100644 --- a/collects/2htdp/private/syn-aux.ss +++ b/collects/2htdp/private/syn-aux.ss @@ -21,11 +21,12 @@ if anything fails, use the legal keyword to specialize the error message |# -(define (->args stx clauses AllSpec PartSpec ->rec? legal) +(define (->args tag stx clauses AllSpec PartSpec ->rec? legal) (define msg (format "not a legal clause in a ~a description" legal)) (define Spec (append AllSpec PartSpec)) (define kwds (map (compose (curry datum->syntax stx) car) Spec)) (define spec (clauses-use-kwd (syntax->list clauses) ->rec? msg (->kwds-in kwds))) + (duplicates? tag spec) (map (lambda (x) (define kw (car x)) (define-values (key coercion) @@ -36,6 +37,21 @@ (list key (coercion (cdr x)))) spec)) +;; Symbol [Listof kw] -> true +;; effect: raise syntax error about duplicated clause +(define (duplicates? tag lox) + (let duplicates? ([lox lox]) + (cond + [(empty? lox) false] + [else + (let* ([f (caar lox)] + [id (syntax-e f)] + [x (memf (lambda (x) (free-identifier=? (car x) f)) (rest lox))]) + (if x + (raise-syntax-error tag (format "duplicate ~a clause" id) (cdar x)) + (duplicates? (rest lox))))]))) + +;; check whether rec? occurs, produce list of keywords (define (clauses-use-kwd stx:list ->rec? legal-clause kwd-in?) (map (lambda (stx) (syntax-case stx () diff --git a/collects/2htdp/tests/clause-once.ss b/collects/2htdp/tests/clause-once.ss new file mode 100644 index 0000000000..0d81a26068 --- /dev/null +++ b/collects/2htdp/tests/clause-once.ss @@ -0,0 +1,38 @@ +#lang scheme/load + +;; purpose: make sure that each clause exists at most once + +;; (why am I running this in scheme/load for the namespace in eval) + +(with-handlers ((exn:fail:syntax? + (lambda (e) + (define msg (exn-message e)) + (unless (string=? msg "big-bang: duplicate on-draw clause") + (raise e))))) + (eval '(module a scheme + (require 2htdp/universe) + (require 2htdp/image) + + (define (render1 n) (text (number->string n) 12 "red")) + (define (render2 n) (text (number->string n) 10 "blue")) + + (define (main a) + (big-bang 0 + (on-draw render1 200 400) + (on-draw render2 400 200) + ; (on-tick sub1) + (on-tick add1)))))) + +(with-handlers ((exn:fail:syntax? + (lambda (e) + (define msg (exn-message e)) + (unless (string=? msg "universe: duplicate on-tick clause") + (raise e))))) + (eval '(module a scheme + (require 2htdp/universe) + + (define (main a) + (universe 0 + (on-tick add1) + (on-tick sub1)))))) + diff --git a/collects/2htdp/universe.ss b/collects/2htdp/universe.ss index 4145ed508c..4d4f575a5c 100644 --- a/collects/2htdp/universe.ss +++ b/collects/2htdp/universe.ss @@ -178,7 +178,7 @@ [(V) (set! rec? #'V)] [_ (err '#'record? stx)])))] [args - (->args stx (syntax (clause ...)) AllSpec WldSpec ->rec? "world")]) + (->args 'big-bang stx (syntax (clause ...)) AllSpec WldSpec ->rec? "world")]) #`(let* ([esp (make-eventspace)] [thd (eventspace-handler-thread esp)]) (with-handlers ((exn:break? (lambda (x) (break-thread thd)))) @@ -275,7 +275,7 @@ [(universe u) (raise-syntax-error #f "not a legal universe description" stx)] [(universe u bind ...) (let* - ([args (->args stx (syntax (bind ...)) AllSpec UniSpec void "universe")] + ([args (->args 'universe stx (syntax (bind ...)) AllSpec UniSpec void "universe")] [domain (map (compose syntax-e car) args)]) (cond [(not (memq 'on-new domain)) From 7a4cd2a70616d51f0b428888245f790ff6566dc6 Mon Sep 17 00:00:00 2001 From: Matthias Felleisen Date: Thu, 1 Apr 2010 00:57:36 +0000 Subject: [PATCH 047/202] appeasing drdr svn: r18702 --- collects/2htdp/tests/clause-once.ss | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/collects/2htdp/tests/clause-once.ss b/collects/2htdp/tests/clause-once.ss index 0d81a26068..95d3bd8c94 100644 --- a/collects/2htdp/tests/clause-once.ss +++ b/collects/2htdp/tests/clause-once.ss @@ -7,7 +7,8 @@ (with-handlers ((exn:fail:syntax? (lambda (e) (define msg (exn-message e)) - (unless (string=? msg "big-bang: duplicate on-draw clause") + (define ext "big-bang: duplicate on-draw clause in: (on-draw render2 400 200)") + (unless (string=? msg ext) (raise e))))) (eval '(module a scheme (require 2htdp/universe) @@ -26,7 +27,7 @@ (with-handlers ((exn:fail:syntax? (lambda (e) (define msg (exn-message e)) - (unless (string=? msg "universe: duplicate on-tick clause") + (unless (string=? msg "universe: duplicate on-tick clause in: (on-tick sub1)") (raise e))))) (eval '(module a scheme (require 2htdp/universe) From eaa7303113cadb8d02bc3ee2f6512263b71002fc Mon Sep 17 00:00:00 2001 From: Matthias Felleisen Date: Thu, 1 Apr 2010 02:01:05 +0000 Subject: [PATCH 048/202] the proper fix svn: r18703 --- collects/2htdp/tests/clause-once.ss | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/collects/2htdp/tests/clause-once.ss b/collects/2htdp/tests/clause-once.ss index 95d3bd8c94..70482fecbd 100644 --- a/collects/2htdp/tests/clause-once.ss +++ b/collects/2htdp/tests/clause-once.ss @@ -4,10 +4,12 @@ ;; (why am I running this in scheme/load for the namespace in eval) +(error-print-source-location #f) + (with-handlers ((exn:fail:syntax? (lambda (e) (define msg (exn-message e)) - (define ext "big-bang: duplicate on-draw clause in: (on-draw render2 400 200)") + (define ext "big-bang: duplicate on-draw clause") ; " in: (on-draw render2 400 200)") (unless (string=? msg ext) (raise e))))) (eval '(module a scheme @@ -27,7 +29,7 @@ (with-handlers ((exn:fail:syntax? (lambda (e) (define msg (exn-message e)) - (unless (string=? msg "universe: duplicate on-tick clause in: (on-tick sub1)") + (unless (string=? msg "universe: duplicate on-tick clause"); " in: (on-tick sub1)") (raise e))))) (eval '(module a scheme (require 2htdp/universe) From 6977f08878996a666212fb0e2e1772265255d136 Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Thu, 1 Apr 2010 07:33:55 +0000 Subject: [PATCH 049/202] typo (PR 10754) svn: r18704 --- collects/scribblings/guide/proc-macros.scrbl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/collects/scribblings/guide/proc-macros.scrbl b/collects/scribblings/guide/proc-macros.scrbl index 07461ab295..a6fb3caf74 100644 --- a/collects/scribblings/guide/proc-macros.scrbl +++ b/collects/scribblings/guide/proc-macros.scrbl @@ -286,9 +286,9 @@ This way of generating identifiers is normally easier to think about than tricking the macro expander into generating names with purely pattern-based macros. -In general, the right-hand side of a @scheme[with-handlers] +In general, the right-hand side of a @scheme[with-syntax] binding is a pattern, just like in @scheme[syntax-case]. In fact, -a @scheme[with-handlers] form is just a @scheme[syntax-case] form +a @scheme[with-syntax] form is just a @scheme[syntax-case] form turned partially inside-out. @; ---------------------------------------- From 581cbb461b8f31da88c839291fad8c86254c0438 Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Thu, 1 Apr 2010 07:45:41 +0000 Subject: [PATCH 050/202] Change `generator' to have a form of (generator () body ...). The empty place will have initial input names, so having this first will make existing code break with an easy to fix syntax error, rather than having confusing failures. (Also made it throw a very clear error message if there is no () now.) svn: r18705 --- collects/scheme/generator.ss | 20 ++++++++++++++------ collects/tests/mzscheme/for.ss | 12 ++++++------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/collects/scheme/generator.ss b/collects/scheme/generator.ss index 79a5939be1..6ad3a93259 100644 --- a/collects/scheme/generator.ss +++ b/collects/scheme/generator.ss @@ -22,7 +22,8 @@ ;; r))) ;; (lambda () (cont))) -;; not using parameterization +;; not using parameterization (old version, doesn't deal with multiple +;; inputs/outputs as the one below) #; (define-syntax-rule (generator body0 body ...) (let ([tag (make-continuation-prompt-tag)]) @@ -51,7 +52,13 @@ (define yield-tag (make-continuation-prompt-tag)) -(define-syntax-rule (generator body0 body ...) +(define-syntax (generator stx) + (syntax-case stx () + [(_ () body0 body ...) #'(generator-old body0 body ...)] + [_ (raise-syntax-error + 'generator "must have a form of (generator () body ...)")])) + +(define-syntax-rule (generator-old body0 body ...) (let ([state 'fresh]) (define (cont) (define (yielder . vs) @@ -95,22 +102,23 @@ (raise-type-error 'generator-state "generator" g)))) (define-syntax-rule (infinite-generator body0 body ...) - (generator (let loop () body0 body ... (loop)))) + (generator () (let loop () body0 body ... (loop)))) (define stop-value (gensym)) (define-sequence-syntax in-generator (syntax-rules () [(_ body0 body ...) - (in-producer (generator body0 body ... stop-value) stop-value)]) + (in-producer (generator () body0 body ... stop-value) stop-value)]) (lambda (stx) (syntax-case stx () [((id ...) (_ body0 body ...)) #'[(id ...) - (in-producer (generator body0 body ... stop-value) stop-value)]]))) + (in-producer (generator () body0 body ... stop-value) + stop-value)]]))) (define (sequence->generator sequence) - (generator (for ([i sequence]) (yield i)))) + (generator () (for ([i sequence]) (yield i)))) (define (sequence->repeated-generator sequence) (sequence->generator (in-cycle sequence))) diff --git a/collects/tests/mzscheme/for.ss b/collects/tests/mzscheme/for.ss index 1d61983e4d..3f9102c384 100644 --- a/collects/tests/mzscheme/for.ss +++ b/collects/tests/mzscheme/for.ss @@ -235,10 +235,10 @@ (for/list ([x (in-generator (helper 0) (helper 1) (helper 2))]) x))) -(let ([g (lambda () (generator (yield 1) (yield 2) (yield 3)))]) +(let ([g (lambda () (generator () (yield 1) (yield 2) (yield 3)))]) (let ([g (g)]) (test '(1 2 3) list (g) (g) (g))) (let ([g (g)]) (test '(1 2 3 10 10) list (g) (g) (g) (g 10) (g))) - (let ([g (generator (yield (yield (yield 1))))]) + (let ([g (generator () (yield (yield (yield 1))))]) (test '(1 2 3 4 4 4) list (g) (g 2) (g 3) (g 4) (g) (g))) (let ([g (g)]) (test '(fresh 1 suspended 2 suspended 3 suspended last done) @@ -247,8 +247,8 @@ (generator-state g) (g) (generator-state g) (g 'last) (generator-state g))) - (letrec ([g (generator (yield (generator-state g)) - (yield (generator-state g)))]) + (letrec ([g (generator () (yield (generator-state g)) + (yield (generator-state g)))]) (test '(fresh running suspended running suspended last done) list (generator-state g) (g) (generator-state g) (g) @@ -257,8 +257,8 @@ (let* ([helper (lambda (pred num) (for ([i (in-range 0 3)]) (yield (pred (+ i num)))))] - [g1 (generator (helper odd? 1) (yield 'odd))] - [g2 (generator (helper even? 1) (yield 'even))]) + [g1 (generator () (helper odd? 1) (yield 'odd))] + [g2 (generator () (helper even? 1) (yield 'even))]) (test '(#t #f #f #t #t #f odd even) 'yield-helper (list (g1) (g2) (g1) (g2) (g1) (g2) (g1) (g2)))) From 05fca5df14017cc770bc8d7c899cff50f1b2f81c Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Thu, 1 Apr 2010 07:46:01 +0000 Subject: [PATCH 051/202] Documented () thing svn: r18706 --- collects/scribblings/reference/sequences.scrbl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/collects/scribblings/reference/sequences.scrbl b/collects/scribblings/reference/sequences.scrbl index d9a9f243c3..aac2bc8033 100644 --- a/collects/scribblings/reference/sequences.scrbl +++ b/collects/scribblings/reference/sequences.scrbl @@ -325,12 +325,15 @@ sequence; if no more elements are available, the @section{Iterator Generators} @defmodule[scheme/generator] -@defform[(generator body ...)]{ Creates a function that returns a -value, usually through @scheme[yield], each time it is invoked. When -the generator runs out of values to yield the last value it computed +@defform[(generator () body ...)]{ Creates a function that returns a +value through @scheme[yield], each time it is invoked. When +the generator runs out of values to yield, the last value it computed will be returned for future invocations of the generator. Generators can be safely nested. +Note: the first form must be @scheme[()], and in the future this will +hold argument names that are used in the initial generator call. + @examples[#:eval (generator-eval) (define g (generator (let loop ([x '(a b c)]) From 853db0ae5591a9435be50ca0a9eb944fbad829ff Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Thu, 1 Apr 2010 08:27:15 +0000 Subject: [PATCH 052/202] forgot examples svn: r18709 --- collects/scribblings/reference/pairs.scrbl | 2 +- collects/scribblings/reference/sequences.scrbl | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/collects/scribblings/reference/pairs.scrbl b/collects/scribblings/reference/pairs.scrbl index 29e0761968..8851966cb5 100644 --- a/collects/scribblings/reference/pairs.scrbl +++ b/collects/scribblings/reference/pairs.scrbl @@ -7,7 +7,7 @@ @(define (generate-c_r-example proc) (define (make-it start n) - (generator + (generator () (let loop ([start start] [n n]) (yield (list* n start)) diff --git a/collects/scribblings/reference/sequences.scrbl b/collects/scribblings/reference/sequences.scrbl index aac2bc8033..f3bd9ced66 100644 --- a/collects/scribblings/reference/sequences.scrbl +++ b/collects/scribblings/reference/sequences.scrbl @@ -335,7 +335,7 @@ Note: the first form must be @scheme[()], and in the future this will hold argument names that are used in the initial generator call. @examples[#:eval (generator-eval) -(define g (generator +(define g (generator () (let loop ([x '(a b c)]) (if (null? x) 0 @@ -354,7 +354,7 @@ with a stop-value known to the generator. @examples[#:eval (generator-eval) (define my-stop-value (gensym)) -(define my-generator (generator +(define my-generator (generator () (let loop ([x '(a b c)]) (if (null? x) my-stop-value @@ -404,14 +404,14 @@ the arguments to the generator instance. Note that a value cannot be passed back to the generator until after the first @scheme[yield] has been invoked. @examples[#:eval (generator-eval) -(define my-generator (generator (yield 1) (yield 2 3 4))) +(define my-generator (generator () (yield 1) (yield 2 3 4))) (my-generator) (my-generator) ] @examples[#:eval (generator-eval) (define pass-values-generator - (generator + (generator () (let* ([from-user (yield 2)] [from-user-again (yield (add1 from-user))]) (yield from-user-again)))) @@ -436,7 +436,7 @@ of the generator. ] @examples[#:eval (generator-eval) -(define my-generator (generator (yield 1) (yield 2))) +(define my-generator (generator () (yield 1) (yield 2))) (generator-state my-generator) (my-generator) (generator-state my-generator) @@ -445,7 +445,7 @@ of the generator. (my-generator) (generator-state my-generator) -(define introspective-generator (generator ((yield 1)))) +(define introspective-generator (generator () ((yield 1)))) (introspective-generator) (introspective-generator (lambda () (generator-state introspective-generator))) From b2d65a1b95dc192aa0d6bc273565b8f6a2e1a8f7 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 1 Apr 2010 13:14:50 +0000 Subject: [PATCH 053/202] fix the interaction of chaperones, keywords, and the whole zoo of reflective procedure operations svn: r18711 --- collects/scheme/private/kw.ss | 213 +++++++++-- collects/scheme/private/pre-base.ss | 3 +- collects/scribblings/inside/eval.scrbl | 5 +- collects/scribblings/inside/procedures.scrbl | 13 +- .../scribblings/reference/chaperones.scrbl | 37 +- .../scribblings/reference/procedures.scrbl | 9 +- .../reference/struct-inspectors.scrbl | 7 +- collects/tests/future/random-future.ss | 2 +- collects/tests/mzscheme/chaperone.ss | 50 +++ collects/tests/mzscheme/procs.ss | 338 ++++++++++-------- doc/release-notes/mzscheme/HISTORY.txt | 3 + src/mred/gc2/Makefile.in | 3 +- src/mzscheme/include/mzscheme.exp | 1 + src/mzscheme/include/mzscheme3m.exp | 1 + src/mzscheme/include/mzwin.def | 1 + src/mzscheme/include/mzwin3m.def | 1 + src/mzscheme/src/error.c | 5 +- src/mzscheme/src/eval.c | 5 + src/mzscheme/src/fun.c | 31 +- src/mzscheme/src/print.c | 2 + src/mzscheme/src/schemef.h | 2 + src/mzscheme/src/schemex.h | 1 + src/mzscheme/src/schemex.inc | 1 + src/mzscheme/src/schemexm.h | 1 + src/mzscheme/src/struct.c | 2 +- 25 files changed, 526 insertions(+), 211 deletions(-) diff --git a/collects/scheme/private/kw.ss b/collects/scheme/private/kw.ss index 09f93893d1..4d4eb767ca 100644 --- a/collects/scheme/private/kw.ss +++ b/collects/scheme/private/kw.ss @@ -14,9 +14,10 @@ (#%provide new-lambda new-λ new-define new-app - (rename *make-keyword-procedure make-keyword-procedure) + make-keyword-procedure keyword-apply procedure-keywords + new:procedure-reduce-arity procedure-reduce-keyword-arity new-prop:procedure new:procedure->method @@ -25,7 +26,7 @@ ;; ---------------------------------------- - (define-values (struct:keyword-procedure make-keyword-procedure keyword-procedure? + (define-values (struct:keyword-procedure mk-kw-proc keyword-procedure? keyword-procedure-ref keyword-procedure-set!) (make-struct-type 'keyword-procedure #f 4 0 #f (list (cons prop:checked-procedure #t)) @@ -113,7 +114,7 @@ struct:okp 0 0 #f)) - (define-values (prop:named-keyword-procedure named-keyword-procedure? keyword-procedure-name) + (define-values (prop:named-keyword-procedure named-keyword-procedure? keyword-procedure-name+fail) (make-struct-type-property 'named-keyword-procedure)) ;; Constructor generator for a procedure with a required keyword. @@ -123,13 +124,15 @@ ;; the right arity, and that sends all arguments to `missing-kw'. (define (make-required name fail-proc method?) (let-values ([(s: mk ? -ref -set!) - (make-struct-type (string->symbol (format "procedure:~a" name)) + (make-struct-type (or name 'unknown) (if method? struct:keyword-method struct:keyword-procedure) 0 0 #f - (list (cons prop:arity-string generate-arity-string) - (cons prop:named-keyword-procedure name)) + (list (cons prop:arity-string + generate-arity-string) + (cons prop:named-keyword-procedure + (cons name fail-proc))) (current-inspector) fail-proc)]) mk)) @@ -140,21 +143,19 @@ ;; ---------------------------------------- - (define *make-keyword-procedure - (letrec ([make-keyword-procedure - (case-lambda - [(proc) (make-keyword-procedure - proc - (lambda args - (apply proc null null args)))] - [(proc plain-proc) - (make-optional-keyword-procedure - (make-keyword-checker null #f (procedure-arity proc)) - proc - null - #f - plain-proc)])]) - make-keyword-procedure)) + (define make-keyword-procedure + (case-lambda + [(proc) (make-keyword-procedure + proc + (lambda args + (apply proc null null args)))] + [(proc plain-proc) + (make-optional-keyword-procedure + (make-keyword-checker null #f (procedure-arity proc)) + proc + null + #f + plain-proc)])) (define (keyword-apply proc kws kw-vals . normal-argss) (let ([type-error @@ -943,7 +944,7 @@ raise-type-error 'x "x" 0 'x (append args (apply append (map list kws kw-args))))))] [proc-name (lambda (p) (or (and (named-keyword-procedure? p) - (keyword-procedure-name p)) + (car (keyword-procedure-name+fail p))) (object-name p) p))]) (raise @@ -986,13 +987,6 @@ [(null? (cdr kws)) #t] [(keywordmethod (let ([procedure->method (lambda (proc) - (procedure->method proc))]) + (if (keyword-procedure? proc) + (cond + [(okm? proc) proc] + [(keyword-method? proc) proc] + [(okp? proc) (make-optional-keyword-method + (keyword-procedure-checker proc) + (keyword-procedure-proc proc) + (keyword-procedure-required proc) + (keyword-procedure-allowed proc) + (okp-ref proc 0))] + [else + ;; Constructor must be from `make-required', but not a method. + ;; Make a new variant that's a method: + (let* ([name+fail (keyword-procedure-name+fail proc)] + [mk (make-required (car name+fail) (cdr name+fail) #t)]) + (mk + (keyword-procedure-checker proc) + (keyword-procedure-proc proc) + (keyword-procedure-required proc) + (keyword-procedure-allowed proc)))]) + ;; Not a keyword-accepting procedure: + (procedure->method proc)))]) procedure->method)) (define new:procedure-rename @@ -1078,11 +1106,130 @@ (if (not (and (keyword-procedure? proc) (symbol? name))) (procedure-rename proc name) - (procedure-rename proc name)))]) + ;; Rename a keyword procedure: + (cond + [(okp? proc) + ((if (okm? proc) + make-optional-keyword-procedure + make-optional-keyword-method) + (keyword-procedure-checker proc) + (keyword-procedure-proc proc) + (keyword-procedure-required proc) + (keyword-procedure-allowed proc) + (procedure-rename (okp-ref proc 0) name))] + [else + ;; Constructor must be from `make-required': + (let* ([name+fail (keyword-procedure-name+fail proc)] + [mk (make-required name (cdr name+fail) (keyword-method? proc))]) + (mk + (keyword-procedure-checker proc) + (keyword-procedure-proc proc) + (keyword-procedure-required proc) + (keyword-procedure-allowed proc)))])))]) procedure-rename)) (define new:chaperone-procedure (let ([chaperone-procedure (lambda (proc wrap-proc . props) - (apply chaperone-procedure proc wrap-proc props))]) + (if (or (not (keyword-procedure? proc)) + (not (procedure? wrap-proc))) + (apply chaperone-procedure proc wrap-proc props) + (let-values ([(a) (procedure-arity proc)] + [(b) (procedure-arity wrap-proc)] + [(a-req a-allow) (procedure-keywords proc)] + [(b-req b-allow) (procedure-keywords wrap-proc)]) + (define (includes? a b) + (cond + [(number? b) (cond + [(number? a) (= b a)] + [(arity-at-least? a) + (b . >= . (arity-at-least-value a))] + [else + (ormap (lambda (b a) (includes? a b)) + a)])] + [(arity-at-least? b) (cond + [(number? a) #f] + [(arity-at-least? a) + ((arity-at-least-value b) . >= . (arity-at-least-value a))] + [else (ormap (lambda (b a) (includes? b a)) + a)])] + [else (andmap (lambda (b) (includes? a b)) b)])) + + (unless (includes? b a) + ;; Let core report error: + (apply chaperone-procedure proc wrap-proc props)) + (unless (subset? b-req a-req) + (raise-mismatch-error + 'chaperone-procedure + "chaperoning procedure requires more keywords than original procedure: " + proc)) + (unless (or (not b-allow) + (and a-allow + (subset? a-allow b-allow))) + (raise-mismatch-error + 'chaperone-procedure + "chaperoning procedure does not accept all keywords of original procedure: " + proc)) + (let* ([kw-chaperone + (let ([p (keyword-procedure-proc wrap-proc)]) + (lambda (kws args . rest) + (call-with-values (lambda () (apply p kws args rest)) + (lambda results + (let ([len (length results)] + [alen (length rest)]) + (unless (<= (+ alen 1) len (+ alen 2)) + (raise-mismatch-error + '|keyword procedure chaperone| + (format + "expected ~a or ~a results, received ~a results from chaperoning procedure: " + (+ alen 1) + (+ alen 2) + len) + wrap-proc)) + (let ([new-args (car results)]) + (unless (and (list? new-args) + (= (length new-args) (length args))) + (raise-mismatch-error + '|keyword procedure chaperone| + "expected a list of keyword-argument values as first result from chaperoning procedure: " + wrap-proc)) + (for-each + (lambda (kw new-arg arg) + (unless (chaperone-of? new-arg arg) + (raise-mismatch-error + '|keyword procedure chaperone| + (format + "~a keyword result is not a chaperone of original argument from chaperoning procedure: " + kw) + wrap-proc))) + kws + new-args + args)) + (apply values kws results))))))] + [new-proc + (cond + [(okp? proc) + (make-optional-keyword-procedure + (keyword-procedure-checker proc) + (chaperone-procedure (keyword-procedure-proc proc) + kw-chaperone) + (keyword-procedure-required proc) + (keyword-procedure-allowed proc) + (chaperone-procedure (okp-ref proc 0) + (okp-ref wrap-proc 0)))] + [else + ;; Constructor must be from `make-required': + (let* ([name+fail (keyword-procedure-name+fail proc)] + [mk (make-required (car name+fail) (cdr name+fail) (keyword-method? proc))]) + (mk + (keyword-procedure-checker proc) + (chaperone-procedure (keyword-procedure-proc proc) kw-chaperone) + (keyword-procedure-required proc) + (keyword-procedure-allowed proc)))])]) + (if (null? props) + new-proc + (apply chaperone-struct new-proc + ;; chaperone-struct insists on having at least one selector: + keyword-procedure-allowed values + props))))))]) chaperone-procedure))) diff --git a/collects/scheme/private/pre-base.ss b/collects/scheme/private/pre-base.ss index ee2bc2fd32..6984f83c59 100644 --- a/collects/scheme/private/pre-base.ss +++ b/collects/scheme/private/pre-base.ss @@ -73,11 +73,12 @@ (rename module-begin #%module-begin) (rename norm:procedure-arity procedure-arity) (rename norm:raise-arity-error raise-arity-error) + (rename new:procedure-reduce-arity procedure-reduce-arity) (rename new:procedure->method procedure->method) (rename new:procedure-rename procedure-rename) (rename new:chaperone-procedure chaperone-procedure) (all-from-except '#%kernel lambda λ #%app #%module-begin apply prop:procedure - procedure-arity raise-arity-error + procedure-arity procedure-reduce-arity raise-arity-error procedure->method procedure-rename chaperone-procedure) (all-from "reqprov.ss") diff --git a/collects/scribblings/inside/eval.scrbl b/collects/scribblings/inside/eval.scrbl index 8b402766d0..0e5be83fee 100644 --- a/collects/scribblings/inside/eval.scrbl +++ b/collects/scribblings/inside/eval.scrbl @@ -186,7 +186,10 @@ to create new namespaces.} [int c] [Scheme_Object** args])]{ -Applies the procedure @var{f} to the given arguments.} +Applies the procedure @var{f} to the given arguments. + +Beware that the procedure can mutate @var{args} if it is the same as +the result of @cpp{scheme_current_argument_stack}.} @function[(Scheme_Object* scheme_apply_multi [Scheme_Object* f] diff --git a/collects/scribblings/inside/procedures.scrbl b/collects/scribblings/inside/procedures.scrbl index 8d2358c4ad..bc07c8a5c6 100644 --- a/collects/scribblings/inside/procedures.scrbl +++ b/collects/scribblings/inside/procedures.scrbl @@ -17,7 +17,9 @@ of arguments passed to the function will be checked using the arity information. (The arity information provided to @cpp{scheme_make_prim_w_arity} is also used for the Scheme @scheme[arity] procedure.) The procedure implementation is not allowed -to mutate the input array of arguments, although it may mutate the +to mutate the input array of arguments; as an exception, the procedure +can mutate the array if it is the same a the result of +@cpp{scheme_current_argument_stack}. The procedure may mutate the arguments themselves when appropriate (e.g., a fill in a vector argument). @@ -129,3 +131,12 @@ The form of @var{prim} is defined by: Creates a closed primitive procedure value without arity information. This function is provided for backward compatibility only.} + +@function[(Scheme_Object** scheme_current_argument_stack)]{ + +Returns a pointer to an internal stack for argument passing. When the +argument array passed to a procedure corresponds to the current +argument stack address, the procedure is allowed to modify the +array. In particular, it might clear out pointers in the argument +array to allow the arguments to be reclaimed by the memory manager (if +they are not otherwise accessible).} diff --git a/collects/scribblings/reference/chaperones.scrbl b/collects/scribblings/reference/chaperones.scrbl index ac71113d2a..7e0fdb0c45 100644 --- a/collects/scribblings/reference/chaperones.scrbl +++ b/collects/scribblings/reference/chaperones.scrbl @@ -89,24 +89,39 @@ from @scheme[v1] through one of the chaperone constructors (e.g., (and/c procedure? chaperone?)]{ Returns a chaperoned procedure that has the same arity, name, and -other attributes as @scheme[proc]. The arity of @scheme[wrapper-proc] -must include the arity of @scheme[proc]; when the chaperoned procedure -is applied, the arguments are first passed to @scheme[wrapper-proc]. +other attributes as @scheme[proc]. When the chaperoned procedure is +applied, the arguments are first passed to @scheme[wrapper-proc], and +then the results from @scheme[wrapper-proc] are passed to +@scheme[proc]. The @scheme[wrapper-proc] can also supply a procedure +that processes the results of @scheme[proc]. -The result of @scheme[wrapper-proc] must be either the same number of -values as supplied to it or one more than the number of supplied -values. For each supplied value, the corresponding result must be the -same or a chaperone of (in the sense of @scheme[chaperone-of?]) the -supplied value. The additional result, if any, must be a procedure -that accepts as many results as produced by @scheme[proc]; it must -return the same number of results, each of which is the same or a -chaperone of the corresponding original result. +The arity of @scheme[wrapper-proc] must include the arity of +@scheme[proc]. The allowed keyword arguments of @scheme[wrapper-proc] +must be a superset of the allowed keywords of @scheme[proc]. The +required keyword arguments of @scheme[wrapper-proc] must be a subset +of the required keywords of @scheme[proc]. +For applications without keywords, the result of @scheme[wrapper-proc] +must be either the same number of values as supplied to it or one more +than the number of supplied values. For each supplied value, the +corresponding result must be the same or a chaperone of (in the sense +of @scheme[chaperone-of?]) the supplied value. The additional result, +if any, must be a procedure that accepts as many results as produced +by @scheme[proc]; it must return the same number of results, each of +which is the same or a chaperone of the corresponding original result. If @scheme[wrapper-proc] returns the same number of values as it is given (i.e., it does not return a procedure to chaperone @scheme[proc]'s result), then @scheme[proc] is called in @tech{tail position} with respect to the call to the chaperone. +For applications that include keyword arguments, @scheme[wrapper-proc] +must return an additional value before any other values. The +additional value must be a list of chaperones of the keyword arguments +that were supplied to the chaperoned procedure (i.e., not counting +optional arguments that were not supplied). The arguments must be +ordered according to the sorted order of the supplied arguments' +keywords. + Pairs of @scheme[prop] and @scheme[prop-val] (the number of arguments to @scheme[procedure-chaperone] must be even) add chaperone properties or override chaperone-property values of @scheme[proc].} diff --git a/collects/scribblings/reference/procedures.scrbl b/collects/scribblings/reference/procedures.scrbl index a2d4b5cf5f..ecf93afbf5 100644 --- a/collects/scribblings/reference/procedures.scrbl +++ b/collects/scribblings/reference/procedures.scrbl @@ -176,8 +176,13 @@ when @scheme[procedure-arity] is applied to the generated procedure, it returns a value that is @scheme[equal?] to @scheme[arity]. -If the @scheme[arity] specification allows arguments that are not -in @scheme[(procedure-arity proc)], the @exnraise[exn:fail:contract]. +If the @scheme[arity] specification allows arguments that are not in +@scheme[(procedure-arity proc)], the @exnraise[exn:fail:contract]. If +@scheme[proc] accepts keyword argument, either the keyword arguments +must be all optional (and they are not accepted in by the +arity-reduced procedure) or @scheme[arity] must be the empty list +(which makes a procedure that cannot be called); otherwise, the +@exnraise[exn:fail:contract]. @examples[ (define my+ (procedure-reduce-arity + 2)) diff --git a/collects/scribblings/reference/struct-inspectors.scrbl b/collects/scribblings/reference/struct-inspectors.scrbl index e193e33860..e96795ff1d 100644 --- a/collects/scribblings/reference/struct-inspectors.scrbl +++ b/collects/scribblings/reference/struct-inspectors.scrbl @@ -150,8 +150,11 @@ The name (if any) of a procedure is always a symbol. The name. The name of a @tech{structure}, @tech{structure type}, @tech{structure -type property} is always a symbol. If a @tech{structure} is not a -procedure, its name matches the name of the @tech{structure type} that +type property} is always a symbol. If a @tech{structure} is a +procedure as implemented by one of its fields (i.e., the +@scheme[prop:procedure] property value for the structure's type is an +integer), then its name is the implementing procedure's name; +otherwise, its name matches the name of the @tech{structure type} that it instantiates. The name of a @tech{regexp value} is a string or byte string. Passing diff --git a/collects/tests/future/random-future.ss b/collects/tests/future/random-future.ss index a9659b290c..53b74c9526 100644 --- a/collects/tests/future/random-future.ss +++ b/collects/tests/future/random-future.ss @@ -182,7 +182,7 @@ Errors/exceptions and other kinds of control? (gen-exp))])) (define-namespace-anchor ns-here) -(let ([seed (+ 1 (random (expt 2 30)))]) +(let ([seed 595933061 #;(+ 1 (random (expt 2 30)))]) (printf "DrDr Ignore! random-seed ~s\n" seed) (random-seed seed)) diff --git a/collects/tests/mzscheme/chaperone.ss b/collects/tests/mzscheme/chaperone.ss index d3e22b0af1..73f3a592a8 100644 --- a/collects/tests/mzscheme/chaperone.ss +++ b/collects/tests/mzscheme/chaperone.ss @@ -172,6 +172,56 @@ (test (vector 'a 'b 'c) values in) (test (vector 'b '(a c)) values out)) +;; Optional keyword arguments: +(let* ([f (lambda (x #:a [a 'a] #:b [b 'b]) (list x a b))] + [in #f] + [f2 (chaperone-procedure + f + (lambda (x #:a [a 'nope] #:b [b 'nope]) + (if (and (eq? a 'nope) (eq? b 'nope)) + x + (values + (append + (if (eq? a 'nope) null (list a)) + (if (eq? b 'nope) null (list b))) + x))))]) + (test '(1 a b) f 1) + (test '(1 a b) f2 1) + (test '(1 2 b) f 1 #:a 2) + (test '(1 2 b) f2 1 #:a 2) + (test '(1 a 3) f 1 #:b 3) + (test '(1 a 3) f2 1 #:b 3) + (test '(1 2 3) f 1 #:a 2 #:b 3) + (test '(1 2 3) f2 1 #:a 2 #:b 3) + (test 1 procedure-arity f2) + (test 'f object-name f2) + (test-values '(() (#:a #:b)) (lambda () (procedure-keywords f2)))) + +;; Required keyword arguments: +(let* ([f (lambda (x #:a [a 'a] #:b b) (list x a b))] + [in #f] + [f2 (chaperone-procedure + f + (lambda (x #:a [a 'nope] #:b [b 'nope]) + (if (and (eq? a 'nope) (eq? b 'nope)) + x + (values + (append + (if (eq? a 'nope) null (list a)) + (if (eq? b 'nope) null (list b))) + x))))]) + (err/rt-test (f 1)) + (err/rt-test (f2 1)) + (err/rt-test (f 1 #:a 2)) + (err/rt-test (f2 1 #:a 2)) + (test '(1 a 3) f 1 #:b 3) + (test '(1 a 3) f2 1 #:b 3) + (test '(1 2 3) f 1 #:a 2 #:b 3) + (test '(1 2 3) f2 1 #:a 2 #:b 3) + (test 1 procedure-arity f2) + (test 'f object-name f2) + (test-values '((#:b) (#:a #:b)) (lambda () (procedure-keywords f2)))) + (err/rt-test ((chaperone-procedure (lambda (x) x) (lambda (y) (values y y))) 1)) (err/rt-test ((chaperone-procedure (lambda (x) x) (lambda (y) (values y y y))) 1)) (err/rt-test ((chaperone-procedure (lambda (x) (values x x)) (lambda (y) y))) 1) diff --git a/collects/tests/mzscheme/procs.ss b/collects/tests/mzscheme/procs.ss index 0d2991a598..4b665ab46f 100644 --- a/collects/tests/mzscheme/procs.ss +++ b/collects/tests/mzscheme/procs.ss @@ -65,160 +65,190 @@ (,f_0_2+ ,(list 0 (make-arity-at-least 2)) () ()) (,f1:+ 1 () #f))) -(for-each (lambda (p) - (let ([a (cadr p)]) - (test a procedure-arity (car p)) - (test-values (list (caddr p) (cadddr p)) - (lambda () - (procedure-keywords (car p)))) - (let ([1-ok? (let loop ([a a]) - (or (equal? a 1) - (and (arity-at-least? a) - ((arity-at-least-value a) . <= . 1)) - (and (list? a) - (ormap loop a))))]) - (test 1-ok? procedure-arity-includes? (car p) 1) - (let ([allowed (cadddr p)] - [required (caddr p)]) - ;; If some keyword is required, make sure that a plain - ;; application fails: - (unless (null? required) - (err/rt-test - (apply (car p) (make-list (procedure-arity (car p)) #\0)))) - ;; Other tests: - (if 1-ok? - (cond - [(equal? allowed '()) - (test (let ([auto (cddddr p)]) - (cond - [(equal? auto '((#:a #:b))) '(1 0 1)] - [(equal? auto '((#:a))) '(1 0)] - [(equal? auto '((#:a))) '(1 0)] - [else '(1)])) - (car p) 1) - (err/rt-test ((car p) 1 #:a 0)) - (err/rt-test ((car p) 1 #:b 0)) - (err/rt-test ((car p) 1 #:a 0 #:b 0))] - [(equal? allowed '(#:a)) - (test (if (pair? (cddddr p)) - '(10 20 1) ; dropped #:b - '(10 20)) - (car p) 10 #:a 20) - (err/rt-test ((car p) 1 #:b 0)) - (err/rt-test ((car p) 1 #:a 0 #:b 0))] - [(equal? allowed '(#:b)) - (test '(10.0 20.0) (car p) 10.0 #:b 20.0) - (err/rt-test ((car p) 1 #:a 0)) - (err/rt-test ((car p) 1 #:a 0 #:b 0))] - [(equal? allowed '(#:a #:b)) - (test '(100 200 300) (car p) 100 #:b 300 #:a 200) - (err/rt-test ((car p) 1 #:a 0 #:b 0 #:c 3))] - [(equal? allowed #f) - (test '(1 2 3) (car p) 1 #:b 3 #:a 2)]) - (begin - ;; Try just 1: - (err/rt-test ((car p) 1)) - ;; Try with right keyword args, to make sure the by-position - ;; arity is checked: - (cond - [(equal? allowed '()) - (void)] - [(equal? allowed '(#:a)) - (err/rt-test ((car p) 1 #:a 1))] - [(equal? allowed '(#:b)) - (err/rt-test ((car p) 1 #:b 1))] - [(equal? allowed '(#:a #:b)) - (err/rt-test ((car p) 1 #:a 1 #:b 1))] - [(equal? allowed #f) - (err/rt-test ((car p) 1 #:a 1 #:b 1))]))))))) - (append procs - ;; reduce to arity 1 or nothing: - (map (lambda (p) - (let ([p (car p)]) - (let-values ([(req allowed) (procedure-keywords p)]) - (if (null? allowed) - (if (procedure-arity-includes? p 1) - (list (procedure-reduce-arity p 1) 1 req allowed) - (list (procedure-reduce-arity p '()) '() req allowed)) - (if (procedure-arity-includes? p 1) - (list (procedure-reduce-keyword-arity p 1 req allowed) 1 req allowed) - (list (procedure-reduce-keyword-arity p '() req allowed) '() req allowed)))))) - procs) - ;; reduce to arity 0 or nothing: - (map (lambda (p) - (let ([p (car p)]) - (let-values ([(req allowed) (procedure-keywords p)]) - (if (null? allowed) - (if (procedure-arity-includes? p 0) - (list (procedure-reduce-arity p 0) 0 req allowed) - (list (procedure-reduce-arity p '()) '() req allowed)) - (if (procedure-arity-includes? p 0) - (list (procedure-reduce-keyword-arity p 0 req allowed) 0 req allowed) - (list (procedure-reduce-keyword-arity p '() req allowed) '() req allowed)))))) - procs) - ;; reduce to arity 1 or nothing --- no keywords: - (map (lambda (p) - (let ([p (car p)]) - (let-values ([(req allowed) (procedure-keywords p)]) - (if (and (procedure-arity-includes? p 1) - (null? req)) - (list* (procedure-reduce-arity p 1) 1 '() '() - (if (null? allowed) - null - (list allowed))) - (list (procedure-reduce-arity p '()) '() '() '()))))) - procs) - ;; reduce to arity 0 or nothing --- no keywords: - (map (lambda (p) - (let ([p (car p)]) - (let-values ([(req allowed) (procedure-keywords p)]) - (if (and (procedure-arity-includes? p 0) - (null? req)) - (list (procedure-reduce-arity p 0) 0 '() '()) - (list (procedure-reduce-arity p '()) '() '() '()))))) - procs) - ;; make #:a required, if possible: - (map (lambda (p) - (let-values ([(req allowed) (procedure-keywords (car p))]) - (let ([new-req (if (member '#:a req) - req - (cons '#:a req))]) - (list (procedure-reduce-keyword-arity - (car p) - (cadr p) - new-req - allowed) - (cadr p) - new-req - allowed)))) - (filter (lambda (p) - (let-values ([(req allowed) (procedure-keywords (car p))]) - (or (not allowed) - (memq '#:a allowed)))) - procs)) - ;; remove #:b, if allowed and not required: - (map (lambda (p) - (let-values ([(req allowed) (procedure-keywords (car p))]) - (let ([new-allowed (if allowed - (remove '#:b allowed) - '(#:a))]) - (list* (procedure-reduce-keyword-arity - (car p) - (cadr p) - req - new-allowed) - (cadr p) - req - new-allowed - (if allowed - (list allowed) - '()))))) - (filter (lambda (p) - (let-values ([(req allowed) (procedure-keywords (car p))]) - (and (or (not allowed) - (memq '#:b allowed)) - (not (memq '#:b req))))) - procs)))) +(let () + (define (try-combos procs add-chaperone) + (for-each (lambda (p) + (let ([a (cadr p)]) + (test a procedure-arity (car p)) + (test-values (list (caddr p) (cadddr p)) + (lambda () + (procedure-keywords (car p)))) + (let ([1-ok? (let loop ([a a]) + (or (equal? a 1) + (and (arity-at-least? a) + ((arity-at-least-value a) . <= . 1)) + (and (list? a) + (ormap loop a))))]) + (test 1-ok? procedure-arity-includes? (car p) 1) + ;; While we're here test renaming, etc.: + (test 'other object-name (procedure-rename (car p) 'other)) + (test (procedure-arity (car p)) procedure-arity (procedure-rename (car p) 'other)) + (test (procedure-arity (car p)) procedure-arity (procedure->method (car p))) + (unless (null? (list-tail p 4)) + (test (object-name (list-ref p 4)) object-name (car p))) + (let ([allowed (cadddr p)] + [required (caddr p)]) + ;; If some keyword is required, make sure that a plain + ;; application fails: + (unless (null? required) + (err/rt-test + (apply (car p) (make-list (procedure-arity (car p)) #\0)))) + ;; Other tests: + (if 1-ok? + (cond + [(equal? allowed '()) + (test (let ([auto (let ([q (cddddr p)]) + (if (null? q) + q + (cdr q)))]) + (cond + [(equal? auto '((#:a #:b))) '(1 0 1)] + [(equal? auto '((#:a))) '(1 0)] + [(equal? auto '((#:a))) '(1 0)] + [else '(1)])) + (car p) 1) + (err/rt-test ((car p) 1 #:a 0)) + (err/rt-test ((car p) 1 #:b 0)) + (err/rt-test ((car p) 1 #:a 0 #:b 0))] + [(equal? allowed '(#:a)) + (test (if (and (pair? (cddddr p)) + (pair? (cddddr (cdr p)))) + '(10 20 1) ; dropped #:b + '(10 20)) + (car p) 10 #:a 20) + (err/rt-test ((car p) 1 #:b 0)) + (err/rt-test ((car p) 1 #:a 0 #:b 0))] + [(equal? allowed '(#:b)) + (test '(10.0 20.0) (car p) 10.0 #:b 20.0) + (err/rt-test ((car p) 1 #:a 0)) + (err/rt-test ((car p) 1 #:a 0 #:b 0))] + [(equal? allowed '(#:a #:b)) + (test '(100 200 300) (car p) 100 #:b 300 #:a 200) + (err/rt-test ((car p) 1 #:a 0 #:b 0 #:c 3))] + [(equal? allowed #f) + (test '(1 2 3) (car p) 1 #:b 3 #:a 2)]) + (begin + ;; Try just 1: + (err/rt-test ((car p) 1)) + ;; Try with right keyword args, to make sure the by-position + ;; arity is checked: + (cond + [(equal? allowed '()) + (void)] + [(equal? allowed '(#:a)) + (err/rt-test ((car p) 1 #:a 1))] + [(equal? allowed '(#:b)) + (err/rt-test ((car p) 1 #:b 1))] + [(equal? allowed '(#:a #:b)) + (err/rt-test ((car p) 1 #:a 1 #:b 1))] + [(equal? allowed #f) + (err/rt-test ((car p) 1 #:a 1 #:b 1))]))))))) + (map + add-chaperone + (append procs + ;; reduce to arity 1 or nothing: + (map (lambda (p) + (let ([p (car p)]) + (let-values ([(req allowed) (procedure-keywords p)]) + (if (null? allowed) + (if (procedure-arity-includes? p 1) + (list (procedure-reduce-arity p 1) 1 req allowed p) + (list (procedure-reduce-arity p '()) '() req allowed p)) + (if (procedure-arity-includes? p 1) + (list (procedure-reduce-keyword-arity p 1 req allowed) 1 req allowed p) + (list (procedure-reduce-keyword-arity p '() req allowed) '() req allowed p)))))) + procs) + ;; reduce to arity 0 or nothing: + (map (lambda (p) + (let ([p (car p)]) + (let-values ([(req allowed) (procedure-keywords p)]) + (if (null? allowed) + (if (procedure-arity-includes? p 0) + (list (procedure-reduce-arity p 0) 0 req allowed p) + (list (procedure-reduce-arity p '()) '() req allowed p)) + (if (procedure-arity-includes? p 0) + (list (procedure-reduce-keyword-arity p 0 req allowed) 0 req allowed p) + (list (procedure-reduce-keyword-arity p '() req allowed) '() req allowed p)))))) + procs) + ;; reduce to arity 1 or nothing --- no keywords: + (map (lambda (p) + (let ([p (car p)]) + (let-values ([(req allowed) (procedure-keywords p)]) + (if (and (procedure-arity-includes? p 1) + (null? req)) + (list* (procedure-reduce-arity p 1) 1 '() '() p + (if (null? allowed) + null + (list allowed))) + (list (procedure-reduce-arity p '()) '() '() '() p))))) + procs) + ;; reduce to arity 0 or nothing --- no keywords: + (map (lambda (p) + (let ([p (car p)]) + (let-values ([(req allowed) (procedure-keywords p)]) + (if (and (procedure-arity-includes? p 0) + (null? req)) + (list (procedure-reduce-arity p 0) 0 '() '() p) + (list (procedure-reduce-arity p '()) '() '() '() p))))) + procs) + ;; make #:a required, if possible: + (map (lambda (p) + (let-values ([(req allowed) (procedure-keywords (car p))]) + (let ([new-req (if (member '#:a req) + req + (cons '#:a req))]) + (list (procedure-reduce-keyword-arity + (car p) + (cadr p) + new-req + allowed) + (cadr p) + new-req + allowed + (car p))))) + (filter (lambda (p) + (let-values ([(req allowed) (procedure-keywords (car p))]) + (or (not allowed) + (memq '#:a allowed)))) + procs)) + ;; remove #:b, if allowed and not required: + (map (lambda (p) + (let-values ([(req allowed) (procedure-keywords (car p))]) + (let ([new-allowed (if allowed + (remove '#:b allowed) + '(#:a))]) + (list* (procedure-reduce-keyword-arity + (car p) + (cadr p) + req + new-allowed) + (cadr p) + req + new-allowed + (car p) + (if allowed + (list allowed) + '()))))) + (filter (lambda (p) + (let-values ([(req allowed) (procedure-keywords (car p))]) + (and (or (not allowed) + (memq '#:b allowed)) + (not (memq '#:b req))))) + procs)))))) + (try-combos procs values) + (let ([add-chaperone (lambda (p) + (cons + (chaperone-procedure + (car p) + (make-keyword-procedure + (lambda (kws kw-args . rest) + (if (null? kws) + (apply values rest) + (apply values kw-args rest))))) + (cdr p)))]) + (try-combos procs add-chaperone) + (try-combos (map add-chaperone procs) values) + (try-combos (map add-chaperone procs) add-chaperone))) ;; ---------------------------------------- diff --git a/doc/release-notes/mzscheme/HISTORY.txt b/doc/release-notes/mzscheme/HISTORY.txt index 1e0861912c..784b23e895 100644 --- a/doc/release-notes/mzscheme/HISTORY.txt +++ b/doc/release-notes/mzscheme/HISTORY.txt @@ -1,3 +1,6 @@ +Version 4.2.5.3 +Added chaperones + Version 4.2.5, March 2010 Added scheme/future, enabled by default on main platforms Changed module to wrap each body expression in a prompt diff --git a/src/mred/gc2/Makefile.in b/src/mred/gc2/Makefile.in index acfe23dcd8..5f412baa37 100644 --- a/src/mred/gc2/Makefile.in +++ b/src/mred/gc2/Makefile.in @@ -215,7 +215,8 @@ xsrc/wx_xbm.cc: $(WXDIR)/utils/image/src/wx_xbm.cc $(XFORMDEP) MACXPRECOMP = macxsrc/xform_precomp.h MACXPRECOMPDEP = -macxsrc/xform_precomp.h : $(XFORMDEP) $(srcdir)/macprecomp.cxx $(srcdir)/../../mzscheme/src/schvers.h +macxsrc/xform_precomp.h : $(XFORMDEP) $(srcdir)/macprecomp.cxx $(srcdir)/../../mzscheme/src/schvers.h \ + $(srcdir)/../../mzscheme/src/schemef.h env XFORM_PRECOMP=yes $(XFORMXX) $(MACXPRECOMP) $(srcdir)/macprecomp.cxx @INCLUDEDEP@ macprecomp.dd diff --git a/src/mzscheme/include/mzscheme.exp b/src/mzscheme/include/mzscheme.exp index 69ce8eb2cb..91f78c03b3 100644 --- a/src/mzscheme/include/mzscheme.exp +++ b/src/mzscheme/include/mzscheme.exp @@ -151,6 +151,7 @@ _scheme_apply_known_prim_closure _scheme_apply_known_prim_closure_multi _scheme_apply_prim_closure _scheme_apply_prim_closure_multi +scheme_current_argument_stack scheme_call_with_prompt scheme_call_with_prompt_multi _scheme_call_with_prompt diff --git a/src/mzscheme/include/mzscheme3m.exp b/src/mzscheme/include/mzscheme3m.exp index 17b5aed4c7..71c67b4651 100644 --- a/src/mzscheme/include/mzscheme3m.exp +++ b/src/mzscheme/include/mzscheme3m.exp @@ -151,6 +151,7 @@ _scheme_apply_known_prim_closure _scheme_apply_known_prim_closure_multi _scheme_apply_prim_closure _scheme_apply_prim_closure_multi +scheme_current_argument_stack scheme_call_with_prompt scheme_call_with_prompt_multi _scheme_call_with_prompt diff --git a/src/mzscheme/include/mzwin.def b/src/mzscheme/include/mzwin.def index ed148f3095..02bb57de57 100644 --- a/src/mzscheme/include/mzwin.def +++ b/src/mzscheme/include/mzwin.def @@ -145,6 +145,7 @@ EXPORTS scheme_eval_string_multi_with_prompt scheme_eval_string_all_with_prompt scheme_eval_module_string + scheme_current_argument_stack scheme_call_with_prompt scheme_call_with_prompt_multi scheme_values diff --git a/src/mzscheme/include/mzwin3m.def b/src/mzscheme/include/mzwin3m.def index b8b2141e4b..2e4e43b6f2 100644 --- a/src/mzscheme/include/mzwin3m.def +++ b/src/mzscheme/include/mzwin3m.def @@ -145,6 +145,7 @@ EXPORTS scheme_eval_string_multi_with_prompt scheme_eval_string_all_with_prompt scheme_eval_module_string + scheme_current_argument_stack scheme_call_with_prompt scheme_call_with_prompt_multi scheme_values diff --git a/src/mzscheme/src/error.c b/src/mzscheme/src/error.c index 463f87770a..405c73a616 100644 --- a/src/mzscheme/src/error.c +++ b/src/mzscheme/src/error.c @@ -991,7 +991,10 @@ static char *make_arity_expect_string(const char *name, int namelen, } else { Scheme_Object *v; int is_method; - v = scheme_extract_struct_procedure((Scheme_Object *)name, -1, NULL, &is_method); + v = (Scheme_Object *)name; + if (SCHEME_CHAPERONEP(v)) + v = SCHEME_CHAPERONE_VAL(v); + v = scheme_extract_struct_procedure(v, -1, NULL, &is_method); if (!v || is_method || !SCHEME_CHAPERONE_PROC_STRUCTP(v)) break; name = (const char *)v; diff --git a/src/mzscheme/src/eval.c b/src/mzscheme/src/eval.c index 433b7df1e3..479584551e 100644 --- a/src/mzscheme/src/eval.c +++ b/src/mzscheme/src/eval.c @@ -9941,6 +9941,11 @@ scheme_do_eval(Scheme_Object *obj, int num_rands, Scheme_Object **rands, #endif } +Scheme_Object **scheme_current_argument_stack() +{ + return MZ_RUNSTACK; +} + /*========================================================================*/ /* eval/compile/expand starting points */ /*========================================================================*/ diff --git a/src/mzscheme/src/fun.c b/src/mzscheme/src/fun.c index 21d48811fd..003123ba7e 100644 --- a/src/mzscheme/src/fun.c +++ b/src/mzscheme/src/fun.c @@ -3352,6 +3352,8 @@ Scheme_Object *scheme_proc_struct_name_source(Scheme_Object *a) /* Either use struct name, or extract proc, depending whether it's method-style */ int is_method; + if (SCHEME_CHAPERONEP(a)) + a = SCHEME_CHAPERONE_VAL(a); b = scheme_extract_struct_procedure(a, -1, NULL, &is_method); if (!is_method && SCHEME_PROCP(b)) { a = b; @@ -4074,8 +4076,23 @@ static Scheme_Object *do_apply_chaperone(Scheme_Object *o, int argc, Scheme_Obje Scheme_Object *scheme_apply_chaperone(Scheme_Object *o, int argc, Scheme_Object **argv, Scheme_Object *auto_val) { Scheme_Chaperone *px = (Scheme_Chaperone *)o; - Scheme_Object *v, *a[1], *a2[1], **argv2, *post, *result_v; - int c, i; + Scheme_Object *v, *a[1], *a2[3], **argv2, *post, *result_v; + int c, i, need_restore = 0; + + if (argv == MZ_RUNSTACK) { + /* Pushing onto the runstack ensures that px->redirects won't + modify argv. */ + if (MZ_RUNSTACK > MZ_RUNSTACK_START) { + --MZ_RUNSTACK; + *MZ_RUNSTACK = NULL; + need_restore = 1; + } else { + /* Can't push! Just allocate a copy. */ + argv2 = MALLOC_N(Scheme_Object *, argc); + memcpy(argv2, argv, sizeof(Scheme_Object*) * argc); + argv = argv2; + } + } v = _scheme_apply_multi(px->redirects, argc, argv); if (v == SCHEME_MULTIPLE_VALUES) { @@ -4114,6 +4131,16 @@ Scheme_Object *scheme_apply_chaperone(Scheme_Object *o, int argc, Scheme_Object return NULL; } + if (need_restore) { + /* As a step toward space safety, even clear out the arguments + form the runstack: */ + MZ_RUNSTACK++; + for (i = 0; i < argc; i++) { + argv[i] = NULL; + } + } else + argv = NULL; + if (c == argc) { /* No filter for the result, so tail call: */ if (auto_val) { diff --git a/src/mzscheme/src/print.c b/src/mzscheme/src/print.c index fc04d7a1be..9ab63349db 100644 --- a/src/mzscheme/src/print.c +++ b/src/mzscheme/src/print.c @@ -2091,6 +2091,8 @@ print(Scheme_Object *obj, int notdisplay, int compact, Scheme_Hash_Table *ht, print_utf8_string(pp, "procedure:", 0, 10); name = ((Scheme_Structure *)obj)->slots[2]; } else { + if (SCHEME_PROCP(obj)) + print_utf8_string(pp, "procedure:", 0, 10); name = SCHEME_STRUCT_NAME_SYM(obj); } diff --git a/src/mzscheme/src/schemef.h b/src/mzscheme/src/schemef.h index ba1efbead8..4119ca7994 100644 --- a/src/mzscheme/src/schemef.h +++ b/src/mzscheme/src/schemef.h @@ -298,6 +298,8 @@ MZ_EXTERN Scheme_Object *_scheme_apply_prim_closure(Scheme_Object *rator, int ar MZ_EXTERN Scheme_Object *_scheme_apply_prim_closure_multi(Scheme_Object *rator, int argc, Scheme_Object **argv); +MZ_EXTERN Scheme_Object **scheme_current_argument_stack(); + MZ_EXTERN Scheme_Object *scheme_call_with_prompt(Scheme_Closed_Prim f, void *data); MZ_EXTERN Scheme_Object *scheme_call_with_prompt_multi(Scheme_Closed_Prim f, void *data); MZ_EXTERN Scheme_Object *_scheme_call_with_prompt(Scheme_Closed_Prim f, void *data); diff --git a/src/mzscheme/src/schemex.h b/src/mzscheme/src/schemex.h index 17368b8e5d..beb3a3305d 100644 --- a/src/mzscheme/src/schemex.h +++ b/src/mzscheme/src/schemex.h @@ -243,6 +243,7 @@ Scheme_Object *(*_scheme_apply_prim_closure)(Scheme_Object *rator, int argc, Scheme_Object **argv); Scheme_Object *(*_scheme_apply_prim_closure_multi)(Scheme_Object *rator, int argc, Scheme_Object **argv); +Scheme_Object **(*scheme_current_argument_stack)(); Scheme_Object *(*scheme_call_with_prompt)(Scheme_Closed_Prim f, void *data); Scheme_Object *(*scheme_call_with_prompt_multi)(Scheme_Closed_Prim f, void *data); Scheme_Object *(*_scheme_call_with_prompt)(Scheme_Closed_Prim f, void *data); diff --git a/src/mzscheme/src/schemex.inc b/src/mzscheme/src/schemex.inc index be68d0aecf..b1bffe1462 100644 --- a/src/mzscheme/src/schemex.inc +++ b/src/mzscheme/src/schemex.inc @@ -159,6 +159,7 @@ scheme_extension_table->_scheme_apply_known_prim_closure_multi = _scheme_apply_known_prim_closure_multi; scheme_extension_table->_scheme_apply_prim_closure = _scheme_apply_prim_closure; scheme_extension_table->_scheme_apply_prim_closure_multi = _scheme_apply_prim_closure_multi; + scheme_extension_table->scheme_current_argument_stack = scheme_current_argument_stack; scheme_extension_table->scheme_call_with_prompt = scheme_call_with_prompt; scheme_extension_table->scheme_call_with_prompt_multi = scheme_call_with_prompt_multi; scheme_extension_table->_scheme_call_with_prompt = _scheme_call_with_prompt; diff --git a/src/mzscheme/src/schemexm.h b/src/mzscheme/src/schemexm.h index d3ee7e64da..dd3d1af0de 100644 --- a/src/mzscheme/src/schemexm.h +++ b/src/mzscheme/src/schemexm.h @@ -159,6 +159,7 @@ #define _scheme_apply_known_prim_closure_multi (scheme_extension_table->_scheme_apply_known_prim_closure_multi) #define _scheme_apply_prim_closure (scheme_extension_table->_scheme_apply_prim_closure) #define _scheme_apply_prim_closure_multi (scheme_extension_table->_scheme_apply_prim_closure_multi) +#define scheme_current_argument_stack (scheme_extension_table->scheme_current_argument_stack) #define scheme_call_with_prompt (scheme_extension_table->scheme_call_with_prompt) #define scheme_call_with_prompt_multi (scheme_extension_table->scheme_call_with_prompt_multi) #define _scheme_call_with_prompt (scheme_extension_table->_scheme_call_with_prompt) diff --git a/src/mzscheme/src/struct.c b/src/mzscheme/src/struct.c index 3e9dd33ebe..589972109e 100644 --- a/src/mzscheme/src/struct.c +++ b/src/mzscheme/src/struct.c @@ -4347,7 +4347,7 @@ static Scheme_Object *procedure_extract_target(int argc, Scheme_Object **argv) if (!SCHEME_PROCP(argv[0])) scheme_wrong_type("procedure-extract-target", "procedure", 0, argc, argv); - if (SCHEME_CHAPERONE_STRUCTP(argv[0])) { + if (SCHEME_STRUCTP(argv[0])) { /* don't allow chaperones */ /* Don't expose arity reducer: */ if (scheme_reduced_procedure_struct && scheme_is_struct_instance(scheme_reduced_procedure_struct, argv[0])) From e0b9bbeba838608414c14f99719a7e2ad9c63f63 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 1 Apr 2010 13:54:56 +0000 Subject: [PATCH 054/202] apply patch from Tim Wiess to make the Boehm GC build on OpenBSD svn: r18712 --- src/mzscheme/gc/Makefile.in | 9 +- src/mzscheme/gc/doc/gc.man | 44 +++- src/mzscheme/gc/dyn_load.c | 6 +- src/mzscheme/gc/include/gc_config_macros.h | 6 +- src/mzscheme/gc/include/private/gcconfig.h | 188 +++++++++++++++--- .../gc/include/private/openbsd_stop_world.h | 12 ++ src/mzscheme/gc/mach_dep.c | 4 +- src/mzscheme/gc/misc.c | 2 +- src/mzscheme/gc/openbsd_stop_world.c | 162 +++++++++++++++ src/mzscheme/gc/os_dep.c | 156 ++++++++++++++- src/mzscheme/gc/pthread_stop_world.c | 2 +- src/mzscheme/gc/pthread_support.c | 13 +- src/mzscheme/gc/tests/test.c | 3 +- src/mzscheme/gc/threadlibs.c | 3 + 14 files changed, 560 insertions(+), 50 deletions(-) create mode 100644 src/mzscheme/gc/include/private/openbsd_stop_world.h create mode 100644 src/mzscheme/gc/openbsd_stop_world.c diff --git a/src/mzscheme/gc/Makefile.in b/src/mzscheme/gc/Makefile.in index 045230473a..c44038fee1 100644 --- a/src/mzscheme/gc/Makefile.in +++ b/src/mzscheme/gc/Makefile.in @@ -345,14 +345,14 @@ OBJS= alloc.@LTO@ reclaim.@LTO@ allchblk.@LTO@ misc.@LTO@ mach_dep.@LTO@ mach_de headers.@LTO@ mark.@LTO@ obj_map.@LTO@ blacklst.@LTO@ finalize.@LTO@ new_hblk.@LTO@ dbg_mlc.@LTO@ \ malloc.@LTO@ stubborn.@LTO@ checksums.@LTO@ pthread_support.@LTO@ pthread_stop_world.@LTO@ \ darwin_stop_world.@LTO@ typd_mlc.@LTO@ ptr_chck.@LTO@ mallocx.@LTO@ gcj_mlc.@LTO@ specific.@LTO@ \ - gc_dlopen.@LTO@ backgraph.@LTO@ win32_threads.@LTO@ thread_local_alloc.@LTO@ + gc_dlopen.@LTO@ backgraph.@LTO@ win32_threads.@LTO@ thread_local_alloc.@LTO@ openbsd_stop_world.@LTO@ CSRCS= reclaim.c allchblk.c misc.c alloc.c mach_dep.c mach_dep1.c os_dep.c mark_rts.c \ headers.c mark.c obj_map.c pcr_interface.c blacklst.c finalize.c \ new_hblk.c real_malloc.c dyn_load.c dbg_mlc.c malloc.c stubborn.c \ checksums.c pthread_support.c pthread_stop_world.c darwin_stop_world.c \ typd_mlc.c ptr_chck.c mallocx.c gcj_mlc.c specific.c gc_dlopen.c \ - backgraph.c win32_threads.c thread_local_alloc.c + backgraph.c win32_threads.c thread_local_alloc.c openbsd_stop_world.c CORD_SRCS= cord/cordbscs.c cord/cordxtra.c cord/cordprnt.c cord/de.c cord/cordtest.c include/cord.h include/ec.h include/private/cord_pos.h cord/de_win.c cord/de_win.h cord/de_cmds.h cord/de_win.ICO cord/de_win.RC @@ -377,7 +377,7 @@ SRCS= $(CSRCS) mips_sgi_mach_dep.s rs6000_mach_dep.s alpha_mach_dep.S \ include/gc_config_macros.h include/private/pthread_support.h \ include/private/pthread_stop_world.h include/private/darwin_semaphore.h \ include/private/darwin_stop_world.h include/private/thread_local_alloc.h \ - $(CORD_SRCS) + include/private/openbsd_stop_world.h $(CORD_SRCS) DOC_FILES= README.QUICK doc/README.Mac doc/README.MacOSX doc/README.O2 \ doc/README.amiga doc/README.cords doc/debugging.html \ @@ -816,6 +816,9 @@ pthread_stop_world.@LTO@: $(srcdir)/pthread_stop_world.c darwin_stop_world.@LTO@: $(srcdir)/darwin_stop_world.c $(CC) $(CFLAGS) -c $(srcdir)/darwin_stop_world.c +openbsd_stop_world.@LTO@: $(srcdir)/openbsd_stop_world.c + $(CC) $(CFLAGS) -c $(srcdir)/openbsd_stop_world.c + backgraph.@LTO@: $(srcdir)/backgraph.c $(CC) $(CFLAGS) -c $(srcdir)/backgraph.c diff --git a/src/mzscheme/gc/doc/gc.man b/src/mzscheme/gc/doc/gc.man index 2a550c7124..558759d3f3 100644 --- a/src/mzscheme/gc/doc/gc.man +++ b/src/mzscheme/gc/doc/gc.man @@ -1,4 +1,4 @@ -.TH GC_MALLOC 1L "2 October 2003" +.TH GC_MALLOC 3 "2 October 2003" .SH NAME GC_malloc, GC_malloc_atomic, GC_free, GC_realloc, GC_enable_incremental, GC_register_finalizer, GC_malloc_ignore_off_page, GC_malloc_atomic_ignore_off_page, GC_set_warn_proc \- Garbage collecting malloc replacement .SH SYNOPSIS @@ -82,6 +82,48 @@ This may temporarily write protect pages in the heap. See the README file for m .LP Other facilities not discussed here include limited facilities to support incremental collection on machines without appropriate VM support, provisions for providing more explicit object layout information to the garbage collector, more direct support for ``weak'' pointers, support for ``abortable'' garbage collections during idle time, etc. .LP +.SH "PORT INFORMATION" +.LP +In this (OpenBSD package) installation, +.I gc.h +and +.I gc_cpp.h +will be found in +.I /usr/local/include , +and the libraries in +.I /usr/local/lib. +.LP +These libraries have been compiled as drop-in replacements +for malloc and free (which is to say, all malloc +calls will allocate garbage-collectable data). +There is no need to include "gc.h" in your C files unless you want +access to the debugging (and other) functions defined there, +or unless you want to explicitly use +.I GC_malloc_uncollectable +for some allocations. +Just link against them whenever you want either garbage +collection or leak detection. +.LP +The C++ header file, "gc_cpp.h", +.I is +necessary for C++ programs, to obtain the appropriate +definitions of the +.I new +and +.I delete +operators. +The comments in both of these header files presently +provide far better documentation +for the package than this man page; +look there for more information. +.LP +Both libraries are compiled without (explicit) support +for the experimental +.I gc +extension of +.I g++. +This may or may not make a difference. +.LP .SH "SEE ALSO" The README and gc.h files in the distribution. More detailed definitions of the functions exported by the collector are given there. (The above list is not complete.) .LP diff --git a/src/mzscheme/gc/dyn_load.c b/src/mzscheme/gc/dyn_load.c index 8f5626eaea..5fe133a0e8 100644 --- a/src/mzscheme/gc/dyn_load.c +++ b/src/mzscheme/gc/dyn_load.c @@ -85,9 +85,9 @@ static int (*GC_has_static_roots)(const char *, void *, size_t); #if defined(LINUX) && defined(__ELF__) || defined(SCO_ELF) || \ (defined(FREEBSD) && defined(__ELF__)) || defined(DGUX) || \ + (defined(OPENBSD) && defined(__ELF__)) || \ (defined(NETBSD) && defined(__ELF__)) || defined(HURD) # include -# include # include #endif @@ -100,7 +100,7 @@ static int (*GC_has_static_roots)(const char *, void *, size_t); # else # define ElfW(type) Elf64_##type # endif -# elif defined(NETBSD) +# elif defined(NETBSD) || defined(OPENBSD) # if ELFSIZE == 32 # define ElfW(type) Elf32_##type # else @@ -468,7 +468,7 @@ GC_bool GC_register_main_static_data() /* This doesn't necessarily work in all cases, e.g. with preloaded * dynamic libraries. */ -#if defined(NETBSD) +#if defined(NETBSD) || defined(OPENBSD) # include /* for compatibility with 1.4.x */ # ifndef DT_DEBUG diff --git a/src/mzscheme/gc/include/gc_config_macros.h b/src/mzscheme/gc/include/gc_config_macros.h index 8d9fe62109..d2476b28bd 100644 --- a/src/mzscheme/gc/include/gc_config_macros.h +++ b/src/mzscheme/gc/include/gc_config_macros.h @@ -65,7 +65,7 @@ defined(GC_DGUX386_THREADS) || defined(GC_DARWIN_THREADS) || \ defined(GC_AIX_THREADS) || defined(GC_NETBSD_THREADS) || \ (defined(GC_WIN32_THREADS) && defined(__CYGWIN32__)) || \ - defined(GC_GNU_THREADS) + defined(GC_GNU_THREADS) || defined(GC_OPENBSD_THREADS) # define GC_PTHREADS # endif @@ -102,6 +102,10 @@ # define GC_DARWIN_THREADS # define GC_PTHREADS # endif +# if !defined(GC_PTHREADS) && defined(__OpenBSD__) +# define GC_OPENBSD_THREADS +# define GC_PTHREADS +# endif # if !defined(GC_PTHREADS) && (defined(__FreeBSD__) || defined(__DragonFly__)) # define GC_FREEBSD_THREADS # define GC_PTHREADS diff --git a/src/mzscheme/gc/include/private/gcconfig.h b/src/mzscheme/gc/include/private/gcconfig.h index 98fe8b5f6d..c8e60f3c70 100644 --- a/src/mzscheme/gc/include/private/gcconfig.h +++ b/src/mzscheme/gc/include/private/gcconfig.h @@ -64,7 +64,7 @@ /* Determine the machine type: */ # if defined(__arm__) || defined(__thumb__) # define ARM32 -# if !defined(LINUX) && !defined(NETBSD) +# if !defined(LINUX) && !defined(NETBSD) && !defined(OPENBSD) # define NOSYS # define mach_type_known # endif @@ -75,14 +75,18 @@ # if defined(hp9000s300) # error M68K based HP machines no longer supported. # endif -# if defined(OPENBSD) && defined(m68k) -# define M68K -# define mach_type_known -# endif # if defined(OPENBSD) && defined(__sparc__) # define SPARC # define mach_type_known # endif +# if defined(OPENBSD) && defined(__arm__) +# define ARM32 +# define mach_type_known +# endif +# if defined(OPENBSD) && defined(__sh__) +# define SH +# define mach_type_known +# endif # if defined(NETBSD) && (defined(m68k) || defined(__m68k__)) # define M68K # define mach_type_known @@ -99,7 +103,7 @@ # define SH # define mach_type_known # endif -# if defined(vax) +# if defined(vax) || defined(__vax__) # define VAX # ifdef ultrix # define ULTRIX @@ -117,7 +121,7 @@ # if defined(nec_ews) || defined(_nec_ews) # define EWS4800 # endif -# if !defined(LINUX) && !defined(EWS4800) && !defined(NETBSD) +# if !defined(LINUX) && !defined(EWS4800) && !defined(NETBSD) && !defined(OPENBSD) # if defined(ultrix) || defined(__ultrix) # define ULTRIX # else @@ -198,7 +202,7 @@ # if defined(_PA_RISC1_0) || defined(_PA_RISC1_1) || defined(_PA_RISC2_0) \ || defined(hppa) || defined(__hppa__) # define HP_PA -# if !defined(LINUX) && !defined(HPUX) +# if !defined(LINUX) && !defined(HPUX) && !defined(OPENBSD) # define HPUX # endif # define mach_type_known @@ -219,6 +223,10 @@ # define I386 # define mach_type_known # endif +# if defined(OPENBSD) && defined(__amd64__) +# define X86_64 +# define mach_type_known +# endif # if defined(LINUX) && defined(__x86_64__) # define X86_64 # define mach_type_known @@ -290,6 +298,11 @@ # define MACOS # define mach_type_known # endif +# if defined(__OpenBSD__) && (defined(__powerpc__)) +# define POWERPC +# define OPENBSD +# define mach_type_known +# endif # if defined(macosx) || (defined(__APPLE__) && defined(__MACH__)) # define DARWIN # if defined(__ppc__) || defined(__ppc64__) @@ -653,17 +666,6 @@ # ifdef M68K # define MACH_TYPE "M68K" # define ALIGNMENT 2 -# ifdef OPENBSD -# define OS_TYPE "OPENBSD" -# define HEURISTIC2 -# ifdef __ELF__ -# define DATASTART GC_data_start -# define DYNAMIC_LOADING -# else - extern char etext[]; -# define DATASTART ((ptr_t)(etext)) -# endif -# endif # ifdef NETBSD # define OS_TYPE "NETBSD" # define HEURISTIC2 @@ -796,6 +798,22 @@ should be looked into some more */ # define NO_PTHREAD_TRYLOCK # endif +# ifdef OPENBSD +# define OS_TYPE "OPENBSD" +# define ALIGNMENT 4 +# ifdef GC_OPENBSD_THREADS +# define UTHREAD_SP_OFFSET 268 +# else +# include +# include +# define STACKBOTTOM USRSTACK +# endif + extern int __data_start[]; +# define DATASTART ((ptr_t)(__data_start)) + extern char _end[]; +# define DATAEND ((ptr_t)(&_end)) +# define DYNAMIC_LOADING +# endif # ifdef FREEBSD # define ALIGNMENT 4 # define OS_TYPE "FREEBSD" @@ -963,9 +981,18 @@ # endif # ifdef OPENBSD # define OS_TYPE "OPENBSD" -# define STACKBOTTOM ((ptr_t) 0xf8000000) - extern int etext[]; -# define DATASTART ((ptr_t)(etext)) +# ifdef GC_OPENBSD_THREADS +# define UTHREAD_SP_OFFSET 232 +# else +# include +# include +# define STACKBOTTOM USRSTACK +# endif + extern int __data_start[]; +# define DATASTART ((ptr_t)(__data_start)) + extern char _end[]; +# define DATAEND ((ptr_t)(&_end)) +# define DYNAMIC_LOADING # endif # ifdef NETBSD # define OS_TYPE "NETBSD" @@ -1211,6 +1238,18 @@ # endif # ifdef OPENBSD # define OS_TYPE "OPENBSD" +# ifdef GC_OPENBSD_THREADS +# define UTHREAD_SP_OFFSET 176 +# else +# include +# include +# define STACKBOTTOM USRSTACK +# endif + extern int __data_start[]; +# define DATASTART ((ptr_t)(__data_start)) + extern char _end[]; +# define DATAEND ((ptr_t)(&_end)) +# define DYNAMIC_LOADING # endif # ifdef FREEBSD # define OS_TYPE "FREEBSD" @@ -1246,7 +1285,7 @@ # ifdef BSDI # define OS_TYPE "BSDI" # endif -# if defined(OPENBSD) || defined(NETBSD) \ +# if defined(NETBSD) \ || defined(THREE86BSD) || defined(BSDI) # define HEURISTIC2 extern char etext[]; @@ -1416,6 +1455,22 @@ # define STACKBOTTOM ((ptr_t) 0x7ffff000) # endif /* _ELF_ */ # endif +# ifdef OPENBSD +# define OS_TYPE "OPENBSD" +# define ALIGNMENT 4 +# ifdef GC_OPENBSD_THREADS +# define UTHREAD_SP_OFFSET 808 +# else +# include +# include +# define STACKBOTTOM USRSTACK +# endif + extern int _fdata[]; +# define DATASTART ((ptr_t)(_fdata)) + extern char _end[]; +# define DATAEND ((ptr_t)(&_end)) +# define DYNAMIC_LOADING +# endif # if defined(NONSTOP) # define CPP_WORDSZ 32 # define OS_TYPE "NONSTOP" @@ -1436,7 +1491,7 @@ # define CPP_WORDSZ 32 # define ALIGNMENT 4 # endif -# if !defined(GC_HPUX_THREADS) && !defined(GC_LINUX_THREADS) +# if !defined(GC_HPUX_THREADS) && !defined(GC_LINUX_THREADS) && !defined(OPENBSD) # ifndef LINUX /* For now. */ # define MPROTECT_VDB # endif @@ -1485,6 +1540,21 @@ extern int _end[]; # define DATAEND (&_end) # endif /* LINUX */ +# ifdef OPENBSD +# define OS_TYPE "OPENBSD" +# ifdef GC_OPENBSD_THREADS +# define UTHREAD_SP_OFFSET 520 +# else +# include +# include +# define STACKBOTTOM USRSTACK +# endif + extern int __data_start[]; +# define DATASTART ((ptr_t)(__data_start)) + extern char _end[]; +# define DATAEND ((ptr_t)(&_end)) +# define DYNAMIC_LOADING +# endif # endif /* HP_PA */ # ifdef ALPHA @@ -1502,15 +1572,19 @@ # endif # ifdef OPENBSD # define OS_TYPE "OPENBSD" -# define HEURISTIC2 -# ifdef __ELF__ /* since OpenBSD/Alpha 2.9 */ -# define DATASTART GC_data_start -# define ELFCLASS32 32 -# define ELFCLASS64 64 -# define ELF_CLASS ELFCLASS64 -# else /* ECOFF, until OpenBSD/Alpha 2.7 */ -# define DATASTART ((ptr_t) 0x140000000) -# endif +# define ELF_CLASS ELFCLASS64 +# ifdef GC_OPENBSD_THREADS +# define UTHREAD_SP_OFFSET 816 +# else +# include +# include +# define STACKBOTTOM USRSTACK +# endif + extern int __data_start[]; +# define DATASTART ((ptr_t)(__data_start)) + extern char _end[]; +# define DATAEND ((ptr_t)(&_end)) +# define DYNAMIC_LOADING # endif # ifdef FREEBSD # define OS_TYPE "FREEBSD" @@ -1678,6 +1752,7 @@ # ifdef CX_UX # define OS_TYPE "CX_UX" # define DATASTART ((((word)etext + 0x3fffff) & ~0x3fffff) + 0x10000) +# define STACKBOTTOM ((char*)0xf0000000) /* determined empirically */ # endif # ifdef DGUX # define OS_TYPE "DGUX" @@ -1777,6 +1852,22 @@ # define OS_TYPE "MSWINCE" # define DATAEND /* not needed */ # endif +# ifdef OPENBSD +# define ALIGNMENT 4 +# define OS_TYPE "OPENBSD" +# ifdef GC_OPENBSD_THREADS +# define UTHREAD_SP_OFFSET 176 +# else +# include +# include +# define STACKBOTTOM USRSTACK +# endif + extern int __data_start[]; +# define DATASTART ((ptr_t)(__data_start)) + extern char _end[]; +# define DATAEND ((ptr_t)(&_end)) +# define DYNAMIC_LOADING +# endif # ifdef NOSYS /* __data_start is usually defined in the target linker script. */ extern int __data_start[]; @@ -1820,6 +1911,21 @@ # define DATASTART GC_data_start # define DYNAMIC_LOADING # endif +# ifdef OPENBSD +# define OS_TYPE "OPENBSD" +# ifdef GC_OPENBSD_THREADS +# define UTHREAD_SP_OFFSET 332 +# else +# include +# include +# define STACKBOTTOM USRSTACK +# endif + extern int __data_start[]; +# define DATASTART ((ptr_t)(__data_start)) + extern char _end[]; +# define DATAEND ((ptr_t)(&_end)) +# define DYNAMIC_LOADING +# endif # endif # ifdef SH4 @@ -1852,6 +1958,22 @@ # ifndef HBLKSIZE # define HBLKSIZE 4096 # endif +# ifdef OPENBSD +# define OS_TYPE "OPENBSD" +# define ELF_CLASS ELFCLASS64 +# ifdef GC_OPENBSD_THREADS +# define UTHREAD_SP_OFFSET 400 +# else +# include +# include +# define STACKBOTTOM USRSTACK +# endif + extern int __data_start[]; +# define DATASTART ((ptr_t)(__data_start)) + extern char _end[]; +# define DATAEND ((ptr_t)(&_end)) +# define DYNAMIC_LOADING +# endif # define CACHE_LINE_SIZE 64 # ifdef LINUX # define OS_TYPE "LINUX" diff --git a/src/mzscheme/gc/include/private/openbsd_stop_world.h b/src/mzscheme/gc/include/private/openbsd_stop_world.h new file mode 100644 index 0000000000..7f423ad572 --- /dev/null +++ b/src/mzscheme/gc/include/private/openbsd_stop_world.h @@ -0,0 +1,12 @@ +#ifndef GC_OPENBSD_STOP_WORLD_H +#define GC_OPENBSD_STOP_WORLD_H + +#if !defined(GC_OPENBSD_THREADS) +#error openbsd_stop_world.h included without GC_OPENBSD_THREADS defined +#endif + +struct thread_stop_info { + ptr_t stack_ptr; /* Valid only when stopped. */ +}; + +#endif diff --git a/src/mzscheme/gc/mach_dep.c b/src/mzscheme/gc/mach_dep.c index b282b7fc5f..1f1270e8fb 100644 --- a/src/mzscheme/gc/mach_dep.c +++ b/src/mzscheme/gc/mach_dep.c @@ -159,7 +159,7 @@ void GC_push_regs() # undef HAVE_PUSH_REGS #endif -#if !defined(HAVE_PUSH_REGS) && defined(UNIX_LIKE) +#if !defined(HAVE_PUSH_REGS) && defined(UNIX_LIKE) && !defined(OPENBSD) # define _XOPEN_SOURCE /* PLTSCHEME: for Mac OS X */ # include #endif @@ -176,7 +176,7 @@ void GC_with_callee_saves_pushed(void (*fn)(ptr_t, void *), # if defined(HAVE_PUSH_REGS) GC_push_regs(); # elif defined(UNIX_LIKE) && !defined(DARWIN) && !defined(ARM32) && \ - !defined(HURD) + !defined(HURD) && !defined(OPENBSD) /* Older versions of Darwin seem to lack getcontext(). */ /* ARM Linux often doesn't support a real getcontext(). */ ucontext_t ctxt; diff --git a/src/mzscheme/gc/misc.c b/src/mzscheme/gc/misc.c index 17e6637ccb..7b1a37bbaa 100644 --- a/src/mzscheme/gc/misc.c +++ b/src/mzscheme/gc/misc.c @@ -622,7 +622,7 @@ void GC_init_inner() # if defined(SEARCH_FOR_DATA_START) GC_init_linux_data_start(); # endif -# if (defined(NETBSD) || defined(OPENBSD)) && defined(__ELF__) +# if defined(NETBSD) && defined(__ELF__) if (!GC_no_dls) /* PLTSCHEME: hack */ GC_init_netbsd_elf(); # endif diff --git a/src/mzscheme/gc/openbsd_stop_world.c b/src/mzscheme/gc/openbsd_stop_world.c new file mode 100644 index 0000000000..a7e84bf902 --- /dev/null +++ b/src/mzscheme/gc/openbsd_stop_world.c @@ -0,0 +1,162 @@ +#include "private/pthread_support.h" + +/* derived from pthread_stop_world.c */ + +# if defined(GC_OPENBSD_THREADS) + +/* We hold allocation lock. Should do exactly the right thing if the */ +/* world is stopped. Should not fail if it isn't. */ +void GC_push_all_stacks() +{ + GC_bool found_me = FALSE; + size_t nthreads = 0; + int i; + GC_thread p; + ptr_t lo, hi; + pthread_t me = pthread_self(); + + if (!GC_thr_initialized) GC_thr_init(); +# if DEBUG_THREADS + GC_printf("Pushing stacks from thread 0x%x\n", (unsigned) me); +# endif + for (i = 0; i < THREAD_TABLE_SZ; i++) { + for (p = GC_threads[i]; p != 0; p = p -> next) { + if (p -> flags & FINISHED) continue; + ++nthreads; + if (THREAD_EQUAL(p -> id, me)) { +# ifdef SPARC + lo = (ptr_t)GC_save_regs_in_stack(); +# else + lo = GC_approx_sp(); +# endif + found_me = TRUE; + } else { + lo = p -> stop_info.stack_ptr; + } + if ((p -> flags & MAIN_THREAD) == 0) { + hi = p -> stack_end; + } else { + /* The original stack. */ + hi = GC_stackbottom; + } +# if DEBUG_THREADS + GC_printf("Stack for thread 0x%x = [%p,%p)\n", + (unsigned)(p -> id), lo, hi); +# endif + if (0 == lo) ABORT("GC_push_all_stacks: sp not set!\n"); +# ifdef STACK_GROWS_UP + /* We got them backwards! */ + GC_push_all_stack(hi, lo); +# else + GC_push_all_stack(lo, hi); +# endif + } + } + if (GC_print_stats == VERBOSE) { + GC_log_printf("Pushed %d thread stacks\n", nthreads); + } + if (!found_me && !GC_in_thread_creation) + ABORT("Collecting from unknown thread."); +} + +/* We hold the allocation lock. Suspend all threads that might */ +/* still be running. */ +void GC_suspend_all() +{ + int i; + GC_thread p; + int result; + pthread_t my_thread = pthread_self(); + + for (i = 0; i < THREAD_TABLE_SZ; i++) { + for (p = GC_threads[i]; p != 0; p = p -> next) { + if (!THREAD_EQUAL(p -> id, my_thread)) { + if (p -> flags & FINISHED) continue; + if (p -> thread_blocked) /* Will wait */ continue; +# if DEBUG_THREADS + GC_printf("Suspending thread 0x%x\n", + (unsigned)(p -> id)); +# endif + + if (pthread_suspend_np(p -> id) != 0) + ABORT("pthread_suspend_np failed"); + + /* + * This will only work for userland pthreads. It will + * fail badly on rthreads. Perhaps we should consider + * a pthread_sp_np() function that returns the stack + * pointer for a suspended thread and implement in + * both pthreads and rthreads. + */ + p -> stop_info.stack_ptr = *(ptr_t*)((char *)p -> id + UTHREAD_SP_OFFSET); + } + } + } +} + +void GC_stop_world() +{ + int i; + + GC_ASSERT(I_HOLD_LOCK()); +# if DEBUG_THREADS + GC_printf("Stopping the world from 0x%x\n", (unsigned)pthread_self()); +# endif + + /* Make sure all free list construction has stopped before we start. */ + /* No new construction can start, since free list construction is */ + /* required to acquire and release the GC lock before it starts, */ + /* and we have the lock. */ +# ifdef PARALLEL_MARK + GC_acquire_mark_lock(); + GC_ASSERT(GC_fl_builder_count == 0); + /* We should have previously waited for it to become zero. */ +# endif /* PARALLEL_MARK */ + + GC_suspend_all(); + +# ifdef PARALLEL_MARK + GC_release_mark_lock(); +# endif + #if DEBUG_THREADS + GC_printf("World stopped from 0x%x\n", (unsigned)pthread_self()); + #endif +} + +/* Caller holds allocation lock, and has held it continuously since */ +/* the world stopped. */ +void GC_start_world() +{ + pthread_t my_thread = pthread_self(); + register int i; + register GC_thread p; + register int result; + +# if DEBUG_THREADS + GC_printf("World starting\n"); +# endif + + for (i = 0; i < THREAD_TABLE_SZ; i++) { + for (p = GC_threads[i]; p != 0; p = p -> next) { + if (!THREAD_EQUAL(p -> id, my_thread)) { + if (p -> flags & FINISHED) continue; + if (p -> thread_blocked) continue; + #if DEBUG_THREADS + GC_printf("Resuming thread 0x%x\n", + (unsigned)(p -> id)); + #endif + + if (pthread_resume_np(p -> id) != 0) + ABORT("pthread_kill failed"); + } + } + } +# if DEBUG_THREADS + GC_printf("World started\n"); +# endif +} + +void GC_stop_init() { +} + +#endif diff --git a/src/mzscheme/gc/os_dep.c b/src/mzscheme/gc/os_dep.c index c6d4fcbb22..815f58d329 100644 --- a/src/mzscheme/gc/os_dep.c +++ b/src/mzscheme/gc/os_dep.c @@ -495,7 +495,7 @@ static void *tiny_sbrk(ptrdiff_t increment) #define sbrk tiny_sbrk # endif /* ECOS */ -#if (defined(NETBSD) || defined(OPENBSD)) && defined(__ELF__) +#if defined(NETBSD) && defined(__ELF__) ptr_t GC_data_start; void GC_init_netbsd_elf(void) @@ -508,6 +508,103 @@ static void *tiny_sbrk(ptrdiff_t increment) } #endif +#if defined(OPENBSD) + static struct sigaction old_segv_act; + sigjmp_buf GC_jmp_buf_openbsd; + +# if defined(GC_OPENBSD_THREADS) +# include + sigset_t __syscall(quad_t, ...); +# endif + + /* + * Dont use GC_find_limit() because siglongjmp out of the + * signal handler by-passes our userland pthreads lib, leaving + * SIGSEGV and SIGPROF masked. Instead use this custom one + * that works-around the issues. + */ + + /*ARGSUSED*/ + void GC_fault_handler_openbsd(int sig) + { + siglongjmp(GC_jmp_buf_openbsd, 1); + } + + /* Return the first nonaddressible location > p or bound */ + /* Requires allocation lock. */ + ptr_t GC_find_limit_openbsd(ptr_t p, ptr_t bound) + { + static volatile ptr_t result; + /* Safer if static, since otherwise it may not be */ + /* preserved across the longjmp. Can safely be */ + /* static since it's only called with the */ + /* allocation lock held. */ + struct sigaction act; + size_t pgsz = (size_t)sysconf(_SC_PAGESIZE); + + GC_ASSERT(I_HOLD_LOCK()); + + act.sa_handler = GC_fault_handler_openbsd; + sigemptyset(&act.sa_mask); + act.sa_flags = SA_NODEFER | SA_RESTART; + sigaction(SIGSEGV, &act, &old_segv_act); + + if (sigsetjmp(GC_jmp_buf_openbsd, 1) == 0) { + result = (ptr_t)(((word)(p)) & ~(pgsz-1)); + for (;;) { + result += pgsz; + if (result >= bound) { + result = bound; + break; + } + GC_noop1((word)(*result)); + } + } + +# if defined(GC_OPENBSD_THREADS) + /* due to the siglongjump we need to manually unmask SIGPROF */ + __syscall(SYS_sigprocmask, SIG_UNBLOCK, sigmask(SIGPROF)); +# endif + + sigaction(SIGSEGV, &old_segv_act, 0); + + return(result); + } + + /* Return first addressable location > p or bound */ + /* Requires allocation lock. */ + ptr_t GC_skip_hole_openbsd(ptr_t p, ptr_t bound) + { + static volatile ptr_t result; + struct sigaction act; + size_t pgsz = (size_t)sysconf(_SC_PAGESIZE); + static volatile int firstpass; + + GC_ASSERT(I_HOLD_LOCK()); + + act.sa_handler = GC_fault_handler_openbsd; + sigemptyset(&act.sa_mask); + act.sa_flags = SA_NODEFER | SA_RESTART; + sigaction(SIGSEGV, &act, &old_segv_act); + + firstpass = 1; + result = (ptr_t)(((word)(p)) & ~(pgsz-1)); + if (sigsetjmp(GC_jmp_buf_openbsd, 1) != 0 || firstpass) { + firstpass = 0; + result += pgsz; + if (result >= bound) { + result = bound; + } else + GC_noop1((word)(*result)); + } + + sigaction(SIGSEGV, &old_segv_act, 0); + + return(result); + } +#endif + + # ifdef OS2 # include @@ -1113,7 +1210,7 @@ ptr_t GC_get_main_stack_base(void) #if !defined(BEOS) && !defined(AMIGA) && !defined(MSWIN32) \ && !defined(MSWINCE) && !defined(OS2) && !defined(NOSYS) && !defined(ECOS) \ - && !defined(CYGWIN32) + && !defined(CYGWIN32) && !defined(GC_OPENBSD_THREADS) ptr_t GC_get_main_stack_base(void) { @@ -1222,6 +1319,35 @@ int GC_get_stack_base(struct GC_stack_base *b) #endif /* GC_LINUX_THREADS */ +#if defined(GC_OPENBSD_THREADS) + +/* Find the stack using pthread_stackseg_np() */ + +# include +# include +# include + +#define HAVE_GET_STACK_BASE + +int GC_get_stack_base(struct GC_stack_base *sb) +{ + stack_t stack; + pthread_stackseg_np(pthread_self(), &stack); + sb->mem_base = stack.ss_sp; + return GC_SUCCESS; +} + +/* This is always called from the main thread. */ +ptr_t GC_get_main_stack_base(void) +{ + struct GC_stack_base sb; + + GC_get_stack_base(&sb); + return (ptr_t)sb.mem_base; +} + +#endif /* GC_OPENBSD_THREADS */ + #ifndef HAVE_GET_STACK_BASE /* Retrieve stack base. */ /* Using the GC_find_limit version is risky. */ @@ -1670,6 +1796,31 @@ ptr_t GC_FreeBSDGetDataStart(size_t max_page_size, ptr_t etext_addr) #else /* !OS2 && !Windows && !AMIGA */ +#if defined(OPENBSD) + +/* + * Depending on arch alignment there can be multiple holes + * between DATASTART & DATAEND. Scan from DATASTART - DATAEND + * and register each region. + */ +void GC_register_data_segments(void) +{ + ptr_t region_start, region_end; + + region_start = DATASTART; + + for(;;) { + region_end = GC_find_limit_openbsd(region_start, DATAEND); + GC_add_roots_inner(region_start, region_end, FALSE); + if (region_end < DATAEND) + region_start = GC_skip_hole_openbsd(region_end, DATAEND); + else + break; + } +} + +# else /* !OS2 && !Windows && !AMIGA && !OPENBSD */ + void GC_register_data_segments(void) { # if !defined(PCR) && !defined(MACOS) @@ -1727,6 +1878,7 @@ void GC_register_data_segments(void) /* change. */ } +# endif /* ! OPENBSD */ # endif /* ! AMIGA */ # endif /* ! MSWIN32 && ! MSWINCE*/ # endif /* ! OS2 */ diff --git a/src/mzscheme/gc/pthread_stop_world.c b/src/mzscheme/gc/pthread_stop_world.c index c542aebc39..3e7bda65e4 100644 --- a/src/mzscheme/gc/pthread_stop_world.c +++ b/src/mzscheme/gc/pthread_stop_world.c @@ -1,7 +1,7 @@ #include "private/pthread_support.h" #if defined(GC_PTHREADS) && !defined(GC_WIN32_THREADS) && \ - !defined(GC_DARWIN_THREADS) + !defined(GC_DARWIN_THREADS) && !defined(GC_OPENBSD_THREADS) #include #include diff --git a/src/mzscheme/gc/pthread_support.c b/src/mzscheme/gc/pthread_support.c index 8ca1a3a609..8c59a4479a 100644 --- a/src/mzscheme/gc/pthread_support.c +++ b/src/mzscheme/gc/pthread_support.c @@ -774,6 +774,9 @@ void GC_thr_init(void) # if defined(GC_NETBSD_THREADS) GC_nprocs = get_ncpu(); # endif +# if defined(GC_OPENBSD_THREADS) + GC_nprocs = 1; +# endif # if defined(GC_DARWIN_THREADS) || defined(GC_FREEBSD_THREADS) int ncpus = 1; size_t len = sizeof(ncpus); @@ -845,7 +848,7 @@ void GC_init_parallel(void) } -#if !defined(GC_DARWIN_THREADS) +#if !defined(GC_DARWIN_THREADS) && !defined(GC_OPENBSD_THREADS) int WRAP_FUNC(pthread_sigmask)(int how, const sigset_t *set, sigset_t *oset) { sigset_t fudged_set; @@ -1100,6 +1103,12 @@ void * GC_start_routine(void * arg) GC_enable(); # endif return GC_inner_start_routine(&sb, arg); +# elif defined(GC_OPENBSD_THREADS) + /* On OpenBSD GC_get_stack_base() doesn't cause any allocations */ + struct GC_stack_base sb; + if (GC_get_stack_base(&sb) != GC_SUCCESS) + ABORT("Failed to get thread stack base."); + return GC_inner_start_routine(&sb, arg); # else return GC_call_with_stack_base(GC_inner_start_routine, arg); # endif @@ -1294,7 +1303,7 @@ void GC_generic_lock(pthread_mutex_t * lock) /* as STL alloc.h. This isn't really the right way to do this. */ /* but until the POSIX scheduling mess gets straightened out ... */ -volatile AO_TS_t GC_allocate_lock = 0; +volatile AO_TS_t GC_allocate_lock = AO_TS_INITIALIZER; void GC_lock(void) diff --git a/src/mzscheme/gc/tests/test.c b/src/mzscheme/gc/tests/test.c index 6033541450..839faf8934 100644 --- a/src/mzscheme/gc/tests/test.c +++ b/src/mzscheme/gc/tests/test.c @@ -1627,7 +1627,8 @@ int main() pthread_attr_init(&attr); # if defined(GC_IRIX_THREADS) || defined(GC_FREEBSD_THREADS) \ - || defined(GC_DARWIN_THREADS) || defined(GC_AIX_THREADS) + || defined(GC_DARWIN_THREADS) || defined(GC_AIX_THREADS) \ + || defined(GC_OPENBSD_THREADS) pthread_attr_setstacksize(&attr, 1000000); # endif n_tests = 0; diff --git a/src/mzscheme/gc/threadlibs.c b/src/mzscheme/gc/threadlibs.c index f2ab58250f..667fa2f602 100644 --- a/src/mzscheme/gc/threadlibs.c +++ b/src/mzscheme/gc/threadlibs.c @@ -18,6 +18,9 @@ int main() # endif printf("-lpthread\n"); # endif +# if defined(GC_OPENBSD_THREADS) + printf("-pthread\n"); +# endif # if defined(GC_FREEBSD_THREADS) # ifdef GC_USE_DLOPEN_WRAP printf("-ldl "); From e64d36b71fb779f54acbe7a1e631edcdb1916831 Mon Sep 17 00:00:00 2001 From: Kevin Tew Date: Thu, 1 Apr 2010 17:03:36 +0000 Subject: [PATCH 055/202] scheme_make_prefab_struct_type svn: r18714 --- src/mzscheme/include/schthread.h | 2 - src/mzscheme/src/struct.c | 225 +++++++++++++++++++++++-------- 2 files changed, 166 insertions(+), 61 deletions(-) diff --git a/src/mzscheme/include/schthread.h b/src/mzscheme/include/schthread.h index 7b9913ba1c..6cd88446a2 100644 --- a/src/mzscheme/include/schthread.h +++ b/src/mzscheme/include/schthread.h @@ -192,7 +192,6 @@ typedef struct Thread_Local_Variables { void *stack_copy_cache_[STACK_COPY_CACHE_SIZE]; long stack_copy_size_cache_[STACK_COPY_CACHE_SIZE]; int scc_pos_; - struct Scheme_Bucket_Table *prefab_table_; struct Scheme_Object *nominal_ipair_cache_; struct Scheme_Object *mark_id_; struct Scheme_Object *current_rib_timestamp_; @@ -476,7 +475,6 @@ XFORM_GC_VARIABLE_STACK_THROUGH_THREAD_LOCAL; #define stack_copy_cache XOA (scheme_get_thread_local_variables()->stack_copy_cache_) #define stack_copy_size_cache XOA (scheme_get_thread_local_variables()->stack_copy_size_cache_) #define scc_pos XOA (scheme_get_thread_local_variables()->scc_pos_) -#define prefab_table XOA (scheme_get_thread_local_variables()->prefab_table_) #define nominal_ipair_cache XOA (scheme_get_thread_local_variables()->nominal_ipair_cache_) #define mark_id XOA (scheme_get_thread_local_variables()->mark_id_) #define current_rib_timestamp XOA (scheme_get_thread_local_variables()->current_rib_timestamp_) diff --git a/src/mzscheme/src/struct.c b/src/mzscheme/src/struct.c index 589972109e..ae6552c388 100644 --- a/src/mzscheme/src/struct.c +++ b/src/mzscheme/src/struct.c @@ -152,6 +152,7 @@ static Scheme_Object *exn_source_p(int argc, Scheme_Object **argv); static Scheme_Object *exn_source_get(int argc, Scheme_Object **argv); static Scheme_Object *procedure_extract_target(int argc, Scheme_Object **argv); +static Scheme_Struct_Type *hash_prefab(Scheme_Struct_Type *type); static Scheme_Object *chaperone_struct(int argc, Scheme_Object **argv); static Scheme_Object *chaperone_struct_type(int argc, Scheme_Object **argv); @@ -163,7 +164,7 @@ static Scheme_Object *make_chaperone_property(int argc, Scheme_Object *argv[]); static void register_traversers(void); #endif -THREAD_LOCAL_DECL(static Scheme_Bucket_Table *prefab_table); +SHARED_OK static Scheme_Bucket_Table *prefab_table; static Scheme_Object *make_prefab_key(Scheme_Struct_Type *type); #define cons scheme_make_pair @@ -1906,6 +1907,22 @@ scheme_make_struct_instance(Scheme_Object *_stype, int argc, Scheme_Object **arg return (Scheme_Object *)inst; } +Scheme_Object *scheme_make_blank_prefab_struct_instance(Scheme_Struct_Type *stype) +{ + Scheme_Structure *inst; + int c; + + c = stype->num_slots; + inst = (Scheme_Structure *) + scheme_malloc_tagged(sizeof(Scheme_Structure) + + ((c - 1) * sizeof(Scheme_Object *))); + + inst->so.type = scheme_structure_type; + inst->stype = stype; + + return (Scheme_Object *)inst; +} + Scheme_Object *scheme_make_prefab_struct_instance(Scheme_Struct_Type *stype, Scheme_Object *vec) { @@ -3518,6 +3535,85 @@ static Scheme_Object *add_struct_type_chaperone_guards(Scheme_Object *o, Scheme_ return scheme_make_pair(orig_guard, first); } +static void struct_type_set_if_immutable(Scheme_Struct_Type *struct_type) { + if (!struct_type->name_pos + || MZ_OPT_HASH_KEY(&struct_type->parent_types[struct_type->name_pos - 1]->iso) & STRUCT_TYPE_ALL_IMMUTABLE) { + int i, size; + size = struct_type->num_islots; + if (struct_type->name_pos) + size -= struct_type->parent_types[struct_type->name_pos - 1]->num_islots; + if (struct_type->immutables) { + for (i = 0; i < size; i++) { + if (!struct_type->immutables[i]) + return; + } + MZ_OPT_HASH_KEY(&struct_type->iso) |= STRUCT_TYPE_ALL_IMMUTABLE; + } + } +} + +Scheme_Struct_Type *scheme_make_prefab_struct_type_raw(Scheme_Object *base, + Scheme_Object *parent, + int num_fields, + int num_uninit_fields, + Scheme_Object *uninit_val, + char *immutable_array) +{ + Scheme_Struct_Type *struct_type, *parent_type; + int j, depth; + + parent_type = (Scheme_Struct_Type *)parent; + depth = parent_type ? (1 + parent_type->name_pos) : 0; + struct_type = (Scheme_Struct_Type *)scheme_malloc_tagged(sizeof(Scheme_Struct_Type) + + (depth + * sizeof(Scheme_Struct_Type *))); + struct_type->iso.so.type = scheme_struct_type_type; + + struct_type->parent_types[depth] = struct_type; + for (j = depth; j--; ) { + struct_type->parent_types[j] = parent_type->parent_types[j]; + } + + struct_type->name = base; + struct_type->num_slots = num_fields + num_uninit_fields + (parent_type ? parent_type->num_slots : 0); + struct_type->num_islots = num_fields + (parent_type ? parent_type->num_islots : 0); + struct_type->name_pos = depth; + struct_type->inspector = scheme_false; + //Scheme_Object *accessor *mutator; + //Scheme_Object *prefab_key; + struct_type->uninit_val = uninit_val; + struct_type->props = NULL; + struct_type->num_props = 0; + struct_type->proc_attr = NULL; + struct_type->immutables = immutable_array; + struct_type->guard = NULL; + + struct_type_set_if_immutable(struct_type); + struct_type = hash_prefab(struct_type); + + return struct_type; +} + +static Scheme_Struct_Type *scheme_make_prefab_struct_type(Scheme_Object *base, + Scheme_Object *parent, + int num_fields, + int num_uninit_fields, + Scheme_Object *uninit_val, + char *immutable_array) +{ +#ifdef MZ_USE_PLACES + return scheme_make_prefab_struct_type_in_master +#else + return scheme_make_prefab_struct_type_raw +#endif + (base, + parent, + num_fields, + num_uninit_fields, + uninit_val, + immutable_array); +} + static Scheme_Object *_make_struct_type(Scheme_Object *base, Scheme_Object *parent, Scheme_Object *inspector, @@ -3794,23 +3890,7 @@ static Scheme_Object *_make_struct_type(Scheme_Object *base, MZ_OPT_HASH_KEY(&struct_type->iso) |= STRUCT_TYPE_CHECKED_PROC; /* Check all immutable */ - if (!struct_type->name_pos - || MZ_OPT_HASH_KEY(&struct_type->parent_types[struct_type->name_pos - 1]->iso) & STRUCT_TYPE_ALL_IMMUTABLE) { - int i, size; - size = struct_type->num_islots; - if (struct_type->name_pos) - size -= struct_type->parent_types[struct_type->name_pos - 1]->num_islots; - if (struct_type->immutables) { - for (i = 0; i < size; i++) { - if (!struct_type->immutables[i]) - break; - } - } else { - i = 0; - } - if (i == size) - MZ_OPT_HASH_KEY(&struct_type->iso) |= STRUCT_TYPE_ALL_IMMUTABLE; - } + struct_type_set_if_immutable(struct_type); return (Scheme_Object *)struct_type; } @@ -3872,7 +3952,29 @@ Scheme_Object *scheme_make_struct_type_from_string(const char *base, guard); } -Scheme_Struct_Type *hash_prefab(Scheme_Struct_Type *type) +static Scheme_Struct_Type *lookup_prefab(Scheme_Object *key) { + Scheme_Object *a = NULL; + +# if defined(MZ_USE_PLACES) && defined(MZ_PRECISE_GC) + void *original_gc; + original_gc = GC_switch_to_master_gc(); +# endif + + if (prefab_table) { + a = scheme_lookup_in_table(prefab_table, (const char *)key); + } + +# if defined(MZ_USE_PLACES) && defined(MZ_PRECISE_GC) + GC_switch_back_from_master(original_gc); +# endif + + if (a) { + return (Scheme_Struct_Type *) SCHEME_WEAK_BOX_VAL(a); + } + return NULL; +} + +static Scheme_Struct_Type *hash_prefab(Scheme_Struct_Type *type) { Scheme_Object *k, *v; @@ -3942,12 +4044,12 @@ static char* immutable_pos_list_to_immutable_array(Scheme_Object *immutable_pos_ static Scheme_Object *make_struct_type(int argc, Scheme_Object **argv) { - int initc, uninitc, num_props = 0, i, prefab = 0; + int initc, uninitc, num_props = 0, prefab = 0; Scheme_Object *props = scheme_null, *l, *a, **r; - Scheme_Object *inspector = NULL, **names, *uninit_val; + Scheme_Object *inspector = NULL, *uninit_val; Scheme_Struct_Type *type; Scheme_Object *proc_attr = NULL, *immutable_pos_list = scheme_null, *guard = NULL; - char* immutable_array; + char *immutable_array; if (!SCHEME_SYMBOLP(argv[0])) scheme_wrong_type("make-struct-type", "symbol", 0, argc, argv); @@ -4069,35 +4171,42 @@ static Scheme_Object *make_struct_type(int argc, Scheme_Object **argv) if (bad) { scheme_raise_exn(MZEXN_FAIL_CONTRACT, bad, argv[0]); } - } - type = (Scheme_Struct_Type *)_make_struct_type(argv[0], + type = scheme_make_prefab_struct_type(argv[0], SCHEME_FALSEP(argv[1]) ? NULL : argv[1], - inspector, initc, uninitc, - uninit_val, props, - proc_attr, - immutable_array, - guard); - - if (prefab) { - type = hash_prefab(type); + uninit_val, + immutable_array); } + else { + type = (Scheme_Struct_Type *)_make_struct_type(argv[0], + SCHEME_FALSEP(argv[1]) ? NULL : argv[1], + inspector, + initc, uninitc, + uninit_val, props, + proc_attr, + immutable_array, + guard); + } + { + int i; + Scheme_Object **names; - names = scheme_make_struct_names(argv[0], - NULL, - SCHEME_STRUCT_GEN_GET | SCHEME_STRUCT_GEN_SET, - &i); - r = scheme_make_struct_values((Scheme_Object *)type, names, i, - SCHEME_STRUCT_GEN_GET | SCHEME_STRUCT_GEN_SET); + names = scheme_make_struct_names(argv[0], + NULL, + SCHEME_STRUCT_GEN_GET | SCHEME_STRUCT_GEN_SET, + &i); + r = scheme_make_struct_values((Scheme_Object *)type, names, i, + SCHEME_STRUCT_GEN_GET | SCHEME_STRUCT_GEN_SET); - return scheme_values(i, r); + return scheme_values(i, r); + } } static Scheme_Object *make_prefab_key(Scheme_Struct_Type *type) { - Scheme_Object *key = scheme_null, *stack = scheme_null, *v; - int cnt, icnt, total_cnt; + Scheme_Object *key = scheme_null, *stack = scheme_null; + int total_cnt; total_cnt = type->num_slots; @@ -4107,8 +4216,8 @@ static Scheme_Object *make_prefab_key(Scheme_Struct_Type *type) } while (type) { - cnt = type->num_slots; - icnt = type->num_islots; + int cnt = type->num_slots; + int icnt = type->num_islots; if (type->name_pos) { cnt -= type->parent_types[type->name_pos - 1]->num_slots; icnt -= type->parent_types[type->name_pos - 1]->num_islots; @@ -4116,7 +4225,7 @@ static Scheme_Object *make_prefab_key(Scheme_Struct_Type *type) if (cnt) { int i; - v = scheme_null; + Scheme_Object *v = scheme_null; for (i = icnt; i--; ) { if (!type->immutables || !type->immutables[i]) { v = scheme_make_pair(scheme_make_integer(i), v); @@ -4206,14 +4315,16 @@ Scheme_Struct_Type *scheme_lookup_prefab_type(Scheme_Object *key, int field_coun if (field_count > MAX_STRUCT_FIELD_COUNT) field_count = MAX_STRUCT_FIELD_COUNT; - if (prefab_table) { - a = scheme_lookup_in_table(prefab_table, (const char *)key); - if (a) - a = SCHEME_WEAK_BOX_VAL(a); - if (a) - return (Scheme_Struct_Type *)a; + + { + Scheme_Struct_Type *stype = NULL; + stype = lookup_prefab(key); + if (stype) { + return stype; + } } + key = scheme_reverse(key); while (SCHEME_PAIRP(key)) { @@ -4279,16 +4390,12 @@ Scheme_Struct_Type *scheme_lookup_prefab_type(Scheme_Object *key, int field_coun if (parent && (icnt + parent->num_slots > MAX_STRUCT_FIELD_COUNT)) return NULL; - parent = (Scheme_Struct_Type *)_make_struct_type(name, - (Scheme_Object *)parent, - scheme_false, - icnt, ucnt, - uninit_val, scheme_null, - NULL, - immutable_array, - NULL); + parent = scheme_make_prefab_struct_type(name, + (Scheme_Object *)parent, + icnt, ucnt, + uninit_val, + immutable_array); - parent = hash_prefab(parent); } if (!SCHEME_NULLP(key)) From 191b11110945c19cd5b5c9a611c8917dc3beb6a6 Mon Sep 17 00:00:00 2001 From: Kevin Tew Date: Thu, 1 Apr 2010 17:03:51 +0000 Subject: [PATCH 056/202] Communciate Structs svn: r18715 --- collects/tests/mzscheme/place-channel.ss | 15 +- src/mzscheme/src/places.c | 240 ++++++++++++++++++++++- src/mzscheme/src/schpriv.h | 13 ++ 3 files changed, 260 insertions(+), 8 deletions(-) diff --git a/collects/tests/mzscheme/place-channel.ss b/collects/tests/mzscheme/place-channel.ss index e703028146..2bb3c514fe 100644 --- a/collects/tests/mzscheme/place-channel.ss +++ b/collects/tests/mzscheme/place-channel.ss @@ -31,7 +31,9 @@ (string-append x "-ok") (cons (car x) 'b) (list (car x) 'b (cadr x)) - (vector (vector-ref x 0) 'b (vector-ref x 1)))) + (vector (vector-ref x 0) 'b (vector-ref x 1)) + #s((bozo 1 building 2) 6 'gubber 'no) + )) ) END "pct1.ss") @@ -44,12 +46,19 @@ END (syntax-rules () [(_ ch (send expect) ...) (begin (test expect pcsr ch send) ...)])) + +(define-struct building (rooms location) #:prefab) +(define-struct (house building) (occupied ) #:prefab) +(define h1 (make-house 5 'factory 'no)) + + (let ([pl (place "pct1.ss" 'place-main)]) (pcsrs pl (1 2 ) ("Hello" "Hello-ok") ((cons 'a 'a) (cons 'a 'b)) ((list 'a 'a) (list 'a 'b 'a)) - (#(a a) #(a b a))) -) + (#(a a) #(a b a)) + (h1 #s((bozo 1 building 2) 6 'gubber 'no)) +)) diff --git a/src/mzscheme/src/places.c b/src/mzscheme/src/places.c index 63bee669c7..d73707c47b 100644 --- a/src/mzscheme/src/places.c +++ b/src/mzscheme/src/places.c @@ -29,6 +29,7 @@ static int scheme_place_channel_ready(Scheme_Object *so); void scheme_place_async_send(Scheme_Place_Async_Channel *ch, Scheme_Object *o); Scheme_Object *scheme_place_async_recv(Scheme_Place_Async_Channel *ch); +Scheme_Object *scheme_places_deep_copy_worker(Scheme_Object *so, Scheme_Hash_Table *ht); # ifdef MZ_PRECISE_GC static void register_traversers(void); @@ -407,12 +408,42 @@ static Scheme_Object *scheme_place_p(int argc, Scheme_Object *args[]) return SAME_TYPE(SCHEME_TYPE(args[0]), scheme_place_type) ? scheme_true : scheme_false; } -Scheme_Object *scheme_places_deep_copy(Scheme_Object *so) +Scheme_Object *scheme_places_deep_copy(Scheme_Object *so) { + Scheme_Object *new_so = so; + if (SCHEME_INTP(so)) { + return so; + } + + switch (so->type) { + case scheme_pair_type: + case scheme_vector_type: + case scheme_struct_type_type: + case scheme_structure_type: + { + Scheme_Hash_Table *ht; + ht = scheme_make_hash_table(SCHEME_hash_ptr); + new_so = scheme_places_deep_copy_worker(so, ht); + } + break; + default: + new_so = scheme_places_deep_copy_worker(so, NULL); + break; + } + return new_so; +} + +Scheme_Object *scheme_places_deep_copy_worker(Scheme_Object *so, Scheme_Hash_Table *ht) { Scheme_Object *new_so = so; if (SCHEME_INTP(so)) { return so; } + if (ht) { + Scheme_Object *r; + if ((r = scheme_hash_get(ht, so))) { + return r; + } + } switch (so->type) { case scheme_true_type: @@ -420,7 +451,38 @@ Scheme_Object *scheme_places_deep_copy(Scheme_Object *so) case scheme_null_type: new_so = so; break; - case scheme_char_string_type: /*43*/ + case scheme_char_type: + new_so = scheme_make_char(SCHEME_CHAR_VAL(so)); + break; + case scheme_rational_type: + { + Scheme_Object *n; + Scheme_Object *d; + n = scheme_rational_numerator(so); + d = scheme_rational_denominator(so); + n = scheme_places_deep_copy_worker(n, ht); + d = scheme_places_deep_copy_worker(d, ht); + new_so = scheme_make_rational(n, d); + } + break; + case scheme_float_type: + new_so = scheme_make_char(SCHEME_FLT_VAL(so)); + break; + case scheme_double_type: + new_so = scheme_make_char(SCHEME_DBL_VAL(so)); + break; + case scheme_complex_type: + { + Scheme_Object *r; + Scheme_Object *i; + r = scheme_complex_real_part(so); + i = scheme_complex_imaginary_part(so); + r = scheme_places_deep_copy_worker(r, ht); + i = scheme_places_deep_copy_worker(i, ht); + new_so = scheme_make_complex(r, i); + } + break; + case scheme_char_string_type: new_so = scheme_make_sized_offset_char_string(SCHEME_CHAR_STR_VAL(so), 0, SCHEME_CHAR_STRLEN_VAL(so), 1); break; case scheme_byte_string_type: @@ -441,8 +503,8 @@ Scheme_Object *scheme_places_deep_copy(Scheme_Object *so) Scheme_Object *car; Scheme_Object *cdr; Scheme_Object *pair; - car = scheme_places_deep_copy(SCHEME_CAR(so)); - cdr = scheme_places_deep_copy(SCHEME_CDR(so)); + car = scheme_places_deep_copy_worker(SCHEME_CAR(so), ht); + cdr = scheme_places_deep_copy_worker(SCHEME_CDR(so), ht); pair = scheme_make_pair(car, cdr); return pair; } @@ -455,22 +517,93 @@ Scheme_Object *scheme_places_deep_copy(Scheme_Object *so) vec = scheme_make_vector(size, 0); for (i = 0; i stype; + Scheme_Struct_Type *ptype = stype->parent_types[stype->name_pos - 1]; + long i; + long size = stype->num_slots; + int local_slots = stype->num_slots - (ptype ? ptype->num_slots : 0); + + if (!stype->prefab_key) { + scheme_log_abort("cannot copy non prefab structure"); + abort(); + } + { + int i = 0; + for (i = 0; i < local_slots; i++) { + if (!stype->immutables || stype->immutables[i] != 1) { + scheme_log_abort("cannot copy mutable prefab structure"); + abort(); + } + } + } + + nst = (Scheme_Structure*) scheme_make_blank_prefab_struct_instance(stype); + for (i = 0; i slots[i], ht); + nst->slots[i] = tmp; + } + new_so = (Scheme_Object*)nst; + } + break; case scheme_resolved_module_path_type: default: scheme_log_abort("cannot copy object"); abort(); break; } + if (ht) { + scheme_hash_set(ht, so, new_so); + } return new_so; } +Scheme_Struct_Type *scheme_make_prefab_struct_type_in_master(Scheme_Object *base, + Scheme_Object *parent, + int num_fields, + int num_uninit_fields, + Scheme_Object *uninit_val, + char *immutable_array) +{ +# ifdef MZ_PRECISE_GC + void *original_gc; +# endif + Scheme_Object *cname; + Scheme_Object *cuninit_val; + char *cimm_array = NULL; + int local_slots = num_fields + num_uninit_fields; + Scheme_Struct_Type *stype; + +# ifdef MZ_PRECISE_GC + original_gc = GC_switch_to_master_gc(); +# endif + + cname = scheme_places_deep_copy(base); + cuninit_val = scheme_places_deep_copy(uninit_val); + if (local_slots) { + cimm_array = (char *)scheme_malloc_atomic(local_slots); + memcpy(cimm_array, immutable_array, local_slots); + } + stype = scheme_make_prefab_struct_type_raw(cname, parent, num_fields, num_uninit_fields, cuninit_val, cimm_array); + +# ifdef MZ_PRECISE_GC + GC_switch_back_from_master(original_gc); +# endif + + return stype; +} + static void *place_start_proc(void *data_arg) { void *stack_base; Place_Start_Data *place_data; @@ -585,6 +718,95 @@ Scheme_Object *scheme_place_recv(int argc, Scheme_Object *args[]) { } # ifdef MZ_PRECISE_GC +void force_hash_worker(Scheme_Object *so, Scheme_Hash_Table *ht); +Scheme_Hash_Table *force_hash(Scheme_Object *so) { + if (SCHEME_INTP(so)) { + return NULL; + } + + switch (so->type) { + case scheme_pair_type: + case scheme_vector_type: + case scheme_struct_type_type: + case scheme_structure_type: + { + Scheme_Hash_Table *ht; + ht = scheme_make_hash_table(SCHEME_hash_ptr); + force_hash_worker(so, ht); + return ht; + } + break; + default: + break; + } + return NULL; +} + +void force_hash_worker(Scheme_Object *so, Scheme_Hash_Table *ht) +{ + if (SCHEME_INTP(so)) { + return; + } + if (ht) { + Scheme_Object *r; + if ((r = scheme_hash_get(ht, so))) { + return; + } + } + + switch (so->type) { + case scheme_true_type: + case scheme_false_type: + case scheme_null_type: + case scheme_char_type: + case scheme_rational_type: + case scheme_float_type: + case scheme_double_type: + case scheme_complex_type: + case scheme_char_string_type: + case scheme_byte_string_type: + case scheme_unix_path_type: + case scheme_symbol_type: + break; + case scheme_pair_type: + { + force_hash_worker(SCHEME_CAR(so), ht); + force_hash_worker(SCHEME_CDR(so), ht); + } + break; + case scheme_vector_type: + { + long i; + long size = SCHEME_VEC_SIZE(so); + for (i = 0; i stype; + long i; + long size = stype->num_slots; + + for (i = 0; i slots[i], ht); + } + } + break; + case scheme_resolved_module_path_type: + default: + scheme_log_abort("cannot copy object"); + abort(); + break; + } + if (ht) { + scheme_hash_set(ht, so, NULL); + } + return; +} + static void* scheme_master_place_handlemsg(int msg_type, void *msg_payload) { switch(msg_type) { @@ -620,6 +842,14 @@ static void* scheme_master_place_handlemsg(int msg_type, void *msg_payload) void* scheme_master_fast_path(int msg_type, void *msg_payload) { Scheme_Object *o; void *original_gc; + Scheme_Hash_Table *ht; + + switch(msg_type) { + case 1: + case 5: + ht = force_hash(msg_payload); + break; + } # ifdef MZ_PRECISE_GC original_gc = GC_switch_to_master_gc(); diff --git a/src/mzscheme/src/schpriv.h b/src/mzscheme/src/schpriv.h index 9cc124afcf..0c5608bcf1 100644 --- a/src/mzscheme/src/schpriv.h +++ b/src/mzscheme/src/schpriv.h @@ -729,9 +729,22 @@ Scheme_Object *scheme_is_writable_struct(Scheme_Object *s); extern Scheme_Object *scheme_source_property; Scheme_Struct_Type *scheme_lookup_prefab_type(Scheme_Object *key, int field_count); +Scheme_Object *scheme_make_blank_prefab_struct_instance(Scheme_Struct_Type *stype); Scheme_Object *scheme_make_prefab_struct_instance(Scheme_Struct_Type *stype, Scheme_Object *vec); Scheme_Object *scheme_clone_prefab_struct_instance(Scheme_Structure *s); +Scheme_Struct_Type *scheme_make_prefab_struct_type_in_master(Scheme_Object *base, + Scheme_Object *parent, + int num_slots, + int num_islots, + Scheme_Object *uninit_val, + char *immutable_pos_list); +Scheme_Struct_Type *scheme_make_prefab_struct_type_raw(Scheme_Object *base, + Scheme_Object *parent, + int num_slots, + int num_islots, + Scheme_Object *uninit_val, + char *immutable_pos_list); Scheme_Object *scheme_extract_checked_procedure(int argc, Scheme_Object **argv); From 20b39568addb61dec2648e10c161ca0b5a3b146e Mon Sep 17 00:00:00 2001 From: Kevin Tew Date: Thu, 1 Apr 2010 22:18:06 +0000 Subject: [PATCH 057/202] Whitespace fixes svn: r18716 --- src/mzscheme/src/struct.c | 54 +++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/mzscheme/src/struct.c b/src/mzscheme/src/struct.c index ae6552c388..50bafff092 100644 --- a/src/mzscheme/src/struct.c +++ b/src/mzscheme/src/struct.c @@ -3553,11 +3553,11 @@ static void struct_type_set_if_immutable(Scheme_Struct_Type *struct_type) { } Scheme_Struct_Type *scheme_make_prefab_struct_type_raw(Scheme_Object *base, - Scheme_Object *parent, - int num_fields, - int num_uninit_fields, - Scheme_Object *uninit_val, - char *immutable_array) + Scheme_Object *parent, + int num_fields, + int num_uninit_fields, + Scheme_Object *uninit_val, + char *immutable_array) { Scheme_Struct_Type *struct_type, *parent_type; int j, depth; @@ -3595,11 +3595,11 @@ Scheme_Struct_Type *scheme_make_prefab_struct_type_raw(Scheme_Object *base, } static Scheme_Struct_Type *scheme_make_prefab_struct_type(Scheme_Object *base, - Scheme_Object *parent, - int num_fields, - int num_uninit_fields, - Scheme_Object *uninit_val, - char *immutable_array) + Scheme_Object *parent, + int num_fields, + int num_uninit_fields, + Scheme_Object *uninit_val, + char *immutable_array) { #ifdef MZ_USE_PLACES return scheme_make_prefab_struct_type_in_master @@ -3607,23 +3607,23 @@ static Scheme_Struct_Type *scheme_make_prefab_struct_type(Scheme_Object *base, return scheme_make_prefab_struct_type_raw #endif (base, - parent, - num_fields, - num_uninit_fields, - uninit_val, - immutable_array); + parent, + num_fields, + num_uninit_fields, + uninit_val, + immutable_array); } static Scheme_Object *_make_struct_type(Scheme_Object *base, - Scheme_Object *parent, - Scheme_Object *inspector, - int num_fields, - int num_uninit_fields, - Scheme_Object *uninit_val, - Scheme_Object *props, - Scheme_Object *proc_attr, - char *immutable_array, - Scheme_Object *guard) + Scheme_Object *parent, + Scheme_Object *inspector, + int num_fields, + int num_uninit_fields, + Scheme_Object *uninit_val, + Scheme_Object *props, + Scheme_Object *proc_attr, + char *immutable_array, + Scheme_Object *guard) { Scheme_Struct_Type *struct_type, *parent_type; int j, depth, checked_proc = 0; @@ -4173,9 +4173,9 @@ static Scheme_Object *make_struct_type(int argc, Scheme_Object **argv) } type = scheme_make_prefab_struct_type(argv[0], - SCHEME_FALSEP(argv[1]) ? NULL : argv[1], - initc, uninitc, - uninit_val, + SCHEME_FALSEP(argv[1]) ? NULL : argv[1], + initc, uninitc, + uninit_val, immutable_array); } else { From 664cfa2e31d18846378ccadb5e9f6d789f859d1b Mon Sep 17 00:00:00 2001 From: Stevie Strickland Date: Fri, 2 Apr 2010 00:15:24 +0000 Subject: [PATCH 058/202] Given the other uses of #:mode public-final in this file, I assume that the quote was a mistake. svn: r18717 --- collects/scribblings/gui/editor-intf.scrbl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collects/scribblings/gui/editor-intf.scrbl b/collects/scribblings/gui/editor-intf.scrbl index eb14fc38ac..a15fa7a570 100644 --- a/collects/scribblings/gui/editor-intf.scrbl +++ b/collects/scribblings/gui/editor-intf.scrbl @@ -905,7 +905,7 @@ See also @method[editor<%> local-to-global]. } -@defmethod[#:mode 'public-final (in-edit-sequence?) +@defmethod[#:mode public-final (in-edit-sequence?) boolean?]{ Returns @scheme[#t] if updating on this editor is currently delayed From 2a2562aa87ab627a25f62fa6ce53bc324f8ba0b1 Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Fri, 2 Apr 2010 07:28:09 +0000 Subject: [PATCH 059/202] Welcome to a new PLT day. svn: r18718 --- collects/repos-time-stamp/stamp.ss | 2 +- src/worksp/mred/mred.manifest | 2 +- src/worksp/mred/mred.rc | 8 ++++---- src/worksp/mzcom/mzcom.rc | 8 ++++---- src/worksp/mzcom/mzobj.rgs | 6 +++--- src/worksp/mzscheme/mzscheme.rc | 8 ++++---- src/worksp/starters/start.rc | 8 ++++---- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/collects/repos-time-stamp/stamp.ss b/collects/repos-time-stamp/stamp.ss index 909a731722..71318cfbb3 100644 --- a/collects/repos-time-stamp/stamp.ss +++ b/collects/repos-time-stamp/stamp.ss @@ -1 +1 @@ -#lang scheme/base (provide stamp) (define stamp "29mar2010") +#lang scheme/base (provide stamp) (define stamp "2apr2010") diff --git a/src/worksp/mred/mred.manifest b/src/worksp/mred/mred.manifest index fe2f1b93c4..9be6cf46d6 100644 --- a/src/worksp/mred/mred.manifest +++ b/src/worksp/mred/mred.manifest @@ -1,7 +1,7 @@ Date: Fri, 2 Apr 2010 12:22:08 +0000 Subject: [PATCH 060/202] fix bug in JIT handling of wcm svn: r18719 --- src/mzscheme/src/jit.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/mzscheme/src/jit.c b/src/mzscheme/src/jit.c index 898e1f4bf6..a8acf27d4e 100644 --- a/src/mzscheme/src/jit.c +++ b/src/mzscheme/src/jit.c @@ -11850,14 +11850,17 @@ static int do_generate_common(mz_jit_state *jitter, void *_data) jit_stxi_p(&((Scheme_Cont_Mark *)0x0)->val, JIT_R0, JIT_R1); (void)jit_movi_p(JIT_R1, NULL); jit_stxi_p(&((Scheme_Cont_Mark *)0x0)->cache, JIT_R0, JIT_R1); - ref5 = jit_jmpi(jit_forward()); CHECK_LIMIT(); + + /* return: */ + ref5 = _jit.x.pc; + mz_epilog(JIT_R2); /* slow path: */ mz_patch_branch(ref4); mz_patch_ucbranch(ref8); - JIT_UPDATE_THREAD_RSPTR_IF_NEEDED(); + JIT_UPDATE_THREAD_RSPTR(); jit_ldxi_p(JIT_R0, JIT_RUNSTACK, WORDS_TO_BYTES(0)); jit_ldxi_p(JIT_V1, JIT_RUNSTACK, WORDS_TO_BYTES(1)); @@ -11869,9 +11872,7 @@ static int do_generate_common(mz_jit_state *jitter, void *_data) (void)mz_finish(scheme_set_cont_mark); CHECK_LIMIT(); - mz_patch_ucbranch(ref5); - - mz_epilog(JIT_R2); + (void)jit_jmpi(ref5); register_sub_func(jitter, wcm_code, scheme_false); } From 7b61ba023d788d2946ff20e2b6a4828aa9df634c Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Fri, 2 Apr 2010 18:53:29 +0000 Subject: [PATCH 061/202] New library formlets svn: r18720 --- collects/tests/web-server/formlets-test.ss | 51 +++++++++++++ collects/web-server/formlets/input.ss | 74 +++++++++++++++++++ .../web-server/scribblings/formlets.scrbl | 30 +++++++- 3 files changed, 153 insertions(+), 2 deletions(-) diff --git a/collects/tests/web-server/formlets-test.ss b/collects/tests/web-server/formlets-test.ss index 78eb6fb936..1d73f9c375 100644 --- a/collects/tests/web-server/formlets-test.ss +++ b/collects/tests/web-server/formlets-test.ss @@ -137,6 +137,19 @@ (test-equal? "make-input" (test-process (make-input (lambda (n) n)) empty) #f) + + (test-equal? "make-input*" + (map ->cons (test-process (make-input* (lambda (n) n)) (list (make-binding:form #"input_0" #"value")))) + (list (cons #"input_0" #"value"))) + (test-equal? "make-input*" + (map ->cons (test-process (make-input* (lambda (n) n)) (list (make-binding:form #"input_0" #"value0") + (make-binding:form #"input_0" #"value1")))) + (list (cons #"input_0" #"value0") + (cons #"input_0" #"value1"))) + (test-equal? "make-input*" + (test-process (make-input* (lambda (n) n)) empty) + empty) + (test-equal? "text-input" (->cons (test-process (text-input) (list (make-binding:form #"input_0" #"value")))) (cons #"input_0" #"value")) @@ -147,6 +160,37 @@ (->cons (test-process (checkbox #"start" #t) (list (make-binding:form #"input_0" #"value")))) (cons #"input_0" #"value")) + (test-equal? "multiselect-input" + (test-process (multiselect-input (list 1 2 3)) + (list (make-binding:form #"input_0" #"0"))) + (list 1)) + (test-equal? "multiselect-input" + (test-process (multiselect-input (list 1 2 3)) + (list (make-binding:form #"input_0" #"0") + (make-binding:form #"input_0" #"2"))) + (list 1 3)) + (test-equal? "multiselect-input" + (test-process (multiselect-input (list 1 2 3)) + empty) + empty) + + ; XXX check output + + (test-equal? "select-input" + (test-process (select-input (list 1 2 3)) + (list (make-binding:form #"input_0" #"0"))) + 1) + (test-equal? "select-input" + (test-process (select-input (list 1 2 3)) + (list (make-binding:form #"input_0" #"0") + (make-binding:form #"input_0" #"2"))) + 1) + (test-exn "select-input" + exn? + (lambda () + (test-process (select-input (list 1 2 3)) + empty))) + (test-equal? "required" (test-process (required (text-input)) (list (make-binding:form #"input_0" #"value"))) #"value") @@ -162,6 +206,10 @@ (test-process (default #"def" (text-input)) empty) #"def") + (test-equal? "textarea-input" + (test-process (textarea-input) (list (make-binding:form #"input_0" #"value"))) + "value") + (test-equal? "to-string" (test-process (to-string (required (text-input))) (list (make-binding:form #"input_0" #"value"))) "value") @@ -254,3 +302,6 @@ (list "Jay" (make-date 10 6) (make-date 10 8)))))) )) + +(require schemeunit/text-ui) +(run-tests all-formlets-tests) \ No newline at end of file diff --git a/collects/web-server/formlets/input.ss b/collects/web-server/formlets/input.ss index c0b51f61f4..ae2ce89b02 100644 --- a/collects/web-server/formlets/input.ss +++ b/collects/web-server/formlets/input.ss @@ -9,6 +9,16 @@ ; Low-level (define (next-name i) (values (format "input_~a" i) (add1 i))) +(define (make-input* render) + (lambda (i) + (let-values ([(w i) (next-name i)]) + (define wb (string->bytes/utf-8 w)) + (values (list (render w)) + (lambda (env) + (for/list ([b (in-list env)] + #:when (bytes=? wb (binding-id b))) + b)) + i)))) (define (make-input render) (lambda (i) (let-values ([(w i) (next-name i)]) @@ -31,6 +41,7 @@ default)))) (provide/contract + [make-input* ((string? . -> . pretty-xexpr/c) . -> . (formlet/c (listof binding?)))] [make-input ((string? . -> . pretty-xexpr/c) . -> . (formlet/c (or/c false/c binding?)))] #;[binding:form-required (formlet/c (binding? . -> . bytes?))] #;[binding:form/default (bytes? . -> . (formlet/c (binding? . -> . bytes?)))]) @@ -110,7 +121,70 @@ ; XXX button +(define (multiselect-input l + #:multiple? [multiple? #t] + #:selected? [selected? (λ (x) #f)] + #:display [display (λ (x) x)]) + (define value->element (make-hasheq)) + (define i 0) + (define (remember! e) + (define this-i + (begin0 i (set! i (add1 i)))) + (hash-set! value->element this-i e)) + (define (recall i) + (hash-ref value->element i + (λ () (error 'input-select* "Invalid selection: ~e" i)))) + (for ([e l]) + (remember! e)) + (cross + (pure + (lambda (bs) + (map (compose recall string->number + bytes->string/utf-8 + binding:form-value) + bs))) + (make-input* + (lambda (name) + `(select (,@(if multiple? '([multiple "true"]) empty) + [name ,name]) + ,@(for/list ([(vn e) (in-hash value->element)]) + (define v (number->string vn)) + `(option ([value ,v] + ,@(if (selected? e) + '([selected "true"]) + empty)) + ,(display e)))))))) + +(define (select-input l + #:selected? [selected? (λ (x) #f)] + #:display [display (λ (x) x)]) + (cross + (pure first) + (multiselect-input l + #:multiple? #f + #:selected? selected? + #:display display))) + +(define (textarea-input) + (to-string + (required + (make-input + (lambda (n) + (list 'textarea + (list (list 'name n)) + "")))))) + (provide/contract + [multiselect-input (->* (sequence?) + (#:multiple? boolean? + #:selected? (any/c . -> . boolean?) + #:display (any/c . -> . pretty-xexpr/c)) + (formlet/c (listof any/c)))] + [select-input (->* (sequence?) + (#:selected? (any/c . -> . boolean?) + #:display (any/c . -> . pretty-xexpr/c)) + (formlet/c any/c))] + [textarea-input (-> (formlet/c string?))] [text-input (() (#:value (or/c false/c bytes?) #:size (or/c false/c exact-nonnegative-integer?) diff --git a/collects/web-server/scribblings/formlets.scrbl b/collects/web-server/scribblings/formlets.scrbl index 6dd1969584..376dd14926 100644 --- a/collects/web-server/scribblings/formlets.scrbl +++ b/collects/web-server/scribblings/formlets.scrbl @@ -206,6 +206,12 @@ These @tech{formlet}s are the main combinators for form input. extracted @scheme[binding]. } +@defproc[(make-input* [render (string? . -> . xexpr/c)]) + (formlet/c (listof binding?))]{ + This @tech{formlet} is rendered with @scheme[render], which is passed the input name, and results in all the + @scheme[binding]s that use the name. +} + @defproc[(text-input [#:value value (or/c false/c bytes?) #f] [#:size size (or/c false/c exact-nonnegative-integer?) #f] [#:max-length max-length (or/c false/c exact-nonnegative-integer?) #f] @@ -223,14 +229,34 @@ These @tech{formlet}s are the main combinators for form input. (formlet/c (or/c false/c binding?))]{ This @tech{formlet} renders using an INPUT element with the PASSWORD type and the attributes given in the arguments. } - + +@defproc[(textarea-input) + (formlet/c string?)]{ + This @tech{formlet} renders using an TEXTAREA element. +} + @defproc[(checkbox [value bytes?] [checked? boolean?] [#:attributes attrs (listof (list/c symbol? string?)) empty]) (formlet/c (or/c false/c binding?))]{ This @tech{formlet} renders using a INPUT elemen with the CHECKBOX type and the attributes given in the arguments. -} +} +@defproc[(multiselect-input [l sequence?] + [#:multiple? multiple? boolean? #t] + [#:selected? selected? (any/c . -> . boolean?) (λ (x) #f)] + [#:display display (any/c . -> . xexpr/c) (λ (x) x)]) + (formlet/c list?)]{ + This @tech{formlet} renders using an SELECT element with an OPTION for each element of the sequence. If @scheme[multiple?] is @scheme[#t], then multiple options may be selected. An element is selected if @scheme[selected?] returns @scheme[#t]. Elements are displayed with @scheme[display]. +} + +@defproc[(select-input [l sequence?] + [#:selected? selected? (any/c . -> . boolean?) (λ (x) #f)] + [#:display display (any/c . -> . xexpr/c) (λ (x) x)]) + (formlet/c any/c)]{ + This @tech{formlet} renders using an SELECT element with an OPTION for each element of the sequence. An element is selected if @scheme[selected?] returns @scheme[#t]. Elements are displayed with @scheme[display]. +} + @defproc[(required [f (formlet/c (or/c false/c binding?))]) (formlet/c bytes?)]{ Constructs a @tech{formlet} that extracts the @scheme[binding:form-value] from the binding produced by @scheme[f], or errors. From 2a87df9e5c15e3320176cc758a006ad5c4b43842 Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Fri, 2 Apr 2010 20:55:36 +0000 Subject: [PATCH 062/202] Supporting arguments in dispatch pattern arguments svn: r18724 --- collects/tests/web-server/dispatch-test.ss | 93 +++++++++++++------ collects/web-server/dispatch/bidi-match.ss | 6 +- collects/web-server/dispatch/pattern.ss | 12 +-- collects/web-server/dispatch/syntax.ss | 28 +++++- .../web-server/scribblings/dispatch.scrbl | 20 ++++ 5 files changed, 115 insertions(+), 44 deletions(-) diff --git a/collects/tests/web-server/dispatch-test.ss b/collects/tests/web-server/dispatch-test.ss index 96b7e28c2e..720f5ecb26 100644 --- a/collects/tests/web-server/dispatch-test.ss +++ b/collects/tests/web-server/dispatch-test.ss @@ -21,17 +21,17 @@ "Dispatch" #;(local - [(define-syntax test-match=> - (syntax-rules () - [(_ val pat res) - (test-equal? (format "~S" 'pat) - (match=> val [pat => (lambda x x)]) - res)]))] - (test-suite - "match" - - (test-match=> (list 1 2) (list a b) (list 1 2)) - (test-match=> (list 1 2) (list _ b) (list 2)))) + [(define-syntax test-match=> + (syntax-rules () + [(_ val pat res) + (test-equal? (format "~S" 'pat) + (match=> val [pat => (lambda x x)]) + res)]))] + (test-suite + "match" + + (test-match=> (list 1 2) (list a b) (list 1 2)) + (test-match=> (list 1 2) (list _ b) (list 2)))) (test-suite "coercion" @@ -193,11 +193,11 @@ 'string-arg) (check-pred symbol? (second (first (map syntax->datum (dispatch-pattern->dispatch-pattern/ids #'((string-arg)))))))))) - (test-exn "dispatch-pattern?" exn? (lambda () (dispatch-pattern? #'((... ...))))) - (test-exn "dispatch-pattern?" exn? (lambda () (dispatch-pattern? #'("foo" (... ...))))) - (test-exn "dispatch-pattern?" exn? (lambda () (dispatch-pattern? #'((integer-arg a) (... ...))))) - (test-exn "dispatch-pattern?" exn? (lambda () (dispatch-pattern? #'((integer-arg a))))) - (test-exn "dispatch-pattern?" exn? (lambda () (dispatch-pattern? #'((list a b) (... ...))))) + (test-exn "dispatch-pattern? ..." exn? (lambda () (dispatch-pattern? #'((... ...))))) + (test-exn "dispatch-pattern? foo ..." exn? (lambda () (dispatch-pattern? #'("foo" (... ...))))) + (test-not-false "dispatch-pattern? integer-arg a ..." (dispatch-pattern? #'((integer-arg a) (... ...)))) + (test-not-false "dispatch-pattern? integer-arg a " (dispatch-pattern? #'((integer-arg a)))) + (test-not-false "dispatch-pattern? list a b" (dispatch-pattern? #'((list a b) (... ...)))) (test-not-false "dispatch-pattern?" (dispatch-pattern? #'((integer-arg) (... ...)))) (test-not-false "dispatch-pattern?" (dispatch-pattern? #'((integer-arg)))) (test-not-false "dispatch-pattern?" (dispatch-pattern? #'("foo"))) @@ -206,75 +206,108 @@ (test-exn "dispatch-pattern/ids?" exn? (lambda () (dispatch-pattern/ids? #'("foo" (... ...))))) (test-not-false "dispatch-pattern/ids?" (dispatch-pattern/ids? #'((integer-arg a) (... ...)))) (test-not-false "dispatch-pattern/ids?" (dispatch-pattern/ids? #'((integer-arg a)))) - (test-exn "dispatch-pattern/ids?" exn? (lambda () (dispatch-pattern/ids? #'((list a b) (... ...))))) + (test-not-false "dispatch-pattern/ids?" (dispatch-pattern/ids? #'((list a b) (... ...)))) (test-exn "dispatch-pattern/ids?" exn? (lambda () (dispatch-pattern/ids? #'((integer-arg) (... ...))))) (test-exn "dispatch-pattern/ids?" exn? (lambda () (dispatch-pattern/ids? #'((integer-arg))))) (test-not-false "dispatch-pattern/ids?" (dispatch-pattern/ids? #'("foo")))) (local [(define-syntax test-arg (syntax-rules () - [(_ arg + [(_ (arg arg-a ...) ([in-expr out-expr] ...) [in-fail-expr ...] [out-fail-expr ...]) (test-suite (format "~S" 'arg) (test-equal? (format "in ~S" in-expr) (syntax-parameterize ([bidi-match-going-in? #t]) - (match in-expr [(arg a) a])) + (match in-expr [(arg arg-a ... a) a])) out-expr) ... (test-equal? (format "out ~S" out-expr) (syntax-parameterize ([bidi-match-going-in? #f]) - (match out-expr [(arg a) a])) + (match out-expr [(arg arg-a ... a) a])) in-expr) ... (test-false (format "in-fail ~S" in-fail-expr) (syntax-parameterize ([bidi-match-going-in? #t]) - (match in-fail-expr [(arg a) a] [_ #f]))) + (match in-fail-expr [(arg arg-a ... a) a] [_ #f]))) ... (test-false (format "out-fail ~S" out-fail-expr) (syntax-parameterize ([bidi-match-going-in? #f]) - (match out-fail-expr [(arg a) a] [_ #f]))) + (match out-fail-expr [(arg arg-a ... a) a] [_ #f]))) ...)]))] (test-suite "url-patterns" - (test-arg number-arg + (test-arg (number-arg) (["1" 1] ["2.3" 2.3] ["+inf.0" +inf.0]) ["a"] ['a #t]) - (test-arg integer-arg + (test-arg (integer-arg) (["1" 1]) ["a" "2.3" "+inf.0"] ['a #t 2.3 +inf.0]) - (test-arg real-arg + (test-arg (real-arg) (["1" 1] ["2.3" 2.3] ["+inf.0" +inf.0]) ["a"] ['a #t]) - (test-arg string-arg + (test-arg (string-arg) (["1" "1"] ["foo" "foo"] ["/" "/"]) [] ['a #t 5]) - (test-arg symbol-arg + (test-arg (symbol-arg) (["1" '|1|] ["foo" 'foo] ["/" '/]) [] - ["a" #t 5]))) + ["a" #t 5]) + + (local [(define-match-expander const-m + (syntax-rules () + [(_ v id) (? (curry equal? v) id)])) + (define-bidi-match-expander const-arg const-m const-m)] + (test-arg (const-arg "1") + (["1" "1"]) + ["2"] + ["2"])))) (test-suite "syntax" + (local + [(define (list-posts req) `(list-posts)) + (define (review-post req p) `(review-post ,p)) + (define (review-archive req y m) `(review-archive ,y ,m)) + (define-values (blog-dispatch blog-url blog-applies?) + (dispatch-rules+applies + [("") list-posts] + [() list-posts] + [("posts" (string-arg)) review-post] + [("archive" (integer-arg) (integer-arg)) review-archive])) + (define (test-blog-dispatch url) + (test-not-false url (blog-applies? (test-request (string->url url))))) + (define (test-blog-dispatch/exn url) + (test-false url (blog-applies? (test-request (string->url url)))))] + + (test-blog-dispatch "http://www.example.com") + (test-blog-dispatch "http://www.example.com/") + (test-blog-dispatch "http://www.example.com/posts/hello-world") + (test-blog-dispatch "http://www.example.com/archive/2008/02") + (test-blog-dispatch/exn "http://www.example.com/posts") + (test-blog-dispatch/exn "http://www.example.com/archive/post/02") + (test-blog-dispatch/exn "http://www.example.com/archive/2008/post") + (test-blog-dispatch/exn "http://www.example.com/foo")) + (local [(define (list-posts req) `(list-posts)) (define (review-post req p) `(review-post ,p)) @@ -425,5 +458,5 @@ #;(test-serve/dispatch) -#;(require (planet schematics/schemeunit:3/text-ui)) -#;(run-tests all-dispatch-tests) +(require schemeunit/text-ui) +(run-tests all-dispatch-tests) diff --git a/collects/web-server/dispatch/bidi-match.ss b/collects/web-server/dispatch/bidi-match.ss index e0514d96d6..5e2a9b184f 100644 --- a/collects/web-server/dispatch/bidi-match.ss +++ b/collects/web-server/dispatch/bidi-match.ss @@ -10,10 +10,10 @@ (define-match-expander bidi-id (lambda (stx) (syntax-case stx () - [(_ id) + [(_ arg (... ...) id) (if (syntax-parameter-value #'bidi-match-going-in?) - (syntax/loc stx (in-expander id)) - (syntax/loc stx (out-expander id)))]))))])) + (syntax/loc stx (in-expander arg (... ...) id)) + (syntax/loc stx (out-expander arg (... ...) id)))]))))])) (provide bidi-match-going-in? define-bidi-match-expander) diff --git a/collects/web-server/dispatch/pattern.ss b/collects/web-server/dispatch/pattern.ss index 30e04a56ca..beb7243851 100644 --- a/collects/web-server/dispatch/pattern.ss +++ b/collects/web-server/dispatch/pattern.ss @@ -14,7 +14,7 @@ (define (dispatch/no-...? stx) (syntax-case stx () [() #t] - [((bidi) . rest-stx) + [((bidi arg ...) . rest-stx) (dispatch/...? #'rest-stx)] [(string . rest-stx) (string-syntax? #'string) @@ -22,7 +22,7 @@ (define (dispatch/...? stx) (syntax-case stx () [() #t] - [((bidi) . rest-stx) + [((bidi arg ...) . rest-stx) (dispatch/...? #'rest-stx)] [(string . rest-stx) (string-syntax? #'string) @@ -35,7 +35,7 @@ (define (dispatch/no-...? stx) (syntax-case stx () [() #t] - [((bidi id) . rest-stx) + [((bidi arg ... id) . rest-stx) (identifier? #'id) (dispatch/...? #'rest-stx)] [(string . rest-stx) @@ -44,7 +44,7 @@ (define (dispatch/...? stx) (syntax-case stx () [() #t] - [((bidi id) . rest-stx) + [((bidi arg ... id) . rest-stx) (identifier? #'id) (dispatch/...? #'rest-stx)] [(string . rest-stx) @@ -78,9 +78,9 @@ [(...? pp) pp] [else - (with-syntax ([(bidi-id) pp] + (with-syntax ([(bidi-id arg ...) pp] [id ppi]) - (syntax/loc pp (bidi-id id)))])) + (syntax/loc pp (bidi-id arg ... id)))])) (syntax->list pps) (generate-temporaries pps))) diff --git a/collects/web-server/dispatch/syntax.ss b/collects/web-server/dispatch/syntax.ss index 8069d87ce6..005bfc9972 100644 --- a/collects/web-server/dispatch/syntax.ss +++ b/collects/web-server/dispatch/syntax.ss @@ -33,11 +33,11 @@ ([((path-pat-id ...) ...) (map (lambda (pp/is) (map (lambda (bs) - (with-syntax ([(bidi-id id) bs]) + (with-syntax ([(bidi-id arg ... id) bs]) #'id)) (filter (lambda (pp/i) (syntax-case pp/i () - [(bidi-id id) #t] + [(bidi-id arg ... id) #t] [_ #f])) (syntax->list pp/is)))) (syntax->list #'((path-pat/id ...) ...)))]) @@ -73,7 +73,7 @@ (for/list ([pp/i (dispatch-pattern-not-... pp/is)] [next-...? (dispatch-pattern-next-...? pp/is)]) (with-syntax ([pp pp/i] - [(bidi-id id) pp/i]) + [(bidi-id arg ... id) pp/i]) (if next-...? (syntax/loc pp/i (list pp (... ...))) pp/i)))) @@ -89,7 +89,7 @@ (with-syntax ([pp pp/i]) (if (string-syntax? pp/i) (syntax/loc pp/i (list pp)) - (with-syntax ([(bidi-id id) pp/i]) + (with-syntax ([(bidi-id arg ... id) pp/i]) (if next-...? (syntax/loc pp/i id) (syntax/loc pp/i (list id)))))))) @@ -122,6 +122,24 @@ ... [else default-else]))])) +(define (dispatch-succ . _) #t) +(define (dispatch-fail . _) #f) + +(define-syntax-rule (dispatch-rules+applies + [pat fun] + ...) + (let-values ([(dispatch url) + (dispatch-rules + [pat fun] + ...)] + [(applies? _) + (dispatch-rules + [pat dispatch-succ] + ... + [else dispatch-fail])]) + (values dispatch url applies?))) + (provide dispatch-case dispatch-url - dispatch-rules) + dispatch-rules + dispatch-rules+applies) diff --git a/collects/web-server/scribblings/dispatch.scrbl b/collects/web-server/scribblings/dispatch.scrbl index ce8c8bd54c..ad3da5996f 100644 --- a/collects/web-server/scribblings/dispatch.scrbl +++ b/collects/web-server/scribblings/dispatch.scrbl @@ -80,6 +80,7 @@ After mastering the world of blogging software, you decide to put the ubiquitous (dispatch-rules [((integer-arg) ...) sum] [else (lambda (req) (sum req empty))])) + (define (sum req is) (apply + is)) @@ -121,6 +122,21 @@ After mastering the world of blogging software, you decide to put the ubiquitous (bidi-match-expander ... . dispatch-pattern) (bidi-match-expander . dispatch-pattern)] +@defform*[#:literals (else) + [(dispatch-rules+applies + [dispatch-pattern dispatch-fun] + ... + [else else-fun]) + (dispatch-rules+applies + [dispatch-pattern dispatch-fun] + ...)] + #:contracts + ([else-fun (request? . -> . response/c)] + [dispatch-fun (request? any/c ... . -> . response/c)])]{ + Like @scheme[dispatch-rules], except returns a third value with the contract @scheme[(request? . -> . boolean?)] that returns + @scheme[#t] if the dispatching rules apply to the request and @scheme[#f] otherwise. + } + @defform*[#:literals (else) [(dispatch-case [dispatch-pattern dispatch-fun] @@ -183,6 +199,10 @@ You can create new URL component patterns by defining @tech{bi-directional match Binds @scheme[id] to a @deftech{bi-directional match expander} where @scheme[in-xform] is a match expander (defined by @scheme[define-match-expander]) that is used when parsing URLs and @scheme[out-xform] is one used when generating URLs. + + Both @scheme[in-xform] and @scheme[out-xform] should use the syntax @scheme[(_xform arg ... _id)] where the @scheme[arg]s are + specific to @scheme[id] and compatible with both @scheme[in-xform] and @scheme[out-xform]. @scheme[_id] will typically be provided + automatically by @scheme[dispatch-rules]. } @defidform[bidi-match-going-in?]{ From 2cb9f378aa813d5cd0c1f52db39bc6bb0c62d02b Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 2 Apr 2010 21:29:59 +0000 Subject: [PATCH 063/202] Racket experiments svn: r18725 --- collects/compiler/embed-unit.ss | 60 +- collects/compiler/main.ss | 1 + collects/mzlib/pconvert.ss | 14 +- collects/racket/base.ss | 6 + collects/racket/base/lang/reader.ss | 5 + collects/racket/init.ss | 15 + collects/racket/lang/reader.ss | 6 + collects/racket/main.ss | 8 + collects/racket/private/define-struct.ss | 23 + collects/racket/private/get-info.ss | 12 + collects/racket/private/lang/reader.ss | 5 + collects/racket/private/runtime.ss | 7 + collects/scheme/pretty.ss | 430 ++++--- collects/scheme/private/define-struct.ss | 100 +- collects/scribblings/mzc/exe-api.scrbl | 9 + .../scribblings/reference/custom-write.scrbl | 35 +- .../scribblings/reference/define-struct.scrbl | 14 +- .../reference/module-reflect.scrbl | 24 +- .../scribblings/reference/pretty-print.scrbl | 24 +- collects/scribblings/reference/printer.scrbl | 111 +- collects/scribblings/reference/startup.scrbl | 46 +- collects/scribblings/reference/struct.scrbl | 7 +- .../scribblings/reference/stx-trans.scrbl | 21 +- collects/scribblings/reference/write.scrbl | 54 +- collects/tests/future/random-future.ss | 2 +- collects/tests/mzscheme/file.ss | 2 +- collects/tests/mzscheme/struct.ss | 2 +- src/mzscheme/cmdline.inc | 55 +- src/mzscheme/include/mzscheme.exp | 3 +- src/mzscheme/include/mzscheme3m.exp | 3 +- src/mzscheme/include/mzwin.def | 3 +- src/mzscheme/include/mzwin3m.def | 3 +- src/mzscheme/include/scheme.h | 3 + src/mzscheme/src/cstartup.inc | 1123 +++++++++-------- src/mzscheme/src/error.c | 2 +- src/mzscheme/src/fun.c | 24 +- src/mzscheme/src/module.c | 5 +- src/mzscheme/src/mzmark.c | 2 + src/mzscheme/src/mzmarksrc.c | 1 + src/mzscheme/src/portfun.c | 63 +- src/mzscheme/src/print.c | 308 ++++- src/mzscheme/src/read.c | 16 + src/mzscheme/src/schemef.h | 19 +- src/mzscheme/src/schemex.h | 19 +- src/mzscheme/src/schemex.inc | 3 +- src/mzscheme/src/schemexm.h | 3 +- src/mzscheme/src/schminc.h | 2 +- src/mzscheme/src/schpriv.h | 10 +- src/mzscheme/src/schvers.h | 4 +- src/mzscheme/src/struct.c | 138 +- src/mzscheme/src/thread.c | 2 + 51 files changed, 1875 insertions(+), 982 deletions(-) create mode 100644 collects/racket/base.ss create mode 100644 collects/racket/base/lang/reader.ss create mode 100644 collects/racket/init.ss create mode 100644 collects/racket/lang/reader.ss create mode 100644 collects/racket/main.ss create mode 100644 collects/racket/private/define-struct.ss create mode 100644 collects/racket/private/get-info.ss create mode 100644 collects/racket/private/lang/reader.ss create mode 100644 collects/racket/private/runtime.ss diff --git a/collects/compiler/embed-unit.ss b/collects/compiler/embed-unit.ss index e0d4f7efa6..ed52b0d693 100644 --- a/collects/compiler/embed-unit.ss +++ b/collects/compiler/embed-unit.ss @@ -746,21 +746,19 @@ ;; Write a module bundle that can be loaded with 'load' (do not embed it ;; into an executable). The bundle is written to the current output port. - (define (do-write-module-bundle outp verbose? modules literal-files literal-expressions collects-dest + (define (do-write-module-bundle outp verbose? modules config? literal-files literal-expressions collects-dest on-extension program-name compiler expand-namespace src-filter get-extra-imports) (let* ([module-paths (map cadr modules)] - [files (map - (lambda (mp) - (let ([f (resolve-module-path mp #f)]) - (unless f - (error 'write-module-bundle "bad module path: ~e" mp)) - (normalize f))) - module-paths)] - [collapsed-mps (map - (lambda (mp) - (collapse-module-path mp (build-path (current-directory) "dummy.ss"))) - module-paths)] + [resolve-one-path (lambda (mp) + (let ([f (resolve-module-path mp #f)]) + (unless f + (error 'write-module-bundle "bad module path: ~e" mp)) + (normalize f)))] + [files (map resolve-one-path module-paths)] + [collapse-one (lambda (mp) + (collapse-module-path mp (build-path (current-directory) "dummy.ss")))] + [collapsed-mps (map collapse-one module-paths)] [prefix-mapping (map (lambda (f m) (cons f (let ([p (car m)]) (cond @@ -774,13 +772,27 @@ files modules)] ;; Each element is created with `make-mod'. ;; As we descend the module tree, we append to the front after - ;; loasing imports, so the list in the right order. - [codes (box null)]) - (for-each (lambda (f mp) (get-code f mp codes prefix-mapping verbose? collects-dest + ;; loading imports, so the list in the right order. + [codes (box null)] + [get-code-at (lambda (f mp) + (get-code f mp codes prefix-mapping verbose? collects-dest on-extension compiler expand-namespace - get-extra-imports)) - files - collapsed-mps) + get-extra-imports))] + [__ + ;; Load all code: + (for-each get-code-at files collapsed-mps)] + [config-info (and config? + (let ([a (assoc (car files) (unbox codes))]) + (let ([info (module-compiled-language-info (mod-code a))]) + (when info + (let ([get-info ((dynamic-require (vector-ref info 0) (vector-ref info 1)) + (vector-ref info 2))]) + (get-info 'configure-runtime #f))))))]) + ;; Add module for runtime configuration: + (when config-info + (let ([mp (vector-ref config-info 0)]) + (get-code-at (resolve-one-path mp) + (collapse-one mp)))) ;; Drop elements of `codes' that just record copied libs: (set-box! codes (filter mod-code (unbox codes))) ;; Bind `module' to get started: @@ -917,6 +929,12 @@ (write (compile-using-kernel '(namespace-set-variable-value! 'module #f #t)) outp) (write (compile-using-kernel '(namespace-undefine-variable! 'module)) outp) (newline outp) + (when config-info + (let ([a (assoc (resolve-one-path (vector-ref config-info 0)) (unbox codes))]) + (write (compile-using-kernel `((dynamic-require '',(mod-full-name a) + ',(vector-ref config-info 1)) + ',(vector-ref config-info 2))) + outp))) (for-each (lambda (f) (when verbose? (fprintf (current-error-port) "Copying from ~s~n" f)) @@ -928,6 +946,7 @@ (define (write-module-bundle #:verbose? [verbose? #f] #:modules [modules null] + #:configure-via-first-module? [config? #f] #:literal-files [literal-files null] #:literal-expressions [literal-expressions null] #:on-extension [on-extension #f] @@ -937,7 +956,7 @@ (compile expr)))] #:src-filter [src-filter (lambda (filename) #f)] #:get-extra-imports [get-extra-imports (lambda (filename code) null)]) - (do-write-module-bundle (current-output-port) verbose? modules literal-files literal-expressions + (do-write-module-bundle (current-output-port) verbose? modules config? literal-files literal-expressions #f ; collects-dest on-extension "?" ; program-name @@ -970,6 +989,7 @@ #:mred? [mred? #f] #:verbose? [verbose? #f] #:modules [modules null] + #:configure-via-first-module? [config? #f] #:literal-files [literal-files null] #:literal-expression [literal-expression #f] #:literal-expressions [literal-expressions @@ -1086,7 +1106,7 @@ (let ([write-module (lambda (s) (do-write-module-bundle s - verbose? modules literal-files literal-expressions collects-dest + verbose? modules config? literal-files literal-expressions collects-dest on-extension (file-name-from-path dest) compiler diff --git a/collects/compiler/main.ss b/collects/compiler/main.ss index 32c37ebf06..673bb135be 100644 --- a/collects/compiler/main.ss +++ b/collects/compiler/main.ss @@ -569,6 +569,7 @@ #:modules (cons `(#%mzc: (file ,(car source-files))) (map (lambda (l) `(#t (lib ,l))) (exe-embedded-libraries))) + #:configure-via-first-module? #t #:literal-expression (parameterize ([current-namespace (make-base-namespace)]) (compile diff --git a/collects/mzlib/pconvert.ss b/collects/mzlib/pconvert.ss index 3e59c7e465..ee0d59ab37 100644 --- a/collects/mzlib/pconvert.ss +++ b/collects/mzlib/pconvert.ss @@ -1,10 +1,8 @@ (module pconvert mzscheme - (require (only "string.ss" expr->string) - (only "list.ss" sort) + (require (only "list.ss" sort) scheme/mpair - "etc.ss" "pconvert-prop.ss" "class.ss") @@ -169,7 +167,7 @@ ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define map-share-name (lambda (name) - (string->symbol (string-append "-" (expr->string name) "-")))) + (string->symbol (format "-~s-" name)))) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; prints an expression given that it has already been hashed. This @@ -458,8 +456,7 @@ [str-name (if (string? name) name (symbol->string name))]) - (string->symbol (string-append "make-" str-name))))] - [uniq (begin-lifted (box #f))]) + (string->symbol (string-append "make-" str-name))))]) `(,constructor ,@(map (lambda (x) (if (eq? uniq x) @@ -497,6 +494,7 @@ [(null? x) null] [else (f x)])) + (define uniq (gensym)) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; these functions get the list of shared items. If just-circular is @@ -536,8 +534,8 @@ (get-shared-helper csi)) (get-shared-helper csi))] [cmp (lambda (x y) - (stringstring (share-info-name (car x))) - (expr->string (share-info-name (car y)))))]) + (stringstring (vector-length obj)))) - (wr-lst (vector->repeatless-list obj) #f depth pair? car cdr "(" ")")))] + (check-expr-found + obj pport #t + #f #f + (lambda () + (let ([qd (to-quoted out qd "`")]) + (out "#") + (when print-vec-length? + (out (number->string (vector-length obj)))) + (wr-lst (vector->repeatless-list obj) #f depth pair? car cdr "(" ")" qd))))] [(and (box? obj) print-box?) - (check-expr-found - obj pport #t - #f #f - (lambda () - (out "#&") - (wr (unbox obj) (dsub1 depth))))] + (check-expr-found + obj pport #t + #f #f + (lambda () + (let ([qd (to-quoted out qd "`")]) + (out "#&") + (wr (unbox obj) (dsub1 depth) qd))))] [(and (custom-write? obj) (not (struct-type? obj))) (check-expr-found @@ -710,7 +726,7 @@ #f #f (lambda () (parameterize ([pretty-print-columns 'infinity]) - (write-custom wr* obj pport depth display? width))))] + (write-custom wr* obj pport depth display? width qd))))] [(struct? obj) (if (and print-struct? (not (and depth @@ -719,12 +735,22 @@ obj pport #t #f #f (lambda () - (out "#") - (let ([v (struct->vector obj)]) - (when (prefab?! obj v) - (out "s")) - (wr-lst (vector->list v) #f (dsub1 depth) pair? car cdr "(" ")")))) - (parameterize ([print-struct #f]) + (let* ([v (struct->vector obj)] + [pf? (prefab?! obj v)]) + (let ([qd (if pf? + (to-quoted out qd "`") + (to-unquoted out qd))]) + (when (or (not qd) pf?) + (out "#") + (when pf? (out "s"))) + (wr-lst (let ([l (vector->list v)]) + (if (and qd (not pf?)) + (cons (make-unquoted (object-name obj)) + (cdr l)) + l)) + #f (dsub1 depth) pair? car cdr "(" ")" + qd))))) + (parameterize ([print-struct #f]) ((if display? orig-display orig-write) obj pport)))] [(hash-table? obj) (if (and print-hash-table? @@ -734,19 +760,20 @@ obj pport #t #f #f (lambda () - (out (if (hash-table? obj 'equal) - "#hash" - (if (hash-table? obj 'eqv) - "#hasheqv" - "#hasheq"))) - (wr-lst (hash-table-map obj (lambda (k v) - (cons k (make-hide v)))) - #f depth - pair? car cdr "(" ")"))) + (let ([qd (to-quoted out qd "`")]) + (out (if (hash-table? obj 'equal) + "#hash" + (if (hash-table? obj 'eqv) + "#hasheqv" + "#hasheq"))) + (wr-lst (hash-table-map obj (lambda (k v) + (cons k (make-hide v)))) + #f depth + pair? car cdr "(" ")" qd)))) (parameterize ([print-hash-table #f]) ((if display? orig-display orig-write) obj pport)))] [(hide? obj) - (wr* pport (hide-val obj) depth display?)] + (wr* pport (hide-val obj) depth display? qd)] [(boolean? obj) (out (if obj "#t" "#f"))] [(number? obj) @@ -760,6 +787,18 @@ [(and (pretty-print-.-symbol-without-bars) (eq? obj '|.|)) (out ".")] + [(and (equal? qd 1) + (or (eq? 'unquote obj) + (eq? 'unquote-splicing obj))) + (out ",'") + (orig-write obj pport)] + [(and qd (or (symbol? obj) + (keyword? obj))) + (to-quoted out qd "'") + (orig-write obj pport)] + [(unquoted? obj) + (let ([qd (to-unquoted out qd)]) + (orig-write (unquoted-val obj) pport))] [else ((if display? orig-display orig-write) obj pport)])) (unless (hide? obj) @@ -767,10 +806,10 @@ ;; ------------------------------------------------------------ ;; pp: write on (potentially) multiple lines - (define (pp* pport obj depth display?) + (define (pp* pport obj depth display? qd) (define (pp obj depth) - (pp* pport obj depth display?)) + (pp* pport obj depth display? qd)) (define (out str) (write-string str pport)) @@ -790,7 +829,7 @@ (spaces (- to col)))) (spaces (max 0 (- to col)))))) - (define (pr obj extra pp-pair depth) + (define (pr obj extra pp-pair depth qd) ;; may have to split on multiple lines (let* ([can-multi (and width (not (size-hook obj display?)) @@ -819,7 +858,7 @@ (- width extra) (lambda () (esc a-pport)))]) ;; Here's the attempt to write on one line: - (wr* a-pport obj depth display?) + (wr* a-pport obj depth display? qd) a-pport))]) (let-values ([(l c p) (port-next-location a-pport)]) (if (<= c (- width extra)) @@ -835,43 +874,62 @@ (pre-print pport obj) (cond [(pair? obj) (pp-pair obj extra depth - pair? car cdr pair-open pair-close)] + pair? car cdr pair-open pair-close + qd)] [(mpair? obj) (pp-pair obj extra depth - mpair? mcar mcdr mpair-open mpair-close)] + mpair? mcar mcdr mpair-open mpair-close + qd)] [(vector? obj) - (out "#") - (when print-vec-length? - (out (number->string (vector-length obj)))) - (pp-list (vector->repeatless-list obj) extra pp-expr #f depth - pair? car cdr pair-open pair-close)] + (let ([qd (to-quoted out qd "`")]) + (out "#") + (when print-vec-length? + (out (number->string (vector-length obj)))) + (pp-list (vector->repeatless-list obj) extra pp-expr #f depth + pair? car cdr pair-open pair-close + qd))] [(and (custom-write? obj) (not (struct-type? obj))) - (write-custom pp* obj pport depth display? width)] + (let ([qd (to-unquoted out qd)]) + (write-custom pp* obj pport depth display? width qd))] [(struct? obj) ; print-struct is on if we got here - (out "#") - (let ([v (struct->vector obj)]) - (when (prefab?! obj v) - (out "s")) - (pp-list (vector->list v) extra pp-expr #f depth - pair? car cdr pair-open pair-close))] + (let* ([v (struct->vector obj)] + [pf? (prefab?! obj v)]) + (let ([qd (if pf? + (to-quoted out qd "`") + (to-unquoted out qd))]) + (when (or (not qd) pf?) + (out "#") + (when pf? (out "s"))) + (pp-list (let ([l (vector->list v)]) + (if (and qd (not pf?)) + (cons (make-unquoted (object-name v)) + (cdr l)) + l)) + extra pp-expr #f depth + pair? car cdr pair-open pair-close + qd)))] [(hash-table? obj) - (out (if (hash-table? obj 'equal) - "#hash" - (if (hash-table? obj 'eqv) - "#hasheqv" - "#hasheq"))) - (pp-list (hash-table-map obj cons) extra pp-expr #f depth - pair? car cdr pair-open pair-close)] + (let ([qd (to-quoted out qd "`")]) + (out (if (hash-table? obj 'equal) + "#hash" + (if (hash-table? obj 'eqv) + "#hasheqv" + "#hasheq"))) + (pp-list (hash-table-map obj cons) extra pp-expr #f depth + pair? car cdr pair-open pair-close + qd))] [(and (box? obj) print-box?) - (out "#&") - (pr (unbox obj) extra pp-pair depth)]) + (let ([qd (to-quoted out qd "`")]) + (out "#&") + (pr (unbox obj) extra pp-pair depth qd))]) (post-print pport obj))))) ;; Not possible to split obj across lines; so just write directly - (wr* pport obj depth display?)))) + (wr* pport obj depth display? qd)))) (define (pp-expr expr extra depth - apair? acar acdr open close) - (if (and (read-macro? expr apair? acar acdr) + apair? acar acdr open close + qd) + (if (and (read-macro? expr apair? acar acdr qd) (equal? open "(") (not (and found (hash-table-get found (acdr expr) #f)))) (begin @@ -879,15 +937,18 @@ (pr (read-macro-body expr acar acdr) extra pp-expr - depth)) + depth + (reader-adjust-qd (acar expr) qd))) (let ((head (acar expr))) (if (or (and (symbol? head) (not (size-hook head display?))) ((pretty-print-remap-stylable) head)) (let ((proc (style head expr apair? acar acdr))) (if proc - (proc expr extra depth - apair? acar acdr open close) + (let ([qd (to-quoted out qd "`")]) + (proc expr extra depth + apair? acar acdr open close + qd)) (if (and #f ;; Why this special case? Currently disabled. (> (string-length @@ -897,62 +958,74 @@ ((pretty-print-remap-stylable) head)))) max-call-head-width)) (pp-general expr extra #f #f #f pp-expr depth - apair? acar acdr open close) + apair? acar acdr open close + qd) (pp-list expr extra pp-expr #t depth - apair? acar acdr open close)))) + apair? acar acdr open close + qd)))) (pp-list expr extra pp-expr #t depth - apair? acar acdr open close))))) + apair? acar acdr open close + qd))))) - (define (wr obj depth) - (wr* pport obj depth display?)) + (define (wr obj depth qd) + (wr* pport obj depth display? qd)) ;; (head item1 ;; item2 ;; item3) (define (pp-call expr extra pp-item depth - apair? acar acdr open close) - (out open) - (wr (acar expr) (dsub1 depth)) - (let ([col (+ (ccol) 1)]) - (pp-down close (acdr expr) col col extra pp-item #t #t depth - apair? acar acdr open close))) + apair? acar acdr open close + qd) + (out open) + (wr (acar expr) (dsub1 depth) qd) + (let ([col (+ (ccol) 1)]) + (pp-down close (acdr expr) col col extra pp-item #t #t depth + apair? acar acdr open close + qd))) ;; (head item1 item2 ;; item3 ;; item4) (define (pp-two-up expr extra pp-item depth - apair? acar acdr open close) + apair? acar acdr open close + qd) (out open) (let ([col (ccol)]) - (wr (acar expr) (dsub1 depth)) + (wr (acar expr) (dsub1 depth) qd) (out " ") - (wr (acar (acdr expr)) (dsub1 depth)) + (wr (acar (acdr expr)) (dsub1 depth) qd) (pp-down close (acdr (acdr expr)) (+ (ccol) 1) (+ col 1) extra pp-item #t #t depth - apair? acar acdr open close))) + apair? acar acdr open close + qd))) ;; (head item1 ;; item2 ;; item3) (define (pp-one-up expr extra pp-item depth - apair? acar acdr open close) + apair? acar acdr open close + qd) (out open) (let ([col (ccol)]) - (wr (acar expr) (dsub1 depth)) + (wr (acar expr) (dsub1 depth) qd) (pp-down close (acdr expr) (+ (ccol) 1) (+ col 1) extra pp-item #t #t depth - apair? acar acdr open close))) + apair? acar acdr open close + qd))) ;; (item1 ;; item2 ;; item3) (define (pp-list l extra pp-item check? depth - apair? acar acdr open close) + apair? acar acdr open close + qd) (out open) (let ([col (ccol)]) (pp-down close l col col extra pp-item #f check? depth - apair? acar acdr open close))) + apair? acar acdr open close + qd))) (define (pp-down closer l col1 col2 extra pp-item check-first? check-rest? depth - apair? acar acdr open close) + apair? acar acdr open close + qd) (let loop ([l l] [icol col1] [check? check-first?]) (check-expr-found l pport (and check? (apair? l)) @@ -966,7 +1039,7 @@ (indent col2) (out ".") (indent col2) - (pr l extra pp-item depth) + (pr l extra pp-item depth qd) (out closer)) (lambda () (cond @@ -974,7 +1047,7 @@ (let ([rest (acdr l)]) (let ([extra (if (null? rest) (+ extra 1) 0)]) (indent icol) - (pr (acar l) extra pp-item (dsub1 depth)) + (pr (acar l) extra pp-item (dsub1 depth) qd) (loop rest col2 check-rest?)))] [(null? l) (out closer)] @@ -982,11 +1055,12 @@ (indent col2) (out ".") (indent col2) - (pr l (+ extra 1) pp-item (dsub1 depth)) + (pr l (+ extra 1) pp-item (dsub1 depth) qd) (out closer)]))))) (define (pp-general expr extra named? pp-1 pp-2 pp-3 depth - apair? acar acdr open close) + apair? acar acdr open close + qd) (define (tail1 rest col1 col3) (if (and pp-1 (apair? rest)) @@ -994,7 +1068,7 @@ (rest (acdr rest)) (extra (if (null? rest) (+ extra 1) 0))) (indent col3) - (pr val1 extra pp-1 depth) + (pr val1 extra pp-1 depth qd) (tail2 rest col1 col3)) (tail2 rest col1 col3))) @@ -1004,88 +1078,113 @@ (rest (acdr rest)) (extra (if (null? rest) (+ extra 1) 0))) (indent col3) - (pr val1 extra pp-2 depth) + (pr val1 extra pp-2 depth qd) (tail3 rest col1)) (tail3 rest col1))) (define (tail3 rest col1) (pp-down close rest col1 col1 extra pp-3 #f #t depth - apair? acar acdr open close)) + apair? acar acdr open close + qd)) (let* ([head (acar expr)] [rest (acdr expr)] [col (ccol)]) (out open) - (wr head (dsub1 depth)) + (wr head (dsub1 depth) qd) (if (and named? (apair? rest)) (let* ((name (acar rest)) (rest (acdr rest))) (out " ") - (wr name (dsub1 depth)) + (wr name (dsub1 depth) qd) (tail1 rest (+ col indent-general) (+ (ccol) 1))) (tail1 rest (+ col indent-general) (+ (ccol) 1))))) (define (pp-expr-list l extra depth - apair? acar acdr open close) + apair? acar acdr open close + qd) (pp-list l extra pp-expr #t depth - apair? acar acdr open close)) + apair? acar acdr open close + qd)) (define (pp-lambda expr extra depth - apair? acar acdr open close) + apair? acar acdr open close + qd) (pp-general expr extra #f pp-expr-list #f pp-expr depth - apair? acar acdr open close)) + apair? acar acdr open close + qd)) (define (pp-if expr extra depth - apair? acar acdr open close) + apair? acar acdr open close + qd) (pp-general expr extra #f pp-expr #f pp-expr depth - apair? acar acdr open close)) + apair? acar acdr open close + qd)) (define (pp-cond expr extra depth - apair? acar acdr open close) + apair? acar acdr open close + qd) (pp-list expr extra pp-expr-list #t depth - apair? acar acdr open close)) + apair? acar acdr open close + qd)) (define (pp-syntax-case expr extra depth - apair? acar acdr open close) + apair? acar acdr open close + qd) (pp-two-up expr extra pp-expr-list depth - apair? acar acdr open close)) + apair? acar acdr open close + qd)) (define (pp-module expr extra depth - apair? acar acdr open close) + apair? acar acdr open close + qd) (pp-two-up expr extra pp-expr depth - apair? acar acdr open close)) + apair? acar acdr open close + qd)) (define (pp-make-object expr extra depth - apair? acar acdr open close) + apair? acar acdr open close + qd) (pp-one-up expr extra pp-expr-list depth - apair? acar acdr open close)) + apair? acar acdr open close + qd)) (define (pp-case expr extra depth - apair? acar acdr open close) + apair? acar acdr open close + qd) (pp-general expr extra #f pp-expr #f pp-expr-list depth - apair? acar acdr open close)) + apair? acar acdr open close + qd)) (define (pp-and expr extra depth - apair? acar acdr open close) + apair? acar acdr open close + qd) (pp-call expr extra pp-expr depth - apair? acar acdr open close)) + apair? acar acdr open close + qd)) (define (pp-let expr extra depth - apair? acar acdr open close) + apair? acar acdr open close + qd) (let* ((rest (acdr expr)) (named? (and (apair? rest) (symbol? (do-remap (acar rest)))))) (pp-general expr extra named? pp-expr-list #f pp-expr depth - apair? acar acdr open close))) + apair? acar acdr open close + qd))) (define (pp-begin expr extra depth - apair? acar acdr open close) + apair? acar acdr open close + qd) (pp-general expr extra #f #f #f pp-expr depth - apair? acar acdr open close)) + apair? acar acdr open close + qd)) (define (pp-do expr extra depth - apair? acar acdr open close) + apair? acar acdr open close + qd) (pp-general expr extra #f pp-expr-list pp-expr-list pp-expr depth - apair? acar acdr open close)) + apair? acar acdr open close + qd)) ;; define formatting style (change these to suit your style) @@ -1155,16 +1254,33 @@ (else #f))) - (pr obj 0 pp-expr depth)) + (pr obj 0 pp-expr depth qd)) + + (define (to-quoted out qd str) + (and qd + (if (zero? qd) + (begin + (out str) + (add1 qd)) + qd))) + + (define (to-unquoted out qd) + (and qd + (if (zero? qd) + qd + (begin + (out ",") + (to-unquoted out (sub1 qd)))))) ;; ------------------------------------------------------------ ;; This is where generic-write's body expressions start ((printing-port-print-line pport) #t 0 width) - (let-values ([(l col p) (port-next-location pport)]) - (if (and width (not (eq? width 'infinity))) - (pp* pport obj depth display?) - (wr* pport obj depth display?))) + (let ([qd (if print-as-qq? 0 #f)]) + (let-values ([(l col p) (port-next-location pport)]) + (if (and width (not (eq? width 'infinity))) + (pp* pport obj depth display? qd) + (wr* pport obj depth display? qd)))) (let-values ([(l col p) (port-next-location pport)]) ((printing-port-print-line pport) #f col width))) @@ -1183,16 +1299,26 @@ values] [else raw-head])) - (define (read-macro? l pair? car cdr) + (define (read-macro? l pair? car cdr qd) (define (length1? l) (and (pair? l) (null? (cdr l)))) (and (pretty-print-abbreviate-read-macros) (let ((head (do-remap (car l))) (tail (cdr l))) (case head - ((quote quasiquote unquote unquote-splicing syntax + ((quote quasiquote syntax quasisyntax unsyntax unsyntax-splicing) (length1? tail)) + ((unquote unquote-splicing) + (and (not (equal? qd 1)) + (length1? tail))) (else #f))))) - + + (define (reader-adjust-qd v qd) + (and qd + (case (do-remap v) + [(quasiquote) (add1 qd)] + [(unquote unquote-splciing) (sub1 qd)] + [else qd]))) + (define (read-macro-body l car cdr) (car (cdr l))) diff --git a/collects/scheme/private/define-struct.ss b/collects/scheme/private/define-struct.ss index 31cfd2b2c4..c9e06f1e94 100644 --- a/collects/scheme/private/define-struct.ss +++ b/collects/scheme/private/define-struct.ss @@ -39,6 +39,34 @@ "procedure (arity 0)" proc))))) + (define-for-syntax (self-ctor-transformer orig stx) + (with-syntax ([orig orig]) + (syntax-case stx () + [(_ arg ...) (datum->syntax stx + (syntax-e (syntax (orig arg ...))) + stx + stx)] + [_ (syntax orig)]))) + + (define-values-for-syntax (make-self-ctor-struct-info) + (letrec-values ([(struct: make- ? ref set!) + (make-struct-type 'self-ctor-struct-info struct:struct-info + 1 0 #f + (list (cons prop:procedure + (lambda (v stx) + (self-ctor-transformer (ref v 0) stx)))) + (current-inspector) #f '(0))]) + make-)) + (define-values-for-syntax (make-self-ctor-checked-struct-info) + (letrec-values ([(struct: make- ? ref set!) + (make-struct-type 'self-ctor-checked-struct-info struct:checked-struct-info + 1 0 #f + (list (cons prop:procedure + (lambda (v stx) + (self-ctor-transformer (ref v 0) stx)))) + (current-inspector) #f '(0))]) + make-)) + (define-syntax-parameter struct-field-index (lambda (stx) (raise-syntax-error #f "allowed only within a structure type definition" stx))) @@ -92,15 +120,16 @@ stx (if (null? alt) kw (car alt)))) - (define (check-exprs orig-n ps) + (define (check-exprs orig-n ps what) (let loop ([nps (cdr ps)][n orig-n]) (unless (zero? n) (unless (and (pair? nps) (not (keyword? (syntax-e (car nps))))) (raise-syntax-error #f - (format "expected ~a expression~a after keyword~a" + (format "expected ~a ~a~a after keyword~a" orig-n + (or what "expression") (if (= orig-n 1) "" "s") (if (pair? nps) ", found a keyword" @@ -129,7 +158,7 @@ (loop (cdr ps) def-val auto? #t)] #; [(eq? #:default (syntax-e (car ps))) - (check-exprs 1 ps) + (check-exprs 1 ps #f) (when def-val (bad "multiple" (car ps) " for field")) (loop (cddr ps) (cadr ps) auto? mutable?)] @@ -173,13 +202,14 @@ (#:props . ()) (#:mutable . #f) (#:guard . #f) + (#:constructor-name . #f) (#:omit-define-values . #f) (#:omit-define-syntaxes . #f))] [nongen? #f]) (cond [(null? p) config] [(eq? '#:super (syntax-e (car p))) - (check-exprs 1 p) + (check-exprs 1 p #f) (when (lookup config '#:super) (bad "multiple" (car p) "s")) (when super-id @@ -196,7 +226,7 @@ [(memq (syntax-e (car p)) '(#:guard #:auto-value)) (let ([key (syntax-e (car p))]) - (check-exprs 1 p) + (check-exprs 1 p #f) (when (lookup config key) (bad "multiple" (car p) "s")) (when (and nongen? @@ -206,7 +236,7 @@ (extend-config config key (cadr p)) nongen?))] [(eq? '#:property (syntax-e (car p))) - (check-exprs 2 p) + (check-exprs 2 p #f) (when nongen? (bad "cannot use" (car p) " for prefab structure type")) (loop (cdddr p) @@ -216,7 +246,7 @@ (lookup config '#:props))) nongen?)] [(eq? '#:inspector (syntax-e (car p))) - (check-exprs 1 p) + (check-exprs 1 p #f) (when (lookup config '#:inspector) (bad "multiple" insp-keys "s" (car p))) (loop (cddr p) @@ -229,6 +259,15 @@ (loop (cdr p) (extend-config config '#:inspector #'#f) nongen?)] + [(eq? '#:constructor-name (syntax-e (car p))) + (check-exprs 1 p "identifier") + (when (lookup config '#:constructor-name) + (bad "multiple #:constructor-name keys" (car p))) + (unless (identifier? (cadr p)) + (bad "need an identifier after #:constructor-name" (cadr p))) + (loop (cddr p) + (extend-config config '#:constructor-name (cadr p)) + nongen?)] [(eq? '#:prefab (syntax-e (car p))) (when (lookup config '#:inspector) (bad "multiple" insp-keys "s" (car p))) @@ -321,17 +360,20 @@ (car field-stxes))] [else (loop (cdr fields) (cdr field-stxes) #f)]))]) - (let-values ([(inspector super-expr props auto-val guard mutable? - omit-define-values? omit-define-syntaxes?) - (let ([config (parse-props #'fm (syntax->list #'(prop ...)) super-id)]) - (values (lookup config '#:inspector) - (lookup config '#:super) - (lookup config '#:props) - (lookup config '#:auto-value) - (lookup config '#:guard) - (lookup config '#:mutable) - (lookup config '#:omit-define-values) - (lookup config '#:omit-define-syntaxes)))]) + (let*-values ([(inspector super-expr props auto-val guard ctor-name mutable? + omit-define-values? omit-define-syntaxes?) + (let ([config (parse-props #'fm (syntax->list #'(prop ...)) super-id)]) + (values (lookup config '#:inspector) + (lookup config '#:super) + (lookup config '#:props) + (lookup config '#:auto-value) + (lookup config '#:guard) + (lookup config '#:constructor-name) + (lookup config '#:mutable) + (lookup config '#:omit-define-values) + (lookup config '#:omit-define-syntaxes)))] + [(self-ctor?) + (and ctor-name (bound-identifier=? id ctor-name))]) (when mutable? (for-each (lambda (f f-stx) (when (field-mutable? f) @@ -342,7 +384,11 @@ f-stx))) fields field-stxes)) (let ([struct: (build-name id "struct:" id)] - [make- (build-name id "make-" id)] + [make- (if ctor-name + (if self-ctor? + (car (generate-temporaries (list id))) + ctor-name) + (build-name id "make-" id))] [? (build-name id id "?")] [sels (map (lambda (f) (build-name id ; (field-id f) @@ -407,7 +453,8 @@ [(not (or mutable? (field-mutable? (car fields)))) (cons i (loop (add1 i) (cdr fields)))] [else (loop (add1 i) (cdr fields))])) - #,guard))]) + #,guard + '#,ctor-name))]) (values struct: make- ? #,@(let loop ([i 0][fields fields]) (if (null? fields) @@ -429,8 +476,12 @@ #`(quote-syntax #,(prune sel)) sel)))] [mk-info (if super-info-checked? - #'make-checked-struct-info - #'make-struct-info)]) + (if self-ctor? + #'make-self-ctor-checked-struct-info + #'make-checked-struct-info) + (if self-ctor? + #'make-self-ctor-struct-info + #'make-struct-info))]) (quasisyntax/loc stx (define-syntaxes (#,id) (#,mk-info @@ -465,7 +516,10 @@ (protect super-id) (if super-expr #f - #t)))))))))]) + #t)))) + #,@(if self-ctor? + (list #`(quote-syntax #,make-)) + null))))))]) (let ([result (cond [(and (not omit-define-values?) (not omit-define-syntaxes?)) diff --git a/collects/scribblings/mzc/exe-api.scrbl b/collects/scribblings/mzc/exe-api.scrbl index 112199e8f6..745d1bf86d 100644 --- a/collects/scribblings/mzc/exe-api.scrbl +++ b/collects/scribblings/mzc/exe-api.scrbl @@ -46,6 +46,9 @@ parameter is true. (listof (list/c (or/c symbol? (one-of/c #t #f)) module-path?)) null] + [#:configure-via-first-module? config-via-first? + any/c + #f] [#:literal-files literal-files (listof path-string?) null] @@ -119,6 +122,12 @@ bindings; use compiled expressions to bootstrap the namespace. If included in the executable. The @scheme[#:literal-expression] (singular) argument is for backward compatibility. +If the @scheme[#:configure-via-first-module?] argument is specified as +true, then the language of the first module in @scheme[mod-list] is +used to configure the run-time environment before the expressions +added by @scheme[#:literal-files] and @scheme[#:literal-expressions] +are evaluated. + The @scheme[#:cmdline] argument @scheme[cmdline] contains command-line strings that are prefixed onto any actual command-line arguments that are provided to the embedding executable. A command-line argument that diff --git a/collects/scribblings/reference/custom-write.scrbl b/collects/scribblings/reference/custom-write.scrbl index e74aa7076a..35db4af2a1 100644 --- a/collects/scribblings/reference/custom-write.scrbl +++ b/collects/scribblings/reference/custom-write.scrbl @@ -6,19 +6,22 @@ @defthing[prop:custom-write struct-type-property?]{ Associates a procedure to a structure type to used by the default -printer to @scheme[display] or @scheme[write] (or @scheme[print]) +printer to @scheme[display], @scheme[write], or @scheme[print] instances of the structure type. @moreref["structprops"]{structure type properties} The procedure for a @scheme[prop:custom-write] value takes three -arguments: the structure to be printed, the target port, and a boolean -that is @scheme[#t] for @scheme[write] mode and @scheme[#f] for -@scheme[display] mode. The procedure should print the value to the -given port using @scheme[write], @scheme[display], @scheme[fprintf], +arguments: the structure to be printed, the target port, and an +argument that is @scheme[#t] for @scheme[write] mode, @scheme[#f] for +@scheme[display] mode, or an exact non-negative integer representing +the current @scheme[quasiquote] depth for @scheme[print] mode. The +procedure should print the value to the given port using +@scheme[write], @scheme[display], @scheme[print], @scheme[fprintf], @scheme[write-special], etc. -The write handler, display handler, and print handler are specially +The @tech{port write handler}, @tech{port display handler}, +and @tech{print handler} are specially configured for a port given to a custom-write procedure. Printing to the port through @scheme[display], @scheme[write], or @scheme[print] prints a value recursively with sharing annotations. To avoid a @@ -41,21 +44,25 @@ limited width). The following example definition of a @scheme[tuple] type includes custom-write procedures that print the tuple's list content using -angle brackets in @scheme[write] mode and no brackets in +angle brackets in @scheme[write] and @scheme[print] mode and no brackets in @scheme[display] mode. Elements of the tuple are printed recursively, so that graph and cycle structure can be represented. @defexamples[ -(define (tuple-print tuple port write?) - (when write? (write-string "<" port)) - (let ([l (tuple-ref tuple 0)]) +(define (tuple-print tuple port mode) + (when mode (write-string "<" port)) + (let ([l (tuple-ref tuple 0)] + [recur (case mode + [(#t) write] + [(#f) display] + [else (lambda (p port) (print p port mode))])]) (unless (zero? (vector-length l)) - ((if write? write display) (vector-ref l 0) port) + (recur (vector-ref l 0) port) (for-each (lambda (e) (write-string ", " port) - ((if write? write display) e port)) + (recur e port)) (cdr (vector->list l))))) - (when write? (write-string ">" port))) + (when mode (write-string ">" port))) (define-values (s:tuple make-tuple tuple? tuple-ref tuple-set!) (make-struct-type 'tuple #f 1 0 #f @@ -63,6 +70,8 @@ so that graph and cycle structure can be represented. (display (make-tuple #(1 2 "a"))) +(print (make-tuple #(1 2 "a"))) + (let ([t (make-tuple (vector 1 2 "a"))]) (vector-set! (tuple-ref t 0) 0 t) (write t)) diff --git a/collects/scribblings/reference/define-struct.scrbl b/collects/scribblings/reference/define-struct.scrbl index c8231b4b62..fbc45d9af6 100644 --- a/collects/scribblings/reference/define-struct.scrbl +++ b/collects/scribblings/reference/define-struct.scrbl @@ -24,6 +24,7 @@ (code:line #:property prop-expr val-exr) (code:line #:transparent) (code:line #:prefab) + (code:line #:constructor-name constructor-id) #:omit-define-syntaxes #:omit-define-values] [field-option #:mutable @@ -41,7 +42,8 @@ to @math{4+2n} names: @item{@schemeidfont{struct:}@scheme[id], a @deftech{structure type descriptor} value that represents the @tech{structure type}.} - @item{@schemeidfont{make-}@scheme[id], a @deftech{constructor} + @item{@scheme[constructor-id] (which defaults to + @schemeidfont{make-}@scheme[id]), a @deftech{constructor} procedure that takes @math{m} arguments and returns a new instance of the @tech{structure type}, where @math{m} is the number of @scheme[field]s that do not include an @@ -72,7 +74,10 @@ to @math{4+2n} names: is used to define subtypes, and it also works with the @scheme[shared] and @scheme[match] forms. For detailed information about the binding of @scheme[id], see - @secref["structinfo"].} + @secref["structinfo"]. + + The @scheme[constructor-id] and @scheme[id] can be the same, in + which case @scheme[id] performs both roles.} ] @@ -119,8 +124,9 @@ must also be a @tech{prefab} structure type. If the @scheme[#:omit-define-syntaxes] option is supplied, then @scheme[id] is not bound as a transformer. If the @scheme[#:omit-define-values] option is supplied, then none of the -usual variables are bound. If both are supplied, then the -@scheme[define-struct] form is equivalent to @scheme[(begin)]. +usual variables are bound, but @scheme[id] is bound. If both are +supplied, then the @scheme[define-struct] form is equivalent to +@scheme[(begin)]. If @scheme[#:auto] is supplied as a @scheme[field-option], then the @tech{constructor} procedure for the structure type does not accept an diff --git a/collects/scribblings/reference/module-reflect.scrbl b/collects/scribblings/reference/module-reflect.scrbl index dad9f1e52b..314ee33708 100644 --- a/collects/scribblings/reference/module-reflect.scrbl +++ b/collects/scribblings/reference/module-reflect.scrbl @@ -305,11 +305,11 @@ module's declaration though the @indexed-scheme['module-language] If no information is available for the module, the result is @scheme[#f]. Otherwise, the result is @scheme[(vector _mp _name _val)] such that @scheme[((dynamic-require _mp _name) _val)] should return -function that takes a single argument. The function's argument is a -key for reflected information, and the result is a value associated -with that key. Acceptable keys and the interpretation of results is -up to external tools, such as DrScheme. If no information is -available for a given key, the result should be @scheme[#f]. +function that takes two arguments. The function's arguments are a key +for reflected information and a default value. Acceptable keys and +the interpretation of results is up to external tools, such as +DrScheme. If no information is available for a given key, the result +should be the given default value. See also @scheme[module->language-info].} @@ -367,14 +367,18 @@ more than the namespace's @tech{base phase}.} @defproc[(module->language-info - [mod (or/c module-path? path? resolved-module-path?)]) + [mod (or/c module-path? path? resolved-module-path?)] + [load? any/c #f]) (or/c #f (vector/c module-path? symbol? any/c))]{ Returns information intended to reflect the ``language'' of the -implementation of @scheme[mod], which must be declared (but not -necessarily @tech{instantiate}d or @tech{visit}ed) in the current -namespace. The information is the same as would have been returned by -@scheme[module-compiled-language-info] applied to the module's +implementation of @scheme[mod]. If @scheme[load?] is @scheme[#f], the +module named by @scheme[mod] must be declared (but not necessarily +@tech{instantiate}d or @tech{visit}ed) in the current namespace; +otherwise, @scheme[mod] may be loaded (as for @scheme[dynamic-require] +and other functions). The information returned by +@scheme[module->language-info] is the same as would have been returned +by @scheme[module-compiled-language-info] applied to the module's implementation as compiled code.} diff --git a/collects/scribblings/reference/pretty-print.scrbl b/collects/scribblings/reference/pretty-print.scrbl index f91e494657..b774eb3ec0 100644 --- a/collects/scribblings/reference/pretty-print.scrbl +++ b/collects/scribblings/reference/pretty-print.scrbl @@ -9,19 +9,20 @@ @defproc[(pretty-print [v any/c] [port output-port? (current-output-port)]) void?]{ -Pretty-prints the value @scheme[v] using the same printed form as -@scheme[write], but with newlines and whitespace inserted to avoid -lines longer than @scheme[(pretty-print-columns)], as controlled by -@scheme[(pretty-print-current-style-table)]. The printed form ends in -a newline, unless the @scheme[pretty-print-columns] parameter is set -to @scheme['infinity]. +Pretty-prints the value @scheme[v] using the same printed form as the +default @scheme[print] mode, but with newlines and whitespace inserted +to avoid lines longer than @scheme[(pretty-print-columns)], as +controlled by @scheme[(pretty-print-current-style-table)]. The printed +form ends in a newline, unless the @scheme[pretty-print-columns] +parameter is set to @scheme['infinity]. In addition to the parameters defined in this section, @scheme[pretty-print] conforms to the @scheme[print-graph], @scheme[print-struct], @scheme[print-hash-table], -@scheme[print-vector-length], and @scheme[print-box] parameters. +@scheme[print-vector-length], @scheme[print-box], and +@scheme[print-as-quasiquote] parameters. -The pretty printer also detects structures that have the +The pretty printer detects structures that have the @scheme[prop:custom-write] property and it calls the corresponding custom-write procedure. The custom-write procedure can check the parameter @scheme[pretty-printing] to cooperate with the @@ -37,12 +38,17 @@ called appropriately). Use @scheme[make-tentative-pretty-print-output-port] to obtain a port for tentative recursive prints (e.g., to check the length of the output).} +@defproc[(pretty-write [v any/c] [port output-port? (current-output-port)]) + void?]{ + +Same as @scheme[pretty-print], but @scheme[v] is printed like +@scheme[write] instead of like @scheme[print].} @defproc[(pretty-display [v any/c][port output-port? (current-output-port)]) void?]{ Same as @scheme[pretty-print], but @scheme[v] is printed like -@scheme[display] instead of like @scheme[write].} +@scheme[display] instead of like @scheme[print].} @defproc[(pretty-format [v any/c][columns exact-nonnegative-integer? (pretty-print-columns)]) diff --git a/collects/scribblings/reference/printer.scrbl b/collects/scribblings/reference/printer.scrbl index 5998ed15b4..4987192863 100644 --- a/collects/scribblings/reference/printer.scrbl +++ b/collects/scribblings/reference/printer.scrbl @@ -9,7 +9,11 @@ using @scheme[read] on the output produces a value that is @scheme[equal?] to the printed value---when the printed is used in @scheme[write]. When the printer is used in @scheme[display] mode, the printing of strings, byte strings, characters, and symbols changes to -render the character/byte content directly to the output port. +render the character/byte content directly to the output port. The +printer's @scheme[print] mode is similar to @scheme[write], but it is +sensitive to the @scheme[print-as-quasiquote] parameter for printing +values in a way that @scheme[read] plus @scheme[eval] on the output +can be @scheme[equal?] to the printed value. When the @scheme[print-graph] parameter is set to @scheme[#t], then the printer first scans an object to detect cycles. The scan traverses @@ -63,10 +67,18 @@ Symbols @scheme[display] without escaping or quoting special characters. That is, the display form of a symbol is the same as the display form of @scheme[symbol->string] applied to the symbol. +Symbols @scheme[print] the same as they @scheme[write], unless +@scheme[print-as-quasiquote] is set to @scheme[#t] and the current +@scheme[quasiquote] depth is @scheme[0]. In that case, the symbol's +@scheme[print]ed form is prefixed with @litchar{'}. If the current +@scheme[quasiquote] depth is @scheme[1], and if the symbol is +@scheme['unquote] or @scheme[quasiquote], then the @scheme[print]ed +form is prefixed with @litchar{,'}. + @section{Printing Numbers} -A number prints the same way in @scheme[write] and @scheme[display] -modes. +A number prints the same way in @scheme[write], @scheme[display], and +@scheme[print] modes. A @tech{complex number} that is not a @tech{real number} always prints as @nonterm{m}@litchar{+}@nonterm{n}@litchar{i}, where @nonterm{m} and @@ -94,14 +106,15 @@ printed form of its exact negation. @section{Printing Booleans} The constant @scheme[#t] prints as @litchar{#t}, and the constant -@scheme[#f] prints as @litchar{#f} in both @scheme[display] and -@scheme[write] modes. +@scheme[#f] prints as @litchar{#f} in all modes (@scheme[display], +@scheme[write], and @scheme[print]). -@section{Printing Pairs and Lists} +@section[#:tag "print-pairs"]{Printing Pairs and Lists} -A pair prints starting with @litchar{(} followed by the printed form -of its @scheme[car]. The rest of the printed form depends on the -@scheme[cdr]: +In @scheme[write] and @scheme[display] modes, an empty list prints as +@litchar{()}. A pair normally prints starting with @litchar{(} +followed by the printed form of its @scheme[car]. The rest of the +printed form depends on the @scheme[cdr]: @itemize[ @@ -116,9 +129,33 @@ of its @scheme[car]. The rest of the printed form depends on the ] +If @scheme[print-reader-abbreviations] is set to @scheme[#t], then +pair printing is adjusted in the case of a pair that starts a +two-element list whose first element is @scheme[quote], +@scheme['quasiquote], @scheme['unquote], @scheme['unquote-splicing], +@scheme['syntax], @scheme['quasisyntax], @scheme['unsyntax], +@scheme['unsyntax-splicing]. In that case, the pair is printed with +the corresponding reader syntax: @litchar{'}, @litchar{`}, +@litchar{,}, @litchar[",@"], @litchar{#'}, @litchar{#`}, @litchar{#,}, +or @litchar["#,@"], respectively. After the reader syntax, the second +element of the list is printed. When the list is a tail of an +enclosing list, the tail is printed after a @litchar{.} in the +enclosing list (after which the reader abbreviations work), instead of +including the tail as two elements of the enclosing list. + The printed form of a pair is the same in both @scheme[write] and @scheme[display] modes, except as the printed form of the pair's -@scheme[car]and @scheme[cdr] vary with the mode. +@scheme[car] and @scheme[cdr] vary with the mode. The @scheme[print] +form is also the same is @scheme[print-as-quasiquote] is @scheme[#f]. + +When @scheme[print-as-quasiquote] is @scheme[#t] and the current +@scheme[quasiquote] depth is @scheme[0], then the empty list prints as +@litchar{'()} and a pair's output is prefixed with @litchar{`}; the +pair's content is printed at @scheme[quasiquote] depth is +@scheme[1]. In addition, when @scheme['quasiquote], @scheme['unquote], +or @scheme['unquote-splicing] appears as the first element of a +two-element list, the @scheme[quasiquote] depth is adjusted +appropriately for printing the second element of the list. By default, mutable pairs (as created with @scheme[mcons]) print the same as pairs, except that @litchar["{"] and @litchar["}"] are used @@ -136,7 +173,7 @@ set to @scheme[#f], then mutable pairs print using @litchar{(} and All strings @scheme[display] as their literal character sequences. -The @scheme[write] form of a string starts with @litchar{"} and ends +The @scheme[write] or @scheme[print] form of a string starts with @litchar{"} and ends with another @litchar{"}. Between the @litchar{"}s, each character is represented. Each graphic or blank character is represented as itself, with two exceptions: @litchar{"} is printed as @litchar{\"}, and @@ -154,7 +191,7 @@ All byte strings @scheme[display] as their literal byte sequence; this byte sequence may not be a valid UTF-8 encoding, so it may not correspond to a sequence of characters. -The @scheme[write] form a byte string starts with @litchar{#"} and +The @scheme[write] or @scheme[print] form a byte string starts with @litchar{#"} and ends with another @litchar{"}. Between the @litchar{"}s, each byte is written using the corresponding ASCII decoding if the byte is between 0 and 127 and the character is graphic or blank (according to @@ -171,7 +208,13 @@ followed by the printed form of @scheme[vector->list] applied to the vector. In @scheme[write] mode, the printed form is the same, except that when the @scheme[print-vector-length] parameter is @scheme[#t], a decimal integer is printed after the @litchar{#}, and a repeated last -element is printed only once.. +element is printed only once. + +Vectors @scheme[print] the same as they @scheme[write], unless +@scheme[print-as-quasiquote] is set to @scheme[#t] and the current +@scheme[quasiquote] depth is @scheme[0]. In that case, the vector's +@scheme[print]ed form is prefixed with @litchar{`}, and its content is +printed with @scheme[quasiquote] depth @scheme[1]. @section[#:tag "print-structure"]{Printing Structures} @@ -185,7 +228,13 @@ for which the structure is an instance: @item{If the structure type is a @techlink{prefab} structure type, then it prints using @litchar{#s(} followed by the @tech{prefab} structure type key, then the printed form each field in the - structure, and then @litchar{)}.} + structure, and then @litchar{)}. + + In @scheme[print] mode when @scheme[print-as-quasiquote] is set + to @scheme[#t] and the current @scheme[quasiquote] depth is + @scheme[0], the structure's @scheme[print]ed form is prefixed + with @litchar{`} and its content is printed with + @scheme[quasiquote] depth @scheme[1].} @item{If the structure has a @scheme[prop:custom-write] property value, then the associated procedure is used to print the @@ -193,7 +242,18 @@ for which the structure is an instance: @item{If the structure type is transparent, or if any ancestor is transparent, then the structure prints as the vector produced - by @scheme[struct->vector].} + by @scheme[struct->vector] in @scheme[display] mode, in + @scheme[write] mode, or in @scheme[print] mode when + @scheme[print-as-quasiquote] is set to @scheme[#f]. + + In @scheme[print] mode with @scheme[print-as-quasiquote] as + @scheme[#t], then the printed form is prefixed with as many + @litchar{,}s as the current @scheme[quasiquote] depth. Instead + of printing as a vector, the structure content is printed as a + list, where the first element is the list is the structure's + type name (as determined by @scheme[object-name]) printed in + @scheme[write] mode, while the remaining elements are + @scheme[print]ed at @scheme[quasiquote] depth @scheme[0].} @item{For any other structure type, the structure prints as an unreadable value; see @secref["print-unreadable"] for more @@ -217,6 +277,14 @@ additional space if the key--value pair is not the last to be printed. After all key-value pairs, the printed form completes with @litchar{)}. +In @scheme[print] mode when @scheme[print-as-quasiquote] is +@scheme[#t] and the current quasiquote depth is @scheme[0], then the +printed form is prefixed with @litchar{`} and the hash table's content +is printed at @scheme[quasiquote] depth @scheme[1]. In the printed +form, keys may be printed with @litchar{,} escapes, even though +@scheme[quasiquote] does not support @scheme[unquote] escapes in the +key position. + When the @scheme[print-hash-table] parameter is set to @scheme[#f], a hash table prints (un@scheme[read]ably) as @litchar{#}. @@ -224,6 +292,10 @@ hash table prints (un@scheme[read]ably) as @litchar{#}. When the @scheme[print-box] parameter is set to @scheme[#t], a box prints as @litchar{#&} followed by the printed form of its content. +In @scheme[print] mode when @scheme[print-as-quasiquote] is +@scheme[#t] and the current quasiquote depth is @scheme[0], then the +printed form is prefixed with @litchar{`} and the box's content +is printed at @scheme[quasiquote] depth @scheme[1]. When the @scheme[print-box] parameter is set to @scheme[#f], a box prints (un@scheme[read]ably) as @litchar{#}. @@ -231,7 +303,7 @@ prints (un@scheme[read]ably) as @litchar{#}. @section{Printing Characters} Characters with the special names described in -@secref["parse-character"] @scheme[write] using the same name. +@secref["parse-character"] @scheme[write] and @scheme[print] using the same name. (Some characters have multiple names; the @scheme[#\newline] and @scheme[#\nul] names are used instead of @scheme[#\linefeed] and @scheme[#\null]). Other graphic characters (according to @@ -246,15 +318,16 @@ character). @section{Printing Keywords} -Keywords @scheme[write] and @scheme[display] the same as symbols, -except (see @secref["print-symbol"]) with a leading @litchar{#:}, +Keywords @scheme[write], @scheme[print], and @scheme[display] the same as symbols, +except (see @secref["print-symbol"]) with a leading @litchar{#:} (after any +@litchar{'} prefix added in @scheme[print] mode), and without special handing for an initial @litchar{#} or when the printed form would matches a number or a delimited @litchar{.} (since @litchar{#:} distinguishes the keyword). @section{Printing Regular Expressions} -Regexp values in both @scheme[write] and @scheme[display] mode print +Regexp values in all modes (@scheme[write], @scheme[display], and @scheme[print]) starting with @litchar{#px} (for @scheme[pregexp]-based regexps) or @litchar{#rx} (for @scheme[regexp]-based regexps) followed by the @scheme[write] form of the regexp's source string or byte string. diff --git a/collects/scribblings/reference/startup.scrbl b/collects/scribblings/reference/startup.scrbl index 07fac92ff3..a29b1618d7 100644 --- a/collects/scribblings/reference/startup.scrbl +++ b/collects/scribblings/reference/startup.scrbl @@ -62,15 +62,22 @@ command line does not specify a @scheme[require] flag @Flag{u}/@DFlag{require-script}) before any @scheme[eval], @scheme[load], or read-eval-print-loop flag (@Flag{e}/@DFlag{eval}, @Flag{f}/@DFlag{load}, @Flag{r}/@DFlag{script}, @Flag{m}/@DFlag{main}, -or @Flag{i}/@DFlag{repl}). The -initialization library can be changed with the @Flag{I} -@tech{configuration option}. +or @Flag{i}/@DFlag{repl}). The initialization library can be changed +with the @Flag{I} @tech{configuration option}. The +@scheme['configure-runtime] property of the initialization library's +language is used before the library is instantiated; see +@secref["configure-runtime"]. After potentially loading the initialization module, expression @scheme[eval]s, files @scheme[load]s, and module @scheme[require]s are executed in the order that they are provided on the command line. If any raises an uncaught exception, then the remaining @scheme[eval]s, -@scheme[load]s, and @scheme[require]s are skipped. +@scheme[load]s, and @scheme[require]s are skipped. If the first +@scheme[require] precedes any @scheme[eval] or @scheme[load] so that +the initialization library is skipped, then the +@scheme['configure-runtime] property of the required module's library +language is used before the module is instantiated; see +@secref["configure-runtime"]. After running all command-line expressions, files, and modules, MzScheme or MrEd then starts a read-eval-print loop for interactive @@ -362,3 +369,34 @@ of the collapsed set. Extra arguments following the last option are available from the @indexed-scheme[current-command-line-arguments] parameter. + +@; ---------------------------------------------------------------------- + +@section[#:tag "configure-runtime"]{Language Run-Time Configuration} + +When a module is implemented using @hash-lang{}, the language after +@hash-lang{} can specify configuration actions to perform when a +module using the language is the main module of a program. The +language specifies run-time configuration by + +@itemlist[ + + @item{attaching a @scheme['module-language] @tech{syntax property} to + the module as read from its source (see @scheme[module] and + @scheme[module-compiled-language-info]);} + + @item{having the function indicated by the @scheme['module-language] + @tech{syntax property} recognize the + @scheme['configure-runtime] key, for which it returns another + vector: @scheme[(vector _mp _name _val)] where @scheme[_mp] is + a @tech{module path}, @scheme[_name] is a symbol, and + @scheme[_val] is an arbitrary value; and} + + @item{having the function called as @scheme[((dynamic-require _mp + _name) _val)] configure the run-time environment, typically by + setting parameters such as @scheme[current-print].} + +] + +The @schememodname[scheme/base] and @schememodname[scheme] languages +do not currently specify a run-time configuration action. diff --git a/collects/scribblings/reference/struct.scrbl b/collects/scribblings/reference/struct.scrbl index e191e79051..b2191d06ab 100644 --- a/collects/scribblings/reference/struct.scrbl +++ b/collects/scribblings/reference/struct.scrbl @@ -99,7 +99,8 @@ override the default @scheme[equal?] definition through the #f] [immutables (listof exact-nonnegative-integer?) null] - [guard (or/c procedure? #f) #f]) + [guard (or/c procedure? #f) #f] + [constructor-name (or/c symbol? #f) #f]) (values struct-type? struct-constructor-procedure? struct-predicate-procedure? @@ -169,6 +170,10 @@ values produced by the subtype's guard procedure become the first @math{n} arguments to @scheme[guard]. When @scheme[inspector] is @scheme['prefab], then @scheme[guard] must be @scheme[#f]. +If @scheme[constructor-name] is not @scheme[#f], it is used as the +name of the generated @tech{constructor} procedure as returned by +@scheme[object-name] or in the printed form of the constructor value. + The result of @scheme[make-struct-type] is five values: @itemize[ diff --git a/collects/scribblings/reference/stx-trans.scrbl b/collects/scribblings/reference/stx-trans.scrbl index 4afadbb6f8..d27fc01054 100644 --- a/collects/scribblings/reference/stx-trans.scrbl +++ b/collects/scribblings/reference/stx-trans.scrbl @@ -67,18 +67,25 @@ A @tech{structure type property} to identify structure types that act as @tech{assignment transformers} like the ones created by @scheme[make-set!-transformer]. -The property value must be an exact integer or procedure of one -argument. In the former case, the integer designates a field within +The property value must be an exact integer or procedure of one or two +arguments. In the former case, the integer designates a field within the structure that should contain a procedure; the integer must be between @scheme[0] (inclusive) and the number of non-automatic fields in the structure type (exclusive, not counting supertype fields), and the designated field must also be specified as immutable. -If the property value is an procedure, then the procedure serves as a -@tech{syntax transformer} and for @scheme[set!] transformations. If -the property value is an integer, the target identifier is extracted -from the structure instance; if the field value is not a procedure of -one argument, then a procedure that always calls +If the property value is an procedure of one argument, then the +procedure serves as a @tech{syntax transformer} and for @scheme[set!] +transformations. If the property value is a procedure of two +arguments, then the first argument is the structure whose type has +@scheme[prop:set!-transformer] property, and the second argument is a +syntax object as for a @tech{syntax transformer} and for @scheme[set!] +transformations; @scheme[set!-transformer-procedure] applied to the +structure produces a new function that accepts just the syntax object +and call the procedure associated through the property. Finally, if the +property value is an integer, the target identifier is extracted from +the structure instance; if the field value is not a procedure of one +argument, then a procedure that always calls @scheme[raise-syntax-error] is used, instead. If a value has both the @scheme[prop:set!-transformer] and diff --git a/collects/scribblings/reference/write.scrbl b/collects/scribblings/reference/write.scrbl index 37e671d030..87d47d5bfe 100644 --- a/collects/scribblings/reference/write.scrbl +++ b/collects/scribblings/reference/write.scrbl @@ -43,7 +43,8 @@ printer. In particular, note that @scheme[display] may require memory proportional to the depth of the value being printed, due to the initial cycle check.} -@defproc[(print [datum any/c][out output-port? (current-output-port)]) +@defproc[(print [datum any/c][out output-port? (current-output-port)] + [exact-nonnegative-integer? qq-depth 0]) void?]{ Writes @scheme[datum] to @scheme[out], normally the same way as @@ -52,12 +53,18 @@ Writes @scheme[datum] to @scheme[out], normally the same way as the handler specified by @scheme[global-port-print-handler] is called; the default handler uses the default printer in @scheme[write] mode. +The optional @scheme[qq-depth] argument adjust printing when the +@scheme[print-as-quasiquote] parameter is set to @scheme[#t]. In that +case, @scheme[qq-depth] specifies the starting @scheme[quasiquote] +depth for printing @scheme[datum]. + The rationale for providing @scheme[print] is that @scheme[display] -and @scheme[write] both have relatively standard output conventions, -and this standardization restricts the ways that an environment can -change the behavior of these procedures. No output conventions should -be assumed for @scheme[print], so that environments are free to modify -the actual output generated by @scheme[print] in any way.} +and @scheme[write] both have specific output conventions, and those +conventions restrict the ways that an environment can change the +behavior of @scheme[display] and @scheme[write] procedures. No output +conventions should be assumed for @scheme[print], so that environments +are free to modify the actual output generated by @scheme[print] in +any way.} @defproc[(fprintf [out output-port?][form string?][v any/c] ...) void?]{ @@ -192,6 +199,20 @@ A parameter that controls printing vectors; defaults to A parameter that controls printing hash tables; defaults to @scheme[#f]. See @secref["print-hashtable"] for more information.} +@defboolparam[print-reader-abbreviations on?]{ + +A parameter that controls printing of two-element lists that start +with @scheme[quote], @scheme['quasiquote], @scheme['unquote], +@scheme['unquote-splicing], @scheme['syntax], @scheme['quasisyntax], +@scheme['unsyntax], or @scheme['unsyntax-splicing]; defaults to +@scheme[#f]. See @secref["print-pairs"] for more information.} + +@defboolparam[print-as-quasiquote on?]{ + +A parameter that controls printing in @scheme[print] mode (as opposed +to @scheme[write] or @scheme[display]); defaults to @scheme[#f]. See +@secref["printing"] for more information.} + @defboolparam[print-honu on?]{ A parameter that controls printing values in an alternate syntax. See @@ -230,7 +251,7 @@ it is not @scheme[#f], otherwise the path is left relative).} [proc (any/c output-port? . -> . any)]) void?])]{} -@defproc*[([(port-print-handler [out output-port?]) (any/c output-port? . -> . any)] +@defproc*[([(port-print-handler [out output-port?]) ((any/c output-port?) (exact-nonnegative-integer?) . ->* . any)] [(port-print-handler [out output-port?] [proc (any/c output-port? . -> . any)]) void?])]{ @@ -239,20 +260,33 @@ Gets or sets the @deftech{port write handler}, @deftech{port display handler}, or @deftech{port print handler} for @scheme[out]. This handler is call to output to the port when @scheme[write], @scheme[display], or @scheme[print] (respectively) is applied to the -port. Each handler takes a two arguments: the value to be printed and +port. Each handler must accept two arguments: the value to be printed and the destination port. The handler's return value is ignored. +A @tech{port print handler} optionally accepts a third argument, which +corresponds to the optional third argument to @scheme[print]; if a +procedure given to @scheme[port-print-handler] does not accept a third +argument, it is wrapped with a procedure that discards the optional +third argument. + The default port display and write handlers print Scheme expressions with Scheme's built-in printer (see @secref["printing"]). The default print handler calls the global port print handler (the value of the @scheme[global-port-print-handler] parameter); the default global port print handler is the same as the default write handler.} -@defparam[global-port-print-handler proc (any/c output-port? . -> . any)]{ +@defproc*[([(global-port-print-handler) ((any/c output-port?) (exact-nonnegative-integer?) . ->* . any)] + [(global-port-print-handler [proc (any/c output-port? . -> . any)]) void?])]{ A parameter that determines @deftech{global port print handler}, which is called by the default port print handler (see @scheme[port-print-handler]) to @scheme[print] values into a port. The default value uses the built-in printer (see -@secref["printing"]) in @scheme[write] mode.} +@secref["printing"]) in @scheme[print] mode. +A @tech{global port print handler} optionally accepts a third +argument, which corresponds to the optional third argument to +@scheme[print]. If a procedure given to +@scheme[global-port-print-handler] does not accept a third argument, +it is wrapped with a procedure that discards the optional third +argument.} diff --git a/collects/tests/future/random-future.ss b/collects/tests/future/random-future.ss index 53b74c9526..a9659b290c 100644 --- a/collects/tests/future/random-future.ss +++ b/collects/tests/future/random-future.ss @@ -182,7 +182,7 @@ Errors/exceptions and other kinds of control? (gen-exp))])) (define-namespace-anchor ns-here) -(let ([seed 595933061 #;(+ 1 (random (expt 2 30)))]) +(let ([seed (+ 1 (random (expt 2 30)))]) (printf "DrDr Ignore! random-seed ~s\n" seed) (random-seed seed)) diff --git a/collects/tests/mzscheme/file.ss b/collects/tests/mzscheme/file.ss index 4cb402bee1..0b30154340 100644 --- a/collects/tests/mzscheme/file.ss +++ b/collects/tests/mzscheme/file.ss @@ -707,7 +707,7 @@ (test "hello\"hello\"" get-output-string sp) (arity-test (port-display-handler sp) 2 2) (arity-test (port-write-handler sp) 2 2) -(arity-test (port-print-handler sp) 2 2) +(arity-test (port-print-handler sp) 2 3) (err/rt-test ((port-display-handler sp) 8 8)) (err/rt-test ((port-write-handler sp) 8 8)) (err/rt-test ((port-print-handler sp) 8 8)) diff --git a/collects/tests/mzscheme/struct.ss b/collects/tests/mzscheme/struct.ss index 57154481e1..cd2cb095c8 100644 --- a/collects/tests/mzscheme/struct.ss +++ b/collects/tests/mzscheme/struct.ss @@ -16,7 +16,7 @@ (test #f struct-type-property? 5) (let-values ([(type make pred sel set) (make-struct-type 'a #f 2 1 'un (list (cons prop:p 87)) (make-inspector insp1))] [(typex makex predx selx setx) (make-struct-type 'ax #f 0 5 #f null (make-inspector insp2))]) - (arity-test make-struct-type 4 10) + (arity-test make-struct-type 4 11) (test 5 primitive-result-arity make-struct-type) (test #t struct-type? type) (test #t procedure? make) diff --git a/src/mzscheme/cmdline.inc b/src/mzscheme/cmdline.inc index ef5510a7af..638047fd86 100644 --- a/src/mzscheme/cmdline.inc +++ b/src/mzscheme/cmdline.inc @@ -166,16 +166,58 @@ typedef struct { typedef void (*Repl_Proc)(Scheme_Env *); +static void configure_environment(Scheme_Object *mod) +{ + Scheme_Object *mli, *dyreq, *a[3], *gi, *v; + + mli = scheme_builtin_value("module->language-info"); + + a[0] = mod; + a[1] = scheme_make_true(); + v = scheme_apply(mli, 2, a); + if (SCHEME_VECTORP(v)) { + dyreq = scheme_builtin_value("dynamic-require"); + + a[0] = SCHEME_VEC_ELS(v)[0]; + a[1] = SCHEME_VEC_ELS(v)[1]; + gi = scheme_apply(dyreq, 2, a); + + a[0] = SCHEME_VEC_ELS(v)[2]; + gi = scheme_apply(gi, 1, a); + + a[0] = scheme_intern_symbol("configure-runtime"); + a[1] = scheme_make_false(); + v = scheme_apply(gi, 2, a); + if (!SAME_OBJ(v, scheme_make_false())) { + if (SCHEME_VECTORP(v) && SCHEME_VEC_SIZE(v) == 3) { + a[0] = SCHEME_VEC_ELS(v)[0]; + a[1] = SCHEME_VEC_ELS(v)[1]; + a[2] = SCHEME_VEC_ELS(v)[2]; + v = scheme_apply(dyreq, 2, a); + + a[0] = a[2]; + scheme_apply_multi(v, 1, a); + } else { + a[0] = v; + scheme_wrong_type("current-print setup", "vector of three values", + -1, 0, a); + } + } + } +} + static int finish_cmd_line_run(FinishArgs *fa, Repl_Proc repl) { volatile int exit_val = 0; + volatile int did_config = 0; if (fa->a->init_ns) { - Scheme_Object *nsreq, *a[1]; + Scheme_Object *a[1], *nsreq; Scheme_Thread * volatile p; mz_jmp_buf * volatile save, newbuf; nsreq = scheme_builtin_value("namespace-require"); + a[0] = scheme_make_pair(scheme_intern_symbol("lib"), scheme_make_pair(scheme_make_utf8_string(fa->init_lib), scheme_make_null())); @@ -183,9 +225,13 @@ static int finish_cmd_line_run(FinishArgs *fa, Repl_Proc repl) p = scheme_get_current_thread(); save = p->error_buf; p->error_buf = &newbuf; - if (!scheme_setjmp(newbuf)) + if (!scheme_setjmp(newbuf)) { + if (!did_config) { + configure_environment(a[0]); + did_config = 1; + } scheme_apply(nsreq, 1, a); - else { + } else { exit_val = 1; } p->error_buf = save; @@ -238,6 +284,8 @@ static int finish_cmd_line_run(FinishArgs *fa, Repl_Proc repl) a[0] = scheme_make_pair(scheme_intern_symbol(name), scheme_make_pair(scheme_make_utf8_string(fa->evals_and_loads[i]), scheme_make_null())); + if (!did_config) + configure_environment(a[0]); scheme_apply(nsreq, 1, a); } } else { @@ -307,6 +355,7 @@ static int finish_cmd_line_run(FinishArgs *fa, Repl_Proc repl) } p->error_buf = save; } + did_config = 1; } } #endif /* DONT_PARSE_COMMAND_LINE */ diff --git a/src/mzscheme/include/mzscheme.exp b/src/mzscheme/include/mzscheme.exp index 91f78c03b3..49fbd059de 100644 --- a/src/mzscheme/include/mzscheme.exp +++ b/src/mzscheme/include/mzscheme.exp @@ -355,8 +355,8 @@ scheme_compile scheme_read scheme_read_syntax scheme_write -scheme_display scheme_print +scheme_display scheme_write_w_max scheme_display_w_max scheme_print_w_max @@ -523,6 +523,7 @@ scheme_intern_exact_char_keyword scheme_make_struct_values scheme_make_struct_names scheme_make_struct_type +scheme_make_struct_type2 scheme_make_struct_instance scheme_is_struct_instance scheme_struct_ref diff --git a/src/mzscheme/include/mzscheme3m.exp b/src/mzscheme/include/mzscheme3m.exp index 71c67b4651..1bb029ade0 100644 --- a/src/mzscheme/include/mzscheme3m.exp +++ b/src/mzscheme/include/mzscheme3m.exp @@ -361,8 +361,8 @@ scheme_compile scheme_read scheme_read_syntax scheme_write -scheme_display scheme_print +scheme_display scheme_write_w_max scheme_display_w_max scheme_print_w_max @@ -529,6 +529,7 @@ scheme_intern_exact_char_keyword scheme_make_struct_values scheme_make_struct_names scheme_make_struct_type +scheme_make_struct_type2 scheme_make_struct_instance scheme_is_struct_instance scheme_struct_ref diff --git a/src/mzscheme/include/mzwin.def b/src/mzscheme/include/mzwin.def index 02bb57de57..d6a0b6e560 100644 --- a/src/mzscheme/include/mzwin.def +++ b/src/mzscheme/include/mzwin.def @@ -338,8 +338,8 @@ EXPORTS scheme_read scheme_read_syntax scheme_write - scheme_display scheme_print + scheme_display scheme_write_w_max scheme_display_w_max scheme_print_w_max @@ -506,6 +506,7 @@ EXPORTS scheme_make_struct_values scheme_make_struct_names scheme_make_struct_type + scheme_make_struct_type2 scheme_make_struct_instance scheme_is_struct_instance scheme_struct_ref diff --git a/src/mzscheme/include/mzwin3m.def b/src/mzscheme/include/mzwin3m.def index 2e4e43b6f2..2fb6d0fd3b 100644 --- a/src/mzscheme/include/mzwin3m.def +++ b/src/mzscheme/include/mzwin3m.def @@ -353,8 +353,8 @@ EXPORTS scheme_read scheme_read_syntax scheme_write - scheme_display scheme_print + scheme_display scheme_write_w_max scheme_display_w_max scheme_print_w_max @@ -521,6 +521,7 @@ EXPORTS scheme_make_struct_values scheme_make_struct_names scheme_make_struct_type + scheme_make_struct_type2 scheme_make_struct_instance scheme_is_struct_instance scheme_struct_ref diff --git a/src/mzscheme/include/scheme.h b/src/mzscheme/include/scheme.h index 7ee0f91035..200d8a6eba 100644 --- a/src/mzscheme/include/scheme.h +++ b/src/mzscheme/include/scheme.h @@ -1191,6 +1191,8 @@ enum { MZCONFIG_PRINT_PAIR_CURLY, MZCONFIG_PRINT_MPAIR_CURLY, MZCONFIG_PRINT_SYNTAX_WIDTH, + MZCONFIG_PRINT_READER, + MZCONFIG_PRINT_AS_QQ, MZCONFIG_CASE_SENS, MZCONFIG_SQUARE_BRACKETS_ARE_PARENS, @@ -1894,6 +1896,7 @@ extern Scheme_Extension_Table *scheme_extension_table; #define SCHEME_STRUCT_GEN_GET 0x20 #define SCHEME_STRUCT_GEN_SET 0x40 #define SCHEME_STRUCT_EXPTIME 0x80 +#define SCHEME_STRUCT_NO_MAKE_PREFIX 0x100 /*========================================================================*/ /* file descriptors */ diff --git a/src/mzscheme/src/cstartup.inc b/src/mzscheme/src/cstartup.inc index 84812dd35a..34bcfefb2b 100644 --- a/src/mzscheme/src/cstartup.inc +++ b/src/mzscheme/src/cstartup.inc @@ -1,43 +1,43 @@ { - SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,52,46,50,46,53,46,51,50,0,0,0,1,0,0,3,0,12,0, -25,0,30,0,33,0,40,0,47,0,51,0,58,0,63,0,68,0,72,0,78, + SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,52,46,50,46,53,46,53,50,0,0,0,1,0,0,3,0,12,0, +16,0,21,0,28,0,41,0,48,0,53,0,58,0,62,0,69,0,72,0,78, 0,92,0,106,0,109,0,115,0,119,0,121,0,132,0,134,0,148,0,155,0, 177,0,179,0,193,0,4,1,33,1,44,1,55,1,65,1,101,1,134,1,167, 1,226,1,36,2,114,2,180,2,185,2,205,2,96,3,116,3,167,3,233,3, 118,4,4,5,56,5,79,5,158,5,0,0,105,7,0,0,29,11,11,68,104, -101,114,101,45,115,116,120,72,112,97,114,97,109,101,116,101,114,105,122,101,64, -99,111,110,100,62,111,114,66,108,101,116,114,101,99,66,117,110,108,101,115,115, -63,108,101,116,66,100,101,102,105,110,101,64,119,104,101,110,64,108,101,116,42, -63,97,110,100,65,113,117,111,116,101,29,94,2,13,68,35,37,107,101,114,110, +101,114,101,45,115,116,120,63,108,101,116,64,99,111,110,100,66,117,110,108,101, +115,115,72,112,97,114,97,109,101,116,101,114,105,122,101,66,100,101,102,105,110, +101,64,119,104,101,110,64,108,101,116,42,63,97,110,100,66,108,101,116,114,101, +99,62,111,114,65,113,117,111,116,101,29,94,2,13,68,35,37,107,101,114,110, 101,108,11,29,94,2,13,68,35,37,112,97,114,97,109,122,11,62,105,102,65, 98,101,103,105,110,63,115,116,120,61,115,70,108,101,116,45,118,97,108,117,101, 115,61,120,73,108,101,116,114,101,99,45,118,97,108,117,101,115,66,108,97,109, 98,100,97,1,20,112,97,114,97,109,101,116,101,114,105,122,97,116,105,111,110, 45,107,101,121,61,118,73,100,101,102,105,110,101,45,118,97,108,117,101,115,97, -35,11,8,240,164,75,0,0,95,159,2,15,35,35,159,2,14,35,35,159,2, -14,35,35,16,20,2,3,2,1,2,4,2,1,2,6,2,1,2,7,2,1, -2,8,2,1,2,9,2,1,2,10,2,1,2,5,2,1,2,11,2,1,2, -12,2,1,97,36,11,8,240,164,75,0,0,93,159,2,14,35,36,16,2,2, -2,161,2,1,36,2,2,2,1,2,2,96,37,11,8,240,164,75,0,0,16, -0,96,11,11,8,240,164,75,0,0,16,0,13,16,4,35,29,11,11,2,1, +35,11,8,240,35,76,0,0,95,159,2,15,35,35,159,2,14,35,35,159,2, +14,35,35,16,20,2,3,2,1,2,5,2,1,2,7,2,1,2,6,2,1, +2,8,2,1,2,9,2,1,2,10,2,1,2,4,2,1,2,11,2,1,2, +12,2,1,97,36,11,8,240,35,76,0,0,93,159,2,14,35,36,16,2,2, +2,161,2,1,36,2,2,2,1,2,2,96,11,11,8,240,35,76,0,0,16, +0,96,37,11,8,240,35,76,0,0,16,0,13,16,4,35,29,11,11,2,1, 11,18,16,2,99,64,104,101,114,101,8,31,8,30,8,29,8,28,8,27,93, -8,224,171,75,0,0,95,9,8,224,171,75,0,0,2,1,27,248,22,142,4, +8,224,42,76,0,0,95,9,8,224,42,76,0,0,2,1,27,248,22,142,4, 195,249,22,135,4,80,158,38,35,251,22,80,2,16,248,22,95,199,12,249,22, 70,2,17,248,22,97,201,27,248,22,142,4,195,249,22,135,4,80,158,38,35, 251,22,80,2,16,248,22,95,199,249,22,70,2,17,248,22,97,201,12,27,248, 22,72,248,22,142,4,196,28,248,22,78,193,20,15,159,36,35,36,28,248,22, 78,248,22,72,194,248,22,71,193,249,22,135,4,80,158,38,35,251,22,80,2, -16,248,22,71,199,249,22,70,2,12,248,22,72,201,11,18,16,2,101,10,8, +16,248,22,71,199,249,22,70,2,10,248,22,72,201,11,18,16,2,101,10,8, 31,8,30,8,29,8,28,8,27,16,4,11,11,2,18,3,1,8,101,110,118, -49,50,53,55,55,16,4,11,11,2,19,3,1,8,101,110,118,49,50,53,55, -56,93,8,224,172,75,0,0,95,9,8,224,172,75,0,0,2,1,27,248,22, +49,50,54,56,56,16,4,11,11,2,19,3,1,8,101,110,118,49,50,54,56, +57,93,8,224,43,76,0,0,95,9,8,224,43,76,0,0,2,1,27,248,22, 72,248,22,142,4,196,28,248,22,78,193,20,15,159,36,35,36,28,248,22,78, 248,22,72,194,248,22,71,193,249,22,135,4,80,158,38,35,250,22,80,2,20, 248,22,80,249,22,80,248,22,80,2,21,248,22,71,201,251,22,80,2,16,2, -21,2,21,249,22,70,2,5,248,22,72,204,18,16,2,101,11,8,31,8,30, -8,29,8,28,8,27,16,4,11,11,2,18,3,1,8,101,110,118,49,50,53, -56,48,16,4,11,11,2,19,3,1,8,101,110,118,49,50,53,56,49,93,8, -224,173,75,0,0,95,9,8,224,173,75,0,0,2,1,248,22,142,4,193,27, +21,2,21,249,22,70,2,12,248,22,72,204,18,16,2,101,11,8,31,8,30, +8,29,8,28,8,27,16,4,11,11,2,18,3,1,8,101,110,118,49,50,54, +57,49,16,4,11,11,2,19,3,1,8,101,110,118,49,50,54,57,50,93,8, +224,44,76,0,0,95,9,8,224,44,76,0,0,2,1,248,22,142,4,193,27, 248,22,142,4,194,249,22,70,248,22,80,248,22,71,196,248,22,72,195,27,248, 22,72,248,22,142,4,23,197,1,249,22,135,4,80,158,38,35,28,248,22,55, 248,22,136,4,248,22,71,23,198,2,27,249,22,2,32,0,89,162,8,44,36, @@ -51,8 +51,8 @@ 249,22,2,32,0,89,162,8,44,36,46,9,222,33,42,248,22,142,4,248,22, 71,201,248,22,72,198,27,248,22,72,248,22,142,4,196,27,248,22,142,4,248, 22,71,195,249,22,135,4,80,158,39,35,28,248,22,78,195,250,22,81,2,20, -9,248,22,72,199,250,22,80,2,8,248,22,80,248,22,71,199,250,22,81,2, -11,248,22,72,201,248,22,72,202,27,248,22,72,248,22,142,4,23,197,1,27, +9,248,22,72,199,250,22,80,2,3,248,22,80,248,22,71,199,250,22,81,2, +9,248,22,72,201,248,22,72,202,27,248,22,72,248,22,142,4,23,197,1,27, 249,22,1,22,84,249,22,2,22,142,4,248,22,142,4,248,22,71,199,249,22, 135,4,80,158,39,35,251,22,80,1,22,119,105,116,104,45,99,111,110,116,105, 110,117,97,116,105,111,110,45,109,97,114,107,2,24,250,22,81,1,23,101,120, @@ -67,9 +67,9 @@ 22,175,8,248,22,136,4,248,22,71,200,64,101,108,115,101,10,248,22,71,197, 250,22,81,2,20,9,248,22,72,200,249,22,70,2,4,248,22,72,202,100,8, 31,8,30,8,29,8,28,8,27,16,4,11,11,2,18,3,1,8,101,110,118, -49,50,54,48,51,16,4,11,11,2,19,3,1,8,101,110,118,49,50,54,48, -52,93,8,224,174,75,0,0,18,16,2,158,94,10,64,118,111,105,100,8,47, -95,9,8,224,174,75,0,0,2,1,27,248,22,72,248,22,142,4,196,249,22, +49,50,55,49,52,16,4,11,11,2,19,3,1,8,101,110,118,49,50,55,49, +53,93,8,224,45,76,0,0,18,16,2,158,94,10,64,118,111,105,100,8,47, +95,9,8,224,45,76,0,0,2,1,27,248,22,72,248,22,142,4,196,249,22, 135,4,80,158,38,35,28,248,22,55,248,22,136,4,248,22,71,197,250,22,80, 2,26,248,22,80,248,22,71,199,248,22,95,198,27,248,22,136,4,248,22,71, 197,250,22,80,2,26,248,22,80,248,22,71,197,250,22,81,2,23,248,22,72, @@ -81,31 +81,31 @@ 2,3,2,4,2,5,2,6,2,7,2,8,2,9,2,10,2,11,2,12,35, 45,36,11,11,11,16,0,16,0,16,0,35,35,11,11,11,11,16,0,16,0, 16,0,35,35,16,11,16,5,2,2,20,15,159,35,35,35,35,20,105,159,35, -16,0,16,1,33,32,10,16,5,2,7,89,162,8,44,36,52,9,223,0,33, -33,35,20,105,159,35,16,1,2,2,16,0,11,16,5,2,10,89,162,8,44, +16,0,16,1,33,32,10,16,5,2,5,89,162,8,44,36,52,9,223,0,33, +33,35,20,105,159,35,16,1,2,2,16,0,11,16,5,2,8,89,162,8,44, 36,52,9,223,0,33,34,35,20,105,159,35,16,1,2,2,16,0,11,16,5, -2,12,89,162,8,44,36,52,9,223,0,33,35,35,20,105,159,35,16,1,2, -2,16,1,33,36,11,16,5,2,5,89,162,8,44,36,55,9,223,0,33,37, -35,20,105,159,35,16,1,2,2,16,1,33,38,11,16,5,2,8,89,162,8, +2,10,89,162,8,44,36,52,9,223,0,33,35,35,20,105,159,35,16,1,2, +2,16,1,33,36,11,16,5,2,12,89,162,8,44,36,55,9,223,0,33,37, +35,20,105,159,35,16,1,2,2,16,1,33,38,11,16,5,2,3,89,162,8, 44,36,57,9,223,0,33,41,35,20,105,159,35,16,1,2,2,16,0,11,16, -5,2,6,89,162,8,44,36,52,9,223,0,33,43,35,20,105,159,35,16,1, -2,2,16,0,11,16,5,2,11,89,162,8,44,36,53,9,223,0,33,44,35, -20,105,159,35,16,1,2,2,16,0,11,16,5,2,3,89,162,8,44,36,54, +5,2,11,89,162,8,44,36,52,9,223,0,33,43,35,20,105,159,35,16,1, +2,2,16,0,11,16,5,2,9,89,162,8,44,36,53,9,223,0,33,44,35, +20,105,159,35,16,1,2,2,16,0,11,16,5,2,6,89,162,8,44,36,54, 9,223,0,33,45,35,20,105,159,35,16,1,2,2,16,0,11,16,5,2,4, 89,162,8,44,36,57,9,223,0,33,46,35,20,105,159,35,16,1,2,2,16, -1,33,48,11,16,5,2,9,89,162,8,44,36,53,9,223,0,33,49,35,20, +1,33,48,11,16,5,2,7,89,162,8,44,36,53,9,223,0,33,49,35,20, 105,159,35,16,1,2,2,16,0,11,16,0,94,2,14,2,15,93,2,14,9, 9,35,0}; EVAL_ONE_SIZED_STR((char *)expr, 2018); } { - SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,52,46,50,46,53,46,51,64,0,0,0,1,0,0,13,0,18,0, + SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,52,46,50,46,53,46,53,64,0,0,0,1,0,0,13,0,18,0, 35,0,50,0,68,0,84,0,94,0,112,0,132,0,148,0,166,0,197,0,226, 0,248,0,6,1,12,1,26,1,31,1,41,1,49,1,77,1,109,1,115,1, -160,1,205,1,229,1,12,2,14,2,71,2,161,3,202,3,19,5,105,5,191, -5,34,6,118,6,131,6,252,6,98,7,110,7,216,8,230,8,119,9,104,10, -86,11,93,11,101,11,109,11,234,11,248,11,233,13,79,14,101,14,117,14,65, -16,168,16,182,16,8,18,201,19,210,19,219,19,245,19,100,20,0,0,90,23, +160,1,205,1,229,1,12,2,14,2,180,2,14,4,55,4,128,5,214,5,44, +6,143,6,227,6,240,6,105,7,207,7,219,7,69,9,83,9,228,9,213,10, +195,11,202,11,210,11,218,11,87,12,101,12,86,14,188,14,210,14,226,14,174, +16,21,17,35,17,117,18,54,20,63,20,72,20,98,20,209,20,0,0,201,23, 0,0,72,112,97,116,104,45,115,116,114,105,110,103,63,64,98,115,98,115,76, 110,111,114,109,97,108,45,99,97,115,101,45,112,97,116,104,74,45,99,104,101, 99,107,45,114,101,108,112,97,116,104,77,45,99,104,101,99,107,45,99,111,108, @@ -131,275 +131,281 @@ 103,6,21,21,115,116,114,105,110,103,32,111,114,32,98,121,116,101,32,115,116, 114,105,110,103,6,36,36,99,97,110,110,111,116,32,97,100,100,32,97,32,115, 117,102,102,105,120,32,116,111,32,97,32,114,111,111,116,32,112,97,116,104,58, -32,5,0,27,20,14,159,80,158,36,50,250,80,158,39,51,249,22,27,11,80, -158,41,50,22,144,13,10,248,22,167,5,23,196,2,28,248,22,164,6,23,194, -2,12,87,94,248,22,181,8,23,194,1,248,80,159,37,53,36,195,28,248,22, -78,23,195,2,9,27,248,22,71,23,196,2,27,28,248,22,190,13,23,195,2, -23,194,1,28,248,22,189,13,23,195,2,249,22,191,13,23,196,1,250,80,158, -42,48,248,22,142,14,2,19,11,10,250,80,158,40,48,248,22,142,14,2,19, -23,197,1,10,28,23,193,2,249,22,70,248,22,129,14,249,22,191,13,23,198, -1,247,22,143,14,27,248,22,72,23,200,1,28,248,22,78,23,194,2,9,27, -248,22,71,23,195,2,27,28,248,22,190,13,23,195,2,23,194,1,28,248,22, -189,13,23,195,2,249,22,191,13,23,196,1,250,80,158,47,48,248,22,142,14, -2,19,11,10,250,80,158,45,48,248,22,142,14,2,19,23,197,1,10,28,23, -193,2,249,22,70,248,22,129,14,249,22,191,13,23,198,1,247,22,143,14,248, -80,159,45,52,36,248,22,72,23,199,1,87,94,23,193,1,248,80,159,43,52, -36,248,22,72,23,197,1,87,94,23,193,1,27,248,22,72,23,198,1,28,248, -22,78,23,194,2,9,27,248,22,71,23,195,2,27,28,248,22,190,13,23,195, -2,23,194,1,28,248,22,189,13,23,195,2,249,22,191,13,23,196,1,250,80, -158,45,48,248,22,142,14,2,19,11,10,250,80,158,43,48,248,22,142,14,2, -19,23,197,1,10,28,23,193,2,249,22,70,248,22,129,14,249,22,191,13,23, -198,1,247,22,143,14,248,80,159,43,52,36,248,22,72,23,199,1,248,80,159, -41,52,36,248,22,72,196,27,248,22,166,13,23,195,2,28,23,193,2,192,87, -94,23,193,1,28,248,22,169,6,23,195,2,27,248,22,188,13,195,28,192,192, -248,22,189,13,195,11,87,94,28,28,248,22,167,13,23,195,2,10,28,248,22, -166,13,23,195,2,10,28,248,22,169,6,23,195,2,28,248,22,188,13,23,195, -2,10,248,22,189,13,23,195,2,11,12,250,22,145,9,76,110,111,114,109,97, -108,45,112,97,116,104,45,99,97,115,101,6,42,42,112,97,116,104,32,40,102, -111,114,32,97,110,121,32,115,121,115,116,101,109,41,32,111,114,32,118,97,108, -105,100,45,112,97,116,104,32,115,116,114,105,110,103,23,197,2,28,28,248,22, -167,13,23,195,2,249,22,175,8,248,22,168,13,23,197,2,2,20,249,22,175, -8,247,22,188,7,2,20,27,28,248,22,169,6,23,196,2,23,195,2,248,22, -178,7,248,22,171,13,23,197,2,28,249,22,155,14,0,21,35,114,120,34,94, -91,92,92,93,91,92,92,93,91,63,93,91,92,92,93,34,23,195,2,28,248, -22,169,6,195,248,22,174,13,195,194,27,248,22,144,7,23,195,1,249,22,175, -13,248,22,181,7,250,22,161,14,0,6,35,114,120,34,47,34,28,249,22,155, -14,0,22,35,114,120,34,91,47,92,92,93,91,46,32,93,43,91,47,92,92, -93,42,36,34,23,201,2,23,199,1,250,22,161,14,0,19,35,114,120,34,91, -32,46,93,43,40,91,47,92,92,93,42,41,36,34,23,202,1,6,2,2,92, -49,80,159,43,36,37,2,20,28,248,22,169,6,194,248,22,174,13,194,193,87, -94,28,28,248,22,166,13,23,195,2,10,28,248,22,169,6,23,195,2,28,248, -22,188,13,23,195,2,10,248,22,189,13,23,195,2,11,12,250,22,145,9,23, -196,2,2,21,23,197,2,28,248,22,188,13,23,195,2,12,248,22,184,11,249, -22,190,10,248,22,134,7,250,22,153,7,2,22,23,200,1,23,201,1,247,22, -23,87,94,28,28,248,22,166,13,23,195,2,10,28,248,22,169,6,23,195,2, -28,248,22,188,13,23,195,2,10,248,22,189,13,23,195,2,11,12,250,22,145, -9,23,196,2,2,21,23,197,2,28,248,22,188,13,23,195,2,12,248,22,184, -11,249,22,190,10,248,22,134,7,250,22,153,7,2,22,23,200,1,23,201,1, -247,22,23,87,94,87,94,28,28,248,22,166,13,23,195,2,10,28,248,22,169, -6,23,195,2,28,248,22,188,13,23,195,2,10,248,22,189,13,23,195,2,11, -12,250,22,145,9,195,2,21,23,197,2,28,248,22,188,13,23,195,2,12,248, -22,184,11,249,22,190,10,248,22,134,7,250,22,153,7,2,22,199,23,201,1, -247,22,23,249,22,3,89,162,8,44,36,49,9,223,2,33,34,196,87,94,28, -28,248,22,166,13,23,194,2,10,28,248,22,169,6,23,194,2,28,248,22,188, -13,23,194,2,10,248,22,189,13,23,194,2,11,12,250,22,145,9,2,6,2, -21,23,196,2,28,248,22,188,13,23,194,2,12,248,22,184,11,249,22,190,10, -248,22,134,7,250,22,153,7,2,22,2,6,23,200,1,247,22,23,32,37,89, -162,8,44,39,54,2,23,222,33,38,28,248,22,78,23,197,2,87,94,23,196, -1,248,22,184,11,249,22,159,11,251,22,153,7,2,24,2,6,28,248,22,78, -23,203,2,87,94,23,202,1,23,201,1,250,22,1,22,184,13,23,204,1,23, -205,1,23,200,1,247,22,23,27,249,22,184,13,248,22,71,23,200,2,23,197, -2,28,248,22,179,13,23,194,2,27,250,22,1,22,184,13,23,197,1,199,28, -248,22,179,13,193,192,251,2,37,198,199,200,248,22,72,202,251,2,37,197,198, -199,248,22,72,201,87,94,87,94,87,94,28,28,248,22,166,13,193,10,28,248, -22,169,6,193,28,248,22,188,13,193,10,248,22,189,13,193,11,12,250,22,145, -9,2,6,2,21,195,28,248,22,188,13,193,12,248,22,184,11,249,22,190,10, -248,22,134,7,250,22,153,7,2,22,2,6,199,247,22,23,249,22,3,32,0, -89,162,8,44,36,48,9,222,33,36,195,27,247,22,144,14,251,2,37,196,197, -198,196,32,40,89,162,43,41,58,2,23,222,33,41,28,248,22,78,23,199,2, -87,94,23,198,1,248,23,196,1,251,22,153,7,2,24,23,199,1,28,248,22, -78,23,203,2,87,94,23,202,1,23,201,1,250,22,1,22,184,13,23,204,1, -23,205,1,23,198,1,27,249,22,184,13,248,22,71,23,202,2,23,199,2,28, -248,22,179,13,23,194,2,27,250,22,1,22,184,13,23,197,1,23,202,2,28, -248,22,179,13,23,194,2,192,87,94,23,193,1,27,248,22,72,23,202,1,28, -248,22,78,23,194,2,87,94,23,193,1,248,23,199,1,251,22,153,7,2,24, -23,202,1,28,248,22,78,23,206,2,87,94,23,205,1,23,204,1,250,22,1, -22,184,13,23,207,1,23,208,1,23,201,1,27,249,22,184,13,248,22,71,23, -197,2,23,202,2,28,248,22,179,13,23,194,2,27,250,22,1,22,184,13,23, -197,1,204,28,248,22,179,13,193,192,253,2,40,203,204,205,206,23,15,248,22, -72,201,253,2,40,202,203,204,205,206,248,22,72,200,87,94,23,193,1,27,248, -22,72,23,201,1,28,248,22,78,23,194,2,87,94,23,193,1,248,23,198,1, -251,22,153,7,2,24,23,201,1,28,248,22,78,23,205,2,87,94,23,204,1, -23,203,1,250,22,1,22,184,13,23,206,1,23,207,1,23,200,1,27,249,22, -184,13,248,22,71,23,197,2,23,201,2,28,248,22,179,13,23,194,2,27,250, -22,1,22,184,13,23,197,1,203,28,248,22,179,13,193,192,253,2,40,202,203, -204,205,206,248,22,72,201,253,2,40,201,202,203,204,205,248,22,72,200,27,247, -22,144,14,253,2,40,198,199,200,201,202,198,87,95,28,28,248,22,167,13,23, -194,2,10,28,248,22,166,13,23,194,2,10,28,248,22,169,6,23,194,2,28, -248,22,188,13,23,194,2,10,248,22,189,13,23,194,2,11,12,252,22,145,9, -23,200,2,2,25,35,23,198,2,23,199,2,28,28,248,22,169,6,23,195,2, -10,248,22,157,7,23,195,2,87,94,23,194,1,12,252,22,145,9,23,200,2, -2,26,36,23,198,2,23,199,1,91,159,38,11,90,161,38,35,11,248,22,187, -13,23,197,2,87,94,23,195,1,87,94,28,192,12,250,22,146,9,23,201,1, -2,27,23,199,1,249,22,7,194,195,91,159,37,11,90,161,37,35,11,87,95, -28,28,248,22,167,13,23,196,2,10,28,248,22,166,13,23,196,2,10,28,248, -22,169,6,23,196,2,28,248,22,188,13,23,196,2,10,248,22,189,13,23,196, -2,11,12,252,22,145,9,2,9,2,25,35,23,200,2,23,201,2,28,28,248, -22,169,6,23,197,2,10,248,22,157,7,23,197,2,12,252,22,145,9,2,9, -2,26,36,23,200,2,23,201,2,91,159,38,11,90,161,38,35,11,248,22,187, -13,23,199,2,87,94,23,195,1,87,94,28,192,12,250,22,146,9,2,9,2, -27,23,201,2,249,22,7,194,195,27,249,22,176,13,250,22,160,14,0,20,35, -114,120,35,34,40,63,58,91,46,93,91,94,46,93,42,124,41,36,34,248,22, -172,13,23,201,1,28,248,22,169,6,23,203,2,249,22,181,7,23,204,1,8, -63,23,202,1,28,248,22,167,13,23,199,2,248,22,168,13,23,199,1,87,94, -23,198,1,247,22,169,13,28,248,22,166,13,194,249,22,184,13,195,194,192,91, -159,37,11,90,161,37,35,11,87,95,28,28,248,22,167,13,23,196,2,10,28, -248,22,166,13,23,196,2,10,28,248,22,169,6,23,196,2,28,248,22,188,13, -23,196,2,10,248,22,189,13,23,196,2,11,12,252,22,145,9,2,10,2,25, -35,23,200,2,23,201,2,28,28,248,22,169,6,23,197,2,10,248,22,157,7, -23,197,2,12,252,22,145,9,2,10,2,26,36,23,200,2,23,201,2,91,159, -38,11,90,161,38,35,11,248,22,187,13,23,199,2,87,94,23,195,1,87,94, -28,192,12,250,22,146,9,2,10,2,27,23,201,2,249,22,7,194,195,27,249, -22,176,13,249,22,167,7,250,22,161,14,0,9,35,114,120,35,34,91,46,93, -34,248,22,172,13,23,203,1,6,1,1,95,28,248,22,169,6,23,202,2,249, -22,181,7,23,203,1,8,63,23,201,1,28,248,22,167,13,23,199,2,248,22, -168,13,23,199,1,87,94,23,198,1,247,22,169,13,28,248,22,166,13,194,249, -22,184,13,195,194,192,249,247,22,136,5,194,11,249,80,159,37,46,36,9,9, -249,80,159,37,46,36,195,9,27,247,22,146,14,249,80,158,38,47,28,23,195, -2,27,248,22,186,7,6,11,11,80,76,84,67,79,76,76,69,67,84,83,28, -192,192,6,0,0,6,0,0,27,28,23,196,1,250,22,184,13,248,22,142,14, -69,97,100,100,111,110,45,100,105,114,247,22,184,7,6,8,8,99,111,108,108, -101,99,116,115,11,27,248,80,159,41,52,36,250,22,84,23,203,1,248,22,80, -248,22,142,14,72,99,111,108,108,101,99,116,115,45,100,105,114,23,204,1,28, -193,249,22,70,195,194,192,32,50,89,162,8,44,38,8,31,2,18,222,33,51, -27,249,22,153,14,23,197,2,23,198,2,28,23,193,2,87,94,23,196,1,27, -248,22,95,23,195,2,27,27,248,22,104,23,197,1,27,249,22,153,14,23,201, -2,23,196,2,28,23,193,2,87,94,23,194,1,27,248,22,95,23,195,2,27, -27,248,22,104,23,197,1,27,249,22,153,14,23,205,2,23,196,2,28,23,193, -2,87,94,23,194,1,27,248,22,95,23,195,2,27,27,248,22,104,23,197,1, -27,249,22,153,14,23,209,2,23,196,2,28,23,193,2,87,94,23,194,1,27, -248,22,95,23,195,2,27,27,248,22,104,23,197,1,27,249,22,153,14,23,213, -2,23,196,2,28,23,193,2,87,94,23,194,1,27,248,22,95,23,195,2,27, -250,2,50,23,215,2,23,216,1,248,22,104,23,199,1,28,249,22,163,7,23, -196,2,2,28,249,22,84,23,214,2,194,249,22,70,248,22,175,13,23,197,1, -194,87,95,23,211,1,23,193,1,28,249,22,163,7,23,196,2,2,28,249,22, -84,23,212,2,9,249,22,70,248,22,175,13,23,197,1,9,28,249,22,163,7, -23,196,2,2,28,249,22,84,23,210,2,194,249,22,70,248,22,175,13,23,197, +32,5,0,27,20,14,159,80,159,36,50,37,250,80,159,39,51,37,249,22,27, +11,80,159,41,50,37,22,144,13,10,248,22,167,5,23,196,2,28,248,22,164, +6,23,194,2,12,87,94,248,22,181,8,23,194,1,27,20,14,159,80,159,37, +50,37,250,80,159,40,51,37,249,22,27,11,80,159,42,50,37,22,144,13,10, +248,22,167,5,23,197,2,28,248,22,164,6,23,194,2,12,87,94,248,22,181, +8,23,194,1,27,20,14,159,80,159,38,50,37,250,80,159,41,51,37,249,22, +27,11,80,159,43,50,37,22,144,13,10,248,22,167,5,23,198,2,28,248,22, +164,6,23,194,2,12,87,94,248,22,181,8,23,194,1,248,80,159,39,53,36, +197,28,248,22,78,23,195,2,9,27,248,22,71,23,196,2,27,28,248,22,128, +14,23,195,2,23,194,1,28,248,22,191,13,23,195,2,249,22,129,14,23,196, +1,250,80,158,42,48,248,22,144,14,2,19,11,10,250,80,158,40,48,248,22, +144,14,2,19,23,197,1,10,28,23,193,2,249,22,70,248,22,131,14,249,22, +129,14,23,198,1,247,22,145,14,27,248,22,72,23,200,1,28,248,22,78,23, +194,2,9,27,248,22,71,23,195,2,27,28,248,22,128,14,23,195,2,23,194, +1,28,248,22,191,13,23,195,2,249,22,129,14,23,196,1,250,80,158,47,48, +248,22,144,14,2,19,11,10,250,80,158,45,48,248,22,144,14,2,19,23,197, +1,10,28,23,193,2,249,22,70,248,22,131,14,249,22,129,14,23,198,1,247, +22,145,14,248,80,159,45,52,36,248,22,72,23,199,1,87,94,23,193,1,248, +80,159,43,52,36,248,22,72,23,197,1,87,94,23,193,1,27,248,22,72,23, +198,1,28,248,22,78,23,194,2,9,27,248,22,71,23,195,2,27,28,248,22, +128,14,23,195,2,23,194,1,28,248,22,191,13,23,195,2,249,22,129,14,23, +196,1,250,80,158,45,48,248,22,144,14,2,19,11,10,250,80,158,43,48,248, +22,144,14,2,19,23,197,1,10,28,23,193,2,249,22,70,248,22,131,14,249, +22,129,14,23,198,1,247,22,145,14,248,80,159,43,52,36,248,22,72,23,199, +1,248,80,159,41,52,36,248,22,72,196,27,248,22,168,13,23,195,2,28,23, +193,2,192,87,94,23,193,1,28,248,22,169,6,23,195,2,27,248,22,190,13, +195,28,192,192,248,22,191,13,195,11,87,94,28,28,248,22,169,13,23,195,2, +10,28,248,22,168,13,23,195,2,10,28,248,22,169,6,23,195,2,28,248,22, +190,13,23,195,2,10,248,22,191,13,23,195,2,11,12,250,22,145,9,76,110, +111,114,109,97,108,45,112,97,116,104,45,99,97,115,101,6,42,42,112,97,116, +104,32,40,102,111,114,32,97,110,121,32,115,121,115,116,101,109,41,32,111,114, +32,118,97,108,105,100,45,112,97,116,104,32,115,116,114,105,110,103,23,197,2, +28,28,248,22,169,13,23,195,2,249,22,175,8,248,22,170,13,23,197,2,2, +20,249,22,175,8,247,22,188,7,2,20,27,28,248,22,169,6,23,196,2,23, +195,2,248,22,178,7,248,22,173,13,23,197,2,28,249,22,157,14,0,21,35, +114,120,34,94,91,92,92,93,91,92,92,93,91,63,93,91,92,92,93,34,23, +195,2,28,248,22,169,6,195,248,22,176,13,195,194,27,248,22,144,7,23,195, +1,249,22,177,13,248,22,181,7,250,22,163,14,0,6,35,114,120,34,47,34, +28,249,22,157,14,0,22,35,114,120,34,91,47,92,92,93,91,46,32,93,43, +91,47,92,92,93,42,36,34,23,201,2,23,199,1,250,22,163,14,0,19,35, +114,120,34,91,32,46,93,43,40,91,47,92,92,93,42,41,36,34,23,202,1, +6,2,2,92,49,80,159,43,36,37,2,20,28,248,22,169,6,194,248,22,176, +13,194,193,87,94,28,28,248,22,168,13,23,195,2,10,28,248,22,169,6,23, +195,2,28,248,22,190,13,23,195,2,10,248,22,191,13,23,195,2,11,12,250, +22,145,9,23,196,2,2,21,23,197,2,28,248,22,190,13,23,195,2,12,248, +22,184,11,249,22,190,10,248,22,134,7,250,22,153,7,2,22,23,200,1,23, +201,1,247,22,23,87,94,28,28,248,22,168,13,23,195,2,10,28,248,22,169, +6,23,195,2,28,248,22,190,13,23,195,2,10,248,22,191,13,23,195,2,11, +12,250,22,145,9,23,196,2,2,21,23,197,2,28,248,22,190,13,23,195,2, +12,248,22,184,11,249,22,190,10,248,22,134,7,250,22,153,7,2,22,23,200, +1,23,201,1,247,22,23,87,94,87,94,28,28,248,22,168,13,23,195,2,10, +28,248,22,169,6,23,195,2,28,248,22,190,13,23,195,2,10,248,22,191,13, +23,195,2,11,12,250,22,145,9,195,2,21,23,197,2,28,248,22,190,13,23, +195,2,12,248,22,184,11,249,22,190,10,248,22,134,7,250,22,153,7,2,22, +199,23,201,1,247,22,23,249,22,3,89,162,8,44,36,49,9,223,2,33,34, +196,87,94,28,28,248,22,168,13,23,194,2,10,28,248,22,169,6,23,194,2, +28,248,22,190,13,23,194,2,10,248,22,191,13,23,194,2,11,12,250,22,145, +9,2,6,2,21,23,196,2,28,248,22,190,13,23,194,2,12,248,22,184,11, +249,22,190,10,248,22,134,7,250,22,153,7,2,22,2,6,23,200,1,247,22, +23,32,37,89,162,8,44,39,54,2,23,222,33,38,28,248,22,78,23,197,2, +87,94,23,196,1,248,22,184,11,249,22,159,11,251,22,153,7,2,24,2,6, +28,248,22,78,23,203,2,87,94,23,202,1,23,201,1,250,22,1,22,186,13, +23,204,1,23,205,1,23,200,1,247,22,23,27,249,22,186,13,248,22,71,23, +200,2,23,197,2,28,248,22,181,13,23,194,2,27,250,22,1,22,186,13,23, +197,1,199,28,248,22,181,13,193,192,251,2,37,198,199,200,248,22,72,202,251, +2,37,197,198,199,248,22,72,201,87,94,87,94,87,94,28,28,248,22,168,13, +193,10,28,248,22,169,6,193,28,248,22,190,13,193,10,248,22,191,13,193,11, +12,250,22,145,9,2,6,2,21,195,28,248,22,190,13,193,12,248,22,184,11, +249,22,190,10,248,22,134,7,250,22,153,7,2,22,2,6,199,247,22,23,249, +22,3,32,0,89,162,8,44,36,48,9,222,33,36,195,27,247,22,146,14,251, +2,37,196,197,198,196,32,40,89,162,43,41,58,2,23,222,33,41,28,248,22, +78,23,199,2,87,94,23,198,1,248,23,196,1,251,22,153,7,2,24,23,199, +1,28,248,22,78,23,203,2,87,94,23,202,1,23,201,1,250,22,1,22,186, +13,23,204,1,23,205,1,23,198,1,27,249,22,186,13,248,22,71,23,202,2, +23,199,2,28,248,22,181,13,23,194,2,27,250,22,1,22,186,13,23,197,1, +23,202,2,28,248,22,181,13,23,194,2,192,87,94,23,193,1,27,248,22,72, +23,202,1,28,248,22,78,23,194,2,87,94,23,193,1,248,23,199,1,251,22, +153,7,2,24,23,202,1,28,248,22,78,23,206,2,87,94,23,205,1,23,204, +1,250,22,1,22,186,13,23,207,1,23,208,1,23,201,1,27,249,22,186,13, +248,22,71,23,197,2,23,202,2,28,248,22,181,13,23,194,2,27,250,22,1, +22,186,13,23,197,1,204,28,248,22,181,13,193,192,253,2,40,203,204,205,206, +23,15,248,22,72,201,253,2,40,202,203,204,205,206,248,22,72,200,87,94,23, +193,1,27,248,22,72,23,201,1,28,248,22,78,23,194,2,87,94,23,193,1, +248,23,198,1,251,22,153,7,2,24,23,201,1,28,248,22,78,23,205,2,87, +94,23,204,1,23,203,1,250,22,1,22,186,13,23,206,1,23,207,1,23,200, +1,27,249,22,186,13,248,22,71,23,197,2,23,201,2,28,248,22,181,13,23, +194,2,27,250,22,1,22,186,13,23,197,1,203,28,248,22,181,13,193,192,253, +2,40,202,203,204,205,206,248,22,72,201,253,2,40,201,202,203,204,205,248,22, +72,200,27,247,22,146,14,253,2,40,198,199,200,201,202,198,87,95,28,28,248, +22,169,13,23,194,2,10,28,248,22,168,13,23,194,2,10,28,248,22,169,6, +23,194,2,28,248,22,190,13,23,194,2,10,248,22,191,13,23,194,2,11,12, +252,22,145,9,23,200,2,2,25,35,23,198,2,23,199,2,28,28,248,22,169, +6,23,195,2,10,248,22,157,7,23,195,2,87,94,23,194,1,12,252,22,145, +9,23,200,2,2,26,36,23,198,2,23,199,1,91,159,38,11,90,161,38,35, +11,248,22,189,13,23,197,2,87,94,23,195,1,87,94,28,192,12,250,22,146, +9,23,201,1,2,27,23,199,1,249,22,7,194,195,91,159,37,11,90,161,37, +35,11,87,95,28,28,248,22,169,13,23,196,2,10,28,248,22,168,13,23,196, +2,10,28,248,22,169,6,23,196,2,28,248,22,190,13,23,196,2,10,248,22, +191,13,23,196,2,11,12,252,22,145,9,2,9,2,25,35,23,200,2,23,201, +2,28,28,248,22,169,6,23,197,2,10,248,22,157,7,23,197,2,12,252,22, +145,9,2,9,2,26,36,23,200,2,23,201,2,91,159,38,11,90,161,38,35, +11,248,22,189,13,23,199,2,87,94,23,195,1,87,94,28,192,12,250,22,146, +9,2,9,2,27,23,201,2,249,22,7,194,195,27,249,22,178,13,250,22,162, +14,0,20,35,114,120,35,34,40,63,58,91,46,93,91,94,46,93,42,124,41, +36,34,248,22,174,13,23,201,1,28,248,22,169,6,23,203,2,249,22,181,7, +23,204,1,8,63,23,202,1,28,248,22,169,13,23,199,2,248,22,170,13,23, +199,1,87,94,23,198,1,247,22,171,13,28,248,22,168,13,194,249,22,186,13, +195,194,192,91,159,37,11,90,161,37,35,11,87,95,28,28,248,22,169,13,23, +196,2,10,28,248,22,168,13,23,196,2,10,28,248,22,169,6,23,196,2,28, +248,22,190,13,23,196,2,10,248,22,191,13,23,196,2,11,12,252,22,145,9, +2,10,2,25,35,23,200,2,23,201,2,28,28,248,22,169,6,23,197,2,10, +248,22,157,7,23,197,2,12,252,22,145,9,2,10,2,26,36,23,200,2,23, +201,2,91,159,38,11,90,161,38,35,11,248,22,189,13,23,199,2,87,94,23, +195,1,87,94,28,192,12,250,22,146,9,2,10,2,27,23,201,2,249,22,7, +194,195,27,249,22,178,13,249,22,167,7,250,22,163,14,0,9,35,114,120,35, +34,91,46,93,34,248,22,174,13,23,203,1,6,1,1,95,28,248,22,169,6, +23,202,2,249,22,181,7,23,203,1,8,63,23,201,1,28,248,22,169,13,23, +199,2,248,22,170,13,23,199,1,87,94,23,198,1,247,22,171,13,28,248,22, +168,13,194,249,22,186,13,195,194,192,249,247,22,136,5,194,11,249,80,159,37, +46,36,9,9,249,80,159,37,46,36,195,9,27,247,22,148,14,249,80,158,38, +47,28,23,195,2,27,248,22,186,7,6,11,11,80,76,84,67,79,76,76,69, +67,84,83,28,192,192,6,0,0,6,0,0,27,28,23,196,1,250,22,186,13, +248,22,144,14,69,97,100,100,111,110,45,100,105,114,247,22,184,7,6,8,8, +99,111,108,108,101,99,116,115,11,27,248,80,159,41,52,36,250,22,84,23,203, +1,248,22,80,248,22,144,14,72,99,111,108,108,101,99,116,115,45,100,105,114, +23,204,1,28,193,249,22,70,195,194,192,32,50,89,162,8,44,38,8,31,2, +18,222,33,51,27,249,22,155,14,23,197,2,23,198,2,28,23,193,2,87,94, +23,196,1,27,248,22,95,23,195,2,27,27,248,22,104,23,197,1,27,249,22, +155,14,23,201,2,23,196,2,28,23,193,2,87,94,23,194,1,27,248,22,95, +23,195,2,27,27,248,22,104,23,197,1,27,249,22,155,14,23,205,2,23,196, +2,28,23,193,2,87,94,23,194,1,27,248,22,95,23,195,2,27,27,248,22, +104,23,197,1,27,249,22,155,14,23,209,2,23,196,2,28,23,193,2,87,94, +23,194,1,27,248,22,95,23,195,2,27,27,248,22,104,23,197,1,27,249,22, +155,14,23,213,2,23,196,2,28,23,193,2,87,94,23,194,1,27,248,22,95, +23,195,2,27,250,2,50,23,215,2,23,216,1,248,22,104,23,199,1,28,249, +22,163,7,23,196,2,2,28,249,22,84,23,214,2,194,249,22,70,248,22,177, +13,23,197,1,194,87,95,23,211,1,23,193,1,28,249,22,163,7,23,196,2, +2,28,249,22,84,23,212,2,9,249,22,70,248,22,177,13,23,197,1,9,28, +249,22,163,7,23,196,2,2,28,249,22,84,23,210,2,194,249,22,70,248,22, +177,13,23,197,1,194,87,94,23,193,1,28,249,22,163,7,23,196,2,2,28, +249,22,84,23,208,2,9,249,22,70,248,22,177,13,23,197,1,9,28,249,22, +163,7,23,196,2,2,28,249,22,84,23,206,2,194,249,22,70,248,22,177,13, +23,197,1,194,87,94,23,193,1,28,249,22,163,7,23,196,2,2,28,249,22, +84,23,204,2,9,249,22,70,248,22,177,13,23,197,1,9,28,249,22,163,7, +23,196,2,2,28,249,22,84,23,202,2,194,249,22,70,248,22,177,13,23,197, 1,194,87,94,23,193,1,28,249,22,163,7,23,196,2,2,28,249,22,84,23, -208,2,9,249,22,70,248,22,175,13,23,197,1,9,28,249,22,163,7,23,196, -2,2,28,249,22,84,23,206,2,194,249,22,70,248,22,175,13,23,197,1,194, -87,94,23,193,1,28,249,22,163,7,23,196,2,2,28,249,22,84,23,204,2, -9,249,22,70,248,22,175,13,23,197,1,9,28,249,22,163,7,23,196,2,2, -28,249,22,84,23,202,2,194,249,22,70,248,22,175,13,23,197,1,194,87,94, -23,193,1,28,249,22,163,7,23,196,2,2,28,249,22,84,23,200,2,9,249, -22,70,248,22,175,13,23,197,1,9,28,249,22,163,7,23,196,2,2,28,249, -22,84,197,194,87,94,23,196,1,249,22,70,248,22,175,13,23,197,1,194,87, -94,23,193,1,28,249,22,163,7,23,198,2,2,28,249,22,84,195,9,87,94, -23,194,1,249,22,70,248,22,175,13,23,199,1,9,87,95,28,28,248,22,157, -7,194,10,248,22,169,6,194,12,250,22,145,9,2,13,6,21,21,98,121,116, -101,32,115,116,114,105,110,103,32,111,114,32,115,116,114,105,110,103,196,28,28, -248,22,79,195,249,22,4,22,166,13,196,11,12,250,22,145,9,2,13,6,13, -13,108,105,115,116,32,111,102,32,112,97,116,104,115,197,250,2,50,197,195,28, -248,22,169,6,197,248,22,180,7,197,196,32,53,89,162,8,44,38,52,70,102, -111,117,110,100,45,101,120,101,99,222,33,56,32,54,89,162,8,44,39,57,64, -110,101,120,116,222,33,55,27,248,22,128,14,23,196,2,28,249,22,177,8,23, -195,2,23,197,1,11,28,248,22,188,13,23,194,2,27,249,22,184,13,23,197, -1,23,196,1,28,23,197,2,91,159,38,11,90,161,38,35,11,248,22,187,13, -23,197,2,87,95,23,195,1,23,194,1,27,28,23,202,2,27,248,22,128,14, -23,199,2,28,249,22,177,8,23,195,2,23,200,2,11,28,248,22,188,13,23, -194,2,250,2,53,23,205,2,23,206,2,249,22,184,13,23,200,2,23,198,1, -250,2,53,23,205,2,23,206,2,23,196,1,11,28,23,193,2,192,87,94,23, -193,1,27,28,248,22,166,13,23,196,2,27,249,22,184,13,23,198,2,23,205, -2,28,28,248,22,179,13,193,10,248,22,178,13,193,192,11,11,28,23,193,2, -192,87,94,23,193,1,28,23,203,2,11,27,248,22,128,14,23,200,2,28,249, -22,177,8,23,195,2,23,201,1,11,28,248,22,188,13,23,194,2,250,2,53, -23,206,1,23,207,1,249,22,184,13,23,201,1,23,198,1,250,2,53,205,206, -195,192,87,94,23,194,1,28,23,196,2,91,159,38,11,90,161,38,35,11,248, -22,187,13,23,197,2,87,95,23,195,1,23,194,1,27,28,23,201,2,27,248, -22,128,14,23,199,2,28,249,22,177,8,23,195,2,23,200,2,11,28,248,22, -188,13,23,194,2,250,2,53,23,204,2,23,205,2,249,22,184,13,23,200,2, -23,198,1,250,2,53,23,204,2,23,205,2,23,196,1,11,28,23,193,2,192, -87,94,23,193,1,27,28,248,22,166,13,23,196,2,27,249,22,184,13,23,198, -2,23,204,2,28,28,248,22,179,13,193,10,248,22,178,13,193,192,11,11,28, -23,193,2,192,87,94,23,193,1,28,23,202,2,11,27,248,22,128,14,23,200, -2,28,249,22,177,8,23,195,2,23,201,1,11,28,248,22,188,13,23,194,2, -250,2,53,23,205,1,23,206,1,249,22,184,13,23,201,1,23,198,1,250,2, -53,204,205,195,192,28,23,193,2,91,159,38,11,90,161,38,35,11,248,22,187, -13,23,199,2,87,95,23,195,1,23,194,1,27,28,23,198,2,251,2,54,23, -198,2,23,203,2,23,201,2,23,202,2,11,28,23,193,2,192,87,94,23,193, -1,27,28,248,22,166,13,195,27,249,22,184,13,197,200,28,28,248,22,179,13, -193,10,248,22,178,13,193,192,11,11,28,192,192,28,198,11,251,2,54,198,203, -201,202,194,32,57,89,162,8,44,39,8,31,2,18,222,33,58,28,248,22,78, -23,197,2,11,27,248,22,191,13,248,22,71,23,199,2,27,249,22,184,13,23, -196,1,23,197,2,28,248,22,178,13,23,194,2,250,2,53,198,199,195,87,94, -23,193,1,27,248,22,72,23,200,1,28,248,22,78,23,194,2,11,27,248,22, -191,13,248,22,71,23,196,2,27,249,22,184,13,23,196,1,23,200,2,28,248, -22,178,13,23,194,2,250,2,53,201,202,195,87,94,23,193,1,27,248,22,72, -23,197,1,28,248,22,78,23,194,2,11,27,248,22,191,13,248,22,71,23,196, -2,27,249,22,184,13,23,196,1,23,203,2,28,248,22,178,13,23,194,2,250, -2,53,204,205,195,87,94,23,193,1,27,248,22,72,23,197,1,28,248,22,78, -23,194,2,11,27,248,22,191,13,248,22,71,23,196,2,27,249,22,184,13,23, -196,1,23,206,2,28,248,22,178,13,23,194,2,250,2,53,23,15,23,16,195, -87,94,23,193,1,27,248,22,72,23,197,1,28,248,22,78,23,194,2,11,27, -248,22,191,13,248,22,71,23,196,2,27,249,22,184,13,23,196,1,23,209,2, -28,248,22,178,13,23,194,2,250,2,53,23,18,23,19,195,87,94,23,193,1, -27,248,22,72,23,197,1,28,248,22,78,23,194,2,11,27,248,22,191,13,248, -22,71,195,27,249,22,184,13,23,196,1,23,19,28,248,22,178,13,193,250,2, -53,23,21,23,22,195,251,2,57,23,21,23,22,23,23,248,22,72,199,87,95, -28,28,248,22,166,13,23,195,2,10,28,248,22,169,6,23,195,2,28,248,22, -188,13,23,195,2,10,248,22,189,13,23,195,2,11,12,250,22,145,9,2,14, -6,25,25,112,97,116,104,32,111,114,32,115,116,114,105,110,103,32,40,115,97, -110,115,32,110,117,108,41,23,197,2,28,28,23,195,2,28,28,248,22,166,13, -23,196,2,10,28,248,22,169,6,23,196,2,28,248,22,188,13,23,196,2,10, -248,22,189,13,23,196,2,11,248,22,188,13,23,196,2,11,10,12,250,22,145, -9,2,14,6,29,29,35,102,32,111,114,32,114,101,108,97,116,105,118,101,32, -112,97,116,104,32,111,114,32,115,116,114,105,110,103,23,198,2,28,28,248,22, -188,13,23,195,2,91,159,38,11,90,161,38,35,11,248,22,187,13,23,198,2, -249,22,175,8,194,68,114,101,108,97,116,105,118,101,11,27,248,22,186,7,6, -4,4,80,65,84,72,27,28,23,194,2,27,249,80,159,40,47,37,23,197,1, -9,28,249,22,175,8,247,22,188,7,2,20,249,22,70,248,22,175,13,5,1, -46,194,192,87,94,23,194,1,9,28,248,22,78,23,194,2,11,27,248,22,191, -13,248,22,71,23,196,2,27,249,22,184,13,23,196,1,23,200,2,28,248,22, -178,13,23,194,2,250,2,53,201,202,195,87,94,23,193,1,27,248,22,72,23, -197,1,28,248,22,78,23,194,2,11,27,248,22,191,13,248,22,71,23,196,2, -27,249,22,184,13,23,196,1,23,203,2,28,248,22,178,13,23,194,2,250,2, -53,204,205,195,87,94,23,193,1,27,248,22,72,23,197,1,28,248,22,78,23, -194,2,11,27,248,22,191,13,248,22,71,195,27,249,22,184,13,23,196,1,205, -28,248,22,178,13,193,250,2,53,23,15,23,16,195,251,2,57,23,15,23,16, -23,17,248,22,72,199,27,248,22,191,13,23,196,1,28,248,22,178,13,193,250, -2,53,198,199,195,11,250,80,159,38,48,36,196,197,11,250,80,159,38,48,36, -196,11,11,87,94,249,22,160,6,247,22,132,5,195,248,22,186,5,249,22,179, -3,35,249,22,163,3,197,198,27,28,23,197,2,87,95,23,196,1,23,195,1, -23,197,1,87,94,23,197,1,27,248,22,142,14,2,19,27,249,80,159,40,48, -36,23,196,1,11,27,27,248,22,182,3,23,200,1,28,192,192,35,27,27,248, -22,182,3,23,202,1,28,192,192,35,249,22,163,5,23,197,1,83,158,39,20, -100,95,89,162,8,44,35,47,9,224,3,2,33,62,23,195,1,23,196,1,27, -248,22,148,5,23,195,1,248,80,159,38,53,36,193,159,35,20,105,159,35,16, -1,11,16,0,83,158,41,20,103,144,67,35,37,117,116,105,108,115,29,11,11, -11,11,11,10,42,80,158,35,35,20,105,159,37,16,17,2,1,2,2,2,3, -2,4,2,5,2,6,2,7,2,8,2,9,2,10,2,11,2,12,2,13,2, -14,2,15,30,2,17,1,20,112,97,114,97,109,101,116,101,114,105,122,97,116, -105,111,110,45,107,101,121,4,30,2,17,1,23,101,120,116,101,110,100,45,112, -97,114,97,109,101,116,101,114,105,122,97,116,105,111,110,3,16,0,16,0,35, -16,0,35,16,4,2,5,2,4,2,2,2,8,39,11,11,38,35,11,11,11, -16,11,2,7,2,6,2,15,2,14,2,12,2,11,2,3,2,10,2,13,2, -9,2,1,16,11,11,11,11,11,11,11,11,11,11,11,11,16,11,2,7,2, -6,2,15,2,14,2,12,2,11,2,3,2,10,2,13,2,9,2,1,46,46, -36,11,11,11,16,0,16,0,16,0,35,35,11,11,11,11,16,0,16,0,16, -0,35,35,16,0,16,17,83,158,35,16,2,89,162,43,36,48,2,18,223,0, -33,29,80,159,35,53,36,83,158,35,16,2,89,162,8,44,36,55,2,18,223, -0,33,30,80,159,35,52,36,83,158,35,16,2,32,0,89,162,43,36,44,2, -1,222,33,31,80,159,35,35,36,83,158,35,16,2,249,22,171,6,7,92,7, -92,80,159,35,36,36,83,158,35,16,2,89,162,43,36,53,2,3,223,0,33, -32,80,159,35,37,36,83,158,35,16,2,32,0,89,162,8,44,37,49,2,4, -222,33,33,80,159,35,38,36,83,158,35,16,2,32,0,89,162,8,44,38,50, -2,5,222,33,35,80,159,35,39,36,83,158,35,16,2,32,0,89,162,8,45, -37,49,2,6,222,33,39,80,159,35,40,36,83,158,35,16,2,32,0,89,162, -43,39,51,2,7,222,33,42,80,159,35,41,36,83,158,35,16,2,32,0,89, -162,43,38,49,2,8,222,33,43,80,159,35,42,36,83,158,35,16,2,32,0, -89,162,43,37,52,2,9,222,33,44,80,159,35,43,36,83,158,35,16,2,32, -0,89,162,43,37,53,2,10,222,33,45,80,159,35,44,36,83,158,35,16,2, -32,0,89,162,43,36,43,2,11,222,33,46,80,159,35,45,36,83,158,35,16, -2,83,158,38,20,99,96,2,12,89,162,43,35,43,9,223,0,33,47,89,162, -43,36,44,9,223,0,33,48,89,162,43,37,54,9,223,0,33,49,80,159,35, -46,36,83,158,35,16,2,27,248,22,149,14,248,22,180,7,27,28,249,22,175, -8,247,22,188,7,2,20,6,1,1,59,6,1,1,58,250,22,153,7,6,14, -14,40,91,94,126,97,93,42,41,126,97,40,46,42,41,23,196,2,23,196,1, -89,162,8,44,37,47,2,13,223,0,33,52,80,159,35,47,36,83,158,35,16, -2,83,158,38,20,99,96,2,14,89,162,8,44,38,59,9,223,0,33,59,89, -162,43,37,46,9,223,0,33,60,89,162,43,36,45,9,223,0,33,61,80,159, -35,48,36,83,158,35,16,2,89,162,43,38,51,2,15,223,0,33,63,80,159, -35,49,36,94,29,94,2,16,68,35,37,107,101,114,110,101,108,11,29,94,2, -16,69,35,37,109,105,110,45,115,116,120,11,9,9,9,35,0}; - EVAL_ONE_SIZED_STR((char *)expr, 6127); +200,2,9,249,22,70,248,22,177,13,23,197,1,9,28,249,22,163,7,23,196, +2,2,28,249,22,84,197,194,87,94,23,196,1,249,22,70,248,22,177,13,23, +197,1,194,87,94,23,193,1,28,249,22,163,7,23,198,2,2,28,249,22,84, +195,9,87,94,23,194,1,249,22,70,248,22,177,13,23,199,1,9,87,95,28, +28,248,22,157,7,194,10,248,22,169,6,194,12,250,22,145,9,2,13,6,21, +21,98,121,116,101,32,115,116,114,105,110,103,32,111,114,32,115,116,114,105,110, +103,196,28,28,248,22,79,195,249,22,4,22,168,13,196,11,12,250,22,145,9, +2,13,6,13,13,108,105,115,116,32,111,102,32,112,97,116,104,115,197,250,2, +50,197,195,28,248,22,169,6,197,248,22,180,7,197,196,32,53,89,162,8,44, +38,52,70,102,111,117,110,100,45,101,120,101,99,222,33,56,32,54,89,162,8, +44,39,57,64,110,101,120,116,222,33,55,27,248,22,130,14,23,196,2,28,249, +22,177,8,23,195,2,23,197,1,11,28,248,22,190,13,23,194,2,27,249,22, +186,13,23,197,1,23,196,1,28,23,197,2,91,159,38,11,90,161,38,35,11, +248,22,189,13,23,197,2,87,95,23,195,1,23,194,1,27,28,23,202,2,27, +248,22,130,14,23,199,2,28,249,22,177,8,23,195,2,23,200,2,11,28,248, +22,190,13,23,194,2,250,2,53,23,205,2,23,206,2,249,22,186,13,23,200, +2,23,198,1,250,2,53,23,205,2,23,206,2,23,196,1,11,28,23,193,2, +192,87,94,23,193,1,27,28,248,22,168,13,23,196,2,27,249,22,186,13,23, +198,2,23,205,2,28,28,248,22,181,13,193,10,248,22,180,13,193,192,11,11, +28,23,193,2,192,87,94,23,193,1,28,23,203,2,11,27,248,22,130,14,23, +200,2,28,249,22,177,8,23,195,2,23,201,1,11,28,248,22,190,13,23,194, +2,250,2,53,23,206,1,23,207,1,249,22,186,13,23,201,1,23,198,1,250, +2,53,205,206,195,192,87,94,23,194,1,28,23,196,2,91,159,38,11,90,161, +38,35,11,248,22,189,13,23,197,2,87,95,23,195,1,23,194,1,27,28,23, +201,2,27,248,22,130,14,23,199,2,28,249,22,177,8,23,195,2,23,200,2, +11,28,248,22,190,13,23,194,2,250,2,53,23,204,2,23,205,2,249,22,186, +13,23,200,2,23,198,1,250,2,53,23,204,2,23,205,2,23,196,1,11,28, +23,193,2,192,87,94,23,193,1,27,28,248,22,168,13,23,196,2,27,249,22, +186,13,23,198,2,23,204,2,28,28,248,22,181,13,193,10,248,22,180,13,193, +192,11,11,28,23,193,2,192,87,94,23,193,1,28,23,202,2,11,27,248,22, +130,14,23,200,2,28,249,22,177,8,23,195,2,23,201,1,11,28,248,22,190, +13,23,194,2,250,2,53,23,205,1,23,206,1,249,22,186,13,23,201,1,23, +198,1,250,2,53,204,205,195,192,28,23,193,2,91,159,38,11,90,161,38,35, +11,248,22,189,13,23,199,2,87,95,23,195,1,23,194,1,27,28,23,198,2, +251,2,54,23,198,2,23,203,2,23,201,2,23,202,2,11,28,23,193,2,192, +87,94,23,193,1,27,28,248,22,168,13,195,27,249,22,186,13,197,200,28,28, +248,22,181,13,193,10,248,22,180,13,193,192,11,11,28,192,192,28,198,11,251, +2,54,198,203,201,202,194,32,57,89,162,8,44,39,8,31,2,18,222,33,58, +28,248,22,78,23,197,2,11,27,248,22,129,14,248,22,71,23,199,2,27,249, +22,186,13,23,196,1,23,197,2,28,248,22,180,13,23,194,2,250,2,53,198, +199,195,87,94,23,193,1,27,248,22,72,23,200,1,28,248,22,78,23,194,2, +11,27,248,22,129,14,248,22,71,23,196,2,27,249,22,186,13,23,196,1,23, +200,2,28,248,22,180,13,23,194,2,250,2,53,201,202,195,87,94,23,193,1, +27,248,22,72,23,197,1,28,248,22,78,23,194,2,11,27,248,22,129,14,248, +22,71,23,196,2,27,249,22,186,13,23,196,1,23,203,2,28,248,22,180,13, +23,194,2,250,2,53,204,205,195,87,94,23,193,1,27,248,22,72,23,197,1, +28,248,22,78,23,194,2,11,27,248,22,129,14,248,22,71,23,196,2,27,249, +22,186,13,23,196,1,23,206,2,28,248,22,180,13,23,194,2,250,2,53,23, +15,23,16,195,87,94,23,193,1,27,248,22,72,23,197,1,28,248,22,78,23, +194,2,11,27,248,22,129,14,248,22,71,23,196,2,27,249,22,186,13,23,196, +1,23,209,2,28,248,22,180,13,23,194,2,250,2,53,23,18,23,19,195,87, +94,23,193,1,27,248,22,72,23,197,1,28,248,22,78,23,194,2,11,27,248, +22,129,14,248,22,71,195,27,249,22,186,13,23,196,1,23,19,28,248,22,180, +13,193,250,2,53,23,21,23,22,195,251,2,57,23,21,23,22,23,23,248,22, +72,199,87,95,28,28,248,22,168,13,23,195,2,10,28,248,22,169,6,23,195, +2,28,248,22,190,13,23,195,2,10,248,22,191,13,23,195,2,11,12,250,22, +145,9,2,14,6,25,25,112,97,116,104,32,111,114,32,115,116,114,105,110,103, +32,40,115,97,110,115,32,110,117,108,41,23,197,2,28,28,23,195,2,28,28, +248,22,168,13,23,196,2,10,28,248,22,169,6,23,196,2,28,248,22,190,13, +23,196,2,10,248,22,191,13,23,196,2,11,248,22,190,13,23,196,2,11,10, +12,250,22,145,9,2,14,6,29,29,35,102,32,111,114,32,114,101,108,97,116, +105,118,101,32,112,97,116,104,32,111,114,32,115,116,114,105,110,103,23,198,2, +28,28,248,22,190,13,23,195,2,91,159,38,11,90,161,38,35,11,248,22,189, +13,23,198,2,249,22,175,8,194,68,114,101,108,97,116,105,118,101,11,27,248, +22,186,7,6,4,4,80,65,84,72,27,28,23,194,2,27,249,80,159,40,47, +37,23,197,1,9,28,249,22,175,8,247,22,188,7,2,20,249,22,70,248,22, +177,13,5,1,46,194,192,87,94,23,194,1,9,28,248,22,78,23,194,2,11, +27,248,22,129,14,248,22,71,23,196,2,27,249,22,186,13,23,196,1,23,200, +2,28,248,22,180,13,23,194,2,250,2,53,201,202,195,87,94,23,193,1,27, +248,22,72,23,197,1,28,248,22,78,23,194,2,11,27,248,22,129,14,248,22, +71,23,196,2,27,249,22,186,13,23,196,1,23,203,2,28,248,22,180,13,23, +194,2,250,2,53,204,205,195,87,94,23,193,1,27,248,22,72,23,197,1,28, +248,22,78,23,194,2,11,27,248,22,129,14,248,22,71,195,27,249,22,186,13, +23,196,1,205,28,248,22,180,13,193,250,2,53,23,15,23,16,195,251,2,57, +23,15,23,16,23,17,248,22,72,199,27,248,22,129,14,23,196,1,28,248,22, +180,13,193,250,2,53,198,199,195,11,250,80,159,38,48,36,196,197,11,250,80, +159,38,48,36,196,11,11,87,94,249,22,160,6,247,22,132,5,195,248,22,186, +5,249,22,179,3,35,249,22,163,3,197,198,27,28,23,197,2,87,95,23,196, +1,23,195,1,23,197,1,87,94,23,197,1,27,248,22,144,14,2,19,27,249, +80,159,40,48,36,23,196,1,11,27,27,248,22,182,3,23,200,1,28,192,192, +35,27,27,248,22,182,3,23,202,1,28,192,192,35,249,22,163,5,23,197,1, +83,158,39,20,100,95,89,162,8,44,35,47,9,224,3,2,33,62,23,195,1, +23,196,1,27,248,22,148,5,23,195,1,248,80,159,38,53,36,193,159,35,20, +105,159,35,16,1,11,16,0,83,158,41,20,103,144,67,35,37,117,116,105,108, +115,29,11,11,11,11,11,10,42,80,158,35,35,20,105,159,37,16,17,2,1, +2,2,2,3,2,4,2,5,2,6,2,7,2,8,2,9,2,10,2,11,2, +12,2,13,2,14,2,15,30,2,17,1,20,112,97,114,97,109,101,116,101,114, +105,122,97,116,105,111,110,45,107,101,121,4,30,2,17,1,23,101,120,116,101, +110,100,45,112,97,114,97,109,101,116,101,114,105,122,97,116,105,111,110,3,16, +0,16,0,35,16,0,35,16,4,2,5,2,4,2,2,2,8,39,11,11,38, +35,11,11,11,16,11,2,7,2,6,2,15,2,14,2,12,2,11,2,3,2, +10,2,13,2,9,2,1,16,11,11,11,11,11,11,11,11,11,11,11,11,16, +11,2,7,2,6,2,15,2,14,2,12,2,11,2,3,2,10,2,13,2,9, +2,1,46,46,36,11,11,11,16,0,16,0,16,0,35,35,11,11,11,11,16, +0,16,0,16,0,35,35,16,0,16,17,83,158,35,16,2,89,162,8,44,36, +50,2,18,223,0,33,29,80,159,35,53,36,83,158,35,16,2,89,162,8,44, +36,55,2,18,223,0,33,30,80,159,35,52,36,83,158,35,16,2,32,0,89, +162,43,36,44,2,1,222,33,31,80,159,35,35,36,83,158,35,16,2,249,22, +171,6,7,92,7,92,80,159,35,36,36,83,158,35,16,2,89,162,43,36,53, +2,3,223,0,33,32,80,159,35,37,36,83,158,35,16,2,32,0,89,162,8, +44,37,49,2,4,222,33,33,80,159,35,38,36,83,158,35,16,2,32,0,89, +162,8,44,38,50,2,5,222,33,35,80,159,35,39,36,83,158,35,16,2,32, +0,89,162,8,45,37,49,2,6,222,33,39,80,159,35,40,36,83,158,35,16, +2,32,0,89,162,43,39,51,2,7,222,33,42,80,159,35,41,36,83,158,35, +16,2,32,0,89,162,43,38,49,2,8,222,33,43,80,159,35,42,36,83,158, +35,16,2,32,0,89,162,43,37,52,2,9,222,33,44,80,159,35,43,36,83, +158,35,16,2,32,0,89,162,43,37,53,2,10,222,33,45,80,159,35,44,36, +83,158,35,16,2,32,0,89,162,43,36,43,2,11,222,33,46,80,159,35,45, +36,83,158,35,16,2,83,158,38,20,99,96,2,12,89,162,43,35,43,9,223, +0,33,47,89,162,43,36,44,9,223,0,33,48,89,162,43,37,54,9,223,0, +33,49,80,159,35,46,36,83,158,35,16,2,27,248,22,151,14,248,22,180,7, +27,28,249,22,175,8,247,22,188,7,2,20,6,1,1,59,6,1,1,58,250, +22,153,7,6,14,14,40,91,94,126,97,93,42,41,126,97,40,46,42,41,23, +196,2,23,196,1,89,162,8,44,37,47,2,13,223,0,33,52,80,159,35,47, +36,83,158,35,16,2,83,158,38,20,99,96,2,14,89,162,8,44,38,59,9, +223,0,33,59,89,162,43,37,46,9,223,0,33,60,89,162,43,36,45,9,223, +0,33,61,80,159,35,48,36,83,158,35,16,2,89,162,8,44,38,51,2,15, +223,0,33,63,80,159,35,49,36,94,29,94,2,16,68,35,37,107,101,114,110, +101,108,11,29,94,2,16,69,35,37,109,105,110,45,115,116,120,11,9,9,9, +35,0}; + EVAL_ONE_SIZED_STR((char *)expr, 6238); } { - SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,52,46,50,46,53,46,51,8,0,0,0,1,0,0,6,0,19,0, + SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,52,46,50,46,53,46,53,8,0,0,0,1,0,0,6,0,19,0, 34,0,48,0,62,0,76,0,118,0,0,0,53,1,0,0,65,113,117,111,116, 101,29,94,2,1,67,35,37,117,116,105,108,115,11,29,94,2,1,69,35,37, 110,101,116,119,111,114,107,11,29,94,2,1,68,35,37,112,97,114,97,109,122, 11,29,94,2,1,68,35,37,101,120,112,111,98,115,11,29,94,2,1,68,35, -37,107,101,114,110,101,108,11,97,35,11,8,240,42,76,0,0,98,159,2,2, +37,107,101,114,110,101,108,11,97,35,11,8,240,169,76,0,0,98,159,2,2, 35,35,159,2,3,35,35,159,2,4,35,35,159,2,5,35,35,159,2,6,35, 35,159,2,6,35,35,16,0,159,35,20,105,159,35,16,1,11,16,0,83,158, 41,20,103,144,69,35,37,98,117,105,108,116,105,110,29,11,11,11,11,11,18, @@ -414,268 +420,271 @@ EVAL_ONE_SIZED_STR((char *)expr, 346); } { - SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,52,46,50,46,53,46,51,69,0,0,0,1,0,0,11,0,38,0, + SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,52,46,50,46,53,46,53,65,0,0,0,1,0,0,11,0,38,0, 44,0,57,0,66,0,73,0,95,0,117,0,143,0,155,0,173,0,193,0,205, 0,221,0,244,0,0,1,31,1,38,1,43,1,48,1,53,1,58,1,67,1, -72,1,76,1,84,1,93,1,138,1,158,1,187,1,218,1,18,2,28,2,75, -2,85,2,92,2,235,3,254,3,11,4,169,4,181,4,59,5,101,6,224,6, -230,6,244,6,0,7,90,7,103,7,222,7,234,7,68,8,81,8,200,8,227, -8,239,8,73,9,86,9,205,9,218,9,81,10,89,10,174,10,176,10,242,10, -232,17,26,18,47,18,0,0,235,20,0,0,70,100,108,108,45,115,117,102,102, -105,120,1,25,100,101,102,97,117,108,116,45,108,111,97,100,47,117,115,101,45, -99,111,109,112,105,108,101,100,65,113,117,111,116,101,29,94,2,3,67,35,37, -117,116,105,108,115,11,68,35,37,112,97,114,97,109,122,29,94,2,3,2,5, -11,1,20,112,97,114,97,109,101,116,101,114,105,122,97,116,105,111,110,45,107, -101,121,1,20,100,101,102,97,117,108,116,45,114,101,97,100,101,114,45,103,117, -97,114,100,1,24,45,109,111,100,117,108,101,45,104,97,115,104,45,116,97,98, -108,101,45,116,97,98,108,101,71,45,112,97,116,104,45,99,97,99,104,101,77, -45,108,111,97,100,105,110,103,45,102,105,108,101,110,97,109,101,79,45,108,111, -97,100,105,110,103,45,112,114,111,109,112,116,45,116,97,103,71,45,112,114,101, -118,45,114,101,108,116,111,75,45,112,114,101,118,45,114,101,108,116,111,45,100, -105,114,1,21,115,112,108,105,116,45,114,101,108,97,116,105,118,101,45,115,116, -114,105,110,103,71,111,114,105,103,45,112,97,114,97,109,122,1,29,115,116,97, -110,100,97,114,100,45,109,111,100,117,108,101,45,110,97,109,101,45,114,101,115, -111,108,118,101,114,29,94,2,3,2,5,11,64,98,111,111,116,64,115,101,97, -108,64,115,97,109,101,5,3,46,122,111,6,6,6,110,97,116,105,118,101,64, -108,111,111,112,63,108,105,98,67,105,103,110,111,114,101,100,249,22,14,195,80, -159,37,45,37,20,14,159,80,158,35,39,250,80,158,38,40,249,22,27,11,80, -158,40,39,22,137,5,28,248,22,166,13,23,198,2,23,197,1,87,94,23,197, -1,247,22,143,14,247,194,250,22,184,13,23,197,1,23,199,1,249,80,158,42, -38,23,198,1,2,22,252,22,184,13,23,199,1,23,201,1,2,23,247,22,189, -7,249,80,158,44,38,23,200,1,80,159,44,35,37,87,94,23,194,1,27,250, -22,137,14,196,11,32,0,89,162,8,44,35,40,9,222,11,28,192,249,22,70, -195,194,11,27,252,22,184,13,23,200,1,23,202,1,2,23,247,22,189,7,249, -80,158,45,38,23,201,1,80,159,45,35,37,27,250,22,137,14,196,11,32,0, -89,162,8,44,35,40,9,222,11,28,192,249,22,70,195,194,11,249,247,22,148, -14,248,22,71,195,195,27,250,22,184,13,23,198,1,23,200,1,249,80,158,43, -38,23,199,1,2,22,27,250,22,137,14,196,11,32,0,89,162,8,44,35,40, -9,222,11,28,192,249,22,70,195,194,11,249,247,22,135,5,248,22,71,195,195, -249,247,22,135,5,194,195,87,94,28,248,80,158,36,37,23,195,2,12,250,22, -145,9,77,108,111,97,100,47,117,115,101,45,99,111,109,112,105,108,101,100,6, -25,25,112,97,116,104,32,111,114,32,118,97,108,105,100,45,112,97,116,104,32, -115,116,114,105,110,103,23,197,2,91,159,41,11,90,161,36,35,11,28,248,22, -190,13,23,201,2,23,200,1,27,247,22,137,5,28,23,193,2,249,22,191,13, -23,203,1,23,195,1,200,90,161,38,36,11,248,22,187,13,23,194,2,87,94, -23,196,1,90,161,36,39,11,28,249,22,175,8,23,196,2,68,114,101,108,97, -116,105,118,101,87,94,23,194,1,2,21,23,194,1,90,161,36,40,11,247,22, -145,14,27,89,162,43,36,49,62,122,111,225,7,5,3,33,29,27,89,162,43, -36,51,9,225,8,6,4,33,30,27,249,22,5,89,162,8,44,36,46,9,223, -5,33,31,23,203,2,27,28,23,195,1,27,249,22,5,89,162,8,44,36,52, -9,225,13,11,9,33,32,23,205,2,27,28,23,196,2,11,193,28,192,192,28, -193,28,23,196,2,28,249,22,175,3,248,22,72,196,248,22,72,23,199,2,193, -11,11,11,11,28,23,193,2,249,80,159,47,58,36,202,89,162,43,35,45,9, -224,14,2,33,33,87,94,23,193,1,27,28,23,197,1,27,249,22,5,83,158, -39,20,100,94,89,162,8,44,36,50,9,225,14,12,10,33,34,23,203,1,23, -206,1,27,28,196,11,193,28,192,192,28,193,28,196,28,249,22,175,3,248,22, -72,196,248,22,72,199,193,11,11,11,11,28,192,249,80,159,48,58,36,203,89, -162,43,35,45,9,224,15,2,33,35,249,80,159,48,58,36,203,89,162,43,35, -44,9,224,15,7,33,36,0,17,35,114,120,34,94,40,46,42,63,41,47,40, -46,42,41,36,34,32,39,89,162,8,44,36,58,2,24,222,33,40,27,249,22, -153,14,2,38,23,196,2,28,23,193,2,87,94,23,194,1,249,22,70,248,22, -95,23,196,2,27,248,22,104,23,197,1,27,249,22,153,14,2,38,23,196,2, +72,1,76,1,84,1,93,1,114,1,144,1,175,1,232,1,24,2,64,4,83, +4,96,4,254,4,10,5,144,5,186,6,53,7,59,7,73,7,85,7,175,7, +188,7,51,8,63,8,153,8,166,8,29,9,56,9,68,9,158,9,171,9,34, +10,47,10,166,10,174,10,3,11,5,11,74,11,69,18,121,18,144,18,0,0, +48,21,0,0,70,100,108,108,45,115,117,102,102,105,120,1,25,100,101,102,97, +117,108,116,45,108,111,97,100,47,117,115,101,45,99,111,109,112,105,108,101,100, +65,113,117,111,116,101,29,94,2,3,67,35,37,117,116,105,108,115,11,68,35, +37,112,97,114,97,109,122,29,94,2,3,2,5,11,1,20,112,97,114,97,109, +101,116,101,114,105,122,97,116,105,111,110,45,107,101,121,1,20,100,101,102,97, +117,108,116,45,114,101,97,100,101,114,45,103,117,97,114,100,1,24,45,109,111, +100,117,108,101,45,104,97,115,104,45,116,97,98,108,101,45,116,97,98,108,101, +71,45,112,97,116,104,45,99,97,99,104,101,77,45,108,111,97,100,105,110,103, +45,102,105,108,101,110,97,109,101,79,45,108,111,97,100,105,110,103,45,112,114, +111,109,112,116,45,116,97,103,71,45,112,114,101,118,45,114,101,108,116,111,75, +45,112,114,101,118,45,114,101,108,116,111,45,100,105,114,1,21,115,112,108,105, +116,45,114,101,108,97,116,105,118,101,45,115,116,114,105,110,103,71,111,114,105, +103,45,112,97,114,97,109,122,1,29,115,116,97,110,100,97,114,100,45,109,111, +100,117,108,101,45,110,97,109,101,45,114,101,115,111,108,118,101,114,29,94,2, +3,2,5,11,64,98,111,111,116,64,115,101,97,108,64,115,97,109,101,5,3, +46,122,111,6,6,6,110,97,116,105,118,101,64,108,111,111,112,63,108,105,98, +67,105,103,110,111,114,101,100,249,22,14,195,80,159,37,45,37,250,22,186,13, +23,197,1,23,199,1,249,80,159,42,38,37,23,198,1,2,22,252,22,186,13, +23,199,1,23,201,1,2,23,247,22,189,7,249,80,159,44,38,37,23,200,1, +80,159,44,35,37,87,94,23,194,1,27,250,22,139,14,196,11,32,0,89,162, +8,44,35,40,9,222,11,28,192,249,22,70,195,194,11,27,252,22,186,13,23, +200,1,23,202,1,2,23,247,22,189,7,249,80,159,45,38,37,23,201,1,80, +159,45,35,37,27,250,22,139,14,196,11,32,0,89,162,8,44,35,40,9,222, +11,28,192,249,22,70,195,194,11,27,250,22,186,13,23,198,1,23,200,1,249, +80,159,43,38,37,23,199,1,2,22,27,250,22,139,14,196,11,32,0,89,162, +8,44,35,40,9,222,11,28,192,249,22,70,195,194,11,87,94,28,248,80,159, +36,37,37,23,195,2,12,250,22,145,9,77,108,111,97,100,47,117,115,101,45, +99,111,109,112,105,108,101,100,6,25,25,112,97,116,104,32,111,114,32,118,97, +108,105,100,45,112,97,116,104,32,115,116,114,105,110,103,23,197,2,91,159,41, +11,90,161,36,35,11,28,248,22,128,14,23,201,2,23,200,1,27,247,22,137, +5,28,23,193,2,249,22,129,14,23,203,1,23,195,1,200,90,161,38,36,11, +248,22,189,13,23,194,2,87,94,23,196,1,90,161,36,39,11,28,249,22,175, +8,23,196,2,68,114,101,108,97,116,105,118,101,87,94,23,194,1,2,21,23, +194,1,90,161,36,40,11,247,22,147,14,27,89,162,43,36,49,62,122,111,225, +7,5,3,33,28,27,89,162,43,36,51,9,225,8,6,4,33,29,27,249,22, +5,89,162,8,44,36,46,9,223,5,33,30,23,203,2,27,28,23,195,1,27, +249,22,5,89,162,8,44,36,52,9,225,13,11,9,33,31,23,205,2,27,28, +23,196,2,11,193,28,192,192,28,193,28,23,196,2,28,249,22,175,3,248,22, +72,196,248,22,72,23,199,2,193,11,11,11,11,28,23,193,2,87,98,23,202, +1,23,199,1,23,197,1,23,196,1,23,194,1,20,14,159,80,159,45,39,37, +250,80,159,48,40,37,249,22,27,11,80,159,50,39,37,22,137,5,28,248,22, +168,13,23,205,2,23,204,1,87,94,23,204,1,247,22,145,14,249,247,22,150, +14,248,22,71,195,206,87,94,23,193,1,27,28,23,197,1,27,249,22,5,83, +158,39,20,100,94,89,162,8,44,36,50,9,225,14,12,10,33,32,23,203,1, +23,206,1,27,28,23,197,2,11,193,28,192,192,28,193,28,196,28,249,22,175, +3,248,22,72,196,248,22,72,199,193,11,11,11,87,95,23,203,1,23,200,1, +11,28,23,193,2,87,94,23,198,1,20,14,159,80,159,46,39,37,250,80,159, +49,40,37,249,22,27,11,80,159,51,39,37,22,137,5,28,248,22,168,13,23, +206,2,23,205,1,87,94,23,205,1,247,22,145,14,249,247,22,135,5,248,22, +71,195,23,15,87,94,23,193,1,20,14,159,80,159,46,39,37,250,80,159,49, +40,37,249,22,27,11,80,159,51,39,37,22,137,5,28,248,22,168,13,23,206, +2,23,205,1,87,94,23,205,1,247,22,145,14,249,247,22,135,5,199,23,15, +0,17,35,114,120,34,94,40,46,42,63,41,47,40,46,42,41,36,34,32,35, +89,162,8,44,36,58,2,24,222,33,36,27,249,22,155,14,2,34,23,196,2, 28,23,193,2,87,94,23,194,1,249,22,70,248,22,95,23,196,2,27,248,22, -104,23,197,1,27,249,22,153,14,2,38,23,196,2,28,23,193,2,87,94,23, +104,23,197,1,27,249,22,155,14,2,34,23,196,2,28,23,193,2,87,94,23, 194,1,249,22,70,248,22,95,23,196,2,27,248,22,104,23,197,1,27,249,22, -153,14,2,38,23,196,2,28,23,193,2,87,94,23,194,1,249,22,70,248,22, -95,23,196,2,248,2,39,248,22,104,23,197,1,248,22,80,194,248,22,80,194, -248,22,80,194,248,22,80,194,32,41,89,162,43,36,54,2,24,222,33,42,28, -248,22,78,248,22,72,23,195,2,249,22,7,9,248,22,71,195,91,159,37,11, -90,161,37,35,11,27,248,22,72,196,28,248,22,78,248,22,72,23,195,2,249, -22,7,9,248,22,71,195,91,159,37,11,90,161,37,35,11,27,248,22,72,196, -28,248,22,78,248,22,72,23,195,2,249,22,7,9,248,22,71,195,91,159,37, -11,90,161,37,35,11,248,2,41,248,22,72,196,249,22,7,249,22,70,248,22, -71,199,196,195,249,22,7,249,22,70,248,22,71,199,196,195,249,22,7,249,22, -70,248,22,71,199,196,195,27,27,249,22,153,14,2,38,23,197,2,28,23,193, -2,87,94,23,195,1,249,22,70,248,22,95,23,196,2,27,248,22,104,23,197, -1,27,249,22,153,14,2,38,23,196,2,28,23,193,2,87,94,23,194,1,249, -22,70,248,22,95,23,196,2,27,248,22,104,23,197,1,27,249,22,153,14,2, -38,23,196,2,28,23,193,2,87,94,23,194,1,249,22,70,248,22,95,23,196, -2,27,248,22,104,23,197,1,27,249,22,153,14,2,38,23,196,2,28,23,193, -2,87,94,23,194,1,249,22,70,248,22,95,23,196,2,248,2,39,248,22,104, -23,197,1,248,22,80,194,248,22,80,194,248,22,80,194,248,22,80,195,28,23, -195,1,192,28,248,22,78,248,22,72,23,195,2,249,22,7,9,248,22,71,195, +155,14,2,34,23,196,2,28,23,193,2,87,94,23,194,1,249,22,70,248,22, +95,23,196,2,27,248,22,104,23,197,1,27,249,22,155,14,2,34,23,196,2, +28,23,193,2,87,94,23,194,1,249,22,70,248,22,95,23,196,2,248,2,35, +248,22,104,23,197,1,248,22,80,194,248,22,80,194,248,22,80,194,248,22,80, +194,32,37,89,162,43,36,54,2,24,222,33,38,28,248,22,78,248,22,72,23, +195,2,249,22,7,9,248,22,71,195,91,159,37,11,90,161,37,35,11,27,248, +22,72,196,28,248,22,78,248,22,72,23,195,2,249,22,7,9,248,22,71,195, 91,159,37,11,90,161,37,35,11,27,248,22,72,196,28,248,22,78,248,22,72, -23,195,2,249,22,7,9,248,22,71,195,91,159,37,11,90,161,37,35,11,27, -248,22,72,196,28,248,22,78,248,22,72,23,195,2,249,22,7,9,248,22,71, -195,91,159,37,11,90,161,37,35,11,248,2,41,248,22,72,196,249,22,7,249, -22,70,248,22,71,199,196,195,249,22,7,249,22,70,248,22,71,199,196,195,249, -22,7,249,22,70,248,22,71,199,196,195,87,95,28,248,22,179,4,195,12,250, -22,145,9,2,17,6,20,20,114,101,115,111,108,118,101,100,45,109,111,100,117, -108,101,45,112,97,116,104,197,28,24,193,2,248,24,194,1,195,87,94,23,193, -1,12,27,27,250,22,145,2,80,159,41,42,37,248,22,173,14,247,22,148,12, -11,28,23,193,2,192,87,94,23,193,1,27,247,22,129,2,87,94,250,22,143, -2,80,159,42,42,37,248,22,173,14,247,22,148,12,195,192,250,22,143,2,195, -198,66,97,116,116,97,99,104,251,211,197,198,199,10,28,192,250,22,144,9,11, -196,195,248,22,142,9,194,32,47,89,162,43,36,51,2,24,222,33,48,28,248, -22,78,248,22,72,23,195,2,249,22,7,9,248,22,71,195,91,159,37,11,90, -161,37,35,11,27,248,22,72,196,28,248,22,78,248,22,72,23,195,2,249,22, -7,9,248,22,71,195,91,159,37,11,90,161,37,35,11,248,2,47,248,22,72, -196,249,22,7,249,22,70,248,22,71,199,196,195,249,22,7,249,22,70,248,22, -71,199,196,195,32,49,89,162,8,44,36,54,2,24,222,33,50,27,249,22,153, -14,2,38,23,196,2,28,23,193,2,87,94,23,194,1,249,22,70,248,22,95, -23,196,2,27,248,22,104,23,197,1,27,249,22,153,14,2,38,23,196,2,28, -23,193,2,87,94,23,194,1,249,22,70,248,22,95,23,196,2,27,248,22,104, -23,197,1,27,249,22,153,14,2,38,23,196,2,28,23,193,2,87,94,23,194, -1,249,22,70,248,22,95,23,196,2,248,2,49,248,22,104,23,197,1,248,22, -80,194,248,22,80,194,248,22,80,194,32,51,89,162,43,36,51,2,24,222,33, -52,28,248,22,78,248,22,72,23,195,2,249,22,7,9,248,22,71,195,91,159, -37,11,90,161,37,35,11,27,248,22,72,196,28,248,22,78,248,22,72,23,195, -2,249,22,7,9,248,22,71,195,91,159,37,11,90,161,37,35,11,248,2,51, -248,22,72,196,249,22,7,249,22,70,248,22,71,199,196,195,249,22,7,249,22, -70,248,22,71,199,196,195,32,53,89,162,8,44,36,54,2,24,222,33,54,27, -249,22,153,14,2,38,23,196,2,28,23,193,2,87,94,23,194,1,249,22,70, -248,22,95,23,196,2,27,248,22,104,23,197,1,27,249,22,153,14,2,38,23, -196,2,28,23,193,2,87,94,23,194,1,249,22,70,248,22,95,23,196,2,27, -248,22,104,23,197,1,27,249,22,153,14,2,38,23,196,2,28,23,193,2,87, -94,23,194,1,249,22,70,248,22,95,23,196,2,248,2,53,248,22,104,23,197, -1,248,22,80,194,248,22,80,194,248,22,80,194,28,249,22,175,6,194,6,1, -1,46,2,21,28,249,22,175,6,194,6,2,2,46,46,62,117,112,192,32,56, -89,162,43,36,51,2,24,222,33,57,28,248,22,78,248,22,72,23,195,2,249, -22,7,9,248,22,71,195,91,159,37,11,90,161,37,35,11,27,248,22,72,196, -28,248,22,78,248,22,72,23,195,2,249,22,7,9,248,22,71,195,91,159,37, -11,90,161,37,35,11,248,2,56,248,22,72,196,249,22,7,249,22,70,248,22, -71,199,196,195,249,22,7,249,22,70,248,22,71,199,196,195,32,58,89,162,8, -44,36,54,2,24,222,33,59,27,249,22,153,14,2,38,23,196,2,28,23,193, +23,195,2,249,22,7,9,248,22,71,195,91,159,37,11,90,161,37,35,11,248, +2,37,248,22,72,196,249,22,7,249,22,70,248,22,71,199,196,195,249,22,7, +249,22,70,248,22,71,199,196,195,249,22,7,249,22,70,248,22,71,199,196,195, +27,27,249,22,155,14,2,34,23,197,2,28,23,193,2,87,94,23,195,1,249, +22,70,248,22,95,23,196,2,27,248,22,104,23,197,1,27,249,22,155,14,2, +34,23,196,2,28,23,193,2,87,94,23,194,1,249,22,70,248,22,95,23,196, +2,27,248,22,104,23,197,1,27,249,22,155,14,2,34,23,196,2,28,23,193, 2,87,94,23,194,1,249,22,70,248,22,95,23,196,2,27,248,22,104,23,197, -1,27,249,22,153,14,2,38,23,196,2,28,23,193,2,87,94,23,194,1,249, -22,70,248,22,95,23,196,2,27,248,22,104,23,197,1,27,249,22,153,14,2, -38,23,196,2,28,23,193,2,87,94,23,194,1,249,22,70,248,22,95,23,196, -2,248,2,58,248,22,104,23,197,1,248,22,80,194,248,22,80,194,248,22,80, -194,32,60,89,162,8,44,36,54,2,24,222,33,61,27,249,22,153,14,2,38, -23,196,2,28,23,193,2,87,94,23,194,1,249,22,70,248,22,95,23,196,2, -27,248,22,104,23,197,1,27,249,22,153,14,2,38,23,196,2,28,23,193,2, +1,27,249,22,155,14,2,34,23,196,2,28,23,193,2,87,94,23,194,1,249, +22,70,248,22,95,23,196,2,248,2,35,248,22,104,23,197,1,248,22,80,194, +248,22,80,194,248,22,80,194,248,22,80,195,28,23,195,1,192,28,248,22,78, +248,22,72,23,195,2,249,22,7,9,248,22,71,195,91,159,37,11,90,161,37, +35,11,27,248,22,72,196,28,248,22,78,248,22,72,23,195,2,249,22,7,9, +248,22,71,195,91,159,37,11,90,161,37,35,11,27,248,22,72,196,28,248,22, +78,248,22,72,23,195,2,249,22,7,9,248,22,71,195,91,159,37,11,90,161, +37,35,11,248,2,37,248,22,72,196,249,22,7,249,22,70,248,22,71,199,196, +195,249,22,7,249,22,70,248,22,71,199,196,195,249,22,7,249,22,70,248,22, +71,199,196,195,87,95,28,248,22,179,4,195,12,250,22,145,9,2,17,6,20, +20,114,101,115,111,108,118,101,100,45,109,111,100,117,108,101,45,112,97,116,104, +197,28,24,193,2,248,24,194,1,195,87,94,23,193,1,12,27,27,250,22,145, +2,80,159,41,42,37,248,22,175,14,247,22,148,12,11,28,23,193,2,192,87, +94,23,193,1,27,247,22,129,2,87,94,250,22,143,2,80,159,42,42,37,248, +22,175,14,247,22,148,12,195,192,250,22,143,2,195,198,66,97,116,116,97,99, +104,251,211,197,198,199,10,28,192,250,22,144,9,11,196,195,248,22,142,9,194, +32,43,89,162,43,36,51,2,24,222,33,44,28,248,22,78,248,22,72,23,195, +2,249,22,7,9,248,22,71,195,91,159,37,11,90,161,37,35,11,27,248,22, +72,196,28,248,22,78,248,22,72,23,195,2,249,22,7,9,248,22,71,195,91, +159,37,11,90,161,37,35,11,248,2,43,248,22,72,196,249,22,7,249,22,70, +248,22,71,199,196,195,249,22,7,249,22,70,248,22,71,199,196,195,32,45,89, +162,8,44,36,54,2,24,222,33,46,27,249,22,155,14,2,34,23,196,2,28, +23,193,2,87,94,23,194,1,249,22,70,248,22,95,23,196,2,27,248,22,104, +23,197,1,27,249,22,155,14,2,34,23,196,2,28,23,193,2,87,94,23,194, +1,249,22,70,248,22,95,23,196,2,27,248,22,104,23,197,1,27,249,22,155, +14,2,34,23,196,2,28,23,193,2,87,94,23,194,1,249,22,70,248,22,95, +23,196,2,248,2,45,248,22,104,23,197,1,248,22,80,194,248,22,80,194,248, +22,80,194,32,47,89,162,43,36,51,2,24,222,33,48,28,248,22,78,248,22, +72,23,195,2,249,22,7,9,248,22,71,195,91,159,37,11,90,161,37,35,11, +27,248,22,72,196,28,248,22,78,248,22,72,23,195,2,249,22,7,9,248,22, +71,195,91,159,37,11,90,161,37,35,11,248,2,47,248,22,72,196,249,22,7, +249,22,70,248,22,71,199,196,195,249,22,7,249,22,70,248,22,71,199,196,195, +32,49,89,162,8,44,36,54,2,24,222,33,50,27,249,22,155,14,2,34,23, +196,2,28,23,193,2,87,94,23,194,1,249,22,70,248,22,95,23,196,2,27, +248,22,104,23,197,1,27,249,22,155,14,2,34,23,196,2,28,23,193,2,87, +94,23,194,1,249,22,70,248,22,95,23,196,2,27,248,22,104,23,197,1,27, +249,22,155,14,2,34,23,196,2,28,23,193,2,87,94,23,194,1,249,22,70, +248,22,95,23,196,2,248,2,49,248,22,104,23,197,1,248,22,80,194,248,22, +80,194,248,22,80,194,28,249,22,175,6,194,6,1,1,46,2,21,28,249,22, +175,6,194,6,2,2,46,46,62,117,112,192,32,52,89,162,43,36,51,2,24, +222,33,53,28,248,22,78,248,22,72,23,195,2,249,22,7,9,248,22,71,195, +91,159,37,11,90,161,37,35,11,27,248,22,72,196,28,248,22,78,248,22,72, +23,195,2,249,22,7,9,248,22,71,195,91,159,37,11,90,161,37,35,11,248, +2,52,248,22,72,196,249,22,7,249,22,70,248,22,71,199,196,195,249,22,7, +249,22,70,248,22,71,199,196,195,32,54,89,162,8,44,36,54,2,24,222,33, +55,27,249,22,155,14,2,34,23,196,2,28,23,193,2,87,94,23,194,1,249, +22,70,248,22,95,23,196,2,27,248,22,104,23,197,1,27,249,22,155,14,2, +34,23,196,2,28,23,193,2,87,94,23,194,1,249,22,70,248,22,95,23,196, +2,27,248,22,104,23,197,1,27,249,22,155,14,2,34,23,196,2,28,23,193, +2,87,94,23,194,1,249,22,70,248,22,95,23,196,2,248,2,54,248,22,104, +23,197,1,248,22,80,194,248,22,80,194,248,22,80,194,32,56,89,162,8,44, +36,54,2,24,222,33,57,27,249,22,155,14,2,34,23,196,2,28,23,193,2, 87,94,23,194,1,249,22,70,248,22,95,23,196,2,27,248,22,104,23,197,1, -27,249,22,153,14,2,38,23,196,2,28,23,193,2,87,94,23,194,1,249,22, -70,248,22,95,23,196,2,248,2,60,248,22,104,23,197,1,248,22,80,194,248, -22,80,194,248,22,80,194,27,248,2,60,23,195,1,192,28,249,22,177,8,248, -22,72,23,200,2,23,197,1,28,249,22,175,8,248,22,71,23,200,2,23,196, -1,251,22,142,9,2,17,6,26,26,99,121,99,108,101,32,105,110,32,108,111, -97,100,105,110,103,32,97,116,32,126,101,58,32,126,101,23,200,1,249,22,2, -22,72,248,22,85,249,22,70,23,206,1,23,202,1,12,12,247,192,20,14,159, -80,159,39,44,37,249,22,70,248,22,173,14,247,22,148,12,23,197,1,20,14, -159,80,158,39,39,250,80,158,42,40,249,22,27,11,80,158,44,39,22,161,4, -23,196,1,249,247,22,136,5,23,198,1,248,22,58,248,22,170,13,23,198,1, -87,94,28,28,248,22,166,13,23,196,2,10,248,22,187,4,23,196,2,12,28, -23,197,2,250,22,144,9,11,6,15,15,98,97,100,32,109,111,100,117,108,101, -32,112,97,116,104,23,200,2,250,22,145,9,2,17,6,19,19,109,111,100,117, -108,101,45,112,97,116,104,32,111,114,32,112,97,116,104,23,198,2,28,28,248, -22,68,23,196,2,249,22,175,8,248,22,71,23,198,2,2,3,11,248,22,180, -4,248,22,95,196,28,28,248,22,68,23,196,2,249,22,175,8,248,22,71,23, -198,2,66,112,108,97,110,101,116,11,87,94,28,207,12,20,14,159,80,158,36, -51,80,158,36,49,90,161,36,35,10,249,22,162,4,21,94,2,25,6,18,18, -112,108,97,110,101,116,47,114,101,115,111,108,118,101,114,46,115,115,1,27,112, -108,97,110,101,116,45,109,111,100,117,108,101,45,110,97,109,101,45,114,101,115, -111,108,118,101,114,12,252,212,199,200,201,202,80,158,41,49,87,94,23,193,1, -27,89,162,8,44,36,45,79,115,104,111,119,45,99,111,108,108,101,99,116,105, -111,110,45,101,114,114,223,5,33,46,27,28,248,22,55,23,198,2,27,250,22, -145,2,80,159,42,43,37,249,22,70,23,203,2,247,22,144,14,11,28,23,193, -2,192,87,94,23,193,1,91,159,37,11,90,161,37,35,11,27,248,22,61,23, -202,2,248,2,47,248,2,49,23,195,1,27,251,80,158,46,52,2,17,23,202, -1,28,248,22,78,23,199,2,23,199,2,248,22,71,23,199,2,28,248,22,78, -23,199,2,9,248,22,72,23,199,2,249,22,184,13,23,195,1,28,248,22,78, -23,197,1,87,94,23,197,1,6,7,7,109,97,105,110,46,115,115,249,22,128, -7,23,199,1,6,3,3,46,115,115,28,248,22,169,6,23,198,2,87,94,23, -194,1,27,27,28,23,200,2,28,249,22,175,8,23,202,2,80,158,42,46,80, -158,40,47,27,248,22,181,4,23,202,2,28,248,22,166,13,23,194,2,91,159, -38,11,90,161,38,35,11,248,22,187,13,23,197,1,87,95,83,160,37,11,80, -158,44,46,23,204,2,83,160,37,11,80,158,44,47,192,192,11,11,28,23,193, -2,192,87,94,23,193,1,27,247,22,137,5,28,23,193,2,192,87,94,23,193, -1,247,22,143,14,27,250,22,145,2,80,159,43,43,37,249,22,70,23,204,2, -23,199,2,11,28,23,193,2,192,87,94,23,193,1,91,159,37,11,90,161,37, -35,11,248,2,51,248,2,53,23,203,2,250,22,1,22,184,13,23,199,1,249, -22,84,249,22,2,32,0,89,162,8,44,36,43,9,222,33,55,23,200,1,248, -22,80,23,200,1,28,248,22,166,13,23,198,2,87,94,23,194,1,28,248,22, -189,13,23,198,2,23,197,2,248,22,80,6,26,26,32,40,97,32,112,97,116, -104,32,109,117,115,116,32,98,101,32,97,98,115,111,108,117,116,101,41,28,249, -22,175,8,248,22,71,23,200,2,2,25,27,250,22,145,2,80,159,42,43,37, -249,22,70,23,203,2,247,22,144,14,11,28,23,193,2,192,87,94,23,193,1, -91,159,38,11,90,161,37,35,11,27,248,22,95,23,203,2,248,2,56,248,2, -58,23,195,1,90,161,36,37,11,28,248,22,78,248,22,97,23,203,2,28,248, -22,78,23,194,2,249,22,155,14,0,8,35,114,120,34,91,46,93,34,23,196, -2,11,10,27,27,28,23,197,2,249,22,84,28,248,22,78,248,22,97,23,207, -2,21,93,6,5,5,109,122,108,105,98,249,22,1,22,84,249,22,2,32,0, -89,162,8,44,36,43,9,222,33,62,248,22,97,23,210,2,23,197,2,28,248, -22,78,23,196,2,248,22,80,23,197,2,23,195,2,251,80,158,48,52,2,17, -23,204,1,248,22,71,23,198,2,248,22,72,23,198,1,249,22,184,13,23,195, -1,28,23,198,1,87,94,23,196,1,23,197,1,28,248,22,78,23,197,1,87, -94,23,197,1,6,7,7,109,97,105,110,46,115,115,28,249,22,155,14,0,8, -35,114,120,34,91,46,93,34,23,199,2,23,197,1,249,22,128,7,23,199,1, -6,3,3,46,115,115,28,249,22,175,8,248,22,71,23,200,2,64,102,105,108, -101,249,22,191,13,248,22,131,14,248,22,95,23,201,2,27,28,23,201,2,28, -249,22,175,8,23,203,2,80,158,43,46,80,158,41,47,27,248,22,181,4,23, -203,2,28,248,22,166,13,23,194,2,91,159,38,11,90,161,38,35,11,248,22, -187,13,23,197,1,87,95,83,160,37,11,80,158,45,46,23,205,2,83,160,37, -11,80,158,45,47,192,192,11,11,28,23,193,2,192,87,94,23,193,1,27,247, -22,137,5,28,23,193,2,192,87,94,23,193,1,247,22,143,14,12,87,94,28, -28,248,22,166,13,23,194,2,10,248,22,191,7,23,194,2,87,94,23,199,1, -12,28,23,199,2,250,22,144,9,67,114,101,113,117,105,114,101,249,22,153,7, -6,17,17,98,97,100,32,109,111,100,117,108,101,32,112,97,116,104,126,97,28, -23,198,2,248,22,71,23,199,2,6,0,0,23,202,1,87,94,23,199,1,250, -22,145,9,2,17,249,22,153,7,6,13,13,109,111,100,117,108,101,32,112,97, -116,104,126,97,28,23,198,2,248,22,71,23,199,2,6,0,0,23,200,2,27, -28,248,22,191,7,23,195,2,249,22,132,8,23,196,2,35,249,22,129,14,248, -22,130,14,23,197,2,11,27,28,248,22,191,7,23,196,2,249,22,132,8,23, -197,2,36,248,80,158,41,53,23,195,2,91,159,38,11,90,161,38,35,11,28, +27,249,22,155,14,2,34,23,196,2,28,23,193,2,87,94,23,194,1,249,22, +70,248,22,95,23,196,2,27,248,22,104,23,197,1,27,249,22,155,14,2,34, +23,196,2,28,23,193,2,87,94,23,194,1,249,22,70,248,22,95,23,196,2, +248,2,56,248,22,104,23,197,1,248,22,80,194,248,22,80,194,248,22,80,194, +27,248,2,56,23,195,1,192,28,249,22,177,8,248,22,72,23,200,2,23,197, +1,28,249,22,175,8,248,22,71,23,200,2,23,196,1,251,22,142,9,2,17, +6,26,26,99,121,99,108,101,32,105,110,32,108,111,97,100,105,110,103,32,97, +116,32,126,101,58,32,126,101,23,200,1,249,22,2,22,72,248,22,85,249,22, +70,23,206,1,23,202,1,12,12,247,192,20,14,159,80,159,39,44,37,249,22, +70,248,22,175,14,247,22,148,12,23,197,1,20,14,159,80,159,39,39,37,250, +80,159,42,40,37,249,22,27,11,80,159,44,39,37,22,161,4,23,196,1,249, +247,22,136,5,23,198,1,248,22,58,248,22,172,13,23,198,1,87,94,28,28, +248,22,168,13,23,196,2,10,248,22,187,4,23,196,2,12,28,23,197,2,250, +22,144,9,11,6,15,15,98,97,100,32,109,111,100,117,108,101,32,112,97,116, +104,23,200,2,250,22,145,9,2,17,6,19,19,109,111,100,117,108,101,45,112, +97,116,104,32,111,114,32,112,97,116,104,23,198,2,28,28,248,22,68,23,196, +2,249,22,175,8,248,22,71,23,198,2,2,3,11,248,22,180,4,248,22,95, +196,28,28,248,22,68,23,196,2,249,22,175,8,248,22,71,23,198,2,66,112, +108,97,110,101,116,11,87,94,28,207,12,20,14,159,80,159,36,51,37,80,158, +36,49,90,161,36,35,10,249,22,162,4,21,94,2,25,6,18,18,112,108,97, +110,101,116,47,114,101,115,111,108,118,101,114,46,115,115,1,27,112,108,97,110, +101,116,45,109,111,100,117,108,101,45,110,97,109,101,45,114,101,115,111,108,118, +101,114,12,252,212,199,200,201,202,80,158,41,49,87,94,23,193,1,27,89,162, +8,44,36,45,79,115,104,111,119,45,99,111,108,108,101,99,116,105,111,110,45, +101,114,114,223,5,33,42,27,28,248,22,55,23,198,2,27,250,22,145,2,80, +159,42,43,37,249,22,70,23,203,2,247,22,146,14,11,28,23,193,2,192,87, +94,23,193,1,91,159,37,11,90,161,37,35,11,27,248,22,61,23,202,2,248, +2,43,248,2,45,23,195,1,27,251,80,159,46,52,37,2,17,23,202,1,28, +248,22,78,23,199,2,23,199,2,248,22,71,23,199,2,28,248,22,78,23,199, +2,9,248,22,72,23,199,2,249,22,186,13,23,195,1,28,248,22,78,23,197, +1,87,94,23,197,1,6,7,7,109,97,105,110,46,115,115,249,22,128,7,23, +199,1,6,3,3,46,115,115,28,248,22,169,6,23,198,2,87,94,23,194,1, +27,27,28,23,200,2,28,249,22,175,8,23,202,2,80,158,42,46,80,158,40, +47,27,248,22,181,4,23,202,2,28,248,22,168,13,23,194,2,91,159,38,11, +90,161,38,35,11,248,22,189,13,23,197,1,87,95,83,160,37,11,80,158,44, +46,23,204,2,83,160,37,11,80,158,44,47,192,192,11,11,28,23,193,2,192, +87,94,23,193,1,27,247,22,137,5,28,23,193,2,192,87,94,23,193,1,247, +22,145,14,27,250,22,145,2,80,159,43,43,37,249,22,70,23,204,2,23,199, +2,11,28,23,193,2,192,87,94,23,193,1,91,159,37,11,90,161,37,35,11, +248,2,47,248,2,49,23,203,2,250,22,1,22,186,13,23,199,1,249,22,84, +249,22,2,32,0,89,162,8,44,36,43,9,222,33,51,23,200,1,248,22,80, +23,200,1,28,248,22,168,13,23,198,2,87,94,23,194,1,28,248,22,191,13, +23,198,2,23,197,2,248,22,80,6,26,26,32,40,97,32,112,97,116,104,32, +109,117,115,116,32,98,101,32,97,98,115,111,108,117,116,101,41,28,249,22,175, +8,248,22,71,23,200,2,2,25,27,250,22,145,2,80,159,42,43,37,249,22, +70,23,203,2,247,22,146,14,11,28,23,193,2,192,87,94,23,193,1,91,159, +38,11,90,161,37,35,11,27,248,22,95,23,203,2,248,2,52,248,2,54,23, +195,1,90,161,36,37,11,28,248,22,78,248,22,97,23,203,2,28,248,22,78, +23,194,2,249,22,157,14,0,8,35,114,120,34,91,46,93,34,23,196,2,11, +10,27,27,28,23,197,2,249,22,84,28,248,22,78,248,22,97,23,207,2,21, +93,6,5,5,109,122,108,105,98,249,22,1,22,84,249,22,2,32,0,89,162, +8,44,36,43,9,222,33,58,248,22,97,23,210,2,23,197,2,28,248,22,78, +23,196,2,248,22,80,23,197,2,23,195,2,251,80,159,48,52,37,2,17,23, +204,1,248,22,71,23,198,2,248,22,72,23,198,1,249,22,186,13,23,195,1, +28,23,198,1,87,94,23,196,1,23,197,1,28,248,22,78,23,197,1,87,94, +23,197,1,6,7,7,109,97,105,110,46,115,115,28,249,22,157,14,0,8,35, +114,120,34,91,46,93,34,23,199,2,23,197,1,249,22,128,7,23,199,1,6, +3,3,46,115,115,28,249,22,175,8,248,22,71,23,200,2,64,102,105,108,101, +249,22,129,14,248,22,133,14,248,22,95,23,201,2,27,28,23,201,2,28,249, +22,175,8,23,203,2,80,158,43,46,80,158,41,47,27,248,22,181,4,23,203, +2,28,248,22,168,13,23,194,2,91,159,38,11,90,161,38,35,11,248,22,189, +13,23,197,1,87,95,83,160,37,11,80,158,45,46,23,205,2,83,160,37,11, +80,158,45,47,192,192,11,11,28,23,193,2,192,87,94,23,193,1,27,247,22, +137,5,28,23,193,2,192,87,94,23,193,1,247,22,145,14,12,87,94,28,28, +248,22,168,13,23,194,2,10,248,22,191,7,23,194,2,87,94,23,199,1,12, +28,23,199,2,250,22,144,9,67,114,101,113,117,105,114,101,249,22,153,7,6, +17,17,98,97,100,32,109,111,100,117,108,101,32,112,97,116,104,126,97,28,23, +198,2,248,22,71,23,199,2,6,0,0,23,202,1,87,94,23,199,1,250,22, +145,9,2,17,249,22,153,7,6,13,13,109,111,100,117,108,101,32,112,97,116, +104,126,97,28,23,198,2,248,22,71,23,199,2,6,0,0,23,200,2,27,28, +248,22,191,7,23,195,2,249,22,132,8,23,196,2,35,249,22,131,14,248,22, +132,14,23,197,2,11,27,28,248,22,191,7,23,196,2,249,22,132,8,23,197, +2,36,248,80,159,41,53,37,23,195,2,91,159,38,11,90,161,38,35,11,28, 248,22,191,7,23,199,2,250,22,7,2,26,249,22,132,8,23,203,2,37,2, -26,248,22,187,13,23,198,2,87,95,23,195,1,23,193,1,27,28,248,22,191, -7,23,200,2,249,22,132,8,23,201,2,38,249,80,158,46,54,23,197,2,5, -0,27,28,248,22,191,7,23,201,2,249,22,132,8,23,202,2,39,248,22,180, -4,23,200,2,27,27,250,22,145,2,80,159,50,42,37,248,22,173,14,247,22, -148,12,11,28,23,193,2,192,87,94,23,193,1,27,247,22,129,2,87,94,250, -22,143,2,80,159,51,42,37,248,22,173,14,247,22,148,12,195,192,87,95,28, -23,208,1,27,250,22,145,2,23,197,2,197,11,28,23,193,1,12,87,95,27, -27,28,248,22,17,80,159,50,45,37,80,159,49,45,37,247,22,19,250,22,25, -248,22,23,23,197,2,80,159,52,44,37,23,196,1,27,248,22,173,14,247,22, -148,12,249,22,3,83,158,39,20,100,94,89,162,8,44,36,54,9,226,12,11, -2,3,33,63,23,195,1,23,196,1,248,28,248,22,17,80,159,49,45,37,32, -0,89,162,43,36,41,9,222,33,64,80,159,48,59,36,89,162,43,35,50,9, -227,13,9,8,4,3,33,65,250,22,143,2,23,197,1,197,10,12,28,28,248, -22,191,7,23,202,1,11,28,248,22,169,6,23,206,2,10,28,248,22,55,23, -206,2,10,28,248,22,68,23,206,2,249,22,175,8,248,22,71,23,208,2,2, -25,11,250,22,143,2,80,159,49,43,37,28,248,22,169,6,23,209,2,249,22, -70,23,210,1,27,28,23,212,2,28,249,22,175,8,23,214,2,80,158,54,46, -87,94,23,212,1,80,158,52,47,27,248,22,181,4,23,214,2,28,248,22,166, -13,23,194,2,91,159,38,11,90,161,38,35,11,248,22,187,13,23,197,1,87, -95,83,160,37,11,80,158,56,46,23,23,83,160,37,11,80,158,56,47,192,192, -11,11,28,23,193,2,192,87,94,23,193,1,27,247,22,137,5,28,23,193,2, -192,87,94,23,193,1,247,22,143,14,249,22,70,23,210,1,247,22,144,14,252, -22,129,8,23,208,1,23,207,1,23,205,1,23,203,1,201,12,193,87,96,83, -160,37,11,80,158,35,49,248,80,158,36,57,249,22,27,11,80,158,38,51,248, -22,160,4,80,159,36,50,37,248,22,136,5,80,159,36,36,36,248,22,139,13, -80,159,36,41,36,83,160,37,11,80,158,35,49,248,80,158,36,57,249,22,27, -11,80,158,38,51,159,35,20,105,159,35,16,1,11,16,0,83,158,41,20,103, -144,66,35,37,98,111,111,116,29,11,11,11,11,11,10,37,80,158,35,35,20, -105,159,37,16,23,2,1,2,2,30,2,4,72,112,97,116,104,45,115,116,114, -105,110,103,63,10,30,2,4,75,112,97,116,104,45,97,100,100,45,115,117,102, -102,105,120,7,30,2,6,2,7,4,30,2,6,1,23,101,120,116,101,110,100, -45,112,97,114,97,109,101,116,101,114,105,122,97,116,105,111,110,3,2,8,2, -9,2,10,2,11,2,12,2,13,2,14,2,15,2,16,2,17,30,2,18,2, -7,4,30,2,4,69,45,102,105,110,100,45,99,111,108,0,30,2,4,76,110, -111,114,109,97,108,45,99,97,115,101,45,112,97,116,104,6,30,2,4,79,112, -97,116,104,45,114,101,112,108,97,99,101,45,115,117,102,102,105,120,9,2,19, -2,20,30,2,18,74,114,101,112,97,114,97,109,101,116,101,114,105,122,101,5, -16,0,16,0,35,16,0,35,16,12,2,11,2,12,2,9,2,10,2,13,2, -14,2,2,2,8,2,1,2,16,2,15,2,17,47,11,11,38,35,11,11,11, -16,2,2,19,2,20,16,2,11,11,16,2,2,19,2,20,37,37,36,11,11, -11,16,0,16,0,16,0,35,35,11,11,11,11,16,0,16,0,16,0,35,35, -16,0,16,16,83,158,35,16,2,89,162,43,36,44,9,223,0,33,27,80,159, -35,59,36,83,158,35,16,2,89,162,43,37,48,68,119,105,116,104,45,100,105, -114,223,0,33,28,80,159,35,58,36,83,158,35,16,2,248,22,188,7,69,115, -111,45,115,117,102,102,105,120,80,159,35,35,36,83,158,35,16,2,89,162,43, -37,59,2,2,223,0,33,37,80,159,35,36,36,83,158,35,16,2,32,0,89, -162,8,44,36,41,2,8,222,192,80,159,35,41,36,83,158,35,16,2,247,22, -132,2,80,159,35,42,36,83,158,35,16,2,247,22,131,2,80,159,35,43,36, -83,158,35,16,2,247,22,66,80,159,35,44,36,83,158,35,16,2,248,22,18, -74,109,111,100,117,108,101,45,108,111,97,100,105,110,103,80,159,35,45,36,83, -158,35,16,2,11,80,158,35,46,83,158,35,16,2,11,80,158,35,47,83,158, -35,16,2,32,0,89,162,43,37,8,25,2,15,222,33,43,80,159,35,48,36, -83,158,35,16,2,11,80,158,35,49,83,158,35,16,2,91,159,37,10,90,161, -36,35,10,11,90,161,36,36,10,83,158,38,20,99,96,2,17,89,162,8,44, -36,50,9,224,2,0,33,44,89,162,43,38,48,9,223,1,33,45,89,162,43, -39,8,32,9,224,2,0,33,66,208,80,159,35,50,36,83,158,35,16,2,89, -162,43,35,44,2,19,223,0,33,67,80,159,35,55,36,83,158,35,16,2,89, -162,8,44,35,44,2,20,223,0,33,68,80,159,35,56,36,96,29,94,2,3, -68,35,37,107,101,114,110,101,108,11,29,94,2,3,69,35,37,109,105,110,45, -115,116,120,11,2,4,2,18,9,9,9,35,0}; - EVAL_ONE_SIZED_STR((char *)expr, 5514); +26,248,22,189,13,23,198,2,87,95,23,195,1,23,193,1,27,28,248,22,191, +7,23,200,2,249,22,132,8,23,201,2,38,249,80,159,46,54,37,23,197,2, +5,0,27,28,248,22,191,7,23,201,2,249,22,132,8,23,202,2,39,248,22, +180,4,23,200,2,27,27,250,22,145,2,80,159,50,42,37,248,22,175,14,247, +22,148,12,11,28,23,193,2,192,87,94,23,193,1,27,247,22,129,2,87,94, +250,22,143,2,80,159,51,42,37,248,22,175,14,247,22,148,12,195,192,87,95, +28,23,208,1,27,250,22,145,2,23,197,2,197,11,28,23,193,1,12,87,95, +27,27,28,248,22,17,80,159,50,45,37,80,159,49,45,37,247,22,19,250,22, +25,248,22,23,23,197,2,80,159,52,44,37,23,196,1,27,248,22,175,14,247, +22,148,12,249,22,3,83,158,39,20,100,94,89,162,8,44,36,54,9,226,12, +11,2,3,33,59,23,195,1,23,196,1,248,28,248,22,17,80,159,49,45,37, +32,0,89,162,43,36,41,9,222,33,60,80,159,48,58,36,89,162,43,35,50, +9,227,13,9,8,4,3,33,61,250,22,143,2,23,197,1,197,10,12,28,28, +248,22,191,7,23,202,1,11,28,248,22,169,6,23,206,2,10,28,248,22,55, +23,206,2,10,28,248,22,68,23,206,2,249,22,175,8,248,22,71,23,208,2, +2,25,11,250,22,143,2,80,159,49,43,37,28,248,22,169,6,23,209,2,249, +22,70,23,210,1,27,28,23,212,2,28,249,22,175,8,23,214,2,80,158,54, +46,87,94,23,212,1,80,158,52,47,27,248,22,181,4,23,214,2,28,248,22, +168,13,23,194,2,91,159,38,11,90,161,38,35,11,248,22,189,13,23,197,1, +87,95,83,160,37,11,80,158,56,46,23,23,83,160,37,11,80,158,56,47,192, +192,11,11,28,23,193,2,192,87,94,23,193,1,27,247,22,137,5,28,23,193, +2,192,87,94,23,193,1,247,22,145,14,249,22,70,23,210,1,247,22,146,14, +252,22,129,8,23,208,1,23,207,1,23,205,1,23,203,1,201,12,193,87,96, +83,160,37,11,80,158,35,49,248,80,159,36,57,37,249,22,27,11,80,159,38, +51,37,248,22,160,4,80,159,36,50,37,248,22,136,5,80,159,36,36,36,248, +22,139,13,80,159,36,41,36,83,160,37,11,80,158,35,49,248,80,159,36,57, +37,249,22,27,11,80,159,38,51,37,159,35,20,105,159,35,16,1,11,16,0, +83,158,41,20,103,144,66,35,37,98,111,111,116,29,11,11,11,11,11,10,37, +80,158,35,35,20,105,159,36,16,23,2,1,2,2,30,2,4,72,112,97,116, +104,45,115,116,114,105,110,103,63,10,30,2,4,75,112,97,116,104,45,97,100, +100,45,115,117,102,102,105,120,7,30,2,6,2,7,4,30,2,6,1,23,101, +120,116,101,110,100,45,112,97,114,97,109,101,116,101,114,105,122,97,116,105,111, +110,3,2,8,2,9,2,10,2,11,2,12,2,13,2,14,2,15,2,16,2, +17,30,2,18,2,7,4,30,2,4,69,45,102,105,110,100,45,99,111,108,0, +30,2,4,76,110,111,114,109,97,108,45,99,97,115,101,45,112,97,116,104,6, +30,2,4,79,112,97,116,104,45,114,101,112,108,97,99,101,45,115,117,102,102, +105,120,9,2,19,2,20,30,2,18,74,114,101,112,97,114,97,109,101,116,101, +114,105,122,101,5,16,0,16,0,35,16,0,35,16,12,2,11,2,12,2,9, +2,10,2,13,2,14,2,2,2,8,2,1,2,16,2,15,2,17,47,11,11, +38,35,11,11,11,16,2,2,19,2,20,16,2,11,11,16,2,2,19,2,20, +37,37,36,11,11,11,16,0,16,0,16,0,35,35,11,11,11,11,16,0,16, +0,16,0,35,35,16,0,16,15,83,158,35,16,2,89,162,43,36,44,9,223, +0,33,27,80,159,35,58,36,83,158,35,16,2,248,22,188,7,69,115,111,45, +115,117,102,102,105,120,80,159,35,35,36,83,158,35,16,2,89,162,43,37,59, +2,2,223,0,33,33,80,159,35,36,36,83,158,35,16,2,32,0,89,162,8, +44,36,41,2,8,222,192,80,159,35,41,36,83,158,35,16,2,247,22,132,2, +80,159,35,42,36,83,158,35,16,2,247,22,131,2,80,159,35,43,36,83,158, +35,16,2,247,22,66,80,159,35,44,36,83,158,35,16,2,248,22,18,74,109, +111,100,117,108,101,45,108,111,97,100,105,110,103,80,159,35,45,36,83,158,35, +16,2,11,80,158,35,46,83,158,35,16,2,11,80,158,35,47,83,158,35,16, +2,32,0,89,162,43,37,8,25,2,15,222,33,39,80,159,35,48,36,83,158, +35,16,2,11,80,158,35,49,83,158,35,16,2,91,159,37,10,90,161,36,35, +10,11,90,161,36,36,10,83,158,38,20,99,96,2,17,89,162,8,44,36,50, +9,224,2,0,33,40,89,162,43,38,48,9,223,1,33,41,89,162,43,39,8, +32,9,224,2,0,33,62,208,80,159,35,50,36,83,158,35,16,2,89,162,43, +35,44,2,19,223,0,33,63,80,159,35,55,36,83,158,35,16,2,89,162,8, +44,35,44,2,20,223,0,33,64,80,159,35,56,36,96,29,94,2,3,68,35, +37,107,101,114,110,101,108,11,29,94,2,3,69,35,37,109,105,110,45,115,116, +120,11,2,4,2,18,9,9,9,35,0}; + EVAL_ONE_SIZED_STR((char *)expr, 5575); } diff --git a/src/mzscheme/src/error.c b/src/mzscheme/src/error.c index 405c73a616..a8ba2bc264 100644 --- a/src/mzscheme/src/error.c +++ b/src/mzscheme/src/error.c @@ -3287,7 +3287,7 @@ do_raise(Scheme_Object *arg, int need_debug, int eb) if (need_debug) { msg = scheme_display_to_string(((Scheme_Structure *)arg)->slots[0], NULL); } else - msg = scheme_write_to_string(arg, NULL); + msg = scheme_print_to_string(arg, NULL); scheme_log(NULL, SCHEME_LOG_WARNING, 0, diff --git a/src/mzscheme/src/fun.c b/src/mzscheme/src/fun.c index 003123ba7e..6b8221c809 100644 --- a/src/mzscheme/src/fun.c +++ b/src/mzscheme/src/fun.c @@ -3520,10 +3520,8 @@ static Scheme_Object *primitive_result_arity(int argc, Scheme_Object *argv[]) return scheme_make_integer(1); } -static Scheme_Object *object_name(int argc, Scheme_Object **argv) +Scheme_Object *scheme_object_name(Scheme_Object *a) { - Scheme_Object *a = argv[0]; - if (SCHEME_CHAPERONEP(a)) a = SCHEME_CHAPERONE_VAL(a); @@ -3580,6 +3578,11 @@ static Scheme_Object *object_name(int argc, Scheme_Object **argv) return scheme_false; } +static Scheme_Object *object_name(int argc, Scheme_Object **argv) +{ + return scheme_object_name(argv[0]); +} + Scheme_Object *scheme_arity(Scheme_Object *p) { return get_or_check_arity(p, -1, NULL); @@ -3676,13 +3679,14 @@ void scheme_init_reduced_proc_struct(Scheme_Env *env) while (insp->superior->superior) { insp = insp->superior; } - scheme_reduced_procedure_struct = scheme_make_proc_struct_type(NULL, - NULL, - (Scheme_Object *)insp, - 4, 0, - scheme_false, - scheme_make_integer(0), - NULL); + scheme_reduced_procedure_struct = scheme_make_struct_type2(NULL, + NULL, + (Scheme_Object *)insp, + 4, 0, + scheme_false, + scheme_null, + scheme_make_integer(0), + NULL, NULL); } } diff --git a/src/mzscheme/src/module.c b/src/mzscheme/src/module.c index bdbd848180..32ffa1b1a4 100644 --- a/src/mzscheme/src/module.c +++ b/src/mzscheme/src/module.c @@ -398,7 +398,7 @@ void scheme_init_module(Scheme_Env *env) GLOBAL_PRIM_W_ARITY("resolved-module-path-name", resolved_module_path_name, 1, 1, env); GLOBAL_PRIM_W_ARITY("module-provide-protected?", module_export_protected_p, 2, 2, env); GLOBAL_PRIM_W_ARITY("module->namespace", module_to_namespace, 1, 1, env); - GLOBAL_PRIM_W_ARITY("module->language-info", module_to_lang_info, 1, 1, env); + GLOBAL_PRIM_W_ARITY("module->language-info", module_to_lang_info, 1, 2, env); GLOBAL_PRIM_W_ARITY("module->imports", module_to_imports, 1, 1, env); GLOBAL_PRIM_W_ARITY2("module->exports", module_to_exports, 1, 1, 2, 2, env); GLOBAL_PRIM_W_ARITY("module-path?", is_module_path, 1, 1, env); @@ -2601,7 +2601,8 @@ static Scheme_Module *module_to_(const char *who, int argc, Scheme_Object *argv[ if (SCHEME_MODNAMEP(argv[0])) name = argv[0]; else - name = scheme_module_resolve(scheme_make_modidx(argv[0], scheme_false, scheme_false), 1); + name = scheme_module_resolve(scheme_make_modidx(argv[0], scheme_false, scheme_false), + (argc > 1) ? SCHEME_TRUEP(argv[1]) : 0); if (SAME_OBJ(name, kernel_modname)) m = kernel; diff --git a/src/mzscheme/src/mzmark.c b/src/mzscheme/src/mzmark.c index fd4c86c588..30f8c0ab25 100644 --- a/src/mzscheme/src/mzmark.c +++ b/src/mzscheme/src/mzmark.c @@ -3829,6 +3829,7 @@ static int mark_print_params_MARK(void *p, struct NewGC *gc) { gcMARK2(pp->inspector, gc); gcMARK2(pp->print_port, gc); gcMARK2(pp->print_buffer, gc); + gcMARK2(pp->depth_delta, gc); return gcBYTES_TO_WORDS(sizeof(PrintParams)); } @@ -3838,6 +3839,7 @@ static int mark_print_params_FIXUP(void *p, struct NewGC *gc) { gcFIXUP2(pp->inspector, gc); gcFIXUP2(pp->print_port, gc); gcFIXUP2(pp->print_buffer, gc); + gcFIXUP2(pp->depth_delta, gc); return gcBYTES_TO_WORDS(sizeof(PrintParams)); } diff --git a/src/mzscheme/src/mzmarksrc.c b/src/mzscheme/src/mzmarksrc.c index 2a3a6d771a..bb75c1301b 100644 --- a/src/mzscheme/src/mzmarksrc.c +++ b/src/mzscheme/src/mzmarksrc.c @@ -1560,6 +1560,7 @@ mark_print_params { gcMARK2(pp->inspector, gc); gcMARK2(pp->print_port, gc); gcMARK2(pp->print_buffer, gc); + gcMARK2(pp->depth_delta, gc); size: gcBYTES_TO_WORDS(sizeof(PrintParams)); } diff --git a/src/mzscheme/src/portfun.c b/src/mzscheme/src/portfun.c index 4e7c157a58..0af7d0f1a4 100644 --- a/src/mzscheme/src/portfun.c +++ b/src/mzscheme/src/portfun.c @@ -200,14 +200,14 @@ scheme_init_port_fun(Scheme_Env *env) scheme_write_proc = scheme_make_noncm_prim(sch_write, "write", 1, 2); scheme_display_proc = scheme_make_noncm_prim(display, "display", 1, 2); - scheme_print_proc = scheme_make_noncm_prim(sch_print, "print", 1, 2); + scheme_print_proc = scheme_make_noncm_prim(sch_print, "print", 1, 3); /* Made as a closed prim so we can get the arity right: */ default_read_handler = scheme_make_closed_prim_w_arity(sch_default_read_handler, NULL, "default-port-read-handler", 1, 2); default_display_handler = scheme_make_prim_w_arity(sch_default_display_handler, "default-port-display-handler", 2, 2); default_write_handler = scheme_make_prim_w_arity(sch_default_write_handler, "default-port-write-handler", 2, 2); - default_print_handler = scheme_make_prim_w_arity(sch_default_print_handler, "default-port-print-handler", 2, 2); + default_print_handler = scheme_make_prim_w_arity(sch_default_print_handler, "default-port-print-handler", 2, 3); scheme_add_global_constant("eof", scheme_eof, env); @@ -342,7 +342,7 @@ void scheme_init_port_fun_config(void) REGISTER_SO(scheme_default_global_print_handler); scheme_default_global_print_handler - = scheme_make_prim_w_arity(sch_default_global_port_print_handler, "default-global-port-print-handler", 2, 2); + = scheme_make_prim_w_arity(sch_default_global_port_print_handler, "default-global-port-print-handler", 2, 3); scheme_set_root_param(MZCONFIG_PORT_PRINT_HANDLER, scheme_default_global_print_handler); /* Use dummy port: */ @@ -3684,7 +3684,10 @@ static Scheme_Object *sch_default_print_handler(int argc, Scheme_Object *argv[]) { if (!SCHEME_OUTPUT_PORTP(argv[1])) scheme_wrong_type("default-port-print-handler", "output-port", 1, argc, argv); - + if ((argc > 2) && !scheme_nonneg_exact_p(argv[2])) + scheme_wrong_type("default-port-print-handler", "non-negative exact integer", + 2, argc, argv); + return _scheme_apply(scheme_get_param(scheme_current_config(), MZCONFIG_PORT_PRINT_HANDLER), argc, argv); @@ -3694,8 +3697,11 @@ static Scheme_Object *sch_default_global_port_print_handler(int argc, Scheme_Obj { if (!SCHEME_OUTPUT_PORTP(argv[1])) scheme_wrong_type("default-global-port-print-handler", "output-port", 1, argc, argv); + if ((argc > 2) && !scheme_nonneg_exact_p(argv[2])) + scheme_wrong_type("default-global-port-print-handler", "non-negative exact integer", + 2, argc, argv); - scheme_internal_print(argv[0], argv[1]); + scheme_internal_print(argv[0], argv[1], argv[2]); return scheme_void; } @@ -3757,17 +3763,25 @@ display_write(char *name, } else { /* print */ Scheme_Object *h; - Scheme_Object *a[2]; + Scheme_Object *a[3]; + + if (argc > 2) { + h = argv[2]; + if (!scheme_nonneg_exact_p(h)) + scheme_wrong_type(name, "non-negative exact integer", 2, argc, argv); + } else + h = scheme_make_integer(0); a[0] = argv[0]; a[1] = (Scheme_Object *)port; + a[2] = h; h = op->print_handler; if (!h) - sch_default_print_handler(2, a); + sch_default_print_handler(3, a); else - _scheme_apply_multi(h, 2, a); + _scheme_apply_multi(h, 3, a); } return scheme_void; @@ -3943,6 +3957,20 @@ static Scheme_Object *port_write_handler(int argc, Scheme_Object *argv[]) } } +static Scheme_Object *call_print_handler(void *data, int argc, Scheme_Object *argv[]) +{ + /* If there's a 3rd argument, drop it. */ + return _scheme_tail_apply((Scheme_Object *)data, 2, argv); +} + +static Scheme_Object *wrap_print_handler(Scheme_Object *proc) +{ + return scheme_make_closed_prim_w_arity(call_print_handler, + proc, + "wrapped-port-print-handler", + 2, 3); +} + static Scheme_Object *port_print_handler(int argc, Scheme_Object *argv[]) { Scheme_Output_Port *op; @@ -3960,19 +3988,34 @@ static Scheme_Object *port_print_handler(int argc, Scheme_Object *argv[]) scheme_check_proc_arity("port-print-handler", 2, 1, argc, argv); if (argv[1] == default_print_handler) op->print_handler = NULL; - else + else if (!scheme_check_proc_arity(NULL, 3, 1, argc, argv)) { + Scheme_Object *wrapped; + wrapped = wrap_print_handler(argv[1]); + op->print_handler = wrapped; + } else op->print_handler = argv[1]; return scheme_void; } } +static Scheme_Object *filter_print_handler(int argc, Scheme_Object **argv) +{ + if (scheme_check_proc_arity(NULL, 2, 0, argc, argv)) { + if (scheme_check_proc_arity(NULL, 3, 0, argc, argv)) + return argv[0]; + else + return wrap_print_handler(argv[0]); + } else + return NULL; +} + static Scheme_Object *global_port_print_handler(int argc, Scheme_Object *argv[]) { return scheme_param_config("global-port-print-handler", scheme_make_integer(MZCONFIG_PORT_PRINT_HANDLER), argc, argv, - 2, NULL, NULL, 0); + -1, filter_print_handler, "procedure (arity 2)", 1); } static Scheme_Object *port_count_lines(int argc, Scheme_Object *argv[]) diff --git a/src/mzscheme/src/print.c b/src/mzscheme/src/print.c index 9ab63349db..a88ed94ae1 100644 --- a/src/mzscheme/src/print.c +++ b/src/mzscheme/src/print.c @@ -49,11 +49,22 @@ SHARED_OK static char compacts[_CPT_COUNT_]; SHARED_OK static Scheme_Hash_Table *global_constants_ht; SHARED_OK static Scheme_Object *quote_link_symbol = NULL; +ROSYM Scheme_Object *quote_symbol; +ROSYM Scheme_Object *quasiquote_symbol; +ROSYM Scheme_Object *unquote_symbol; +ROSYM Scheme_Object *unquote_splicing_symbol; +ROSYM Scheme_Object *syntax_symbol; +ROSYM Scheme_Object *quasisyntax_symbol; +ROSYM Scheme_Object *unsyntax_symbol; +ROSYM Scheme_Object *unsyntax_splicing_symbol; + /* Flag for debugging compiled code in printed form: */ #define NO_COMPACT 0 #define PRINT_MAXLEN_MIN 3 +#define REASONABLE_QQ_DEPTH (1 << 29) + /* locals */ #define MAX_PRINT_BUFFER 500 @@ -67,6 +78,7 @@ typedef struct Scheme_Print_Params { char print_hash_table; char print_unreadable; char print_pair_curly, print_mpair_curly; + char print_reader; char can_read_pipe_quote; char case_sens; char honu_mode; @@ -81,6 +93,7 @@ typedef struct Scheme_Print_Params { long print_syntax; Scheme_Object *print_port; mz_jmp_buf *print_escape; + Scheme_Object *depth_delta; /* for large qq depth */ } PrintParams; #ifdef MZ_PRECISE_GC @@ -88,7 +101,7 @@ static void register_traversers(void); #endif static void print_to_port(char *name, Scheme_Object *obj, Scheme_Object *port, - int notdisplay, long maxl, int check_honu); + int notdisplay, long maxl, int check_honu, Scheme_Object *qq_depth); static int print(Scheme_Object *obj, int notdisplay, int compact, Scheme_Hash_Table *ht, Scheme_Marshal_Tables *mt, @@ -100,7 +113,7 @@ static void print_pair(Scheme_Object *pair, int notdisplay, int compact, Scheme_Hash_Table *ht, Scheme_Marshal_Tables *mt, PrintParams *pp, - Scheme_Type type, int round_parens); + Scheme_Type type, int round_parens, int first_unquoted); static void print_vector(Scheme_Object *vec, int notdisplay, int compact, Scheme_Hash_Table *ht, Scheme_Marshal_Tables *mt, @@ -108,7 +121,8 @@ static void print_vector(Scheme_Object *vec, int notdisplay, int compact, int as_prefab); static void print_char(Scheme_Object *chobj, int notdisplay, PrintParams *pp); static char *print_to_string(Scheme_Object *obj, long * volatile len, int write, - Scheme_Object *port, long maxl, int check_honu); + Scheme_Object *port, long maxl, int check_honu, + Scheme_Object *qq_depth); static void custom_write_struct(Scheme_Object *s, Scheme_Hash_Table *ht, Scheme_Marshal_Tables *mt, @@ -153,6 +167,23 @@ void scheme_init_print(Scheme_Env *env) compacts[i] = i; } + REGISTER_SO(quote_symbol); + REGISTER_SO(quasiquote_symbol); + REGISTER_SO(unquote_symbol); + REGISTER_SO(unquote_splicing_symbol); + REGISTER_SO(syntax_symbol); + REGISTER_SO(quasisyntax_symbol); + REGISTER_SO(unsyntax_symbol); + REGISTER_SO(unsyntax_splicing_symbol); + quote_symbol = scheme_intern_symbol("quote"); + quasiquote_symbol = scheme_intern_symbol("quasiquote"); + unquote_symbol = scheme_intern_symbol("unquote"); + unquote_splicing_symbol = scheme_intern_symbol("unquote-splicing"); + syntax_symbol = scheme_intern_symbol("syntax"); + quasisyntax_symbol = scheme_intern_symbol("quasisyntax"); + unsyntax_symbol = scheme_intern_symbol("unsyntax"); + unsyntax_splicing_symbol = scheme_intern_symbol("unsyntax-splicing"); + #ifdef MZ_PRECISE_GC register_traversers(); #endif @@ -160,8 +191,8 @@ void scheme_init_print(Scheme_Env *env) void scheme_init_print_global_constants() { - REGISTER_SO(global_constants_ht); - global_constants_ht = scheme_map_constants_to_globals(); + REGISTER_SO(global_constants_ht); + global_constants_ht = scheme_map_constants_to_globals(); } void scheme_init_print_buffers_places() @@ -208,14 +239,24 @@ scheme_debug_print (Scheme_Object *obj) static void *print_to_port_k(void) { Scheme_Thread *p = scheme_current_thread; - Scheme_Object *obj, *port; + Scheme_Object *obj, *port, *depth; port = (Scheme_Object *)p->ku.k.p1; obj = (Scheme_Object *)p->ku.k.p2; + depth = (Scheme_Object *)p->ku.k.p3; - print_to_port(p->ku.k.i2 ? "write" : "display", + p->ku.k.p1 = NULL; + p->ku.k.p2 = NULL; + p->ku.k.p3 = NULL; + + print_to_port((p->ku.k.i2 + ? ((p->ku.k.i2 = 2) + ? "print" + : "write") + : "display"), obj, port, - p->ku.k.i2, p->ku.k.i1, p->ku.k.i3); + p->ku.k.i2, p->ku.k.i1, p->ku.k.i3, + depth); return NULL; } @@ -232,7 +273,7 @@ static void do_handled_print(Scheme_Object *obj, Scheme_Object *port, } else a[1] = port; - scheme_apply_multi(scheme_write_proc, 2, a); + scheme_apply_multi(proc, 2, a); if (maxl > 0) { char *s; @@ -258,6 +299,7 @@ void scheme_write_w_max(Scheme_Object *obj, Scheme_Object *port, long maxl) p->ku.k.i1 = maxl; p->ku.k.i2 = 1; p->ku.k.i3 = 0; + p->ku.k.p3 = NULL; (void)scheme_top_level_do(print_to_port_k, 0); } @@ -280,6 +322,7 @@ void scheme_display_w_max(Scheme_Object *obj, Scheme_Object *port, long maxl) p->ku.k.i1 = maxl; p->ku.k.i2 = 0; p->ku.k.i3 = 0; + p->ku.k.p3 = NULL; (void)scheme_top_level_do(print_to_port_k, 0); } @@ -300,8 +343,9 @@ void scheme_print_w_max(Scheme_Object *obj, Scheme_Object *port, long maxl) p->ku.k.p1 = port; p->ku.k.p2 = obj; p->ku.k.i1 = maxl; - p->ku.k.i2 = 1; + p->ku.k.i2 = 2; p->ku.k.i3 = 1; + p->ku.k.p3 = NULL; (void)scheme_top_level_do(print_to_port_k, 0); } @@ -315,7 +359,7 @@ void scheme_print(Scheme_Object *obj, Scheme_Object *port) static void *print_to_string_k(void) { Scheme_Thread *p = scheme_current_thread; - Scheme_Object *obj; + Scheme_Object *obj, *qq_depth; long *len, maxl; int iswrite, check_honu; @@ -324,11 +368,13 @@ static void *print_to_string_k(void) maxl = p->ku.k.i1; iswrite = p->ku.k.i2; check_honu = p->ku.k.i3; + qq_depth = (Scheme_Object *)p->ku.k.p3; p->ku.k.p1 = NULL; p->ku.k.p2 = NULL; + p->ku.k.p3 = NULL; - return (void *)print_to_string(obj, len, iswrite, NULL, maxl, check_honu); + return (void *)print_to_string(obj, len, iswrite, NULL, maxl, check_honu, qq_depth); } char *scheme_write_to_string_w_max(Scheme_Object *obj, long *len, long maxl) @@ -340,6 +386,7 @@ char *scheme_write_to_string_w_max(Scheme_Object *obj, long *len, long maxl) p->ku.k.i1 = maxl; p->ku.k.i2 = 1; p->ku.k.i3 = 0; + p->ku.k.p3 = NULL; return (char *)scheme_top_level_do(print_to_string_k, 0); } @@ -358,6 +405,7 @@ char *scheme_display_to_string_w_max(Scheme_Object *obj, long *len, long maxl) p->ku.k.i1 = maxl; p->ku.k.i2 = 0; p->ku.k.i3 = 0; + p->ku.k.p3 = NULL; return (char *)scheme_top_level_do(print_to_string_k, 0); } @@ -374,8 +422,9 @@ char *scheme_print_to_string_w_max(Scheme_Object *obj, long *len, long maxl) p->ku.k.p1 = obj; p->ku.k.p2 = len; p->ku.k.i1 = maxl; - p->ku.k.i2 = 1; + p->ku.k.i2 = 2; p->ku.k.i3 = 1; + p->ku.k.p3 = NULL; return (char *)scheme_top_level_do(print_to_string_k, 0); } @@ -388,19 +437,19 @@ char *scheme_print_to_string(Scheme_Object *obj, long *len) void scheme_internal_write(Scheme_Object *obj, Scheme_Object *port) { - print_to_port("write", obj, port, 1, -1, 0); + print_to_port("write", obj, port, 1, -1, 0, NULL); } void scheme_internal_display(Scheme_Object *obj, Scheme_Object *port) { - print_to_port("display", obj, port, 0, -1, 0); + print_to_port("display", obj, port, 0, -1, 0, NULL); } void -scheme_internal_print(Scheme_Object *obj, Scheme_Object *port) +scheme_internal_print(Scheme_Object *obj, Scheme_Object *port, Scheme_Object *depth) { - print_to_port("print", obj, port, 1, -1, 1); + print_to_port("print", obj, port, 2, -1, 1, depth); } #ifdef DO_STACK_CHECK @@ -834,7 +883,8 @@ static char * print_to_string(Scheme_Object *obj, long * volatile len, int write, Scheme_Object *port, long maxl, - int check_honu) + int check_honu, + Scheme_Object *qq_depth) { Scheme_Hash_Table * volatile ht; Scheme_Object *v; @@ -852,6 +902,7 @@ print_to_string(Scheme_Object *obj, params.print_maxlen = maxl; params.print_port = port; params.print_syntax = 0; + params.depth_delta = NULL; /* Getting print params can take a while, and they're irrelevant for simple things like displaying numbers. So try a shortcut: */ @@ -866,6 +917,7 @@ print_to_string(Scheme_Object *obj, params.print_vec_shorthand = 0; params.print_hash_table = 0; params.print_unreadable = 1; + params.print_reader = 1; params.print_pair_curly = 0; params.print_mpair_curly = 1; params.can_read_pipe_quote = 1; @@ -904,6 +956,28 @@ print_to_string(Scheme_Object *obj, params.print_pair_curly = SCHEME_TRUEP(v); v = scheme_get_param(config, MZCONFIG_PRINT_MPAIR_CURLY); params.print_mpair_curly = SCHEME_TRUEP(v); + if (write > 1) { + v = scheme_get_param(config, MZCONFIG_PRINT_AS_QQ); + if (SCHEME_TRUEP(v)) { + params.depth_delta = scheme_make_integer(0); + if (qq_depth) { + if (scheme_bin_gt(qq_depth, scheme_make_integer(REASONABLE_QQ_DEPTH))) { + write = 3 + REASONABLE_QQ_DEPTH; + qq_depth = scheme_bin_minus(qq_depth, scheme_make_integer(REASONABLE_QQ_DEPTH)); + params.depth_delta = qq_depth; + } else + write = 3 + SCHEME_INT_VAL(qq_depth); + } else + write = 3; + } + } + /* at this point, write >= 3 => qq printing at depth write - 3 */ + if (write > 2) { + params.print_reader = 1; + } else { + v = scheme_get_param(config, MZCONFIG_PRINT_READER); + params.print_reader = SCHEME_TRUEP(v); + } v = scheme_get_param(config, MZCONFIG_CAN_READ_PIPE_QUOTE); params.can_read_pipe_quote = SCHEME_TRUEP(v); v = scheme_get_param(config, MZCONFIG_CASE_SENS); @@ -957,7 +1031,8 @@ print_to_string(Scheme_Object *obj, } static void -print_to_port(char *name, Scheme_Object *obj, Scheme_Object *port, int notdisplay, long maxl, int check_honu) +print_to_port(char *name, Scheme_Object *obj, Scheme_Object *port, int notdisplay, + long maxl, int check_honu, Scheme_Object *qq_depth) { Scheme_Output_Port *op; char *str; @@ -967,7 +1042,7 @@ print_to_port(char *name, Scheme_Object *obj, Scheme_Object *port, int notdispla if (op->closed) scheme_raise_exn(MZEXN_FAIL, "%s: output port is closed", name); - str = print_to_string(obj, &len, notdisplay, port, maxl, check_honu); + str = print_to_string(obj, &len, notdisplay, port, maxl, check_honu, qq_depth); scheme_write_byte_string(str, len, port); } @@ -1576,9 +1651,28 @@ static void always_scheme(PrintParams *pp, int reset) } } +static int to_quoted(PrintParams *pp, int notdisplay, const char *quote) +{ + if (notdisplay == 3) { + print_utf8_string(pp, quote, 0, 1); + return notdisplay + 1; + } else + return notdisplay; +} + +static int to_unquoted(PrintParams *pp, int notdisplay) +{ + while (notdisplay > 3) { + print_utf8_string(pp, ",", 0, 1); + --notdisplay; + } + return notdisplay; +} + static int print(Scheme_Object *obj, int notdisplay, int compact, Scheme_Hash_Table *ht, Scheme_Marshal_Tables *mt, PrintParams *pp) + /* notdisplay >= 3 => print at qq depth notdisplay - 3 */ { int closed = 0; int save_honu_mode; @@ -1740,6 +1834,17 @@ print(Scheme_Object *obj, int notdisplay, int compact, Scheme_Hash_Table *ht, print_utf8_string(pp, ")", 0, 1); } else { const char *s; + + if (notdisplay >= 3) { + if (notdisplay == 4) { + if (SAME_OBJ(obj, unquote_symbol) + || SAME_OBJ(obj, unquote_splicing_symbol)) + print_utf8_string(pp, ",'", 0, 2); + else + notdisplay = to_quoted(pp, notdisplay, "'"); + } else + notdisplay = to_quoted(pp, notdisplay, "'"); + } if (is_kw) print_utf8_string(pp, "#:", 0, 2); @@ -1866,6 +1971,7 @@ print(Scheme_Object *obj, int notdisplay, int compact, Scheme_Hash_Table *ht, if (compact) { print_compact(pp, CPT_NULL); } else { + notdisplay = to_quoted(pp, notdisplay, "'"); if (pp->honu_mode) print_utf8_string(pp, "null", 0, 4); else @@ -1875,18 +1981,21 @@ print(Scheme_Object *obj, int notdisplay, int compact, Scheme_Hash_Table *ht, } else if (SCHEME_PAIRP(obj)) { - print_pair(obj, notdisplay, compact, ht, mt, pp, scheme_pair_type, !pp->print_pair_curly); + notdisplay = to_quoted(pp, notdisplay, "`"); + print_pair(obj, notdisplay, compact, ht, mt, pp, scheme_pair_type, !pp->print_pair_curly, 0); closed = 1; } else if (SCHEME_MUTABLE_PAIRP(obj)) { + notdisplay = to_quoted(pp, notdisplay, "`"); if (compact || !pp->print_unreadable) cannot_print(pp, notdisplay, obj, ht, compact); - print_pair(obj, notdisplay, compact, ht, mt, pp, scheme_mutable_pair_type, !pp->print_mpair_curly); + print_pair(obj, notdisplay, compact, ht, mt, pp, scheme_mutable_pair_type, !pp->print_mpair_curly, 0); closed = 1; } else if (SCHEME_CHAPERONE_VECTORP(obj)) { + notdisplay = to_quoted(pp, notdisplay, "`"); print_vector(obj, notdisplay, compact, ht, mt, pp, 0); closed = 1; } @@ -1900,6 +2009,7 @@ print(Scheme_Object *obj, int notdisplay, int compact, Scheme_Hash_Table *ht, print_compact(pp, CPT_BOX); else { always_scheme(pp, 1); + notdisplay = to_quoted(pp, notdisplay, "`"); print_utf8_string(pp, "#&", 0, 2); } if (SCHEME_BOXP(obj)) @@ -1933,6 +2043,7 @@ print(Scheme_Object *obj, int notdisplay, int compact, Scheme_Hash_Table *ht, print_compact_number(pp, 0); } else { always_scheme(pp, 1); + notdisplay = to_quoted(pp, notdisplay, "`"); print_utf8_string(pp, "#hash", 0, 5); if (SCHEME_HASHTP(obj)) { if (!scheme_is_hash_table_equal(obj)) { @@ -2061,10 +2172,18 @@ print(Scheme_Object *obj, int notdisplay, int compact, Scheme_Hash_Table *ht, Scheme_Object *vec, *prefab; prefab = ((Scheme_Structure *)obj)->stype->prefab_key; vec = scheme_struct_to_vector(obj, NULL, pp->inspector); - if (prefab) { - SCHEME_VEC_ELS(vec)[0] = SCHEME_CDR(prefab); + if ((notdisplay >= 3) && !prefab) { + notdisplay = to_unquoted(pp, notdisplay); + vec = scheme_vector_to_list(vec); + vec = scheme_make_pair(scheme_object_name(obj), SCHEME_CDR(vec)); + print_pair(vec, notdisplay, compact, ht, mt, pp, scheme_pair_type, !pp->print_pair_curly, 1); + } else { + if (prefab) { + SCHEME_VEC_ELS(vec)[0] = SCHEME_CDR(prefab); + notdisplay = to_quoted(pp, notdisplay, "`"); + } + print_vector(vec, notdisplay, compact, ht, mt, pp, !!prefab); } - print_vector(vec, notdisplay, compact, ht, mt, pp, !!prefab); closed = 1; } else { Scheme_Object *src; @@ -2397,7 +2516,7 @@ print(Scheme_Object *obj, int notdisplay, int compact, Scheme_Hash_Table *ht, PRINTADDRESS(pp, obj); print_utf8_string(pp, ">", 0, 1); } - else if (SCHEME_CPTRP(obj)) + else if (SCHEME_CPTRP(obj)) { Scheme_Object *tag = SCHEME_CPTR_TYPE(obj); if (compact || !pp->print_unreadable) { @@ -2456,7 +2575,7 @@ print(Scheme_Object *obj, int notdisplay, int compact, Scheme_Hash_Table *ht, char *str; print_utf8_string(pp, " ", 0, 1); str = print_to_string(scheme_syntax_to_datum((Scheme_Object *)stx, 0, NULL), - &slen, 1, NULL, pp->print_syntax, 0); + &slen, 1, NULL, pp->print_syntax, 0, NULL); print_utf8_string(pp, str, 0, slen); } print_utf8_string(pp, ">", 0, 1); @@ -3065,13 +3184,80 @@ print_byte_string(const char *str, int delta, int len, int notdisplay, PrintPara } } +static int is_special_reader_form(PrintParams *pp, int notdisplay, Scheme_Object *p) +{ + Scheme_Object *v; + + if (notdisplay && pp->print_reader) { + v = SCHEME_CAR(p); + p = SCHEME_CDR(p); + if (!SCHEME_PAIRP(p)) return 0; + p = SCHEME_CDR(p); + if (!SCHEME_NULLP(p)) return 0; + if (SCHEME_SYMBOLP(v)) { + if (SAME_OBJ(v, quote_symbol) + || SAME_OBJ(v, quasiquote_symbol) + || (SAME_OBJ(v, unquote_symbol) && (notdisplay != 4)) + || (SAME_OBJ(v, unquote_splicing_symbol) && (notdisplay != 4)) + || SAME_OBJ(v, syntax_symbol) + || SAME_OBJ(v, quasisyntax_symbol) + || SAME_OBJ(v, unsyntax_symbol) + || SAME_OBJ(v, unsyntax_splicing_symbol)) + return 1; + + } + } + return 0; +} + +static int print_special_reader_form(Scheme_Object *v, PrintParams *pp, int notdisplay) +{ + const char *str; + int len; + + if (SAME_OBJ(v, quote_symbol)) { + str = "'"; + len = 1; + } else if (SAME_OBJ(v, quasiquote_symbol)) { + str = "`"; + len = 1; + notdisplay++; + } else if (SAME_OBJ(v, unquote_symbol)) { + str = ","; + len = 1; + --notdisplay; + } else if (SAME_OBJ(v, unquote_splicing_symbol)) { + str = ",@"; + len = 2; + --notdisplay; + } else if (SAME_OBJ(v, syntax_symbol)) { + str = "#'"; + len = 2; + } else if (SAME_OBJ(v, quasisyntax_symbol)) { + str = "#`"; + len = 2; + } else if (SAME_OBJ(v, unsyntax_symbol)) { + str = "#,"; + len = 2; + } else if (SAME_OBJ(v, unsyntax_splicing_symbol)) { + str = "#,@"; + len = 3; + } else { + str = "???"; + len = 3; + } + + print_utf8_string(pp, str, 0, len); + + return notdisplay; +} static void print_pair(Scheme_Object *pair, int notdisplay, int compact, Scheme_Hash_Table *ht, Scheme_Marshal_Tables *mt, PrintParams *pp, - Scheme_Type pair_type, int round_parens) + Scheme_Type pair_type, int round_parens, int first_unquoted) { Scheme_Object *cdr; int super_compact = 0; @@ -3162,16 +3348,22 @@ print_pair(Scheme_Object *pair, int notdisplay, int compact, if (!super_compact) print_compact(pp, CPT_PAIR); } else { - if (round_parens) - print_utf8_string(pp,"(", 0, 1); - else + if (round_parens) { + if (!first_unquoted && is_special_reader_form(pp, notdisplay, pair)) { + notdisplay = print_special_reader_form(SCHEME_CAR(pair), pp, notdisplay); + (void)print(SCHEME_CADR(pair), notdisplay, compact, ht, mt, pp); + return; + } else + print_utf8_string(pp,"(", 0, 1); + } else print_utf8_string(pp,"{", 0, 1); } - print(SCHEME_CAR(pair), notdisplay, compact, ht, mt, pp); + print(SCHEME_CAR(pair), (first_unquoted ? 1 : notdisplay), compact, ht, mt, pp); - cdr = SCHEME_CDR (pair); - while (SAME_TYPE(SCHEME_TYPE(cdr), pair_type)) { + cdr = SCHEME_CDR(pair); + while (SAME_TYPE(SCHEME_TYPE(cdr), pair_type) + && !is_special_reader_form(pp, notdisplay, pair)) { if (ht && !super_compact) { if ((long)scheme_hash_get(ht, cdr) != 1) { /* This needs a tag */ @@ -3450,7 +3642,9 @@ static Scheme_Object *custom_recur(int notdisplay, void *_vec, int argc, Scheme_ volatile long save_max; if (!SCHEME_OUTPORTP(argv[1])) { - scheme_wrong_type(notdisplay ? "write/recusrive" : "display/recursive", + scheme_wrong_type((notdisplay > 1) + ? "print/recursive" + : (notdisplay ? "write/recusrive" : "display/recursive"), "output-port", 1, argc, argv); return NULL; } @@ -3491,6 +3685,29 @@ static Scheme_Object *custom_recur(int notdisplay, void *_vec, int argc, Scheme_ pp->print_port = argv[1]; + if (notdisplay > 1) { + if (argc > 2) { + Scheme_Object *qq_depth = argv[2]; + if (!scheme_nonneg_exact_p(qq_depth)) + scheme_wrong_type("print/recursive", "nonnegative exact integer", 2, argc, argv); + pp = copy_print_params(pp); + if (scheme_bin_gt(qq_depth, scheme_make_integer(REASONABLE_QQ_DEPTH))) { + notdisplay = 3 + REASONABLE_QQ_DEPTH; + qq_depth = scheme_bin_minus(qq_depth, scheme_make_integer(REASONABLE_QQ_DEPTH)); + pp->depth_delta = qq_depth; + } else { + pp->depth_delta = scheme_make_integer(0); + notdisplay = 3 + SCHEME_INT_VAL(qq_depth); + } + } else if (pp->depth_delta) { + notdisplay = 3; + if (!SAME_OBJ(pp->depth_delta, scheme_make_integer(0))) { + pp = copy_print_params(pp); + pp->depth_delta = scheme_make_integer(0); + } + } + } + /* Recur */ print(argv[0], notdisplay, 0, ht, mt, pp); @@ -3518,13 +3735,18 @@ static Scheme_Object *custom_display_recur(void *_vec, int argc, Scheme_Object * return custom_recur(0, _vec, argc, argv); } +static Scheme_Object *custom_print_recur(void *_vec, int argc, Scheme_Object **argv) +{ + return custom_recur(2, _vec, argc, argv); +} + static void custom_write_struct(Scheme_Object *s, Scheme_Hash_Table *ht, Scheme_Marshal_Tables *mt, PrintParams *orig_pp, int notdisplay) { Scheme_Object *v, *a[3], *o, *vec, *orig_port; Scheme_Output_Port *op; - Scheme_Object *recur_write, *recur_display; + Scheme_Object *recur_write, *recur_display, *recur_print; PrintParams *pp; v = scheme_is_writable_struct(s); @@ -3557,11 +3779,14 @@ static void custom_write_struct(Scheme_Object *s, Scheme_Hash_Table *ht, vec, "custom-display-recur-handler", 2, 2); - + recur_print = scheme_make_closed_prim_w_arity(custom_print_recur, + vec, + "custom-print-recur-handler", + 2, 3); op->write_handler = recur_write; op->display_handler = recur_display; - op->print_handler = recur_write; + op->print_handler = recur_print; /* First, flush print cache to actual port, so further writes go after current writes: */ @@ -3570,7 +3795,12 @@ static void custom_write_struct(Scheme_Object *s, Scheme_Hash_Table *ht, a[0] = s; a[1] = o; - a[2] = (notdisplay ? scheme_true : scheme_false); + if (notdisplay >= 3) { + a[2] = scheme_bin_plus(pp->depth_delta, scheme_make_integer(notdisplay - 3)); + pp->depth_delta = a[2]; + } else + a[2] = (notdisplay ? scheme_true : scheme_false); + scheme_apply_multi(v, 3, a); scheme_close_output_port(o); diff --git a/src/mzscheme/src/read.c b/src/mzscheme/src/read.c index a87dd829e4..60d842e04a 100644 --- a/src/mzscheme/src/read.c +++ b/src/mzscheme/src/read.c @@ -118,6 +118,8 @@ static Scheme_Object *print_pair_curly(int, Scheme_Object *[]); static Scheme_Object *print_mpair_curly(int, Scheme_Object *[]); static Scheme_Object *print_honu(int, Scheme_Object *[]); static Scheme_Object *print_syntax_width(int, Scheme_Object *[]); +static Scheme_Object *print_reader(int, Scheme_Object *[]); +static Scheme_Object *print_as_qq(int, Scheme_Object *[]); static int scheme_ellipses(mzchar* buffer, int length); @@ -536,6 +538,8 @@ void scheme_init_read(Scheme_Env *env) GLOBAL_PARAMETER("print-mpair-curly-braces", print_mpair_curly, MZCONFIG_PRINT_MPAIR_CURLY, env); GLOBAL_PARAMETER("print-honu", print_honu, MZCONFIG_HONU_MODE, env); GLOBAL_PARAMETER("print-syntax-width", print_syntax_width, MZCONFIG_PRINT_SYNTAX_WIDTH, env); + GLOBAL_PARAMETER("print-reader-abbreviations", print_reader, MZCONFIG_PRINT_READER, env); + GLOBAL_PARAMETER("print-as-quasiquote", print_as_qq, MZCONFIG_PRINT_AS_QQ, env); GLOBAL_PRIM_W_ARITY("make-readtable", make_readtable, 1, -1, env); GLOBAL_FOLDING_PRIM("readtable?", readtable_p, 1, 1, 1, env); @@ -753,6 +757,18 @@ print_honu(int argc, Scheme_Object *argv[]) DO_CHAR_PARAM("print-honu", MZCONFIG_HONU_MODE); } +static Scheme_Object * +print_reader(int argc, Scheme_Object *argv[]) +{ + DO_CHAR_PARAM("print-reader-abbreviations", MZCONFIG_PRINT_READER); +} + +static Scheme_Object * +print_as_qq(int argc, Scheme_Object *argv[]) +{ + DO_CHAR_PARAM("print-as-quasiquote", MZCONFIG_PRINT_AS_QQ); +} + static Scheme_Object *good_syntax_width(int c, Scheme_Object **argv) { int ok; diff --git a/src/mzscheme/src/schemef.h b/src/mzscheme/src/schemef.h index 4119ca7994..1b9242da43 100644 --- a/src/mzscheme/src/schemef.h +++ b/src/mzscheme/src/schemef.h @@ -699,8 +699,8 @@ MZ_EXTERN Scheme_Object *scheme_compile(Scheme_Object *form, Scheme_Env *env, in MZ_EXTERN Scheme_Object *scheme_read(Scheme_Object *port); MZ_EXTERN Scheme_Object *scheme_read_syntax(Scheme_Object *port, Scheme_Object *stxsrc); MZ_EXTERN void scheme_write(Scheme_Object *obj, Scheme_Object *port); -MZ_EXTERN void scheme_display(Scheme_Object *obj, Scheme_Object *port); MZ_EXTERN void scheme_print(Scheme_Object *obj, Scheme_Object *port); +MZ_EXTERN void scheme_display(Scheme_Object *obj, Scheme_Object *port); MZ_EXTERN void scheme_write_w_max(Scheme_Object *obj, Scheme_Object *port, long maxl); MZ_EXTERN void scheme_display_w_max(Scheme_Object *obj, Scheme_Object *port, long maxl); MZ_EXTERN void scheme_print_w_max(Scheme_Object *obj, Scheme_Object *port, long maxl); @@ -981,11 +981,11 @@ MZ_EXTERN Scheme_Object *scheme_intern_exact_char_keyword(const mzchar *name, un /*========================================================================*/ MZ_EXTERN Scheme_Object **scheme_make_struct_values(Scheme_Object *struct_type, - Scheme_Object **names, - int count, int flags); + Scheme_Object **names, + int count, int flags); MZ_EXTERN Scheme_Object **scheme_make_struct_names(Scheme_Object *base, - Scheme_Object *field_names, - int flags, int *count_out); + Scheme_Object *field_names, + int flags, int *count_out); MZ_EXTERN Scheme_Object *scheme_make_struct_type(Scheme_Object *base, Scheme_Object *parent, Scheme_Object *inspector, @@ -993,6 +993,15 @@ MZ_EXTERN Scheme_Object *scheme_make_struct_type(Scheme_Object *base, Scheme_Object *uninit_val, Scheme_Object *properties, Scheme_Object *guard); +MZ_EXTERN Scheme_Object *scheme_make_struct_type2(Scheme_Object *base, + Scheme_Object *parent, + Scheme_Object *inspector, + int num_fields, int num_uninit_fields, + Scheme_Object *uninit_val, + Scheme_Object *proc_attr, + Scheme_Object *properties, + char *immutable_array, + Scheme_Object *guard); MZ_EXTERN Scheme_Object *scheme_make_struct_instance(Scheme_Object *stype, int argc, Scheme_Object **argv); diff --git a/src/mzscheme/src/schemex.h b/src/mzscheme/src/schemex.h index beb3a3305d..37c96efc36 100644 --- a/src/mzscheme/src/schemex.h +++ b/src/mzscheme/src/schemex.h @@ -577,8 +577,8 @@ Scheme_Object *(*scheme_compile)(Scheme_Object *form, Scheme_Env *env, int write Scheme_Object *(*scheme_read)(Scheme_Object *port); Scheme_Object *(*scheme_read_syntax)(Scheme_Object *port, Scheme_Object *stxsrc); void (*scheme_write)(Scheme_Object *obj, Scheme_Object *port); -void (*scheme_display)(Scheme_Object *obj, Scheme_Object *port); void (*scheme_print)(Scheme_Object *obj, Scheme_Object *port); +void (*scheme_display)(Scheme_Object *obj, Scheme_Object *port); void (*scheme_write_w_max)(Scheme_Object *obj, Scheme_Object *port, long maxl); void (*scheme_display_w_max)(Scheme_Object *obj, Scheme_Object *port, long maxl); void (*scheme_print_w_max)(Scheme_Object *obj, Scheme_Object *port, long maxl); @@ -813,11 +813,11 @@ Scheme_Object *(*scheme_intern_exact_char_keyword)(const mzchar *name, unsigned /* structs */ /*========================================================================*/ Scheme_Object **(*scheme_make_struct_values)(Scheme_Object *struct_type, - Scheme_Object **names, - int count, int flags); + Scheme_Object **names, + int count, int flags); Scheme_Object **(*scheme_make_struct_names)(Scheme_Object *base, - Scheme_Object *field_names, - int flags, int *count_out); + Scheme_Object *field_names, + int flags, int *count_out); Scheme_Object *(*scheme_make_struct_type)(Scheme_Object *base, Scheme_Object *parent, Scheme_Object *inspector, @@ -825,6 +825,15 @@ Scheme_Object *(*scheme_make_struct_type)(Scheme_Object *base, Scheme_Object *uninit_val, Scheme_Object *properties, Scheme_Object *guard); +Scheme_Object *(*scheme_make_struct_type2)(Scheme_Object *base, + Scheme_Object *parent, + Scheme_Object *inspector, + int num_fields, int num_uninit_fields, + Scheme_Object *uninit_val, + Scheme_Object *proc_attr, + Scheme_Object *properties, + char *immutable_array, + Scheme_Object *guard); Scheme_Object *(*scheme_make_struct_instance)(Scheme_Object *stype, int argc, Scheme_Object **argv); diff --git a/src/mzscheme/src/schemex.inc b/src/mzscheme/src/schemex.inc index b1bffe1462..3c8293bc4f 100644 --- a/src/mzscheme/src/schemex.inc +++ b/src/mzscheme/src/schemex.inc @@ -403,8 +403,8 @@ scheme_extension_table->scheme_read = scheme_read; scheme_extension_table->scheme_read_syntax = scheme_read_syntax; scheme_extension_table->scheme_write = scheme_write; - scheme_extension_table->scheme_display = scheme_display; scheme_extension_table->scheme_print = scheme_print; + scheme_extension_table->scheme_display = scheme_display; scheme_extension_table->scheme_write_w_max = scheme_write_w_max; scheme_extension_table->scheme_display_w_max = scheme_display_w_max; scheme_extension_table->scheme_print_w_max = scheme_print_w_max; @@ -575,6 +575,7 @@ scheme_extension_table->scheme_make_struct_values = scheme_make_struct_values; scheme_extension_table->scheme_make_struct_names = scheme_make_struct_names; scheme_extension_table->scheme_make_struct_type = scheme_make_struct_type; + scheme_extension_table->scheme_make_struct_type2 = scheme_make_struct_type2; scheme_extension_table->scheme_make_struct_instance = scheme_make_struct_instance; scheme_extension_table->scheme_is_struct_instance = scheme_is_struct_instance; scheme_extension_table->scheme_struct_ref = scheme_struct_ref; diff --git a/src/mzscheme/src/schemexm.h b/src/mzscheme/src/schemexm.h index dd3d1af0de..aac0c352b5 100644 --- a/src/mzscheme/src/schemexm.h +++ b/src/mzscheme/src/schemexm.h @@ -403,8 +403,8 @@ #define scheme_read (scheme_extension_table->scheme_read) #define scheme_read_syntax (scheme_extension_table->scheme_read_syntax) #define scheme_write (scheme_extension_table->scheme_write) -#define scheme_display (scheme_extension_table->scheme_display) #define scheme_print (scheme_extension_table->scheme_print) +#define scheme_display (scheme_extension_table->scheme_display) #define scheme_write_w_max (scheme_extension_table->scheme_write_w_max) #define scheme_display_w_max (scheme_extension_table->scheme_display_w_max) #define scheme_print_w_max (scheme_extension_table->scheme_print_w_max) @@ -575,6 +575,7 @@ #define scheme_make_struct_values (scheme_extension_table->scheme_make_struct_values) #define scheme_make_struct_names (scheme_extension_table->scheme_make_struct_names) #define scheme_make_struct_type (scheme_extension_table->scheme_make_struct_type) +#define scheme_make_struct_type2 (scheme_extension_table->scheme_make_struct_type2) #define scheme_make_struct_instance (scheme_extension_table->scheme_make_struct_instance) #define scheme_is_struct_instance (scheme_extension_table->scheme_is_struct_instance) #define scheme_struct_ref (scheme_extension_table->scheme_struct_ref) diff --git a/src/mzscheme/src/schminc.h b/src/mzscheme/src/schminc.h index f555ffa119..be24448358 100644 --- a/src/mzscheme/src/schminc.h +++ b/src/mzscheme/src/schminc.h @@ -13,7 +13,7 @@ #define USE_COMPILED_STARTUP 1 -#define EXPECTED_PRIM_COUNT 978 +#define EXPECTED_PRIM_COUNT 980 #define EXPECTED_UNSAFE_COUNT 65 #define EXPECTED_FLFXNUM_COUNT 53 diff --git a/src/mzscheme/src/schpriv.h b/src/mzscheme/src/schpriv.h index 0c5608bcf1..1ae4b99f25 100644 --- a/src/mzscheme/src/schpriv.h +++ b/src/mzscheme/src/schpriv.h @@ -708,19 +708,13 @@ Scheme_Object *scheme_make_struct_type_from_string(const char *base, Scheme_Object *props, Scheme_Object *guard, int immutable); -Scheme_Object *scheme_make_proc_struct_type(Scheme_Object *base, - Scheme_Object *parent, - Scheme_Object *inspector, - int num_fields, int num_uninit, - Scheme_Object *uninit_val, - Scheme_Object *proc_attr, - Scheme_Object *guard); Scheme_Object *scheme_struct_to_vector(Scheme_Object *_s, Scheme_Object *unknown_val, Scheme_Object *insp); Scheme_Object *scheme_extract_struct_procedure(Scheme_Object *obj, int num_rands, Scheme_Object **rands, int *is_method); Scheme_Object *scheme_proc_struct_name_source(Scheme_Object *a); +Scheme_Object *scheme_object_name(Scheme_Object *a); Scheme_Object *scheme_is_writable_struct(Scheme_Object *s); @@ -1914,7 +1908,7 @@ Scheme_Object *scheme_internal_read(Scheme_Object *port, Scheme_Object *stxsrc, Scheme_Object *delay_load_info); void scheme_internal_display(Scheme_Object *obj, Scheme_Object *port); void scheme_internal_write(Scheme_Object *obj, Scheme_Object *port); -void scheme_internal_print(Scheme_Object *obj, Scheme_Object *port); +void scheme_internal_print(Scheme_Object *obj, Scheme_Object *port, Scheme_Object *quote_depth); Scheme_Object *scheme_read_language(Scheme_Object *port, int nonlang_ok); diff --git a/src/mzscheme/src/schvers.h b/src/mzscheme/src/schvers.h index 3b2cffeec1..50251fd7d1 100644 --- a/src/mzscheme/src/schvers.h +++ b/src/mzscheme/src/schvers.h @@ -13,12 +13,12 @@ consistently.) */ -#define MZSCHEME_VERSION "4.2.5.4" +#define MZSCHEME_VERSION "4.2.5.5" #define MZSCHEME_VERSION_X 4 #define MZSCHEME_VERSION_Y 2 #define MZSCHEME_VERSION_Z 5 -#define MZSCHEME_VERSION_W 4 +#define MZSCHEME_VERSION_W 5 #define MZSCHEME_VERSION_MAJOR ((MZSCHEME_VERSION_X * 100) + MZSCHEME_VERSION_Y) #define MZSCHEME_VERSION_MINOR ((MZSCHEME_VERSION_Z * 1000) + MZSCHEME_VERSION_W) diff --git a/src/mzscheme/src/struct.c b/src/mzscheme/src/struct.c index 50bafff092..f78b29bdd7 100644 --- a/src/mzscheme/src/struct.c +++ b/src/mzscheme/src/struct.c @@ -171,11 +171,11 @@ static Scheme_Object *make_prefab_key(Scheme_Struct_Type *type); #define icons scheme_make_pair #define _intern scheme_intern_symbol -#define BUILTIN_STRUCT_FLAGS SCHEME_STRUCT_EXPTIME | SCHEME_STRUCT_NO_SET -#define LOC_STRUCT_FLAGS BUILTIN_STRUCT_FLAGS | SCHEME_STRUCT_NO_SET +#define BUILTIN_STRUCT_FLAGS SCHEME_STRUCT_NO_SET | SCHEME_STRUCT_EXPTIME #define TYPE_NAME(base, blen) make_name("struct:", base, blen, "", NULL, 0, "", 1) -#define CSTR_NAME(base, blen) make_name("make-", base, blen, "", NULL, 0, "", 1) +#define CSTR_NAME(base, blen) make_name("", base, blen, "", NULL, 0, "", 1) +#define CSTR_MAKE_NAME(base, blen) make_name("make-", base, blen, "", NULL, 0, "", 1) #define PRED_NAME(base, blen) make_name("", base, blen, "?", NULL, 0, "", 1) #define GET_NAME(base, blen, field, flen, sym) make_name("", base, blen, "-", field, flen, "", sym) #define SET_NAME(base, blen, field, flen, sym) make_name("set-", base, blen, "-", field, flen, "!", sym) @@ -207,8 +207,8 @@ scheme_init_struct (Scheme_Env *env) READ_ONLY static const char *arity_fields[1] = { "value" }; #ifdef TIME_SYNTAX READ_ONLY static const char *date_fields[10] = { "second", "minute", "hour", - "day", "month", "year", - "week-day", "year-day", "dst?", "time-zone-offset" }; + "day", "month", "year", + "week-day", "year-day", "dst?", "time-zone-offset" }; #endif READ_ONLY static const char *location_fields[10] = { "source", "line", "column", "position", "span" }; @@ -259,10 +259,10 @@ scheme_init_struct (Scheme_Env *env) loc_names = scheme_make_struct_names_from_array("srcloc", 5, location_fields, - LOC_STRUCT_FLAGS, &loc_count); + BUILTIN_STRUCT_FLAGS, &loc_count); loc_values = scheme_make_struct_values(location_struct, loc_names, loc_count, - LOC_STRUCT_FLAGS); + BUILTIN_STRUCT_FLAGS); for (i = 0; i < loc_count - 1; i++) { scheme_add_global_constant(scheme_symbol_val(loc_names[i]), loc_values[i], env); @@ -405,7 +405,7 @@ scheme_init_struct (Scheme_Env *env) REGISTER_SO(scheme_make_struct_type_proc); scheme_make_struct_type_proc = scheme_make_prim_w_arity2(make_struct_type, "make-struct-type", - 4, 10, + 4, 11, 5, 5); scheme_add_global_constant("make-struct-type", @@ -504,7 +504,7 @@ scheme_init_struct (Scheme_Env *env) scheme_add_global_constant("struct-type-make-constructor", scheme_make_prim_w_arity(struct_type_constr, "struct-type-make-constructor", - 1, 1), + 1, 2), env); scheme_add_global_constant("struct->vector", scheme_make_prim_w_arity(struct_to_vector, @@ -1530,6 +1530,8 @@ int scheme_is_set_transformer(Scheme_Object *o) } static int is_proc_1(Scheme_Object *o) { return (SCHEME_PROCP(o) && scheme_check_proc_arity(NULL, 1, -1, 0, &o)); } +static int is_proc_1_or_2(Scheme_Object *o) { return (SCHEME_PROCP(o) && (scheme_check_proc_arity(NULL, 1, -1, 0, &o) + || scheme_check_proc_arity(NULL, 2, -1, 0, &o))); } Scheme_Object *signal_bad_syntax(int argc, Scheme_Object **argv) { @@ -1537,6 +1539,14 @@ Scheme_Object *signal_bad_syntax(int argc, Scheme_Object **argv) return NULL; } +static Scheme_Object *chain_transformer(void *data, int argc, Scheme_Object *argv[]) +{ + Scheme_Object *a[2], *v = (Scheme_Object *)data; + a[0] = SCHEME_CAR(v); + a[1] = argv[0]; + return _scheme_tail_apply(SCHEME_CDR(v), 2, a); +} + Scheme_Object *scheme_set_transformer_proc(Scheme_Object *o) { if (SAME_TYPE(SCHEME_TYPE(o), scheme_set_macro_type)) @@ -1551,6 +1561,11 @@ Scheme_Object *scheme_set_transformer_proc(Scheme_Object *o) "bad-syntax-set!-transformer", 1, 1); } + } else if (!scheme_check_proc_arity(NULL, 1, -1, 0, &v)) { + /* Must be a procedure of 2 arguments. Reduce to a procedure of 1. */ + o = scheme_make_pair(o, v); + v = scheme_make_closed_prim_w_arity(chain_transformer, (void *)o, + "set!-transformer", 1, 1); } return v; } @@ -1560,8 +1575,8 @@ Scheme_Object *scheme_set_transformer_proc(Scheme_Object *o) static Scheme_Object *check_set_transformer_property_value_ok(int argc, Scheme_Object *argv[]) { return check_indirect_property_value_ok("guard-for-prop:set!-transformer", - is_proc_1, - "property value is not an procedure (arity 1) or exact non-negative integer: ", + is_proc_1_or_2, + "property value is not an procedure (arity 1 or 2) or exact non-negative integer: ", argc, argv); } @@ -2485,9 +2500,17 @@ static Scheme_Object *struct_type_constr(int argc, Scheme_Object *argv[]) else stype = (Scheme_Struct_Type *)argv[0]; + if ((argc < 2) || SCHEME_FALSEP(argv[1])) + v = CSTR_MAKE_NAME(scheme_symbol_val(stype->name), SCHEME_SYM_LEN(stype->name)); + else if (SCHEME_SYMBOLP(argv[1])) + v = argv[1]; + else { + scheme_wrong_type("struct-type-make-constructor", "symbol", 1, argc, argv); + return NULL; + } + v = make_struct_proc(stype, - scheme_symbol_val(CSTR_NAME(scheme_symbol_val(stype->name), - SCHEME_SYM_LEN(stype->name))), + scheme_symbol_val(v), SCHEME_CONSTR, stype->num_slots); @@ -3200,7 +3223,10 @@ static Scheme_Object **_make_struct_names(const char *base, int blen, } if (!(flags & SCHEME_STRUCT_NO_CONSTR)) { Scheme_Object *nm; - nm = CSTR_NAME(base, blen); + if (flags & SCHEME_STRUCT_NO_MAKE_PREFIX) + nm = CSTR_NAME(base, blen); + else + nm = CSTR_MAKE_NAME(base, blen); names[pos++] = nm; } if (!(flags & SCHEME_STRUCT_NO_PRED)) { @@ -3615,15 +3641,15 @@ static Scheme_Struct_Type *scheme_make_prefab_struct_type(Scheme_Object *base, } static Scheme_Object *_make_struct_type(Scheme_Object *base, - Scheme_Object *parent, - Scheme_Object *inspector, - int num_fields, - int num_uninit_fields, - Scheme_Object *uninit_val, - Scheme_Object *props, - Scheme_Object *proc_attr, + Scheme_Object *parent, + Scheme_Object *inspector, + int num_fields, + int num_uninit_fields, + Scheme_Object *uninit_val, + Scheme_Object *props, + Scheme_Object *proc_attr, char *immutable_array, - Scheme_Object *guard) + Scheme_Object *guard) { Scheme_Struct_Type *struct_type, *parent_type; int j, depth, checked_proc = 0; @@ -3711,7 +3737,7 @@ static Scheme_Object *_make_struct_type(Scheme_Object *base, p = SCHEME_INT_VAL(proc_attr); if (p < ni) { if (!immutable_array) { - immutable_array= (char *)scheme_malloc_atomic(n); + immutable_array = (char *)scheme_malloc_atomic(n); memset(immutable_array, 0, n); } immutable_array[p] = 1; @@ -3911,19 +3937,21 @@ Scheme_Object *scheme_make_struct_type(Scheme_Object *base, guard); } -Scheme_Object *scheme_make_proc_struct_type(Scheme_Object *base, - Scheme_Object *parent, - Scheme_Object *inspector, - int num_fields, int num_uninit, - Scheme_Object *uninit_val, - Scheme_Object *proc_attr, - Scheme_Object *guard) +Scheme_Object *scheme_make_struct_type2(Scheme_Object *base, + Scheme_Object *parent, + Scheme_Object *inspector, + int num_fields, int num_uninit, + Scheme_Object *uninit_val, + Scheme_Object *properties, + Scheme_Object *proc_attr, + char *immutable_array, + Scheme_Object *guard) { return _make_struct_type(base, parent, inspector, num_fields, num_uninit, - uninit_val, scheme_null, - proc_attr, NULL, + uninit_val, properties, + proc_attr, immutable_array, guard); } @@ -4045,7 +4073,7 @@ static char* immutable_pos_list_to_immutable_array(Scheme_Object *immutable_pos_ static Scheme_Object *make_struct_type(int argc, Scheme_Object **argv) { int initc, uninitc, num_props = 0, prefab = 0; - Scheme_Object *props = scheme_null, *l, *a, **r; + Scheme_Object *props = scheme_null, *l, *a, **r, *cstr_name = NULL; Scheme_Object *inspector = NULL, *uninit_val; Scheme_Struct_Type *type; Scheme_Object *proc_attr = NULL, *immutable_pos_list = scheme_null, *guard = NULL; @@ -4133,6 +4161,14 @@ static Scheme_Object *make_struct_type(int argc, Scheme_Object **argv) if (!SCHEME_PROCP(guard)) scheme_wrong_type("make-struct-type", "procedure or #f", 9, argc, argv); } + + if (argc > 10) { + if (!SCHEME_FALSEP(argv[10])) { + if (!SCHEME_SYMBOLP(argv[10])) + scheme_wrong_type("make-struct-type", "symbol or #f", 10, argc, argv); + cstr_name = argv[10]; + } + } } } } @@ -4173,31 +4209,33 @@ static Scheme_Object *make_struct_type(int argc, Scheme_Object **argv) } type = scheme_make_prefab_struct_type(argv[0], - SCHEME_FALSEP(argv[1]) ? NULL : argv[1], - initc, uninitc, - uninit_val, - immutable_array); - } - else { + SCHEME_FALSEP(argv[1]) ? NULL : argv[1], + initc, uninitc, + uninit_val, + immutable_array); + } else { type = (Scheme_Struct_Type *)_make_struct_type(argv[0], - SCHEME_FALSEP(argv[1]) ? NULL : argv[1], - inspector, - initc, uninitc, - uninit_val, props, - proc_attr, - immutable_array, - guard); + SCHEME_FALSEP(argv[1]) ? NULL : argv[1], + inspector, + initc, uninitc, + uninit_val, props, + proc_attr, + immutable_array, + guard); } + { int i; Scheme_Object **names; names = scheme_make_struct_names(argv[0], - NULL, - SCHEME_STRUCT_GEN_GET | SCHEME_STRUCT_GEN_SET, - &i); + NULL, + SCHEME_STRUCT_GEN_GET | SCHEME_STRUCT_GEN_SET, + &i); + if (cstr_name) + names[1] = cstr_name; r = scheme_make_struct_values((Scheme_Object *)type, names, i, - SCHEME_STRUCT_GEN_GET | SCHEME_STRUCT_GEN_SET); + SCHEME_STRUCT_GEN_GET | SCHEME_STRUCT_GEN_SET); return scheme_values(i, r); } diff --git a/src/mzscheme/src/thread.c b/src/mzscheme/src/thread.c index 158b3e5b4c..108c7cf79d 100644 --- a/src/mzscheme/src/thread.c +++ b/src/mzscheme/src/thread.c @@ -6624,6 +6624,8 @@ static void make_initial_config(Scheme_Thread *p) init_param(cells, paramz, MZCONFIG_PRINT_UNREADABLE, scheme_true); init_param(cells, paramz, MZCONFIG_PRINT_PAIR_CURLY, scheme_false); init_param(cells, paramz, MZCONFIG_PRINT_MPAIR_CURLY, scheme_true); + init_param(cells, paramz, MZCONFIG_PRINT_READER, scheme_false); + init_param(cells, paramz, MZCONFIG_PRINT_AS_QQ, scheme_false); init_param(cells, paramz, MZCONFIG_PRINT_SYNTAX_WIDTH, scheme_make_integer(32)); init_param(cells, paramz, MZCONFIG_HONU_MODE, scheme_false); From 3d9806a606d893c2952ed86707cc05ef03d3cd2f Mon Sep 17 00:00:00 2001 From: Casey Klein Date: Sat, 3 Apr 2010 00:54:55 +0000 Subject: [PATCH 064/202] Forces sequences to have length zero when the depth is zero svn: r18726 --- collects/redex/private/rg.ss | 4 +++- collects/redex/tests/rg-test.ss | 35 +++++++++++++++++++-------------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/collects/redex/private/rg.ss b/collects/redex/private/rg.ss index e93860036c..3ad9dcc37c 100644 --- a/collects/redex/private/rg.ss +++ b/collects/redex/private/rg.ss @@ -340,7 +340,9 @@ (λ (r s a e h) (let*-values ([(len) (let ([prior (hash-ref e class #f)]) - (if prior prior ((next-sequence-decision) a)))] + (if prior + prior + (if (zero? s) 0 ((next-sequence-decision) a))))] [(seq env) (generate-sequence (λ (e h) (elemg r s a e h)) e vars len)] [(tail env) diff --git a/collects/redex/tests/rg-test.ss b/collects/redex/tests/rg-test.ss index 2abeac5b60..93285bb1e1 100644 --- a/collects/redex/tests/rg-test.ss +++ b/collects/redex/tests/rg-test.ss @@ -526,6 +526,14 @@ (if (= attempt finish) 0 'x)))) (test attempts (list finish retry-threshold start)))) +;; At size zero, a sequence length must be zero; otherwise, +;; we risk increasing the problem size. +(let () + (define-language L + (a (a ...))) + (test (generate-term/decisions L a 0 1 (decisions #:seq '())) + (term ()))) + ;; output : (-> (-> void) string) (define (output thunk) (let ([p (open-output-string)]) @@ -692,24 +700,26 @@ ;; check-metafunction-contract (let () - (define-language empty) - (define-metafunction empty + (define-language L + (C hole (1 hole))) + + (define-metafunction L f : (side-condition number_1 (odd? (term number_1))) -> number [(f 1) 1] [(f 3) 'NaN]) - (define-metafunction empty - g : number ... -> (any ...) - [(g number_1 ... 1 number_2 ...) (number_1 ...)]) + (define-metafunction L + g : (1 1) -> C + [(g (in-hole C any)) C]) - (define-metafunction empty + (define-metafunction L h : number -> number [(h any) any]) - (define-metafunction empty + (define-metafunction L [(i any ...) (any ...)]) - (define-metafunction empty + (define-metafunction L j : (side-condition any #f) -> any [(j any ...) (any ...)]) @@ -728,13 +738,8 @@ (check-metafunction-contract f)))) #rx"counterexample found after 1 attempt:\n\\(3\\)\n") ;; LHS matches multiple ways - (test (output - (λ () - (parameterize ([generation-decisions - (decisions #:num (list (λ _ 1) (λ _ 1)) - #:seq (list (λ _ 2)))]) - (check-metafunction-contract g)))) - #rx"counterexample found after 1 attempt:\n\\(1 1\\)\n") + (test (output (λ () (check-metafunction-contract g))) + #rx"counterexample found after 1 attempt:\n\\(\\(1 1\\)\\)\n") ;; OK -- generated from Dom(h) (test (output (λ () (check-metafunction-contract h))) #rx"no counterexamples") ;; OK -- generated from pattern (any ...) From 8e36e8e3eb70e007b043a9f3873c7536b4603080 Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Sat, 3 Apr 2010 07:50:06 +0000 Subject: [PATCH 065/202] Welcome to a new PLT day. svn: r18728 --- collects/repos-time-stamp/stamp.ss | 2 +- src/worksp/mred/mred.manifest | 2 +- src/worksp/mred/mred.rc | 8 ++++---- src/worksp/mzcom/mzcom.rc | 8 ++++---- src/worksp/mzcom/mzobj.rgs | 6 +++--- src/worksp/mzscheme/mzscheme.rc | 8 ++++---- src/worksp/starters/start.rc | 8 ++++---- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/collects/repos-time-stamp/stamp.ss b/collects/repos-time-stamp/stamp.ss index 71318cfbb3..4ef2b3d349 100644 --- a/collects/repos-time-stamp/stamp.ss +++ b/collects/repos-time-stamp/stamp.ss @@ -1 +1 @@ -#lang scheme/base (provide stamp) (define stamp "2apr2010") +#lang scheme/base (provide stamp) (define stamp "3apr2010") diff --git a/src/worksp/mred/mred.manifest b/src/worksp/mred/mred.manifest index 9be6cf46d6..cc34f01eb9 100644 --- a/src/worksp/mred/mred.manifest +++ b/src/worksp/mred/mred.manifest @@ -1,7 +1,7 @@ Date: Sat, 3 Apr 2010 11:59:26 +0000 Subject: [PATCH 066/202] fix module-laguage info from scribble/doc svn: r18729 --- collects/scribble/doc/lang/reader.ss | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/collects/scribble/doc/lang/reader.ss b/collects/scribble/doc/lang/reader.ss index 8d082a9be4..0568ed9de0 100644 --- a/collects/scribble/doc/lang/reader.ss +++ b/collects/scribble/doc/lang/reader.ss @@ -1,8 +1,14 @@ #lang scheme/base (require (prefix-in doc: scribble/doc/reader)) -(provide (rename-out [doc:read read] [doc:read-syntax read-syntax]) +(provide (rename-out [doc:read read] + [my:read-syntax read-syntax]) get-info) +(define (my:read-syntax . args) + (let ([s (apply doc:read-syntax args)]) + ;; For now, remove the 'module-language property added by `doc:read-syntax' + (syntax-property s 'module-language #f))) + (define (get-info . args) (lambda (key defval) (case key From 3cc95b31efa28447ecf1804f1a00bd8db9638df1 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sat, 3 Apr 2010 13:08:39 +0000 Subject: [PATCH 067/202] add prop:struct-info svn: r18730 --- collects/scheme/private/struct-info.ss | 48 +++++++++++++++------ collects/scribblings/reference/struct.scrbl | 33 +++++++++----- collects/tests/mzscheme/struct.ss | 28 ++++++++++++ 3 files changed, 86 insertions(+), 23 deletions(-) diff --git a/collects/scheme/private/struct-info.ss b/collects/scheme/private/struct-info.ss index 8ccef0325c..067feef6cb 100644 --- a/collects/scheme/private/struct-info.ss +++ b/collects/scheme/private/struct-info.ss @@ -8,7 +8,18 @@ (#%provide make-struct-info struct-info? extract-struct-info - struct:struct-info) + struct:struct-info + prop:struct-info) + + (define-values (prop:struct-info has-struct-info-prop? struct-info-prop-ref) + (make-struct-type-property 'struct-info + (lambda (v type-info) + (if (and (procedure? v) + (procedure-arity-includes? v 1)) + v + (raise-type-error 'guard-for-prop:struct-info + "procedure (arity 1)" + v))))) (define-values (struct:struct-info make-struct-info struct-info-rec? struct-info-ref struct-info-set!) @@ -31,21 +42,34 @@ (define-values (extract-struct-info) (lambda (si) - (if (struct-info-rec? si) - (let ([p (struct-info-ref si 0)]) - (let ([v (p)]) - (if (struct-declaration-info? v) - v - (error 'extract-struct-info - "struct-info procedure result not properly formed: ~e" - v)))) - (if (set!-transformer? si) - (extract-struct-info (set!-transformer-procedure si)) - si)))) + (cond + [(struct-info-rec? si) + (let ([p (struct-info-ref si 0)]) + (let ([v (p)]) + (if (struct-declaration-info? v) + v + (error 'extract-struct-info + "struct-info procedure result not properly formed: ~e" + v))))] + [(has-struct-info-prop? si) + (let ([v ((struct-info-prop-ref si) si)]) + (if (struct-declaration-info? v) + v + (error 'extract-struct-info + "prop:struct-info procedure result not properly formed: ~e" + v)))] + [(set!-transformer? si) + (extract-struct-info (set!-transformer-procedure si))] + [(struct-declaration-info? si) si] + [else (raise-type-error 'extract-struct-info + "struct-info" + si)]))) (define-values (struct-info?) (lambda (si) (or (struct-info-rec? si) + (and (has-struct-info-prop? si) + (not (struct-type? si))) (struct-declaration-info? si) (and (set!-transformer? si) (struct-info-rec? (set!-transformer-procedure si)))))) diff --git a/collects/scribblings/reference/struct.scrbl b/collects/scribblings/reference/struct.scrbl index b2191d06ab..951c6d9aab 100644 --- a/collects/scribblings/reference/struct.scrbl +++ b/collects/scribblings/reference/struct.scrbl @@ -318,7 +318,7 @@ Creates a new structure type property and returns three values: If the optional @scheme[guard] is supplied as a procedure, it is called by @scheme[make-struct-type] before attaching the property to a -new structure type. The @scheme[guard-proc] must accept two arguments: +new structure type. The @scheme[guard] must accept two arguments: a value for the property supplied to @scheme[make-struct-type], and a list containing information about the new structure type. The list contains the values that @scheme[struct-type-info] would return for @@ -596,14 +596,17 @@ encapsulated procedure must return): ] -Instead of this direct representation, the representation can -be a structure created by @scheme[make-struct-info] (or an instance of -a subtype of @scheme[struct:struct-info]), which encapsulates a +Instead of this direct representation, the representation can be a +structure created by @scheme[make-struct-info] (or an instance of a +subtype of @scheme[struct:struct-info]), which encapsulates a procedure that takes no arguments and returns a list of six -elements. Finally, the representation can be an instance of a -structure type derived from @scheme[struct:struct-info] that also -implements @scheme[prop:procedure], and where the instance is further -is wrapped by @scheme[make-set!-transformer]. +elements. Alternately, the representation can be a structure whose +type has the @scheme[prop:struct-info] @tech{structure type property}. +Finally, the representation can be an instance of a structure type +derived from @scheme[struct:struct-info] or with the +@scheme[prop:struct-info] property that also implements +@scheme[prop:procedure], and where the instance is further is wrapped +by @scheme[make-set!-transformer]. Use @scheme[struct-info?] to recognize all allowed forms of the information, and use @scheme[extract-struct-info] to obtain a list @@ -626,9 +629,10 @@ type. Returns @scheme[#t] if @scheme[v] is either a six-element list with the correct shape for representing structure-type information, a -procedure encapsulated by @scheme[make-struct-info], or a structure -type derived from @scheme[struct:struct-info] and wrapped with -@scheme[make-set!-transformer].} +procedure encapsulated by @scheme[make-struct-info], a structure with +the @scheme[prop:struct-info] property, or a structure type derived +from @scheme[struct:struct-info] or with @scheme[prop:struct-info] and +wrapped with @scheme[make-set!-transformer].} @defproc[(checked-struct-info? [v any/c]) boolean?]{ @@ -657,6 +661,13 @@ mostly useful for creating structure subtypes. The structure type includes a guard that checks an instance's first field in the same way as @scheme[make-struct-info].} +@defthing[prop:struct-info struct-type-property?]{ + +The @tech{structure type property} for creating new structure types +like @scheme[struct:struct-info]. The property value must a procedure +of one argument that takes an instance structure and returns +structure-type information in list form.} + @; ---------------------------------------------------------------------- @close-eval[struct-eval] diff --git a/collects/tests/mzscheme/struct.ss b/collects/tests/mzscheme/struct.ss index cd2cb095c8..f4ad365af6 100644 --- a/collects/tests/mzscheme/struct.ss +++ b/collects/tests/mzscheme/struct.ss @@ -977,4 +977,32 @@ ;; ---------------------------------------- +(require (for-syntax scheme/struct-info)) + +(let () + (define-struct a (x y)) + (define-syntax foo (make-struct-info + (lambda () + (list #'struct:a #'make-a #'a? + (list #'a-y #'a-x) + (list #f #f) + #f)))) + (define-syntax foo2 (let () + (define-struct si (pred) + #:property + prop:struct-info + (lambda (v) + (list #'struct:a #'make-a (si-pred v) + (list #'a-y #'a-x) + (list #f #f) + #f))) + (make-si #'a?))) + (test (list 1 2) 'match (match (make-a 1 2) + [(struct foo (x y)) (list x y)])) + (test (list 1 2) 'match (match (make-a 1 2) + [(struct foo2 (x y)) (list x y)]))) + + +;; ---------------------------------------- + (report-errs) From fdd42be5d9551d1f7e0cc39c60828e27f797633e Mon Sep 17 00:00:00 2001 From: Ryan Culpepper Date: Sat, 3 Apr 2010 23:00:37 +0000 Subject: [PATCH 068/202] syntax/parse: fixed bug (thanks Jay!) some internal additions/changes svn: r18731 --- collects/syntax/private/stxparse/parse.ss | 8 ++++--- .../syntax/private/stxparse/rep-patterns.ss | 8 +++---- collects/syntax/private/stxparse/rep.ss | 24 ++++++++++++------- collects/syntax/private/stxparse/runtime.ss | 2 ++ collects/syntax/private/stxparse/sc.ss | 1 + 5 files changed, 27 insertions(+), 16 deletions(-) diff --git a/collects/syntax/private/stxparse/parse.ss b/collects/syntax/private/stxparse/parse.ss index f38b30c5a7..ec5f70cc05 100644 --- a/collects/syntax/private/stxparse/parse.ss +++ b/collects/syntax/private/stxparse/parse.ss @@ -365,9 +365,11 @@ #`(with-enclosing-fail enclosing-cut-fail k)] [#s(ghost:bind _ clauses) #`(convert-sides x clauses (clause-success () k))] - [#s(ghost:fail _ condition message) + [#s(ghost:fail _ early? condition message) #`(let* ([c (without-fails condition)] - [fc* (dfc-add-post fc (if (syntax? c) c x))]) + [fc* (if (quote early?) + fc + (dfc-add-post fc (if (syntax? c) c x)))]) (if c (fail (if (syntax? c) c x) #:expect (expectation pattern0) @@ -633,7 +635,7 @@ #'(collect-error 'ineffable)] [(_ #s(pat:not _ pattern)) #'(collect-error 'ineffable)] - [(_ #s(ghost:fail _ condition message)) + [(_ #s(ghost:fail _ _e condition message)) #'(expectation-of-message message)])) ;; ---- diff --git a/collects/syntax/private/stxparse/rep-patterns.ss b/collects/syntax/private/stxparse/rep-patterns.ss index b789e7235b..ac2d34839f 100644 --- a/collects/syntax/private/stxparse/rep-patterns.ss +++ b/collects/syntax/private/stxparse/rep-patterns.ss @@ -52,7 +52,7 @@ A ListPattern is a subtype of SinglePattern; one of #| A GhostPattern is one of (make-ghost:cut Base) - (make-ghost:fail Base stx stx) + (make-ghost:fail Base bool stx stx) (make-ghost:bind Base (listof clause:attr)) * (make-ghost:and Base (listof GhostPattern)) (make-ghost:parse Base SinglePattern stx) @@ -61,7 +61,7 @@ ghost:and is desugared below in create-* procedures |# (define-struct ghost:cut (attrs) #:prefab) -(define-struct ghost:fail (attrs when message) #:prefab) +(define-struct ghost:fail (attrs early? when message) #:prefab) (define-struct ghost:bind (attrs clauses) #:prefab) (define-struct ghost:and (attrs patterns) #:prefab) (define-struct ghost:parse (attrs pattern expr) #:prefab) @@ -227,8 +227,8 @@ A Kind is one of (define (create-ghost:cut) (make ghost:cut null)) -(define (create-ghost:fail condition message) - (make ghost:fail null condition message)) +(define (create-ghost:fail early? condition message) + (make ghost:fail null early? condition message)) (define (create-ghost:and patterns) (let ([attrs (append-iattrs (map pattern-attrs patterns))]) diff --git a/collects/syntax/private/stxparse/rep.ss b/collects/syntax/private/stxparse/rep.ss index 8050721f7d..0e055c1709 100644 --- a/collects/syntax/private/stxparse/rep.ss +++ b/collects/syntax/private/stxparse/rep.ss @@ -92,6 +92,7 @@ (quote-syntax ~!) (quote-syntax ~bind) (quote-syntax ~fail) + (quote-syntax ~early-fail) (quote-syntax ~parse) (quote-syntax ...+))) @@ -341,7 +342,7 @@ [else (wrong-syntax stx "action pattern not allowed here")])) (syntax-case stx (~var ~literal ~datum ~and ~or ~not ~rest ~describe - ~seq ~optional ~! ~bind ~fail ~parse) + ~seq ~optional ~! ~bind ~fail ~early-fail ~parse) [wildcard (wildcard? #'wildcard) (begin (disappeared! stx) @@ -401,7 +402,11 @@ [(~fail . rest) (disappeared! stx) (check-ghost! - (parse-pat:fail stx decls))] + (parse-pat:fail stx decls #f))] + [(~early-fail . rest) + (disappeared! stx) + (check-ghost! + (parse-pat:fail stx decls #t))] [(~parse . rest) (disappeared! stx) (check-ghost! @@ -726,7 +731,7 @@ (append-iattrs (side-clauses-attrss clauses)) clauses))])) -(define (parse-pat:fail stx decls) +(define (parse-pat:fail stx decls early?) (syntax-case stx () [(_ . rest) (let-values ([(chunks rest) @@ -743,7 +748,7 @@ #`(not #,(caddr chunk)))))]) (syntax-case rest () [(message) - (create-ghost:fail condition #'message)] + (create-ghost:fail early? condition #'message)] [() (wrong-syntax stx "missing message expression")] [_ @@ -843,11 +848,12 @@ "expected exact nonnegative integer or +inf.0")) (when (> minN maxN) (wrong-syntax stx "minimum larger than maximum repetition constraint")) - (let ([chunks (parse-keyword-options #'options - (list (list '#:too-few check-expression) - (list '#:too-many check-expression) - (list '#:name check-expression)) - #:context stx)]) + (let ([chunks (parse-keyword-options/eol + #'options + (list (list '#:too-few check-expression) + (list '#:too-many check-expression) + (list '#:name check-expression)) + #:context stx)]) (let ([too-few-msg (options-select-value chunks '#:too-few #:default #'#f)] [too-many-msg diff --git a/collects/syntax/private/stxparse/runtime.ss b/collects/syntax/private/stxparse/runtime.ss index 37924ecf50..53bcb283a7 100644 --- a/collects/syntax/private/stxparse/runtime.ss +++ b/collects/syntax/private/stxparse/runtime.ss @@ -27,6 +27,7 @@ ~! ~bind ~fail + ~early-fail ~parse ...+ @@ -93,6 +94,7 @@ (define-keyword ~!) (define-keyword ~bind) (define-keyword ~fail) +(define-keyword ~early-fail) (define-keyword ~parse) (define-keyword ...+) diff --git a/collects/syntax/private/stxparse/sc.ss b/collects/syntax/private/stxparse/sc.ss index 824cb344bf..2a50158235 100644 --- a/collects/syntax/private/stxparse/sc.ss +++ b/collects/syntax/private/stxparse/sc.ss @@ -44,6 +44,7 @@ ~! ~bind ~fail + ;; ~early-fail ~parse ...+ From a360b554ce39d1198e4dc5991b614f3fa7deab7d Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Sun, 4 Apr 2010 07:50:36 +0000 Subject: [PATCH 069/202] Welcome to a new PLT day. svn: r18732 --- collects/repos-time-stamp/stamp.ss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collects/repos-time-stamp/stamp.ss b/collects/repos-time-stamp/stamp.ss index 4ef2b3d349..79bf939857 100644 --- a/collects/repos-time-stamp/stamp.ss +++ b/collects/repos-time-stamp/stamp.ss @@ -1 +1 @@ -#lang scheme/base (provide stamp) (define stamp "3apr2010") +#lang scheme/base (provide stamp) (define stamp "4apr2010") From fdba97b1c09d8c338f0d069f17741211917758d5 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sun, 4 Apr 2010 15:08:35 +0000 Subject: [PATCH 070/202] rico svn: r18733 --- collects/compiler/commands/c-ext.ss | 398 ++++++++++++++++++ collects/compiler/commands/decompile.ss | 25 ++ collects/compiler/commands/exe-dir.ss | 31 ++ collects/compiler/commands/exe.ss | 90 ++++ collects/compiler/commands/expand.ss | 26 ++ collects/compiler/commands/info.ss | 10 + collects/compiler/commands/make.ss | 79 ++++ collects/compiler/commands/pack.ss | 99 +++++ collects/compiler/distribute.ss | 33 +- collects/meta/dist-specs.ss | 3 + collects/planet/info.ss | 2 + collects/planet/planet.ss | 3 +- collects/rico/command-name.ss | 23 + collects/rico/info.ss | 6 + collects/rico/main.lch | 5 + collects/rico/main.ss | 23 + collects/rico/rico.ss | 111 +++++ .../scribblings/reference/filesystem.scrbl | 3 +- collects/setup/info.ss | 2 + collects/setup/main.ss | 4 +- collects/setup/option-sig.ss | 3 +- collects/setup/option-unit.ss | 2 + collects/setup/setup-cmdline.ss | 21 +- collects/setup/setup-go.ss | 4 +- collects/setup/setup-unit.ss | 21 +- 25 files changed, 994 insertions(+), 33 deletions(-) create mode 100644 collects/compiler/commands/c-ext.ss create mode 100644 collects/compiler/commands/decompile.ss create mode 100644 collects/compiler/commands/exe-dir.ss create mode 100644 collects/compiler/commands/exe.ss create mode 100644 collects/compiler/commands/expand.ss create mode 100644 collects/compiler/commands/info.ss create mode 100644 collects/compiler/commands/make.ss create mode 100644 collects/compiler/commands/pack.ss create mode 100644 collects/rico/command-name.ss create mode 100644 collects/rico/info.ss create mode 100644 collects/rico/main.lch create mode 100644 collects/rico/main.ss create mode 100644 collects/rico/rico.ss diff --git a/collects/compiler/commands/c-ext.ss b/collects/compiler/commands/c-ext.ss new file mode 100644 index 0000000000..50dbbea93a --- /dev/null +++ b/collects/compiler/commands/c-ext.ss @@ -0,0 +1,398 @@ +#lang scheme/base + +;; On error, exit with 1 status code +(error-escape-handler (lambda () (exit 1))) + +(error-print-width 512) + +(require (prefix-in compiler:option: "../option.ss") + "../compiler.ss" + rico/command-name + mzlib/cmdline + dynext/file + dynext/compile + dynext/link + scheme/pretty + setup/pack + setup/getinfo + setup/dirs) + +(define dest-dir (make-parameter #f)) +(define auto-dest-dir (make-parameter #f)) + +(define ld-output (make-parameter #f)) + +(define exe-output (make-parameter #f)) +(define exe-embedded-flags (make-parameter '("-U" "--"))) +(define exe-embedded-libraries (make-parameter null)) +(define exe-aux (make-parameter null)) +(define exe-embedded-collects-path (make-parameter #f)) +(define exe-embedded-collects-dest (make-parameter #f)) +(define exe-dir-add-collects-dirs (make-parameter null)) + +(define exe-dir-output (make-parameter #f)) + +(define mods-output (make-parameter #f)) + +(define module-mode (make-parameter #f)) + +(define default-plt-name "archive") + +(define disable-inlining (make-parameter #f)) + +(define plt-output (make-parameter #f)) +(define plt-name (make-parameter default-plt-name)) +(define plt-files-replace (make-parameter #f)) +(define plt-files-plt-relative? (make-parameter #f)) +(define plt-files-plt-home-relative? (make-parameter #f)) +(define plt-force-install-dir? (make-parameter #f)) +(define plt-setup-collections (make-parameter null)) +(define plt-include-compiled (make-parameter #f)) + +(define stop-at-source (make-parameter #f)) + +(define (extract-suffix appender) + (bytes->string/latin-1 + (subbytes (path->bytes (appender (bytes->path #"x"))) 1))) + +(define ((add-to-param param) f v) (param (append (param) (list v)))) + +(define mzc-symbol (string->symbol (short-program+command-name))) + +;; Returns (values mode files prefixes) +;; where mode is 'compile, 'make-zo, etc. +(define-values (mode source-files prefix) + (parse-command-line + (short-program+command-name) + (current-command-line-arguments) + `([help-labels + "-------------------------------- mode flags ---------------------------------"] + [once-any + [("--cc") + ,(lambda (f) 'cc) + (,(format "Compile arbitrary file(s) for an extension: ~a -> ~a" + (extract-suffix append-c-suffix) + (extract-suffix append-object-suffix)))] + [("--ld") + ,(lambda (f name) (ld-output name) 'ld) + (,(format "Link arbitrary file(s) to create : ~a -> ~a" + (extract-suffix append-object-suffix) + (extract-suffix append-extension-suffix)) + "extension")] + [("-x" "--xform") + ,(lambda (f) 'xform) + ((,(format "Convert for 3m compilation: ~a -> ~a" + (extract-suffix append-c-suffix) + (extract-suffix append-c-suffix)) + ""))] + [("--c-mods") + ,(lambda (f name) (mods-output name) 'c-mods) + ((,(format "Write C-embeddable module bytecode to ") "") + "file")] + [("-e" "--extension") + ,(lambda (f) 'compile) + (,(format "Output ~a file(s) from Scheme source(s)" (extract-suffix append-extension-suffix)))] + [("-c" "--c-source") + ,(lambda (f) 'compile-c) + (,(format "Output ~a file(s) from Scheme source(s)" (extract-suffix append-c-suffix)))]] + [help-labels ""] + [once-any + [("--3m") + ,(lambda (f) (compiler:option:3m #t)) + (,(format "Compile/link for 3m~a" + (if (eq? '3m (system-type 'gc)) " [current default]" "")))] + [("--cgc") + ,(lambda (f) (compiler:option:3m #f)) + (,(format "Compile/link for CGC~a" + (if (eq? 'cgc (system-type 'gc)) " [current default]" "")))]] + [once-each + [("-m" "--module") + ,(lambda (f) (module-mode #t)) + ("Skip eval of top-level syntax, etc. for -e/-c")] + [("--embedded") + ,(lambda (f) (compiler:option:compile-for-embedded #t)) + ("Compile for embedded run-time engine, with -c")] + [("-p" "--prefix") + ,(lambda (f v) v) + ("Add elaboration-time prefix file for -e/-c/-z" "file")] + [("-n" "--name") + ,(lambda (f name) (compiler:option:setup-prefix name)) + ("Use as extra part of public low-level names" "name")]] + [once-any + [("-d" "--destination") + ,(lambda (f d) + (unless (directory-exists? d) + (error mzc-symbol "the destination directory does not exist: ~s" d)) + (dest-dir d)) + ("Output -e/-c/-x file(s) to " "dir")] + [("--auto-dir") + ,(lambda (f) (auto-dest-dir #t)) + (,(format "Output -e to ~s" + (path->string (build-path "compiled" "native" + (system-library-subpath #f)))))]] + [help-labels + "------------------- compiler/linker configuration flags ---------------------"] + [once-each + [("--tool") + ,(lambda (f v) + (let ([v (string->symbol v)]) + (use-standard-compiler v) + (use-standard-linker v))) + (,(format "Use pre-defined as C compiler/linker:~a" + (apply string-append + (apply append (map (lambda (t) + (list " " (symbol->string t))) + (get-standard-compilers))))) + "tool")] + [("--compiler") + ,(lambda (f v) (current-extension-compiler v)) + ("Use as C compiler" "compiler-path")]] + [multi + [("++ccf") + ,(add-to-param current-extension-compiler-flags) + ("Add C compiler flag" "flag")] + [("--ccf") + ,(lambda (f v) + (current-extension-compiler-flags + (remove v (current-extension-compiler-flags)))) + ("Remove C compiler flag" "flag")] + [("--ccf-clear") + ,(lambda (f) (current-extension-compiler-flags null)) + ("Clear C compiler flags")] + [("--ccf-show") + ,(lambda (f) + (printf "C compiler flags: ~s\n" + (expand-for-link-variant (current-extension-compiler-flags)))) + ("Show C compiler flags")]] + [once-each + [("--linker") + ,(lambda (f v) (current-extension-linker v)) + ("Use as C linker" "linker-path")]] + [multi + [("++ldf") + ,(add-to-param current-extension-linker-flags) + ("Add C linker flag" "flag")] + [("--ldf") + ,(lambda (f v) + (current-extension-linker-flags + (remove v (current-extension-linker-flags)))) + ("Remove C linker flag" "flag")] + [("--ldf-clear") + ,(lambda (f) (current-extension-linker-flags null)) + ("Clear C linker flags")] + [("--ldf-show") + ,(lambda (f) + (printf "C linker flags: ~s\n" + (expand-for-link-variant (current-extension-linker-flags)))) + ("Show C linker flags")] + [("++ldl") + ,(add-to-param current-standard-link-libraries) + ("Add C linker library" "lib")] + [("--ldl-show") + ,(lambda (f) + (printf "C linker libraries: ~s\n" + (expand-for-link-variant (current-standard-link-libraries)))) + ("Show C linker libraries")]] + [multi + [("++cppf") + ,(add-to-param current-extension-preprocess-flags) + ("Add C preprocess (xform) flag" "flag")] + [("--cppf") + ,(lambda (f v) + (current-extension-preprocess-flags + (remove v (current-extension-preprocess-flags)))) + ("Remove C preprocess (xform) flag" "flag")] + [("--cppf-clear") + ,(lambda (f) (current-extension-preprocess-flags null)) + ("Clear C preprocess (xform) flags")] + [("--cppf-show") + ,(lambda (f) + (printf "C compiler flags: ~s\n" + (expand-for-link-variant (current-extension-preprocess-flags)))) + ("Show C preprocess (xform) flags")]] + [help-labels + "-------------------- -c/-e compiler optimization flags ----------------------"] + [once-each + [("--no-prop") + ,(lambda (f) (compiler:option:propagate-constants #f)) + ("Don't propagate constants")] + [("--inline") + ,(lambda (f d) + (compiler:option:max-inline-size + (with-handlers ([void (lambda (x) + (error mzc-symbol "bad size for --inline: ~a" d))]) + (let ([v (string->number d)]) + (unless (and (not (negative? v)) (exact? v) (real? v)) + (error 'bad)) + v)))) + ("Set the maximum inlining size" "size")] + [("--no-prim") + ,(lambda (f) (compiler:option:assume-primitives #f)) + ("Do not assume `scheme' bindings at top level")] + [("--stupid") + ,(lambda (f) (compiler:option:stupid #t)) + ("Compile despite obvious non-syntactic errors")] + [("--unsafe-disable-interrupts") + ,(lambda (f) (compiler:option:disable-interrupts #t)) + ("Ignore threads, breaks, and stack overflow")] + [("--unsafe-skip-tests") + ,(lambda (f) (compiler:option:unsafe #t)) + ("Skip run-time tests for some primitive operations")] + [("--unsafe-fixnum-arithmetic") + ,(lambda (f) (compiler:option:fixnum-arithmetic #t)) + ("Assume fixnum arithmetic yields a fixnum")]] + [help-labels + "-------------------------- miscellaneous flags ------------------------------"] + [once-each + [("-v") + ,(lambda (f) (compiler:option:somewhat-verbose #t)) + ("Slightly verbose mode, including version banner and output files")] + [("--vv") + ,(lambda (f) (compiler:option:somewhat-verbose #t) (compiler:option:verbose #t)) + ("Very verbose mode")] + [("--save-temps") + ,(lambda (f) (compiler:option:clean-intermediate-files #f)) + ("Keep intermediate files")] + [("--debug") + ,(lambda (f) (compiler:option:debug #t)) + ("Write debugging output to dump.txt")]]) + (lambda (accum . files) + (let ([mode (let ([l (filter symbol? accum)]) + (if (null? l) + (error mzc-symbol "no mode flag specified") + (car l)))]) + (values + mode + files + (let ([prefixes (filter string? accum)]) + (unless (or (memq mode '(compile compile-c)) (null? prefixes)) + (error mzc-symbol "prefix files are not useful in ~a mode" mode)) + (if (module-mode) + (begin + (unless (compiler:option:assume-primitives) + (error mzc-symbol "--no-prim is not useful with -m or --module")) + (unless (null? prefixes) + (error mzc-symbol "prefix files not allowed with -m or --module")) + #f) + `(begin + (require scheme) + ,(if (compiler:option:assume-primitives) + '(void) + '(namespace-require/copy 'scheme)) + (require compiler/cffi) + ,@(map (lambda (s) `(load ,s)) prefixes) + (void))))))) + (list "file"))) + +(when (compiler:option:somewhat-verbose) + (printf "~a v~a [~a], Copyright (c) 2004-2010 PLT Scheme Inc.\n" + (short-program+command-name) + (version) + (system-type 'gc))) + +(when (and (auto-dest-dir) (not (memq mode '(zo compile)))) + (error mzc-symbol "--auto-dir works only with -z, --zo, -e, or --extension (or default mode)")) + +(define (never-embedded action) + (when (compiler:option:compile-for-embedded) + (error mzc-symbol "cannot ~a an extension for an embedded MzScheme" action))) + +(if (compiler:option:3m) + (begin (link-variant '3m) (compile-variant '3m)) + (begin (link-variant 'cgc) (compile-variant 'cgc))) + +(define (compiler-warning) + (fprintf (current-error-port) + "Warning: ~a\n ~a\n" + "compilation to C is usually less effective for performance" + "than relying on the bytecode just-in-time compiler.")) + +(case mode + [(compile) + (compiler-warning) + (never-embedded "compile") + ((compile-extensions prefix) + source-files + (if (auto-dest-dir) 'auto (dest-dir)))] + [(compile-c) + ((compile-extensions-to-c prefix) source-files (dest-dir))] + [(cc) + (for ([file source-files]) + (let* ([base (extract-base-filename/c file mzc-symbol)] + [dest (append-object-suffix + (let-values ([(base name dir?) (split-path base)]) + (build-path (or (dest-dir) 'same) name)))]) + (when (compiler:option:somewhat-verbose) + (printf "\"~a\":\n" file)) + (compile-extension (not (compiler:option:verbose)) file dest null) + (when (compiler:option:somewhat-verbose) + (printf " [output to \"~a\"]\n" dest))))] + [(ld) + (extract-base-filename/ext (ld-output) mzc-symbol) + ;; (for ([file source-files]) (extract-base-filename/o file mzc-symbol)) + (let ([dest (if (dest-dir) + (build-path (dest-dir) (ld-output)) + (ld-output))]) + (when (compiler:option:somewhat-verbose) + (printf "~a:\n" (let ([s (apply string-append + (map (lambda (n) (format " \"~a\"" n)) + source-files))]) + (substring s 1 (string-length s))))) + (link-extension (not (compiler:option:verbose)) + source-files + dest) + (when (compiler:option:somewhat-verbose) + (printf " [output to \"~a\"]\n" dest)))] + [(xform) + (for ([file source-files]) + (let* ([out-file (path-replace-suffix file ".3m.c")] + [out-file (if (dest-dir) + (build-path (dest-dir) out-file) + out-file)]) + ((dynamic-require 'compiler/xform 'xform) + (not (compiler:option:verbose)) + file + out-file + (list (find-include-dir))) + (when (compiler:option:somewhat-verbose) + (printf " [output to \"~a\"]\n" out-file))))] + [(c-mods) + (let ([dest (mods-output)]) + (let-values ([(in out) (make-pipe)]) + (parameterize ([current-output-port out]) + ((dynamic-require 'compiler/embed 'write-module-bundle) + #:modules + (append (map (lambda (l) `(#f (file ,l))) source-files) + (map (lambda (l) `(#t (lib ,l))) (exe-embedded-libraries))))) + (close-output-port out) + (let ([out (open-output-file dest #:exists 'truncate/replace)]) + (fprintf out "#ifdef MZ_XFORM\n") + (fprintf out "XFORM_START_SKIP;\n") + (fprintf out "#endif\n") + (fprintf out "static void declare_modules(Scheme_Env *env) {\n") + (fprintf out " static unsigned char data[] = {") + (let loop ([pos 0]) + (let ([b (read-byte in)]) + (when (zero? (modulo pos 20)) (fprintf out "\n ")) + (unless (eof-object? b) (fprintf out "~a," b) (loop (add1 pos))))) + (fprintf out "0\n };\n") + (fprintf out " Scheme_Object *eload = NULL, *a[3] = {NULL, NULL, NULL};\n") + (fprintf out " MZ_GC_DECL_REG(4);\n") + (fprintf out " MZ_GC_VAR_IN_REG(0, eload);\n") + (fprintf out " MZ_GC_ARRAY_VAR_IN_REG(1, a, 3);\n") + (fprintf out " MZ_GC_REG();\n") + (fprintf out " eload = scheme_builtin_value(\"embedded-load\");\n") + (fprintf out " a[0] = scheme_false;\n") + (fprintf out " a[1] = scheme_false;\n") + (fprintf out " a[2] = scheme_make_sized_byte_string((char *)data, ~a, 0);\n" + (file-position in)) + (fprintf out " scheme_apply(eload, 3, a);\n") + (fprintf out " MZ_GC_UNREG();\n") + (fprintf out "}\n") + (fprintf out "#ifdef MZ_XFORM\n") + (fprintf out "XFORM_END_SKIP;\n") + (fprintf out "#endif\n") + (close-output-port out))) + (when (compiler:option:somewhat-verbose) + (printf " [output to \"~a\"]\n" dest)))] + [else (printf "bad mode: ~a\n" mode)]) diff --git a/collects/compiler/commands/decompile.ss b/collects/compiler/commands/decompile.ss new file mode 100644 index 0000000000..ee5a4c9eeb --- /dev/null +++ b/collects/compiler/commands/decompile.ss @@ -0,0 +1,25 @@ +#lang scheme/base +(require scheme/cmdline + rico/command-name + compiler/zo-parse + compiler/decompile + scheme/pretty) + +(define source-files + (command-line + #:program (short-program+command-name) + #:args source-or-bytecode-file + source-or-bytecode-file)) + +(for ([zo-file source-files]) + (let ([zo-file (path->complete-path zo-file)]) + (let-values ([(base name dir?) (split-path zo-file)]) + (let ([alt-file (build-path base "compiled" (path-add-suffix name #".zo"))]) + (parameterize ([current-load-relative-directory base] + [print-graph #t]) + (pretty-print + (decompile + (call-with-input-file* + (if (file-exists? alt-file) alt-file zo-file) + (lambda (in) + (zo-parse in)))))))))) diff --git a/collects/compiler/commands/exe-dir.ss b/collects/compiler/commands/exe-dir.ss new file mode 100644 index 0000000000..3952d4d484 --- /dev/null +++ b/collects/compiler/commands/exe-dir.ss @@ -0,0 +1,31 @@ +#lang scheme/base +(require scheme/cmdline + rico/command-name + compiler/distribute) + +(define verbose (make-parameter #f)) +(define exe-embedded-collects-path (make-parameter #f)) +(define exe-dir-add-collects-dirs (make-parameter null)) + +(define-values (dest-dir source-files) + (command-line + #:program (short-program+command-name) + #:once-each + [("--collects-path") path "Set as main collects for executables" + (exe-embedded-collects-path path)] + #:multi + [("++collects-copy") dir "Add collects in to directory" + (exe-dir-add-collects-dirs (append (exe-dir-add-collects-dirs) (list dir)))] + #:once-each + [("-v") "Verbose mode" + (verbose #t)] + #:args (dest-dir . executable) + (values dest-dir executable))) + +(assemble-distribution + dest-dir + source-files + #:collects-path (exe-embedded-collects-path) + #:copy-collects (exe-dir-add-collects-dirs)) +(when (verbose) + (printf " [output to \"~a\"]\n" dest-dir)) diff --git a/collects/compiler/commands/exe.ss b/collects/compiler/commands/exe.ss new file mode 100644 index 0000000000..0c5586ab6a --- /dev/null +++ b/collects/compiler/commands/exe.ss @@ -0,0 +1,90 @@ +#lang scheme/base +(require scheme/cmdline + rico/command-name + compiler/private/embed + dynext/file) + +(define verbose (make-parameter #f)) +(define very-verbose (make-parameter #f)) + +(define gui (make-parameter #f)) +(define 3m (make-parameter #t)) + +(define exe-output (make-parameter #f)) +(define exe-embedded-flags (make-parameter '("-U" "--"))) +(define exe-embedded-libraries (make-parameter null)) +(define exe-aux (make-parameter null)) +(define exe-embedded-collects-path (make-parameter #f)) +(define exe-embedded-collects-dest (make-parameter #f)) + +(define source-file + (command-line + #:program (short-program+command-name) + #:once-each + [("-o") file "Write executable as " + (exe-output file)] + [("--gui") "Geneate GUI executable" + (gui #t)] + [("--collects-path") path "Set as main collects for executable" + (exe-embedded-collects-path path)] + [("--collects-dest") dir "Write collection code to " + (exe-embedded-collects-dest dir)] + [("--ico") .ico-file "Set Windows icon for executable" + (exe-aux (cons (cons 'ico .ico-file) (exe-aux)))] + [("--icns") .icns-file "Set Mac OS X icon for executable" + (exe-aux (cons (cons 'icns .icns-file) (exe-aux)))] + [("--orig-exe") "Use original executable instead of stub" + (exe-aux (cons (cons 'original-exe? #t) (exe-aux)))] + [("--3m") "Generate using 3m variant" + (3m #t)] + [("--cgc") "Generate using CGC variant" + (3m #f)] + #:multi + [("++lib") lib "Embed in executable" + (exe-embedded-libraries (append (exe-embedded-libraries) (list lib)))] + [("++exf") flag "Add flag to embed in executable" + (exe-embedded-flags (append (exe-embedded-flags) (list flag)))] + [("--exf") flag "Remove flag to embed in executable" + (exe-embedded-flags (remove flag (exe-embedded-flags)))] + [("--exf-clear") "Clear flags to embed in executable" + (exe-embedded-flags null)] + [("--exf-show") "Show flags to embed in executable" + (printf "Flags to embed: ~s\n" (exe-embedded-flags))] + #:once-each + [("-v") "Verbose mode" + (verbose #t)] + [("--vv") "Very verbose mode" + (verbose #t) + (very-verbose #t)] + #:args (source-file) + source-file)) + +(let ([dest (mzc:embedding-executable-add-suffix + (or (exe-output) + (extract-base-filename/ss source-file + (string->symbol (short-program+command-name)))) + (gui))]) + (mzc:create-embedding-executable + dest + #:mred? (gui) + #:variant (if (3m) '3m 'cgc) + #:verbose? (very-verbose) + #:modules (cons `(#%mzc: (file ,source-file)) + (map (lambda (l) `(#t (lib ,l))) + (exe-embedded-libraries))) + #:configure-via-first-module? #t + #:literal-expression + (parameterize ([current-namespace (make-base-namespace)]) + (compile + `(namespace-require + '',(string->symbol + (format "#%mzc:~a" + (let-values ([(base name dir?) + (split-path source-file)]) + (path->bytes (path-replace-suffix name #"")))))))) + #:cmdline (exe-embedded-flags) + #:collects-path (exe-embedded-collects-path) + #:collects-dest (exe-embedded-collects-dest) + #:aux (exe-aux)) + (when (verbose) + (printf " [output to \"~a\"]\n" dest))) diff --git a/collects/compiler/commands/expand.ss b/collects/compiler/commands/expand.ss new file mode 100644 index 0000000000..45f3539835 --- /dev/null +++ b/collects/compiler/commands/expand.ss @@ -0,0 +1,26 @@ +#lang scheme/base +(require scheme/cmdline + rico/command-name + scheme/pretty) + +(define source-files + (command-line + #:program (short-program+command-name) + #:args source-file + source-file)) + +(for ([src-file source-files]) + (let ([src-file (path->complete-path src-file)]) + (let-values ([(base name dir?) (split-path src-file)]) + (parameterize ([current-load-relative-directory base] + [current-namespace (make-base-namespace)] + [read-accept-reader #t]) + (call-with-input-file* + src-file + (lambda (in) + (port-count-lines! in) + (let loop () + (let ([e (read-syntax src-file in)]) + (unless (eof-object? e) + (pretty-print (syntax->datum (expand e))) + (loop)))))))))) diff --git a/collects/compiler/commands/info.ss b/collects/compiler/commands/info.ss new file mode 100644 index 0000000000..47ac1abd96 --- /dev/null +++ b/collects/compiler/commands/info.ss @@ -0,0 +1,10 @@ +#lang setup/infotab + +(define rico + '(("make" compiler/commands/make "compile source to bytecode" 100) + ("exe" compiler/commands/exe "create executable" 20) + ("pack" compiler/commands/pack "pack files/collections into a .plt archive" 10) + ("decompile" compiler/commands/decompile "decompile bytecode" #f) + ("expand" compiler/commands/expand "macro-expand source" #f) + ("distribute" compiler/commands/exe-dir "prepare executable(s) in a directory for distribution" #f) + ("c-ext" compiler/commands/c-ext "compile and link C-based extensions" #f))) diff --git a/collects/compiler/commands/make.ss b/collects/compiler/commands/make.ss new file mode 100644 index 0000000000..17d07381f6 --- /dev/null +++ b/collects/compiler/commands/make.ss @@ -0,0 +1,79 @@ +#lang scheme/base +(require scheme/cmdline + rico/command-name + compiler/cm + "../compiler.ss" + dynext/file) + +(define verbose (make-parameter #f)) +(define very-verbose (make-parameter #f)) +(define disable-inlining (make-parameter #f)) + +(define disable-deps (make-parameter #f)) +(define prefixes (make-parameter null)) +(define assume-primitives (make-parameter #t)) + +(define source-files + (command-line + #:program (short-program+command-name) + #:once-each + [("--disable-inline") "Disable procedure inlining during compilation" + (disable-inlining #t)] + [("--no-deps") "Compile immediate files without updating depdencies" + (disable-deps #t)] + [("-p" "--prefix") file "Add elaboration-time prefix file for --no-deps" + (prefixes (append (prefixes) (list file)))] + [("--no-prim") "Do not assume `scheme' bindings at top level for --no-deps" + (assume-primitives #f)] + [("-v") "Verbose mode" + (verbose #t)] + [("--vv") "Very verbose mode" + (verbose #t) + (very-verbose #t)] + #:args file file)) + +(if (disable-deps) + ;; Just compile one file: + (let ([prefix + `(begin + (require scheme) + ,(if (assume-primitives) + '(void) + '(namespace-require/copy 'scheme)) + (require compiler/cffi) + ,@(map (lambda (s) `(load ,s)) (prefixes)) + (void))]) + ((compile-zos prefix #:verbose? (verbose)) + source-files + 'auto)) + ;; Normal make: + (let ([n (make-base-empty-namespace)] + [did-one? #f]) + (parameterize ([current-namespace n] + [manager-trace-handler + (lambda (p) + (when (very-verbose) + (printf " ~a\n" p)))] + [manager-compile-notify-handler + (lambda (p) + (set! did-one? #t) + (when (verbose) + (printf " making ~s\n" (path->string p))))]) + (for ([file source-files]) + (unless (file-exists? file) + (error 'mzc "file does not exist: ~a" file)) + (set! did-one? #f) + (let ([name (extract-base-filename/ss file 'mzc)]) + (when (verbose) + (printf "\"~a\":\n" file)) + (parameterize ([compile-context-preservation-enabled + (disable-inlining)]) + (managed-compile-zo file)) + (let ([dest (append-zo-suffix + (let-values ([(base name dir?) (split-path file)]) + (build-path (if (symbol? base) 'same base) + "compiled" name)))]) + (when (verbose) + (printf " [~a \"~a\"]\n" + (if did-one? "output to" "already up-to-date at") + dest)))))))) diff --git a/collects/compiler/commands/pack.ss b/collects/compiler/commands/pack.ss new file mode 100644 index 0000000000..1605b88d99 --- /dev/null +++ b/collects/compiler/commands/pack.ss @@ -0,0 +1,99 @@ +#lang scheme/base +(require scheme/cmdline + rico/command-name + setup/pack + setup/getinfo + compiler/distribute) + +(define verbose (make-parameter #f)) + +(define collection? (make-parameter #f)) + +(define default-plt-name "archive") + +(define plt-name (make-parameter default-plt-name)) +(define plt-files-replace (make-parameter #f)) +(define plt-files-plt-relative? (make-parameter #f)) +(define plt-files-plt-home-relative? (make-parameter #f)) +(define plt-force-install-dir? (make-parameter #f)) +(define plt-setup-collections (make-parameter null)) +(define plt-include-compiled (make-parameter #f)) + +(define-values (plt-output source-files) + (command-line + #:program (short-program+command-name) + #:once-each + [("--collect") "Pack collections instead of files and directories" + (collection? #t)] + [("--plt-name") name "Set the printed describing the archive" + (plt-name name)] + [("--replace") "Files in archive replace existing files when unpacked" + (plt-files-replace #t)] + [("--at-plt") "Files/dirs in archive are relative to user's add-ons directory" + (plt-files-plt-relative? #t)] + #:once-any + [("--all-users") "Files/dirs in archive go to PLT installation if writable" + (plt-files-plt-home-relative? #t)] + [("--force-all-users") "Files/dirs forced to PLT installation" + (plt-files-plt-home-relative? #t) (plt-force-install-dir? #t)] + #:once-each + [("--include-compiled") "Include \"compiled\" subdirectories in the archive" + (plt-include-compiled #t)] + #:multi + [("++setup") collect "Setup after the archive is unpacked" + (plt-setup-collections (append (plt-setup-collections) (list collect)))] + #:once-each + [("-v") "Verbose mode" + (verbose #t)] + #:args (dest-file . file) + (values dest-file file))) + +(if (not (collection?)) + ;; Files and directories + (begin + (for ([fd source-files]) + (unless (relative-path? fd) + (error 'mzc + "file/directory is not relative to the current directory: \"~a\"" + fd))) + (pack-plt plt-output + (plt-name) + source-files + #:collections (map list (plt-setup-collections)) + #:file-mode (if (plt-files-replace) 'file-replace 'file) + #:plt-relative? (or (plt-files-plt-relative?) + (plt-files-plt-home-relative?)) + #:at-plt-home? (plt-files-plt-home-relative?) + #:test-plt-dirs (if (or (plt-force-install-dir?) + (not (plt-files-plt-home-relative?))) + #f + '("collects" "doc" "include" "lib")) + #:requires + ;; Get current version of mzscheme for require: + (let* ([i (get-info '("mzscheme"))] + [v (and i (i 'version (lambda () #f)))]) + (list (list '("mzscheme") v)))) + (when (verbose) + (printf " [output to \"~a\"]\n" plt-output))) + ;; Collection + (begin + (pack-collections-plt + plt-output + (if (eq? default-plt-name (plt-name)) #f (plt-name)) + (map (lambda (sf) + (let loop ([sf sf]) + (let ([m (regexp-match "^([^/]*)/(.*)$" sf)]) + (if m (cons (cadr m) (loop (caddr m))) (list sf))))) + source-files) + #:replace? (plt-files-replace) + #:extra-setup-collections (map list (plt-setup-collections)) + #:file-filter (if (plt-include-compiled) + (lambda (path) + (or (regexp-match #rx#"compiled$" (path->bytes path)) + (std-filter path))) + std-filter) + #:at-plt-home? (plt-files-plt-home-relative?) + #:test-plt-collects? (not (plt-force-install-dir?))) + (when (verbose) + (printf " [output to \"~a\"]\n" plt-output)))) + diff --git a/collects/compiler/distribute.ss b/collects/compiler/distribute.ss index 4f598f9cea..499e40f048 100644 --- a/collects/compiler/distribute.ss +++ b/collects/compiler/distribute.ss @@ -75,9 +75,11 @@ (let* ([specific-lib-dir (build-path "lib" "plt" - (let-values ([(base name dir?) - (split-path (car binaries))]) - (path-replace-suffix name #"")))] + (if (null? binaries) + "generic" + (let-values ([(base name dir?) + (split-path (car binaries))]) + (path-replace-suffix name #""))))] [relative-collects-dir (or collects-path (build-path specific-lib-dir @@ -120,18 +122,19 @@ (collects-path->bytes (relative->binary-relative sub-dir type relative-collects-dir)))) binaries types sub-dirs) - ;; Copy over extensions and adjust embedded paths: - (copy-extensions-and-patch-binaries orig-binaries binaries types sub-dirs - exts-dir - relative-exts-dir - relative->binary-relative) - ;; Copy over runtime files and adjust embedded paths: - (copy-runtime-files-and-patch-binaries orig-binaries binaries types sub-dirs - exts-dir - relative-exts-dir - relative->binary-relative) - ;; Done! - (void))))) + (unless (null? binaries) + ;; Copy over extensions and adjust embedded paths: + (copy-extensions-and-patch-binaries orig-binaries binaries types sub-dirs + exts-dir + relative-exts-dir + relative->binary-relative) + ;; Copy over runtime files and adjust embedded paths: + (copy-runtime-files-and-patch-binaries orig-binaries binaries types sub-dirs + exts-dir + relative-exts-dir + relative->binary-relative) + ;; Done! + (void)))))) (define (install-libs lib-dir types) (case (system-type) diff --git a/collects/meta/dist-specs.ss b/collects/meta/dist-specs.ss index e55ff4a1de..1655aa97e6 100644 --- a/collects/meta/dist-specs.ss +++ b/collects/meta/dist-specs.ss @@ -428,6 +428,9 @@ platform-dependent := ; hook for package rules mz-extras :+= (- (package: "setup-plt" #:collection "setup/") (cond (not dr) => (srcfile: "plt-installer{|-sig|-unit}.ss"))) +;; -------------------- rico +mz-extras :+= (package: "rico") + ;; -------------------- launcher mz-extras :+= (- (collects: "launcher") (cond (not mr) => "[Mm]r[Ss]tart*.exe")) diff --git a/collects/planet/info.ss b/collects/planet/info.ss index 525d7e764a..403035ff6c 100644 --- a/collects/planet/info.ss +++ b/collects/planet/info.ss @@ -4,3 +4,5 @@ (define mzscheme-launcher-names '("planet")) (define mzscheme-launcher-libraries '("planet.ss")) (define scribblings '(("planet.scrbl" (multi-page) (tool)))) + +(define rico '(("planet" planet/planet "manage Planet package installations" 80))) diff --git a/collects/planet/planet.ss b/collects/planet/planet.ss index 9a29bfd7b1..b04c0ab05c 100644 --- a/collects/planet/planet.ss +++ b/collects/planet/planet.ss @@ -11,6 +11,7 @@ PLANNED FEATURES: (only mzlib/list sort) net/url mzlib/match + rico/command-name "config.ss" "private/planet-shared.ss" @@ -27,7 +28,7 @@ PLANNED FEATURES: (planet-logging-to-stdout #t) (svn-style-command-line - #:program "planet" + #:program (short-program+command-name) #:argv (current-command-line-arguments) "PLT Scheme PLaneT command-line tool. Provides commands to help you manipulate your local planet cache." ["create" "create a PLaneT archive from a directory" diff --git a/collects/rico/command-name.ss b/collects/rico/command-name.ss new file mode 100644 index 0000000000..c1693d85c9 --- /dev/null +++ b/collects/rico/command-name.ss @@ -0,0 +1,23 @@ +#lang scheme/base + +(provide current-command-name + program+command-name + short-program+command-name) + +(define current-command-name (make-parameter #f)) + +(define (program+command-name) + (let ([p (find-system-path 'run-file)] + [n (current-command-name)]) + (if n + (format "~a ~a" p n) + p))) + +(define (short-program+command-name) + (let ([p (find-system-path 'run-file)] + [n (current-command-name)]) + (let-values ([(base name dir?) (split-path p)]) + (if n + (format "~a ~a" name n) + (path->string name))))) + diff --git a/collects/rico/info.ss b/collects/rico/info.ss new file mode 100644 index 0000000000..1c07a8001a --- /dev/null +++ b/collects/rico/info.ss @@ -0,0 +1,6 @@ +#lang setup/infotab + +(define compile-omit-paths '("main.ss")) + +(define mzscheme-launcher-libraries '("main.ss")) +(define mzscheme-launcher-names '("Rico")) diff --git a/collects/rico/main.lch b/collects/rico/main.lch new file mode 100644 index 0000000000..632865e4f0 --- /dev/null +++ b/collects/rico/main.lch @@ -0,0 +1,5 @@ +The context of this file doesn't matter. +It's existence causes the launcher-maker to +create an "independent launcher", which +means that it doesn't depend on the exact +MzScheme/MrEd executable or DLLs. diff --git a/collects/rico/main.ss b/collects/rico/main.ss new file mode 100644 index 0000000000..b143beddce --- /dev/null +++ b/collects/rico/main.ss @@ -0,0 +1,23 @@ + +;; Because `rico setup' is used to rebuild .zos, check for "setup" +;; directly. + +;; Note that this file is listed in "info.ss" so that it never gets a +;; .zo file. Do not `require' this module from anywhere, not even +;; `for-label', otherwise it could get a .zo anyway. + +(module main '#%kernel + (#%require '#%min-stx + ;; Need to make sure they're here: + '#%builtin) + + (let-values ([(cmdline) (current-command-line-arguments)]) + (if (and (positive? (vector-length cmdline)) + (equal? "setup" (vector-ref cmdline 0))) + (parameterize ([current-command-line-arguments + (list->vector + (cdr + (vector->list cmdline)))]) + (dynamic-require 'setup/main #f)) + (dynamic-require 'rico/rico #f)))) + diff --git a/collects/rico/rico.ss b/collects/rico/rico.ss new file mode 100644 index 0000000000..9fa1f54ab7 --- /dev/null +++ b/collects/rico/rico.ss @@ -0,0 +1,111 @@ +#lang scheme/base +(require setup/getinfo + "command-name.ss") + +(define cmdline (vector->list (current-command-line-arguments))) + +(define (find-by-prefix hash str) + (let ([trie (make-hash)]) + (for ([key (in-hash-keys hash)]) + (for/fold ([trie trie]) ([c (string->list key)]) + (let ([next (hash-ref trie c (lambda () (make-hash)))]) + (if (hash-ref next #f #f) + (hash-set! next #f null) + (hash-set! next #f key)) + (hash-set! trie c next) + next))) + (let ([t (for/fold ([trie trie]) ([c (string->list str)]) + (and trie + (hash-ref trie c #f)))]) + (and t + (let ([s (hash-ref t #f #f)]) + (if (string? s) + (hash-ref hash s) + 'ambiguous)))))) + +(let* ([dirs (find-relevant-directories '(rico))] + [infos (map get-info/full dirs)] + [tools (make-hash)]) + (for-each (lambda (i d) + (for-each (lambda (entry) + (cond + [(and (list? entry) + (= (length entry) 4) + (string? (car entry)) + (module-path? (cadr entry)) + (string? (caddr entry)) + (or (not (list-ref entry 3)) + (real? (list-ref entry 3)))) + (let ([p (hash-ref tools (car entry) #f)]) + (when p + (fprintf + (current-error-port) + "warning: tool ~s registered twice: ~e and ~e" + (car entry) + (car p) + d))) + (hash-set! tools (car entry) entry)] + [else + (fprintf + (current-error-port) + "warning: ~s provided bad `rico' spec: ~e" + d + entry)])) + (let ([l (i 'rico (lambda () null))]) + (if (list? l) + l + (list l))))) + infos + dirs) + (let ([show-all? + (cond + [(null? cmdline) #f] + [(or (equal? (car cmdline) "--help") + (equal? (car cmdline) "-h")) + #t] + [(regexp-match? #rx"^-" (car cmdline)) + (fprintf (current-error-port) "~a: A flag must follow a command: ~a\n\n" + (find-system-path 'run-file) + (car cmdline)) + #f] + [(or (hash-ref tools (car cmdline) #f) + (find-by-prefix tools (car cmdline))) + => (lambda (tool) + (if (eq? 'ambiguous tool) + (begin + (fprintf (current-error-port) "~a: Ambiguous command prefix: ~a\n\n" + (find-system-path 'run-file) + (car cmdline)) + #f) + (parameterize ([current-command-line-arguments + (list->vector (cdr cmdline))] + [current-command-name (car tool)]) + (dynamic-require (cadr tool) #f) + (exit))))] + [else + (fprintf (current-error-port) "~a: Unrecognized command: ~a\n\n" + (find-system-path 'run-file) + (car cmdline)) + #f])]) + (fprintf (current-error-port) "Usage: rico

ChConversion
~yany2-digit yeardate-year within 50 years
~Ychar-numeric?yeardate-year
~zanytime zonedate-zone-offset
~?char-numeric?2-digit or 4-digit year (PLT-specific extension)date-year

Table 2: STRING->DATE conversion specifiers