Commit Graph

473 Commits

Author SHA1 Message Date
Matthew Flatt
1cc55f30fe subprocess: support adding to an existing subprocess group 2017-10-12 12:37:21 -06:00
Matthew Flatt
d4f2f01c80 ffi/unsafe: add void/reference-sink 2017-09-24 08:27:48 -06:00
Leif Andersen
5e3a23886a Make compute-offsets public. (#1814)
Make compute-offsets public.
2017-09-22 23:15:28 -04:00
Matthew Flatt
1f02cf226e fix eq[v]? hashing with many collisions
Normally, it's impossible to generate lots of `eq?`-hashing
collisions, but when the compiler inlines a function, it can duplicate
variables in a way that gives each copy the same `eq?` hash code. The
immutable-hash tree implementation failed when more than 32 collisions
occurred (which triggers a subtree in the collision node).

It's similarly very difficult to generate > 32 values that collide on
`eqv?` hashes but are not `eqv?` (although it must be possible using
exact rationals or complex numbers).
2017-09-07 17:42:29 +01:00
Matthew Flatt
93ea42d7b7 tcp-addresses: fix result for a connection peer
In the rktio conversion, the peer-address results were incorrectly
wired to the local-address function.
2017-08-18 09:27:23 -06:00
Matthew Flatt
1a9dee59da deregister semaphore for a blocking file descriptor
The rktio conversion lost the deregistration of file descriptors in an
internal fd-to-semaphore table building on kqueue/epoll, causing the
wrong semaphore to be checked for a later recycling of the file
descriptor. This bug mainly affects Linux and ports created by
`subprocess`, since kqueue is not used for pipes on Mac OS and BSD
variants. The bug does not affect network sockets (which are the
primary intended clients of epoll/kqueue support), since the relevant
semaphore is deregistered when a socket is closed.

Thanks to James Bornholt for discovering the problem and providing the
repair.

Closes #1769
2017-08-10 19:54:04 -06:00
Matthew Flatt
664bec2040 repair a problem with module->namespace
Fix a problem with compile-time bindings added to a
namespace created by `module->namespace` for a module
that does not have a source file.

Possibly, there's a different fault that should be fixed that caused a
binding to use the module's instantiation-time module path index
instead of its compile-time module path index (which is what happens
when a file is involved). This repair fixes the problem in a general
way, though, and leaves further improvement to the reimplementation of
the expander in Racket (which already does not suffer from the bug).

Thanks to Alexis for providing the example.
2017-08-10 18:33:49 -06:00
Matthew Flatt
f6e863a4dd fix GC handling of unquoted-printing strings
Adds missing change to cbfcc904ab.
2017-08-04 09:18:15 -06:00
Matthew Flatt
05c5c4fa3e fix space-safety of JIT-generated apply
In a non-tail position, a JIT-generated application of `apply`
retained the argument list until the called function returned.
Fix it to drop the reference to the list before the function
is called.
2017-08-04 07:23:50 -06:00
Matthew Flatt
cbfcc904ab add unquted-printing strings
And unquoted-printing string contains a string to `display` in all
print modes. Although it could be implemented with a structure type
that has a printing function, `raise-arguments-error` further treats
unquoted-printing strings specially by not using the error value
conversion handler, so it reliably produces literal text in the error
message; that way, `raise-arguments-error` can be used to construct
more error messages.
2017-08-04 06:13:19 -06:00
Matthew Flatt
94b9b8f4dd document integer->integer-bytes and integer-bytes->integer change 2017-07-28 09:51:15 -06:00
rain
8ee5d18107 support 1-byte numbers in integer->integer-bytes and integer-bytes->integer 2017-07-28 09:39:49 -06:00
Matthew Flatt
2cf38ecad7 ffi/unsafe: attempt to improve _union
The hack to implement `_union` without help from libffi failed when
the total size of the variants is too large. Try a different approach,
which involves a bet that the total size plus whether the content is
all floating-point numbers will be enough information for most cases.

Relevant to #1351
2017-07-28 09:05:24 -06:00
Matthew Flatt
9c48ee003a add missing lock on chaperoned/impersonated hash-table operations
For `equal?`-based hash tables, various operations are supposed to
take a lock on the table, but the lock was missing.
2017-07-24 19:25:17 -06:00
Matthew Flatt
263e7b10d9 unsafe-vector-chaperone: repair a test 2017-07-23 08:57:08 -06:00
Matthew Flatt
d081586959 fix immutability of some syntax-e results
Internally, when scopes are propagated to nested syntax objects,
vectors and boxes were not reconstructed as immutable.

Closes #1745
2017-07-14 07:37:55 -06:00
Matthew Flatt
2e77279be0 syntax: fix guard for multiple pattern variables under ...
Fix the part of `syntax`/`datum` that determines whether an exception
handler is needed to convert an error from `map` to one from
`syntax`/`datum`.
2017-07-14 06:58:58 -06:00
Matthew Flatt
b2b53d61a1 fix test that uses IPv6
Closes #1738
2017-07-02 20:07:55 -06:00
Matthew Flatt
eb24c1e0b1 find-relative-path: correct contract in docs
Also, avoid a test on Windows that can't work there.
2017-06-29 13:26:24 -06:00
Ben Greenman
04c1c15d89 bug: add guard against string-paths in 'find-relative-path'
Add guard, if first argument to `find-relative-path` is not a path,
 then don't call `path-convention-type` on it.

Thanks to Jack Firth for reporting:
https://github.com/racket/rackunit/pull/46
2017-06-28 10:19:50 -04:00
Matthew Flatt
3c07250db4 fix printer for (unquote @d)
Avoid printing `(unquote @d)` or `(unsyntax @d)` as `,@d` or `#,@d`,
which would mean `(unquote-splicing @d)` or `(unsyntax-splicing @d)`
to the reader, by adding an extra space before the `@`.
2017-06-22 15:00:00 -06:00
Daniel Feltey
87e4bdbec8 Fix segfault on accessing non-present impersonator properties of property-only vector chaperones
Additionally this adds macros that distinguish between the chaperone redirects of prop-only vector
chaperones, function chaperones, and structure chaperones since each of these may store a vector
in the redirects field.
2017-06-22 12:46:58 -05:00
Matthew Flatt
f8c7feaf88 fix problem with prefabs, auto fields, and construction via a key
Auto fields were incorrectly recorded as immutable in a structure type
that is first generated from the prefab struct key instead of
`make-struct-type`.

Thanks to Deren Dohoda for the report.
2017-06-22 10:46:49 -06:00
Matthew Flatt
a15b16cfd9 repair expand-user-path 2017-06-21 16:19:14 -06:00
Matthew Flatt
83cb1a0d00 repair and tests for Windows path handling
In the process of extracting minimal Windows path encoding for rktio,
I noticed a decoding issue with a path that ends with an unpaired
high-surrogate value. Add a suitable tests and fix the old decoder
(although it will probably go away).
2017-06-21 05:23:53 -06:00
Matthew Flatt
d4742a0618 fix bytes-convert-end
The `bytes-convert-end` function didn't set up a proper decoding.
Make sure that it at least does nothing for encodings where
there's nothing to do.
2017-06-21 05:23:53 -06:00
Matthew Flatt
51bf69e356 switch for/list back to a loop plus reverse
Closes #1721, which points out that the `for/list` expansion
introduced in commit 5e94a906cd interacts badly with a body
that captures a continuation plus Racket's current implemenation
of continuations.

When Racket one day gets a better implementation of continuations,
this change could be considered again, but the general question is
whether programs can detect or be affected by the size of the
continuation (when the programs don't directly control the
continuation creation --- otherwise continuation marks obviously
expose the size).
2017-06-20 08:28:53 -06:00
Matthew Flatt
c4b3b19c1e rktio: repairs
All tests now pass for MacOS.
2017-06-19 06:45:17 -06:00
Sam Tobin-Hochstadt
5d4bf33906 Tests keep taking longer. 2017-06-09 18:08:12 -04:00
Matthew Flatt
dc14a68162 fix performance problem in expander
For a term

 (lambda (arg-id ...) (define def-id _rhs) ... (arg-id def-id) ...)

the expander could take quadratic time in the number of `def-id`s
due to walking an environment to remove use-site scopes. (The
variant of the expander rewritten in Racket didn't have this
problem.)
2017-06-08 07:01:31 -06:00
Leif Andersen
2f6c42f3c1 Add a #:make-c-id flag to define-ffi-definer
This make-c-id allows an author to specify a convention for how
to connect and identifier defined with define-ffi-definer and
the actual symbol in the file.

* Adds docs.
* Adds tests.
* Adds history.
2017-06-02 10:26:57 -04:00
Matthew Flatt
06b69c625f repair chainges to ffi/file
Bring back the exported `_file/guard`, `_file/r`, and `_file/rw`;
restore/move tests in "file.rktl" test suite; and add docs for new
functions.
2017-05-27 07:29:47 -06:00
Milo Turner
cc25a27f87 fix id-set-symmetric-difference, same as 4716a6e fixed for sets 2017-05-24 15:55:03 -04:00
Stephen Chang
7620bfcb7c fix and actually run id-set tests 2017-05-24 13:25:15 -04:00
Matthew Flatt
f43234e1cb add prop:authentic and (struct .... #:authentic ....)
An authentic structure type is one whose instances cannot be
impersonated or chaperoned. The intended use of `prop:authentic` is to
annotate a library-private data structure where impersonators are
never needed internally for the data structure, and the declaration
lets the compiler produce less code and fewer branches by omitting
impersonator support.
2017-05-12 12:40:57 -06:00
Matthew Flatt
e6793c4598 fix variable-reference->module-path-index on primitive refs 2017-05-09 20:28:25 -06:00
Matthew Flatt
de0d84f7b3 racket/serialize: repairs for structs that have auto fields
Closes #1650
2017-04-29 13:20:25 -07:00
Vincent St-Amour
13443dec92 Add chaperone-vector*, unsafe-chaperone-vector, and property-only vector chaperones.
By analogy with the procedure chaperone equivalents.
2017-04-28 14:27:53 -05:00
Matthew Flatt
608e6cc2a2 add tests for racket/port
Also, fix some doc typos.
2017-04-26 17:16:59 -06:00
Matthew Flatt
6de3659664 repair for hash-keys-subset?
When comparing a part of a hamt that is a collision node versus a
subtree node, a "hash code" was extracted from the collision node ---
but that's really a code for an integer key is that used for the
collision element. The comparison should instead use a code extracted
from the reference to the collision node (which is the code that is
common to all colliding keys).
2017-04-26 15:27:39 -06:00
Matthew Flatt
c0f158b38c Makefile: add a client-testing entry for use by distro-build
Also, add a "distro.rkt" test to "tests/racket/test" to hold
basic checks to run in a client build.
2017-04-25 11:12:01 -06:00
Matthew Flatt
a71d87c5a9 optimizer: remove incorrect assertion 2017-04-21 14:28:57 -06:00
Matthew Flatt
9cb8c8fdd9 avoid O(n^2) GC time with ephemeron chains
Avoid the well-known possibility of quadratic handling of ephemeron
chains, where all ephemerons are immediately known, no keys are
immediately known, and each link in the chain has a value that refers
to the next link's key.

To aviod quadratic behior, attach a list of ephemerons to each page of
allocated objecst, where marking any object on the page triggers a
rescan of the ephemerons without waiting to rescan all ephemerons.
2017-04-20 20:48:55 -06:00
Matthew Flatt
3bc3fe9e26 fix dynamic-wind matching for continuation jumps
Thanks to Gustavo and Robby for tracking down the relevant feature
of a complex example that was found by random testing.
2017-04-19 07:00:34 -06:00
Leif Andersen
47a2d4a879 Fixed tests for log function.
The test cases relied on arity and changing log to have an arity
of both 1 and 2 activated new (incorrect) tests. I fixed the
incorrect tests as they applied to the log function.
2017-04-16 15:34:13 -04:00
Leif Andersen
922b5f06e9 Make log also accept a base. (#1667)
Make `log` in `racket/base` optionally accept a second argument.

The second argument is the log `base`. The docs also recommend
`fllogb` when precision is important.

* Error message when base is 1
* Added docs.
* Add tests.
2017-04-15 10:40:41 -04:00
Matthew Flatt
5fb86dc55e fix ad-hoc hash-ref optimizaiton
Optimization to convert `(hash-ref <ht> <key> (lambda () <constant>))`
to `(hash-ref <ht> <key> <constant>)` didn't check that the `lambda`
for had zero argument.

Closes #1648
2017-03-30 18:45:26 -04:00
Matthew Flatt
92a0dcbcb0 fix problems with chaperoning/impersonating keyword functions 2017-03-29 12:26:48 -06:00
Ben Greenman
2cbd44d64d add optional 'sep' argument to path-add-extension
New optional argument to 'path-add-extension',
 a byte string to replace for the '.' in the argument path.
2017-03-26 20:58:53 -04:00
Matthew Flatt
e22a5da06c find-relative-path: case-normalize for comparison by default
This change affects programs only on Windows. For example, `C:\a\b`
relative to `c:\A\c` is `..\b`, instead of not relative.

Closes #1603
2017-03-24 20:00:03 -06:00