The code added to handle expressions mixed with definitions was
not introduced in the right way; fix it to be like macro-introduced
code.
Closes PR 13452
The problem was in the handing of "lightweight continuations" used to
represent suspended computations, and in particular the handling
of continuation marks (such as the ones added by DrRacket's debugging
mode).
Unfortunately, I wasn't able to construct a simpler test case that
triggers the problem. I think the number of installed continuation marks
has to be just right, and there have to be some replacing marks, and
a lightweight continuaiton has to be captured at the right time
as a result of applying a previously captured continuation.
Closes PR 13427
Merge to v5.3.2
It fixes a crash in the installation on OpenBSD. Racket reaches the
limits of the shell when it is compiled with a non-root user account.
Tested on OpenBSD-current amd64.
Merge to v5.3.2
With either
configure --enable-pkgscope=installation
or
raco pkg config -i --set default-scope installation
the default scope of `raco pkg' actions can be changed from
user-specific to installation-wide.
We considered trying to guess when someone building Racket would prefer
installation-wide package scope by default. In particular, someone
building from source for in-place use seems likely to want
installation-wide scope by default. Then again, we don't want to
discourage in-place builds for Unix installations that are intended
for multiple users. So, no guessing for now.
Also, add a `--scope' argument to `raco pkg' commands, which is more in
line with other options, but keep `-i', etc., as shorthands.
The problems were with
* `sqrt' and `expt' on single-flonum complex numbers
* `asin' and `acos' on single-flonum arguments and complex results
* `atan' on mixtures of single-flonum and exact arguments
* `gcd' on mixtures of single-flonum and flonum arguments
For now, SGC must be used, but `configure' does not select it
automatically.
Also, support Cygwin (in addition to MSYS) as a build environment
when using MinGW compilers. Since I build in a Cygwin environment
(which seemed to be the easiest way to get MinGW-w64 gcc), I use
../configure --host=x86_64-w64-mingw32 --enable-sgc
The synchronization result of a log receiver is now a vector of four
values, instead of three, where the last one reports the name.
Also, an optional argument to `make-logger' provides a notification
callback for each event sent to the logger.
These changes enable more control over loggers and events. Suppose
that you have processes A and B, and you want all log events of A
to be visible to B, but not vice-versa. Furthermore, you want the
log events to appear at B in the right order: if A logs an event
before B, then A's event should arrive at a log receiver's before
B's. Now that a log receiver gets the name associated with the
original event, and now that the name can be re-sent in a
`log-receiver', it's possible to give A and B separate loggers and
send all of the events from A's logger to B's logger. Furthermore,
you can use the notification callback so that when an event is logged
in B, you can make sure that all available events from from A's
logger have been transferred to B's logger.
A phantom byte string is a small object that the memory
manager treats as an arbitrary-sized object, where the
size is specified when the phantom byte string is created
or or when size is changed via `set-phantom-bytes!'.
Keep track of whether any Racket-managed subprocesses are pending,
and use waitpid(0, ...) only if there is one, to better cooperate
with an embedding environment.
Also, add a chapter to the "Inside" manual to explain the issues.
As long as some thread is ready to run, and in case the threads
synchronize after very little work, keep checking threads for
at least one thread quantum.
Allowing them would require support for immutable fxvectors and
flvectors, interning, and more. Since the motivation for reader
support is to make marshaling and unmarshaling easier, allow
them only in `read' mode. Change printing to make then unquotable.
Also, describe the patch in the Windows build notes.
This change increases access to symbol fonts, though not in a
completely consistent and portable way. See the closed problem
report for more information, as well as a 24-NOV-2012 post
on the Racket mailing list:
http://lists.racket-lang.org/users/archive/2012-November/055141.html
Closes PR 13300
This change makes document building --- and specially incremental
document building --- more scalable. The global duplicate-definition
check is handled by a database query, for example.
A bogus flag was propagated to closure information. This flag
was ignored by the validator, but not `zo-parse'. Make the validator
reject the bogus flag, too, while fixing the compiler.
This one is related to shifting type info when the closure is
made smaller due to lifting of something that used to be in
the closure. The `games/pousse/robot' module exposed the bug.
This is another old bug that could have caused validation failures
with flonums, but it showed up with fixnum tracking because fixnums
are more common (e.g., from `string-length').
There were really two bugs: information installed at the
wrong offet in one place, and a failure to detect that information
should be propagated in a different place. Fixing both avoids
a validation problem with `html/sgml-reader'.
Instead of keeping offsets in terms of `double's, keep it in
terms of bytes. This change is a step toward putting other kinds
of values on the flostack, such as extended-precision floats.
The last argument in a self-tail cal is treated specially and
not immediately stored on the "runstack". Space was formerly
allocated for it, though, and under certain circumstances
that space was not initialized. I think a combination of thread
timing, GC timing, and flonum boxing could potentially lead to a
crash (but constructing a test case is really difficult).
The scheme_generate_arith() function effectively had its own
copy of of the general scheme_generate_two_args() function that
predates the general one. Using scheme_generate_two_args()
instead simplifies and clarifies the code.
Track fixnum results in the same way as flonum results to enable
unboxing, if that turns out to be useful. The intent of the change,
though, is to support other types in the future, such as "extnums".
The output `raco decompile' no longer includes `#%in', `#%flonum',
etc., annotations, which are mostly obvious and difficult to
keep in sync with the implementation. A local-binding name now
reflects a known type, however.
The change includes a bug repair for he bytecode compiler that
is independent of the generalization (i.e., the new test case
triggered the old problem using flonums).
This appears to be an old bug where a check and use are misordered, so
I'm not sure why it hasn't caused more trouble before, but it depends
on a GC happening at the right time.
Closes PR 13245
The JIT was pessimistically using 64-bit jumps for long branches
or any jump between code that is allocated at different times.
Normally, though, code allocation stays within the same 32-bit
range of the heap, so stick to 32-bit jumps until forced by
allocation addresses to use 64-bit jump targets.
In `(if (pair? x) E1 E2)', convert `(car x)' in E1 to
`(unsafe-car x)', and similarly for `(cdr x)'. Also,
`(begin (car x) (cdr x))' converts to `(begin (car x)
(unsafe-cdr x))' since `(car x)' implies a `pair?' test
on `x'.
More consistent clearing avoids a kind of space unsafety. There's just
one buffer per thread, so it's difficult to turn non-clearing into
a detectable leak (I wasn't abel to construct an example), but it
might be possible. More practically, failing to clear the buffer
can make it difficult to debug memory use.
The scheme_is_multiprocessor() function wasn't the right guard
for whether to use a locking compare-and-swap instruction; any
use of pthread-based futures needs the compare-and-swap.
Merge to v5.3.1
This change doesn't speed up anything, so far. GC performance
of pairs (or anything) is determined almost completely by
its size in bytes, and this change doesn't affect the size of
pairs. At the same time, the change mostly replaces the obsolete
"xtagged" support, and I might have a better idea that builds on
this change, so I'm keeping it for now.
Shape information allows the linker to check the importing
module's compile-time expectation against the run-time
value of its imports. The JIT, in turn, can rely on that
checking to better inline structure-type predicates, etc.,
and to more directy call JIT-generated code across
module boundaries.
In addition to checking the "shape" of an import, the import's
JITted vs. non-JITted state must be consistent. To prevent shifts
in JIT state, the `eval-jit-enabled' parameter is now restricted
in its effect to top-level bindings.
This tracking allows the compiler to treat structure sub-type
declarations as generating constant results, and it also allows
the compiler to recognize an applications of a constructor or
predicate as functional.
The JIT takes advantage of known-constant bindings to avoid the
check that a variable is still bound to a structure predicate,
selector, or mutator; that makes the code short enough to really
inline. The inlined version takes about half the time of the
indirect version.
The compiler does not yet track bindings precisely enough to
recognize constants for sub-type declarations.
Turn use of a finalized ffi callout into a reported error,
instead of a crash. Clarify the existence of the finalizer
in the docs. Fix error logging of the finalizer thread.
Merge to v5.3.1
Bytecode changes in two small ways to help the validator:
* a cross-module variable reference preserves the compiler's
annotation on whether the reference is constant, fixed, or other
* lifted procedures now appear in the module body just before the
definitions that use them, instead of at the beginning of the
module body
The new argument gets to chaperone/impersonate a guard at
the prompt, and it is applied when the continuation is applied ---
based on a wrapper on th prompt tag of the continuation (as opposed to
the prompt tag of the prompt).
The new argument gets to filter results that come from a
non-composable continuation that replaces one delimited
by a prompt using the chaperoned/impersonated prompt tag.
For simple structure types (no guards, no auto fields, no
procedure property). Inlined allocation makes structure
allocation a little faster; more significantly, it
make structure allocation future-safe.
When thie JIT guesses that an identifier is bound to a
structure predicate, getter, setter, etc., but that guess
turns out to be wrong, and the call is in a tail position,
then preserve tail-call behavior.
(Changes include some setup to inline structure constructors.)
Avoids a common problem with libffi installed by MacPorts
causing problems with a mismatch between an iconv installed
by MacPorts and the system iconv. (When libffi is installed,
then -I/opt/include for the libffi heads also picks up the
iconv headers, but the ordering of the lib flags doesn't
pick up libiconv from /opt/lib. We could try to hack around
this by ordering the flags just right, but it seems better
to avoid the issue.)
JIT-generated doesn't actually conform to the constraints
of the Win64 stack-unwind protocol. In pariticular,
JITted code might move the stack pointer after a "preamble"
that saves non-volatiles, and the frame pointer isn't in
the right place. So, we can't implement the generic unwind
hook --- but the JIT's stack traversal can interleave its own
unwinding with the OS-supplied unwinding interface.
The new parameter (and supporting environment variables and
command-line flags) can bytecode lookup to a tree other than
where a source file resides, so that sources and generated
compiled files can be kept separate. It also supports storing
bytecode files in a version-specific location (either with
the source or elsewhere).
Clients of scheme_apply(), scheme_eval(), etc. (i.e., the variants
without a leading "_") except aborts to continue jumping out, while
a recent change to make them behavior more like a default prompt
handler caused them to return on errors. Changethe handler to behave
like the default, except that after running a result thunk, the
handler effectively aborts again.
The `make-log-receiver' function now includes a logger-name
filter. This filter is implemented as a low enough level that
it affects `log-level?' tests to check whether a log message
needs to be constructed at all.
The -W and -L flags and PLTSTDERR and PLTSYSLOG environment variables
support filters of the form "<level> <level>@<name> ...", where
<level>@<name> specializes filtering of events for a logger whose
name matches <name> to show <level> and higher.
The old `cast' didn't work right for a mismatch between
a pointer GCableness and the source or target types, and
it didn't work right for an GCable pointer with a non-zero
offset. While those pitfalls were documented, the first
of them definitely has been a source of bugs in code that
I wrote.
Also added `cpointer-gcable?'
Using `call-as-atomic' isn't right, because that allows an escape
via `call-as-nonatomic'. Assuming that `call-as-nonatomic' isn't
used, it seems like `call-as-atomic' should be ok, anyway, but
somehow its leads to unbalanced `end-atomic' calls.
Add `file-position*', which can return #f instead of raising
an exception when a port's position is unknown. Change
`make-input-port' and `make-output-port' to accept more
kinds of values as the initial position.
These changes make it possible to synchronize a port's
position with a `port-commit-peeked' action. It's ugly,
which I think reflect something broken about position
tracking in the port protocol (which seems difficult to fix
without breaking compaibility).
Providing a port instead of a reading or writing procedure
redirects the read/write to the specified port. This shortcut
is kind of a hack, but the run-time system can easily streamline
the redirection when it's exposed this way.
Using the new redirection feature reduces overhead in
`with-output-to-bytes' and `pretty-print'.
Previously, the use of `pretty-print' for `print' by `racket/main'
and the use of `transplant-output-port' by `pretty-print' caused
a flush to happen.
This problem highlights a potential general issue, which is that
`pretty-print' happened to always flush its output before, and
some programs may accidentally depend on that behavior.
We can't disallow the creation of bad mutators without breaking
old code, but we can prevent the JIT from treating them like
good ones.
Closes PR 13062
Since SIGHUP normally means that the output has gone away,
don't try to write to it.
Closes PR 13058 (although it doesn't solve the more general
problem that is noted in the PR)
The bytecode compiler used to convert an expresison like
(<flonum-op> <simple-expr> <complex-expr>)
to
(let ([id <complex-expr>])
(<flonum-op> <simple-expr> id))
to help an older version of the JIT avoid boxing the result of
<simple-expr>, but that transformation isn't needed, since the JIT can
keep unboxed values on the stack.
The transformation was complex and apparently buggy.
The changes also include a repair to the JIT for code that the
bytecode compiler formerly wouldn't generate, but which is allowed
bytecode.
Closes PR 13052