Commit Graph

43189 Commits

Author SHA1 Message Date
Matthew Flatt
aec86a811d build guide: Chez Scheme for Racket is no longer in a separate repo
Closes #3762
2021-04-07 06:50:42 -06:00
Mike Sperber
922bab40b5 Add print-value-columns parameter. 2021-04-07 05:13:25 -06:00
Matthew Flatt
548aca02e7 configure and makesfiles: make code compression more configurable
Add a `configure` argument to enable even more compression in ".zo"
forms, and introduce environment variables to enable compression
control for Windows builds using MSVC.
2021-04-06 17:14:48 -06:00
Matthew Flatt
069e6d1417 cs: fix cross-compile non-code fasl compression
When cross compiling, use the same fasl compression mode as non-cross
compilation on linklet bundles --- instead of always compressing,
which slows down module loading in most environments.
2021-04-06 17:14:48 -06:00
Matthew Flatt
aaab0aca28 configure: unbreak --enable-compressboot 2021-04-06 17:14:48 -06:00
Matthew Flatt
1ad31fe559 cs: fix cross compile to omit RTD descriptions
This is another way that cross compilation differed from direct
compilation, overlooked before because it's an argumen to
`compile-to-port` instead of a parameter.
2021-04-06 17:14:48 -06:00
Matthew Flatt
185809bc2c doc typo 2021-04-06 17:14:48 -06:00
Matthew Flatt
e58a3d9dda cs: adapt (unused) Patricia trie implementation for negative hash codes
The hashing protocol has been adjusted since the Patricia trie
implementation so that the result can be negative. Force it to
avoid breaking an assumption in the Patricia-trie implementation
(even though this implementation is not currently used).
2021-04-06 17:14:48 -06:00
Philip McGrath
4d23c6da5a docs: "a inclusive-range application" -> "an" 2021-04-05 16:39:48 -06:00
sorawee
e8f857cc19
sequence & list: add in-inclusive-range and inclusive-range
Currently, a common way to generate an inclusive range is to
use `in-range`, but users need to figure out an appropriate
upper bound, which (1) is error-prone and (2) obscures the intention.
As an example, https://docs.racket-lang.org/pict/Animation_Helpers.html
uses `(in-range 0 1.2 0.2)` to generate `'(0 0.2 0.4 0.6 0.8 1.0)`.
It is also quite common to use `(in-range 1 (add1 n))` to generate
`(list 1 2 ... n)`. Both examples are subpar.

This PR adds `in-inclusive-range` as a counterpart to `in-range`, and
`inclusive-range` as a counterpart to `range`, to make inclusive range
construction easier.

An alternative API is to modify `in-range` to accept a keyword argument
like `#:inclusive? #t`, but this is more verbose and no other sequence
generating function accepts keyword arguments.
Therefore, I think `(in-)inclusive-range` is more appropriate.
2021-04-05 08:02:36 -06:00
Greg Hendershott
b7078dc272 provide-trampoline: Ensure expanded export id has srcloc
1. Forms like rename-out supply the original "export-id" syntax to
make-export as orig-stx, as well as the symbol value as out-sym. In
such a case -- that is, when (eq? (syntax-e (export-orig-stx export))
(export-out-sym export)) -- expand using orig-stx, retaining its
source location and other properties.

2. Otherwise, at least expand using out-sym as an identifier with
srcloc from orig-stx. Rationale: Although that source location might
not be exactly correct it is probably better than none at all.

Note: The spirit of this commit is to treat this as a private
implementation detail -- as opposed to stating some new official API
for renaming provide transformers in general -- so this commit doesn't
update documentation for e.g. `make-export`.
2021-04-05 08:01:41 -06:00
Matthew Flatt
612c1865de cs: ensure cross compile uses same configuration as non-cross
Some compiler settings were previously not carried over to
cross-compile mode, with the consequence that cross-compiled code was
slightly slower.
2021-04-04 15:12:11 -06:00
Matthew Flatt
7013cfb655 cs: configure MSVC Windows build to compress compiled code 2021-04-04 12:41:15 -06:00
Matthew Flatt
589f0e55e4 ffi/unsafe: repair cast from GCable pointer with offset
The repair in 601f4a76e7 did not correctly handle pointers with a
non-zero offset.

Thanks to Bruce O'Neel for the report.
2021-04-04 11:19:12 -06:00
Matthew Flatt
d3f3be5dc5 sqlite3: in ffi, fix _ptr arguments to #:blocking? #t functions 2021-04-04 08:30:43 -06:00
Matthew Flatt
ed8019742c ffi/unsafe: add optional malloc mode to _ptr and _box
The optional mode is probably most useful when 'atomic-interior is
needed in combination with a `#:blocking? #t` function.
2021-04-04 08:24:06 -06:00
Matthew Flatt
dcaf358c64 cs: add malloc support for 'interior mode
Since immobile vectors now exist at the Chez Scheme level, it's easy
to support 'interior mode (similar to 'interior-atomic).
2021-04-04 07:51:34 -06:00
sorawee
725710e445 doc: fix minor typo in stx-serialize.scrbl 2021-04-03 08:24:22 -06:00
Sorawee Porncharoenwase
bad1c016f6 doc: more racketvalfont changes
A follow-up change to #3751
2021-04-03 07:32:44 -06:00
Matthew Flatt
601f4a76e7 ffi/unsafe: fix cast from _bytes to _pointer
The `cast` function is supposed to auto-promote its second argument to
a GCable type if the value to convert is a GCable pointer. This
promotion did not happen for `_bytes` and other string-like types.

