racket/s/expand-lang.ss
dybvig d0b405ac8b library-manager, numeric, and bytevector-compres improvements
- added invoke-library
    syntax.ss, primdata.ss,
    8.ms, root-experr*,
    libraries.stex, release_notes.stex
- updated the date
    release_notes.stex
- libraries contained within a whole program or library are now
  marked pending before their invoke code is run so that invoke
  cycles are reported as such rather than as attempts to invoke
  while still loading.
    compile.ss, syntax.ss, primdata.ss,
    7.ms, root-experr*
- the library manager now protects against unbound references
  from separately compiled libraries or programs to identifiers
  ostensibly but not actually exported by (invisible) libraries
  that exist only locally within a whole program.  this is done by
  marking the invisibility of the library in the library-info and
  propagating it to libdesc records; the latter is checked upon
  library import, visit, and invoke as well as by verify-loadability.
  the import and visit code of each invisible no longer complains
  about invisibility since it shouldn't be reachable.
    syntax.ss, compile.ss, expand-lang.ss,
    7.ms, 8.ms, root-experr*, patch*
- documented that compile-whole-xxx's linearization of the
  library initialization code based on static dependencies might
  not work for dynamic dependencies.
    system.stex
- optimized bignum right shifts so the code (1) doesn't look at
  shifted-off bigits if the bignum is positive, since it doesn't
  need to know in that case if any bits are set; (2) doesn't look
  at shifted-off bigits if the bignum is negative if it determines
  that at least one bit is set in the bits shifted off the low-order
  partially retained bigit; (3) quits looking, if it must look, for
  one bits as soon as it finds one; (4) looks from both ends under
  the assumption that set bits, if any, are most likely to be found
  toward the high or low end of the bignum rather than just in the
  middle; and (5) doesn't copy the retained bigits and then shift;
  rather shifts as it copies.  This leads to dramatic improvements
  when the shift count is large and often significant improvements
  otherwise.
    number.c,
    5_3.ms,
    release_notes.stex
- threaded tc argument through to all calls to S_bignum and
  S_trunc_rem so they don't have to call get_thread_context()
  when it might already have been called.
    alloc.c, number.c, fasl.c, print.c, prim5.c, externs.h
- added an expand-primitive handler to partially inline integer?.
    cpnanopass.ss
- added some special cases for basic arithmetic operations (+, -, *,
  /, quotient, remainder, and the div/div0/mod/mod0 operations) to
  avoid doing unnecessary work for large bignums when the result
  will be zero (e.g,. multiplying by 0), the same as one of the
  inputs (e.g., adding 0 or multiplying by 1), or the additive
  inverse of one of the inputs (e.g., subtracting from 0, dividing
  by -1).  This can have a major beneficial affect when operating
  on large bignums in the cases handled.  also converted some uses
  of / into integer/ where going through the former would just add
  overhead without the possibility of optimization.
    5_3.ss,
    number.c, externs.h, prim5.c,
    5_3.ms, root-experr, patch*,
    release_notes.stex
- added a queue to hold pending signals for which handlers have
  been registered via register-signal-handler so up to 63 (configurable
  in the source code) unhandled signals are buffered before the
  handler has to start dropping them.
    cmacros.ss, library.ss, prims.ss, primdata.ss,
    schsig.c, externs.h, prim5.c, thread.c, gc.c,
    unix.ms,
    system.stex, release_notes.stex
- bytevector-compress now selects the level of compression based
  on the compress-level parameter.  Prior to this it always used a
  default setting for compression.  the compress-level parameter
  can now take on the new minimum in addition to low, medium, high,
  and maximum.  minimum is presently treated the same as low
  except in the case of lz4 bytevector compression, where it
  results in the use of LZ4_compress_default rather than the
  slower but more effective LZ4_compress_HC.
    cmacros,ss, back.ss,
    compress_io.c, new_io.c, externs.h,
    bytevector.ms, mats/Mf-base, root-experr*
    io.stex, objects.stex, release_notes.stex

original commit: 72d90e4c67849908da900d0b6249a1dedb5f8c7f
2020-02-21 13:48:47 -08:00

115 lines
3.2 KiB
Scheme

;;; expand-lang.ss
;;; Copyright 1984-2017 Cisco Systems, Inc.
;;;
;;; Licensed under the Apache License, Version 2.0 (the "License");
;;; you may not use this file except in compliance with the License.
;;; You may obtain a copy of the License at
;;;
;;; http://www.apache.org/licenses/LICENSE-2.0
;;;
;;; Unless required by applicable law or agreed to in writing, software
;;; distributed under the License is distributed on an "AS IS" BASIS,
;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;;; See the License for the specific language governing permissions and
;;; limitations under the License.
(define-record-type libreq
(fields
(immutable path)
(immutable version)
(immutable uid))
(nongenerative #{libreq fnuxvkuvs8x0xbc68h3hm6-0})
(sealed #t))
(define-record-type recompile-info
(fields
(immutable import-req*)
(immutable include-req*))
(nongenerative #{recompile-info fnuxvkuvs8x0xbc68h3hm6-1})
(sealed #t))
(define-record-type library-info
(nongenerative #{library-info e10vy7tci6bqz6pmnxgvlq-3})
(fields
(immutable path)
(immutable version)
(immutable uid)
(immutable visible?)))
(define-record-type library/ct-info
(parent library-info)
(fields
(immutable import-req*)
(immutable visit-visit-req*)
(immutable visit-req*))
(nongenerative #{library/ct-info fgf0koeh2zn6ajlujfyoyf-4})
(sealed #t))
(define-record-type library/rt-info
(parent library-info)
(fields
(immutable invoke-req*))
(nongenerative #{library/rt-info ff86rtm7efmvxcvrmh7t0b-3})
(sealed #t))
(define-record-type program-info
(fields (immutable uid) (immutable invoke-req*))
(nongenerative #{program-info fgc8ptwnu9i5gfqz3s85mr-0})
(sealed #t))
(module (Lexpand Lexpand?)
(define library-path?
(lambda (x)
(and (list? x) (andmap symbol? x))))
(define library-version?
(lambda (x)
(and (list? x)
(andmap (lambda (x) (and (integer? x) (exact? x) (>= x 0))) x))))
(define maybe-optimization-loc? (lambda (x) (or (not x) (box? x)))) ; should be a record
(define maybe-label? (lambda (x) (or (not x) (gensym? x))))
(define-language Lexpand
(nongenerative-id #{Lexpand fgy7v2wrvj0so4ro8kvhqo-3})
(terminals
(maybe-label (dl))
(gensym (uid export-id))
(library-path (path))
(library-version (version))
(maybe-optimization-loc (db))
(prelex (dv))
(libreq (import-req visit-req visit-visit-req invoke-req))
(string (include-req))
(Lsrc (lsrc body init visit-code import-code de)) => unparse-Lsrc
(recompile-info (rcinfo))
(library/ct-info (linfo/ct))
(library/rt-info (linfo/rt))
(program-info (pinfo)))
(Outer (outer)
(recompile-info rcinfo)
(group outer1 outer2)
(visit-only inner)
(revisit-only inner)
inner)
(Inner (inner)
(library/ct-info linfo/ct)
ctlib
(library/rt-info linfo/rt)
rtlib
(program-info pinfo)
prog
lsrc)
(ctLibrary (ctlib)
(library/ct uid (export-id* ...) import-code visit-code))
(rtLibrary (rtlib)
(library/rt uid
(dl* ...)
(db* ...)
(dv* ...)
(de* ...)
body))
(Program (prog)
(program uid body))))