Commit Graph

42440 Commits

Author SHA1 Message Date
Matthew Flatt
cbcd9505aa racocs decompile: handle linklets in 'interpret mode 2020-01-31 06:10:33 -07:00
Matthew Flatt
4acf864b0e delay cross-system-library-subpath call
In `compiler/private/mach-o` --- which is reachable via `racket` due
to being a dependency of `setup/dirs` --- delay the call to
`cross-system-library-subpath` until needed.
2020-01-31 05:23:18 -07:00
Matthew Flatt
8da6e9bd6b cs: use black hole for unsafe-undefined representation 2020-01-30 20:18:12 -07:00
Matthew Flatt
ad9dc342f8 cs: suppress reundant letrec-variable checking
The schmiefy pass already ensures that variables are defined before
use, so skip cpvalid in Chez Scheme. The difference is tiny, though.
2020-01-30 18:59:02 -07:00
Matthew Flatt
d13e5898c8 add enable-unsafe-variable-reference
original commit: 77a0ef249b6d419dcac7c8e1c28e710b30a7aa33
2020-01-30 17:46:30 -07:00
Matthew Flatt
37ce9478cd move symbol->immutable-string and keyword->immutable->string out of racket/base
Move them to new `racket/symbol` and `racket/keyword` libraries to
avoid conflicts with existing packages.
2020-01-30 15:53:16 -07:00
Matthew Flatt
fa6e7101df adjust inliner to avoid infinite inline
Fixes optimization for an expression like

 (define (f x)
   (lambda (y)
     (letrec ([recursion (f x)])
       (+ x y))))

by adjusting the inlining hueristic to support less inlining on a
second pass of `letrec` right-hand sides.

Closes #3027
2020-01-30 08:31:04 -07:00
Matthew Flatt
e0d4ede953 doc typos and clarifications on ffi/unsafe/vm 2020-01-30 05:52:18 -07:00
Matthew Flatt
fb95e9312f racocs decompile: show machine code or assembly
When the "disassemble" package is installed, use it to disassemble the
machine code in a Racket CS linklet.
2020-01-29 20:01:24 -07:00
Matthew Flatt
27e21e6e7d code inspector: improvements to reloc reporting
Fix 'reloc to avoid a crash on static-generation code, and add
'reloc+offset to report an offset for each entry.

original commit: 4d4195044377f9c619cfb46056e365044069d5bc
2020-01-29 16:22:52 -07:00
Matthew Flatt
69932f6f67 add ffi/unsafe/vm
Provide `vm-primitive` and `vm-eval` to regularize access to VM-level
primitives. Document some of the issues for interoperating across the
Racket and (Chez Scheme) VM layers.