Also, in CS, `malloc` did not alocate GCable memory by default when
given the `_bytes` type, which would sometimes interfere with getting
a GCable pointer result.

This bug explains why the "draw-test/tests/racket/draw/dc.rkt" test
would occassionally have an `unscaled-alpha-set` failure on DrDr (for
many years).
2021-04-02 10:32:40 -06:00
Matthew Flatt
181b9c80ac add syntax-serialize and syntax-deserialize
The new functions provide a more direct way to serialize and
deserialize syntax objects than compiling and running a `quote-syntax`
form. The new functions also offer additional configuration related to
preserving extra syntax properties and limiting the use of shared
"bulk binding" tables (i.e., tables that must provided by module
declarations in the namespace).

This change does not add syntax-object support to `serialize` or
`s-exp->fasl`, because serialized syntax objects are still in many
ways like code: they are version-specific, and their invariants can be
broken by mangling the serialized form (in much the same way that
compiled code can be broken by mangling, and with similar safetly
implications).
2021-04-01 08:05:51 -06:00
Matthew Flatt
2606ae3d8e raco pkg: add support for "git+http[s]://" package sources
When referring to a Git repo with a "https://" URL, the URL must end
with ".git" to distinguish the URL for directory and file URLs. A
"git+https://" URL specifies that the Git-over-HTTP protocol should be
where the URL cannot contain ".git". For example, SourceHut URLs do
not include ".git" (while hosting services like GitHub or BitBucket
allow ".git" to be in the URL).

When using `raco pkg`, it was possible to specify `--type git` for an
"https://" reference, but for consistency and internal tracking, a
".git" would be added to the URL, anyway. Using `--type git-url` can
similarly force the interpretation of an "https://" reference without
triggering the addition of ".git". The new state is mostly internal,
but it is reflected in the output of `raco pkg show`, which shows
`git` for such references (as opposed to `url` as shown for others).
2021-03-31 13:29:42 -06:00
Matthew Flatt
45ecb8a99d add some tests for raise-arguments-error 2021-03-31 13:29:42 -06:00
Sorawee Porncharoenwase
744e51ecfc doc: use racketvalfont to make the display correct 2021-03-31 10:46:15 -04:00
Ryan Culpepper
9a4f9688ad db: fix custom functions for blocking sqlite3_step change
Also fix error reporting for aggregate functions.
2021-03-30 10:15:12 +02:00
Ryan Culpepper
d65e648d6a db: mark sqlite3_step and sqlite3_prepare* as blocking
This allows the GC to run during these ffi calls. It is probably only
worth marking often-used, potentially long-running calls.
2021-03-30 09:06:35 +02:00
Bogdan Popa
013368188c xexpr,doc: add history notes for {current,html}-unescaped-tags 2021-03-29 11:38:16 -04:00
Bogdan Popa
6535f4f2b8 xexpr: add current-unescaped-tags to disable escaping for certain tags 2021-03-29 11:38:16 -04:00
Bogdan Popa
1a1018d9fe rumble,error: fix error case when given a field with no value
Closes #3744
2021-03-29 07:03:38 -06:00
Matthew Flatt
b320a1a114 test repair related to spurious CAS failure 2021-03-28 20:25:45 -06:00
Matthew Flatt
920e3dbde5 cs: repair async-apply handling for foreign callbacks
The CS implementation was missing a level of indirection. It worked
for a typical handler `(lambda (thunk) (thunk))` for the case when the
callback can run atomically, but it did not work for caces where
`thunk` is made to run later (potentially out of atomic mode).

Also, fix the management of interrupt state, including for some place-
and future-related asynchronous callbacks.

Thanks to @rmculpepper for the `async-apply` report, new `async-apply`
tests, and the repair for the interrupt-state bug.
2021-03-28 20:18:56 -06:00
Matthew Flatt
8668ad6959 docs: correction on register-external-file 2021-03-27 09:02:32 -06:00
Matthew Flatt
e31003b0ad racket/stream: unbreak chained lazy streams
The new implementation attempting to collapse lazy streams was broken.
2021-03-27 08:23:55 -06:00
Matthew Flatt
a5615a7bae racket/stream: add more control over laziness
Add `#:eager` options to `stream-cons` to control whether the head
and/or tail expression is delayed. Also add `stream-lazy` to
explicitly construct a lazy stream and `stream-force` (normally not
needed) to force a stream.

Delayed expressions in `stream-cons` are now non-reentrant, like
promises created by `delay`. This is a change in behavior, but I'm
hoping that no one relied on the old behavior, which has the bad
property that the delayed expression is retained until its result is
received.

