Commit Graph

41059 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
b7fcf4112a update "racket/HISTORY.txt" for v7.6 2020-01-23 13:01:26 -07:00
Philip McGrath
f9fac13da3 docs: add cross-reference to fixnum-for-every-system? 2020-01-23 09:44:52 -05:00
Matthew Flatt
17aae65664 fix 'inferred-name handling for keyword-supporting define
Closes #3009
2020-01-20 13:44:15 -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
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
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
b8398f796c improve hash microbenchmarks 2020-01-11 09:52:36 -07:00
Matthew Flatt
e71963c48b openssl: condition versionless based on current, not cross target 2020-01-10 14:16:30 -07:00
Matthew Flatt
76726ee928 cs: improve stencil-vector HMAT hash-keys-subset? performance
Also, improve some hash benchmarks.
2020-01-10 10:46:55 -07:00
Matthew Flatt
d5930a18c6 configure: fix --disable-mac64 mode as cross-compile mode 2020-01-09 07:24:27 -07:00
Matthew Flatt
8c5d580d5a cs: fix cross-compile build steps 2020-01-08 06:41:23 -07:00
Matthew Flatt
57e19c9d8f repair a test for weak-hash iteration 2020-01-08 06:13:22 -07:00
John Clements
4bdad475e1 Post-release version for the v7.6 release 2020-01-07 13:02:31 -08:00
Matthew Flatt
a60f173b46 hash benchmarks and stencil-vector HAMT experiment
This commit adds an (unused) implementation of immutable hash tables
for Racket CS that trades some run-time performance for an especially
compact representation --- similar to the traditional Racket
implementation of immutable hash tables. It uses a new "stencil
vector" datatype at the Chez Scheme level, which overlays the bitmap
needed for a HAMT node with the Chez-object type tag (and also
provides an update operation that avoids unnecessary memory work).

Compared to the current Racket CS implementation, the stencil-vector
HAMT implementation of an immutable hash table takes only about 1/3
the space on avergae, which translates to a overall 5% savings in
DrRacket's initial heap. It also makes a full Racket build slightly
faster by reducing avergage memory use by 5-10%.

But the run-time performance difference is significant, especially for
the `hash-keys-subset?` operation (at least in microbenchmarks), and
also for addition and iteration. Maybe there's an overall better point
that reduces memory use of the current Patricia trie implementation
without sacrificing as much performance.

Besides the benchmarks and stencil-vector HAMT implementaiton, there
are small changes to the way hash tables cooperate with `equal?`,
which makes it a little easier to plug in different implementations.
2020-01-06 07:07:48 -07:00
Matthew Flatt
f0a63b5921 rktio: repair for building without ptherad support 2020-01-06 04:09:26 -07:00
Tommy McHugh
fc258725ba added struct/derived, tests, and doc updates 2020-01-04 09:24:10 -05:00
Dominik Pantůček
58cfb6654a Update fixnums documentation to suggest require'ing only fixnum-related parts of racket/unsafe/ops and not the rest of unsafe ops. 2020-01-02 15:10:52 -05:00
Alexis King
07f060133c racket-build-guide: Don’t decode within exec/commandline 2020-01-02 12:17:07 -06:00
Matthew Flatt
8ae53d9e8b fix _bytes/nul-terminated for NULL results
Closes #2995
2020-01-02 08:46:34 -07:00
Matthew Flatt
e97639e525 cs: faster string-copy!
Similar to e087059f21.
2020-01-01 15:00:23 -07:00
Matthew Flatt
e88c2b18e6 fix license blurb in "racket/src/README.txt" 2020-01-01 12:22:34 -07:00
Matthew Flatt
16cbb5be30 makefile: add pre-processing step for distribution creation 2020-01-01 07:13:53 -07:00
Matthew Flatt
647f172acd compiler-test: improve progress output for raco exe tests 2019-12-31 17:17:01 -07:00
Matthew Flatt
6816bdcf2b raise timeout for hash-memory test 2019-12-31 16:35:35 -07:00
Matthew Flatt
ba83d95339 cs configure: avoid --enable-shared problems
Building with shared libraries is not currently supported, because the
Chez Scheme build is not set up to work in that mode, and because
"stand alone" executable handling at the Racket level does not support
Racket CS shared libraries.

Also, there's no benefit to shared libraries. Racket executables get
the benefit of sharing because they all run through the same
executable. Meanwhile, there's not (yet?) a supported C API to make
something like "libracketcs.so" useful.

Related to #2993
2019-12-31 08:03:01 -07:00
Tommy McHugh
0d1a85237e Implemented struct/contract and testing for struct/contract 2019-12-30 19:01:26 -06:00
Matthew Flatt
af3c22dd11 cs: mark some internal representations as sealed
This change makes a small but measurable difference for mpairs, at
least (about 5% on the mpair-intensive "lists.rkt" benchmark).
2019-12-30 08:15:23 -07:00
Matthew Flatt
ce4ad668b6 cs & thread: move retry callback to cancel result
Adjust part of the internal scheduling protocol to make a retry
callback generated by another callback that sets up the retry. This
helps clarify the protocol and avoids allocating a closure that is
rarely used.
2019-12-29 18:56:42 -07:00
Matthew Flatt
755e914c7c cs & thread: allow evt-chaperone to hide other membership
Make Racket CS consistent with traditional Racket in the way
`chaperone-evt` on a thread hides threadness, etc.

Hiding properties like threadness is not ideal and does not seem
entirely consistent with `chaperone-of`, but allowing things like
threads and semaphores to be chaperoned creates non-trivial expense
internally. It would have been better to have event constructors for
threads and such to (and then the consyructed events could be
chaperoned without imposing a cost on the original data structure).
2019-12-29 19:19:09 -06:00
Matthew Flatt
b8a4e0535f thread: small simplification in scheduler 2019-12-29 11:35:06 -06:00