Commit Graph

42879 Commits

Author SHA1 Message Date
Matthew Flatt
56970fdae7 docs: clarifications on identifier-binding results 2021-03-17 20:08:25 -06:00
Matthew Flatt
9a329574b4 docs: fix documented name for get-place-table
Closes #3734
2021-03-17 19:52:26 -06:00
Matthew Flatt
3244fa7a3c normalize error message for mem{ber|q|v}
Restore roughly the old error message for BC, but also adjust it to
use the modern error-message style (with newlines).
2021-03-17 19:52:26 -06:00
Robby Findler
274e4b95b1 give the binding that is introduced to be renamed on provide a source
location so it can be the target of jumps from other files

related to #3733
2021-03-17 19:55:53 -05:00
Robby Findler
2180ae15de mention that expt does like sqrt when it gets 1/2 as a second argument 2021-03-17 19:55:53 -05:00
Matthew Flatt
f43f2f552f docs: correct contract for mem{ber,q,v,f} and ass{oc,q,v,f}
The list-like argument doesn't have to be a list, as long as it's a
chain of pairs to the point where an element is found.
2021-03-17 14:19:02 -06:00
Matthew Flatt
e2cbd9bd73 fix "non-pair" error message for ass{oc,q,v,f} 2021-03-17 14:16:29 -06:00
Matthew Flatt
d0feb5c75a move memq and memv back to core
This commit partly reverts c305dba649 and 88fc9a979f, which was
discusssed in #366.

The original discussion was about allowing an extra argument to
`member` to pick the equality predicate. That change is still in place
in the same (private) Racket module.

The `memq` and `memv` functions are in Scheme for Racket CS and back
to being and in C for Racket BC. The old motivation for moving `memv`
and `memq` --- to get them out of C --- is subsumed by the switch to
CS (granting that some C code got added back to BC meanwhile). The
advantage of moving `memq` and `memv` back to the runtime core is that
the compiler can do more with them, at least in CS.

When `memq` and `memv` were moved previously, they lost checking for
cyclic lists. That wasn't discussed and presumably wasn't on purpose;
check is restored here, including for `member`.

There's no significant performance change in CS, except in cases like
`(memq x '(a b c))` that the compiler unpacks into a combination of
`eq?`s. For BC, the C version is a little faster (10-40%, depending on
the length of the list), but still slower than CS (probably because
`pair?` is slower, which due to representation differences).
2021-03-17 13:36:40 -06:00
Matthew Flatt
db34c62241 schemify: propagate 'compiler-hint:cross-module-inline through values
This change makes

 (begin-encourage-inline
   (define-values (f g h) (values e1 e2 e3)))

equivalent to

 (begin-encourage-inline
   (define f e1)
   (define g e2)
   (define h e3))
2021-03-17 13:33:04 -06:00
Sam Tobin-Hochstadt
4a65dfb1aa Use dd-parse to parse ... patterns inside quasipatterns.
Related to racket/typed-racket#1055.
2021-03-16 21:44:27 -04:00
Matthew Flatt
5058dc5a1a Chez Scheme: fix make-date and date-nanosecond signature 2021-03-16 08:26:06 -06:00
Matthew Flatt
a5db4bf376 Chez Scheme: fix make-time type signature
On a 32-bit platform, the nanosecond argument is not always a fixnum.
2021-03-16 07:47:45 -06:00
Paulo Matos
84328615a1 Fix Chez workflow to run inside a container
Fixes #3730.

By running inside a container we avoid CI breakages caused by changes
in the VM base image. In any case, lso update to use base image
ubuntu-20.04.
2021-03-16 09:37:49 +01:00
Matthew Flatt
a484cd76e5 cs & thread: fix problem with place initialization
The `current-place` place-local variable was initialized relatively
late in the set of place-creation steps. It was possible for the
thread scheduler to get involved before `current-place` was set ---
and in that case, it was possible for semaphores and Racket threads to
end up being used in the wrong place.
2021-03-15 13:51:16 -06:00
Matthew Flatt
c0cfd32bcb Chez Scheme: move cp machine-register indirection
Register allocation needs fresh machine-register state for each
compilation, and that was previously implemented by allocating a new
register record and indirecting references through a parameter. Move
the indirection to the places where conflict-set, index, and precolor
state is manipulated, and pass a state vector though to keep access
efficient. This change makes compilation slightly faster, and it makes
registers easier to work with by not having to introduce
indirections/delays in various places for register references.
2021-03-14 12:10:05 -06:00
Matthew Flatt
467ca64a7f Chez Scheme: split cpprim out of cpnanopass
Moving the np-expand-primtives pass to a separately compiled source
file reduces peak memory use when compiling Chez Scheme from about 1.3
GB to about 0.7 GB on a 64-bit platform. It's also nice from a
code-navigation perspective to split a 19k-line file to a 10k-line
file plus 8k-line file (and some additional small files).

The overall time for Chez Scheme to compile itself is only slightly
affected, even though some support functions, macros, and record
declarations end up getting compiled twice.
2021-03-14 07:39:55 -06:00
Bob Burger
31358698f3 Chez Scheme: sleep of non-positive duration now returns immediately
A negative duration would previously result in an infinite pause in
Windows.
2021-03-13 11:05:51 -07:00
Matthew Flatt
5e1df80a00 unixstyle-install: adjust DESTDIR fixup for "lib" executables with a suffix
More generally, make the path-fixup step insensitive to specific
filenames in the "lib" directory, making it more like the handling of
the "bin" directory.
2021-03-13 10:12:05 -07:00
Gustavo Massaccesi
a6e77a1a0c Chez Scheme: Add more maybe-* and eof/* types
The logic was added in the previous commits, but it's necesary to add
the mapping from the names in primdata to cptypes.

Also add a few subsets of fixnum.
2021-03-13 11:20:02 -03:00
Matthew Flatt
6f58ef5458 make embedding wrapper executable less sensitive to argv[0]
Running a `starter`-based executable with an argv[0] different
than the executable's path can make sense in various situations, but
it doesn't work for finding code embedded in the enxecutable. On
platforms where it's possible to get the current process's executable
(not looking at you, OpenBSD), then use that instead of argv[0] for
the purposes of loading embedded code.

Related to #3685
2021-03-12 20:08:53 -07:00
Matthew Flatt
4a06e4a1e3 Chez Scheme: remove before install
Removing the old executable before copying a new one in place avoids
problems on ARM Mac OS, at least.
2021-03-12 20:08:53 -07:00
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