Commit Graph

3602 Commits

Author SHA1 Message Date
Matthew Flatt
4fa8a9870d cs: report file for bad-version errors 2018-06-22 13:39:08 -06:00
Matthew Flatt
00b9acdac3 cs: fix procedure names
Use a `(let ([<name> ....]) <name>)` wrapper to communicate
an 'inferred-name property from correlated objects to
Chez Scheme. This stategy relies on a Chez Scheme patch to
make the wrapper work consistently.
2018-06-22 12:32:17 -06:00
Matthew Flatt
cf0b38aee9 cs: drop unused correlation early
The improvements reported in 74012f8c57 were actually due to a broken
experiment that dropped source locations on application forms, instead
of preserving them in marshaled code. Adjust the expansion pipeline
to do that earlier and intentionally.

The xify pas doesn't help all that much after all, but it's still more
comfortable to be independent of local-variable names.
2018-06-22 11:04:00 -06:00
Matthew Flatt
74012f8c57 cs: add xify pass for JIT mode
The xify pass replaces local variable names with `x0`, `x1`, etc.
Using a minimal set of symbols makes the fasled form smaller
and typically take only 60-70% as long to read.
2018-06-22 09:57:50 -06:00
Matthew Flatt
d8832723e9 expander: fix corner for syntax-debug-info
Add a missing argument in the implementation of binding traversals for
"all bindings" mode.
2018-06-22 09:57:03 -06:00
Leif Andersen
eb97c7f54e Update deserialize-module-guard. (#2147)
It can now optionally return a pair to redirect the module
that is dynamic-required.
2018-06-22 10:48:12 -04:00
Matthew Flatt
d061970a01 adjust place tests and failure mode
The places test suite included some tests that create lots of places
and don't wait for them, which can lead to an overload of places that
exhausts resources such as file descriptors. Improve the tests, and
also improve a failure behavior from a crash to an error message.
2018-06-21 10:16:02 -06:00
Matthew Flatt
8678fbc90c place-kill: wait for place to finish
The `place-kill` function sends a message to another place to
terminate, but it didn't wait for that message to take
effect before returning. Worse, it put the place object in a
state that claimed that the place had terminated.
2018-06-21 09:00:15 -06:00
Matthew Flatt
d4fc865319 style nit: cond on its own line 2018-06-21 09:00:15 -06:00
Sam Tobin-Hochstadt
b6a3f40bd9 Use a custom implementation of promises.
Saves 43 definitions and 397 lines of (de)compiled code.
2018-06-21 10:37:12 -04:00
Matthew Flatt
f58b99aa74 ffi/unsafe/alloc: add decallocation on place exit
Closes #1830
2018-06-20 16:54:59 -06:00
Matthew Flatt
8fb8d3c936 ffi/unsafe: add _wchar
Closes #1843
2018-06-20 16:54:59 -06:00
Gustavo Massaccesi
6d775e5c5c optimizer: reduce (length '()) ==> 0
This pattern is common in the internal code of the keyword procedures
2018-06-20 17:34:21 -03:00
Matthew Flatt
598a5baf6a JIT: fix miscompilaton of char=?, char<?
When the first subexpression is complex and the second
is a literal character, the generated JIT code swaps the
argument order, but compilation didn't swap the test for
whether one or the other is a literal character to skip
a run-time test.
2018-06-20 13:43:19 -06:00
Matthew Flatt
da41bdf43a syntax/modread: adjust error-message quotes
While we're adjusting error messagaes, change `...' to `...`.
2018-06-19 20:12:01 -06:00
Stephen Chang
8620bc50be clean up check-module-form
- truly ignore expected-module (in err msgs) to match docs
- remove dead code
2018-06-19 20:10:16 -06:00
Paulo Matos
d6fe30156c Fix indentation
Remove tab and add spaces, which is how the rest of the file deals with this.
Avoid a misaligned preview in github editor.
2018-06-19 20:05:35 -06:00
Gustavo Massaccesi
17acb7458b avoid compiler warning in jit 2018-06-19 19:27:35 -06:00
Matthew Flatt
d72ccb521d MzCom: repairs for some Windows configurations
Registration of the typelib seems to be required on some modern
configurations, and myssink must claim to not implement
INoMarshal.
2018-06-19 13:29:19 -06:00
Sam Tobin-Hochstadt
ff867155d1
Add Sarah and Andrew. 2018-06-19 11:25:55 -04:00
AlexKnauth
3996f23879 add src argument to syntax:read-xml
and pass it through into the syntax-source field of the result
2018-06-18 19:52:52 -04:00
Gustavo Massaccesi
9cd3798ca9 schemify: add reduction of (not #f) 2018-06-16 22:44:39 -03:00
Matthew Flatt
96161f68eb fix non-initial call to scheme_basic_env
When an embedding application calls `scheme_basic_env` a
second time, it's supposed to reset the main namespace, but
the new expander wasn't reset correctly.
2018-06-16 15:49:38 -06:00
Matthew Flatt
3c752e008e Racket HISTORY note for v7.0 2018-06-16 09:59:38 -06:00
Matthew Flatt
d3067465e3 setup/unixstyle-install: use delete-directory/files
Use `delete-directory/files` instead of a separate implementation
here to get the special deletion mode for Windows files.
2018-06-16 09:59:38 -06:00
Philip McGrath
5a4ea2cd1b json: small fixes
* Fix handling of single-percision infinities and nan

* Document that non-`hash-eq?` hash tables are accepted by `jsexpr?`.

* Document that the value of `json-null` is recognized using `eq?`

* Use `case` instead of `assoc`.

* Use contracts
2018-06-16 00:42:43 -04:00
Alexis King
41fd4f3a5e Allow local-expand to opt-out of implicit extension of the stop list
Also, adjust the expansion of #%plain-module-begin to reinstate the stop
list after initial partial expansion.
2018-06-15 17:56:52 -05:00
Matthew Flatt
98ae91e0ba expander: repair and further improve flattener
Delay reporting of potential problems until an actual problem
is detected. Correct a mismatch between original and renamed
symbols to restore detection of problems.
2018-06-14 17:27:00 -06:00
Sam Tobin-Hochstadt
62ef3ed1ee Improve flattener. 2018-06-14 14:04:05 -06:00
Matthew Flatt
daa7ddeef8 workarounds for Windows filesystem behavior
* When you delete a file in Windows, then the name doesn't go away
  until the file is closed in all processes (and background tasks like
  search indexing may open files behind your back). Worse, attempting
  to create a new file with the same name reports a permission error,
  not a file-exists error; there's seems to be no way to tell whether
  a permission error was really a file-exists error.

  This creates trouble for `make-temporary-file` when files are
  created, deleted, and created again quickly enough and when
  something like a search indexer runs in the background (which is the
  usual Windows configuration). In practice, that kind of collision
  happens often for `raco setup` on my machine.

  To compensate, make `make-temporary-file` try up to 32 times on a
  permission error. A collision that many times seems extremely
  unlikely, and it seems ok to delay an actual permission error.

  Windows provides a GetTempFileName function from "kernel.dll" that
  must be able to deal with this somehow --- perhaps because it's in
  the kernel --- but it doesn't solve the problem for making temporary
  directories, hence the 32-tries approach for now.

* When a deleted file's name persists because the file is open in some
  process, then a directory containing the file cannot be deleted.

  This creates trouble for `delete-directory/files`, since
  `delete-file` on a directory's content doesn't necessarily make the
  directory empty. In practice, this happens often for package
  upgrades on my machine, where the package system wants to delete a
  short-lived working space that the indexer is trying to scan.

  To compenstate, change `delete-directory/files` to delete a file by
  first moving it to the temporary directory with a fresh name, and
  then delete the file there. It may take a while for a file to
  disappear from the temporary directory, but meanwhile it's not in
  the way of the original enclosing directory.

* When a file is open by any process, it prevents renaming any
  ancestor directory of the file.

  This creates trouble for the package system, which installs a
  package by unpacking it in a temporary place and then moving it by
  renaming. The package system also removes a package by renaming it
  to a subdirectory of a ".trash" directory. If a background indexer
  has a package file open, the move fails. In practice, a move fails
  often on my machine when I'm attempting to upgrade many packages.

  To compensate, make the package system fall back to copy + delete
  if moving fails with a permission error.
2018-06-13 18:57:07 -06:00
Matthew Flatt
09cdbc418c expander: allow rename transformer to primitive in local-expanded
Closes #2119
2018-06-12 19:19:09 -06:00
Matthew Flatt
c7318cab33 expander: fix syntax-local-bind-syntaxes for local-expand
Bind variables in a way that allows `local-expand` (with an empty stop
list) to replace a reference to the binding with one that has the same
scopes as the binding.
2018-06-12 16:23:44 -06:00
Matthew Flatt
380dc42427 expander: fix interaction of expand+eval across namespaces
This repair was motivated by tests in the "rex" package. The
new test added here failed before by finding 'new both times,
but in the "rex" case, the mixup led to the same variable
being imported and exported at the linklet level.
2018-06-12 12:58:56 -06:00
Ben Greenman
cf0c06d810 struct-out: get correct list of super-struct mutators
struct-out was putting the super-struct's accessors into two parts of a
struct-info: the accessor list and the mutator list

this commit puts the accessors only in the accessor list and the
mutators in the mutator list
2018-06-12 08:49:58 -06:00
Matthew Flatt
5c641919a6 fix --enable-jitframe for platforms that use libunwind 2018-06-11 18:16:17 -06:00
Matthew Flatt
0d870fb11c reader: fix bugs in cdot readering 2018-06-11 16:24:34 -06:00
Matthew Flatt
f11b4319b5 catch up on some acknowledgments 2018-06-11 11:42:18 -06:00
Matthew Flatt
a703b608a4 add --enable-jitframe for configure on x86_64
Using a frame pointer for the ABI of internal helper functions
should make the stack friendlier to tools like `perf`. There
may be a small performance cost, though.
2018-06-11 08:35:42 -06:00
Matthew Flatt
2c58937008 expander: fix comment 2018-06-08 09:24:13 +08:00
Vincent St-Amour
a2ab778ddb Post-release version for the v7.0 release 2018-06-07 09:10:05 -05:00
Robby Findler
aabd0e4603 fix random contract generation for </c and >/c when they get +inf.0 or -inf.0 2018-06-07 08:49:02 -05:00
Sam Tobin-Hochstadt
c6dd371ed6 Make stx.rkt cross-phase persistent.
This eliminates more than 70 linklet instance creations.
2018-06-07 09:38:38 -04:00
Matthew Flatt
4e10ed0518 expander: fix another local-expand problem with 'module-begin
Alexis's repair, and as she notes, forcing a `post-expansion` context
value in the core `#%module-begin` expander may allow a simplification
in "definition-context.rkt". But it's not immediately obvious, so save
that potential improvement for later.

Relevant to #2118
2018-06-03 17:10:31 +08:00
Matthew Flatt
9ca8d34e7c expander: clean up post-expansion scope representation
Instead of three different fields in the context to keep in sync,
encode the possibilities witin a single field.
2018-06-03 16:46:46 +08:00
Matthew Flatt
a1b5bab31b expander: repair local-expand with definition context
When `local-expand` receives one or more internal definition contexts,
it would forget about any current post-expansion scopes. That's
particularly a problem in a 'module-begin expansion context, where the
post-expansion scope ensures that any bindings are suitably
phase-specific.

Closes #2115
2018-06-03 10:02:01 +08:00
Gustavo Massaccesi
b9392b2a51 use unsafe-undefined for missing arguments in string-join
This is similar to the recent change of functions with optional
values. Using unsafe-undefined instead of a gensym makes it easier
to avoid the check of the missing argument.
2018-06-01 16:33:16 -03:00
Gustavo Massaccesi
fd149ca1c0 fix cache of regexp in string-{split,trim,normalize-spaces}
When the separator is a string, these function construct a regexp
that is cached to make repeated calls faster. But when the string
is mutated it is necessary to recalculate the regexp.
2018-06-01 16:33:07 -03:00
Matthew Flatt
8d56c29317 expander: fix incorrect addition of shifts
Commit 32b256886e adds shifts in one place where it shoouldn't;
the "determinsitic-zo" test exposed the problem.

Also, avoid adding shifts that will have no effect, which avoids
accumulating useless shifts in some top-level contexts.
2018-06-01 07:41:26 +08:00
Matthew Flatt
2cfd65e972 defend against bad bytecode
Closes #2107
2018-06-01 07:41:25 +08:00
Matthew Flatt
937c396e1b expander: don't flip use-site scope in local-expand
Various parts of the expander, including `local-expand`, always
flipped the use-site scope when flipping an introduction scope. Onlt
`syntax-local-introduce` should flip both of them, though.

Closes #2112
2018-05-31 18:06:59 +08:00
Matthew Flatt
32b256886e expander: fix problem with module->namespace and shifts
When expanding in a namespace for a module unmarshaled from ".zo"
form, a scope corresponding to the module's "inside edge" is added to
every expansion. Before this repair, the scope was detached from
module path index shifts that might apply to the bindings (including
references to bulk bindings). Repair the problem by adding suitable
shifts when adding the scope.

Thanks to William Hatch for the bug report.
2018-05-31 18:06:58 +08:00
Matthew Flatt
865efb7dda add and use racket/repl
As suggested by Sam: Using `racket/repl` to start a read-eval-print
loop can mean that less code is loaded if a startup language other
than `racket/base` is selected.

Closes #2064
2018-05-30 15:55:54 +08:00
Matthew Flatt
388345f35f fix eval variant used for command-line arguments
Closes #2111
2018-05-30 10:13:50 +08:00
Matthew Flatt
7bbbb8f063 namespace-syntax-introduce: fix bad phase shift
A `namespace-syntax-introduce` at a phase other than 0 could shift the
phase of introduced context by double the correct shift.

Relevant to #2099
2018-05-26 21:31:41 -06:00
Matthew Flatt
b1bf333523 expander: avoid excessive binding information in error messages 2018-05-26 20:29:07 -06:00
Ben Greenman
10c05aa3a1 typo: make-file-or-directory-link error message
Change error message to blame the symlink, not its destination
2018-05-26 17:45:21 -04:00
Matthew Flatt
ec2387fa16 syntax-debug-info: restore all-bindings support
Relevant to #2099
2018-05-26 10:32:56 -06:00
Alexis King
87a5ee4cc1 Make syntax-local-introduce work in syntax/parse pattern expanders 2018-05-25 18:25:13 -05:00
Alexis King
33546008b3 Make syntax-local-introduce work in require/provide syntax 2018-05-25 18:25:13 -05:00
Alexis King
2bccbf76ad Make syntax-local-introduce work in match expanders 2018-05-25 18:25:13 -05:00
Alexis King
d944b8589e Add syntax/apply-transformer, which provides local-apply-transformer 2018-05-25 18:25:13 -05:00
Ben Greenman
568f086162 object/c-equivalent? refactoring
- add comment saying `check-one-object/equivalent` only compares common
  members
- put the similar parts of `check-one-object` and
  `check-one-object/equivalent` in a helper function
- in `object/c-equivalent?`, check that names match before comparing the
  common contracts (because the names should be fast to check-if-incorrect)
2018-05-25 14:07:42 -05:00
Ben Greenman
cc44afdf77 bump version for contract-equivalent 2018-05-25 12:10:49 -04:00
Robby Findler
d5d296c350 add missing arguments so external combinators can supply #:equivalent 2018-05-25 08:56:55 -05:00
Matthew Flatt
851ea57ef9 read/recursive: avoid placeholder wrapper
Although the documentation claimed that `read/recursive` produces
a plaeholder, that seems to be a leftover from a much older
reader (before `make-reader-graph`). Fix the new `read/recursive`
to be like the old one, and update the documentation.

Thanks to Alex Knauth for tracking down the unnecessary change
in reader behavior.

Related to #2099
2018-05-24 15:44:21 -06:00
Matthew Flatt
b58938dc89 map: fix contract check on given function with required keyword arguments
Compared to v6.12, `map` & co. already provide better checking in
reporting an error when a keyword-requiring function is provided
with empty lists, but repair the error message to talk about
required keywords instead of just by-position arity.

Thanks to Philip McGrath for reporting the problem.

Related to #2099
2018-05-24 15:44:04 -06:00
Matthew Flatt
643d0d2cc4 Windows: restore console handling of Ctl-Z as EOF 2018-05-24 09:35:28 -06:00
Matthew Flatt
b00779863f fix Windows OpenSSL native library build 2018-05-23 20:46:39 -06:00
Matthew Flatt
1faa0433fa expander: fix local-expand and dropped macro definition
If `local-expand` with a 'module-begin context introduces a macro
definition, but the definition is dropped while a non-macro definition
is later introduced, then make sure references go to the non-macro
definition.

This change also addresses a related scenario, where a
`local-expand`-discovered macro definition is not dropped, but it is
given an extra scope --- which amounts to the same thing from the
expander's perspective.
2018-05-23 15:19:35 -06:00
Matthew Flatt
37dde6dc1e expander: fix related to (local-expand .... 'module-begin ....)
When a module body is expanded with `local-expand`, then submodules
can remain declared even if the submodule is discarded in the final
expansion. Since that's the way it has always been, leave it that way.
But also guard against a way of generating an import cycle via those
leftover declarations.
2018-05-23 12:30:52 -06:00
Matthew Flatt
ab7dffa420 expander: repair for module with (#%declare #:empty-namespace)
Repair a corner of `namespace-attach-module` on modules that include
`(#%declare #:empty-namespace)`.
2018-05-22 14:19:16 -06:00
Robby Findler
1ee5786e2d fix substruct contract blame setup
closes #2093
2018-05-22 08:43:10 -05:00
Matthew Flatt
fadac92003 dump-memory-stats: repair for non-backtrace build
Fix `(dump-memory-stats 'count ....)` to avoid crashing immediately.
2018-05-21 06:33:48 -06:00
Matthew Flatt
c990bbf1f7 Windows: fix Console output for non-UTF-8 bytes
A repair for the preceding commit: Writing non-UTF-8 output to a
console will write something unspecified, but it shouldn't crash
or freeze Racket.
2018-05-20 09:47:14 -06:00
Matthew Flatt
f5f4e6cf03 Windows: Unicode I/O for console ports
Use WriteConsoleW and ReadConsoleW to support Unicode input and output
for a console independent of it's code page.

Closes #2087
2018-05-20 07:46:20 -06:00
Gustavo Massaccesi
293beac7ff fix mode in rumble:equal?/recur 2018-05-19 09:49:22 -06:00
Matthew Flatt
628c177480 expander: fix code-inspector management during macro expansion
Specifically, don't incorrectly preserve the current macro's code
inspector when triggering another macro via `local-expand`.
2018-05-19 07:12:26 -06:00
Caner Derici
55011ce282 racket/src/expander: add -B
adding -B option into the expander to write the bytecode of the extracted linklet
2018-05-18 19:25:51 -06:00
Robby Findler
54989bddec use preserved thread cells for the knot-tying cache
(this makes a difference in the acquire gradual typing
benchmark, which uses nested threads via the sandbox library)
2018-05-17 08:42:08 -05:00
Alexis King
774b02a0b8 syntax/parse: Add #:track-literals and syntax-parse-track-literals 2018-05-16 14:07:58 -05:00
Robby Findler
be7fe82ea8 adjust implementation of recursive contract to cope with
the fact that blame object equality now works right and
adding context to a blame object doesn't produce an equal?
blame object

also it appears that blame-add-unknown-context is not actually
being called so lets just get rid of that functionality
(but preserve reasonable backwards compatibility in
case someone is actually calling that function or
supplying #f to blame-add-context)

And the interning of blame objects was not intended to be
in 0b3f4b627e, so get rid of it here

closes racket/typed-racket#722
2018-05-15 21:06:53 -05:00
Jay McCarthy
06c7318eaf reformat and fix up reconnecting 2018-05-14 10:17:47 -04:00
Robby Findler
0b3f4b627e streamline the representation of blame objects
and improve the context tracking support
to allow a choice of how much context to save
2018-05-12 17:28:55 -05:00
Matthew Flatt
44b8e56ed0 bytecode optimizer: allow inline of unsafe-undefined
Restores some function inlining that was lost by the change to
optional-argument expansion.
2018-05-12 07:49:12 -06:00
Alexis King
bbbdee2853 Adjust local-require to be more deliberate about syntax-local-introduce
This ensures macro-introduction scopes don’t unintentionally end up on
lifted pieces of syntax, which causes problems for Check Syntax, since
it affects the syntax-original?-ness of the require spec.
2018-05-11 16:52:17 -05:00
Ben Greenman
a539825dc9 fix: allow missing fields in object/c-common-fields-stronger?
Change `object/c-common-fields-stronger?` to only compare the fields
common to both objects.
2018-05-11 11:50:14 -04:00
Robby Findler
8ec3edaa95 add contract-equivalent?
and use it to get rid of the change in 4de050552,
avoiding the exponential blowup in a way that
doesn't compromise on contract-stronger?'s result
2018-05-09 21:32:29 -05:00
Matthew Flatt
c927a004d2 expander: fix problems with syntax-local-make-definition-context
Allow `syntax-local-make-definition-context` in places where the
created scope is not accumulated for stripping from `quote-syntax`.
Refine the docs to clarify those situtations.

A test for the repair exposed a problem with use-site scopes
and `quote-syntax`, so fix that, too.

Closes #2062
2018-05-06 20:23:39 -06:00
Matthew Flatt
f9821f9f15 variable-reference->namespace: repair namespace availability
Internally, the namespace must be set to the returned one while making
it available. Otherwise, the current namespace can get mangled.

Closes #2067
2018-05-06 20:23:39 -06:00
Robby Findler
76c404dffc fix contract-stronger bug 2018-05-06 21:21:44 -05:00
Matthew Flatt
f231cb2003 expander: fix problem related to (local-expand 'module-begin ...)
When `local-expand` is used for a 'module-begin context, use a fresh
binding -> definition-unreadable-symbol table for the nested
expansion. That way, the table used for the main expansion is
unchanged, and re-expanding or evaluating the expanded module will
arrive at the same unreadable symbols as the initial expansion.

The report and example are from Alexis.
2018-05-06 07:59:54 -06:00
Matthew Flatt
662a9022c0 refine implementation of keyword and optional arguments
The old implementation turns a single optional argument into two
arguments: the optional value and a boolean to indicate whether the
optional value is supplied.

The new expansion uses `unsafe-undefined` in place of not-supplied
arguments, in the general case. If the default-value expression is
simple enough, however, it is copied to call sites that would
otherwise supply `unsafe-undefined`. In the common case where the
default value is `#f`, for example, no run-time test is needed in the
core implementation function to check whether the default is supplied,
because a `#f` will be filled in for callers.

The performance improvement is tiny to non-existent for realistic
programs, but the simpler and reduced generated code may help in the
long run.
2018-05-06 07:59:54 -06:00
Robby Findler
4de0505525 block possible exponential explosion in stronger check 2018-05-06 08:58:21 -05:00
Asumu Takikawa
5eceb3d051 Guard FFI union functions with type checks (#1375)
* Guard FFI union functions with type checks

Also add unit tests for unions
2018-05-06 00:10:14 -04:00
Robby Findler
69eb5ee055 change the representation of blame objects
so that blame-swap (when no context is added)
is more efficient
2018-05-04 14:40:31 -05:00
Robby Findler
143d15eaa5 add the ability to not track context information in contract violation error messages 2018-05-04 06:38:59 -05:00
Robby Findler
3f4cbcbfd8 memoize the creation of the name in the blame object 2018-05-02 19:01:20 -05:00
Tucker DiNapoli
822938d9ae Handle symbol changes between openssl-1.0 and 1.1
In openssl-1.1 (specifically libcrypto) the functions sk_num, sk_value and sk_pop_free are prefixed by 'OPENSSL_'.
Now both symbol names looked for to support both version 1.0 and 1.1.
2018-05-02 06:26:08 -04:00
Sam Tobin-Hochstadt
73c3341001 Implement read-eval-print-loop using #%kernel.
Makes the repl faster to load when using a very small language
such as `racket/kernel/init`
2018-05-01 13:35:05 -04:00
Sam Tobin-Hochstadt
ba8c79f502 Avoid some dependencies for racket/kernel/init.
This is useful when loading without bytecode. Motivated by use in
Pycket, which does not load bytecode.
2018-05-01 13:35:05 -04:00