Commit Graph

42498 Commits

Author SHA1 Message Date
Bogdan Popa
ec1f11e18e match: implement and*' in terms of andmap' 2020-11-24 10:00:43 -05:00
Bogdan Popa
7bb2cad8db match: improve elimination of unused bindings 2020-11-24 10:00:43 -05:00
Bogdan Popa
88db31f46d match: preserve stx loc of original app expr 2020-11-24 10:00:43 -05:00
Bogdan Popa
bdef494c8c match: preserve source location in constant-pat predicate applications 2020-11-24 10:00:43 -05:00
Bogdan Popa
0f5ba032bf match: ensure entire `body' is traversed when eliminating unused temps 2020-11-24 10:00:43 -05:00
Bogdan Popa
21cd97f2b2 match: stop searching for unused tmps when all have been found 2020-11-24 10:00:43 -05:00
Bogdan Popa
684a1f1039 match: eliminate field refs due to _ in constructor patterns
Related to #3487.
2020-11-24 10:00:43 -05:00
Matthew Flatt
403ef87ec2 bc: upgrade to libffi 3.3 2020-11-24 07:19:41 -07:00
Matthew Flatt
71ffa2bcb6 doc: clarify intent of CS C-to-Racket calling API 2020-11-23 11:54:04 -07:00
Matthew Flatt
31d0c07d37 rktboot: fix confusion between compile-time and run-time fixnums 2020-11-23 09:55:39 -07:00
Matthew Flatt
318d3e0a9f Chez Scheme: implementation notes on adding functions
Also, explain primitives and entries, which helps make sense of
definitions like

 (define set-car!
   (lambda (p v)
     (#2%set-car! p v)))
2020-11-23 08:32:22 -07:00
Matthew Flatt
71d86bd3a3 cs: unbreak MSVC build 2020-11-23 06:54:01 -07:00
Matthew Flatt
c52113397c Chez Scheme: add weak generic hash tables
Implement weak and ephemeron generic hashtables, and repair weak and
ephemeron `eqv?` hashtables to be weak on numbers.

Racket's implementation of weak `equal?`-based tables now uses weak
generic tables. Datum interning, which needs a weak `equal?`-based
table and was the bottleneck for unfasling literal data, is much
faster. DrRacket's footprint is 1% smaller.
2020-11-23 06:43:49 -07:00
Matthew Flatt
60e9245390 cs: tweak implementation of keyword intern table 2020-11-22 16:12:17 -07:00
Matthew Flatt
3b1f457375 tweak case fixnum-only dispatch
Use `fixnum?` instead of `fixnum-for-any-platform?` when
only fixnums-on-any-platform are relevant.
2020-11-22 15:53:44 -07:00
Matthew Flatt
8751e5b75f Chez Scheme: fix $describe-fasl-from-port with cycles 2020-11-22 15:21:44 -07:00
Matthew Flatt
3ccb523f1a Chez Scheme: unbreak eq? hash on 32-bit platforms 2020-11-22 13:06:08 -07:00
Matthew Flatt
4b39dc73be cs: restore -natipkg in system-library-subpath result 2020-11-22 11:37:00 -07:00
Matthew Flatt
380550a858 cs: unbreak zo-marshal 2020-11-22 10:18:20 -07:00
Matthew Flatt
5ca183a710 cs: improve eq? hashing
Use the fixnum-mixing idea of dc82685ce0 on pointers, too.

This change provides a significant improvement on the "hash-mem.rkt"
benchmark, for example, because the allocated objects have a size that
triggers a repeating pattern in the low bits of the allocated address.
2020-11-22 09:46:30 -07:00
Matthew Flatt
f07c2fea71 cs: simplify and improve handling of literals
Use data instead of code to shrink ".zo" sizes by 10-30%.

When Racket code contains a literal that cannot be serialized directly
by Chez Scheme (such as a keyword or an immutable string that should
be datum-interned), the old approach was to generate Scheme code to
construct the literal through a lifted `let` binding. To handle paths
associated with procedures, however, Chez Scheme's `fasl-write` had
been extended to allow arbitrary values to be intercepted during fasl
and passed back in to `fasl-read`. Using that strategy for all Racket
literals simplifies the implementation and reduces compiled code. It
also makes closures smaller, while increases the number of
relocations. DrRacket's foorprint shrinks by about 1%, but the main
affect is on disk space for a Racket installation.
2020-11-22 06:02:40 -07:00
Matthew Flatt
b2a27ef05c cs & raco decompile: expose more fasl content
Show the machine code that constructs lifted constants for a linket.

Also, add a `--partial-fasl` option that shows fasl content in a rawer
form, which is useful for checking how content is presented and that
nothing is getting lost in other reconstructed views.
2020-11-21 07:26:08 -07:00
Matthew Flatt
a6e683cc71 bc: fix incomplete update for 'os* and 'arch reporting 2020-11-20 15:35:58 -07:00
Matthew Flatt
39d5adc745 system-type: add 'os* and 'arch modes
The 'os* mode is like 'os, but it provides a more specific result for
Unix variants, such as 'linux on Linux.

The 'os* and 'arch modes together are the information that we've
previously accessed indirectly via `(system-library-subpath #f)`.

Closes #3510
2020-11-20 15:11:52 -07:00
xxyzz
153e417862 generate GitHub Action file for raco pkg new 2020-11-20 10:15:26 -05:00
Matthew Flatt
d88ae7911d Chez Scheme: update expected-error test for cp0 repair
Commit 3b7378f071 turns out to have fixed the error message for an
existing tests (that I didn't notice was wrong before).
2020-11-20 07:41:35 -07:00
Gustavo Massaccesi
b9e1294b19 cptypes: add special case for zero? 2020-11-20 00:25:25 -03:00
Gustavo Massaccesi
cdfa80bde9 cptypes: add suport for bignum? 2020-11-20 00:23:29 -03:00
Matthew Flatt
3b7378f071 Chez Scheme: cp0 repair for fx{+,*}/overflow with identity
Using folding approach for `fx+` caused cp0 to convert `(fx+/overflow
x 0)` to `(fx+/overflow x)`, but two arguments are required.
2020-11-19 19:59:03 -07:00
Matthew Flatt
f34ff31aef cs: improve equal-hash-code
Mixing for sequences did not produce enough variety related to the
length of the sequence. For example, '(0 0) and '(0 0 0) and '(0 0 0
0) had the same hash code.
2020-11-19 19:21:34 -07:00
Matthew Flatt
d1a61e5ab5 Chez Scheme: mark fx{+,-,*}/wraparound as safe on good args
Allow cptypes to convert a `fx{+,-,*}/wraparound` call to unsafe if it
proves that the arguments are fixnums (unlike, say, `fx+`, where the
possibility of overflow remains).
2020-11-19 16:56:28 -07:00
Dominik Joe Pantůček
14a380bd49
net-lib/ftp upload and download enhancement
Allow using ports with ftp-download-file and ftp-upload-file.
2020-11-19 15:10:58 -07:00
yjqww6
6075923a45 add fast path for rename-in 2020-11-19 15:08:54 -07:00
Matthew Flatt
b5a9fbb03d cs: use wraparound functions for hashing
Change hash-code calculations to use `fx+/wraparound` and
`fxsll/wraparound` instead of `#3%fx+` and `#3%fxsll`. The resulting
code should be the same in the default unsafe compilation mode for the
Racket core, but the `wraparound` versions can be checked in safe
mode.

Also, fill in missing tests in Chez Scheme, which exposed cp0 problems
with `fx-/wraparound`.
2020-11-19 12:38:16 -07:00
Matthew Flatt
53c14c78d6 bc: fix C compiler warnings 2020-11-18 18:15:42 -07:00
Matthew Flatt
77ee4bb877 fix read-line-evt on a port that delivers bytes one at a time
Thanks to Javier Vivanco for the report.
2020-11-18 17:39:18 -07:00
Matthew Flatt
128892c996 add fx{+,-,*,lshift}/wraparound
Expose machine-level operations that stay within the fixnum range,
which can be useful for things like hash-code computations where it's
ok to just lose bits. Operations like `unsafe-fx+` turn out to do that
already in the current implementation, but with no guarantee (and with
no checking of arguments).

For Racket BC, before this commit, JIT-inlined `fxlshift` incorrectly
handled a negative second argument like `arithmetic-shift` instead of
erroring.
2020-11-18 17:39:18 -07:00
Sam Tobin-Hochstadt
bec35108b4
Increase hash-mem timeout. 2020-11-18 13:03:35 -05:00
Matthew Flatt
9a3eb15d8b cs & thread: fix scheduler timer event in atomic mode
When the thread-scheduler timer fires while a thread is in atomic
mode, the thread could check for breaks even when it shouldn't. Worse,
if the atomic region was to implement terminating a thread, the path
to check for a break could end up ressurecting the thread from the
persspective of `thread-dead?`.
2020-11-18 04:10:06 -07:00
Matthew Flatt
b28d682ec4 reference: correct some details on reader syntax for characters
Closes #3506 and #3507
2020-11-17 13:12:18 -07:00
Paulo Matos
4268091c7b Remove deprecated set-env directive from CI files
set-env were removed due to security concerns.
https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/
2020-11-17 06:51:30 +01:00
Paulo Matos
5dd687b77d
Check that user correctly regenerated build.md (#3505) 2020-11-17 06:38:37 +01:00
kurinoku
3f9f01e520 Fix mutator listing in struct-auto-info. 2020-11-16 12:42:07 -05:00
Matthew Flatt
117f22e3d6 render build guide to "build.md"
Also, tweak to follow a documentation convention.
2020-11-16 08:28:18 -07:00
Paulo Matos
c3aa63db37
Add ARM32 version of PR fast build workflow (#3503)
Unfortunately, due to bug https://github.com/moby/moby/issues/41217,
ARM and ARM64 versions cannot share the same jobs through a matrix
setting.
2020-11-16 15:46:35 +01:00
Paulo Matos
c8e34be4d9 Remove fetch-depth: 0 from actions/checkout
Apparently fetch-depth: 0 means fetch everything.
Pointed out by @xxyzz in #3502 but I mistakingly pushed before fixing.
2020-11-16 15:41:43 +01:00
Paulo Matos
c057d5e7a6
Add workflow to scribble build guide (#3502)
This should avoid breaking changes being committed.
2020-11-16 15:25:20 +01:00
Paulo Matos
06d852683c
Fix scribble hyperlink 2020-11-16 08:57:12 +01:00
Matthew Flatt
5656073637 repair mismatch in fixnum mixing
Scheme code and C code did not compute the same result for negative
fixnums for 64-bit machines.
2020-11-14 12:42:34 -07:00
Matthew Flatt
dc82685ce0 fix mutable hash tables for certain likely fixnum distibutions
A mutable hash table only uses the lower few bits of a hash code,
because it masks the hash code by [one less than] the power-of-two
size of the bucket array. That truncation interacts badly with the
hashing function for fixnums, which is the identity function; if the
the lower several bits of the fixnum stay the same for many keys and
the upper bits change, then there are many hash collisions --- and
that's a relatively likely distribution.

Fix the mutable hash-table implementations by mixing the hash code to
let higher bits influence the lower bits: xor the high half of the
bits with the lower half (which doesn't lose information, because
xoring again would recover the original number), then do the same for
the high one-fourth of bits in the low half, and then (on a 64-bit
platform) the high one-eighth of the low one-fourth of the bits.

Instead if blaming the way the mutable hash-table implementations only
use the lower bits of a hash code, we could blame the hash function on
fixnums for not performing this kind of mixing. In this patch, though,
we take the view that the hash function's job is to map variation in
its domain to variation in the fixnum hash code, and then the hash
table's job is to use that fixnum effectively. That separation of
responsibilities is now documented with `gen:equal+hash`.

There are also improvements here to the hashing function for bignums
in CS and to the secondary hashung function for fixnums and bignums in
BC.

Thanks to Alex Harsanyi for reporting the problem.
2020-11-14 10:45:15 -07:00