From 899a3279c2f37665b623a34414dc9c421e4b531e Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 26 Feb 2013 14:14:52 -0700 Subject: [PATCH] add experimental support for "phaseless" modules The intent is to support phase-crossing data such as the `exn:fail:syntax' structure type that is instantiaed by macros and recognized by contexts that use `eval' or `expand'. Phaseless modules are highly constrained, however, to avoid new cross-phase channels, and a module is inferred to be phaseless when it fits syntactic constraints. I've adjusted `racket/kernel' and improved its documentation a little so that it can be used to implement a phaseless module (which can import only from other phaseless modules). This change also adds a `flags' field to the `mod' structure type from `compiler/zo-structs'. --- collects/compiler/decompile.rkt | 3 +- collects/compiler/demodularizer/merge.rkt | 2 +- collects/compiler/demodularizer/module.rkt | 1 + collects/compiler/demodularizer/nodep.rkt | 4 +- collects/compiler/zo-marshal.rkt | 3 +- collects/compiler/zo-parse.rkt | 3 +- collects/compiler/zo-structs.rkt | 1 + collects/racket/kernel.rkt | 18 +- collects/scribblings/raco/zo-struct.scrbl | 13 +- .../scribblings/reference/eval-model.scrbl | 30 ++ collects/scribblings/reference/init.scrbl | 6 - collects/scribblings/reference/kernel.scrbl | 37 ++ collects/scribblings/reference/running.scrbl | 1 + .../scribblings/reference/syntax-model.scrbl | 47 ++- collects/tests/racket/phaseless.rkt | 78 ++++ doc/release-notes/racket/HISTORY.txt | 4 + src/racket/src/compile.c | 5 + src/racket/src/cstartup.inc | 350 +++++++++--------- src/racket/src/marshal.c | 6 + src/racket/src/module.c | 251 ++++++++++++- src/racket/src/mzmark_type.inc | 4 + src/racket/src/mzmarksrc.c | 2 + src/racket/src/optimize.c | 8 + src/racket/src/schpriv.h | 4 +- src/racket/src/schvers.h | 4 +- src/racket/src/validate.c | 32 +- 26 files changed, 693 insertions(+), 224 deletions(-) create mode 100644 collects/scribblings/reference/kernel.scrbl create mode 100644 collects/tests/racket/phaseless.rkt diff --git a/collects/compiler/decompile.rkt b/collects/compiler/decompile.rkt index 6d5127cd50..33d314ebb1 100644 --- a/collects/compiler/decompile.rkt +++ b/collects/compiler/decompile.rkt @@ -185,11 +185,12 @@ (define (decompile-module mod-form orig-stack stx-ht mod-name) (match mod-form [(struct mod (name srcname self-modidx prefix provides requires body syntax-bodies unexported - max-let-depth dummy lang-info internal-context pre-submodules post-submodules)) + max-let-depth dummy lang-info internal-context flags pre-submodules post-submodules)) (let-values ([(globs defns) (decompile-prefix prefix stx-ht)] [(stack) (append '(#%modvars) orig-stack)] [(closed) (make-hasheq)]) `(,mod-name ,(if (symbol? name) name (last name)) .... + ,@(if (null? flags) '() (list `(quote ,@flags))) ,@(let ([l (apply append (for/list ([req (in-list requires)] diff --git a/collects/compiler/demodularizer/merge.rkt b/collects/compiler/demodularizer/merge.rkt index f118e6b9e4..4ca7184e59 100644 --- a/collects/compiler/demodularizer/merge.rkt +++ b/collects/compiler/demodularizer/merge.rkt @@ -114,7 +114,7 @@ (match mod-form [(struct mod (name srcname self-modidx mod-prefix provides requires body syntax-bodies unexported mod-max-let-depth dummy lang-info internal-context - pre-submodules post-submodules)) + flags pre-submodules post-submodules)) (define toplevel-offset (length (prefix-toplevels top-prefix))) (define topsyntax-offset (length (prefix-stxs top-prefix))) (define lift-offset (prefix-num-lifts top-prefix)) diff --git a/collects/compiler/demodularizer/module.rkt b/collects/compiler/demodularizer/module.rkt index dca4498fec..1be8d31309 100644 --- a/collects/compiler/demodularizer/module.rkt +++ b/collects/compiler/demodularizer/module.rkt @@ -34,6 +34,7 @@ lang-info #t empty + empty empty))])) (provide/contract diff --git a/collects/compiler/demodularizer/nodep.rkt b/collects/compiler/demodularizer/nodep.rkt index f6c70e2bb1..16d705cfca 100644 --- a/collects/compiler/demodularizer/nodep.rkt +++ b/collects/compiler/demodularizer/nodep.rkt @@ -137,7 +137,7 @@ (match mod-form [(struct mod (name srcname self-modidx prefix provides requires body syntax-bodies unexported max-let-depth dummy lang-info internal-context - pre-submodules post-submodules)) + flags pre-submodules post-submodules)) (define new-prefix prefix) ; Cache all the mpi paths (for-each (match-lambda @@ -154,7 +154,7 @@ (begin (log-debug (format "[~S] lang-info : ~S" name lang-info)) ; XXX Seems to always be #f now (list (make-mod name srcname self-modidx new-prefix provides requires body empty unexported max-let-depth dummy lang-info internal-context - empty empty))) + empty empty empty))) (begin (log-debug (format "[~S] Dropping module @ ~S" name phase)) empty))))] [else (error 'nodep-module "huh?: ~e" mod-form)])) diff --git a/collects/compiler/zo-marshal.rkt b/collects/compiler/zo-marshal.rkt index e3333ba4ff..a8b787c08f 100644 --- a/collects/compiler/zo-marshal.rkt +++ b/collects/compiler/zo-marshal.rkt @@ -995,7 +995,7 @@ (define (convert-module mod-form) (match mod-form [(struct mod (name srcname self-modidx prefix provides requires body syntax-bodies unexported - max-let-depth dummy lang-info internal-context pre-submodules post-submodules)) + max-let-depth dummy lang-info internal-context flags pre-submodules post-submodules)) (let* ([lookup-req (lambda (phase) (let ([a (assq phase requires)]) (if a @@ -1091,6 +1091,7 @@ [l (cons lang-info l)] ; lang-info [l (cons (map convert-module post-submodules) l)] [l (cons (map convert-module pre-submodules) l)] + [l (cons (if (memq 'phaseless flags) #t #f) l)] [l (cons self-modidx l)] [l (cons srcname l)] [l (cons (if (pair? name) (car name) name) l)] diff --git a/collects/compiler/zo-parse.rkt b/collects/compiler/zo-parse.rkt index 162391bff4..4aaf58de45 100644 --- a/collects/compiler/zo-parse.rkt +++ b/collects/compiler/zo-parse.rkt @@ -251,7 +251,7 @@ (define (read-module v) (match v [`(,submod-path - ,name ,srcname ,self-modidx + ,name ,srcname ,self-modidx ,phaseless? ,pre-submods ,post-submods ,lang-info ,functional? ,et-functional? ,rename ,max-let-depth ,dummy @@ -337,6 +337,7 @@ dummy lang-info rename + (if phaseless? '(phaseless) '()) (map read-module pre-submods) (map read-module post-submods))]))])) (define (read-module-wrap v) diff --git a/collects/compiler/zo-structs.rkt b/collects/compiler/zo-structs.rkt index 4ca4395d18..78fa6e2de9 100644 --- a/collects/compiler/zo-structs.rkt +++ b/collects/compiler/zo-structs.rkt @@ -139,6 +139,7 @@ [dummy toplevel?] [lang-info (or/c #f (vector/c module-path? symbol? any/c))] [internal-context (or/c #f #t stx? (vectorof stx?))] + [flags (listof (or/c 'phaseless))] [pre-submodules (listof mod?)] [post-submodules (listof mod?)])) diff --git a/collects/racket/kernel.rkt b/collects/racket/kernel.rkt index 170dc48501..824fa3d578 100644 --- a/collects/racket/kernel.rkt +++ b/collects/racket/kernel.rkt @@ -1,18 +1,2 @@ (module kernel '#%kernel - (#%require (for-syntax '#%kernel)) - - ;; this is duplicated from "racket/private/pre-base.rkt" - ;; but i'm not sure that file should require this one - (define-syntaxes (#%top-interaction) - (lambda (stx) - (if (eq? 'top-level (syntax-local-context)) - 'ok - (raise-syntax-error - #f - "not at top level" - stx)) - (if (symbol? (syntax-e stx)) - (raise-syntax-error #f "bad syntax" stx) - (datum->syntax stx (cdr (syntax-e stx)) stx stx)))) - - (#%provide (all-from '#%kernel) #%top-interaction)) + (#%provide (all-from '#%kernel))) diff --git a/collects/scribblings/raco/zo-struct.scrbl b/collects/scribblings/raco/zo-struct.scrbl index 17b0d6739c..c34e510d0b 100644 --- a/collects/scribblings/raco/zo-struct.scrbl +++ b/collects/scribblings/raco/zo-struct.scrbl @@ -205,6 +205,7 @@ binding, constructor, etc.} [dummy toplevel?] [lang-info (or/c #f (vector/c module-path? symbol? any/c))] [internal-context (or/c #f #t stx? (vectorof stx?))] + [flags (listof (or/c 'phaseless))] [pre-submodules (listof mod?)] [post-submodules (listof mod?)])]{ Represents a @racket[module] declaration. @@ -244,7 +245,17 @@ binding, constructor, etc.} @racket[module->namespace]. A @racket[#f] value means that the context is unavailable or empty. A @racket[#t] value means that the context is computed by re-importing all required modules. A - syntax-object value embeds an arbitrary lexical context.} + syntax-object value embeds an arbitrary lexical context. + + The @racket[flags] field records certain properties of the module. + The @racket['phaseless] flag indicates that the module body is + evaluated once and the results shared across all phases; such a + module contains only definitions of functions, structure types, and + structure type properties. + + The @racket[pre-submodules] field records @racket[module]-declared + submodules, while the @racket[post-submodules] field records + @racket[module*]-declared submodules.} @defstruct+[provided ([name symbol?] diff --git a/collects/scribblings/reference/eval-model.scrbl b/collects/scribblings/reference/eval-model.scrbl index 919277b654..a74b795636 100644 --- a/collects/scribblings/reference/eval-model.scrbl +++ b/collects/scribblings/reference/eval-model.scrbl @@ -598,6 +598,36 @@ top-level variables in higher @tech{phases}, while module @tech{instantiations} (triggered by @racket[require]) relative to such top-levels are in corresponding higher @tech{phase}s. +@;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +@subsection[#:tag "phaseless-modules"]{Phaseless Modules} + +Module declarations that fit a highly constrained form create +@deftech{phaseless} modules. A @tech{phaseless} module's +instantiations across all phases and @tech{module registries} share +the variables produced by the first instantiation of the module. + +The intent of a @tech{phaseless} module is to support values that are +recognizable after @tech{phase} crossings. For example, when a macro +transformer running in phase 1 raises a syntax error as represented by +a @racket[exn:fail:syntax] instance, the instance is recognizable by a +phase-0 exception handler wrapping a call to @racket[eval] or +@racket[expand] that triggered the syntax error, because the +@racket[exn:fail:syntax] structure type is defined by a +@tech{phaseless} module. + +A @tech{phaseless} module imports only other @tech{phaseless} modules, +and it contains only definitions that bind variables to functions, +structure types and related functions, or structure-type properties +and related functions. A @tech{phaseless} module never includes syntax +literals (via @racket[quote-syntax]) or variable references (via +@racket[#%variable-reference]). See @secref["phaseless-grammar"] for +the syntactic specification of a @tech{phaseless} module +declaration. + +A documented module should be assumed non-@tech{phaseless} unless it +is specified as @tech{phaseless} (such as +@racketmodname[racket/kernel]). + @;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @subsection[#:tag "module-redeclare"]{Module Re-declarations} diff --git a/collects/scribblings/reference/init.scrbl b/collects/scribblings/reference/init.scrbl index e31c8e4342..34beaa172f 100644 --- a/collects/scribblings/reference/init.scrbl +++ b/collects/scribblings/reference/init.scrbl @@ -40,9 +40,3 @@ as a member of a list of runtime-configuration specification (as returned by a module's language-information function for the key @racket['configure-runtime]) to obtain the same runtime configuration as for the @racketmodname[racket/base] language. - -@defmodule*[(racket/kernel)]{The @racketmodname[racket/kernel] library -is a minimal initial environment intended for scripts that require low -startup time. It re-exports the bindings of the -@indexed-racket['#%kernel], along with a binding for -@racket[#%top-interaction].} diff --git a/collects/scribblings/reference/kernel.scrbl b/collects/scribblings/reference/kernel.scrbl new file mode 100644 index 0000000000..4253a1c26a --- /dev/null +++ b/collects/scribblings/reference/kernel.scrbl @@ -0,0 +1,37 @@ +#lang scribble/manual +@(require (for-label (except-in racket/base + lambda λ #%app #%module-begin) + (only-in racket/base + [#%plain-lambda lambda] + [#%plain-lambda λ] + [#%plain-app #%app] + [#%plain-module-begin #%module-begin]))) + +@title{Kernel Forms and Functions} + +@defmodule*[(racket/kernel)]{The @racketmodname[racket/kernel] library +is a @tech{phaseless} module that provides a minimal set of syntactic +forms and functions.} + +``Minimal'' means that @racketmodname[racket/kernel] includes only +forms that are built into the Racket compiler and only functions that +are built into the run-time system. Currently, the set of bindings is +not especially small, nor is it particularly well-defined, since the +set of built-in functions can change frequently. Use +@racketmodname[racket/kernel] with care, and beware that its use can +create compatibility problems. + +The @racket[racket/kernel] module exports all of the bindings in the +grammar of fully expanded programs (see @secref["fully-expanded"]), +but it provides @racket[#%plain-lambda] as @racket[lambda] and @racket[λ], +@racket[#%plain-app] as @racket[#%app], and +@racket[#%plain-module-begin] as @racket[#%module-begin]. Aside from +@racket[#%datum] (which expands to @racket[quote]), +@racketmodname[racket/kernel] provides no other syntactic bindings. + +The @racket[racket/kernel] module also exports many of the function +bindings from @racketmodname[racket/base], and it exports a few other +functions that are not exported by @racketmodname[racket/base] because +@racketmodname[racket/base] exports improved variants. The exact set +of function bindings exported by @racket[racket/kernel] is unspecified +and subject to change across versions. diff --git a/collects/scribblings/reference/running.scrbl b/collects/scribblings/reference/running.scrbl index e553ae3075..d78dbd4905 100644 --- a/collects/scribblings/reference/running.scrbl +++ b/collects/scribblings/reference/running.scrbl @@ -10,3 +10,4 @@ @include-section["help.scrbl"] @include-section["enter.scrbl"] @include-section["debugging.scrbl"] +@include-section["kernel.scrbl"] diff --git a/collects/scribblings/reference/syntax-model.scrbl b/collects/scribblings/reference/syntax-model.scrbl index 40942afa6c..999964399b 100644 --- a/collects/scribblings/reference/syntax-model.scrbl +++ b/collects/scribblings/reference/syntax-model.scrbl @@ -201,7 +201,8 @@ the binding (according to @racket[free-identifier=?]) matters.} [module-level-form general-top-level-form (#%provide raw-provide-spec ...) (begin-for-syntax module-level-form ...) - (module id module-path + submodule-form] +[submodule-form (module id module-path (#%plain-module-begin module-level-form ...)) (module* id module-path @@ -987,6 +988,50 @@ available, a name is constructed using the source location information. Inferred and property-assigned names are also available to syntax transformers, via @racket[syntax-local-name]. +@;---------------------------------------- +@section[#:tag "phaseless-grammar"]{Phaseless Module Declarations} + +A module is @tech{phaseless} only if it fits the following grammar, +which uses non-terminals from @secref["fully-expanded"], and only if +it includes no uses of @racket[quote-syntax] or @racket[#%variable-reference]: + +@racketgrammar*[ +#:literals (module module* #%plain-module-begin begin #%provide + define-values #%require + #%plain-lambda case-lambda begin + set! quote-syntax quote with-continuation-mark + #%plain-app + cons list make-struct-type make-struct-type-property) +[phaseless-module (module id module-path + (#%plain-module-begin + phaseless-form ...))] +[phaseless-form (begin phaseless-form ...) + (#%provide raw-provide-spec ...) + submodule-form + (define-values (id ...) phaseless-expr) + (#%require raw-require-spec ...)] +[phaseless-expr id + (@#,racket[quote] phaseless-datum) + (#%plain-lambda formals expr ...+) + (case-lambda (formals expr ...+) ...) + (#%plain-app cons expr ...+) + (#%plain-app list expr ...+) + (#%plain-app make-struct-type expr ...+) + (#%plain-app make-struct-type-property + expr ...+)] +[phaseless-datum number + boolean + identifier + string + bytes] +] + +This grammar applies after @tech{expansion}, but because a @tech{phaseless} +module imports only from other phaseless modules, the only relevant +expansion steps are the implicit introduction of +@racket[#%plain-module-begin], implicit introduction of @racket[#%plain-app], +and implicit introduction and/or expansion of @racket[#%datum]. + @;---------------------------------------- @close-eval[racket-eval] diff --git a/collects/tests/racket/phaseless.rkt b/collects/tests/racket/phaseless.rkt new file mode 100644 index 0000000000..870d14091a --- /dev/null +++ b/collects/tests/racket/phaseless.rkt @@ -0,0 +1,78 @@ +#lang racket/base +(require compiler/zo-parse) + +(define (check-phaseless is? form) + (parameterize ([current-namespace (make-base-namespace)]) + (define o (open-output-bytes)) + (write (compile `(module m racket/kernel ,form)) o) + (close-output-port o) + (define i (open-input-bytes (get-output-bytes o))) + (define e (zo-parse i)) + (unless (equal? is? (and (memq 'phaseless (mod-flags (compilation-top-code e))) #t)) + (error 'phaseless "failed: ~s ~s\n" is? form)))) + +(check-phaseless #t '(define-values (x) 5)) +(check-phaseless #t '(define-values (x) '5)) +(check-phaseless #t '(define-values (x) (#%datum . 5))) +(check-phaseless #t '(define-values (x) #t)) +(check-phaseless #t '(define-values (x) 'x)) +(check-phaseless #t '(define-values (x) "x")) +(check-phaseless #t '(define-values (x) #"x")) +(check-phaseless #t '(define-values (x) cons)) +(check-phaseless #t '(define-values (x) (cons 1 2))) +(check-phaseless #t '(define-values (x) (list 1 2))) +(check-phaseless #t '(define-values (x) (cons 1 '()))) +(check-phaseless #t '(#%require racket/private/stx)) +(check-phaseless #t '(define-values (x) (lambda (x) x))) +(check-phaseless #t '(define-values (x) (case-lambda [(x) x] [y y]))) +(check-phaseless #t '(define-values (struct: ? -ref) (make-struct-type-property 'p))) +(check-phaseless #t '(define-values (struct: make- ? -ref -set!) (make-struct-type 's #f 0 0))) +(check-phaseless #t '(define-values (struct: make- ? -ref -set!) (make-struct-type 's struct:exn 0 0))) +(check-phaseless #t '(define-values (struct: make- ? -ref -set!) (make-struct-type 's struct:exn 1 0 #f (list (cons prop:procedure 0))))) +(check-phaseless #t '(begin + (define-values (x) 5) + (define-values (y) 6))) + +(check-phaseless #f '(define-values (x) #(x))) +(check-phaseless #f '(define-values (x) '(x))) +(check-phaseless #f '(define-values (x) (quote-syntax x))) +(check-phaseless #f '(define-values (x) (lambda () (quote-syntax x)))) +(check-phaseless #f '(define-values (x) (#%variable-reference))) +(check-phaseless #f '(define-values (x) (lambda () (#%variable-reference)))) +(check-phaseless #f '(define-values (x) (lambda () (if #f (#%variable-reference) 10)))) +(check-phaseless #f '(define-values (x) (#%variable-reference x))) +(check-phaseless #f '(#%require racket/base)) + +(check-phaseless #t '(module* sub #f (vector 1 2 3))) +(check-phaseless #t '(module* sub #f (#%variable-reference))) +(check-phaseless #t '(module* sub racket/base (#%variable-reference))) +(check-phaseless #t '(module sub racket/base (#%variable-reference))) + +;; Check phase crossing via an exception: +(parameterize ([current-namespace (make-base-namespace)]) + (eval `(module m racket/kernel + (#%provide s? make-s) + (define-values (struct:s make-s s? s-ref s-set!) (make-struct-type 's #f 0 0)))) + (eval '(require 'm)) + (define s? (eval 's?)) + (eval '(require (for-syntax racket/base 'm))) + (eval '(define-syntax (m stx) (raise (make-s)))) + (with-handlers ([s? void]) + (eval '(m))) + (define (check-exn) + (with-handlers ([s? void]) + (eval '(module n racket/base + (require (for-syntax racket/base 'm)) + (begin-for-syntax + (raise (make-s))))))) + (check-exn) + (define (check-attach namespace-attach-module) + (define ns (make-base-namespace)) + (namespace-attach-module (current-namespace) ''m ns) + (parameterize ([current-namespace ns]) + (check-exn))) + (check-attach namespace-attach-module) + (check-attach namespace-attach-module-declaration)) + +(displayln "All tests passed.") + diff --git a/doc/release-notes/racket/HISTORY.txt b/doc/release-notes/racket/HISTORY.txt index 0c60ac2ad8..fa272664aa 100644 --- a/doc/release-notes/racket/HISTORY.txt +++ b/doc/release-notes/racket/HISTORY.txt @@ -1,3 +1,7 @@ +Version 5.3.3.6 +Added "phaseless" module inference and instantiation +compiler/zo-structs: added flags field to mod + Version 5.3.3.4 Added impersonator-ephemeron diff --git a/src/racket/src/compile.c b/src/racket/src/compile.c index 36adcb2f67..7f8edace8e 100644 --- a/src/racket/src/compile.c +++ b/src/racket/src/compile.c @@ -1334,6 +1334,8 @@ ref_syntax (Scheme_Object *form, Scheme_Comp_Env *env, Scheme_Compile_Info *rec, Scheme_Object *var, *name, *rest, *dummy, *lex_id = NULL; int l, ok; + env->prefix->non_phaseless = 1; + form = scheme_stx_taint_disarm(form, NULL); l = check_form(form, form); @@ -3225,6 +3227,9 @@ quote_syntax_syntax(Scheme_Object *orig_form, Scheme_Comp_Env *env, Scheme_Compi int len; Scheme_Object *stx, *form; + if (rec[drec].comp) + env->prefix->non_phaseless = 1; + form = scheme_stx_taint_disarm(orig_form, NULL); if (rec[drec].comp) diff --git a/src/racket/src/cstartup.inc b/src/racket/src/cstartup.inc index 4aebe498f3..e9e12cecd0 100644 --- a/src/racket/src/cstartup.inc +++ b/src/racket/src/cstartup.inc @@ -1,11 +1,11 @@ { - SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,53,46,51,46,51,46,52,84,0,0,0,0,0,0,0,0,0,0, + SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,53,46,51,46,51,46,54,84,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,51,0,0,0,1,0,0,10,0,14,0, 21,0,28,0,33,0,37,0,40,0,45,0,58,0,62,0,67,0,74,0,83, 0,87,0,93,0,107,0,121,0,124,0,130,0,134,0,136,0,147,0,149,0, 163,0,170,0,192,0,194,0,208,0,19,1,48,1,59,1,70,1,96,1,129, 1,162,1,224,1,24,2,105,2,161,2,166,2,187,2,84,3,105,3,158,3, -225,3,114,4,2,5,56,5,67,5,150,5,0,0,112,7,0,0,69,35,37, +225,3,114,4,2,5,56,5,67,5,150,5,0,0,113,7,0,0,69,35,37, 109,105,110,45,115,116,120,29,11,11,11,66,100,101,102,105,110,101,66,108,101, 116,114,101,99,64,108,101,116,42,63,97,110,100,62,111,114,64,119,104,101,110, 72,112,97,114,97,109,101,116,101,114,105,122,101,63,108,101,116,64,99,111,110, @@ -16,12 +16,12 @@ 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,36,11,8,240, -110,91,0,0,95,159,2,17,36,36,159,2,16,36,36,159,2,16,36,36,16, +79,91,0,0,95,159,2,17,36,36,159,2,16,36,36,159,2,16,36,36,16, 20,2,3,2,2,2,4,2,2,2,5,2,2,2,6,2,2,2,7,2,2, 2,8,2,2,2,11,2,2,2,10,2,2,2,9,2,2,2,12,2,2,97, -37,11,8,240,110,91,0,0,93,159,2,16,36,37,16,2,2,13,161,2,2, -37,2,13,2,2,2,13,96,11,11,8,240,110,91,0,0,16,0,96,38,11, -8,240,110,91,0,0,16,0,18,98,64,104,101,114,101,13,16,6,36,2,14, +37,11,8,240,79,91,0,0,93,159,2,16,36,37,16,2,2,13,161,2,2, +37,2,13,2,2,2,13,96,11,11,8,240,79,91,0,0,16,0,96,38,11, +8,240,79,91,0,0,16,0,18,98,64,104,101,114,101,13,16,6,36,2,14, 2,2,11,11,11,8,32,8,31,8,30,8,29,27,248,22,164,4,195,249,22, 157,4,80,158,39,36,251,22,89,2,18,248,22,104,199,12,249,22,79,2,19, 248,22,106,201,27,248,22,164,4,195,249,22,157,4,80,158,39,36,251,22,89, @@ -74,33 +74,33 @@ 248,22,158,4,248,22,80,197,250,22,89,2,28,248,22,89,248,22,178,17,199, 248,22,104,198,27,248,22,158,4,248,22,178,17,197,250,22,89,2,28,248,22, 89,248,22,80,197,250,22,90,2,25,248,22,179,17,199,248,22,179,17,202,159, -36,20,114,159,36,16,1,11,16,0,20,26,149,9,2,1,2,1,2,2,9, -9,11,11,11,10,36,80,158,36,36,20,114,159,36,16,0,16,0,38,39,36, -16,0,36,16,0,36,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,36,46,37,16,0,36,16,1,2,13,37,11,11,11,16,0,16,0,16, -0,36,36,11,12,11,11,16,0,16,0,16,0,36,36,16,11,16,5,11,20, -15,16,2,20,14,159,36,36,37,80,158,36,36,36,20,114,159,36,16,1,2, -13,16,1,33,33,10,16,5,2,12,88,163,8,36,37,53,37,9,223,0,33, -34,36,20,114,159,36,16,1,2,13,16,0,11,16,5,2,8,88,163,8,36, -37,53,37,9,223,0,33,35,36,20,114,159,36,16,1,2,13,16,0,11,16, -5,2,6,88,163,8,36,37,53,37,9,223,0,33,36,36,20,114,159,36,16, -1,2,13,16,1,33,37,11,16,5,2,7,88,163,8,36,37,56,37,9,223, -0,33,38,36,20,114,159,36,16,1,2,13,16,1,33,39,11,16,5,2,10, -88,163,8,36,37,58,37,9,223,0,33,42,36,20,114,159,36,16,1,2,13, -16,0,11,16,5,2,4,88,163,8,36,37,53,37,9,223,0,33,44,36,20, -114,159,36,16,1,2,13,16,0,11,16,5,2,5,88,163,8,36,37,54,37, -9,223,0,33,45,36,20,114,159,36,16,1,2,13,16,0,11,16,5,2,9, -88,163,8,36,37,56,37,9,223,0,33,46,36,20,114,159,36,16,1,2,13, -16,0,11,16,5,2,11,88,163,8,36,37,58,37,9,223,0,33,47,36,20, -114,159,36,16,1,2,13,16,1,33,49,11,16,5,2,3,88,163,8,36,37, -54,37,9,223,0,33,50,36,20,114,159,36,16,1,2,13,16,0,11,16,0, -94,2,16,2,17,93,2,16,9,9,36,0}; - EVAL_ONE_SIZED_STR((char *)expr, 2048); +36,20,114,159,36,16,1,11,16,0,20,26,150,9,2,1,2,1,2,2,11, +9,9,11,11,11,10,36,80,158,36,36,20,114,159,36,16,0,16,0,38,39, +36,16,0,36,16,0,36,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,36,46,37,16,0,36,16,1,2,13,37,11,11,11,16,0,16,0, +16,0,36,36,11,12,11,11,16,0,16,0,16,0,36,36,16,11,16,5,11, +20,15,16,2,20,14,159,36,36,37,80,158,36,36,36,20,114,159,36,16,1, +2,13,16,1,33,33,10,16,5,2,12,88,163,8,36,37,53,37,9,223,0, +33,34,36,20,114,159,36,16,1,2,13,16,0,11,16,5,2,8,88,163,8, +36,37,53,37,9,223,0,33,35,36,20,114,159,36,16,1,2,13,16,0,11, +16,5,2,6,88,163,8,36,37,53,37,9,223,0,33,36,36,20,114,159,36, +16,1,2,13,16,1,33,37,11,16,5,2,7,88,163,8,36,37,56,37,9, +223,0,33,38,36,20,114,159,36,16,1,2,13,16,1,33,39,11,16,5,2, +10,88,163,8,36,37,58,37,9,223,0,33,42,36,20,114,159,36,16,1,2, +13,16,0,11,16,5,2,4,88,163,8,36,37,53,37,9,223,0,33,44,36, +20,114,159,36,16,1,2,13,16,0,11,16,5,2,5,88,163,8,36,37,54, +37,9,223,0,33,45,36,20,114,159,36,16,1,2,13,16,0,11,16,5,2, +9,88,163,8,36,37,56,37,9,223,0,33,46,36,20,114,159,36,16,1,2, +13,16,0,11,16,5,2,11,88,163,8,36,37,58,37,9,223,0,33,47,36, +20,114,159,36,16,1,2,13,16,1,33,49,11,16,5,2,3,88,163,8,36, +37,54,37,9,223,0,33,50,36,20,114,159,36,16,1,2,13,16,0,11,16, +0,94,2,16,2,17,93,2,16,9,9,36,0}; + EVAL_ONE_SIZED_STR((char *)expr, 2049); } { - SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,53,46,51,46,51,46,52,84,0,0,0,0,0,0,0,0,0,0, + SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,53,46,51,46,51,46,54,84,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,126,0,0,0,1,0,0,8,0,21,0, 26,0,43,0,55,0,77,0,106,0,121,0,139,0,151,0,167,0,181,0,203, 0,219,0,236,0,2,1,13,1,19,1,28,1,35,1,42,1,54,1,70,1, @@ -113,7 +113,7 @@ 161,17,236,17,238,17,106,18,166,18,171,18,39,19,50,19,188,19,198,19,124, 21,146,21,155,21,148,22,166,22,180,22,201,22,213,22,5,23,12,23,30,23, 81,23,94,23,157,25,68,26,213,26,198,27,180,28,187,28,194,28,56,29,174, -29,18,31,99,31,182,31,11,32,202,32,228,32,101,33,0,0,22,38,0,0, +29,18,31,99,31,182,31,11,32,202,32,228,32,101,33,0,0,23,38,0,0, 67,35,37,117,116,105,108,115,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,71,114,101,114,111,111,116,45,112,97,116,104,1,20,102,105,110,100,45,101, @@ -376,7 +376,7 @@ 38,48,11,9,223,3,33,96,28,197,86,94,20,18,159,11,80,158,42,49,193, 20,18,159,11,80,158,42,50,196,86,94,20,18,159,11,80,158,42,55,193,20, 18,159,11,80,158,42,56,196,193,28,193,80,158,38,49,80,158,38,55,248,22, -8,88,163,8,32,37,8,40,8,240,0,240,94,0,9,224,1,2,33,97,0, +9,88,163,8,32,37,8,40,8,240,0,240,94,0,9,224,1,2,33,97,0, 7,35,114,120,34,47,43,34,28,248,22,145,7,23,195,2,27,249,22,189,15, 2,99,196,28,192,28,249,22,128,4,248,22,103,195,248,22,182,3,248,22,148, 7,198,249,22,7,250,22,167,7,199,36,248,22,103,198,197,249,22,7,250,22, @@ -521,71 +521,71 @@ 22,139,4,23,202,1,27,28,23,194,2,23,194,1,86,94,23,194,1,36,249, 22,135,6,23,199,1,20,20,95,88,163,8,36,36,48,11,9,224,4,2,33, 124,23,195,1,23,197,1,27,248,22,184,5,23,195,1,248,80,159,39,8,33, -39,193,159,36,20,114,159,36,16,1,11,16,0,20,26,144,9,2,1,2,1, -29,11,11,11,9,9,11,11,11,10,43,80,158,36,36,20,114,159,40,16,30, -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,2,16,2,17,30,2,20,76,102,105,110,100,45,108, -105,110,107,115,45,112,97,116,104,33,11,4,30,2,21,1,20,112,97,114,97, -109,101,116,101,114,105,122,97,116,105,111,110,45,107,101,121,11,6,30,2,21, -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,11,3,2,22,2,23,2,24,30,2,20,1,21,101,120,99,101, -112,116,105,111,110,45,104,97,110,100,108,101,114,45,107,101,121,11,2,2,25, -2,26,2,27,2,28,2,29,2,30,2,31,16,0,37,39,36,16,0,36,16, -13,2,9,2,10,2,8,2,3,2,26,2,24,2,22,2,17,2,23,2,25, -2,15,2,14,2,16,49,11,11,11,16,13,2,13,2,11,2,31,2,12,2, -6,2,30,2,29,2,4,2,28,2,7,2,27,2,2,2,5,16,13,11,11, -11,11,11,11,11,11,11,11,11,11,11,16,13,2,13,2,11,2,31,2,12, -2,6,2,30,2,29,2,4,2,28,2,7,2,27,2,2,2,5,49,49,37, -12,11,11,16,0,16,0,16,0,36,36,11,12,11,11,16,0,16,0,16,0, -36,36,16,30,20,15,16,2,32,0,88,163,36,37,45,11,2,2,222,33,57, -80,159,36,36,37,20,15,16,2,249,22,147,7,7,92,7,92,80,159,36,37, -37,20,15,16,2,88,163,36,37,54,38,2,4,223,0,33,62,80,159,36,38, -37,20,15,16,2,88,163,36,38,58,38,2,5,223,0,33,64,80,159,36,39, -37,20,15,16,2,20,25,96,2,6,88,163,8,36,39,8,25,8,32,9,223, -0,33,71,88,163,36,38,47,52,9,223,0,33,72,88,163,36,37,46,52,9, -223,0,33,73,80,159,36,40,37,20,15,16,2,27,248,22,183,15,248,22,159, -8,27,28,249,22,155,9,247,22,167,8,2,34,6,1,1,59,6,1,1,58, -250,22,129,8,6,14,14,40,91,94,126,97,93,42,41,126,97,40,46,42,41, -23,196,2,23,196,1,88,163,8,36,38,48,11,2,7,223,0,33,77,80,159, -36,41,37,20,15,16,2,32,0,88,163,8,36,38,47,11,2,8,222,33,78, -80,159,36,42,37,20,15,16,2,32,0,88,163,8,36,39,48,11,2,9,222, -33,80,80,159,36,43,37,20,15,16,2,32,0,88,163,8,36,38,46,11,2, -10,222,33,81,80,159,36,44,37,20,15,16,2,88,163,45,39,49,8,128,16, -2,11,223,0,33,83,80,159,36,45,37,20,15,16,2,88,163,45,40,50,8, -128,16,2,13,223,0,33,85,80,159,36,47,37,20,15,16,2,248,22,174,15, -70,108,105,110,107,115,45,102,105,108,101,80,159,36,48,37,20,15,16,2,247, -22,140,2,80,158,36,49,20,15,16,2,2,86,80,158,36,50,20,15,16,2, -248,80,159,37,52,37,88,163,36,36,49,8,240,16,0,6,0,9,223,1,33, -87,80,159,36,51,37,20,15,16,2,247,22,140,2,80,158,36,55,20,15,16, -2,2,86,80,158,36,56,20,15,16,2,88,163,36,37,44,8,240,0,240,94, -0,2,24,223,0,33,98,80,159,36,57,37,20,15,16,2,88,163,36,38,56, -8,240,0,0,128,0,2,25,223,0,33,100,80,159,36,59,37,20,15,16,2, -88,163,36,40,59,8,240,0,128,160,0,2,12,223,0,33,111,80,159,36,46, -37,20,15,16,2,32,0,88,163,36,39,50,11,2,26,222,33,112,80,159,36, -8,24,37,20,15,16,2,32,0,88,163,36,38,53,11,2,27,222,33,113,80, -159,36,8,25,37,20,15,16,2,32,0,88,163,36,38,54,11,2,28,222,33, -114,80,159,36,8,26,37,20,15,16,2,20,27,158,32,0,88,163,36,37,44, -11,2,29,222,33,115,32,0,88,163,36,37,44,11,2,29,222,33,116,80,159, -36,8,27,37,20,15,16,2,88,163,8,36,37,51,16,2,52,8,240,0,64, -0,0,2,41,223,0,33,117,80,159,36,8,30,39,20,15,16,2,88,163,8, -36,37,51,16,2,52,8,240,0,128,0,0,2,41,223,0,33,118,80,159,36, -8,31,39,20,15,16,2,88,163,8,36,37,56,16,4,52,36,37,36,2,41, -223,0,33,119,80,159,36,8,32,39,20,15,16,2,20,25,96,2,30,88,163, -36,36,53,16,2,8,32,8,240,0,64,0,0,9,223,0,33,120,88,163,36, -37,54,16,2,8,32,8,240,0,128,0,0,9,223,0,33,121,88,163,36,38, -55,16,4,8,32,36,37,36,9,223,0,33,122,80,159,36,8,28,37,20,15, -16,2,88,163,8,36,37,55,16,4,36,42,38,36,2,41,223,0,33,123,80, -159,36,8,33,39,20,15,16,2,88,163,8,36,39,54,16,4,52,36,38,36, -2,31,223,0,33,125,80,159,36,8,29,37,95,29,94,2,18,68,35,37,107, -101,114,110,101,108,11,29,94,2,18,69,35,37,109,105,110,45,115,116,120,11, -2,20,9,9,9,36,0}; - EVAL_ONE_SIZED_STR((char *)expr, 10044); +39,193,159,36,20,114,159,36,16,1,11,16,0,20,26,145,9,2,1,2,1, +29,11,11,11,11,9,9,11,11,11,10,43,80,158,36,36,20,114,159,40,16, +30,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,2,16,2,17,30,2,20,76,102,105,110,100,45, +108,105,110,107,115,45,112,97,116,104,33,11,4,30,2,21,1,20,112,97,114, +97,109,101,116,101,114,105,122,97,116,105,111,110,45,107,101,121,11,6,30,2, +21,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,11,3,2,22,2,23,2,24,30,2,20,1,21,101,120,99, +101,112,116,105,111,110,45,104,97,110,100,108,101,114,45,107,101,121,11,2,2, +25,2,26,2,27,2,28,2,29,2,30,2,31,16,0,37,39,36,16,0,36, +16,13,2,9,2,10,2,8,2,3,2,26,2,24,2,22,2,17,2,23,2, +25,2,15,2,14,2,16,49,11,11,11,16,13,2,13,2,11,2,31,2,12, +2,6,2,30,2,29,2,4,2,28,2,7,2,27,2,2,2,5,16,13,11, +11,11,11,11,11,11,11,11,11,11,11,11,16,13,2,13,2,11,2,31,2, +12,2,6,2,30,2,29,2,4,2,28,2,7,2,27,2,2,2,5,49,49, +37,12,11,11,16,0,16,0,16,0,36,36,11,12,11,11,16,0,16,0,16, +0,36,36,16,30,20,15,16,2,32,0,88,163,36,37,45,11,2,2,222,33, +57,80,159,36,36,37,20,15,16,2,249,22,147,7,7,92,7,92,80,159,36, +37,37,20,15,16,2,88,163,36,37,54,38,2,4,223,0,33,62,80,159,36, +38,37,20,15,16,2,88,163,36,38,58,38,2,5,223,0,33,64,80,159,36, +39,37,20,15,16,2,20,25,96,2,6,88,163,8,36,39,8,25,8,32,9, +223,0,33,71,88,163,36,38,47,52,9,223,0,33,72,88,163,36,37,46,52, +9,223,0,33,73,80,159,36,40,37,20,15,16,2,27,248,22,183,15,248,22, +159,8,27,28,249,22,155,9,247,22,167,8,2,34,6,1,1,59,6,1,1, +58,250,22,129,8,6,14,14,40,91,94,126,97,93,42,41,126,97,40,46,42, +41,23,196,2,23,196,1,88,163,8,36,38,48,11,2,7,223,0,33,77,80, +159,36,41,37,20,15,16,2,32,0,88,163,8,36,38,47,11,2,8,222,33, +78,80,159,36,42,37,20,15,16,2,32,0,88,163,8,36,39,48,11,2,9, +222,33,80,80,159,36,43,37,20,15,16,2,32,0,88,163,8,36,38,46,11, +2,10,222,33,81,80,159,36,44,37,20,15,16,2,88,163,45,39,49,8,128, +16,2,11,223,0,33,83,80,159,36,45,37,20,15,16,2,88,163,45,40,50, +8,128,16,2,13,223,0,33,85,80,159,36,47,37,20,15,16,2,248,22,174, +15,70,108,105,110,107,115,45,102,105,108,101,80,159,36,48,37,20,15,16,2, +247,22,140,2,80,158,36,49,20,15,16,2,2,86,80,158,36,50,20,15,16, +2,248,80,159,37,52,37,88,163,36,36,49,8,240,16,0,6,0,9,223,1, +33,87,80,159,36,51,37,20,15,16,2,247,22,140,2,80,158,36,55,20,15, +16,2,2,86,80,158,36,56,20,15,16,2,88,163,36,37,44,8,240,0,240, +94,0,2,24,223,0,33,98,80,159,36,57,37,20,15,16,2,88,163,36,38, +56,8,240,0,0,128,0,2,25,223,0,33,100,80,159,36,59,37,20,15,16, +2,88,163,36,40,59,8,240,0,128,160,0,2,12,223,0,33,111,80,159,36, +46,37,20,15,16,2,32,0,88,163,36,39,50,11,2,26,222,33,112,80,159, +36,8,24,37,20,15,16,2,32,0,88,163,36,38,53,11,2,27,222,33,113, +80,159,36,8,25,37,20,15,16,2,32,0,88,163,36,38,54,11,2,28,222, +33,114,80,159,36,8,26,37,20,15,16,2,20,27,158,32,0,88,163,36,37, +44,11,2,29,222,33,115,32,0,88,163,36,37,44,11,2,29,222,33,116,80, +159,36,8,27,37,20,15,16,2,88,163,8,36,37,51,16,2,52,8,240,0, +64,0,0,2,41,223,0,33,117,80,159,36,8,30,39,20,15,16,2,88,163, +8,36,37,51,16,2,52,8,240,0,128,0,0,2,41,223,0,33,118,80,159, +36,8,31,39,20,15,16,2,88,163,8,36,37,56,16,4,52,36,37,36,2, +41,223,0,33,119,80,159,36,8,32,39,20,15,16,2,20,25,96,2,30,88, +163,36,36,53,16,2,8,32,8,240,0,64,0,0,9,223,0,33,120,88,163, +36,37,54,16,2,8,32,8,240,0,128,0,0,9,223,0,33,121,88,163,36, +38,55,16,4,8,32,36,37,36,9,223,0,33,122,80,159,36,8,28,37,20, +15,16,2,88,163,8,36,37,55,16,4,36,42,38,36,2,41,223,0,33,123, +80,159,36,8,33,39,20,15,16,2,88,163,8,36,39,54,16,4,52,36,38, +36,2,31,223,0,33,125,80,159,36,8,29,37,95,29,94,2,18,68,35,37, +107,101,114,110,101,108,11,29,94,2,18,69,35,37,109,105,110,45,115,116,120, +11,2,20,9,9,9,36,0}; + EVAL_ONE_SIZED_STR((char *)expr, 10045); } { - SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,53,46,51,46,51,46,52,84,0,0,0,0,0,0,0,0,0,0, + SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,53,46,51,46,51,46,54,84,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,14,0,0,0,1,0,0,15,0,40,0, 57,0,75,0,97,0,120,0,140,0,162,0,169,0,176,0,183,0,190,0,197, -0,0,0,222,1,0,0,74,35,37,112,108,97,99,101,45,115,116,114,117,99, +0,0,0,223,1,0,0,74,35,37,112,108,97,99,101,45,115,116,114,117,99, 116,1,23,115,116,114,117,99,116,58,84,72,45,112,108,97,99,101,45,99,104, 97,110,110,101,108,76,84,72,45,112,108,97,99,101,45,99,104,97,110,110,101, 108,77,84,72,45,112,108,97,99,101,45,99,104,97,110,110,101,108,63,1,20, @@ -595,24 +595,24 @@ 1,20,84,72,45,112,108,97,99,101,45,99,104,97,110,110,101,108,45,111,117, 116,249,80,158,38,39,195,36,249,80,158,38,39,195,36,249,80,158,38,39,195, 36,249,80,158,38,39,195,37,249,80,158,38,39,195,37,159,36,20,114,159,36, -16,1,11,16,0,20,26,144,9,2,1,2,1,29,11,11,11,9,9,11,11, -11,10,45,80,158,36,36,20,114,159,36,16,7,2,2,2,3,2,4,2,5, -2,6,2,7,2,8,16,0,37,39,36,16,0,36,16,2,2,5,2,6,38, -11,11,11,16,5,2,3,2,7,2,8,2,4,2,2,16,5,11,11,11,11, -11,16,5,2,3,2,7,2,8,2,4,2,2,41,41,37,12,11,11,16,0, -16,0,16,0,36,36,11,12,11,11,16,0,16,0,16,0,36,36,16,3,20, -15,16,6,253,22,138,11,2,3,11,38,36,11,248,22,89,249,22,79,22,189, -10,88,163,36,37,45,44,9,223,9,33,9,80,159,36,36,37,80,159,36,37, -37,80,159,36,38,37,80,159,36,39,37,80,159,36,40,37,20,15,16,2,20, -27,158,88,163,36,37,45,44,9,223,0,33,10,88,163,36,37,45,44,9,223, -0,33,11,80,159,36,41,37,20,15,16,2,20,27,158,88,163,36,37,45,44, -9,223,0,33,12,88,163,36,37,45,44,9,223,0,33,13,80,159,36,42,37, -93,29,94,65,113,117,111,116,101,68,35,37,107,101,114,110,101,108,11,9,9, -9,36,0}; - EVAL_ONE_SIZED_STR((char *)expr, 548); +16,1,11,16,0,20,26,145,9,2,1,2,1,29,11,11,11,11,9,9,11, +11,11,10,45,80,158,36,36,20,114,159,36,16,7,2,2,2,3,2,4,2, +5,2,6,2,7,2,8,16,0,37,39,36,16,0,36,16,2,2,5,2,6, +38,11,11,11,16,5,2,3,2,7,2,8,2,4,2,2,16,5,11,11,11, +11,11,16,5,2,3,2,7,2,8,2,4,2,2,41,41,37,12,11,11,16, +0,16,0,16,0,36,36,11,12,11,11,16,0,16,0,16,0,36,36,16,3, +20,15,16,6,253,22,138,11,2,3,11,38,36,11,248,22,89,249,22,79,22, +189,10,88,163,36,37,45,44,9,223,9,33,9,80,159,36,36,37,80,159,36, +37,37,80,159,36,38,37,80,159,36,39,37,80,159,36,40,37,20,15,16,2, +20,27,158,88,163,36,37,45,44,9,223,0,33,10,88,163,36,37,45,44,9, +223,0,33,11,80,159,36,41,37,20,15,16,2,20,27,158,88,163,36,37,45, +44,9,223,0,33,12,88,163,36,37,45,44,9,223,0,33,13,80,159,36,42, +37,93,29,94,65,113,117,111,116,101,68,35,37,107,101,114,110,101,108,11,9, +9,9,36,0}; + EVAL_ONE_SIZED_STR((char *)expr, 549); } { - SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,53,46,51,46,51,46,52,84,0,0,0,0,0,0,0,0,0,0, + SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,53,46,51,46,51,46,54,84,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,89,0,0,0,1,0,0,7,0,18,0, 45,0,51,0,60,0,67,0,89,0,102,0,128,0,145,0,167,0,175,0,187, 0,202,0,218,0,236,0,0,1,12,1,28,1,51,1,63,1,94,1,101,1, @@ -622,7 +622,7 @@ 12,192,12,255,12,18,13,32,13,190,13,203,13,90,14,141,15,223,15,88,16, 145,16,153,16,162,16,186,17,192,17,220,17,233,17,142,18,149,18,203,18,225, 18,245,18,51,19,61,19,75,19,112,19,211,19,213,19,63,20,15,28,68,28, -92,28,116,28,0,0,114,32,0,0,66,35,37,98,111,111,116,70,100,108,108, +92,28,116,28,0,0,115,32,0,0,66,35,37,98,111,111,116,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,68,35, 37,112,97,114,97,109,122,29,94,2,4,2,5,11,1,20,112,97,114,97,109, @@ -969,78 +969,78 @@ 159,37,56,38,248,22,172,5,80,159,37,37,39,248,22,167,14,80,159,37,45, 39,20,18,159,11,80,158,36,55,248,80,159,37,8,27,37,249,22,33,11,80, 159,39,57,37,20,18,159,11,80,158,36,55,248,80,159,37,8,27,37,249,22, -33,11,80,159,39,57,37,159,36,20,114,159,36,16,1,11,16,0,20,26,144, -9,2,1,2,1,29,11,11,11,9,9,11,11,11,10,38,80,158,36,36,20, -114,159,41,16,28,2,2,2,3,30,2,6,2,7,11,6,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,11,3,30,2,8,72,112,97,116,104,45,115,116,114,105,110,103,63,38, -196,11,2,9,30,2,8,71,114,101,114,111,111,116,45,112,97,116,104,40,196, -12,30,2,8,75,112,97,116,104,45,97,100,100,45,115,117,102,102,105,120,40, -196,8,2,10,2,11,2,12,2,13,2,14,2,15,2,16,2,17,2,18,2, -19,2,20,2,21,2,22,30,2,23,2,7,11,6,30,2,8,79,112,97,116, -104,45,114,101,112,108,97,99,101,45,115,117,102,102,105,120,40,196,10,30,2, -8,73,102,105,110,100,45,99,111,108,45,102,105,108,101,44,196,3,30,2,8, -76,110,111,114,109,97,108,45,99,97,115,101,45,112,97,116,104,38,196,7,2, -24,2,25,30,2,23,74,114,101,112,97,114,97,109,101,116,101,114,105,122,101, -11,7,16,0,37,39,36,16,0,36,16,15,2,16,2,17,2,9,2,13,2, -18,2,19,2,12,2,3,2,11,2,2,2,14,2,15,2,10,2,20,2,22, -51,11,11,11,16,3,2,24,2,21,2,25,16,3,11,11,11,16,3,2,24, -2,21,2,25,39,39,37,12,11,11,16,0,16,0,16,0,36,36,11,12,11, -11,16,0,16,0,16,0,36,36,16,23,20,15,16,2,248,22,167,8,69,115, -111,45,115,117,102,102,105,120,80,159,36,36,37,20,15,16,2,88,163,36,38, -8,43,8,189,3,2,3,223,0,33,54,80,159,36,37,37,20,15,16,2,32, -0,88,163,8,36,41,52,11,2,10,222,33,55,80,159,36,44,37,20,15,16, -2,20,27,158,32,0,88,163,8,36,37,42,11,2,11,222,192,32,0,88,163, -8,36,37,42,11,2,11,222,192,80,159,36,45,37,20,15,16,2,247,22,143, -2,80,159,36,41,37,20,15,16,2,8,128,8,80,159,36,46,37,20,15,16, -2,249,22,171,8,8,128,8,11,80,159,36,47,37,20,15,16,2,88,163,8, -36,37,50,8,128,32,2,14,223,0,33,56,80,159,36,48,37,20,15,16,2, -88,163,8,36,38,55,8,128,32,2,15,223,0,33,57,80,159,36,49,37,20, -15,16,2,247,22,75,80,159,36,50,37,20,15,16,2,248,22,18,74,109,111, -100,117,108,101,45,108,111,97,100,105,110,103,80,159,36,51,37,20,15,16,2, -11,80,158,36,52,20,15,16,2,11,80,158,36,53,20,15,16,2,32,0,88, -163,36,38,8,25,11,2,20,222,33,63,80,159,36,54,37,20,15,16,2,11, -80,158,36,55,20,15,16,2,88,164,8,34,37,45,8,240,0,0,40,0,1, -21,112,114,101,112,45,112,108,97,110,101,116,45,114,101,115,111,108,118,101,114, -33,37,224,1,0,33,64,80,159,36,8,28,39,20,15,16,2,88,163,36,37, -50,8,240,0,0,3,0,67,103,101,116,45,100,105,114,223,0,33,65,80,159, -36,8,29,39,20,15,16,2,88,163,36,37,49,8,240,0,0,64,0,72,112, -97,116,104,45,115,115,45,62,114,107,116,223,0,33,66,80,159,36,8,30,39, -20,15,16,2,88,163,8,36,37,45,8,240,0,0,4,0,9,223,0,33,67, -80,159,36,8,31,39,20,15,16,2,88,163,36,37,45,8,240,0,128,0,0, -9,223,0,33,68,80,159,36,8,32,39,20,15,16,2,27,11,20,19,158,36, -90,159,37,10,89,161,37,36,10,20,25,96,2,22,88,163,8,36,38,54,8, -32,9,224,2,1,33,69,88,163,36,39,49,11,9,223,0,33,70,88,163,36, -40,8,32,16,4,8,240,44,240,0,0,8,240,204,241,0,0,37,36,9,224, -2,1,33,85,207,80,159,36,56,37,20,15,16,2,88,163,36,36,45,16,2, -8,130,8,8,184,32,2,24,223,0,33,86,80,159,36,8,25,37,20,15,16, -2,20,27,158,88,163,8,36,36,45,16,2,36,8,168,32,2,25,223,0,33, -87,88,163,8,36,36,45,16,2,36,8,168,32,2,25,223,0,33,88,80,159, -36,8,26,37,96,29,94,2,4,68,35,37,107,101,114,110,101,108,11,29,94, -2,4,69,35,37,109,105,110,45,115,116,120,11,2,8,2,23,9,9,9,36, -0}; - EVAL_ONE_SIZED_STR((char *)expr, 8526); +33,11,80,159,39,57,37,159,36,20,114,159,36,16,1,11,16,0,20,26,145, +9,2,1,2,1,29,11,11,11,11,9,9,11,11,11,10,38,80,158,36,36, +20,114,159,41,16,28,2,2,2,3,30,2,6,2,7,11,6,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,11,3,30,2,8,72,112,97,116,104,45,115,116,114,105,110,103,63, +38,196,11,2,9,30,2,8,71,114,101,114,111,111,116,45,112,97,116,104,40, +196,12,30,2,8,75,112,97,116,104,45,97,100,100,45,115,117,102,102,105,120, +40,196,8,2,10,2,11,2,12,2,13,2,14,2,15,2,16,2,17,2,18, +2,19,2,20,2,21,2,22,30,2,23,2,7,11,6,30,2,8,79,112,97, +116,104,45,114,101,112,108,97,99,101,45,115,117,102,102,105,120,40,196,10,30, +2,8,73,102,105,110,100,45,99,111,108,45,102,105,108,101,44,196,3,30,2, +8,76,110,111,114,109,97,108,45,99,97,115,101,45,112,97,116,104,38,196,7, +2,24,2,25,30,2,23,74,114,101,112,97,114,97,109,101,116,101,114,105,122, +101,11,7,16,0,37,39,36,16,0,36,16,15,2,16,2,17,2,9,2,13, +2,18,2,19,2,12,2,3,2,11,2,2,2,14,2,15,2,10,2,20,2, +22,51,11,11,11,16,3,2,24,2,21,2,25,16,3,11,11,11,16,3,2, +24,2,21,2,25,39,39,37,12,11,11,16,0,16,0,16,0,36,36,11,12, +11,11,16,0,16,0,16,0,36,36,16,23,20,15,16,2,248,22,167,8,69, +115,111,45,115,117,102,102,105,120,80,159,36,36,37,20,15,16,2,88,163,36, +38,8,43,8,189,3,2,3,223,0,33,54,80,159,36,37,37,20,15,16,2, +32,0,88,163,8,36,41,52,11,2,10,222,33,55,80,159,36,44,37,20,15, +16,2,20,27,158,32,0,88,163,8,36,37,42,11,2,11,222,192,32,0,88, +163,8,36,37,42,11,2,11,222,192,80,159,36,45,37,20,15,16,2,247,22, +143,2,80,159,36,41,37,20,15,16,2,8,128,8,80,159,36,46,37,20,15, +16,2,249,22,171,8,8,128,8,11,80,159,36,47,37,20,15,16,2,88,163, +8,36,37,50,8,128,32,2,14,223,0,33,56,80,159,36,48,37,20,15,16, +2,88,163,8,36,38,55,8,128,32,2,15,223,0,33,57,80,159,36,49,37, +20,15,16,2,247,22,75,80,159,36,50,37,20,15,16,2,248,22,18,74,109, +111,100,117,108,101,45,108,111,97,100,105,110,103,80,159,36,51,37,20,15,16, +2,11,80,158,36,52,20,15,16,2,11,80,158,36,53,20,15,16,2,32,0, +88,163,36,38,8,25,11,2,20,222,33,63,80,159,36,54,37,20,15,16,2, +11,80,158,36,55,20,15,16,2,88,164,8,34,37,45,8,240,0,0,40,0, +1,21,112,114,101,112,45,112,108,97,110,101,116,45,114,101,115,111,108,118,101, +114,33,37,224,1,0,33,64,80,159,36,8,28,39,20,15,16,2,88,163,36, +37,50,8,240,0,0,3,0,67,103,101,116,45,100,105,114,223,0,33,65,80, +159,36,8,29,39,20,15,16,2,88,163,36,37,49,8,240,0,0,64,0,72, +112,97,116,104,45,115,115,45,62,114,107,116,223,0,33,66,80,159,36,8,30, +39,20,15,16,2,88,163,8,36,37,45,8,240,0,0,4,0,9,223,0,33, +67,80,159,36,8,31,39,20,15,16,2,88,163,36,37,45,8,240,0,128,0, +0,9,223,0,33,68,80,159,36,8,32,39,20,15,16,2,27,11,20,19,158, +36,90,159,37,10,89,161,37,36,10,20,25,96,2,22,88,163,8,36,38,54, +8,32,9,224,2,1,33,69,88,163,36,39,49,11,9,223,0,33,70,88,163, +36,40,8,32,16,4,8,240,44,240,0,0,8,240,204,241,0,0,37,36,9, +224,2,1,33,85,207,80,159,36,56,37,20,15,16,2,88,163,36,36,45,16, +2,8,130,8,8,184,32,2,24,223,0,33,86,80,159,36,8,25,37,20,15, +16,2,20,27,158,88,163,8,36,36,45,16,2,36,8,168,32,2,25,223,0, +33,87,88,163,8,36,36,45,16,2,36,8,168,32,2,25,223,0,33,88,80, +159,36,8,26,37,96,29,94,2,4,68,35,37,107,101,114,110,101,108,11,29, +94,2,4,69,35,37,109,105,110,45,115,116,120,11,2,8,2,23,9,9,9, +36,0}; + EVAL_ONE_SIZED_STR((char *)expr, 8527); } { - SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,53,46,51,46,51,46,52,84,0,0,0,0,0,0,0,0,0,0, + SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,7,53,46,51,46,51,46,54,84,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,11,0,0,0,1,0,0,10,0,16,0, -29,0,44,0,58,0,78,0,90,0,104,0,118,0,170,0,0,0,98,1,0, +29,0,44,0,58,0,78,0,90,0,104,0,118,0,170,0,0,0,99,1,0, 0,69,35,37,98,117,105,108,116,105,110,65,113,117,111,116,101,29,94,2,2, 67,35,37,117,116,105,108,115,11,29,94,2,2,69,35,37,110,101,116,119,111, 114,107,11,29,94,2,2,68,35,37,112,97,114,97,109,122,11,29,94,2,2, 74,35,37,112,108,97,99,101,45,115,116,114,117,99,116,11,29,94,2,2,66, 35,37,98,111,111,116,11,29,94,2,2,68,35,37,101,120,112,111,98,115,11, -29,94,2,2,68,35,37,107,101,114,110,101,108,11,97,36,11,8,240,140,93, +29,94,2,2,68,35,37,107,101,114,110,101,108,11,97,36,11,8,240,109,93, 0,0,100,159,2,3,36,36,159,2,4,36,36,159,2,5,36,36,159,2,6, 36,36,159,2,7,36,36,159,2,8,36,36,159,2,9,36,36,159,2,9,36, -36,16,0,159,36,20,114,159,36,16,1,11,16,0,20,26,144,9,2,1,2, -1,29,11,11,11,9,9,11,11,11,18,96,11,46,46,46,36,80,158,36,36, -20,114,159,36,16,0,16,0,37,39,36,16,0,36,16,0,36,11,11,11,16, -0,16,0,16,0,36,36,37,12,11,11,16,0,16,0,16,0,36,36,11,12, -11,11,16,0,16,0,16,0,36,36,16,0,104,2,9,2,8,29,94,2,2, -69,35,37,102,111,114,101,105,103,110,11,29,94,2,2,68,35,37,117,110,115, -97,102,101,11,29,94,2,2,69,35,37,102,108,102,120,110,117,109,11,2,7, -2,6,2,5,2,4,2,3,29,94,2,2,67,35,37,112,108,97,99,101,11, -29,94,2,2,69,35,37,102,117,116,117,114,101,115,11,9,9,9,36,0}; - EVAL_ONE_SIZED_STR((char *)expr, 418); +36,16,0,159,36,20,114,159,36,16,1,11,16,0,20,26,145,9,2,1,2, +1,29,11,11,11,11,9,9,11,11,11,18,96,11,46,46,46,36,80,158,36, +36,20,114,159,36,16,0,16,0,37,39,36,16,0,36,16,0,36,11,11,11, +16,0,16,0,16,0,36,36,37,12,11,11,16,0,16,0,16,0,36,36,11, +12,11,11,16,0,16,0,16,0,36,36,16,0,104,2,9,2,8,29,94,2, +2,69,35,37,102,111,114,101,105,103,110,11,29,94,2,2,68,35,37,117,110, +115,97,102,101,11,29,94,2,2,69,35,37,102,108,102,120,110,117,109,11,2, +7,2,6,2,5,2,4,2,3,29,94,2,2,67,35,37,112,108,97,99,101, +11,29,94,2,2,69,35,37,102,117,116,117,114,101,115,11,9,9,9,36,0}; + EVAL_ONE_SIZED_STR((char *)expr, 419); } diff --git a/src/racket/src/marshal.c b/src/racket/src/marshal.c index 816e8e6231..e351d0036c 100644 --- a/src/racket/src/marshal.c +++ b/src/racket/src/marshal.c @@ -1346,6 +1346,8 @@ static Scheme_Object *write_module(Scheme_Object *obj) l = cons(scheme_null, l); } + l = cons((m->phaseless ? scheme_true : scheme_false), l); + l = cons(m->me->src_modidx, l); l = cons(scheme_resolved_module_path_value(m->modsrc), l); l = cons(scheme_resolved_module_path_value(m->modname), l); @@ -1424,6 +1426,10 @@ static Scheme_Object *read_module(Scheme_Object *obj) ((Scheme_Modidx *)me->src_modidx)->resolved = m->modname; m->self_modidx = me->src_modidx; + if (!SCHEME_PAIRP(obj)) return_NULL(); + m->phaseless = (SCHEME_TRUEP(SCHEME_CAR(obj)) ? scheme_true : NULL); + obj = SCHEME_CDR(obj); + for (i = 0; i < 2; i++) { if (!SCHEME_PAIRP(obj)) return_NULL(); e = SCHEME_CAR(obj); diff --git a/src/racket/src/module.c b/src/racket/src/module.c index 86296ee45a..40c74142a4 100644 --- a/src/racket/src/module.c +++ b/src/racket/src/module.c @@ -161,6 +161,8 @@ static int check_is_submodule(Scheme_Object *modname, Scheme_Object *_genv); static Scheme_Object *scheme_sys_wraps_phase_worker(intptr_t p); +static int phaseless_rhs(Scheme_Object *val, int var_count, int phase); + #define cons scheme_make_pair /* global read-only kernel stuff */ @@ -231,6 +233,13 @@ READ_ONLY static Scheme_Object *with_continuation_mark_stx; READ_ONLY static Scheme_Object *letrec_syntaxes_stx; READ_ONLY static Scheme_Object *var_ref_stx; READ_ONLY static Scheme_Object *expression_stx; +READ_ONLY static Scheme_Object *quote_stx; +READ_ONLY static Scheme_Object *datum_stx; + +READ_ONLY static Scheme_Object *make_struct_type_stx; +READ_ONLY static Scheme_Object *make_struct_type_property_stx; +READ_ONLY static Scheme_Object *list_stx; +READ_ONLY static Scheme_Object *cons_stx; READ_ONLY static Scheme_Object *empty_self_modidx; READ_ONLY static Scheme_Object *empty_self_modname; @@ -290,7 +299,8 @@ static void parse_requires(Scheme_Object *form, int at_phase, int eval_exp, int eval_run, int *all_simple, Scheme_Hash_Table *modix_cache, - Scheme_Hash_Table *submodule_names); + Scheme_Hash_Table *submodule_names, + int *maybe_phaseless); static void parse_provides(Scheme_Object *form, Scheme_Object *fst, Scheme_Object *e, int at_phase, Scheme_Hash_Table *all_provided, @@ -503,6 +513,7 @@ void scheme_finish_kernel(Scheme_Env *env) kernel = MALLOC_ONE_TAGGED(Scheme_Module); kernel->so.type = scheme_module_type; kernel->predefined = 1; + kernel->phaseless = scheme_true; env->module = kernel; { @@ -624,6 +635,8 @@ void scheme_finish_kernel(Scheme_Env *env) REGISTER_SO(letrec_syntaxes_stx); REGISTER_SO(var_ref_stx); REGISTER_SO(expression_stx); + REGISTER_SO(quote_stx); + REGISTER_SO(datum_stx); w = scheme_sys_wraps0; scheme_module_stx = scheme_datum_to_syntax(scheme_intern_symbol("module"), scheme_false, w, 0, 0); @@ -648,6 +661,18 @@ void scheme_finish_kernel(Scheme_Env *env) letrec_syntaxes_stx = scheme_datum_to_syntax(scheme_intern_symbol("letrec-syntaxes+values"), scheme_false, w, 0, 0); var_ref_stx = scheme_datum_to_syntax(scheme_intern_symbol("#%variable-reference"), scheme_false, w, 0, 0); expression_stx = scheme_datum_to_syntax(scheme_intern_symbol("#%expression"), scheme_false, w, 0, 0); + quote_stx = scheme_datum_to_syntax(scheme_intern_symbol("quote"), scheme_false, w, 0, 0); + datum_stx = scheme_datum_to_syntax(scheme_intern_symbol("#%datum"), scheme_false, w, 0, 0); + + REGISTER_SO(make_struct_type_stx); + REGISTER_SO(make_struct_type_property_stx); + REGISTER_SO(cons_stx); + REGISTER_SO(list_stx); + + make_struct_type_stx = scheme_datum_to_syntax(scheme_intern_symbol("make-struct-type"), scheme_false, w, 0, 0); + make_struct_type_property_stx = scheme_datum_to_syntax(scheme_intern_symbol("make-struct-type-property"), scheme_false, w, 0, 0); + cons_stx = scheme_datum_to_syntax(scheme_intern_symbol("cons"), scheme_false, w, 0, 0); + list_stx = scheme_datum_to_syntax(scheme_intern_symbol("list"), scheme_false, w, 0, 0); REGISTER_SO(prefix_symbol); REGISTER_SO(only_symbol); @@ -1317,7 +1342,8 @@ static Scheme_Object *do_namespace_require(Scheme_Env *env, int argc, Scheme_Obj NULL, 1, copy, 0, (etonly ? 1 : -1), !etonly, - NULL, NULL, NULL); + NULL, NULL, NULL, + NULL); scheme_append_rename_set_to_env(rns, env); @@ -3896,6 +3922,7 @@ static Scheme_Object *_module_resolve_k(void) Scheme_Env *env = (Scheme_Env *)p->ku.k.p2; p->ku.k.p1 = NULL; + p->ku.k.p2 = NULL; return _module_resolve(base, NULL, env, p->ku.k.i1); } @@ -5560,6 +5587,19 @@ static void *eval_module_body_k(void) static void eval_module_body(Scheme_Env *menv, Scheme_Env *env) { + if (menv->module->phaseless) { + /* Phaseless modules are implemented by last-minute sharing of the + `toplevels' table. In principle, much more repeated work up to + this point could be skipped, but this is the simplest point to + implement the sharing. */ + if (SAME_OBJ(scheme_true, menv->module->phaseless)) { + menv->module->phaseless = (Scheme_Object *)menv->toplevel; + } else { + menv->toplevel = (Scheme_Bucket_Table *)menv->module->phaseless; + return; + } + } + #ifdef MZ_USE_JIT (void)scheme_module_run_start(menv, env, scheme_make_pair(menv->module->modsrc, scheme_true)); #else @@ -5741,6 +5781,7 @@ Scheme_Env *scheme_primitive_module(Scheme_Object *name, Scheme_Env *for_env) m = MALLOC_ONE_TAGGED(Scheme_Module); m->so.type = scheme_module_type; m->predefined = scheme_starting_up; + m->phaseless = (scheme_starting_up ? scheme_true : NULL); env = scheme_new_module_env(for_env, m, 0); @@ -6939,6 +6980,7 @@ static Scheme_Object *do_module(Scheme_Object *form, Scheme_Comp_Env *env, m = MALLOC_ONE_TAGGED(Scheme_Module); m->so.type = scheme_module_type; m->predefined = scheme_starting_up; + m->phaseless = (scheme_starting_up ? scheme_true : NULL); /* must set before calling new_module_env: */ rmp = SCHEME_STX_VAL(nm); @@ -7075,6 +7117,9 @@ static Scheme_Object *do_module(Scheme_Object *form, Scheme_Comp_Env *env, m->tt_requires = scheme_null; m->dt_requires = scheme_null; + if (iim && iim->phaseless) + m->phaseless = scheme_true; + if (iidx) { Scheme_Object *ins; ins = cons(iidx, scheme_null); @@ -7722,7 +7767,8 @@ Scheme_Object *scheme_parse_lifted_require(Scheme_Object *module_path, 1, 0, all_simple, NULL, - submodule_names); + submodule_names, + NULL); return e; } @@ -8245,7 +8291,7 @@ static Scheme_Object *do_module_begin_at_phase(Scheme_Object *form, Scheme_Comp_ Scheme_Object *lift_data; Scheme_Object *lift_ctx; Scheme_Object *lifted_reqs = scheme_null, *req_data, *unbounds = scheme_null; - int maybe_has_lifts = 0, expand_ends = (phase == 0); + int maybe_has_lifts = 0, expand_ends = (phase == 0), maybe_phaseless; Scheme_Object *observer, *vec, *end_statements; Scheme_Object *begin_for_syntax_stx; const char *who = "module"; @@ -8301,6 +8347,9 @@ static Scheme_Object *do_module_begin_at_phase(Scheme_Object *form, Scheme_Comp_ if (*bxs->_num_phases < phase + 1) *bxs->_num_phases = phase + 1; + maybe_phaseless = (env->genv->module->phaseless ? 1 : 0); + env->genv->module->phaseless = NULL; + /* Expand each expression in form up to `begin', `define-values', `define-syntax', `require', `provide', `#%app', etc. */ xenv = scheme_new_compilation_frame(0, (SCHEME_CAPTURE_WITHOUT_RENAME @@ -8498,6 +8547,7 @@ static Scheme_Object *do_module_begin_at_phase(Scheme_Object *form, Scheme_Comp_ if (scheme_stx_module_eq_x(scheme_define_values_stx, fst, phase)) { /************ define-values *************/ Scheme_Object *vars, *val; + int var_count = 0; SCHEME_EXPAND_OBSERVE_ENTER_PRIM(observer, e); SCHEME_EXPAND_OBSERVE_PRIM_DEFINE_VALUES(observer); @@ -8546,7 +8596,11 @@ static Scheme_Object *do_module_begin_at_phase(Scheme_Object *form, Scheme_Comp_ scheme_extend_module_rename(rn, self_modidx, name, name, self_modidx, name, phase, NULL, NULL, 0); vars = SCHEME_STX_CDR(vars); + var_count++; } + + if (maybe_phaseless && !phaseless_rhs(val, var_count, phase)) + maybe_phaseless = 0; SCHEME_EXPAND_OBSERVE_EXIT_PRIM(observer, e); kind = DEFN_MODFORM_KIND; @@ -8757,7 +8811,9 @@ static Scheme_Object *do_module_begin_at_phase(Scheme_Object *form, Scheme_Comp_ SCHEME_EXPAND_OBSERVE_EXIT_PRIM(observer, e); kind = DONE_MODFORM_KIND; - } else if (scheme_stx_module_eq_x(require_stx, fst, phase)) { + + maybe_phaseless = 0; + } else if (scheme_stx_module_eq_x(require_stx, fst, phase)) { /************ require *************/ SCHEME_EXPAND_OBSERVE_ENTER_PRIM(observer, e); SCHEME_EXPAND_OBSERVE_PRIM_REQUIRE(observer); @@ -8770,7 +8826,8 @@ static Scheme_Object *do_module_begin_at_phase(Scheme_Object *form, Scheme_Comp_ 0, 0, 1, 1, phase ? 1 : 0, bxs->all_simple_renames, bxs->modidx_cache, - bxs->submodule_names); + bxs->submodule_names, + &maybe_phaseless); if (!erec) e = NULL; @@ -8843,12 +8900,18 @@ static Scheme_Object *do_module_begin_at_phase(Scheme_Object *form, Scheme_Comp_ kind = MODULE_MODFORM_KIND; } SCHEME_EXPAND_OBSERVE_EXIT_PRIM(observer,e); - } else + } else { kind = EXPR_MODFORM_KIND; - } else + maybe_phaseless = 0; + } + } else { + maybe_phaseless = 0; kind = EXPR_MODFORM_KIND; - } else + } + } else { + maybe_phaseless = 0; kind = EXPR_MODFORM_KIND; + } if (e) { p = scheme_make_pair(scheme_make_pair(e, scheme_make_integer(kind)), scheme_null); @@ -9113,6 +9176,9 @@ static Scheme_Object *do_module_begin_at_phase(Scheme_Object *form, Scheme_Comp_ adt = scheme_hash_tree_set(bxs->all_defs, scheme_make_integer(phase), all_rt_defs); bxs->all_defs = adt; + if (cenv->prefix->non_phaseless) + maybe_phaseless = 0; + if (!phase) env->genv->module->comp_prefix = cenv->prefix; else @@ -9131,6 +9197,9 @@ static Scheme_Object *do_module_begin_at_phase(Scheme_Object *form, Scheme_Comp_ } } + if (maybe_phaseless) + env->genv->module->phaseless = scheme_true; + if (rec[drec].comp) { body_lists = scheme_make_pair(first, scheme_make_pair(exp_body, body_lists)); if (erec) @@ -11082,6 +11151,158 @@ Scheme_Object *scheme_module_exported_list(Scheme_Object *modpath, Scheme_Env *g } } +static int expression_starts(Scheme_Object *expr, Scheme_Object *id, int phase) +{ + if (SCHEME_STX_PAIRP(expr)) { + expr = SCHEME_STX_CAR(expr); + if (SCHEME_STX_SYMBOLP(expr)) { + if (scheme_stx_module_eq_x(id, expr, phase)) + return 1; + } + } + + return 0; +} + +static int expression_starts_app(Scheme_Object *expr, Scheme_Object *id, int phase) +{ + if (expression_starts(expr, app_stx, phase)) { + expr = SCHEME_STX_CDR(expr); + if (SCHEME_STX_PAIRP(expr)) { + expr = SCHEME_STX_CDR(expr); + return expression_starts(expr, id, phase); + } + } else if (expression_starts(expr, id, phase)) { + /* would explicit `#%app' be the core one? */ + id = scheme_datum_to_syntax(SCHEME_STX_VAL(app_stx), expr, expr, 0, 0); + id = scheme_stx_taint_rearm(id, expr); + if (scheme_stx_module_eq_x(app_stx, id, phase)) + return 1; + } + + return 0; +} + +static int phaseless_literal(Scheme_Object *val) +{ + val = SCHEME_STX_VAL(val); + + if (SCHEME_BOOLP(val) + || SCHEME_SYMBOLP(val) + || SCHEME_KEYWORDP(val) + || SCHEME_NULLP(val) + || SCHEME_NUMBERP(val) + || (SCHEME_CHAR_STRINGP(val) && SCHEME_IMMUTABLEP(val)) + || (SCHEME_BYTE_STRINGP(val) && SCHEME_IMMUTABLEP(val))) + return 1; + + return 0; +} + +static int phaseless_constant_expression(Scheme_Object *val, int phase); + +static int phaseless_constant_expressions(Scheme_Object *expr, int phase) +{ + Scheme_Object *a; + + while (SCHEME_STX_PAIRP(expr)) { + a = SCHEME_STX_CAR(expr); + if (!phaseless_constant_expression(a, phase)) + return 0; + expr = SCHEME_STX_CDR(expr); + } + + return SCHEME_STX_NULLP(expr); +} + +static Scheme_Object *phaseless_constant_expression_k(void) +{ + Scheme_Thread *p = scheme_current_thread; + Scheme_Object *val = (Scheme_Object *)p->ku.k.p1; + + p->ku.k.p1 = NULL; + + if (phaseless_constant_expression(val, p->ku.k.i1)) + return scheme_true; + else + return scheme_false; +} + +static int phaseless_constant_expression(Scheme_Object *val, int phase) +{ +# include "mzstkchk.h" + { + Scheme_Thread *p = scheme_current_thread; + p->ku.k.p1 = (void *)val; + p->ku.k.i1 = phase; + val = scheme_handle_stack_overflow(phaseless_constant_expression_k); + return SCHEME_TRUEP(val); + } + + /* identifier? */ + if (SCHEME_SYMBOLP(SCHEME_STX_VAL(val))) + return 1; + + if (expression_starts(val, lambda_stx, phase)) + return 1; + + if (expression_starts(val, case_lambda_stx, phase)) + return 1; + + if (expression_starts(val, quote_stx, phase)) { + val = SCHEME_STX_CDR(val); + if (SCHEME_STX_PAIRP(val)) { + val = SCHEME_STX_CAR(val); + if (phaseless_literal(val)) + return 1; + } + return 0; + } else if (expression_starts(val, datum_stx, phase)) { + val = SCHEME_STX_CDR(val); + if (phaseless_literal(val)) + return 1; + return 0; + } else if (phaseless_literal(val)) { + /* would explicit `#%datum' be the core one? */ + Scheme_Object *a; + a = SCHEME_STX_VAL(datum_stx); + val = scheme_stx_taint_rearm(scheme_datum_to_syntax(a, val, val, 0, 0), + val); + if (scheme_stx_module_eq_x(datum_stx, val, phase)) + return 1; + return 0; + } + + if (expression_starts_app(val, cons_stx, phase) + || expression_starts_app(val, list_stx, phase)) { + val = SCHEME_STX_CDR(val); + return phaseless_constant_expressions(val, phase); + } + + + return 0; +} + +static int phaseless_rhs(Scheme_Object *val, int var_count, int phase) +{ + if (var_count == 1) { + if (phaseless_constant_expression(val, phase)) + return 1; + } else if (var_count == 5) { + if (expression_starts_app(val, make_struct_type_stx, phase) + && phaseless_constant_expressions(val, phase)) { + return 1; + } + } else if (var_count == 3) { + if (expression_starts_app(val, make_struct_type_property_stx, phase) + && phaseless_constant_expressions(val, phase)) { + return 1; + } + } + + return 0; +} + /**********************************************************************/ /* top-level require */ /**********************************************************************/ @@ -11511,7 +11732,8 @@ void parse_requires(Scheme_Object *form, int at_phase, int eval_exp, int eval_run, int *all_simple, Scheme_Hash_Table *modidx_cache, - Scheme_Hash_Table *submodule_names) + Scheme_Hash_Table *submodule_names, + int *maybe_phaseless) /* form can be a module-path index or a quoted require spec */ { Scheme_Object *ll = form, *mode = scheme_make_integer(0), *just_mode = NULL, *x_mode, *x_just_mode; @@ -11856,6 +12078,9 @@ void parse_requires(Scheme_Object *form, int at_phase, start ? eval_exp : 0, start ? eval_run : 0, main_env->phase, scheme_null, 0); + if (maybe_phaseless && !m->phaseless) + *maybe_phaseless = 0; + x_just_mode = just_mode; x_mode = mode; if (at_phase) { @@ -12000,7 +12225,8 @@ do_require_execute(Scheme_Env *env, Scheme_Object *form) NULL, !env->module, 0, 0, -1, 1, - NULL, NULL, NULL); + NULL, NULL, NULL, + NULL); scheme_append_rename_set_to_env(rn_set, env); @@ -12055,7 +12281,8 @@ static Scheme_Object *do_require(Scheme_Object *form, Scheme_Comp_Env *env, NULL, 0, 0, 0, 1, 0, - NULL, NULL, NULL); + NULL, NULL, NULL, + NULL); if (rec && rec[drec].comp) { /* Dummy lets us access a top-level environment: */ diff --git a/src/racket/src/mzmark_type.inc b/src/racket/src/mzmark_type.inc index 60b1fa4f02..cdbaafbca0 100644 --- a/src/racket/src/mzmark_type.inc +++ b/src/racket/src/mzmark_type.inc @@ -2618,6 +2618,8 @@ static int module_val_SIZE(void *p, struct NewGC *gc) { static int module_val_MARK(void *p, struct NewGC *gc) { Scheme_Module *m = (Scheme_Module *)p; + gcMARK2(m->phaseless, gc); + gcMARK2(m->code_key, gc); gcMARK2(m->modname, gc); @@ -2666,6 +2668,8 @@ static int module_val_MARK(void *p, struct NewGC *gc) { static int module_val_FIXUP(void *p, struct NewGC *gc) { Scheme_Module *m = (Scheme_Module *)p; + gcFIXUP2(m->phaseless, gc); + gcFIXUP2(m->code_key, gc); gcFIXUP2(m->modname, gc); diff --git a/src/racket/src/mzmarksrc.c b/src/racket/src/mzmarksrc.c index a94ee2e256..c9e365ed84 100644 --- a/src/racket/src/mzmarksrc.c +++ b/src/racket/src/mzmarksrc.c @@ -1045,6 +1045,8 @@ module_val { mark: Scheme_Module *m = (Scheme_Module *)p; + gcMARK2(m->phaseless, gc); + gcMARK2(m->code_key, gc); gcMARK2(m->modname, gc); diff --git a/src/racket/src/optimize.c b/src/racket/src/optimize.c index 67ac41f579..fef7420a21 100644 --- a/src/racket/src/optimize.c +++ b/src/racket/src/optimize.c @@ -5212,6 +5212,14 @@ module_optimize(Scheme_Object *data, Optimize_Info *info, int context) return (Scheme_Object *)m; } + if (m->phaseless) { + scheme_log(info->logger, + SCHEME_LOG_DEBUG, + 0, + "compilation of phaseless module: %D", + m->modname); + } + old_context = info->context; info->context = (Scheme_Object *)m; diff --git a/src/racket/src/schpriv.h b/src/racket/src/schpriv.h index 0e3e600188..7367a4819b 100644 --- a/src/racket/src/schpriv.h +++ b/src/racket/src/schpriv.h @@ -2368,7 +2368,7 @@ intptr_t scheme_get_print_width(void); typedef struct Comp_Prefix { MZTAG_IF_REQUIRED - int num_toplevels, num_stxes; + int num_toplevels, num_stxes, non_phaseless; Scheme_Hash_Table *toplevels; /* buckets for toplevel/module variables */ Scheme_Hash_Table *inline_variants; /* position -> inline_variant */ Scheme_Object *unbound; /* identifiers (and lists of phase-1 shifted unbounds) that were unbound at compile */ @@ -3251,6 +3251,8 @@ typedef struct Scheme_Module Scheme_Object so; /* scheme_module_type */ short predefined; + Scheme_Object *phaseless; /* NULL, #t, or shared `toplevel' hash table */ + Scheme_Object *code_key; Scheme_Object *modname; diff --git a/src/racket/src/schvers.h b/src/racket/src/schvers.h index 5b6183fb39..f1d0700d11 100644 --- a/src/racket/src/schvers.h +++ b/src/racket/src/schvers.h @@ -13,12 +13,12 @@ consistently.) */ -#define MZSCHEME_VERSION "5.3.3.5" +#define MZSCHEME_VERSION "5.3.3.6" #define MZSCHEME_VERSION_X 5 #define MZSCHEME_VERSION_Y 3 #define MZSCHEME_VERSION_Z 3 -#define MZSCHEME_VERSION_W 5 +#define MZSCHEME_VERSION_W 6 #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/racket/src/validate.c b/src/racket/src/validate.c index 42555f41ca..be464419d5 100644 --- a/src/racket/src/validate.c +++ b/src/racket/src/validate.c @@ -135,11 +135,23 @@ static void add_struct_mapping(Scheme_Hash_Table **_st_ht, int pos, int field_co scheme_make_integer(field_count)); } +static int phaseless_expr(Scheme_Object *expr) +{ + /* A precise check is a little tricky, since compiler optimizations + might change the original program beyond easily recognition of + the syntactic pattern that defines "phaseless". For now, let + anything through; the result can be weird if state somehow leakes + through a "phaseless" module, but I don't think it can be unsafe + from the run-time system's perspective. */ + return 1; +} + void scheme_validate_code(Mz_CPort *port, Scheme_Object *code, int depth, int num_toplevels, int num_stxes, int num_lifts, void *tl_use_map, Scheme_Object **toplevels, int code_vec) +/* code_vec == 2 => check that phasesless is ok */ { char *stack; int delta; @@ -147,6 +159,7 @@ void scheme_validate_code(Mz_CPort *port, Scheme_Object *code, Validate_TLS tls; mzshort *tl_state; Scheme_Hash_Table *st_ht = NULL; + Scheme_Object *form; depth += ((num_toplevels || num_stxes || num_lifts) ? 1 : 0); @@ -201,8 +214,16 @@ void scheme_validate_code(Mz_CPort *port, Scheme_Object *code, int i, cnt, tl_timestamp = 1; cnt = SCHEME_VEC_SIZE(code); for (i = 0; i < cnt; i++) { + form = SCHEME_VEC_ELS(code)[i]; + if (code_vec == 2) { + if (SAME_TYPE(SCHEME_TYPE(form), scheme_define_values_type)) { + if (!phaseless_expr(SCHEME_VEC_ELS(form)[0])) + scheme_ill_formed_code(port); + } else + scheme_ill_formed_code(port); + } reset_clearing(vc); - if (!validate_expr(port, SCHEME_VEC_ELS(code)[i], + if (!validate_expr(port, form, stack, tls, depth, delta, delta, num_toplevels, num_stxes, num_lifts, tl_use_map, @@ -1118,6 +1139,9 @@ static void module_validate(Scheme_Object *data, Mz_CPort *port, if (!SCHEME_MODNAMEP(m->modname)) scheme_ill_formed_code(port); + if (m->phaseless && m->prefix->num_stxes) + scheme_ill_formed_code(port); + validate_toplevel(m->dummy, port, stack, tls, depth, delta, num_toplevels, num_stxes, num_lifts, tl_use_map, tl_state, tl_timestamp, @@ -1126,12 +1150,14 @@ static void module_validate(Scheme_Object *data, Mz_CPort *port, scheme_validate_code(port, m->bodies[0], m->max_let_depth, m->prefix->num_toplevels, m->prefix->num_stxes, m->prefix->num_lifts, NULL, m->prefix->toplevels, - 1); - + (m->phaseless ? 2 : 1)); + /* validate exp-time code */ for (j = m->num_phases; j-- > 1; ) { cnt = SCHEME_VEC_SIZE(m->bodies[j]); for (i = 0; i < cnt; i++) { + if (m->phaseless) scheme_ill_formed_code(port); + e = SCHEME_VEC_ELS(m->bodies[j])[i]; let_depth = SCHEME_INT_VAL(SCHEME_VEC_ELS(e)[2]);