Commit Graph

3080 Commits

Author SHA1 Message Date
Matthew Flatt
b243ce894a GC: give main allocation pages back to the GC less eagerly 2016-05-15 17:44:58 -06:00
Matthew Flatt
7fbe6a4097 GC: avoid trying to prime a full page cache 2016-05-15 17:44:58 -06:00
Matthew Flatt
49fd1e41da improve immutable hash table on sequential inserts
Inserting keys with sequential hash codes --- as in 0, 1, 2, 3, etc.
--- performed badly compared to random keys, because it triggered the
worst case of allocation: allocate a node of size 1, then 2, then 3,
then 32, then 32 plus a subtree of size 1, then 32 plus a subtree of
size 2, and so on. By rearranging the bits in a hash code, arrange
for nodes that are more like 4-wide instead of 32-wide. In other
words, the tree become wider with thinner branches, instead of growning
just as a thick branch to the left.

Of course, there's now a different sequence of inserts that used
to perform well and now perform badly (the inverse of the new
reordering), but that case seems much more likely than the cae
of sequential inserts.
2016-05-15 17:44:58 -06:00
Ryan Culpepper
80364d85dd syntax/parse: add progress-ordering to ~and
In (~and p1 p2), a failure in p2 now always dominates a failure in p1.
Consequently, if a pattern succeeds, its failures don't matter.

Add {pat,hpat,action}:ord wrappers, ord prframes. Apply ordering to
main pattern and side clauses. Add better progress analysis to
eliminate order wrapping.
2016-05-13 14:40:16 -04:00
Ryan Culpepper
158f087d8e syntax/parse: remove attrs from pattern structs, desugar hpat:optional 2016-05-13 14:40:16 -04:00
Ryan Culpepper
91a03eecb3 syntax/parse: add separate pattern for simple vars 2016-05-13 14:40:16 -04:00
Matthew Flatt
678369f187 avoid generating shared call code for too many arguments
Although the JIT would not try to use a block of shared code for more
than a certain number of arguments, it could in rare cases (related to
self tail calls, for example) generate the code and attempt to install
it in the array of shared-code pointers.
2016-05-13 11:56:48 -06:00
Matthew Flatt
1149d6cdcd ffi/unsafe: add checking of _array values
When an array value is provided, make sure that it's an array
with at least the expected length (or longer) and same element
layout. That's weaker than checking that the array elements have
the right type, because an `eq?` check at the ctype layer seems
too strong, and the ctype API doesn't provide enough information
for a more flexible equality.
2016-05-10 10:56:32 -06:00
Matthew Flatt
d92be80f77 unbreak line-based flushing
Repairs a problem introduced by 8e7792d85a.
2016-05-09 12:49:06 -06:00
Matthew Flatt
8e7792d85a reduce overhead for simple port char/byte reads/writes
Cut the overhead by 30% or so by making the fast path need less
cooperation with the GC.
2016-05-09 09:11:47 -06:00
Matthew Flatt
6c9a4cb470 avoid a compiler warning 2016-05-05 15:19:47 -06:00
John Clements
7c26614343 make match exception transparent
This push makes the exn:misc:match exception transparent. This
matches other racket-raised user exceptions.

The motivation for this change was breakage in the handin-server;
specifically, the discussion in

https://groups.google.com/forum/#!topic/racket-users/nEos3-osoWE

...in which the handin-server was not behaving the same on exn:misc:match
because it was not transparent. This caused the handin server to
refuse to rewrite these exceptions, resulting in less helpful
messages for users.
2016-05-04 14:19:04 -07:00
Ryan Culpepper
9d3c193bcf syntax/parse: fix ~datum pattern with compound datum 2016-05-03 05:07:29 -04:00
Ryan Culpepper
430e6e9567 syntax/parse: different fix for deterministic compilation
The previous fix (1acaf011) caused a performance regression
(compilation time?), reported by stchang. Reverting to quote.

Apparently, the problem with gensym and deterministic compilation
isn't the uninterned-ness; it's the global counter used for the
name. So use a compilation-local counter instead.
2016-05-03 04:38:26 -04:00
Ryan Culpepper
c8f3536694 Revert "syntax/parse: fix for deterministic compilation"
This reverts commit 1acaf0111d.
2016-05-03 03:11:08 -04:00
Asumu Takikawa
25c9e9347a Fix nested quasisyntax infinite looping
Thanks to Michael Ballantyne for the bug report
2016-05-02 15:15:47 -04:00
Matthias Felleisen
fdcbe249f9 re-organized in preparation for additions 2016-05-01 09:47:39 -04:00
Matthew Flatt
76418e9be8 path->module-path: make sure result is always a module path
Avoid creating a result that is intended as a module path but
has elements that are not syntactically allowed, such as a "."
in a collection-path element.
2016-05-01 07:00:36 -06:00
Robby Findler
bb03281308 add flat-contract-with-explanation
closes #1314
2016-04-30 21:04:08 -05:00
Robby Findler
45acc19f44 improve source location in internal-definition errors for syntax-case,
syntax-case*, and datum-case
2016-04-26 16:09:30 -05:00
Matthew Flatt
fb88abd992 fix accidentally committed debugging mode 2016-04-26 14:32:08 -06:00
Matthew Flatt
528b14025f fix syntax-local-lift-module-end-declaration in higher phases
A phase shift was mising on `begin-for-syntax`es introduced by
`syntax-local-lift-module-end-declaration`, which is in turn
used to implement` module+`, so `module+` didn't work under
two or more `begin-for-syntaxes`.

Closes #1312
2016-04-26 10:45:56 -06:00
Matthew Flatt
99b3ed55be make syntax objects work as preserved syntax properties
Syntax objects generally make sense as properties in other syntax
objects, but they require special care when marshaling to bytecode
(as syntax objects do in general). To make that special handling
possible and reliable, constrain the shape of allowed values.
2016-04-26 10:18:46 -06:00
Vincent St-Amour
5cc030e2ad Avoid redundant checking. 2016-04-25 15:41:27 -05:00
Vincent St-Amour
264a11f899 Add procedure-impersonator*?.
Mostly useful to determine whether using `unsafe-chaperone-procedure` is ok.
2016-04-25 15:41:19 -05:00
Matthew Flatt
35ab9ffdb8 rename relectly added path-extension to path-get-extension
The name `path-extension` created a conflict for an existing
registered package, so it should not have been added to
`racket/path`.

Also, `path-get-extension` was intended to work on a path
that is syntactically a directory, so fix and test that.
2016-04-24 20:30:51 -06:00
Matthew Flatt
18fd9949a6 fix unmarshaling of perserved syntax properties
Unmarshaling was broken for a syntax object that doesn't have
a 'paren-shape property.
2016-04-24 07:19:02 -06:00
Robby Findler
68b8bf760a make #f always coerce into the same (eq?) contract and make
(or/c #f #t) (or (or/c #t #f)) coerce into the same thing
that boolean? coerces into (and make that also always be eq?)
2016-04-22 15:43:19 -05:00
Robby Findler
bbac97129e avoid an extra call to the contract-specific method for checking stronger
Before this commit, when contract-stronger? is called, it would not
be able to return #f until it calls the contract-specific stronger
method twice
2016-04-22 14:54:33 -05:00
Ryan Culpepper
1acaf0111d syntax/parse: fix for deterministic compilation
Lift compile-time gensyms to vars bound to run-time gensyms.
2016-04-22 09:54:30 -04:00
Matthew Flatt
b523c9c13f local-transformer-expand: catch lifts in 'top-level mode
Change the one expansion mode as far as I can tell) that disables
lifts so that lifts are now allowed, which means that
`(syntax-transforming?)` implies `(syntax-transforming--with-lifts?)`.

The old documentation incorrectly characterized when lifts
were allowed. Ryan noticed the documentation problem, and that
observation led to this simplication.
2016-04-21 13:58:05 -06:00
Matthew Flatt
9ff64fc6ed GC: guard against excessive fragmentation in incremental mode
Although excessive fragmentation is already detected at the end
of a major GC, it can get out of hand already during a long
incremental phase. So, check for excessive fragmentation and
bail out to a major GC when it happens.

Related to PR 15287
2016-04-19 16:26:42 -06:00
Robby Findler
fa4a6d4c13 fix the 'just check existence' part of object/c contracts 2016-04-19 14:07:50 -05:00
Matthew Flatt
3b1b4a0d26 string->url: always mark as absolute when a host is present
Fixes a failure in the web server tests caused by d23b296627.

