Fixes a problem installation Planet packages under Windows,
for example, where attempting to open a read-only file in
write mode triggers an extremely slow result.
Merge bug fix to v6.0 (pending review)
Making the default match the docs fixes Planet package installation,
which otherwise tries to rebuild the index too frequently.
Merge bug fix to v6.0 (pending review)
The main change is to add an option to `syntax-local-infer-name` to
select whether `syntax-local-name` is used, and to use the new option
to disable `syntax-local-name` for the function expression in a
keyword `#%app`.
Improvements in the expander/compiler generalize a previous repair.
Merge to v6.0
Add "Connection: close" to requests that we know will end after one
request.
Read upto 1K bytes at a time on requests rather than just 1 at a time.
Change closing semantics to be "close" and not "abandon"
(not strictly necessary, but the new, still pending class/c first-order
checking checks the arities of the methods and those additional
tests got put into the test suite, so the easiest thing for now
is just to make the current class/c implementation do that check too)
Fix various problems, including a bad result from `procedure-arity`
and problems with chaperones and arity error messages when a
structure's `prop:procedure` value is a keyword-accepting procedure.
Merge to v6.0
The main changes are the addition of a new way to specify projections,
using the #:val-first-projection keyword argument; the main goal of the
new API is that more information can be supplied to the projection on
the server side of the contract boundary. In addition, the arrow contracts
will now, internally and in some cases (see define-module-boundary-contract)
return functions that accept one additional argument than the original
function did and then insert the name of the negative party into call sites.
The rough idea is that if you have a program like this one:
#lang racket/base
(define (f x) (+ x 1))
(provide (contract-out [f (-> integer? integer?)]))
then the contract system produces something much closer to this:
#lang racket/base
(define (f x) (+ x 1))
(provide (rename-out [external-f f]))
(define (external-f neg-party x)
(check-integer neg-party x)
(define ans (f x))
(check-integer neg-party ans)
ans)
(define local-blame-information ...)
(define (check-integer neg-party v)
(unless (integer? v)
(raise-blame-error local-blame-information
#:missing-party neg-party
...)))
where 'raise-blame-error' can now cope with blame objects that don't
have negative part information in them (when the #:missing-party
argument is supplied, essentially just reassembling the original blame
record at that point)
Then, on the client side, if we had
(f x)
it gets transformed into
(f '<<my-modules-name>> x)
and if we had
(let ([g f])
...)
you get a slow path:
(let ([g (lambda (x) (f '<<my-modules-name>> x))])
...)
(where we don't create a wrapper lambda, of course, we actually create
a procedure chaperone)
The performance improvements seem pretty good (see below for the
precise programs that I ran and the numbers I got):
first order contract microbenchmark: 6x speedup
higher-order contract microbenchmark: 1.5x speedup
first-order TR contract interop micro benchmark: 6x speedup
This also improves the memory use for DrRacket by about 3% (from about
236.8 mb to 231.3 mb), presumably because more of the data structures
created by the contract system can be created only once, on the server
side.
Be aware, however, that not all combinators are using the new
projections and the code that translates between the two APIs
is slow.
Also there are a bunch of other changes that got made while I was
doing this. Most notably, the change above were not designed for the
performance improvements to arrow contracts, but to make it possible
to implement class/c contracts with a (hopefully) negligible space
overhead. That work is not yet finished, but this commit includes some
changes to the class system to prepare the way for those changes.
Unfortuantely, these changes slow down 'send' on microbenchmarks by
about 24%. The change comes from the addition of an extra 'if' (and
predicate test and possibly the extra let expresison) that's inserted
into the expansion. I'm not happy about that (I was shooting for 10%)
but I'm not sure that we can do much about it (except perhaps double
check my measurements, see below).
Other misc changes:
- improve arity mismatch error messages by including the arity of the
given procedure (closes PR 14220)
- Adjust case-> so it generates less code. This seems to reduce the
size of the math library .zo files by about 3% (from 10440k to
10156k for me)
- speeds up the contract tests a bit
- move recontract out into racket/contract (also, document it)
- added define-module-boundary-contract
- streamline TR's any-wrap/c and adjust it to use
#:val-first-projection instead of #:projection
- adjust a bunch of contracts to print more nicely
- and, of course, Rackety
--------------------------------
The precise programs that I tried and their timings (the raw data
for the performance claims above):
#lang racket/base
(module m racket/base
(require racket/contract/base)
(define (f x) x)
(provide (contract-out [f (-> any/c any/c)])))
(require 'm)
(time
(for ([x (in-range 100000)])
(f 1) (f 2) (f 3) (f 4) (f 5) (f 6) (f 7) (f 8)
(f 1) (f 2) (f 3) (f 4) (f 5) (f 6) (f 7) (f 8)
(f 1) (f 2) (f 3) (f 4) (f 5) (f 6) (f 7) (f 8)
(f 1) (f 2) (f 3) (f 4) (f 5) (f 6) (f 7) (f 8)
(f 1) (f 2) (f 3) (f 4) (f 5) (f 6) (f 7) (f 8)
(f 1) (f 2) (f 3) (f 4) (f 5) (f 6) (f 7) (f 8)
(f 1) (f 2) (f 3) (f 4) (f 5) (f 6) (f 7) (f 8)))
pre-push timings:
cpu time: 3553 real time: 3552 gc time: 52
cpu time: 3548 real time: 3552 gc time: 52
cpu time: 3525 real time: 3525 gc time: 54
cpu time: 3547 real time: 3547 gc time: 47
post-push timings:
cpu time: 515 real time: 515 gc time: 15
cpu time: 522 real time: 522 gc time: 17
cpu time: 560 real time: 560 gc time: 19
cpu time: 514 real time: 515 gc time: 19
cpu time: 507 real time: 507 gc time: 17
A second order example using vectors (note that vector/c isn't yet
updated to the #:val-first-projection, so it will be way slower)
#lang racket/base
(module m racket/base
(require racket/contract/base)
(define (f x) (vector-ref x 0))
(provide (contract-out [f (-> (vectorof any/c) any/c)])))
(require 'm)
(define v (vector void))
(time
(for ([x (in-range 10000)])
(f v) (f v) (f v) (f v) (f v) (f v) (f v) (f v)
(f v) (f v) (f v) (f v) (f v) (f v) (f v) (f v)
(f v) (f v) (f v) (f v) (f v) (f v) (f v) (f v)
(f v) (f v) (f v) (f v) (f v) (f v) (f v) (f v)
(f v) (f v) (f v) (f v) (f v) (f v) (f v) (f v)
(f v) (f v) (f v) (f v) (f v) (f v) (f v) (f v)
(f v) (f v) (f v) (f v) (f v) (f v) (f v) (f v)))
pre-push timings:
cpu time: 744 real time: 745 gc time: 20
cpu time: 679 real time: 679 gc time: 18
cpu time: 695 real time: 695 gc time: 23
cpu time: 743 real time: 742 gc time: 21
cpu time: 780 real time: 786 gc time: 21
cpu time: 723 real time: 726 gc time: 25
post-push timings:
cpu time: 448 real time: 448 gc time: 18
cpu time: 470 real time: 469 gc time: 19
cpu time: 466 real time: 465 gc time: 16
cpu time: 457 real time: 456 gc time: 15
cpu time: 465 real time: 466 gc time: 24
Using contracts in TR
#lang racket/base
(module m typed/racket/base
(: f (Any -> Any))
(define (f x) x)
(provide f))
(require 'm)
(time
(for ([x (in-range 10000)])
(f 1) (f 2) (f 3) (f 4) (f 5) (f 6) (f 7) (f 8)
(f 1) (f 2) (f 3) (f 4) (f 5) (f 6) (f 7) (f 8)
(f 1) (f 2) (f 3) (f 4) (f 5) (f 6) (f 7) (f 8)
(f 1) (f 2) (f 3) (f 4) (f 5) (f 6) (f 7) (f 8)
(f 1) (f 2) (f 3) (f 4) (f 5) (f 6) (f 7) (f 8)
(f 1) (f 2) (f 3) (f 4) (f 5) (f 6) (f 7) (f 8)
(f 1) (f 2) (f 3) (f 4) (f 5) (f 6) (f 7) (f 8)))
pre-push timings:
cpu time: 357 real time: 357 gc time: 6
cpu time: 446 real time: 447 gc time: 4
cpu time: 361 real time: 359 gc time: 4
cpu time: 366 real time: 366 gc time: 5
cpu time: 368 real time: 367 gc time: 6
post-push timings
cpu time: 63 real time: 63 gc time: 7
cpu time: 64 real time: 63 gc time: 8
cpu time: 63 real time: 64 gc time: 8
cpu time: 58 real time: 58 gc time: 8
cpu time: 59 real time: 59 gc time: 7
Slowdown for 'send':
#lang racket/base
(require racket/class)
(define c% (class object% (define/public (m x) x) (super-new)))
(define o (new c%))
(time
(for ([x (in-range 100000)])
(send o m 1) (send o m 2) (send o m 3) (send o m 4)
(send o m 5) (send o m 6) (send o m 7) (send o m 8)
(send o m 1) (send o m 2) (send o m 3) (send o m 4)
(send o m 5) (send o m 6) (send o m 7) (send o m 8)
(send o m 1) (send o m 2) (send o m 3) (send o m 4)
(send o m 5) (send o m 6) (send o m 7) (send o m 8)
(send o m 1) (send o m 2) (send o m 3) (send o m 4)
(send o m 5) (send o m 6) (send o m 7) (send o m 8)
(send o m 1) (send o m 2) (send o m 3) (send o m 4)
(send o m 5) (send o m 6) (send o m 7) (send o m 8)))
timings pre-push:
cpu time: 251 real time: 251 gc time: 0
cpu time: 275 real time: 275 gc time: 0
cpu time: 250 real time: 250 gc time: 0
cpu time: 246 real time: 246 gc time: 0
cpu time: 247 real time: 246 gc time: 0
timings post-push:
cpu time: 303 real time: 302 gc time: 0
cpu time: 333 real time: 333 gc time: 0
cpu time: 315 real time: 315 gc time: 0
cpu time: 317 real time: 317 gc time: 0
cpu time: 311 real time: 310 gc time: 0
When a GC is needed for the shared space, a GC is triggered
in all places, and the places wait until each other place
has completed. However, the places also need to wait until
all other places are ready to *start* a GC; otherwise, a
place may be modifying a shared record while some other place
traverses it for a GC.
Closes PR 14229
Merge to v6.0
closes PR 14170
Instead of checking free pvars of first template and using that to choose
which template to use, just try first and on failure try second.
Note: ?? still only covers absent pvars; non-#f non-stx value still
causes error; ellipsis rep mismatch still causes error; etc.
Allows some `raco` tools to work (such as `raco pkg`) when loading
information about other installed tools fails, so that problems can
be more easily corrected using working tools (other than `raco setup`,
which is a special case, anyway, for bootstrapping).
Closes PR 14221
Merge to v6.0
related to PR 14222
This doesn't completely fix that PR because the
implementation says that bytes are allowed and
the docs don't allow that. My guess is that the
implementation is wrong, not the docs, btu I'm not
sure and this may be a backwards compatibility
kind of thing, too. Also, path->collects-relative
should probably be considered (it doesn't allow
bytes? as an argument).
Make executables created by `raco exe` not refer to the original
configuration directory by default, but add an option for setting
the directory.
For Unix ELF executables, fix `raco exe` to set/preserve the
configuration directory.
Merge to v6.0
When rendering the user documentation-search page or
local-redirect page, only user-specific documentation is
included, which makes rendering faster and automatically
picks up any installation-scope additions.
The documentation start page is still static, so the
user version doesn't pick up installation-scope
additions in the same way.
Related to PR 14180
When the "racket-index" package is in user scope, then the
the documentation-build process should not try to write to
"doc" in the installation.
Merge to v6.0
A hash-table size grew based on the number of key slots occupied,
instead of the number of value slots, where the two differ when
keys are added and removed in the table.
Thanks to Ryan for the example.
Using
#lang scribble/base
produces HTML output in the old style, while
#lang scribble/manual
uses the new style.
To get the new style without switching to `#lang scribble/manual`,
use `manual-doc-style`.
Related changes include the addition of `css-style-addition` and
`js-style-addition`.
A new `#:from-command-line?` argument to various functions indicates
whether error messages should try to suggest command line flags (since
the suggested flags do not make sense for other contexts, such as the
GUI package manager).
Fallback checked original module only if `deserialize-info` was
missing, but it's possible to have a mixture of `deserialize-info`
and original-module exports.
This change is slightly incompatible, because `serializable-struct`,
`define-serializable-struct`, and `define-serializable-class` no
longer `provide` and identifier that they used to. Instead, the identifier
is provided by a `deserialize-info` submodule.
The deserializer looks for a `deserialize-info` submodule, and then
falls back to using a module if the submodule is not available.
Downloaded files are keyed on the source URL and checksum, and the
cache is used only when a checksum is known.
The cache addresses two situations:
* when installing many packages over an unreliable connection,
the cache effectively lets a retry pick up where a previous
attempt failed
* when creating clean builds frequently, the downloads from a
previous build can be reused (as long as the package's checksum
does not change)
The cache location and limits are configurable, and they default to
a subdirectory in the user's add-ons directory (not version-specific),
1024 files, and 64 MB.
If a failure happens during staging (checksum and unpackaging) of a
package that has an entry in the cache, the entry is removed. The
file-cache library, meanwhile, implements a limit on the cache size
and defends against uncooperative filesystems.
The sqlite3_prepare[_v2]() function takes a byte-string pointer
for a query and returns a pointer into the byte string. That
pointer can be odd-valued, in which case the GC doesn't treat
the pointer as a reference to the byte string (even when the
string is allocated with 'atomic-interior), so arrange for the
original pointer to be retained.
Seems to work for Mac OS X 10.9 (Mavericks), at least.
In Retina mode, a drawing unit corresponds to two pixels on
the screen or in a bitmap created by `make-screen-bitmap'.
In particular, a bitmap created by `make-screen-bitmap' is
actually twice as big in each dimension as requested, and the
bitmap is scaled when transferring to other drawing contexts.
When transferring onto the screen, scalings cancel so that the
result looks right.
Adds `get-display-backing-scale` to `racket/gui/base`, and
also `get-backing-scale` to `bitmap%`.
To do: add a way to set the backing scale of a bitmap. That
option will provide a way to give controls higher-resolution
bitmaps as labels.
Make sure it's at the end of the `raco setup` command line, and set
the executable name to "raco" instead of "raco setup" so that the `-l`
flag is effectively implied.
No need to limit ourselves to x86.
Regardless of architecture, sun_path is always 108 bytes long on Linux.
Signed-off-by: Jan Dvořák <mordae@anilinux.org>
This flag may be useful for checking for unnecessary dependencies, but
beware that it reports many false negatives, either because relevant
files are not compiled, because the dependency is dynamic, or because
unused packages are intentially listed as dependencies as a
convenience (as is the case for "main-distribution").
OpenBSD provides pthread_stackseg_np(), which directly reports
the stack-bounds information that Racket needs, so we can use
that instead of the approach used on other Unix variants. The
approach used for other Unix variants seems not to work for OpenBSD
because the stack location at the point that main() is called
is already significantly far from the stack base (on the order
of 100k on a 32-bit system in my test using OpenBSD 5.2).
When installing a package "P" and the usual directory already exists
and cannot be deleted, then use the path "P+1", etc., and record the
alternate path in the package database.
A pipe's limit is supposed to apply only to unpeeked bytes, but
there were problems related to triggering further writes after
a peek, and also triggering further reads after a partial
write.
This is useful for telling people how to install a new pkg, from
GitHub or elsewhere: just get the files, and then do
`raco pkg install` in the relevant directory.
Also, both cabal (the Haskell package manager) and npm (the node.js
package manager) behave this way.
To explicitly get the old behavior, specify the sources as
`--pkgs pkg-srcs ...`. This is useful in scripts, when `pkg-srcs`
might be empty.
Avoids including the bit thet indicates whether the object
is GCable in the eq hash code (in a configuration where
bits are available in the GC header for hashing).
Closes PR 14059
Symbols in the PR were mapped to coliding hashes in
groups of 4 because the low 2 bits of the `eq?` hash
code were begin dropped to generate an `equal?` hash
code. Those two bits got lost due to a refectoring
a while back that moved the dropping of two useless
bits to a more centralized place, but the 2-bit shift
did not get removed from the `equal` hash code comparision.
The PR's example program will still generate groups of 2
when hashing around 10k symbols (which used to be groups of 8).
That's because there's a bit in the hash-code counter that
turns out to be forced to 1.
The problem mainly affected `register-custodian-shutdown`
from `ffi/unsafe/custodian`, which is used by `math/bigfloat`
and `ffi/unsafe/com`.
When a value is registered with a custodian, the value is held
weakly, but the shutdown procedure is intended to be held
strongly. At the C API level, the data associated with a shutdown
function pointer is intended to be held strongly.
A custodian itself, however, is retained weakly by other custodians
in its family, so that custodians can be GCed and their elements
transferred to a parent custodian. Since the custodian itself may
be held only weakly, the callback & data in a custodian was effectively
held weakly --- which, in turn, can break assumptions in code such
as `ffi/unsafe/custodian` that expects strong references to prevent
finalizers from running.
Fix the problem by registering a reference to callback data as
data in a custodian's finalizer, which makes the data strongly
retained no matter how the custodian is retained.
The package split exposed another place where searching
is needed, because the fallback in `collection-file-path`
to `collection-path` didn't work after the split.
This repair needs a test case, but I think the test will require a lot
of scaffolding to set up a package configuration, so I'm leaving that
part on my todo list for now.