The library could have been implemented with just `compile-linklet`
and `instantiate-linklet`, but using an underlying `primitive-lookup`
function is a little nicer.
2020-01-29 11:07:40 -07:00
KDr2
a01f9ada99 Docs update: bug fix in embedding examples 2020-01-29 14:44:33 -03:00
Jack Firth
b24e22cb5c
Centralize documentation on equality and hashing (#3019)
Additionally:

- Add a tech definition for "hash code" and be more explicit about the rule that equal values must have equal hash codes.

- Add some intro text about equality and lightly recommend using equal? instead of the other comparison functions.

- Be more specific about the difference between eqv? and equal?, and lightly discourage use of eqv? since equal? makes it superflous.

- Use more modern APIs, such as `#lang scribble/manual` instead of `#lang scribble/doc`, `scribble/example` instead of `scribble/eval`, and `struct` instead of `define-struct`.

- Use clearer variable names and function names in the example code for gen:equal+hash.
2020-01-29 08:05:58 -07:00
Greg Hendershott
2695003cc6 Delete docs for four obsolete expanded module stx props
Rewrite docs for a fifth that used to refer to them.

This is just me trying to be helpful based on my (mis?)understanding
of a Slack conversation with @mflatt -- in other words someone should
definitely review this before merging.
2020-01-29 07:58:49 -07:00
Matthew Flatt
6962aceaf0 change * to Karatsuba
original commit: 8038a1745b8d176bc97c1dd69024da76626eb775
2020-01-26 10:51:38 -07:00
Matthew Flatt
c48afdb16b repairs for arithmetic-shift
Produce 0, -1, or out-of-memory for bignum shifts. For large fixnum
shifts, check memory limits.

The repairs are mostly for Racket CS, but traditional Racket
incorrectly reported out-of-memory for 0 shifted by a positive bignum.
2020-01-26 09:18:14 -07:00
Matthew Flatt
5587285fac faster bitwise-arithmetic-shift on bignum shift
Immediately produce 0, -1, or out-of-memory, instead of looping
towards one of those.

original commit: dccc7e81b2f0909ce3c7871b849b0faa83eae576
2020-01-26 08:23:37 -07:00
Gustavo Massaccesi
04af7b3b2d fix docs about raco exe 2020-01-26 11:36:18 -03:00
Gustavo Massaccesi
e72848fa1f fix typo in cs/README.txt 2020-01-25 16:05:52 -03:00
David Florness
ecbff0976e Grammar fix 2020-01-25 11:36:53 -07:00
Matthew Flatt
16acbf1ae6 fix a test
original commit: bd0eb64e1b13e731d8378ffa2fa2bc835795d4f8
2020-01-24 19:32:57 -07:00
Matthew Flatt
26ff90e8e6 more compact return points for function calls
In the general form of a function call, the return point embeds 4
words of information: offset to the start of the enclosing function,
frame size, live-veriable mask, and multiple-value return address. In
the common case, however, the multiple-value return address is either
the same as the return address or it is a `values-error` library
function, and the frame size and live-variable mask fit into a word
with bits to spare. This patch implements a more compact return point
for that common case, which shrinks the 4 words to 2 and also avoids a
relocation (= 1 more word).

Multiple-value returns are more complex with this change (i.e.,
require more code), since they must check whether the return point is
compact or not. But multiple-value returns are far less common than
function calls, so saving function-call space is a clear win.

Overall, this change tends to reduce code size by about 10% on x86_64.

original commit: 1f53b5eabef966db01086cb32e544bbf8deacfca
2020-01-24 19:19:32 -07:00
Matthew Flatt
9d43b62282 cs: use fxlogtest instead of (fx= 0 (fxand ...))
For the stencil-vector HAMT implementation, the difference
can be 5-10% improvement on microbenchmarks.
2020-01-24 17:33:47 -07:00
Matthew Flatt
7c06d6d4ab bump version to sync with Chez Scheme change
A more compact representation for return points tends to reduce code
by about 10%. For DrRacket, that translates to a 5% decrease in
overall footprint.
2020-01-24 17:26:13 -07:00
dyb
1d2d9c6f54 updated release notes date
original commit: 600edcdc0f2ce629d1d632f6df390fb0fbbfb610
2020-01-24 10:39:20 -08:00
Matthew Flatt
dc2aa03e4e update Windows and Mac OS build instructions
Explain how to deal with the "racket-lib" that is normally included
with a source distribution, but that doesn't have dependencies
specific to Windows or Mac OS.
2020-01-23 19:07:59 -07:00
Matthew Flatt
83f8acbfef avoid symbolic link in repo checkout
original commit: 8eb10e62d0a58d945dec67cdc38a317a8a1d88e0
2020-01-23 17:58:15 -07:00
Matthew Flatt
8d6bdafb45 cs: use unsafe application after schemify
Since schemify adds its own checking for procedureness in an
application, always compile the application as unsafe at the Chez
Scheme level. This simple change saves about 5% in code size for
DrRacket, which is a 1-2% footprint saving overall.
2020-01-23 17:20:15 -07:00
Matthew Flatt
754bae07e3 add enable-unsafe-application
original commit: 4c0750d292999dbc476b2b0a80cad3b8beaab660
2020-01-23 15:25:22 -07:00
Matthew Flatt
b7fcf4112a update "racket/HISTORY.txt" for v7.6 2020-01-23 13:01:26 -07:00
dyb
4d819b1a1e fix for scheme-version string
original commit: bfd06eccfccf395cb3ff9e1d0f9419dc16709378
2020-01-23 11:23:01 -08:00
dybvig
48db0a9405 various library-manager improvements including the ability to verify
loadability without actually loading; also, support for unregistering
guarded objects.
- improved error reporting for library compilation-instance errors:
  now including the name of the object file from which the "wrong"
  compilation instance was loaded, if it was loaded from (or compiled
  to) an object file and the original importing library, if it was
  previously loaded from an object file due to a library import.
    syntax.ss, 7.ss, interpret.ss,
    8.ms, root-experr*
- removed situation and for-input? arguments from $make-load-binary,
  since the only consumer always passes 'load and #f.
    7.ss,
    scheme.c
- $separate-eval now prints the stderr and stdout of the subprocess
  to help in diagnosing separate-eval and separate-compile issues.
    mat.ss
- added unregister-guardian, which can be used to unregister
  the unressurected objects registered with any guardian.  guardian?
  can be used to distinguish guardian procedures from other objects.
    cp0.ss, cmacros.ss, cpnanopass.ss, ftype.ss, primdata.ss,
    prims.ss,
    gcwrapper.c, prim.c, externs.h,
    4.ms, primvars.ms
    release_notes.stex
    smgmt.stex, threads.stex
- added verify-loadability.  given a situation (visit, revisit,
  or load) and zero or more pathnames (each of which may be optionally
  paired with a library search path), verity-loadability checks
  whether the set of object files named by those pathnames and any
  additional object files required by library requirements in the
  given situation can be loaded together.  it raises an exception
  in each case where actually attempting to load the files would
  raise an exception and additionally in cases where loading files
  would result in the compilation or loading of source files in
  place of the object files.  if the check is successful,
  verity-loadability returns an unspecified value.  in either case,
  although portions of the object files are read, none of the
  information read from the object files is retained, and none of
  the object code is read, so there are no side effects other than
  the file operations and possibly the raising of an exception.
  library and program info records are now moved to the top of each
  object file produced by one of the file compilation routines,
  just after recompile info, with a marker to allow verity-loadability
  to stop reading once it reads all such records.  this change is
  not entirely backward compatible; the repositioning of the records
  can be detected by a call to list-library made from a loaded file
  before the definition of one or more libraries.  it is fully
  backward compatible for typical library files that contain a
  single library definition and nothing else.  adding this feature
  required changes to the object-file format and corresponding
  changes in the compiler and library manager.  it also required
  moving cross-library optimization information from library/ct-info
  records (which verity-loadability must read) to the invoke-code
  for each library (which verity-loadability  does not read) to
  avoid reading and permanently associating record-type descriptors
  in the code with their uids.
    compile.ss, syntax.ss, expand-lang.ss, primdata.ss, 7.ss,
    7.ms, misc.ms, root-experr*, patch*,
    system.stex, release_notes.stex
- fixed a bug that bit only with the compiler compiled at
  optimize-level 2: add-library/rt-records was building a library/ct-info
  wrapper rather than a library/rt-info wrapper.
    compile.ss
- fixed a bug in visit-library that could result in an indefinite
  recursion: it was not checking to make sure the call to $visit
  actually added compile-time info to the libdesc record.  it's not
  clear, however, whether the libdesc record can be missing
  compile-time information on entry to visit-library, so the code
  that calls $visit (and now checks for compile-time information
  having been added) might not be reachable.  ditto for
  revisit-library.
    syntax.ss
    syntax.ss, primdata.ss,
    7.ms, root-experr*, patch*,
    system.stex, release_notes.stex
- added some argument-error checks for library-directories and
  library-extensions, and fixed up the error messages a bit.
    syntax.ss,
    7.ms, root-experr*
- compile-whole-program now inserts the program record into the
  object file for the benefit of verify-loadability.
    syntax.ss,
    7.ms, root-experr*
- changed 'loading' import-notify messages to the more precise
  'visiting' or 'revisiting' in a couple of places.
    syntax.ss,
    7.ms, 8.ms

original commit: b911ed47190727b0e1d6a88c0e473d1757accdcd
2020-01-23 10:43:17 -08:00
Philip McGrath
f9fac13da3 docs: add cross-reference to fixnum-for-every-system? 2020-01-23 09:44:52 -05:00
Matthew Flatt
5a01e2c589 make a test portable
original commit: 86b384b5ed2e1cde6c61abe50db5b606e8841cfc
2020-01-20 15:00:56 -07:00
Matthew Flatt
17aae65664 fix 'inferred-name handling for keyword-supporting define
Closes #3009
2020-01-20 13:44:15 -07:00
R. Kent Dybvig
c1a4de6f4f Merge pull request #490 from mflatt/cp-push-mvrs
fix missing continuation call in `cp-push-mvrs`
original commit: 585068e174bde7d685ca8743533ea0f02f157753
2020-01-20 10:59:13 -08:00
Matthew Flatt
bdaeb6afaa fix missing continuation call in cp-push-mvrs
original commit: 2758eb1848fbc21f7f6af718d952547132b265a0
2020-01-20 09:27:45 -07:00
Matthew Flatt
94fee207a1 fix missing continuation call in mp-push-mvrs
original commit: d841744b26e4b4421fc4388b6943e558014e5e70
2020-01-20 09:26:46 -07:00
Matthew Flatt
345621fc91 cp0 repair for mutated library variables
This was supposed to be part of 628d57e1bd and fixes a test
failure introduced there.

original commit: bb186c9a29acf36a7c5954356690f6648cf9348c
2020-01-20 09:25:44 -07:00
Matthew Flatt
848d2148b0 cs: cooperate with improved cross-library inlining
An improvement to Chez Scheme allows more function from the Rumble and
other built-in layers to be inlined into compiled Racket code, and a
new `$app/no-inline` primitive enables improved control over how slow
paths are integrated.
2020-01-19 09:43:44 -07:00
Matthew Flatt
6020b944ef improve cross-library inlining
Allow a library-defined function to be inlined when the inlined
expressions refer to other library-defined functions. Since the
library function's body may already have inlined calls, don't allow
further inlining of calls within the inlined code.

This commit also adds `$app/no-inline`, which can be used to prevent
inlining of a function. For consumers other than Racket on Chez
Scheme, probably it would make sense to provide a nicer-looking
syntactic form that expands to use the internal `$app/no-inline`
function.

original commit: 628d57e1bd2e658aad4da97a3e85bda72c38f6ab
2020-01-19 08:35:02 -07:00
Paulo Matos
b9c78fccd8
remove travis ci file (#2967) 2020-01-16 19:34:48 +01:00
Paulo Matos
087c38db2f
Improve test matrix on Linux and Macos (#2966)
This commit furthers the test matrix by testing
     * with and without jit
     * if jit is enabled it tests with and without
       - places
       - futures
       - extflonum

This commit completes the functionality present in current TravisCI.
2020-01-16 17:31:03 +01:00
Matthew Flatt
712494312a improve consistency of printers and prop:custom-write
The pretty printer and built-in printer for traditional Racket did not
consistently provide the current quoting mode while checking for
unquoting and cycles. All printers, including the Racket CS printer,
are improved for a structure type that has
`prop:custom-print-quotable` as 'always, in which case we know that
unquoting- and cycle-checking time that the components will be in
quoted mode.

The pretty printer also made three passes through a value to check for
cycles, compute cycles, and compute unquotes, and those are now fused
into a single pass like the Racket CS printer. The built-in printer
for traditional Racket still makes up to two passes, but it now
behaves more like other printers by recurring immediately on nested
calls via `prop:custom-write` instead of accumulating them for after
the `prop:custom-write` callback returns.

The documentation clarifies that synthesizing new values during
printing can interefere with cycle checking and unquoting, but the
printers now react to that behavior more consistently.
2020-01-15 07:21:19 -07:00
Brian Wignall
738d2b7a81 Fix typos (#3005) 2020-01-14 11:49:23 +01:00
Matthew Flatt
15d107d373 cs: repairs for equal?/recur, especially on hash tables 2020-01-12 09:37:01 -07:00
Matthew Flatt
96ac646284 sync with Chez Scheme report for popcount on Windows 2020-01-11 16:43:45 -07:00
Matthew Flatt
45381612b2 fix popcount support to work on Windows
Avoid RDI, since it's preserved in the Windows ABI.

original commit: 68b2f597ec67ed8752998807bd0c9fc66667c752
2020-01-11 16:41:46 -07:00
Matthew Flatt
33f8173970 cs: switch to stencil-vector HAMT
With recent improvements, the run-time performance of vector-stencil
HAMTs for immutable hash tables seems close enough (on
microbenchmarks) to the Patricia-trie implementation to be worthwhile,
since they use less memory. Performance remains better in most cases
than the traditional Racket implementation.

The table at the end of this message summarizes relative performance
on microbenchmarks. Overall, though, immutable hash-table operations
are already so fast that these difference very rarely translate to
measurable differences in overall run times --- not even for the macro
expander, which relies heavily on immutable hash tables to represent
scope sets.

Stencil-vector HAMTs tend to take about 1/3 the space of Patricia
tries, and those space savings can turn into run-time improvements in
applications by reducing GC time. I've observed a 10% reduction in
compile time for some programs. When building a full Racket
distribution, run time shrinks by about 2 minutes out of 80 minutes,
probbaly because just average memory use goes down by 10%. DrRacket's
initial memory footprint goes down by about 37M out of 657M (a 5%
savings).

Mincrobenchmark relative performance, normalized to previous Racket CS
implementation (measured on 2018 MacBook Pro, 2.7 GHz Core i7; Chez
Scheme can substitute POPCNT instructions at link time):

 patricia = previous Racket CS implementation as a Patricia Trie
 stencil = new Racket CS implementation as a stencil-vector HAMT
 racket = traditional Racket implementation

                           patricia  stencil  racket
       set-in-empty:eq#t:  ==|       ==|      ==|=
           set-many:eq#t:  ==|       ==|==    ==|========
  set-many-in-order:eq#t:  ==|       ==|      ==|====
           set-same:eq#t:  ==|       ==       ==|=
         set-in-empty:eq:  ==|       ==       ==|=
             set-many:eq:  ==|       ==|==    ==|========
    set-many-in-order:eq:  ==|       ==|=     ==|=====
             set-same:eq:  ==|       ==       ==|=
        set-in-empty:eqv:  ==|       ==|      ==|==
            set-many:eqv:  ==|       ==|==    ==|=========
   set-many-in-order:eqv:  ==|       ==|=     ==|=====
            set-same:eqv:  ==|       ==|      ==|=
      set-in-empty:equal:  ==|       ==|==    ==|===
          set-many:equal:  ==|       ==|==    ==|=====
 set-many-in-order:equal:  ==|       ==|=     ==|===
          set-same:equal:  ==|       ==|=     ==|===
                ref:eq#t:  ==|       ==|      ==|=
           ref-fail:eq#t:  ==|       ==|      ==
                  ref:eq:  ==|       ==|      ==|=
             ref-fail:eq:  ==|       ==|      ==
                 ref:eqv:  ==|       ==|      ==|====
            ref-fail:eqv:  ==|       ==|      ==|
               ref:equal:  ==|       ==|      ==|===
         ref-large:equal:  ==|       ==|      ==
          ref-fail:equal:  ==|       ==|      ==|===
    ref-large-fail:equal:  ==|       ==|      ==
            removes:eq#t:  ==|       ==|===   ==|===========
         add+remove:eq#t:  ==|       ==|=     ==|=======
              removes:eq:  ==|       ==|====  ==|============
           add+remove:eq:  ==|       ==|=     ==|=======
             removes:eqv:  ==|       ==|===   ==|=============
          add+remove:eqv:  ==|       ==|      ==|========
           removes:equal:  ==|       ==|==    ==|=======
        add+remove:equal:  ==|       ==|=     ==|======
         iterate-keys:eq:  ==|       ==|      ==|=
       iterate-vals:eq#t:  ==|       ==|=     ==|=
         iterate-vals:eq:  ==|       ==|=     ==|=
  iterate-unsafe-keys:eq:  ==|       ==|      ==|=======
iterate-unsafe-vals:eq#t:  ==|       ==|      ==|
  iterate-unsafe-vals:eq:  ==|       ==|=     ==|
             for-each:eq:  ==|       ==|      ==|==========
    subset-lil-shared:eq:  ==|       ==|      ==|=
  subset-lil-unshared:eq:  ==|       ==|      ==|==
       subset-lil-not:eq:  ==|       ==       ==
subset-med+lil-shared:eq:  ==|       ==|====  ==|=
subset-med+med-shared:eq:  ==|       ==|=     ==|=
      subset-big-same:eq:  ==|       ==|      ==|===============
subset-big+lil-shared:eq:  ==|       ==|===   ==|====
subset-big+med-shared:eq:  ==|       ==|==    ==|===
  subset-big-unshared:eq:  ==|       ==|      ==|==
2020-01-11 13:42:33 -07:00
Matthew Flatt
196a9800f9 implement fxbit-count using fxpopcount
original commit: 470b088840576872fd0a7ede7bf5342f44555af0
2020-01-11 11:21:42 -07:00