Commit Graph

42958 Commits

Author SHA1 Message Date
Ismael Luceno
44964359ae Chez Scheme: fix missing include in externs.h
The correct header is needed to build with musl.
2021-03-12 19:50:40 -07:00
Robby Findler
288d13b85a add blame-replaced-negative? 2021-03-11 17:02:53 -06:00
Gustavo Massaccesi
3d04b71ced Chez Scheme: add maybe-char to cptypes
chars are immediates, so the previous change doesn't add automatically
the combinations like maybe-char. Add also eof/char that is commonly
used and has the same problem.

And rename in ctypes the internal symbol $immediate/true to
true-immediate because in all the other instances / is used for unions.
2021-03-10 14:27:00 -03:00
Matthew Flatt
8ba89cbd2a Chez Scheme: avoid floating-point register shuffling on x86_64
For floating-point arithmetic, encourage the register allocator to use
the same register for an argument and destination in arithmetic.
2021-03-09 17:36:21 -07:00
xxyzz
c9956aceae mv get/build-val-first-projection & get/build-late-neg-projection doc
close #2883
2021-03-09 11:21:47 -06:00
Matthew Flatt
5a2b6aab1e Chez Scheme: update docs for expand/optimize and run-cp0
Mention that it runs cptypes.
2021-03-08 09:55:45 -07:00
Matthew Flatt
75ba7ff5bc cptypes: discard call form around an error, better cm support
An an example of better error handling,

 (f (error 'x "x") y x)

turns into

 (error 'x "x")

which may allow further propagation through `begin` and `if` as
alerady implemented.

Also, make cp0 and cptypes more aware of
`call-{setting,getting,cosuming}-continuation-attachment` in terms of
result types and single-valuedness. The single-valued part requires
some generalization to the existing `single-valued?` support (by
default, "single-valued" => "doesn't inspect/changed immediate mark")
in both cp0 and cptypes.

Finally, the "optimize.rktl" test suite is now enabled for Racket CS.
The tests helped expose some missed opportunities and bugs, and it
should be particularly helpful going forward, since we're back to
having a place for Racket-level optimization tests. Not all tests
written for BC pass with CS. Grep for 'chez-scheme for missed
optimization opportunities.
2021-03-08 09:10:18 -07:00
Matthew Flatt
73eeff4f60 fix problems with continuation-mark-key chaperones
CS: When `with-continuation-mark` for a chaperoned key is in tail
position for a mark (such as a `parameterize`), make sure the existing
mark is still in place while (non-tail-)calling the chaperone's
interposition function.

BC: Don't collapse immediately nested `with-continuation-mark`s for
the same key if the key might be chaperoned. Also, repair treatment of
module-level bindings as potentially chaperoned.
2021-03-07 20:08:49 -07:00
Matthew Flatt
87d84a59c1 cs & schemify: cptypes-nice inline of authentic access and mutate
Change schemify to inline accessors and mutators of authentic
structure types in a way that lets cptypes eliminate checks for
subsequent operations.
2021-03-07 19:11:21 -07:00
Matthew Flatt
9651b45c83 cs & schemify: fix inlining that fold to #f
When the schemify inliner tries to inline, and inlining is supposed to
succeed with a result expression `#f`, the #f was being treated as a
failure to inline.
2021-03-07 16:55:18 -07:00
Philip McGrath
e45cd87511 version/check: use https; actually enforce timeout; guard reading params
Also, add an environment variable for testing purposes
and document the fact that `check-version` may block.
2021-03-07 11:12:57 -05:00
Matthew Flatt
727cd1ca9f raco demod: report that it works only on BC
Closes #3706
2021-03-07 07:58:32 -07:00
Bogdan Popa
81e0c86fc3 pkg: show bad deps in check-dependencies 2021-03-07 07:37:42 -07:00
yjqww6
b4d05e7a41 add [unsafe-]assert-unreachable 2021-03-07 06:48:50 -07:00
Matthew Flatt
fac8463082 cs: fix raco exe for OpenBSD
The repair involvea adding a `-E` flag to Racket for use by the wrap
executable that `raco exe` created, because OpenBSD (intentionally)
does not have a way to access the executable file of the current
process.

Closes #3717
2021-03-07 05:03:50 -07:00
Matthew Flatt
a3bf702ac9 cs & io: fix simplify-path for 'up relative to a root
Closes #3716
2021-03-06 09:37:10 -07:00
Matthew Flatt
07c7ff51ff repairs for NetBSD 2021-03-06 09:37:10 -07:00
xxyzz
d03456b55e
Skip keywords in invalid-option-placement (#3621)
Close #3603

* skip keywords in invalid-option-placement
* replace check-duplicate with check-duplicates
* add skip keywords test
* add require and fix syntax-e error
* update comment of invalid-option-placement
* add mixture keywords and arguments test
* forget to skip keyword in loop
* and another two tests for syntax-parse
* define splicing-formals-no-rest as @Metaxal suggested
* add formals link
* rename splicing-formals-no-rest to formals-no-rest
* add attributes to formals
* remove racket/dict import
2021-03-06 00:55:52 +01:00
Fred Fu
1484b35516
doc: improve the documentation for generic interfaces (#3701)
* doc: improve the documentation for generic interfaces

1. fix the doc on define/generic
2. make the use of `define/generic` necessary in the example code
2021-03-04 15:45:01 -05:00
Matthew Flatt
076426e796 unbreak unzip
Commit 71b7f21fdb changed the scope of a shadowing binding.
2021-03-03 09:29:10 -07:00
Matthew Flatt
a5b61f7ac8 unzip: add option to insist on a zip archive
The fact that a non-zip archive has always been silently ignored seems
bad, but adding an error might break code that (probably accidentally)
relies on the behavior. This change makes sane behavior at least
available by adding a `#:must-unzip?` option.

Relevant to #3613
2021-03-03 09:07:06 -07:00
Matthew Flatt
71b7f21fdb unzip: avoid blocking on break exception
The `dynamic-wind` that causes problems dos not appear to be needed.

Closes #3703
2021-03-03 08:20:41 -07:00
Matthew Flatt
1e56ca9cc1 treat uname result as locale encoding instead of UTF-8 2021-03-03 07:06:07 -07:00
Philip McGrath
261d73abdb racket/src/cs/c/Makefile.in: use $(SHELL) rather than hard-coded /bin/sh
This change facilitates building in environments where `/bin/sh` is not
available, such as Nix and GNU Guix.
The GNU Autoconf manual lists several additional systems where `/bin/sh`
is either missing or not POSIX-compliant:
https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.70/html_node/The-Make-Macro-SHELL.html

Related to https://github.com/racket/racket/issues/3707
2021-03-03 07:04:51 -07:00
Philip McGrath
fdb2ad7892 Chez Scheme: avoid hard-coded paths for utilities in build scripts
These changes facilitate building Chez Scheme in environments where
utility commands are not available at their usual absolute paths,
such as Nix and GNU Guix.

Specific changes:
  - `cc` -> `$(CC)`
  - `/bin/rm` -> `rm`
  - `/bin/ln` -> `ln`
  - `/bin/cp` -> `cp`
  - `/bin/echo` -> `echo`
  - in `makefiles/installsh`, add a case to find `true`
    at an unusual path or as a shell builtin

Related to https://github.com/racket/racket/issues/3707
2021-03-03 07:04:51 -07:00
Matthew Flatt
5114fec2c7 file/resource: support REG_EXPAND_SZ
Also, provide workarounds for some broken conversions --- especially
the 'string/utf-16 conversion for reading. For writing, allow
specifying raw bytes that end up in REG_SZ or REG_EXPAND_SZ via
'bytes/string or 'bytes/expand-string.
2021-03-03 06:41:16 -07:00
Matthew Flatt
e615294e78 change (system-type 'machine) to use C-library uname
Thanks to @LiberalArtist for pointer out that uname(3) exists!

Related to #3707
2021-03-02 17:33:27 -07:00
Matthew Flatt
afe522ab9c find-executable-path: avoid conversion of PATH to string
Send bytes directly to `path-list-string->path-list`, since it can
handle bytes and convert directly to paths. Also check that the
argument to `path-list-string->path-list` has no nul character or byte.
2021-03-02 15:51:53 -07:00
Gustavo Massaccesi
421dce228d Chez Scheme: add maybe predicates to cptypes
Actually, use a more general decomposition with a part for an
$immediate, a part for a $record and a third part for other types
like string?, vector?, ...

This is not as general as an arbitrary union, but it is enough for
the common cases, and also to handles the common objects in Racket
that are implemented in CS as the corresponding object and a record
for the impersonator.
2021-02-28 17:05:20 -03:00
Matthew Flatt
37ee8a793c Chez Scheme: make "immediate" consistently mean type-immediate
Exposing `$immediate?` as just "immediate" will be useful to cptypes.
Meanwhile, introduce "fixmediate" as the term for a union of "fixnum"
and "immediate" (i.e., values that are not allocated).

The new terminology helps avoid internal inconsistencies, such as the
`Simmediatep` kernel macro meaning "immediate" while the `$immediate?`
primitive meant the union.
2021-02-28 08:45:17 -07:00
Matthew Flatt
04e78c4bb7 repair handling of PLTCOMPILEDROOTS
Commit a110c58e52 broke the interaction with `PLTCOMPILEDROOTS`.
Instead of reverting to the old behavior that coerced 'same to a path,
this change makes `path-list-string->path-list` a little more
flexible.

Closes #3704
2021-02-27 19:16:21 -07:00
Matthew Flatt
2b79ba6d4f add ephemeron hash tables
Weak hash tables retain keys weakly, but they hold each corresponding
value strongly as long as the key is accessible. As a result, weak
hash tables suffer from the key-in-value problem: if the value refers
to the key, the key cannot become inaccesible and be removed from the
table.

Previously, the way around that problem was to map a key to an
ephemeron that combines the key and value. The extra cost of involving
ephemerons (a constant factor) is why ephemerons storage is not the
default behavior of weak hash tables.[*] Having ephemeron hash tables
as a distinct variant avoids imposing a cost where its not needed, and
compared to using explicit ephemerons, it's easier to drop into a
program that was written to use strong or merely weak hash tables.

For Racket CS, the change is especially straightforward, because
ephemeron tables already exist in Chez Scheme (at least for the Racket
variant, in the case of eqv- and equal-based tables).

[*] Also, non-emphemeron hash tables turn out to be needed for certain
    finalization tasks.
2021-02-27 19:08:05 -07:00
Matthew Flatt
c89f885578 Chez Scheme: fix test involving CAS
Replace an unnecessary `box-cas!` in a test with `set-box!`. The use
of `box-cas!` was wrong in that it didn't accomodate a spurious CAS
failure.
2021-02-27 12:20:09 -07:00
Matthew Flatt
be7c7755b2 struct: syntax error for #:prefab plus #:authentic
Prior to this change, the combination was documented as a syntax
error, but it was only a run-time error --- and not even that as of
v8.0 for Racket CS (but it was always a run-time error for BC).

Closes #3700
2021-02-26 16:58:31 -07:00
Matthew Flatt
6ae0417468 docs: explain why not to use byte-ready? 2021-02-26 14:50:19 -07:00
Matthew Flatt
999c300f7f cs: fix byte-ready? on the result of make-input-port
When an evt is returned by the byte-peeking function, the evt needs to
be polled.

Relevant to racket/datalog#13
2021-02-26 11:34:05 -07:00
Ryan Kramer
0841af7992 add tests and scribble documentation for XML indentation 2021-02-26 09:24:31 -05:00
Ryan Kramer
a5f95a4a41 adding different indentation to XML 2021-02-26 09:24:31 -05:00
Matthew Flatt
0ab75d1675 read: avoid quadratic-time string->number integer conversion
For bases other than powers of 2, I think reading is at least
O(n^1.58), due to multiplication with Karatsubra --- but that turns
out to be a lot faster than O(n^2) by the time you get to 1M digits.
For powers of 2, the time should be linear.
2021-02-25 14:58:02 -07:00
Matthew Flatt
70c763833d repair collection-file-path and default current-compiled-file-roots
The `collection-file-path` function did not handle compiled-file root
paths correctly. The problem was exposed by a recent change to the
default for `current-compiled-file-roots`, which made it match the
documentation, but this commit changes it back and fixes the
documentation.
2021-02-25 13:31:17 -07:00
Cameron Moy
7f34da35e7 Fail random generation of range contracts with bad bounds 2021-02-25 11:34:00 -06:00
Matthew Flatt
f1fb22f0a7 Chez Scheme: faster bignum printing for power-of-two bases
Insteda of using the generic strategy that involves division, walk
through the bits of a bignum to convert to a power-of-two base.
2021-02-25 06:35:46 -07:00
Matthew Flatt
c2b46b1e96 Chez Scheme: Burnikel-Ziegler division for very large integers
Adapted from Peter Bex's Scheme version of CHICKEN's implementation
here:
 https://www.more-magic.net/posts/numeric-tower-part-3.html

Improving dvision has a large effect on printing large integers in
base 10, such as printing `(expt 2 8000000)`.
2021-02-25 06:35:46 -07:00
Matthew Flatt
35116f6015 Chez Scheme: improve multiplication with trailing 0s
Multiplying bignums with trailing 0s is common enough to be worth a
special case.
2021-02-25 06:35:46 -07:00
Matthew Flatt
0cb9643fcb Chez Scheme: improve multiplication and scheduling
Raise the threshold for using Karatsuba. The experimentally determined
threshold (on an M1 Mac) matches the GMP default threshold, so that
seems like a good sign.

Also, adjust kernel bignum operations to decrease the trap counter.
Otherwise, a program that performs many big multiplcations or
divisions does not check for Ctl-C or swap threads often enough.
2021-02-25 06:35:46 -07:00
Cameron Moy
c8bc0c76ad Improve flat-murec-contract with random generation 2021-02-24 15:51:45 -06:00
Matthew Flatt
18435e3a08 cs: fix interactio of unsafe capture and barriers
Fix `unsafe-call-with-composable-continuation/no-wind` so that it's
not blocked by a barrier, since it's supposed to have thread-like
capturing ability.

Closes #3696
2021-02-23 13:03:39 -07:00
Matthew Flatt
fff39d0306 Chez Scheme: fix expected-error log
Repair after commit 0523a5311c.
2021-02-23 13:03:39 -07:00
Fred Fu
12dbfeb58a doc: fix contract for read-bytes-avail!/enable-break 2021-02-23 11:30:05 -07:00
Patrick McCarty
3fa362566c guide: fix a grammatical issue
`into to` -> `into`
2021-02-23 11:29:08 -07:00