Formerly, `(string->url "http://racket-lang.org")`, with no trailing
slash, would produce a `url` structure with `path-absolute?` as #f.
That doesn't exactly make sense, because a URL with a host must always
have an absolute path component. Claiming a relative path component
interacts badly with extending a URL with a path later. (Although
`combine-url/relative` compenstate, a similar function in the web
server doesn't.) The revised `url->string` always sets `path-absolute?`
to #t when a host is present, and whether the path is empty or contains
an empty string still records whether a trailing "/" was present.

The `url->string` function, meanwhile, now needs to use whether the
path is empty to determine whether a "/" should be added after
the host name, not whether `path-absolute?` is true.
2016-04-19 05:42:07 -06:00
Matthew Flatt
ddd4190edf GC: improve backtrace info for 'interior pointers 2016-04-19 05:25:07 -06:00
Matthew Flatt
84bffd41af GC: fix backtrace reporting
The addition ot limited recursive marking broke the implementation
of memory-debugging backtraces.
2016-04-18 18:39:20 -06:00
Matthew Flatt
027dd9a43c untgz and gunzip: report unexpected end-of-file
Report an explicit "unexpected end-of-file" error instead of
a later contract failure on #<eof> insteda of a byte

Closes #1204
2016-04-18 08:25:41 -06:00
Ryan Culpepper
837fe2a91a use group-by 2016-04-18 09:13:11 -04:00
Ryan Culpepper
6da3e88bd8 fix and update syntax/parse/debug 2016-04-18 09:13:11 -04:00
Ryan Culpepper
4e6438eaf2 syntax/parse: add groups of post progress
This is a partial solution to the ~and problem, only for side clauses.
In (~and p1 p2 p3), one often wants errors in p2 to take precedence over
errors in p1, and likewise for p3 over p2. One solution is ~commit, but
that prevents backtracking. Another is ~post, but then two ~post wrappers
are needed around p3. Also, it doesn't make sense to compare progress of
the third #:with clause from stxclass A to the second #:with clause of
stxclass B and say third beats second.

So, generalize 'post to (post group index); post frames are comparable to
each other only if group is the same, then compared by index. (Post still
beats CAR and CDR.) Each set of side clauses shares a group.

For simplicity of code generation for now, use gensyms to identify groups.
2016-04-18 09:13:11 -04:00
Matthew Flatt
51061c0829 fallback for sqlite3_clear_bindings
Work with older SQLite, such as the one with Fedora 6

Closes #769

Merge to v6.5
2016-04-17 14:24:52 -06:00
Matthew Flatt
dda791c8cb remove unneeded use of long-double function
Using stdtold() instead of strtod() causes trouble with the
version of gcc on Fedora 6.

Merge to v6.5
2016-04-17 11:35:50 -06:00
Matthew Flatt
f75729ef41 raco pkg: improve error reporting for bad URLs
Related to #1257
2016-04-17 09:10:06 -06:00
Matthew Flatt
d23b296627 URL string conversions: disallow host plus relative path
Closes #1257
2016-04-17 09:02:19 -06:00
Matthew Flatt
53ffad767b net/url-string: support URLs that contain IPv6 literals
Since an IPv6 literal address includes ":"s, it must be written
between "[" and "]" as a host name.

Based on a patch by @Phlosioneer and comments by @Blaisorblade,
with additional changes to make `url->string` work.

Closes #980
Closes #1243
2016-04-16 21:19:33 -06:00
Matthew Flatt
8993398033 Add #:name and #:extra-name to struct
A `#:name` identifier picks the name that is bound to static
information about a structure type. An `#:extra-name` identifier
specifies an additional name to be bound to the information.
This pair of options is analogous to `#:constructor-name`
and `#:extra-constructor-name`.

Based on Jen Axel's suggestion and implementation.

Closes #1309
2016-04-16 18:39:48 -06:00
Matthew Flatt
4d9427af44 add path-extension, path-has-extension? and path-{add,replace}-extension
Provide a cleaned-up set up path-extension functions. In contrast
to `path-{add,replace}-suffix` and `filename-extension`, a dot
at the beginning of a path element is not treated as an extension
separator. Also, `path-extension` returns an extension including
its separator, which is more consistent with other extension
functions.

The new `path-has-extension?` function replaces many uses of
regexp matching in the base collections.

Closes #1307
2016-04-16 17:56:34 -06:00
Matthew Flatt
4cc3aad30b fix problem with (open-input-file #:for-module? #f ...)
Also, clarify failure handling in the docs.

Closes #1298
2016-04-16 10:34:18 -06:00
Matthew Flatt
a6e773f69b fix syntax checking in for/vector
Closes #1308
2016-04-16 09:48:08 -06:00
Spencer Florence
123755437c remove bad srcloc from define-runtime-path (#1203) 2016-04-16 09:39:28 -06:00
Matthew Flatt
2dce66925a update HISTORY.txt for v6.5
Merge to v6.5
2016-04-16 07:01:38 -06:00
Matthew Flatt
e1a5e41ddc The set of environment variables accessible via getenv is
restricted through `get-info`, which prunes the environment
variable set before it loads the "info.rkt" file. All
environment variables are pruned except those listed in
`PLT_INFO_ALLOW_VARS` (separated by semicolons).

Related to emina/rosette#17.
2016-04-15 09:56:59 -06:00
Matthew Flatt
6369e56709 add support for tethering to a config or addon dir
Add a hook to `raco setup` to make copies of installed executables,
where the copies start with the configuration or addon directory
of creation time, instead of the default installation or user-specific
path.

Although the same effect can be achived by setting environment
variables such as PLTADDONDIR, tethered executables can be easier
to work with and compose better with other programs.

See also #1206 for some discussion, although this change does
not exactly address the original idea there.
2016-04-15 06:42:15 -06:00
Gustavo Massaccesi
91d6c69565 Avoid compiler warning 2016-04-13 19:23:56 -03:00
Gustavo Massaccesi
b93d94bb67 optimizer: allow duplication of toplevels 2016-04-11 23:08:23 -03:00
Gustavo Massaccesi
2d0f8f6c0f reduce (unbox (box x)) and extend reductions to unsafe-cXr
Reduce (unbox (box x)) => x

Extend the reductions for cXr to the unsafe versions, for
example reduce (unsafe-car (cons x y)) => x

Check and save types in unsafe operations
2016-04-11 21:14:22 -03:00
Gustavo Massaccesi
c4e5a0b190 check for single value expressions in ensure_single_value
Only wrap the argument when the optimizer is not sure that
it is a single valued expression. This allows to remove the
checks in the calling sites.
2016-04-11 21:13:37 -03:00
Vincent St-Amour
f33a4ba471 Fix ->* pre/desc and post/desc handling. 2016-04-11 17:12:23 -05:00
Robby Findler
3636e35480 more compiler/cm log message cleanup 2016-04-10 21:23:12 -05:00
Matthew Flatt
c0bbfe8237 fix raco pkg show --rx on bad patterns
Fix error reporting so it's not an internal error. Also,
report errors before printing a scope, and update the docs
for earlier changes.

Closes #1251
2016-04-08 19:10:56 -06:00
Matthew Flatt
13ebd0e1c8 adjustments for regexp failure handler
Pass a string to the handler to describe the problem.
Also, fix minor issues (GC registration, contracts and `history`
in docs) and make `pregexp`, etc., report compilation errors as
`pregexp`, etc.
2016-04-08 18:34:51 -06:00
Asumu Takikawa
436fca7134 Add optional failure thunk for regexp and friends 2016-04-08 17:15:39 -06:00
Matthew Flatt
c59e1a2ea9 Add note about MMTabBarView 2016-04-08 09:37:14 -06:00
Matthew Flatt
7a339f45b9 Merge pull request #1303 from jsmaniac/doc-changes
Update to the package template + small documentation changes
2016-04-08 09:37:04 -06:00
Vincent St-Amour
249e8eabab Post-release version for the v6.5 release 2016-04-07 11:43:45 -05:00
Georges Dupéron
c0b6378e49 Updated package template.
* Add 6.4 version, as this is now the default one to download on the website.
* raco doc <<name>> should use raco docs <<name>>
* raco is now on the PATH, remove warning
* Change `raco setup --check-deps <<name>>` to `raco setup --check-pkg-deps --pkgs <<name>>` (the former seems obsolete).
* Move `raco pkg install --deps search-auto` to the `install:` section, so that it is done before running the tests
* Move `raco pkg install --deps search-auto cover`, to the `after_success section`, since `raco cover` is run there.
* Fixed .travis.yml syntax (wrong indentation for fields under "matrix:")
* Clone https://github.com/greghendershott/travis-racket.git to a separate directory, not a subdirectory of the current package, as this can cause problems (see https://travis-ci.org/jsmaniac/type-expander/jobs/121099218#L824)
2016-04-07 15:01:01 +02:00
Gustavo Massaccesi
4bcb657f08 fix copy of rator in finish_optimize_application3 2016-04-06 16:42:33 -03:00
Michael McConville
596c571ab1 sizeof(char) is always 1
POSIX and ANSI specify that char is always 1 byte, and I'm almost
certain that no systems violate this. Regardless, the SIZEOF_CHAR macro
is never used.
2016-04-06 12:52:08 -06:00
Matthew Flatt
50ddbee87f change CRLF to LF in a Windows source file 2016-04-06 12:51:14 -06:00
Matthew Flatt
6a5cecee0a make (system-type 'machine) not depend on the secutiry guard
Allow `system-type` on non-Windows platforms to run `uname` to get
machine information, even in a sandbox or other contexts with a
limiting secutiry guard.
2016-04-06 12:51:14 -06:00
Jay McCarthy
782f5798a2 Fix issue 1286 2016-04-06 10:18:03 -04:00
Jay McCarthy
e4c0b75cae Indent 2016-04-06 10:09:16 -04:00
Jay McCarthy
cf70c4a241 Minimal optimizer safe-to-unsafe commit 2016-04-05 15:43:47 -04:00
Matthew Flatt
ffbdc4b61c fix related to continuations
Check that it works to apply a continuation that shares with
an enclosing continuation, where a runstack overflow happens
between the continuations.

Closes PR 15281
2016-04-04 11:19:53 -06:00
Gustavo Massaccesi
09313a0942 optimizer: clone K in (if (if x y #f) z K) reduction
in case K is a once used variable
2016-04-03 12:17:51 -03:00
Matthew Flatt
193178028d fix 'origin info in submodule expansion
While expanding a module, the root of module-relative references is a
fresh notion of "this module".

After expansion, "this module" is shifted to "an expanded module",
which is a global constant (for top-level modules). When an expanded
module is re-expanded, "an expanded module" is shifted to a fresh
"this module" during re-expansion, and so on.

One problem with this approach is that the shift from "this module" to
"an expanded module" isn't applied to syntax properties --- but
there's some extra trickery to make it work out by mutating "this
module" to make it look like "an expanded module".

Submodule expansion introduces an intermediate "parent of this module"
that wasn't currently covered by the extra trickery, so fix that.
2016-04-03 06:39:07 -06:00
Matthew Flatt
794061ba1d syntax/modcollapse: repair for submodule referenced from submodule
While cross-submodule references within a top-level module worked
right, submodule references across top-level modules did not work
right.
2016-04-01 15:25:50 -06:00
Matthew Flatt
161a9edb57 Windows: another PE update fix
Corrects problems with a4d569ae31 to unbreak MinGW-based builds.
2016-03-31 14:40:39 -06:00
Eric Dobson
236b17f625 Make compile-file always return a path as documented. 2016-03-31 09:28:10 -06:00
Vincent St-Amour
5c10eb13eb Revert "Attempt at adding ->im; will be reverted."
This reverts commit 3d987bf1fda9039fee9efafe21f9f78a0ef4feca.
2016-03-30 19:31:24 -05:00
Vincent St-Amour
7c458d10d7 Attempt at adding ->im; will be reverted.
`->i` already supports method contracts (for use wihin `object-contract`,
whose `->i` support is tested, but undocumented), which would make `->im`
possible.

Unfortunately, that support is very incomplete, missing support for using
`this` in contracts, making this `->im` (or the undocumented `->i` +
`object-contract` combo) basically useless.

Once/if that is added, then this commit would enable `->im`. Until then,
it's mostly useful for future reference (hence will be reverted).

In the meantime, it's possible to use `->i` within class/object contracts
with an explicit `this` argument, so nothing critical is lost, just a tiny
shortcut.
2016-03-30 19:31:23 -05:00
Vincent St-Amour
209f2db611 Don't use syntax parameters for method contracts.
Can be done with plain old functions.
2016-03-30 19:31:23 -05:00
Vincent St-Amour
0aec872710 Don't export internal helpers.
Not used anywhere, including in pkgs, not documents, and should never have been exported.

And they're going away.
2016-03-30 19:31:23 -05:00
Vincent St-Amour
077e6da2cb ->2 -> -> 2016-03-30 19:31:23 -05:00
Vincent St-Amour
62aa2b75bf Remove old implementation of ->. 2016-03-30 19:31:22 -05:00
Vincent St-Amour
427fe9340c Remove unused file. 2016-03-30 19:31:22 -05:00
Vincent St-Amour
585ca37c5b Add support for method contracts to ->2.
Should allow removal of old -> implementation.

Temporarily (almost) duplicates code, which will be fixed by removing the old ->.
2016-03-30 19:31:22 -05:00
Matthew Flatt
a4d569ae31 Windows: fix PE update for ".rsrc" not at end
Support creating executables when the base executable has
sections after ".rsrc", as long as there's room to add
a section to the section table. The new resource data is
written to the end of the file and vitrual space, but the
old space needs to be recorded as a section to keep them
contiguous.

MSVC 2015 puts a ".reloc" section after ".rsrc".
2016-03-30 16:27:58 -07:00
Matthew Flatt
153e19edc5 work around modulo failure on 64-bit Windows with MSVC 2008
Something about loading the MinGW-built "londdouble.dll" interferes
with fmod() in some cases --- but only on the first call?
2016-03-30 09:14:55 -06:00
Matthew Flatt
91eaf40b1f fix modulo and remainder related to most negative fixnum
Robby noticed the bug while looking for undefined behavior.
2016-03-30 09:14:54 -06:00
Robby Findler
bfd2404328 move late-neg projection warnings to the info level in the logger
because right now they are too noisy to be useful to anyone other
than contract system maintainers. Once the problems inside the contract
library itself is fixed, consider moving these back to warning
2016-03-30 09:29:50 -05:00
Ryan Culpepper
fafa83a8a0 syntax/parse: reorder and compress error messages
Collect common types of frame (eg message, literal, etc) and
report together. For literals, symbols, and other atoms, compress
multiple entries to list. For example:
  before: "expected the identifier `X' or expected the identifier `Y'"
  now:    "expected one of these identifiers: `X' or `Y'"
2016-03-28 15:36:52 -04:00
Ryan Culpepper
a86931d5f9 syntax/parse: improve error reporting
Previously, syntax-parse would only report errors for one maximal
progress equivalence class (and generate a useless "and other errors
occurred" message). But approach to linearizing the tree of failures
behaved badly if there was too much branching even for a single progress
equiv class. So now it dumps all of the maximal failures into one pile
and tries to find shared "sync points" (frames and terms) to linearize
the failure tree.

In particular, this eliminates the "and other errors" message.

Also updated and improved comments.
2016-03-28 15:36:52 -04:00
Ryan Culpepper
25b2ec2e03 syntax/parse: fix bug that disabled opt, improve debugging 2016-03-28 15:36:52 -04:00
Robby Findler
cf595678f6 clean up logging of compiler/cm a little
use trace-printf for all of the printing (which logs to info@compiler/cm
already) and make all of the indentation printing use the nicer:

   |  |  |  |  |

style, and avoid creating the indentation strings unless they are actually used
2016-03-27 17:29:19 -05:00
Gustavo Massaccesi
ab546d662e Fix SCHEME_LISTP 2016-03-27 10:52:33 -03:00
Robby Findler
20e2e839cb add current-path->mode 2016-03-26 18:39:17 -05:00
Matthew Flatt
9a3e16edff fix problem with lifted bindings and the top level
Repair a mismatch between `syntax-local-lift-expression` and the
way that `compile` tries to avoid creating bindings while
compiling a top-level `define` form.

Closes #1284 and #1282
2016-03-26 16:00:51 -06:00
Matthew Flatt
f7182e7a5c GC on Linux: adjust handler to not abort on SI_KERNEL signals
The meaning of SI_KERNEL signals is not clear, but ignoring
them seems to let the process continue ok. (These signals show
up when running `typed-racket-test/main --int`.)
2016-03-26 13:58:34 -06:00
Sam Tobin-Hochstadt
b1ba506b52 Remove unused variable. 2016-03-26 14:33:43 -04:00
Gustavo Massaccesi
b9b71b20cc optimizer: add hidden list-pair? primitive
This is useful in the optimizer to track simultaneously the list? and pair?
types of an expression.
2016-03-25 19:17:10 -03:00
Gustavo Massaccesi
cff10bc5a8 extract types for branch when the tests is (not <expr>)
In some cases, complex variants of (if (not <expr>) tb fb) are not reduced.
Extract the type information of the tests in <expr> to use it in tb and fb.
2016-03-25 19:15:51 -03:00
Robby Findler
df157cdfd0 make cm compile all depdencies, not just the first one that needs it
This wouldn't matter if the dependencies recorded in the dep file were
exactly the same as the files that are actually loaded when a file is
required. But in the case of lazy-require (or, more accurately, when
the cm-accomplice library is used), the dependencies in the dep files
can include things that are, in some cases, not actually
required. This is no problem for raco setup, since it looks at all of
the files anyway, but it can cause a particularly bad interaction with
DrRacket's online compilation facility.

For example say there is some file, e.g., mzscheme/main that is
required lazily. So when you edit a file in DrRacket, it will traverse
the requires and lets say it sees that the of mzscheme/main's
dependencies need to be compiled.  So it will compile that dependency,
and then the ormap in this commit will be shortcircuited, which will
cause CM to stop looking at dependencies and decide to compile
mzscheme/main. So DrRacket will compile mzscheme/main, and then
whatever other pending compiles were going on and DrRacket's online
check syntax will complete, but because the lazy require doesn't
triggered, mzscheme/main isn't actually loaded during compilation.

Now you make another edit to the buffer and the same thing happens
except this time it gets past that first dependency of mzscheme/main
because there is now a .zo file for it from the last go 'round. But
say there isn't one for the second dependency. So it compiles that
file and compiles mzscheme/main now for a second time, but still
doesn't look at the third and fourth (etc) dependencies of
mzscheme/main.

Overall, this means that the second time you edit you file in
DrRacket, it should have been quick for the expansion portion to
finish because, after all, everything has been compiled and should
have been cached in .zo files. But because of the short circuiting, it
the .zo files weren't actually created and so your second edit is also
slow to come back.

After this commit, because of the ormap, the second edit will be
faster.

One worry with this commit is that it might change something that
could cause raco setup to go slower. To test that, I applied only this
change to a fresh checkout and did a full build. I then deleted all zo
files in racket/share/pkgs and timed 'raco setup -D' twice (four times
total). Here are the timings I get. The version of the code that uses
ormap:

  % ... delete .zo files ...
  % time raco setup -D
  real    9m2.354s
  user    37m5.176s
  sys     4m14.963s
  % ... delete .zo files ...
  % time raco setup -D
  real    9m2.421s
  user    37m43.793s
  sys     4m23.111s

The version of the code that uses the change in this commit:

  % ... delete .zo files ...
  % time raco setup -D
  real    8m58.852s
  user    36m51.369s
  sys     4m13.633s
  % ... delete .zo files ...
  % time raco setup -D
  real    8m53.980s
  user    37m40.262s
  sys     4m23.692s
2016-03-23 15:41:01 -05:00
Robby Findler
668e2ffbe2 fix error message 2016-03-23 15:41:01 -05:00
Robby Findler
790096529c report a reason when entering bootstrapping mode 2016-03-23 15:41:01 -05:00
Matthew Flatt
8b3ea4c842 avoid runstack issue with early GC 2016-03-19 08:33:06 -06:00
Matthew Flatt
0b7c8e0b2e fix GC registration of the initial parameterization 2016-03-19 08:33:06 -06:00
Vincent St-Amour
894873c2ff Fix arity checking for ->*.
Some functions were passing when they shouldn't have, only to fail when
the function is called.

Technically not backwards compatible, but should only affect functions
that were never called.
2016-03-18 12:36:05 -05:00
Matthew Flatt
b94e77a062 raco pkg migrate: fix cross-version locking 2016-03-17 17:01:57 -06:00
Matthew Flatt
b1ff73155f raco pkg update: avoid too-early normalization of clone URL
For example,

  raco pkg update --lookup gui-doc

should suggest uncloning "gui-lib", too, assuming they were
cloned in the usual way. Due to too-early normalization of
GitHub URLs, though, shared-clone detection was broken.
2016-03-17 17:01:57 -06:00
Matthew Flatt
e412a2d5a9 raco pkg {install,update,...}: add --dry-run 2016-03-17 17:01:57 -06:00
Matthew Flatt
d27bf66f1a revise hash function for flonums and extflonums
As suggested by Tony.

Closes #1280
2016-03-15 05:28:04 -06:00
Matthew Flatt
182d648af6 improve some comments and an assertion 2016-03-14 18:17:10 -06:00
Robby Findler
8bcb035693 add suggest/c 2016-03-11 11:42:14 -06:00
Matthew Flatt
cbba4e75f9 fix inconsistency in cross-module inlined variable reference
The variable's position in its module was wrong, and
possibly the shape info. The demodularizer test exposed
the inconsistency.
2016-03-11 07:35:05 -07:00
Ian Harris
de0fbf2648 scalinger -> scaliger
This fixes racket/racket#757. Tests are included for both versions,
and documentation now only references the new, correctly named,
procedures.
2016-03-10 15:08:48 -06:00
Matthew Flatt
d22df41001 add support for preserved syntax properties
A syntax property is added as preserved or not. For backward
compatibility, the default for a 'paren-shape key is preserved, and
any other key's default is non-preserved.
2016-03-09 20:19:55 -07:00
Matthew Flatt
2213b61536 Windows (MinGW 64-bit): fix logging for place activity
Like 4d358d9914, but for 64-bit builds using MinGW.
2016-03-09 15:37:43 -07:00
Robby Findler
041cebc9c0 fix error message in ->i
in the case where the dependened on contract is a first-order contract, there
is a shortcircuit that incorrectly formulated the error message
2016-03-09 15:37:52 -06:00
Matthew Flatt
4d358d9914 Windows: fix logging for place activity
Logging tends to use "%Id" for `intptr_t` formatting,
at least with MSVC, but the log-string formatting function
didn't recognize the "%Id" pattern.
2016-03-09 13:14:38 -07:00
Robby Findler
0f73870a1b fix keyword argument order bug in ->i
the bug required all mandatory arguments to manifest

closes PR 15267
2016-03-08 21:50:15 -06:00
Matthew Flatt
26d28a28fe fix mismatch between optimizer snd run-time on "constant" detection
Cross-module inlining that pulls a variable reference across a
module boundary imposes a more struct requirement that run-time
"constant" detection is consistent with the optimizer's view of
"constant" within a module. So, make sure they're the same.
2016-03-08 16:37:28 -07:00
Vincent St-Amour
747185184b Don't store result arity of reduced-arity functions in a field.
Instead compute it on the fly.
2016-03-08 17:00:53 -06:00
Vincent St-Amour
9fdffc446a Further cleanup and robustness. 2016-03-08 16:56:06 -06:00
Vincent St-Amour
b5503151ac Split impersonator property into two.
To avoid future confusion.
2016-03-08 16:31:20 -06:00
Vincent St-Amour
d80a8244a2 Fix the fix in 686bc68.
Original fix did not break correctness, but did introduce too much wrapping.
2016-03-08 16:21:58 -06:00
Vincent St-Amour
686bc68b0a Fix object/c multiple-wrapping optimization.
A shortcut in the optimization made it drop all but the most recent contract.
2016-03-08 15:51:51 -06:00
Gustavo Massaccesi
509da64135 reduce (let ([x <expr>]) #f) => (begin <expr> #f)
Sometimes the optimizer removes all the references to a variable but it
doesn't detect that the variable is unused, so it keeps the definition.

Later, the sfs detects the unused variable so it marks it, but it doesn't
remove the let form.
2016-03-07 20:30:46 -03:00
Matthew Flatt
ffbae2c090 fix resolve-path to always return a path (not a string)
Closes #1132
2016-03-07 15:34:57 -07:00
Vincent St-Amour
e90e587a91 Generalize procedure-result-arity to work on reduced-arity procedures. 2016-03-07 16:25:13 -06:00
Matthew Flatt
c1d44cedba allow cross-module inlining to introduce a variable reference
Formerly, cross-module inlining would not work for a function like

  (define (f x)
    (if .... .... (slow x)))

unless `slow` was also inlined into `f`. This commit changes
cross-module inlining so that it allows a call to `f` to be replaced
with an expression that references other module-level bindings (that
are not primitives), such as `slow`.

Adjusting the inlining rules can always make some program worse. In
this case, a hueristic about whether to export an optimized or
unoptimized variant of a fnuciton for inlining tends to collide with
the adjusted inlining rule, so this commit tweaks that heuristic, too.
2016-03-07 07:13:14 -07:00
Matthew Flatt
7e2195fdba fix optimizer bug
Fix a bug introduced by one of the last few bytecode-compiler
changes.
2016-03-05 13:10:21 -07:00
Matthew Flatt
bfb14637a6 fix validator and JIT to match with-continuation-mark compilation
Compiler changes allow the body of a `with-continuation-mark`
form to produce an unboxed value, but the validator and JIT
were not updated for that change.
2016-03-05 05:51:06 -07:00
Matthew Flatt
79ad86d891 fix optimization related to with-continuation-mark
Fix mistake intoduced in 5904acc69a adding `with-continuation-mark`
to single_valued_noncm_expression().
2016-03-05 05:17:37 -07:00
Matthew Flatt
2bfb851ccc optimizer: generalize intraprocedural type tracking
Enable the optimizer to figure to figure out that a loop
argument is always a real number, for example, in much the
same way that it can detect fixnums and flonums for unboxing.

Unboxing information was only needed at the resolve level,
but `real?` information is useful only to the optimizer, so
the generalization enables the optimizer to reach
approximations of type information earlier (e.g., among
a subset of a function's arguments).
2016-03-05 05:17:37 -07:00
Matthew Flatt
8ec35de0b2 generalize predicate tracking to support numerics 2016-03-05 05:17:37 -07:00
Matthew Flatt
1c8881dbef optimizer: convert (let ([x M]) x) to (begin0 M #f)
For simple enough M, `(let ([x M]) x)` is already converted
to just M, but add a conversion for other forms that gets rid
of the binding while preserving non-tailness.
2016-03-05 05:17:37 -07:00
Matthew Flatt
254dac4625 optimizer: drop redundant with-continuation-marks
Simplify `(wcm <k1> <v1> (wcm <k1> <v2> <e>))` to
`(begin <v1> (wcm <k1> <v2> <e>))` for a simple enough <k1>.
A variable simple enough, so this is useful for improving
errortrace output.
2016-03-05 05:17:37 -07:00
Robby Findler
b52a4b3318 make struct-out leave behind a disappeared use for its argument
closes PR 15263
2016-03-03 03:38:53 -06:00
Sam Tobin-Hochstadt
8eadc197a9 Use syntax-local-introduce to fix arrows in match. 2016-03-02 18:03:46 -05:00
Matthew Flatt
9b4f830268 improve hashing on structs, especially prefabs
Use the structure-type name, in addition to the structure
content. Including the name is espeically useful for
distinguishing prefabs structs that differ in the prefab
name.
2016-03-02 10:42:57 -07:00
Matthew Flatt
97d951af54 improve equal-hash-code on interned symbols
Compute an `equal?` hash code for `read`able values that
is a constant, at least for a given version of Racket. Only
(interned) symbols failed to have that property before.
2016-03-02 10:31:34 -07:00
Matthew Flatt
3617e1f81e xform: add XFORM_ASSERT_NO_CONVERSION
A `XFORM_ASSERT_NO_CONVERSION` declaration makes xform check that
an procedure that is intended to avoid instrumentation actually
does avoid it.
2016-03-02 09:48:24 -07:00
Robby Findler
753def919b cooperate better with check syntax for variables generated by #:pre and #:post in ->i
closes PR 15256
2016-03-01 00:56:34 -06:00
Sam Tobin-Hochstadt
e94081c5aa Initialize variables to avoid compiler warnings. 2016-02-29 12:21:55 -05:00
Matthew Flatt
59f3f82460 GC: fix initialization of mark tables for places
Fixes a mistake in 7d90b27524.
2016-02-29 06:08:29 -07:00
Matthew Flatt
3b25e22dd6 add XFORM_NONGCING_NONALIASING annotation
An `XFORM_NONGCING_NONALIASING` function doesn't trigger a GC, and
when it is given an argument that is an address of a local variable,
it fills in that address and doesn't leak it. This annotation allows
the xform transformation (to support precise GC) avoid some work for
some hash-iteration functions.
2016-02-28 17:19:34 -07:00
Matthew Flatt
8a59534669 adjust unsafe hash-table iteration implementation
Restore exports available to embedding, extending, and FFI
applications, and shift boundary back between hash-table
implementation details (in "hash.c") and Racket interface
(in "list.c").
2016-02-28 16:23:52 -07:00
Matthew Flatt
3ac2c69f6c add explanations for primitive-property flags 2016-02-28 15:14:53 -07:00
Matthew Flatt
428d02c78c enumerate some guidelines for changing the core implementation 2016-02-28 15:14:53 -07:00
Gustavo Massaccesi
828335a879 optimizer: split optimize_info_lookup
With the old representation of local variables, optimize_info_lookup
had to search the stack for the frame with the information about the
variable. This was complicated so it has many flags to be used in
different situations and extract different kind of information.

With the new representation this process is easier, so it's possible
to split the function into a few smaller functions with an easier
control flow.

In particular, this is useful to avoid marking a variable as used
inside a lambda when the reference in immediately reduced to a
constant using the type information.
2016-02-28 17:59:34 -03:00
Gustavo Massaccesi
5ef3a53002 special cases for small hashes in unsafe_scheme_hash_tree_iterate_*
The iterator saves the return points in a list. For small immutable hashes,
encode the values in the list in the bits of a fixnum to avoid allocations.
2016-02-28 15:34:16 -03:00
Matthew Flatt
7d90b27524 add support for defining GC traversals through ffi/unsafe
Expose tagged allocation and a function that interprets a description
of tagged shapes. As a furst cut, the description can only specify
constant offsets for pointers within the object, but future extensions
are possible.
2016-02-27 20:33:50 -07:00
Matthew Flatt
e4f0b69b72 fix chaperone-of? and property-only impersonators
Closes #1263
2016-02-27 19:50:54 -06:00
Matthew Flatt
032b1871d1 bytecode compiler: break up and improve comments at final let step 2016-02-27 18:13:14 -06:00
Matthew Flatt
d70616ec65 raco exe: fix 32-bit ELF updating
Closes #1264
2016-02-27 18:12:57 -06:00
ben
f83cec1b04 fix (combinations n k) bug
Now using Gosper's hack to enumerate length k binary numbers.
New implementation is shorter & a little more obviously correct
(if you trust the bit-twiddling)
https://en.wikipedia.org/wiki/Combinatorial_number_system#Applications
2016-02-26 17:59:59 -05:00
Ryan Culpepper
c1664610e1 update version number for ffi change 2016-02-26 17:57:56 -05:00
Ryan Culpepper
2cc4b66184 add saved-errno setter variant
This makes it easier to create mock foreign functions
(or wrap existing ones) for testing.
2016-02-26 17:57:56 -05:00
Matthew Flatt
81b5d74ed6 fix mishandling of the continuation-mark depth
When a chaperone-wrapped function leads to a slow-path tail
call, the continuation-mark depth can be made too deep when
resolving the slow tail call.

Closes #1265
2016-02-26 16:39:05 -05:00
Robby Findler
990555cd8d fix arity checking for -> contract with ellipses
closes #1266
2016-02-26 08:10:42 -06:00
Matthew Flatt
d9971292a6 make compiled-expression-recompile work on top-level forms
Mostly just fill in some corners, but also fix a bug with lifted
functions that accepted a boxed argument and have less than three
arguments total.

The `tests/racket/test` test suite now passes with
`PLT_RECOMPILE_COMPILE` set --- except for the "optimize.rktl" test
suite, wher emore work is needed to ensure that optimizations
don't get lost.
2016-02-26 06:03:11 -05:00
Matthew Flatt
f0500c64d3 Windows: always get errno from "MSVCRT.dll" 2016-02-26 06:03:10 -05:00
Stephen Chang
15f47ef62e fix context of macro-generated default-in-hash- internal ids 2016-02-25 23:40:30 -05:00
Gustavo Massaccesi
5a378ca883 More reductions for (if t v v) and (eq? v v)
Reduce
(eq? v v) ==> #t
(if t v v) ==> (begin t v)
(if v v #f) ==> v
when v is a local or a top level variable.

Previously, the last two reductions were used only
with local variables.

Also, move the (if x #t #f) ==> (not x) reduction
after branch optimization.
2016-02-24 21:56:04 -03:00
Gustavo Massaccesi
6cd225e073 avoid compiler warning 2016-02-24 21:55:05 -03:00
Stephen Chang
3e29101e48 properly throw exn when in-hash seq input is wrong type of hash
- refactors define-in-hash-sequences
- closes #1256
2016-02-24 14:43:44 -05:00
ben
c15a357417 add #:exact-columns option to table-display
Least invasive change I could think of to solve #1252.
When `--full-checksum` is set, never truncates the checksum column.

Examples:
```
$ raco pkg show typed-racket
Installation-wide:
 Package       Checksum               Source
 typed-racket  32d0a97058b797a8ef...  clone...=typed-racket
User-specific for installation "development":
 [none]
```

```
$ raco pkg show --full-checksum typed-racket
Installation-wide:
 Package       Checksum                                  Source
 typed-racket  32d0a97058b797a8efe794336dde069156b98630  clone...=typed-racket
User-specific for installation "development":
 [none]
```

```
$ raco pkg show --long typed-racket
Installation-wide:
 Package         Checksum                                    Source
 typed-racket    32d0a97058b797a8efe794336dde069156b98630    (clone "/Users/ben/code/racket/fork/extra-pkgs/typed-racket/typed-racket" "git://github.com/racket/typed-racket/?path=typed-racket")
User-specific for installation "development":
 [none]
```
2016-02-23 19:23:08 -05:00
Asumu Takikawa
98ba277948 Normalize path to have a trailing slash
The regexp-based helper did not work correctly for
a path like the one in the following use:

  raco pkg install -n foo /
2016-02-22 21:53:22 -05:00
Matthew Flatt
9494216a9b fix a problem with hash-remove
When a key is removed at a level that other only has a collision
table, the HAMT representation was not adjusted properly by
eliminating the layer. As aresult, table comparison via
`equal?` could fail. The problem could show up with hash tables
used to represent scope sets, where an internal "subset?" test
could fail and produce an incorrect binding resolution.
2016-02-22 15:24:17 -07:00
Jay McCarthy
619ef41f7d If full-checksum, table can be as long as necessary 2016-02-22 09:32:06 -05:00
Matthew Flatt
c0bb539af7 make an optimizer function private 2016-02-21 08:07:27 -07:00
Matthew Flatt
d050bd79d9 revert an optimizer transformation
The transformation from

 (begin (let <bindings> (begin <e1> ...)) <e2> ...)

to

 (let <bindings> (begin <e1> ... <e2> ...))

makes things look simpler and might help the optimizer a little. But
it also tends to make the run-time stack deeper, and that slows some
programs a small but measurable amount.

A better solution would be to keep the transformation but add another
pass that moves expressions out of a `let`.
2016-02-21 08:07:26 -07:00
Matthew Flatt
537292ef45 optimizer: fix calculation of used local variables (again)
Mostly reverts a52a08146a, then repairs the problem in a way
that does not add variables unnecessarily to nested closures.
2016-02-21 08:07:26 -07:00
Gustavo Massaccesi
01458e22fa Don't burn fuel when a single use function is inlined
Since this operation only moves the code and doesn't make the final
bytecode bigger, it's not necessary to decrease the fuel and then it
is available for further inlining.
2016-02-21 08:07:26 -07:00
Matthew Flatt
0619af508b merge unresolver implementations
Merge the original implementation for cross-module inlining
with the new one for recompiling.
2016-02-21 08:07:26 -07:00
Matthew Flatt
0606228959 add comments 2016-02-19 18:57:57 -07:00
Matthew Flatt
5f7d0317e8 improve names for some internal structures and functions
Changes:

    ...unclosed_procedure... -> lambda
    ...procedure_compilation... -> lambda
    ..._Closure_Data -> ..._Lambda
    `code` field in Scheme_Lambda -> `body` field
    ..._CLOSURE_DATA_FLAGS -> ..._LAMBDA_FLAGS
    CLOS_... -> LAMBDA_... (e.g., CLOS_IS_METHOD)
    SCHEME_COMPILED_CLOS_CODE -> SCHEME_CLOSURE_CODE
    SCHEME_COMPILED_CLOS_ENV -> SCHEME_CLOSURE_ENV

    ..._compiled_... -> ..._ir_... (where "ir" is "intermediate
                                    representation")
    ..._Compiled_... -> ..._IR_... (e.g., Scheme_Compiled_Let_Value)
    Scheme_Let_Header -> Scheme_IR_Let_Header (since it's IR-only)
    Closure_Info -> Scheme_IR_Lambda_Info

    make_syntax_compiler -> make_primitive_syntax
    scheme_syntax_compiler_type -> scheme_primitive_syntax_type
    ..._syntax -> ..._compiler (e.g., lambda_syntax -> lambda_compile)

    scheme_..._prim -> scheme_..._proc
    scheme_values_func -> scheme_values_proc

Closes #1249
2016-02-19 18:57:57 -07:00
Matthew Flatt
37a8031803 windows: fix overflow handling in seconds->date 2016-02-19 18:57:06 -07:00
Matthew Flatt
a52a08146a optimizer: fix calculation used local variables
The calculation of used variables in a possibly unused function did
not work right when the function is referenced by a more deeply
nested function that itself is unused. The extra uses triggered by
more nested uses need to be registered as tentative in the more nested
frame, not in the outer frame.

Closes #1247
2016-02-18 21:21:27 -07:00
Matthew Flatt
2b4bfcf854 raco setup: repair doc build
Fix mistake in 1005701b8e.
2016-02-18 16:26:15 -07:00
Matthew Flatt
a0f7b618f7 fix failure in cross-module inliner
Recent compiler changes expose a bug in the cross-module
inliner when it turns out to be unable to inline a candidate.
2016-02-18 14:09:35 -07:00
Matthew Flatt
1005701b8e raco setup: defend against bad scribblings in "info.rkt"
Closes #1142
2016-02-18 13:45:53 -07:00
Matthew Flatt
6a78beecdf raco setup: more consistently defend against bad "info.rkt"
Closes #1244
2016-02-18 13:28:19 -07:00
Matthew Flatt
0133954c84 avoid a made-up OS error in rename-file-or-directory
On Unix and OS X, the check to avoid replacing an existing
file or directory is made by Racket, rather than the OS,
so don't claim a system error if the operation fails for
that reason.

Also, update the docs to clarify that the check is not
atomic with the move.

Closes issue #1158
2016-02-18 13:12:55 -07:00
Sam Tobin-Hochstadt
79fcdf4201 Remove unused variables to eliminate compiler warnings. 2016-02-18 12:57:52 -05:00
Sam Tobin-Hochstadt
b92ef72c8c fix typo 2016-02-18 10:49:24 -05:00
Matthew Flatt
db04b47cdb add stack-overflow check in compiler's letrec-check pass
Closes PR 15247
2016-02-17 06:16:31 -07:00
Matthew Flatt
0c38da0ee2 change intermediate representation for the bytecode optimizer
Correct the second-biggest design flaw in the bytecode optimizer:
instead of using a de Bruijn-like representation of variable
references in the optimizer pass, use variable objects.

This change is intended to address limitations on programs like the
one in

 http://bugs.racket-lang.org/query/?cmd=view&pr=15244

where the optimizer could not perform a straightforward-seeming
transformation due to the constraints of its representation.

Besides handling the bug-report example better, there are other minor
optimization improvements as a side effect of refactoring the code. To
simplify the optimizer's implementation (e.g., eliminate code that I
didn't want to convert) and also preserve success for optimizer tests,
the optimizer ended up getting a little better at flattening and
eliminating `let` forms and `begin`--`let` combinations.

Overall, the optimizer tests in "optimize.rktl" pass, which helps
ensure that no optimizations were lost. I had to modify just a few
tests:

 * The test at line 2139 didn't actually check against reordering as
   intended, but was instead checking that the bug-report limitation
   was intact (and now it's not).

 * The tests around 3095 got extra `p` references, because the
   optimizer is now able to eliminate an unused `let` around the
   second case, but it still doesn't discover the unusedness of `p` in
   the first case soon enough to eliminate the `let`. The extra
   references prevent eliminating the `let` in both case, since that's
   not the point of the tests.

Thanks to Gustavo for taking a close look at the changes.

 LocalWords:  pkgs rkt
2016-02-16 21:05:15 -07:00
ben
0e1f17b520 option to limit prefix in ~a,~s,~v,~e,~.a,~.s,~.v 2016-02-11 19:51:47 -05:00
Robby Findler
71f338430b clean up some confusion about the timing of errors
specifically, always wait for the neg party to come in
before signalling any errors
2016-02-10 17:36:37 -06:00
Vincent St-Amour
640895645f Fix contract-stronger? to work with late-neg projections. 2016-02-10 15:40:59 -06:00
Stephen Chang
e6a0caa147 Use better regexp for string->url input contract.
Closes #929
2016-02-10 12:54:03 -05:00
Stephen Chang
5ffe007f5c Add faster non-generic in-*-set sequences
closes #1217
2016-02-10 11:24:38 -05:00
Matthew Flatt
5b37bac183 xform: another signbit intrinsic 2016-02-10 06:07:20 -07:00
Matthew Flatt
f21aa8661b xform: more signbit variants 2016-02-09 08:21:41 -07:00
Matthew Flatt
1cffde1df8 fix parallel raco setup failure on dependency cycles
The failure should be an individual module failure, instead of
terminating `raco setup`.
2016-02-09 08:01:42 -07:00
Matthew Flatt
50db01bf2c bump version 2016-02-09 07:38:28 -07:00
Matthew Flatt
c1b9cd6828 xform: recognize some floating-point intrinsics
GCC v6.0 apparently adds `__builtin_isnan`. Guess at some other future
additions, while we're at it.

Closes #1222
2016-02-09 07:38:28 -07:00
Matthew Flatt
18990701a6 xform: better reporting for disallowed call 2016-02-09 07:38:28 -07:00
Matthew Flatt
9a8fd2912f avoid some C undefined behavior
Found with `-fsanitize=undefined`. The only changes that are potentially
bug repairs involve some abuses of pointers that can end up misaligned
(which is not an x86 issue, but might be on other platforms). Most of
the changes involve casting a signed integer to unsigned, which
effectively requests the usual two's complement behavior.

Some undefined behavior still present:

  * floating-point operations that can divide by zero or coercions
    from `double` to `float` that can fail;

  * offset calculations such as `&SCHEME_CDR((Scheme_Object *)0x0)`,
    which are supposed to be written with `offsetof`, but using
    a NULL address composes better with macros.

  * unaligned operations in the JIT for x86 (which are ok, because
    they're platform-specific).

Hints for using `-fsanitize=undefined`:

 * Add `-fsanitize=undefined` to both CPPFLAGS and LDFLAGS

 * Add `-fno-sanitize=alignment -fno-sanitize=null` to CPPFLAGS to
   disable those checks.

 * Add `-DSTACK_SAFETY_MARGIN=200000` to CPPFLAGS to avoid stack
   overflow due to large frames.

 * Use `--enable-noopt` so that the JIT compiles.
2016-02-09 07:38:28 -07:00
Matthew Flatt
35acfab903 fix internal array size on module redeclaration
If a module is redeclared with more phases than before,
expand the `running` array.
2016-02-07 13:34:47 -07:00
Gustavo Massaccesi
7982a59a1d Fix eq? reduction 2016-02-07 16:49:06 -03:00
Stephen Chang
048c4b4a73 add unsafe-hash-iterate ops; add specific hash table sequences
- refactor for.rkt: abstract in-hash- definitions
- refactor hash_table_next in hash.c
- move hash fn headers to schpriv.h

closes #1229
2016-02-05 14:30:34 -05:00
Gustavo Massaccesi
89e00da75e Swap arguments of optimize_get_predicate 2016-02-04 15:42:09 -03:00
Gustavo Massaccesi
9cb0637f95 Don't add type information twice
In some cases, for example while using no_types, the optimizer can try to
add again the type information of a local variable. This creates unnecessary
internal storage to save the repeated information.
2016-02-04 15:41:51 -03:00
Gustavo Massaccesi
65838bd3c8 Try to collapse references in a branch using the type information of the other branch
A reference to a local may be reduced in a branch to a constant, while it's unchanged in the
other because the optimizer has different type information for each branch. Try to use the
type information of the other branch to see if both branches are actually equivalent.

For example, (if (null? x) x x) is first reduced to (if (null? x) null x) using the type
information of the #t branch. But both branches are equivalent so they can be
reduced to (begin (null? x) x) and then to just x.
2016-02-04 15:41:32 -03:00
Gustavo Massaccesi
3f246dd857 Use a sub_info to optimize branches
Create a new sub_info for each branch to hold the type information of the local variables, instead of handling the types manually.
2016-02-04 15:41:15 -03:00
Gustavo Massaccesi
1b54b1c040 optimizer: reductions for expressions with fixnum
For example, reduce:

(= <fx> <fx>) ==> (unsafe-fx= <fx> <fx>)
(fxmax <fx> <fx>) ==> (unsafe-fxmax <fx> <fx>)
(zero? <fx>) ==> (unsafe-fx= <fx> 0)
(bitwise-not <fx>) ==> (unsafe-fxnot <fx>)
2016-02-03 13:11:59 -03:00
Gustavo Massaccesi
bbbe99db43 optimizer: use type predicates to calculate local types
The functions expr_implies_predicate was very similar to
expr_produces_local_type, and slighty more general.
Merging them, is possible to use the type information
is expressions where the optimizer used only the
local types that were visible at the definition.

For example, this is useful in this expression to
transform bitwise-xor to it's unsafe version.

(lambda (x)
  (when (fixnum? x)
    (bitwise-xor x #xff)))
2016-02-03 13:11:45 -03:00
Jay McCarthy
ced25315ac Merge pull request #1231 from simmone/xml
not sort xml attributes
2016-02-03 11:07:02 -05:00
Matthew Flatt
2ee721f351 clean up GC implementation
Try to make the GC implementation more readable by reordering
and reorganizing the code.
2016-02-03 06:59:05 -07:00
Chen Xiao
19c00dc91c xml attributes not sort 2016-02-03 16:52:15 +08:00
Gustavo Massaccesi
65eaff3a03 Avoid compiler warnings 2016-02-02 19:06:31 -03:00
Matthew Flatt
4e7bb3071a OS X: support Unix-style install
Support "Unix-style" (as opposed to "in-place") installation for
OS X, which is mostly a matter of putting ".app" files in the
right place and correcting relative references.

Intended to fix #1180
2016-01-29 22:01:57 -07:00
Robby Findler
ec4bd288bf add support for ... to -> contracts to indicate repeated arguments
also fix order of evaluation for ->
2016-01-28 15:34:57 -06:00
Robby Findler
856e60fe51 add *list/c 2016-01-28 10:12:24 -06:00
Robby Findler
5214b06a86 use chaperone-of? instead of eq? to find list?, null?, and pair? 2016-01-28 10:12:23 -06:00
Vincent St-Amour
fe900e0d7a More cons lifting. 2016-01-27 14:41:00 -06:00
Vincent St-Amour
870b8d4137 More cons lifting.
Could not lift all of those completely.
2016-01-27 14:40:59 -06:00
Vincent St-Amour
5dc368585f Lift some blame and neg-party consing.
To avoid doing it every time the contract is checked.
2016-01-27 14:40:59 -06:00
Robby Findler
c34d37d265 break list contracts out into their own file
which required moving and/c (and integer-in) out of
misc.rkt files to avoid cyclic dependencies
2016-01-27 08:16:39 -06:00
Stephen Chang
86a9c2e493 fix return type of hash_table_index 2016-01-26 10:26:51 -05:00
Stephen Chang
e8d34dd156 add hash-iterate-pair and hash-iterate-key+value
- cuts in-hash and in-hash-pairs iteration time in half
- refactor hash_table_index
- add tests
- bump version

closes #1224
2016-01-26 10:14:40 -05:00
Robby Findler
7563f5a812 refresh the popular keys 2016-01-25 23:55:41 -06:00
Robby Findler
6723c64487 dont use unsafe-{chaperone,impersonator}-procedure when {chaperone,impersonator}-procedure* might be involved 2016-01-25 23:54:12 -06:00
Gustavo Massaccesi
5644b901d0 Avoid unnecessary closures in arrow-val-first
This code uses call-with-values and case-lambda to check the number of
values that returns the original function inside the contract.
The case-lambda create new closures because they have references
to local variables.

In these case, it's possible to avoid the creation of closure saving the
results in temporal variables, that are used later outside the case-lambda.
2016-01-25 17:18:00 -03:00
Robby Findler
f669eb4af5 add a second argument to list*of
to control what the last piece of the list is more explicitly
2016-01-25 07:58:49 -06:00
Robby Findler
b0d9653cbe adjust the plus-one arity functions to exploit procedure-return-arity 2016-01-25 07:58:49 -06:00
Matthew Flatt
9e69f341b3 fix unsafe-chaperone-procedure and ...-procedure* side channel
Also, clarify in docs that `unsafe-chaperone-procedure` cannot
really work with an argument created via `chaperone-procedure*`.
2016-01-24 21:45:21 -08:00
Vincent St-Amour
9d990b65dc Add instrumentation to class/c.
Method contracts are taken care of by the function combinators.

So only field contract instrumentation is necessary.
2016-01-22 15:30:07 -06:00
Alexis King
3620bae6da Fix check-version from version/check
Use get-pure-port to more robustly handle HTTP and to avoid prematurely
closing the output port.
2016-01-21 20:18:48 -06:00
Alexis King
f52d43e600 Add for/stream and for*/stream comprehensions to racket/stream
Closes #664
2016-01-21 20:18:39 -06:00
Robby Findler
10c934aec0 restore the contract profile marks
commit bea67c0 dropped a bit too much of the contract wrapper
2016-01-21 06:57:42 -06:00
Robby Findler
bea67c0a39 When we know that the procedure getting a contract is "simple enough",
drop the tail call fanciness

"simple enough", for now, means that it is a struct selector, predicate,
constructor, or mutator. Perhaps we will learn more about such simple
procedures where this is safe some other way.

This commit speeds up this program:

  #lang racket/base
  (require racket/contract/base)
  (struct s (x))
  (define f (contract (-> any/c integer?) s-x 'pos 'neg))
  (define an-s (s 1))
  (time
   (for ([x (in-range 10000000)])
     (f an-s)))

by about 1.9x
2016-01-20 21:38:32 -06:00
Robby Findler
126c090579 special case any/c when it appears syntactically in the argument to ->
Skip calling the domain projection in that case and, if all of the
arguments are any/c then also skip putting the contract continuation mark

This appears to give about a 20% speed up on this program:

  #lang racket/base
  (require racket/contract/base)
  (define f
    (contract
     (-> any/c integer?)
     (λ (x) 1)
     'pos 'neg))
  (time
   (for ([x (in-range 4000000)])
     (f 1)))
2016-01-20 21:08:15 -06:00
Stephen Chang
fa96375742 fix in-vector segfault; document corner cases
closes #15227
2016-01-19 16:37:07 -05:00
Stephen Chang
0f39ee9b72 fix ni-range docs; add for tests 2016-01-19 14:22:02 -05:00
Stephen Chang
8331e28c49 Merge pull request #1208 from stchang/fast-in-hash
add :do-in fast path for in-hash
2016-01-19 10:52:10 -05:00
Matthew Flatt
86f0d75a96 JIT: fix fast path for property-only chaperones
The recently added fast path for property-only chaperones did not
propagate the original object in the case that the property-only
chaperone wraps a `chaperone-procedure*` chaprerone.

Merge to v6.4
2016-01-19 06:51:25 -05:00
Vincent St-Amour
4fd60fed11 Instrument id table contracts. 2016-01-18 22:23:07 -06:00
Vincent St-Amour
d5ae7125e5 Add instrumentation to sequence/c. 2016-01-18 22:23:07 -06:00
Vincent St-Amour
451ef1d37e Add instrumentation for tail-marks-match?. 2016-01-18 22:23:07 -06:00
Vincent St-Amour
b8af007d94 Instrument stream/c. 2016-01-18 22:23:07 -06:00
Vincent St-Amour
74c423bb24 Add instrumentation to set/c. 2016-01-18 22:23:06 -06:00
Vincent St-Amour
a48b559324 Instrument async-channel/c. 2016-01-18 22:23:06 -06:00
Vincent St-Amour
2f6f403ce8 Fix and improve ->i instrumentation. 2016-01-18 22:23:06 -06:00
Vincent St-Amour
d0c48de685 Add instrumentation to struct property contracts. 2016-01-18 22:23:06 -06:00
Vincent St-Amour
1661eeda18 Front-load some work in struct/dc instrumentation. 2016-01-18 22:23:05 -06:00
Vincent St-Amour
b00d7782ca Instrumentation for parametric->/c. 2016-01-18 22:23:05 -06:00
Vincent St-Amour
143267f1e9 Remove now-redundant instrumentation of vector contracts.
Now covered by instrumentation at contract entry points.
2016-01-18 22:23:05 -06:00
Vincent St-Amour
1277f0347a Instrumentation for object-contract. 2016-01-18 22:23:05 -06:00
Vincent St-Amour
e5738b8ee6 Add missing instrumentation to misc.rkt. 2016-01-18 22:23:04 -06:00
Vincent St-Amour
72418fba03 Instrument higher-order hash/c. 2016-01-18 22:23:04 -06:00
Vincent St-Amour
f3f5d9212a Instrumentation at use site for provide/contract and flat contracts. 2016-01-18 22:23:04 -06:00
Vincent St-Amour
9b7724167a Add instrumentation for box contracts. 2016-01-18 22:23:03 -06:00
Vincent St-Amour
379a3dd110 Add instrumentation to contract system entry points.
To catch checking that does not happen inside chaperones.
2016-01-18 22:23:03 -06:00
Robby Findler
66d6de6394 avoid putting tail marks on when we know they are already there 2016-01-18 21:19:32 -06:00
Robby Findler
0104e753e7 fix incorrect contract profiler marks, introduced in 308c918a 2016-01-18 21:19:32 -06:00
Matthew Flatt
edd117d414 update HISTORY.txt for v6.4
Merge to v6.4
2016-01-17 16:37:20 -07:00
Matthew Flatt
1204aacd70 procedure-specialize: repair for literal syntax object
Fix `procedure-specialize` for a procedure that refers to a
syntax-object literal. A syntax-object literal becomes part of the
procedure closure, but in a special way that nomrally allows syntax
objects to be loaded on demand. For now, specialization counts as
a demand of the syntax object.

Merge to v6.4
2016-01-17 16:37:20 -07:00
Matthew Flatt
e0cc61d5af fix broken info use after JIT buffer overflow
After the JIT buffer becomes too full, some paths
don't bail out fast enough, so guard against
broken info in some relatively new uses of the info.

Merge to v6.4
2016-01-17 16:37:20 -07:00
Sam Tobin-Hochstadt
e133d87765 Handle rename transformers better in match expanders.
Closes PR 15223.

Merge to 6.4.
2016-01-17 10:48:07 -05:00
Matthew Flatt
ea172ae459 unsafe-{chaperone,impersonate}-procedure: fix name on bad arity
When a procedure created by `unsafe-{chaperone,impersonate}-procedure`
is given the wrong number of arguments, the original procedure's name
should be used in the error message.
2016-01-16 23:06:33 -07:00
Robby Findler
738529c7de fix a bug introduced in 35ce47d97 2016-01-16 12:37:58 -06:00
Matthew Flatt
0a266780fe unsafe-{impersonate,chaperone}-procedure: to racket/unsafe/ops
Move from racket/base, since the functions are unsafe.
2016-01-16 08:20:36 -07:00
Matthew Flatt
48de4101c2 sync version numbers 2016-01-16 07:04:06 -07:00
Matthew Flatt
cc4fd16ed5 avoid a srcloc from "kw.rkt" 2016-01-16 07:03:29 -07:00
Robby Findler
35ce47d97c use procedure-result-arity in racket/contract
This commit, combined with the use of unsafe-chaperone-procedure,
achieves almost the same speedups as c24ddb4a7, but now correctly.

More concretely, this program:

  #lang racket/base
  (module server racket/base
    (require racket/contract/base)
    (provide
     (contract-out
      [f (-> integer? integer?)]))
    (define (f x) x))
  (require 'server)
  (time
   (let ([f f]) ;;  <-- defeats the plus-one-arity optimiztion
     (for ([x (in-range 1000000)])
       (f 1) (f 2) (f 3) (f 4) (f 5))))

runs only about 40% slower than the version without the "(let ([f f])"
and this program

  #lang racket/base
  (module m racket/base
    (provide f)
    (define (f x) x))
  (module n typed/racket/base
    (require/typed
     (submod ".." m)
     [f (-> Integer Integer)])
    (time
     (for ([x (in-range 1000000)])
       (f 1) (f 2) (f 3) (f 4))))
  (require 'n)

runs about 2.8x faster than it did before that same set of changes.
2016-01-16 00:02:20 -06:00
Robby Findler
579d50b2d8 add procedure-result-arity 2016-01-16 00:02:20 -06:00
Robby Findler
308c918a42 use unsafe-{chaperone,impersonate}-procedure in racket/contract
for contracts where the arity of the given function is exactly
the arity that the contract expects (i.e. no optional arguments
are turned into madatory or dropped)
2016-01-16 00:02:20 -06:00
Robby Findler
41c8d5bc27 add unsafe-{chaperone,impersonate}-procedure 2016-01-16 00:02:19 -06:00
Jay McCarthy
df29c4e7e2 adjust double splicing behavior of rename-transformer-parameter 2016-01-14 17:29:15 -05:00
Jay McCarthy
3cb100ba17 Clean up stxparam interface 2016-01-14 17:29:15 -05:00
Stephen Chang
187d220ecc add :do-in fast path for in-hash 2016-01-14 12:28:23 -05:00
Matthew Flatt
9498bdd80f make raco distribute work with non-writable exe
Closes PR 15214

Merge to v6.4
2016-01-13 20:12:36 -07:00
Gustavo Massaccesi
be82c27db3 fix bug in shifting of types during inlining
During inlining, the type information gathered in
code that was inside the lambda is copied to the outer
context. But the coordinates of the type information
were shifted in the wrong direction, so the type was
assigned to the wrong variable.

This bug is difficult to trigger, so the test is convoluted.

Merge to v6.4
2016-01-13 23:59:17 -03:00
Matthew Butterick
0fb11e61e6 update copyright from 2015 to 2016 2016-01-13 19:40:35 -07:00
Matthew Flatt
052c7e4c06 pick better names for new module-expansion properties
In retrospect, 'module-body-outside-context wasn't a good
name for a property that turned out to hold only an
inside-edge scope.
2016-01-13 07:53:50 -07:00
Matthew Flatt
6ea9e963c4 add context properties to a module expansion
Add 'module-body-inside-context, 'module-body-outside-context, and
'module-body-context-simple? properties to the expansion of a
`module` form. These properties expose scopes that are used by
`module->namespace` and taht appear in marshaled bytecode.
2016-01-13 07:44:31 -07:00
Asumu Takikawa
34f52deeb1 Fix struct error for bad #:constructor-name 2016-01-12 11:21:31 -05:00
Matthew Flatt
417d9b0e73 define-runtime-path: add a #:runtime?-id option
The expression in a `define-runtime-path` form is used in
both a run-time context and a compile-time context. The
latter is used for `raco exe`. In a cross-build context,
you might need to load OpenSSL support for Linux (say)
at build time while generating executables that refer to
Windows (say) OpenSSL support. In that case, `#:runtime?-id`
lets you choose between `(cross-system-type)` and
`(system-type)`.

Merge to v6.4
2016-01-09 09:44:47 -07:00
Ryan Culpepper
c2e99efefc Post-release version for the v6.4 release 2016-01-09 11:31:31 -05:00
Matthew Flatt
01e889570a net/win32-ssl: enable TLS 1.1 and 1.2 2016-01-09 08:28:20 -07:00
Matthew Flatt
034d2e9531 declare NSSupportsAutomaticGraphicsSwitching
Related to #1193
2016-01-09 06:12:46 -07:00
Matthew Flatt
3e5c889b7d adjust non-JIT application of chaperone with only properties
Don't push elements to the runstack that aren't popped back off. I
can't construct an example that demonstrates a problem, but fix it
just in case.
2016-01-09 06:09:36 -07:00
Matthew Flatt
7b4c91ea21 setup/cross-system: configure reader properly 2016-01-08 18:29:10 -07:00
Matthew Flatt
8e162082e1 fix foreign library references for cross-build 2016-01-08 16:40:58 -07:00
Matthew Flatt
30005d41ac repair for cross-build of OS X executables 2016-01-08 16:22:44 -07:00
Matthew Flatt
7bae604711 fix default source catalog for make 2016-01-08 09:53:44 -07:00
Jay McCarthy
b078cbc0ef Add define-rename-transformer-parameter and friends 2016-01-08 11:03:33 -05:00
Ben Greenman
3c496777ef add 'combinations' and 'in-combinations' 2016-01-07 23:44:53 -05:00
Robby Findler
32a79a22ec Revert "improve the way plus-one arity functions fall back when they can't see the application site"
This reverts commit c24ddb4a7c.

This optimization was bogus, as shown by the test case in 393d72f153

(Thanks to Sam again for the test case.)
2016-01-07 22:14:15 -06:00
Robby Findler
3e53a3ea42 make impersonator vector contracts use impersonate-vector, not chaperone-vector
closes #1198
2016-01-07 12:59:21 -06:00
Robby Findler
c24ddb4a7c improve the way plus-one arity functions fall back when they can't see the application site
In particular, instead of going directly back to the chaperone, handle
the case where the function doesn't accept keyword arguments with a
less expensive fallback.

The less expensive fallback uses a case-lambda wrapper (wrapped inside
a make-keyword-procedure) to close over the neg-party and avoid the
chaperone creation. With this commit, the program below gets about 3x
faster, and is only about 20% slower than the version that replaces
the "(let ([f f]) ...)" with its body

  #lang racket/base
  (module m racket/base
    (require racket/contract/base)
    (provide (contract-out [f (-> integer? integer?)]))
    (define (f x) x))
  (require 'm)
  (collect-garbage)
  (time (for ([x (in-range 5000000)]) (let ([f f]) (f 1))))

  Thanks, @samth!
2016-01-07 12:59:21 -06:00
Matthew Flatt
7db904e984 net/osx-ssl: fix error handling 2016-01-07 10:49:53 -07:00
Gustavo Massaccesi
9a6726b10d sequence-length: more O(1) special cases 2016-01-07 13:48:42 -03:00
Matthew Flatt
bfe9b4aefd fix CFNetwork reference for old OS X 2016-01-07 06:11:28 -07:00
Matthew Flatt
c9348f7cd7 fix Mac OS X pre-built libssl install 2016-01-07 06:11:27 -07:00
Juan Francisco Cantero Hurtado
961ab31776 Typo: clonse -> clones. 2016-01-06 19:52:31 -06:00
Jay McCarthy
d3c09ead19 Fix cpointer tags 2016-01-06 19:07:33 -05:00
Jay McCarthy
ccc50ca68f Forgot to update racket, just base 2016-01-06 17:42:56 -05:00
Jay McCarthy
18208f76f5 Improve define-cstruct inline-ability and add #:define-unsafe 2016-01-06 16:53:36 -05:00
Matthew Flatt
711ab4d984 raco pkg: add PLT_PKG_SSL_NO_VERIFY environment variable
Just in case someone needs to work around an HTTPS server
without a valid certifcate.
2016-01-06 11:55:43 -07:00
Matthew Flatt
8dfce37977 net/win32-ssl: enable 'secure mode
Validate server certificate in 'secure mode.
2016-01-06 11:55:43 -07:00
Matthew Flatt
c706ee2c05 switch default catalogs to HTTPS 2016-01-06 11:55:43 -07:00
Matthew Flatt
273bc4ea49 use OS X native SSL when libssl is too old
OS X's libssl is deprecated, and it doesn't work with SSL connections
that need SNI. We'll distribute out own libssl builds for OS X via a
package, but we need a native implementation that works well enough to
get that package.
2016-01-06 11:55:43 -07:00
Matthew Flatt
d160cb81a8 raco pkg: use 'secure for an HTTPS catalog 2016-01-06 11:55:43 -07:00
Matthew Flatt
92f1bfa4d2 openssl: add 'secure protocol shortcut
The 'secure protocol symbol is just a shorthand for
`(ssl-secure-client-context)`, but it helps highlight
that the default 'auto isn't secure, and having a plain
symbol smooths the connection to native Win32 and OS X
implementations of SSL.
2016-01-06 11:55:43 -07:00
Matthew Flatt
1e5da68b88 OS X: avoid getdtablesize() by switching frmo select() to poll()
The getdtablesize() result appears not to be constant on OS X.
Creating some combination of CFStream objects, threads, and CFRunLoop
objects can cause the value to be increased by a factor of 10. Avoid
the need for getdtablesize() by switching from select() to poll().
2016-01-06 07:34:18 -07:00
Matthew Flatt
8068c1e2a5 Revert "add source for "racket-playsound.exe""
This reverts commit e08188aeda.

New implementation of `play-sound` doesn't need it.
2016-01-05 20:36:33 -07:00
Matthew Flatt
25f8a5d0d9 Revert "adjust "racket-playsound.exe" return code"
This reverts commit 26560240f1.

New implementation of `play-sound` doesn't need it.
2016-01-05 20:36:33 -07:00
Vincent St-Amour
4b266f1ff2 sequence-sample: various comments from Eli. 2016-01-05 20:33:57 -06:00
Vincent St-Amour
1ce6a49f94 random-sample: actually use the passed-in prng.
Found by Eli.
2016-01-05 20:33:56 -06:00
Vincent St-Amour
656044b8fc random-sample: use reservoir sampling to do a single pass over sequences.
Suggested by Eli.
2016-01-05 14:42:43 -06:00
Robby Findler
c7726e23ec fix random-generation for and/c 2016-01-05 09:14:15 -06:00
Robby Findler
3f4dcb8e87 more accurate error message when content-length is missing 2016-01-05 09:09:52 -06:00
Robby Findler
3df12dca58 specialize sequence/c for one-element sequences
this yields only a modest speed up and only when iterating
over long sequences, e.g. like in this program:

  #lang racket/base
  (require racket/sequence racket/contract/base)
  (define s (make-string 10000 #\a))
  (define str (contract (any/c . -> .  (sequence/c char?))
                        (λ (x) (in-string s))
                        'pos 'neg))
  (time
   (for ([x (in-range 100)])
     (for ([x (str 0)])
       (void))))
2016-01-04 19:56:46 -06:00
Robby Findler
94ac77d30e port sequence/c to late-neg projections 2016-01-04 19:56:45 -06:00
Robby Findler
3ed7dfd62b add the contract printer to set contracts 2016-01-04 19:56:45 -06:00
Robby Findler
14b951cf44 improve the performance of the way contract-stronger? recurs
and fix evt/c's contract-stronger
2016-01-04 19:56:45 -06:00
Matthew Flatt
d37ee8c5b1 fix place and raco exe
The repair involves making `raco exe` detect a sub-submodule
whose name is `declare-preserve-for-embedding` as an indication
that a submodule should be carried along with its enclosing module.

Normally, `define-runtime-module-path-index` would do that, but
the submodule for `place` is created with `syntax-local-lift-module`,
and the point of `syntax-local-lift-module` is to work in a
nested experssion context where definitions cannot be lifted
to the enclosing module.
2016-01-04 11:01:48 -07:00
Robby Findler
1c431e6f4d Clean up chaperone-hash-set and impersonate-hash-set and adjust set/c to match
Made the hash-set chaperones essentially forward the hash chaperone
operations, but now explain them all in terms of set-based operations
in the docs.

Also adjusted value-blame and has-blame? to support late-neg projections
2016-01-03 20:43:24 -06:00
Robby Findler
77a76a7953 fix opt/c for the new way (-> any/c ... any) works
should have been a part of 36b3493e
2016-01-03 20:43:24 -06:00
Sam Tobin-Hochstadt
5ae4e45340 Merge pull request #1184 from andmkent/patch-3
more *syntax/loc for match forms
2016-01-03 17:02:03 -05:00
Vincent St-Amour
cc79e2241c random: Get the right name without run-time overhead. 2016-01-03 13:53:31 -06:00
Vincent St-Amour
4509430063 Fix object name for new random function. 2016-01-03 13:05:35 -06:00
Vincent St-Amour
1e18a7e2b4 sequence-length: special-case lists too. 2016-01-03 13:05:35 -06:00
Vincent St-Amour
c47c0ebfca sequence-length: special case O(1) cases. 2016-01-02 20:05:04 -06:00
Vincent St-Amour
47f06f11e1 random: encourage inlining.
Reduces overhead to 6% over #%kernel's  for the integer case.
2016-01-02 20:02:30 -06:00
Vincent St-Amour
740b6dc198 random: Remove redundant checking. 2016-01-02 20:02:30 -06:00
Vincent St-Amour
acb7d999ba Comment typo.
Pointed out by Gustavo.
2016-01-02 20:02:30 -06:00
Vincent St-Amour
707f9bffa6 random: move sequence support to random-ref, in racket/random.
And add `random-sample`.
2016-01-02 20:02:30 -06:00
Vincent St-Amour
0796350a88 Extend random to work with ranges and sequences.
Requested by Matthias.
2016-01-02 20:02:30 -06:00
Robby Findler
36b3493e45 Change contracts of the form (-> any/c ... any) to not be flat contracts
The issue is what happens when the actual function has other arities.
For example, if the function were (λ (x [y 1]) y) then it is not okay
to simply check if procedure-arity-includes? of 1 is true (what the
code used to do) because then when the function is applied to 2
arguments, the call won't fail like it should. It is possible to check
and reject functions that don't have exactly the right arity, but if
the contract were (-> string? any), then the function would have been
allowed and only when the extra argument is supplied would the error
occur. So, this commit makes it so that (-> any/c any) is like
(-> string? any), but with the optimization that if the procedure
accepts only one argument, then no wrapper is created.

This is a backwards incompatible change because it used to be the
case that (flat-contract? (-> any)) returned #t and it now returns #f.
2016-01-02 17:29:58 -06:00
Matthew Flatt
fdf56dfebf fix calculation of unexported bindings
When a module defines <name-1> and doesn't export it, but when
the module imports <name-2> and re-exports that refers to another
module's definition of <name-1>, then <name-1> wasn't properly
registered as an unexported binding.

Most of the implementation change is just a clean-up of an
unnecessary traversal from before the addition of a `count`
field in each hash table.
2016-01-02 15:10:23 -07:00
Matthew Flatt
190925ee32 avoid a compiler warning 2016-01-02 07:46:42 -07:00
Robby Findler
2529e63b74 make stronger recognize any/c on the right as stronger than any flat contracts 2016-01-01 19:49:38 -06:00
Robby Findler
b24882fd18 implement the (-> any/c ... any) special case for the new -> contract combinator
(new is being used in a relative sense here; it is the newer of the
two -> combinators; the old one is used currently only for ->m)
2016-01-01 19:49:38 -06:00
Matthew Flatt
fd7b8b29ea avoid compiler warning 2016-01-01 14:33:16 -07:00
Matthew Flatt
c0915b02b0 pathlist-closure, tar, and tar-gzip: add #:path-filter
Also, add `#:skip-filtered-directory?` to `find-files`.

Less significantly, adjust `pathlist-closure` to be consistent in the
way that it includes a separator at the end of a directory path.
2016-01-01 13:52:37 -07:00
Matthew Flatt
c9a1dc781e raco setup: use lazy ".zo" parsing for dpeendency checking
Lazy ".zo" parsing make the dependency check take about half as
long.
2016-01-01 13:52:37 -07:00
Matthew Flatt
d3bb9d0412 fix bytecode-reading time-complexity bug
When a tree marshaled to bytecode form has many shared pieces,
the unmarshaling process can lose track of the sharing in one
place and traverse too much of the structure as pieces are
loaded.
2016-01-01 13:52:37 -07:00
Matthew Flatt
8b7f5bc046 faster xexpr->string 2016-01-01 13:52:37 -07:00
Matthew Flatt
567679bf0a {impersonate,chaperone}-hash: add equal-key-proc wrapper
The optional `equal-key-proc` wrapper effectively interposes on calls
to `equal?` and `equal-hash-code` for hash-table keys.
2015-12-31 09:22:57 -07:00
Andrew Kent
d5f61238c2 more *syntax/loc
I was using match-let and got a syntax error that pointed to this file. After changing the match-let definition to use syntax/loc the error pointed to the exact spot causing the problem. Yay!

I changed quite a few vanilla syntax-quotes to the *syntax/loc form... perhaps some do not need to? I'm not sure.

added back nested syntax/loc
2015-12-31 10:36:30 -05:00
Robby Findler
e92b8610f2 port id-set/c to late-neg 2015-12-30 19:16:36 -06:00
Robby Findler
df382ca939 improve warnings and fix small problems with contract combinator constructors 2015-12-30 17:13:23 -06:00
Robby Findler
cb2af327e6 port async-channel/c to late-neg proj
and drop other projection implementations
(mostly to reduce the testing burden)
2015-12-30 17:13:22 -06:00
Robby Findler
9ee264a0ea improve performance of define-generic-created contracts and port to late-neg
This program runs about 10x faster than it did before this commit, but
seems to still be about 100x slower than the version where you change
an-s to just be (s).

  #lang racket/base
  (require racket/contract/base racket/generic)
  (define-generics id [m id x])
  (struct s () #:methods gen:id [(define (m g x) x)])
  (define an-s
    (contract (id/c [m (-> any/c integer? integer?)])
              (s)
              'pos 'neg))
  (time
   (for ([x (in-range 100000)])
     (m an-s 2)))
2015-12-30 17:13:22 -06:00
Robby Findler
a97aa8389b port id-table/c to flat-neg projection 2015-12-30 17:13:22 -06:00
Robby Findler
f2f38cdf4a remove overly aggressive use of procedure-specialize 2015-12-30 09:28:58 -06:00
Robby Findler
a5b3d6b3d0 uncopy some code 2015-12-29 21:46:06 -06:00
Robby Findler
46ace3172f clean up interaction between strict set/c contracts and mutable sets 2015-12-29 20:28:22 -06:00
Robby Findler
757adac568 make #f always convert into the same (eq?) contract 2015-12-29 16:13:01 -06:00
Robby Findler
4bdde405f6 improve the way that 'struct-out' cooperates with the
rest of the contract system, creating and using a slightly
more legitmate blame record and calling into the late-neg
projections instead of using `contract`
2015-12-29 15:48:17 -06:00
Mira Leung
e2bd1b51bc Using in-list in for/list 2015-12-29 15:59:40 -05:00
Mira Leung
404c5b2699 Better code style for f3d888 2015-12-29 15:59:40 -05:00
Mira Leung
56ea9f8b9a Specify names of missing fields for match on structs 2015-12-29 15:59:40 -05:00
Robby Findler
22adc0253b change sets generics so they default to supplying the optional argument
if the given procedure accepts it
2015-12-29 11:26:17 -06:00
Robby Findler
2c5aa96031 change some potentially error-prone provide all-from-outs to explicit provides
and make set load its implementation via relative requires
2015-12-29 11:25:45 -06:00
Robby Findler
7056cd5f2a improve ->i in the case that the dependent contract
turns out to be a predicate.

In that case, just call it instead of creating all of the extra junk
that would normally be created by coercing the predicate to a contract
and invoking it
2015-12-29 11:20:59 -06:00
Matthew Flatt
a516304f6b fix specialization over a nested lambda 2015-12-29 07:04:17 -06:00
Matthew Flatt
26560240f1 adjust "racket-playsound.exe" return code 2015-12-29 07:04:17 -06:00
Robby Findler
d4ca825640 fix set/c name method 2015-12-29 06:56:20 -06:00
Robby Findler
a44ce40b56 fix a bug in 50405a2ca 2015-12-28 22:17:39 -06:00
Robby Findler
f7465f81f1 convert stream/c to late-neg-projection
Also, tune the projection to get a few modest performance gains.

This program gets about 20% faster:

  #lang racket
  (define s (contract (stream/c exact-nonnegative-integer?)
                      (in-naturals) 'pos 'neg))
  (time
   (for ([x (in-range 1000)])
     (for/fold ([s s])
               ([x (in-range 100)])
       (stream-rest s))))

and this program gets about 15% faster:

  #lang racket
  (define f (contract (-> (stream/c exact-nonnegative-integer?)
                          any)
                      (λ (x) 1)
                      'pos 'neg))
  (define l (make-list 10000 0))
  (time (for ([x (in-range 1000)])
          (f l) (f l) (f l) (f l) (f l)))
2015-12-28 21:57:03 -06:00
Robby Findler
ff31b01505 add some error checking for custom set type constructors 2015-12-28 16:59:43 -06:00
Robby Findler
50405a2ca9 fix chaperone-hash-set and impersonate-hash-set for custom-set-types 2015-12-28 16:59:42 -06:00
Matthew Flatt
e08188aeda add source for "racket-playsound.exe" 2015-12-28 07:37:29 -06:00
Matthew Flatt
cefcbdf802 Windows: ensure 'kill subprocesses end with Racket
Use a job object to ensure that subprocesses that are meant
to be killed by the current custodian are reliably terminated
if Racket exits for any reason.
2015-12-28 07:37:29 -06:00
Matthew Flatt
afa01fa763 allow optimizations around procedure-specialize
Although `procedure-specialize` should be useful in places where
inlining does not apply, allowing inlining and related optimizations
through it, anyway.
2015-12-28 07:37:29 -06:00
Robby Findler
b3d05de304 improvements to set/c
- use chaperone-hash-set for set/c when the contract allows only hash-sets

- add a #:lazy flag to allow explicit choice of when to use laziness
  (but have a backwards-compatible default that, roughly, eschews laziness
   only when the resulting contract would be flat)
2015-12-27 22:56:04 -06:00
Robby Findler
bc12019af4 allow the interposition procedures to all be #f in chaperone-hash-set and impersonate-hash-set 2015-12-27 21:02:20 -06:00
Robby Findler
8f2874e4b5 fix impersonator properties for chaperone-hash-set and impersonate-hash-set 2015-12-26 22:37:00 -06:00
Robby Findler
daf19869de chaperone-hash-set fixes 2015-12-26 22:09:14 -06:00
Robby Findler
d927d04efd generalize tail contract checking for function contracts
Specifically, remove reliance on procedure-closure-contents-eq? to
tell when a pending check is stronger in favor of usint
contract-stronger?

Also, tighten up the specification of contract-stronger? to require
that any contract is stronger than itself

With this commit, this program gets about 10% slower:

  #lang racket/base
  (require racket/contract/base)
  (define f
    (contract
     (-> any/c integer?)
     (λ (x) (if (zero? x)
                0
                (f (- x 1))))
     'pos 'neg))
  (time (f 2000000))

becuase the checking is doing work more explicitly now but because the
checking in more general, it identifies the redundant checking in this
program

  #lang racket/base
  (require racket/contract/base)
  (define f
    (contract
     (-> any/c integer?)
     (contract
      (-> any/c integer?)
      (λ (x) (if (zero? x)
                 0
                 (f (- x 1))))
      'pos 'neg)
     'pos 'neg))
  (time (f 200000))

which makes it run about 13x faster than it did before

I'm not sure if this is a win overall, since the checking can be more
significant in the case of "near misses". For example, with this
program, where neither the new nor the old checking detects the
redundancy is about 40% slower after this commit than it was before:

  #lang racket/base
  (require racket/contract/base)
  (define f
    (contract
     (-> any/c (<=/c 0))
     (contract
      (-> any/c (>=/c 0))
      (λ (x) (if (zero? x)
                 0
                 (f (- x 1))))
      'pos 'neg)
     'pos 'neg))

  (time (f 50000))

(The redundancy isn't detected here because the contract system only
looks at the first pending contract check.)

Overall, despite the fact that it slows down some programs and speeds
up others, my main thought is that it is worth doing because it
eliminates a (painful) reliance on procedure-closure-contents-eq? that
inhibits other approaches to optimizing these contracts we might try.
2015-12-25 22:58:56 -06:00
Robby Findler
f0f85549ce add impersonate-hash-set and chaperone-hash-set 2015-12-25 22:58:55 -06:00
Robby Findler
badf2bd19e audit requires of files that require misc.rkt in racket/contract 2015-12-25 22:58:55 -06:00
Robby Findler
7708b2056a use specialize-procedure on predicate portion or or/c
This seems to give about a 10% speedup on this program:

 #lang racket/base
(require racket/contract/base)
(define f (contract
           (-> (or/c number? symbol?) any)
           (λ (x) 0)
           'pos 'neg))

(time
 (for ([_ (in-range 1000000)])
   (f 'x) (f 'x) (f 'x) (f 'x)))
2015-12-25 14:17:03 -06:00
Matthew Flatt
0840fcd6c8 JIT: avoid assertion failures due to a full buffer 2015-12-25 08:04:22 -06:00
Matthew Flatt
f0d09dbef1 make JIT recognize literal struct predicatates, etc.
Mka the closure specializer handle literal struct operations
(as opposed to just references to struct operations).
2015-12-25 07:14:40 -06:00
Matthew Flatt
843992d0c7 use specialization opportunity for #%apply-values 2015-12-24 12:17:31 -06:00
ven
c1950f1ae3 Fix small typo in jit.h
Just noticed it while reading db0a6de1d2
2015-12-24 10:11:56 +01:00
Matthew Flatt
ba2eb6487c restore precision for procedure-closure-contents-eq?
After adding `procedure-specialize`, making
`procedure-closure-contents-eq?` work as before involves
a little extra tracking. I'd prefer to weaken or
even get rid of `procedure-closure-contents-eq?`, but
this adjustment keeps some contract tests passing.
2015-12-23 22:06:18 -07:00
Matthew Flatt
44e1262648 unbreak no-JIT build 2015-12-23 21:51:14 -07:00
Matthew Flatt
db0a6de1d2 add procedure-specialize
The `procedure-specialize` function is the identity function, but it
provides a hint to the JIT to compile the body of a closure
specifically for the values in the closure (as opposed to compiling
the body generically for all closure instances).

This hint is useful to the contract system, where a predicate
is coerced to a projection with

 (lambda (p?)
   (procedure-specialize
    (lambda (v)
      (if (p? v)
          v
          ....))))

Specializing the projection to a given `p?` allows primitive
predicates to be JIT-inlined in the projection's body.
2015-12-23 17:46:56 -07:00
Matthew Flatt
592ae853e3 JIT: fast path for procedure impersonator w/o wrapper proc
Make the JIT-generated function-call dispatch recognize a call to
an impersonator that wraps a procedure only to hold properties.

This change also repairs handling for a arity-reducing wrapper
on a primitive, where the fast path incorrecty treated the
primitive as a JIT-generated function.
2015-12-22 15:05:14 -07:00
Matthew Flatt
b794404333 faster path for a procedure impersonator w/o wrapper proc
Make the call path faster when an impersontor is present
on a procedure only to add impersonator properties.
2015-12-22 15:04:53 -07:00
Matthew Flatt
e8073e699e restore a fast path for a procedure chaperone
When the representation of a redirect changed, the fast
path wasn't updated.
2015-12-22 15:04:53 -07:00
Matthew Flatt
c73bcceafe avoid a string pointer needed only for error reporting 2015-12-22 15:04:53 -07:00
Robby Findler
d2233f95e2 make vectorof also try less hard during or/c checking 2015-12-22 16:02:48 -06:00
Robby Findler
8a9408306b have a better strategy for or/c to determine which clause to commit to
in particular, when there is a recursive contract, then we check only
some part of the first-order checks and see if that was enough to
distinguish the branches. if it was, we don't continue and otherwise we do
2015-12-22 16:02:44 -06:00
Robby Findler
31cf0bdbc3 remove the error-prone except-out's from racket/contract
and take the opportunity to move some things around
internally to more reasonable places
2015-12-22 15:51:40 -06:00
Robby Findler
d2bf335212 use the correct accessor for subcontracts 2015-12-22 15:51:39 -06:00
Matthew Flatt
2b10262258 get-module-suffixes: put "rkt" first
Putting "rkt" first in the list makes it likely to act as
a default, such as for a `put-file` dialog.
2015-12-22 11:03:09 -07:00
Matthew Flatt
c01ced6e1d add syntax-transforming-with-lifts? 2015-12-22 08:02:44 -07:00
Robby Findler
b221e00937 Revert " clean up exports of racket/contract/combinator"
I didn't intend to push that commit
2015-12-21 22:56:34 -06:00
Robby Findler
aeb0509f3a fix performance bug in late-neg projection for cons/c
the first-order check and the projection itself
can duplicate work (potentailly lots of work
in a non-constant factor sort of a way when
recursive-contract is involved)

this seems also to be a potential problem for other
uses of or/c too
2015-12-21 22:53:02 -06:00
Robby Findler
99d7ad56d9 clean up exports of racket/contract/combinator
It used to have a (provide (except-out (all-from-out <private-file>) ...))
    and various private functions leaked to the outside over the years.

    None of the ones removed in this commit were documented, so hopefully
    they weren't being used. But this is definitely not backwards compatible,
    so this commit is mostly about testing the waters
2015-12-21 10:32:41 -06:00
Robby Findler
3a4ba9a1ca fix parametric->/c for the keyword case 2015-12-21 10:32:08 -06:00
Robby Findler
261a5cb1f4 port rename-contract to late-neg projection and add some tests 2015-12-21 09:32:14 -06:00
Robby Findler
e4ffa6c97c port if/c to late-neg, add tests, and fix some (minor) bugs 2015-12-21 09:20:45 -06:00
Robby Findler
8776ab7686 remove implementations of non-late-neg projections from bunch of combinators 2015-12-21 09:20:45 -06:00
Robby Findler
7d02f4c7b1 port parametric->/c to late-neg 2015-12-21 08:06:14 -06:00
Robby Findler
35b2320730 add more warning logging for contracts that don't have late-neg projections 2015-12-21 07:27:38 -06:00
Robby Findler
efc8bcc2fd update contract in comment 2015-12-20 21:17:53 -06:00
Matthew Flatt
0553f191d7 adjust PLT_INCREMENTAL_GC so it can disable generational GC
A value that starts "1", "y", or "Y" enabled incremental mode
permanently (any value was allowed formerly), while a value that
starts "0", "n", or "N" causes incremental-mode requests to be
ignored.
2015-12-20 08:58:21 -07:00
Matthew Flatt
3a99a19c56 reduce double major GCs
When a major GC triggers finalization, another major
GC is scheduled immediately on the grounds that the
finalizer may release other values. That was important
at once time, but the finalization and weak-reference
implementation has improved to the point where the
extra ful GC no longer seems necessary or useful.
2015-12-20 08:58:21 -07:00
Matthew Flatt
513849c1e3 incremental GC: make accounting incremental for the root custodian 2015-12-20 08:58:21 -07:00
Matthew Flatt
9711000b70 drop generation 1/2 except in incremental mode
Originally, generation 1/2 was intended to delay major
collections when the heap is especially large. It doesn't
seem to be effective in that case, and it can slow down
minor GCs, so continue to use it only in incremental
mode (where it helps significantly with fragmentation).
2015-12-20 08:58:21 -07:00
Matthew Flatt
6957780cd5 incremental GC: tune departure from incremental mode
At the completion of an incremental major GC, if incremental
mode wasn't requested recently, schedule an immediate major
GC to reduce the heap back to its normal footprint.
2015-12-20 08:58:21 -07:00
Robby Findler
15e24fce78 adjust set/c to follow the late-neg protocol
and make it do some work earlier
2015-12-19 22:17:59 -06:00
Robby Findler
53fa16fc9c adjust hash/c to more completely follow the late-neg protocol 2015-12-19 22:17:59 -06:00
Robby Findler
bd4b243963 port xml contracts to late-neg 2015-12-19 22:17:58 -06:00
Robby Findler
3b1e535049 port recursive-contract to late-neg 2015-12-19 22:17:58 -06:00
Robby Findler
a712117030 adjust syntax-parse's contract support to use the late-neg projections 2015-12-19 22:17:58 -06:00
Robby Findler
00c0ddb7f6 port vector/c to late-neg projection (and throw away some redundant code) 2015-12-19 22:17:58 -06:00
Robby Findler
efcbd12116 port class/c and friends to late-neg projections 2015-12-19 22:17:58 -06:00
Robby Findler
93d286914e port new-∀/c and new-∃/c to late-neg 2015-12-19 11:41:38 -06:00
Robby Findler
8e2179a6eb port struct-type-property/c to late-neg and add some tests for it 2015-12-19 11:41:37 -06:00
Robby Findler
557b039f3c add more racket/contract non late-neg projection warnings 2015-12-19 11:41:37 -06:00
Robby Findler
4a29792934 port ->i to late-neg 2015-12-19 11:41:37 -06:00
Matthew Flatt
7d2b538293 fix marshaling of a compiled top-level begin-for-syntax
Closes #1174
2015-12-19 09:37:32 -07:00
Matthew Flatt
2fad028fd5 fix incremental GC bug
Also, fix reporting of whether a minor GC was in incremental mode.
2015-12-19 09:37:32 -07:00
Robby Findler
506c9be0cd add the ability to make chaperone contracts to ->i 2015-12-18 20:41:51 -06:00
Sam Tobin-Hochstadt
962a72dfda Properly handle (place ...) in submodules.
Closes #1173 and PR 12934.
2015-12-17 19:35:08 -05:00
Sam Tobin-Hochstadt
e5c5feca6d Bind channel properly in place/context.
Closes #1169.
2015-12-17 19:17:28 -05:00
Matthew Flatt
074202bdd2 raco setup: don't completely ignore a collection without compilation
A collection's "info.rkt" might have `(define compile-omit-paths
'all)` but also other setup actions, so don't completely ignore
a collection directory just because there's nothing to compile.
2015-12-17 07:55:39 -07:00
Matthew Flatt
ad1fe0c529 raco setup: make "nothing to do" count as success 2015-12-17 07:50:20 -07:00
Matthew Flatt
d7184227e1 fix mutation of shared "self" module path index for submodules 2015-12-17 06:21:05 -07:00
ben
0d633fefd3 typo: string-contains precondition 2015-12-16 14:07:16 -05:00
Matthew Flatt
ca237910b3 fix make-syntax-delta-introducer with a #f argument
Closes PR 15202
2015-12-15 17:11:45 -07:00
Vincent St-Amour
3dc49139cf Fix more missing parties in contract instrumentation. 2015-12-15 14:31:38 -06:00
Vincent St-Amour
d0d6d719af Abstract contract instrumentation. 2015-12-15 13:37:47 -06:00
Andrew Kent
b4afecab97 slightly more explicit error msg 2015-12-15 11:33:16 -06:00
Gustavo Massaccesi
6985150e0b Don't drop expressions with side effects in eq? reduction
The expression (eq? x y) is reduced to #f when the types of
x and y are known. Reduce this to (begin x y #f) when they
have side effects.
2015-12-15 00:25:00 -03:00
Vincent St-Amour
b8df0a38a2 Add instrumentation for optimized struct/dc. 2015-12-14 13:57:07 -06:00
Robby Findler
bd77a0102c add blame-missing-party? and document it and blame-add-missing-party 2015-12-14 12:53:35 -06:00
Vincent St-Amour
8bd47f3f8a Fix instrumentation of struct/dc.
Unbreaks the contract profiler.
2015-12-14 10:52:23 -06:00
Matthew Flatt
f7c67f5c45 incremental GC: always use generation 1/2 in incremental mode
Also, make nursery 1/4 as big in incremental mode, and
correspondingly tune the amount of work to perform per
collection by 1/4 its old value. Using generation 1/2
reduces fragmentation that would otherwise be increase
by a smaller nursery.
2015-12-13 17:16:05 -07:00
Matthew Flatt
d01aec1b32 JIT: always use buffer padding of 200
The main intent of this change is to raise the buffer size
for ARM, but that would leave only 32-bit x86 at size 100, so
just make it size large for all machines.
2015-12-12 14:11:17 -07:00
Matthew Flatt
c6b8ba7c4a JIT: add missing checks for buffer space 2015-12-12 08:13:34 -07:00
Matthew Flatt
d66af86a58 JIT on ARM: add assertion to check long-jump mode
The same assertion is present already in Thumb mode, but
add it to non-Thumb mode.
2015-12-12 07:48:14 -07:00
Sam Tobin-Hochstadt
e45e5712de Use quote-srcloc to avoid paths in the compiled code.
Closes #1165.
2015-12-11 13:12:11 -05:00
Robby Findler
6593594ebf port struct/dc to late-neg style projections 2015-12-10 18:41:37 -06:00
Robby Findler
4aabe505be fix missing party and indy blame interaction
(also add all of the fields to the equal and hashing
functions)
2015-12-10 18:37:50 -06:00
Robby Findler
a952f11bc5 unbreak the creation of first-order contracts that
don't supply a val-first projection
2015-12-10 09:21:41 -06:00
Matthew Flatt
f5d5277ae7 fix binding table when shadowing imports 2015-12-10 04:56:14 -07:00
Matthew Flatt
b7dd829a6f bump version number 2015-12-09 21:06:55 -07:00
Matthew Flatt
835d098eb2 racket/contract: fix blame in arre case
Remove an incorrect syntax quote that could cause the contract
system to be blamed (and also lead to an absolute path in
bytecode).
2015-12-09 21:06:55 -07:00
Matthew Flatt
1d7429f1d7 match: avoid recording full paths
Use a syntax object to store a source location, letting the
marshal process for syntax objects deal with non-relative
paths.
2015-12-09 21:06:55 -07:00
Matthew Flatt
2743ea06bb avoid paths in case-lambda names
Filter absolute path names for `case-lambda` in the same way as for
`lambda`.
2015-12-09 21:06:55 -07:00
Robby Findler
3d7d906cc1 tweak and clean up the contract combinators api
- uniformly remove the extra layers of calls to unknown functions for
  chapereone-of?  checks that make sure that chaperone contracts are
  well-behaved (put those checks only in contracts that are created
  outside racket/contract)

- clean up and simplify how missing projection functions are created
  (val-first vs late-neg vs the regular ones)

- add some logging to more accurately tell when late-neg projections
  aren't being used

- port the contract combinator that ->m uses to use late-neg

- port the </c combinator to use late-neg
2015-12-09 21:55:58 -06:00
Matthew Flatt
c0f4eb8287 inctemental GC: make finalization more incremental
Allow the process of discovering finalizers to be incremental,
including allow interruptions in later levels of ordered
finalization.
2015-12-08 07:53:03 -07:00
Matthew Flatt
6f106d9adc incremental GC: more precising counting of work done 2015-12-08 05:17:44 -07:00
Leif Andersen
5cd2220366 Add coverall support and use new TravisCI Infrastructure 2015-12-07 17:54:28 -05:00
Vincent St-Amour
5353dd1076 free-vars: add mode that also reports module-bound variables
As a separate mode, for backwards compatibility.
2015-12-07 10:42:12 -06:00
Vincent St-Amour
22caaad944 free-vars: nicer error on submodules 2015-12-07 10:31:12 -06:00
Matthew Flatt
715bdbb49e incremental GC: avoid already-finished finalizaton work
Avoid extra work svaing finalization information and
re-chaining old-generation records for a major GC.
2015-12-06 12:36:52 -05:00
Matthew Flatt
e44926fcee increemntal GC: compact when a major GC is forced early
This change further defends against fragmentation when
incremental mode isn't working well.
2015-12-06 12:36:52 -05:00
Matthew Flatt
b5131321d7 force non-inremental GC if excessive fragmentation
Increemntal GC skips the old-generation compaction phase.
For most applications, that's ok, but it's possible for
fragmentation to get out of hand. Detect that situation
and fall back to non-incremental mode for one major GC.
2015-12-06 12:36:52 -05:00
Sam Tobin-Hochstadt
21316e3ebf Don't copy immutable vectors in vectorof if not needed.
This happens only if the element contract is a flat contract.
2015-12-06 10:45:13 -05:00
Sam Tobin-Hochstadt
b8d4248053 Copy immutable vector more efficiently.
Thanks to @mflatt for the suggestion.
2015-12-06 10:31:01 -05:00
Robby Findler
e814d742a7 fix the late-neg construction for flat contracts
Thanks to Sam for finding this problem!
2015-12-05 23:03:06 -06:00
Robby Findler
8b3369f81c set up some information for TR 2015-12-05 15:35:46 -06:00
Leif Andersen
f88ba77a5c Fix travis to build against latest Racket build. 2015-12-04 18:01:57 -05:00
Matthew Flatt
fef695f066 fix call-with-atomic-output-file for pathless filename
Closes #1156
2015-12-03 08:05:17 -07:00
Matthew Flatt
724dc2fdbf fix namespace-mapped-symbols forcing of lazy binding info 2015-12-02 13:14:28 -07:00
Sam Tobin-Hochstadt
a6eb00a41c Avoid warning for unused variable. 2015-12-02 10:01:01 -05:00
Matthew Flatt
d56e7309ad GC: fix yet another problem counting allocated bytes 2015-12-01 16:21:32 -07:00
Jay McCarthy
67bf4349ca Revert "Assume that files that start with . are not modules"
This reverts commit fc34292486.
2015-12-01 14:21:09 -05:00
Gustavo Massaccesi
b175241961 Flatten nested begin and begin0 forms
The nested begin/begin0 are flattened at read time, but some
optimizations may create new instances.
2015-12-01 13:50:16 -03:00
Matthew Flatt
7e949d5513 GC: skip memory accounting if demand goes away
Memory accounting is enabled on demand; if demand goes
away --- as approximated by no live custodians having
a limit or previously been queried for memory use ---
then stop accounting until demand resumes.
2015-12-01 08:14:38 -07:00
Matthew Flatt
bef34606cb incremental GC: fix handling of ephemerons
Fix the case that an old-generation finalizer ends up
on a modified page after all old-generation marking
is complete.

Also, make sure epehemerons are checked after previous
marking that may have left the stack empty.
2015-12-01 05:50:06 -07:00
Matthew Flatt
03302c3f30 repair an assertion in the GC 2015-12-01 05:50:06 -07:00
Matthew Flatt
8363144818 incremental GC: make finalization more incremental 2015-12-01 05:50:06 -07:00
Matthew Flatt
f30d8bd562 incremental GC: fix overcount of immobile objects 2015-12-01 05:50:06 -07:00
Matthew Flatt
d306ecdf3a incremental GC: fix accumulation of page-repair work
Too much work was being saved for the final step of a
major GC.
2015-12-01 05:50:06 -07:00
Matthew Flatt
e9c722cf22 re-tune incremental GC parameters
With immobile-object allocation repaired, smaller increments
work.
2015-12-01 05:50:06 -07:00
Matthew Flatt
7901962647 incremental GC: fix phantom-byte counting 2015-12-01 05:50:06 -07:00
Matthew Flatt
fa3cabd681 incremental GC: avoid allocating immobile on old-generation page
The allocation strategy for immobile objects avoids some fragmentation
in non-incremental mode, but it interferes with finishing up an
incremental major collection, so trade some fragmentation for
an earlier finish (which is far more likely to use less memory
instead of more, despite extra fragmentation).
2015-12-01 05:50:06 -07:00
Jay McCarthy
fc34292486 Assume that files that start with . are not modules 2015-11-30 08:30:25 -05:00
Matthew Flatt
817fdad2d5 Windows with MinGW: Fix network address resolution
Use the same code as for MSVC compilation, which is as simple
as defining `HAVE_GETADDRINFO`.

Closes PR 15192
2015-11-29 17:31:47 -07:00
Vincent St-Amour
e7e75c2292 Fix exponentiation of negative single-floats and moderately large bignums. 2015-11-29 15:46:56 -06:00
Matthew Flatt
a389678556 improve interaction of incremental mode and finalization
Really, just improve when majors GCs are forced to trigger
further finalizations. This improvement makes `(collect-garbage)`
followed by `(collect-garbage 'incremental)` move more
reliably into incremental mode.
2015-11-28 15:54:45 -07:00
Robby Findler
71d80bace5 whoops: don't want to do the precondition check twice 2015-11-28 16:27:21 -06:00
Robby Findler
8cc2e27ca7 improve error checking in version/utils
closes #1152
2015-11-28 16:26:09 -06:00
Robby Findler
86934d4a4f adjust contract printing so that it looks like
the constructors in print mode and so that it
cooperates with pretty printing to get some
newlines in there
2015-11-28 13:47:27 -06:00
Matthew Flatt
9407afa0a2 faster GC traversal of shared closure prefixes 2015-11-28 11:21:19 -07:00
Matthew Flatt
89807d178e fix accounting of nursery for logging
The pre-GC count didn't include the obejcts allocated on
the most recent nursery page.
2015-11-28 10:36:12 -07:00
Matthew Flatt
c3ac1c6bf4 reduce incremental work on (collect-garbage 'minor)
When `(collect-garbage 'minor)` is combined with incremental
mode, do less incremental work. At the same time, don't
skip an incremental GC just because a major GC is ready.
2015-11-28 10:36:12 -07:00
Matthew Flatt
e968cfbde4 fix accounting of phantom bytes for incremental GC
Also fixes accounting when a phantom-bytes value is
treated as potentially having a backpointer.
2015-11-28 10:35:24 -07:00
Matthew Flatt
81e0636843 fix counting of interior-pointer-allowed objects
Words versus bytes.
2015-11-28 09:22:11 -07:00
Matthew Flatt
ca0e9b8b2f report timing of incremental step 2015-11-28 09:22:11 -07:00
Matthew Flatt
d37bfd45ae avoid unnecessary closure-fixup work in incremental mode 2015-11-28 09:22:11 -07:00
Matthew Flatt
46fe53fadb incremental GC: avoid extra traverals of weak-link lists
When incremental mode has already gone through weak boxes
and arrays, a major GC doesn't need to see them again.
2015-11-28 09:22:11 -07:00
Matthew Flatt
ad2dd24fb8 incremental GC: split "incremental" finalization to single step
Don't finalize after performing some marking work, since
finalization is in one chunk, so it's best to avoid combining
that delay with others.
2015-11-28 06:09:39 -07:00
Matthew Flatt
493eb1de7f tweak incremental-GC parameters
Based on experiments with a few programs.
2015-11-27 15:08:54 -07:00
Matthew Flatt
ba8103bbde add PLT_INCREMENTAL_GC
Although calling `(collect-garbage 'incremental)` in a program with
a periodic task is the best way to request incremental collection, it's
handy for some experiments to have an environment variable that turns
it on permanently.

This change also makes incremental-mode minor collections log as "mIn"
instead of "min", and it changes the first field of the logged
`gc-info` structure to be a mode symbol instead of a boolean.
2015-11-27 08:02:18 -07:00
Matthew Flatt
a0576e0378 make the clean-up phase of a major GC incremental
Incremental GC now works well enough to be useful for some programs
(e.g., games). Memory accounting is still not incremental, so DrRacket
(and running programs in DrRacket) does not really support incremental
collection, although pause times can be much shorter in incremental
mode than by default.
2015-11-27 08:02:17 -07:00
Matthew Flatt
2486c7f4bc incremental GC: add finalization step
This step is semi-incremental, in that it can happen during
incremental collection, but all finalization is performed at once.
This will work well enoguh if the number of finalizers, weak boxes,
etc., will be small enough relative to the heap size.
2015-11-27 08:02:17 -07:00
Matthew Flatt
e24b73fbfd minor GC simplification 2015-11-27 08:02:17 -07:00
Vincent St-Amour
e9282d4f6e Fix expt of floats by large positive bignums.
Brings behavior in line with Gambit.

Closes GH #1148.
2015-11-25 17:46:36 -06:00
Matthew Flatt
8839f7b848 bump version number
Should have incremented it for "xform.rkt" change in f5dbd99e43.
2015-11-25 07:18:12 -07:00
Matthew Flatt
050f708879 setup/unixstyle-install: fix DESTDIR mode for ".desktop" fixup
Closes #1143
2015-11-24 09:49:09 -07:00
Matthew Flatt
b443f3fe68 fix broken resize of place array
Change default array size from 32 to 4, so that the
resize path is used (and tested) on more typical
machines.
2015-11-24 09:20:44 -07:00
Matthew Flatt
5cb02282f5 fix round-to-even for exact->inexact on rationals
Thanks again to Robby
2015-11-22 18:09:11 -07:00
Matthew Flatt
ce7487182a fix too-early exact->inexact conversion in number parsing
Robby found this bug, continuing his streak that included
find the bugs behind commits f5dbd99e43 and 901ffdcbac.
2015-11-22 09:11:23 -07:00
Matthew Flatt
2a88662d01 exact->inexact fixup for MSVC
Casting a `uintptr_t` to `double` seems not to round to
nearest, so keep all bits while moving to `double` and
use arithmetic to combine them (since the rounding mode
is used correctly for arithmetic).
2015-11-22 08:33:44 -07:00
Matthew Flatt
901ffdcbac fix inexact-number parsing problem
Bug introduced in c40229f756.
2015-11-22 06:50:49 -07:00
Matthew Flatt
f5dbd99e43 fix precision in exact->inexact on bignums
The strategy of converting a bignum to a flonum by converting on word
boundaries can lose one bit of precision. (If the use of a word
boundary causes a single bit to get rounded away, but the first bit of
the next word is non-zero, then the rounding might have been down when
it should have been up.)

Avoid the problem by aligning relative to the high bit, instead.
2015-11-22 06:50:49 -07:00
Asumu Takikawa
92fc1f41c8 Add more hash-like operations to id-table
The operations are ref!, set*, set*!, update, and
update!. Also bumps version number.
2015-11-21 15:46:22 -05:00
Matthew Flatt
c40229f756 fix reading of extflonums, including with large exponents
Fix even basic readind when extflonums are not supported, but
also fix reading extflonums with large exponents (related to
the other recent changes to number parsing).
2015-11-21 10:55:14 -07:00
Matthew Flatt
9d2dd01689 more repairs of parsing inexact with large exponents
Fix the slow-path parsing of numbers in essentially the same
way as aff167b13d.

Closes #1140
2015-11-21 09:18:32 -07:00
Chris Jester-Young
aff167b13d Fix parsing of 0e401 on USE_EXPLICT_FP_FORM_CHECK platforms. 2015-11-21 08:27:46 -07:00
Matthew Flatt
8e46e46d40 add more support for continuation marks in procedure impersonators
Allow a more dynamic (than `impersonator-prop:application-mark`)
determination of continuation marks and associated values to wrap the
call of an impersonated procedure.
2015-11-20 10:20:02 -07:00
Jay McCarthy
69b8b2be35 Fix up prim count from merge mistake 2015-11-20 10:34:19 -05:00
Jay McCarthy
8c08d22197 update cstartup 2015-11-20 10:22:36 -05:00
Jay McCarthy
fff7bcfb03 initialize new params in read_escape_from_string 2015-11-20 10:17:59 -05:00
Jay McCarthy
ec713a22c3 Ensurce new parameters have false defaults everywhere 2015-11-20 10:17:59 -05:00
Jay McCarthy
bbf03997bb correct dot cancelling under readtable 2015-11-20 10:17:36 -05:00
Jay McCarthy
ce0aed77ea use readtable for detecting dot 2015-11-20 10:17:36 -05:00
Jay McCarthy
4451f44dda use readtable if available to look up whitespace 2015-11-20 10:17:36 -05:00
Jay McCarthy
35aa2c2398 first version of read_cdot 2015-11-20 10:17:36 -05:00
Jay McCarthy
23beaa4793 comments re mflatt 2015-11-20 10:17:08 -05:00
Jay McCarthy
c257d6dc64 tagged brackets and braces 2015-11-20 10:16:41 -05:00
Matthew Flatt
877264c63b fix net/url delays to be thread-safe 2015-11-20 06:17:52 -07:00
Tim Brown
0b1d0610f2 support [plt_]{http,no}_proxy environment variables
The `current-proxy-servers` and `current-no-proxy-servers` parameters
are initialized on-demand from environment variables.
2015-11-19 15:46:54 -07:00
Asumu Takikawa
76e27da8ba Fix blame error for listof contract 2015-11-17 06:30:35 -06:00
Matthew Flatt
6099a70c52 fix relative-path discovery for case-normalized paths 2015-11-16 12:55:19 -07:00
Ryan Culpepper
912f1fe603 add macro-debugger event on expand opaque expression 2015-11-16 09:09:36 -05:00
Matthew Flatt
d3f2bd6dac fix broken abort handling related to module-registry lock 2015-11-15 16:46:07 -07:00
Matthew Flatt
0e16ce4bea add internal-definition-context-{binding-identifier,track}
When an internal-definition context is used with `local-expand`, the
any binding added to the context affect expansion, but the binding do
not appear in the expansion. As a result, Check Syntax was unable to
draw an arrow from the `s` use to its binding in

 (class object%
   (define-struct s ())
   s)

The general solution is to add the internal-definition context's
bindings to the expansion as a 'disappeared-bindings property. The new
`internal-definitionc-context-track` function does that using a new
`internal-definition-context-binding-identifier` primitive.
2015-11-15 06:17:22 -07:00
Matthew Flatt
e3d78e44cc avoid excessive path retention in raco dist output
This change builds on 5c909cca0d, but it better handles files that
are installed in "lib" or "share" instead of residing in a
package.
2015-11-14 08:31:23 -07:00
Matthew Flatt
8ec17deed1 avoid Linux stack correction on non-main thread 2015-11-13 14:54:05 -07:00
Matthew Flatt
6343ca0826 raco {dist,c-tool}: normalize case of paths before finding prefix 2015-11-13 07:42:34 -07:00
Matthew Flatt
fb1432e70e declare and document scheme_set_dll_path() for Windows embedding 2015-11-13 06:49:07 -07:00
Matthew Flatt
825902f8e6 Windows: adjust raco ctool --c-mods ... --runtime ... to copy libs
When gathering runtime files, include the "longdouble.dll"
and "libiconv-2.dll" libraries that are referenced by the
runtime system.
2015-11-12 19:01:18 -07:00
Matthew Flatt
a053c78c30 fix re-export of shadowing binding
Mishandling of the `require`-binding table could cause
`racket/private/pre-base` to export `andmap` as syntax, for example,
instead of as a variable. The syntax-versus-variable distinction
doesn't usually matter, but it affects the order of exports in
bytecode form.
2015-11-12 14:24:44 -07:00
John Clements
b5e2ae030b net/head: better error message for bytes/string mismatch 2015-11-11 17:46:47 -08:00
Matthew Flatt
596b05146c file/tar: add #:follow-links? option 2015-11-10 10:50:07 -07:00
Matthew Flatt
4c6750286a net/http-client: avoid race between EOF and collection close
The race condition can result in an "input port is closed"
error when a connection is used again.
2015-11-10 10:50:07 -07:00
Robby Findler
3d31d86bf5 fix (-> any/c boolean?) for the case of an impersonated struct predicate
closes #1129
2015-11-10 09:00:17 -06:00
Sam Tobin-Hochstadt
54be64ad31 Restore permissive error message from permissive/c.
Thanks to @rbfindler for the suggestion.
2015-11-09 09:15:33 -05:00
Robby Findler
611899764f pass along neg-party
closes #1126
2015-11-08 09:07:16 -06:00
Matthew Flatt
2ed6c01e56 fix space-safety annotation for nested ifs
Closes PR 15176
2015-11-08 07:36:48 -07:00
Robby Findler
71690384a4 add first-or/c 2015-11-07 19:55:20 -06:00
Robby Findler
12d063ad87 improve error message when an unknown dependent variable is used 2015-11-07 19:55:20 -06:00
Robby Findler
657cda6e12 add missing ->i well-formedness check 2015-11-07 19:55:19 -06:00
Matthew Flatt
0beee9cd6a remove visit of available module in dynamic-require
Even though `dynamic-require` might lead to loading source, the
path into the compiler for that source will force compile-time code
as needed.

One benefit of ths change is that `racket -l pict3d` takes about half
as long, because `racket/gui` includes a `dynamic-require` to load a
platform-specific back-end, while `pict3d` can pull in a lot of
compile-time code to cooperate with Typed Racket.
2015-11-07 14:08:13 -07:00
Matthew Flatt
6655352789 guard against some cyclic lists in bytecode decoding
Closes #1098
2015-11-07 09:17:41 -07:00
Matthew Flatt
e94b07b3aa patch Pango to handle font-info failure
Getting NULL from CTFontCollectionCreateMatchingFontDescriptors()
might indicate a font installation problem; I'm not sure. In any case,
checking for NULL avoids a crash on at least one installation.
2015-11-07 08:19:50 -07:00
Matthew Flatt
4d9c5d8dd2 patch Cairo to avoid writing to a global constant
This bug is already fixed in the Cairo source repo, so we
can discard the patch on the next Cairo upgrade.

It's not clear which platforms are affected. On OS X, at least,
writing to a global constant can cause a crash.

Thanks to Spencer for making a small example that triggers the bug
(added to the "draw-test" package).
2015-11-06 16:01:36 -07:00
Sam Tobin-Hochstadt
b6939b0b2e Namespace scheme_boxmap_size now that it isn't static. 2015-11-06 14:25:41 -05:00
Sam Tobin-Hochstadt
f126fd2356 Revert "change or/c so that it takes the first ho projection"
This reverts commit 5a33856802.

Merge to 6.3.
2015-11-06 14:25:41 -05:00
Juan Francisco Cantero Hurtado
5e2421b1a0 Doc: github.com/plt -> github.com/racket 2015-11-06 10:26:07 -06:00
Matthew Flatt
58c919c04e fix getting port name for reader errors
Closes #1121
2015-11-05 06:40:05 -07:00
Matthew Flatt
585f14744e ffi/unsafe/com: repair for safe arrays, and add com-omit?
Repair provided by Antonio Menezes Leitao.
2015-11-04 16:51:09 -07:00
Matthew Flatt
b54c03bb04 refine Cairo patch for CTFontCreatePathForGlyph
The CTFontCreatePathForGlyph() function can return NULL when
the glyph exists but has an empty path. Instead of treating that
as failure, which causes Cairo to generate a bitmap version of
the glyph, check that the glyph is mapped for bounding boxes,
and treat a NULL path as an empty path in that case.
2015-11-04 16:45:44 -07:00
Matthew Flatt
c5f4740b31 fix reader error for bad surrogate-style encodings 2015-11-04 14:03:48 -07:00
Matthew Flatt
5a8d2e4204 fix bugs in the reader, especially related to readtables
Closes #1118, but improved testing exposed many other bugs.
2015-11-04 08:51:03 -07:00
Vincent St-Amour
86f19474ca Have magnitude preserve single-precision-ness.
Found using random testing.
2015-11-03 18:43:27 -06:00
Matthew Flatt
827fc45598 syntax-local-infer-name: restore some lost generality
In #956, @gus-massa warned that `syntax-local-infer-name` was changed
in a breaking way, but the implications were not clear. At a minimum,
identifiers need to be treated like symbols, so that `mzlib/contract`
name inference works right. I'm erroring more generally on the side
of keeping the old behavior for anything other than pair-based
trees.

Closes #1117.
2015-11-02 09:14:34 -07:00
Matthew Flatt
37dc3ffa01 report error when --enable-extflonums fails
The `--enable-extflonums` option doesn't really do anything, since
extflonum support is enabled automtatically when the compiler's
configuration allows it. To make this slightly less confusing, report
an error when extflonums cannot be supported, despite
`--enable-extflonums`. The error is reported via compiling, instead of
via `configure`, but hopefully that's enough to be helpful.
2015-11-02 09:09:44 -07:00
Asumu Takikawa
14d25abd76 Add *-keys, *-values, in-* functions for id-tables
Bump version to 6.3.0.3 too
2015-11-01 02:50:12 -05:00
Matthew Flatt
101fac5c1e repair scope-propagtion cache yet again
Commit 352a5dd2d5 effectively reverted the repair
of d719c06e00.

Merge to v6.3
2015-10-30 22:24:40 -04:00
Matthew Flatt
352a5dd2d5 avoid thread swap in checking scope-propagation cache
Continuing with 2f25a1e2bd...

On further reflection, a GC is possible because a
thread swap is possible, and that's asking for trouble.
Disallow thread swaps (and, incidentally, GCs) whle
comparing scope propagations from the cache.

Merge to v6.3
2015-10-30 21:44:13 -04:00
Matthew Flatt
2f25a1e2bd fix GC-related issue with recent cache repair
Repairs a problem with d719c06e00.

A GC can happen while checking whether a cache entry matches,
in which case the cache is cleared, so don't check the cache
slot again after comparing.

Merge to v6.3
2015-10-30 21:31:57 -04:00
Matthew Flatt
d719c06e00 fix cache comparison of scope-propagation tables
Repairs 3eb2c20ad0, which used a scope-set comparison for
a table that maps scopes to propagation actions (add, remove,
or flip).

Closes #1113

Merge to v6.3
2015-10-30 21:01:46 -04:00
Matthew Flatt
bfb245553c fix some syntax-object traversals
Fix uses of `SCHEME_STX_VAL` that should be `scheme_stx_content`
to ensure propagation of scope changes.
2015-10-30 20:48:56 -04:00
Jay McCarthy
fddd85fa18 protect against errors from early-eof, protect against url objects with no path, ensure method is always passed correctly 2015-10-30 13:50:24 -04:00
Matthew Flatt
342198625e syntax-debug-info: handle non-identifiers correctly
In particular, fix the handling of binding information
when the context includes prefixing on import.

Closes PR 15173
2015-10-30 11:39:20 -04:00
Matthew Flatt
31b035cc94 fix submodule name used in error reporting 2015-10-30 08:47:23 -04:00
Matthew Flatt
6e21376473 fix relative-path handling for source locations in bytecode
Closes PR 15174
2015-10-29 21:09:52 -04:00
Matthew Flatt
685e74a1c6 fix debugging mode for checking runstack overflow 2015-10-29 21:09:52 -04:00
Sam Tobin-Hochstadt
60fb3e06b2 Improve set! error messages. 2015-10-29 19:33:15 -04:00
Sam Tobin-Hochstadt
1d3fe10d3d Ensure that the closure_map is big enough when deserializing.
Also document more invariants about the closure representation,
and avoid some code duplication.

Fixes #1108 (caught by fuzz testing).
2015-10-29 19:33:15 -04:00
Sam Tobin-Hochstadt
9d909d6834 Another validation check.
Fixes bug caught by fuzz testing.
2015-10-29 19:33:15 -04:00
Vincent St-Amour
d00401ccc1 Use faster reverse inside racket/private/list proper. 2015-10-29 15:37:25 -05:00
Vincent St-Amour
c3aa266bee Flush the same port we write to. 2015-10-29 15:37:14 -05:00
Robby Findler
aa46d1bc10 fix predicate/c bugs 2015-10-29 13:33:28 -05:00
Robby Findler
3f20803679 implement predicate/c for the more complex arrow contract protocol
So now (-> any/c integer?) will avoid the chaperone wrapper when the
function is a struct predicate while simultaneously supporting the
"extra argument neg party" protocol
2015-10-28 20:54:00 -05:00
Matthew Flatt
d17cc6039b repair syntax-local-lift-require to top level
In `syntax-local-lift-require`, avoid scope adjustments intended
to deal with `require` forms that are compiled in one namespace
and evaluated in another.
2015-10-28 21:14:10 -04:00
Matthew Flatt
0edd781928 use "_LOCK" prefix for Windows cross-build
Use "_LOCK" instead of ".LOCK" when the cross
platform is Windows, not just when the current
platform is Windows.

Merge to v6.3
2015-10-28 17:44:26 -04:00
Sam Tobin-Hochstadt
d589f6a8ed Avoid problematic reordering of Or patterns.
This makes two changes to `(or ...)` pattern compilation.

* Avoid reordering the individual elements of an `or` pattern.
  Since this reordering has broken programs with `and` patterns,
  avoid it here as well.

* Avoid re-ordering sets of patterns that _contain_ an `or`. This
  is not semantically important for match itself, but Typed Racket
  relies on the previous behavior.

  Closes racket/typed-racket#150.

Merge to 6.3
2015-10-27 12:13:21 -04:00
Sam Tobin-Hochstadt
7338f45bd2 Fix unwanted reordering of match patterns.
This change ensures that the `reorder?` flag is passed to recursive
calls to `compile` correctly. Related to racket/frtime#1, which is
probably now fixed.

Merge to 6.3.
2015-10-27 12:13:21 -04:00
Vincent St-Amour
bf69920570 Move racket/require tests. 2015-10-24 18:31:17 -05:00
Alexis King
dd97e7b72e Improve how multi-in assigns source location info for its expansion
This changes how multi-in is implemented so that the location for each
expanded element in the final require spec is tied to the last relevant
module path element. This allows DrRacket to intelligently show arrows
linking each imported binding with a relevant piece of the multi-in
import spec.
2015-10-24 18:21:30 -05:00
Alex Knauth
67e3899272 Allow separate read and write contracts for box/c 2015-10-24 14:16:49 -05:00
Robby Findler
c0209b1d80 preserve originalness so that arrows in define/contract
work properly with check syntax

Thanks to Matthew for the fix

Please include in 6.3
2015-10-24 14:16:47 -05:00
Matthew Flatt
3eb2c20ad0 avoid excessive memory use in or expansion
When `or` has many subexpressions, the expansion generates a
sequence of deeply nested `let`s, where original and macro-introduced
forms are interleaved in a way that defeats a minimal
child-is-same-as-parent sharing of scope sets. Add a small
cache that's good enough to capture extra sharing and
dramatically lower memory use for an `or` that has 1000
subexpressions.
2015-10-23 16:32:22 -06:00
Ryan Culpepper
a41c63be09 call SCHEME_EXPAND_OBSERVE_* only when in expand mode, not compile
Merge to 6.3.
2015-10-23 18:26:23 -04:00
Matthew Flatt
b98731ed00 Windows cross-build: MzCOM as a GUI executable
Merge to v6.3
2015-10-22 09:39:48 -06:00
Matthew Flatt
91d825ba61 Windows cross-build: fix over-agressive pruning of DLLs
The `setup/winstrip` step was run too late. As an extra measure,
make make `setup/winstrip` more precise about the files it
will discard.

Merge to v6.3
2015-10-21 18:13:39 -06:00
Matthew Flatt
876708c100 fix tracking of shadowed module imports
When an import is shadowed by another import or by a definition, don't
include it in the set of bindings in the resut of
`syntax-local-module-required-identifiers` or in the set that can be
exported by `all-from-out`.

Merge to v6.3
2015-10-21 16:56:54 -06:00
Matthew Flatt
7b7a315777 fix taint-check ordering in expander
Merge to v6.3
2015-10-20 20:22:37 -06:00
Matthew Flatt
5a768de132 fix Windows distribution stripping to remove CGC ".def" files 2015-10-20 20:22:34 -06:00
Matthew Flatt
a38ba440fa add ".def" generation for MSVC build 2015-10-20 20:22:28 -06:00
Matthew Flatt
ea6cef5246 Windows: make scheme_register_tls_space() always available
To make the API consistent for MSVC versus MinGW builds, make
a functional formerly required for embedding on 32-bit Windows
always available and required for all Windows variants.
2015-10-20 20:22:22 -06:00