For consistency, this commit also changes `stream*` to delay the
stream-construction expression when its the only one expression that
is given.

Internally, changes to the stream implementation reduce allocation.

The `stream-lazy` form would be more natrally called `stream-delay`,
but that creates a conflict with existing packages.
2021-03-26 19:52:42 -06:00
Matthew Flatt
4704dc6962 makefile: fix RACKET_FOR_BOOTFILES 2021-03-26 10:43:40 -06:00
yjqww6
4328b3acdb fix signatures of $fx+? and $fx-? 2021-03-26 15:07:51 +08:00
Alex Knauth
5c2949d051
add make-struct-type-property/generic and make-generic-struct-type-property (#3627) 2021-03-25 19:44:40 -04:00
Matthew Flatt
ca7404f2e3 docs: PLT_SETUP_OPTIONS as makefile variable
Although setting `PLT_SETUP_OPTIONS` as an environment variable works
for the makefile created by `configure` in a source distribution, it's
better used/described as a makefile variable.

Closes #3735
2021-03-23 17:33:46 -06:00
Matthew Flatt
c7b40ee2a4 makefile: clone single pb branch by default
Another try at the commit reverted by 471f18c02d, but this time with a
`SINGLE_BRANCH_FLAG` makefile variable that can be set to turn it off
for the rare system that has Git older than version 1.7.10.
2021-03-23 17:28:46 -06:00
Matthew Flatt
cd2d5f0ac7 cs: fix some error-message formatting
Some Chez Scheme error messages were not converted correctly,
leaving the values to be printed by Chez Scheme's printer.
2021-03-23 16:41:30 -06:00
Brian Adkins
f65560ed4c Optimize when sep is unspecified or the default regexp 2021-03-23 16:16:07 -06:00
Brian Adkins
754b3457c3 Verify the argument is a string?
For the fast path of splitting on whitespace, verify the str
argument is a string, so that internal-split will handle the
invalid argument error.
2021-03-23 16:16:07 -06:00
Brian Adkins
d061df81ce Optimize splitting strings on whitespace
Use an optimized function, instead of regexp-split, when string-split
is called with the default separator and trim setting.
2021-03-23 16:16:07 -06:00
Matthew Flatt
2a718d8162 Chez Scheme: repair for cross-library inlining
The cross-library inlining improvement in commit 6020b944ef did not
manage internal names correctly, and it could mix up bindings that
have the same printed form.

Closes racket/ChezScheme#35
2021-03-23 15:33:10 -06:00
Matthew Flatt
281eed7dda Chez Scheme: fix some typos 2021-03-23 13:42:05 -06:00
Gustavo Massaccesi
61cca93086 Chez Scheme: improve eq[v]? reductions in cptypes
Improve eq? and eq? handling to reduce expressions like
(eq? (newline) (void)) => (begin (newline) #t)
2021-03-23 15:14:56 -03:00
Gustavo Massaccesi
355b9f51be Chez Scheme: fix too much propagation of numbers in cptypes
In this example, after the check with eq? or eqv? the value of
the variables x and y are known, so cptypes replaced the
reference to the variable with it. But it can interact badly
with the eq? test, for example in this case the first (eq? x y)
can be #f and the second be reduced by the compiler to #t.

In spite eq? cannot be used to compare numbers reliably, this
behavior is too confusing and it's better to avoid it.

(define (one)
  (let ([r (random 2)])
    (if (= r 0) (one) r)))

(define (f x y)
  (define first-comparison (eq? x y))
    (when (and (eqv? x 7.0)
               (eqv? y 7.0))
      (define second-comparison (eq? x y))
      (eq? first-comparison second-comparison)))

(f (+ 6.0 (one)) (+ 6.0 (one)))))
2021-03-23 15:14:56 -03:00
Matthew Flatt
ef0ff679d0 correct some hash-table locking cases
BC did not take a lock for `hash-clear!`. Maybe the intent was that a
lock isn't needed from the perspective of `hash-clear!` when it isn't
traversing the table, but failing to take a lock before modifying the
table can break other operations (that do take a lock) in progress.
Furthermore, some iterations that intentionally did not take a lock
also did not guard against changes well enough. Various repairs here
avoid crashes, and now `hash-clear!` consistently takes a lock.

CS had a similar (but more subtle and more limited) instance of the
problem in `hash-map` and `hash-for-each`. That problem is corrected
(without adding any new lock acquisitions).

The existing CS implementation of `equal-hash-code` for hash tables
takes a lock more than the BC implementation. A possibly surprising
result: when attempting to add a mutable hash table to itself as part
of a key, the `hash-set!` can block forever on the hash table's lock,
instead of doing something more random as a result of having a mutated
key. The documentation now notes that possibility.

Related to #3738
2021-03-21 13:03:17 -06:00
Matthew Flatt
bcd16840da docs: note in flsingle about its use for single-precision operations
Add some reassurance that `flsingle` can be used to implement
single-precision arithmetic.
2021-03-21 12:46:01 -06:00
Ryan Culpepper
8bf8e3cf82 db: fix error case for disconnect in lock 2021-03-20 18:27:55 +01:00