Converting between strings and paths interferes with cross
compilation. This hasn't caused more problems only because cross
compilation has tended to run on Unix platforms, where the generated
paths are acceptable to Windows. But using strings goes wrong when
manipulating a Windows-based build for further cross-build actions on
Unix, and it can go wrong if paths contain bytes that cannot be
encoded in strings.
The `ffi/unsafe/string-list` library is not needed now that `(_list i
_string)` and similar work. This way, existing code that uses `(_list
i _string)`, `(_vector i _string)`, etc., does not needed to be
modified to work with CS.
We don't usually remove libraries, of course, but this one has only
existed for a few days, and it was made to work around a problem that
has been solved in a better way.
Related to #3825
A reference bytevector holds a mixture of addresses within GCable
objects and foreign addresses, where "address" corresponds to the
payload of a bytevector or flvector object. The GC knows to apply a
suitable offset to the reference, so that object counts as reachable
from a reference bytevector, and the reference bytevector is updated
if the object is relocated during a collection.
With this change, the restriction in Racket CS against passing
non-atomic memory to a foreign function can be lifted. For example,
`(_list i _string)` can be useful as the type of a foreign-call
argument.
Making reference bytevectors a subtype of bytevectors is not an
obvious choice, given that writing to a reference bytevector with
byte-level operations can easily corrupt it. But this choice makes
various things simpler and easier.
I'm not sure this is a good idea, but it doesn't apear to be a
particularly bad idea. Exporting symbols just makes the executable
size slightly larger.
Closes#3617
Passing an array of strings or byte strings to a foreign function can
be especially tedious on Racket CS, due to the prohibition against
passing an array of GCable pointers to a foreign function.
Closes#3825
In CS, a pointer to non-atomic memory cannot usefully be passed to a
foreign function. The general foreign-call path checked for that kind
of argument and raised an exception, but the check was missing from
the common-case fast path, so a meaningless argument would be quietly
passed to the foreign function.
Related to #3825
This speeds up `(factorial 1000000)` (using factorial from math/number-theory)
by about 3x, and the conversion of the result to a string by about 2x.
Benchmark:
#lang racket
(require math/number-theory)
(define n (time (factorial 1000000)))
(define s (time (number->string n)))
(string-length s)
Current Racket CS:
cpu time: 19135 real time: 19137 gc time: 372
cpu time: 33416 real time: 33418 gc time: 463
Current Racket BC (GMP is really fast):
cpu time: 1465 real time: 1465 gc time: 51
cpu time: 3661 real time: 3659 gc time: 3
This PR:
cpu time: 6173 real time: 6172 gc time: 168
cpu time: 17846 real time: 17847 gc time: 377
Cutoff between Karatsuba and Toom3 estimated by mflatt.
Cutoff between Toom3 & Toom4 guessed.
The argument type `(_ptr i _string/utf-16)` is not used on CS, because
a pointer to non-atomic memory cannot usefully be passed to a foreign
function from Racket CS.
Closes#3820
When a struct is called as a procedure and the struct is
impersonators, make a method-style `prop:procedure` receive the
impersonated structure as its argument. This change makes a
method-style `prop:procedure` more consistent with a field-index
`prop:procedure. The old behavior, meanwhile, seems to create an
unsoundness in Typed Racket.
Closes#2574
When an inlined `set!` mutates a variable that's bound in the inlined
function, the `set!` target was not updated to refer to the inlined
binding.
Closes#3817
When a function from `define-inline` is applied to the wrong number of
arguments or the wrong keyword arguments, then leave it as a runtime
error (with a compile-time warning) instead of a badly reported
compile-time error.
Closes#3402
This is a backward-incompatible change, but I think it's unlikely that
any code intentionally uses `unsyntax` or `unsyntax-splicing` within a
syntax-quoted box and expects it to stay literal.
Meanwhile, as @rocketnia noted, the documentation for `quasiquote` was
unclear about the espacing positions for `unquote` and
`unquote-splicing`, so this commit impoves that documentation. It
adjusts the documentation for `quasisyntax` to note that a hash table
value position is not an escape position, unlike for `quasiquote`.
(The lack of an escape position within hash tables is consistent with
`syntax`. That's arguably inconsistent with `quasiquote`, but it seems
simpler to leave that alone, and changing `syntax` just might matter
for existing code.)
Closes#3656
I can't see where the ABI pins this down for x86_64, but the default
compiler on Mac OS seems to have started caring that 1-byte and 2-byte
integer arguments are sign-extended in registers. The previous lack of
sign extension would affect only small-structure arguments.
Also, make some adjustments to "Mf-base" so that plain `make`
generates a summary file as before and so that output files are linked
in a way that lets `make root-experr` and `make patches` find them.
* refactor mats to allow different configurations to run in parallel.
The {partial,all,bully}x targets now support being run in parallel should
make decide to do so (e.g., via the -j flag)
* fix mats ignoring "rmg" parameter
* Update travis-ci build scripts to use new partialx target and run multiple
jobs in parallel, based on the number of processors available.
* Add a way to only run particular machines in travis-ci by including
a line that starts with "travis:only:" and lists the machine types in the
commit message.
Lazy require benefits from using a lock on a namespace registry for
much the same reason as on-demand instantiation of ready modules. Make
lazy require use the lock that's alerady in place for on-demand
instantiation, and expose `namespace-call-with-registry-lock` for
other potential uses.
Thanks to @m4burns for tracking down the problem and its solution.
Related to #3805
It's not clear how many of these combinations work right now, but they
should be close, and the intent is that they're supported. I
succcessfully built for FreeBSD on AArch64 and Chez Scheme for NetBSD
on PowerPC32.
Replace lots of mostly-duplicated "Mf-<platform>" and "<platform>.def"
files with just a few "Mf-unix" and and "unix.def" files plus
configuration within "configure" and "workarea". Also change
"version.h" to infer more OS details (as was used for pb, anyway).
This change simplifies setting up configurations for different
platforms, and it makes it easier to share among similar
configurations.
Document the fact that `prop:object-name` takes precedence for the
`object-name` result, and make printing also use `object-name` instead
of the propcedure's name when they're differet.
Also, repair constructor-style printing of a transparent structure
type that has `prop:object-name`.
Closes#2585
Link "liblz4.dll" with the right LZ4 library for /MT mode. It looks
like VS 2017 links anyway, but VS 2015 (and probably earlier) does not
link with the wrong library.
In a normal build, "liblz4.dll" is not needed, but it's linked in case
it turns out to be useful to compress or decompress boot files. A
normal build will construct boot files with the intended final
compression, at least when all the right flags are passed around to
the right places.
The inlined version of `in-value` in a `for` form did not bind the
left-hand identifier at the right layer relative to other bindings in
`for/fold`, which caused the inlined `in-value` to behave differently
than a non-inlined `in-value`. Confusing about this `in-value`, in
turn, had led to incorrect documentation on `for/fold`.
It would be nice to clean up a little more of the evaluator and
availability of bindings in `for/fold`, but doing so runs a
significant risk of breaking existing code (unlike fixing `in-value`,
which behaved even worse and where the repair seems less likely to
break existing programs).
Closes#1659 (again)
Add a `#:permissions` optional argument that is a permissions integer
in the same style as `file-or-directory-permissions` and that is used
when a file is created. On Unix, the given permissions are combined
with the process's umask.
Closes#1654
Making `syntax-local-lift-require` during `#%module-begin` expansion
provides a solution to a long-standing problem with composing
languages via `#%module-begin`, where the bindings of some lanuage
should be made available for expanding the module body by
`#%module-begin` expansion (i.e., the language is *not* the initial
import). If the language does not support `require`, then there was no
way to expand and expose the language import dependency.
Closes#1352
Set the source location of a function call that implements an indirect
import to be the original identifier, so a use-before-definition error
has the right location.
Closes#1324
As noted by @rmculpepper, using an underlying input port as an evt to
indicate more SSL input is not right if data can be pumped from the
underlying input port meanwhile. This commit uses progress evts (real
or synthesized) to avoid that problem.
[The commit include more whitespace changes than I'd normally like,
but it seems like some past tabify went wrong.]
Closes#3804
Match BC's long-standing behavior of only flushing the original output
and error ports on input from the original input port when the output
and/or error port is a terminal port.
During the time that the procedure in a guard-evt is called by `sync`,
it's possible for the `sync` evt choice to become determined. If the
guard-evt procedure then returns a choice-evt, the BC implementation
of `sync` could lose track of the selected evt; the selection is
represented by an index, and choice-evt splicing can shift indices.
Possibly related to #3004
Although retaining the original stream argument to `stream-ref`,
`stream-tail`, or `stream-take` can enable a better error message if
the stream runs out of elements too soon, it can also interfere with
the intended memory use of a stream.
Closes#2870
Although commit 5b0f0cee23 was sufficient to make `rename-in` expand
to `rename` with srcloc for the original name, it turns out it did not
address a similar issue with `only-in` renaming.
Do so by supplying the original (not renamed) identifier syntax as the
`orig-stx` for `make-import`.
Now specifies that the ftype pointer parameter types - `(* ftype)` and
`(& ftype)` - actually require an `ftype-name` (i.e., the syntax
requires an identifier in that position). This clarifies the problem
encountered in issue cisco/ChezScheme#557 (although further examples
would be helpful, of course).
When a negative bignum is shifted right by a multiple of the bigint
bit size (which is 32), when a shifted-off bit is non-0, and when the
result would be a sequence of bigints with all 1 bits before rounding
to deal with the dropped bits, a carry that should have been delivered
to a new high bigint was dropped.
Closes#3794
The current output for `--help` is quite messy and hard to
navigate.
I added some indentation and spacing to make the document
easier to read. For example,
File and expression options:
-e <exprs>, --eval <exprs>
Evaluate <exprs>, print results
-f <file>, --load <file>
Like -e '(load "<file>")' without printing
The new layout is longer, but at least it is readable. It
might be better if we could move all the options to a man
page and only select a few common ones to put in `--help`.
Currently `(make-readtable #f #\a 'dispatch-macro)` produces the error
message
```
; make-readtable: expected procedure argument after symbol argument
; given: 'dispatch-macro
```
which is very confusing, because it sounds like `'dispatch-macro` is
incorrect, but it is in fact correct already.
This PR adjusts the error message to:
```
; make-readtable: expected procedure argument after symbol argument
; symbol: 'dispatch-macro
```
which is the convention that is already used when the mode argument is not given.
One effect of using rktio instead of fwrite is that Windows output
produces LF instead of CRLF. Writing CRLF is arguably more correct,
but it likely doesn't matter, and consistency with normal Racket
output is helpful.