Commit Graph

5118 Commits

Author SHA1 Message Date
Paulo Matos
f6b14a7bc1
Add -D to pkg install as an alternative to --no-docs (#2777)
raco setup already provides --no-docs and -D so we should too.
Followup to #2776
2019-08-03 15:49:31 +02:00
Paulo Matos
fc76f59457
Add --no-docs command line to raco pkg install (#2776)
This simply passes the same flag to setup, which already knows how to
run setup without rendering the documentation.
2019-08-01 21:12:10 +02:00
Matthew Flatt
2819d73d7f cs: make collect-garbage always return (void) 2019-08-01 07:26:37 -06:00
Matthew Flatt
a5f70561d2 expander: fix module-path resolution in module->namespace namespace
This repair affects DrRacket and xrepl after `enter` so that a
`require` in the context of a module namespace is resolved relative to
the module's path (as it did in the old expander, before v7.0).

Closes racket/drracket#276
2019-07-31 13:52:17 -06:00
Jon Zeppieri
f797694931 Ensure interned_key is initialized 2019-07-31 10:35:21 -06:00
Matthew Flatt
754109fa31 JIT: fix useless test for N-ary unsafe-fx+, etc.
Running tests on 32-bit ARM exposed the problem.

Relevant to #2773
2019-07-30 16:04:29 -06:00
Matthew Flatt
17bc626293 fix bignum quotient on 32-bit ARM
The assembly implementation of `gmpn_invert_limb` is needed to
correctly implement bignum division within the embedded slice of GMP.

Relevant to #2773
2019-07-29 18:39:48 -06:00
Matthew Flatt
af163a533d integer-bytes->integer: repair for unsigned char
Fix `integer-bytes->integer` for the single-byte case when the C
compiler is configured to treat `char` as an unsigned type.

Relevant to #2773
2019-07-29 13:51:10 -06:00
James Bornholt
93dca626f0 repairs for syntax/template on Racket CS
Fix the default argument in `syntax/template`, where cons-proc-stx should be a
syntax object reflecting a procedure, not a procedure itself.

Fix test case for `syntax/template`, where restore-stx should be a syntax object
reflecting the restore procedure, not the proceure itself.

Closes #2745
2019-07-29 06:16:12 -06:00
Jon Zeppieri
0632ac616e Fixes bug in intmap equality
Collision nodes were previously only testing for the equality
of keys and ignoring values.
2019-07-28 18:38:58 -06:00
Jon Zeppieri
4ba070766e Replace uses of hashtable-cell with hashtable-ref-cell in rumble
The hash-demo's "mutable destructive for-each" test, which
uses hash-remove! is slightly faster after this change.
2019-07-28 17:36:48 -06:00
Matthew Flatt
cf0717b855 adjust build to update "raco.exe" when needed 2019-07-27 09:54:22 -06:00
Matthew Flatt
7d6e2fc89b cs: fix launcher hack for cross build
Disable optimizations that would avoid inspecting literal string data
that is modified in the run-time executable.
2019-07-27 08:46:41 -06:00
Matthew Flatt
49929ce8d3 cs: fix incremental cross-compile of Chez Scheme 2019-07-27 08:46:41 -06:00
Matthew Flatt
d48b4498cc cs: strip launchers in Windows cross build 2019-07-27 08:46:41 -06:00
Matthew Flatt
01af30a517 cs: repair recompile of Chez Scheme in Windows build 2019-07-26 16:55:14 -06:00
Matthew Flatt
2a1ffbbdf1 bump version to sync with Chez Scheme change 2019-07-26 16:22:37 -06:00
Stephen Chang
e22abfb8a4 reduce code generated by in-X-set sequence constructors 2019-07-26 13:32:04 -04:00
Stephen Chang
69d748a95e fix seg fault when using in-X-set sequence constructor with wrong kind of set; closes #2765 2019-07-26 12:59:20 -04:00
Matthew Flatt
572b29b874 rktio: fix leak and bad free in subprocess
Closes #2764
2019-07-26 08:37:39 -06:00
Philip McGrath
fce209d9f4 racket/private/serialize: eliminate unnecessary vector->list 2019-07-25 13:27:36 -06:00
Jon Zeppieri
0ebc43ef24 Adds hash-ref-key primitive
For now, the operation is implemented on mutable tables in Chez
using a combination of hashtable-contains? and hashtable-cell.
A more efficient version will require modifying Chez.
2019-07-25 07:43:13 -06:00
Matthew Flatt
57f64367ed cs: implement make-known-char-range-list
Compute the list (at compile time), instead of using a literal copy of
the output at one point.

Also, adjust the documentation to explain extra guarantees provided by
`make-known-char-range-list`.

Closes #2757
2019-07-24 07:33:28 -06:00
Matthew Flatt
f63ededab8 cs: fix copied environment setup from cross-compilation
The copy of the environment setup for cross-compilation was
out of sync with the main environment configuration.
2019-07-23 19:21:46 -06:00
Matthew Flatt
8b916fc5c1 expander & cs: sync lists of internal primitives
The expander and the rumble layer of Racket CS need to agree on a set
of extra primitives that are referenced by schemified linklets.
2019-07-23 17:49:45 -06:00
Matthew Flatt
c1bc49e45b update racket HISTORY.txt for v7.4 2019-07-23 13:01:31 -06:00
Matthew Flatt
05c82d877c rktio: fix problem with lazy ltps
Don't try to wait on a kqueue or epoll fd that is not yet initialized.
2019-07-23 11:00:05 -06:00
Matthew Flatt
491081eefd cgc: don't use GC_free on runstacks
Using GC_free() on runstacks was a way of reducing leaks with
conservative GC, but the implementation of prompts for delimited
continuations evolved in a way that is incompatible with using
GC_free(). The recent change to make certain runstack links weak
particularly exposed the mismatch.
2019-07-22 14:15:30 -06:00
Paulo Matos
7b3766ae84 Generate new certificate (valid for 10 yrs) for testing using 2048bits
Fixes #2748

Steps to create this certificate:
openssl genrsa -out key.pem 2048
openssl req -new -sha256 -key key.pem -out csr.csr
openssl req -x509 -sha256 -key key.pem -days 3650 -in csr.csr -out certificate.pem
cat key.pem certificate.pem > test.pem

When filling out the information for the certificate, keep the same
details - some tests depend on it.
2019-07-22 13:17:35 +02:00
Matthew Flatt
fa754ee333 unsafe-poller: fix result handling
Closes #2754
2019-07-21 18:05:57 -06:00
Matthew Flatt
91f5ec3c9b fix GC registration for scheme_unsafe_poller_proc 2019-07-21 18:05:57 -06:00
Matthew Flatt
23cb7c6a1a sgc: fix finalization callback data marking
Callback data should be treated accessible before conaidering any
finalized or weak references.

Relevant to #2734
2019-07-21 18:05:57 -06:00
Matthew Flatt
ab9a5d261e ffi: fix recording of foreign function names
The internal change to a curried mode caused a generic name to be
used.
2019-07-21 18:05:57 -06:00
Matthew Flatt
0f6cd01489 conservative GC: break weak links after finalization
Bring CGC and 3m in line by breaking weak links in CGC only after
ready level-1 finalizations (which correspond to will executors) have
been queued. The chage delays clearing of the weak link until after
the finalizer is run.
2019-07-21 18:05:57 -06:00
Matthew Flatt
deca030d34 fix finalization pessimization
Recurring during finalization marking could potentially delay
finalization that should happen in the same collection.
2019-07-21 18:05:57 -06:00
Robby Findler
93f4c9226b change the way +1 arity functions work so the code is generated
by `contract-out` instead of `->`

This seems to save about a second of startup time in (non-cs) DrRacket
and about .1 seconds in drracketcs.

The code is also theoretically more easily inlined. Still not easy enough, however.
2019-07-20 10:45:23 -05:00
Paulo Matos
2045c4abd8
Fix processor-count for windows systems (#2752)
DOS_FILE_SYSTEM is not defined in rktio, use RKTIO_SYSTEM_WINDOWS instead

Fixes #2674
2019-07-20 16:20:19 +02:00
Matthew Flatt
43ba15ca38 expander: fix performance problem with datum->syntax
In a pattern like

 (let loop ([l l])
   (define v (syntax-e l))
   (cond
     [(null? v) 'done]
     [else
      (loop (datum->syntax #f (cdr v)))]))

the running time was O(N^2) for a list of syntax objects of length N.
That pattern is relevant for traversals that use `syntax-case` like

 (let loop ([l l])
   (syntax-case l ()
     [(a . b) (loop #'b)]
     [() 'done]))

Avoid bad behavior by recording in an weak hash table certain pairs
that were previously been produced by `datum->syntax` internally so
that they can be used as-is.
2019-07-18 12:19:29 -06:00
Matthew Flatt
e4c6a2560b cs & thread: fix problems with future-shutdown synchronization
Relevant to #2725
2019-07-18 06:05:53 -06:00
Matthew Flatt
91cdc06c91 tanh: single flonum result for range of arguments
Fix the case for > 1.29f-08 and <= 0.549f0.

Closes #2736
2019-07-18 06:05:53 -06:00
Matthew Flatt
c397dba145 cs: better build-time error if lz4 isn't available
Mainly for cross-compilation with a Windows target, the Racket CS
build process may need to run `lz4` as an external program. In that
case, complain when `lz4` isn't found, instead of letting `system*`
complain about getting `#f`.
2019-07-17 13:15:50 -06:00
Sam Tobin-Hochstadt
997f5b583c Support chaperoning tcp-listeners as evts.
Found by the Typed Racket test suite.
2019-07-15 09:18:33 -04:00
Matthew Flatt
fa155727df cs: unbreak Windows build
Add pe-made "cs_config.h" for Windows.
2019-07-12 11:49:39 -06:00
Ryan Culpepper
b4d7885b16 openssl: fix ssl-addresses, docs for ports->ssl-ports 2019-07-12 00:22:28 +02:00
Ryan Culpepper
65e2d802dd openssl: add key and cert-chain args to ssl-make-{client,server}-context 2019-07-12 00:22:28 +02:00
Ben Greenman
eef651743e
contract: collapsible, prune leaves if eq? and trusted (#2706)
Change the condition for filtering leaf contracts via `eq?`.

Before, we looked for flat or chaperone contracts.
After, look for flat or trusted contracts. So:

1. untrusted chaperones with side effects that are unsafe to drop are not
   dropped, and
2. impersonator contracts can now be dropped (object/c, recursive-contract)
2019-07-11 15:53:16 -04:00
Matthew Flatt
ef4eb585d7 reader: repair readtable re-mapping of # comment forms
Thanks to @LiberalArtist for the bug report and examples.
2019-07-11 12:09:21 -06:00
Matthew Flatt
bad64945e7 racket/fasl: support unsafe-undefined
Since a literal unsafe-undefined can be serialized in compiled code,
support in fasl.
2019-07-11 05:13:39 -06:00
Paulo Matos
e6922e76ea
Ensure that src variable type to test mbsrtowcs is correct (#2735)
When compiling with -Werror (./configure CFLAGS="-Werror" ...),
the test to see if mbsrtowcs exists
failed with pointer type of incompatible type, is char **, should be
const char **. It would proceed to assume mbsrtowcs didn't exist.
2019-07-11 12:20:36 +02:00
Matthew Flatt
85f4fc1337 cs & schemify: fix incorrect constant-folding for {fx,fl}vector
Closes #2729
2019-07-09 17:56:15 -06:00
Matthew Flatt
15587d84fe cs & schemify: repair bad cross-module copy propagation
Closes #2732
2019-07-09 15:20:24 -06:00
Matthew Flatt
0284bdaa58 cs & thread: fix chaperone-evt on will executors
Closes #2730
2019-07-09 13:48:30 -06:00
Matthew Flatt
8c052df959 cs & thread: repair for custodian sync witth future host thread 2019-07-09 13:37:24 -06:00
Matthew Flatt
9c0a3abfdb cs: repair for 32-bit ELF 2019-07-09 09:04:58 -06:00
Matthew Flatt
8e85441410 repairs for procedure-spcialize 2019-07-08 11:48:15 -06:00
John Clements
003f0dd72e Post-release version for the v7.4 release 2019-07-08 02:33:57 -07:00
Matthew Flatt
839fb84eec cs & io: fix security-guard call in current-directory 2019-07-07 10:11:37 -06:00
Matthew Flatt
79d6b9bc18 json: preserve old behavior in terminating a number
The json parser has allowed "1x" as "1" and "1e-0x" as "1.0", so
keep that behavior for now.
2019-07-06 05:59:14 -06:00
Dmitry Moskowski
bbb8707a4a json: fixing scientific notation exponent sign bug
if exponent contains leading zeroes it's sign will be always `+`. example:

$ racket                                                                                                                                                                                                                                                      (6s 38ms)
Welcome to Racket v7.3.
> (require json)
> (jsexpr->string 0.000001)
"1e-06"
> (string->jsexpr (jsexpr->string 0.000001))
1000000.0
2019-07-06 05:57:22 -06:00
Matthew Flatt
c0104a29ef CS bootstrap: avoid pessimizing primitives
Speed up the bootstrap process by more directly referencing primitives
that won't be replaced in the top-lvel namespace for simulating Chez
Scheme.
2019-07-05 15:22:02 -06:00
Matthew Flatt
1e7dbbe020 CS bootstrap: fix structure-operation simplification 2019-07-05 12:12:13 -06:00
Matthew Flatt
3235f648fb speed up Chez Scheme bootstrap a little
Recognize constructor patterns to avoid some indirections.
2019-07-05 08:13:12 -06:00
Matthew Flatt
f0314ddad7 configure: fix failure handling in configure dispatch
Closes #2727
2019-07-05 08:13:12 -06:00
Alexis King
ca8870e964 Add property/c contract combinator for checking first-order properties 2019-07-04 14:08:30 -05:00
Matthew Flatt
21481421a0 unbreak compilation with gcc < v4.5 2019-07-04 07:38:53 -06:00
Matthew Flatt
62f1243136 expander: fix extract mode to not run and work with a submodule root
Also, report an error, for now, if a cache directory is not specified
in extract mode, since extraction doesn't currently work without it.
2019-07-03 10:38:12 -06:00
Paulo Matos
8f85df64d9
Add MZ_ prefix to macros NORETURN and UNREACHABLE (#2723)
Since the definitions of these live in the public header scheme.h,
adding this prefix reduces clashes with other related macros.
2019-07-03 15:32:48 +02:00
Paulo Matos
e26d2e11d8
Proper cross-platform no return annotations for error functions (#2709)
Ensures proper noreturn annotations for error functions. Implemented
cross-platform unreachable annotation. No warnings in tested clang or
gcc with default flags. Tested as well on MacOS and Windows.
2019-07-03 08:31:18 +02:00
Sorawee Porncharoenwase
0ffb16bce3 Fix various typos 2019-07-02 12:52:23 -06:00
Matthew Flatt
b0f77a98a3 schemify: improve cross-module optimization
The schemify pass collects known-value information as the first step
of processing a linklet body, but the main pass to process the linklet
body may simplify it in a way that exposes new information. For
example, in

 (define (call) (values 1 2))
 (define-values (x y) (call))

the main pass will inline `call` and expose the fact that `x` and `y`
are always 1 and 2, respectively.

Adjust schemify to inspect the simplified form of a definition and
potentially add new information to known-value information, which is
useful later in the ame linklet body and also as cross-module
information.
2019-07-01 15:19:28 -06:00
Matthew Flatt
ecabcd385a schemify: add constant folding
Like other optimizations that schemify duplicates, constant folding
helps support cross-module optimization. Related "no-prompt"
declarations for primitives can reduce `call-with-module-prompt`s in
schemified output, too, which can interfere with Chez Scheme's
optimizer.
2019-07-01 14:34:25 -06:00
Paulo Matos
831e75d731
Remove SCHEME_NO_EXN block (#2718)
This is probably related to #2712.
It's the only occurrence of SCHEME_NO_EXN pointing to the fact that
this is an historical artifact that can be removed.
2019-07-01 16:17:07 +02:00
Matthew Flatt
0e1af0be89 schemify: recognize define-values split after inlining
Recognize `(define-values (id ...) (values rhs ...))` and split to
multiple `define`s after simplifying the right-hand side of
`define-values`. Also, don't split if a define variable is referenced
too early.
2019-07-01 06:11:17 -06:00
Matthew Flatt
c5523fef02 use fixnum-for-every-platform? for case 2019-07-01 05:41:08 -06:00
Paulo Matos
e97c85b79e
Mark do_raise as NORETURN and ensure it does not return (#2717) 2019-07-01 12:55:30 +02:00
Paulo Matos
26cd03ec8f
Do not add explicit return statement when it doesn't exist (#2715)
Adding return statement where it doesn't exist, causes problems with
functions marked no return so it should be avoided.

Related to #2709 - with this PR, clang won't complain any longer
about issues with xform generated sources about functions marked
no return that do indeed return.
2019-07-01 12:30:45 +02:00
Paulo Matos
fcddf7e9ba
Whitespace cleanup (#2716)
Requested as a separate PR in #2714
2019-07-01 12:28:22 +02:00
Matthew Flatt
f8e5526b28 unbreak some 32-bit x86 builds 2019-06-30 11:40:17 -06:00
Matthew Flatt
020c75792c add fixnum-for-every-system?
The `case` macro needs to use the new predicate instead of `fixnum?`,
but delay swittching over until Typed Racket is ready.
2019-06-29 20:18:23 -06:00
Matthew Flatt
b1a5c86702 cs: disable bytecode loaded with a non-original code inspector
Racket CS now passes all tests in the core Racket test suite.
2019-06-29 09:20:36 -06:00
Matthew Flatt
97b2982a1d schemify: update demo 2019-06-29 08:30:08 -06:00
Matthew Flatt
efeb9116d5 cs & schemify: fix set!-vs.-define tracking 2019-06-29 08:13:52 -06:00
Matthew Flatt
82d40d1509 use wrappers for trig functions in complex variants
Using wrappers applies various "sconfig.h"-configured fixups.
2019-06-29 05:46:10 -06:00
Matthew Flatt
2847d1d22a improve atan, asin, and acos on complex numbers
Replace naive calculations with ones based on Kahan's "Branch Cuts for
Complex Elementary Functions" as implemented in Chez Scheme.
2019-06-28 16:51:48 -06:00
Matthew Flatt
8e1b27592f cs: disable non-decimal string->number on inexacts 2019-06-28 10:57:59 -06:00
Matthew Flatt
75ff7870bd improve / precision on mixed exact--inexact complex numbers 2019-06-28 10:57:59 -06:00
Matthew Flatt
ff94c6d8d8 cs: fix variable-reference->module-... on reference to primitive 2019-06-28 10:57:59 -06:00
Matthew Flatt
032ab4e374 cs: add place logging 2019-06-28 10:57:59 -06:00
Ryan Culpepper
3c12957c7e template: mark pattern variables as disappeared
This fixes a bug introduced in 291565.
2019-06-27 22:22:08 +02:00
Matthew Flatt
cbaddd2164 cs & thread: repairs for memory accounting and places 2019-06-26 13:50:06 -06:00
Matthew Flatt
8985a409b8 openssl: fix bytes-terminator problem on Racket CS
Make sure the argument to SSL_ctrl has a nul terminator.
2019-06-26 13:50:06 -06:00
Matthew Flatt
5e59ae0586 rktio: use only async-signal safe after fork
In particular, `malloc` is not async-signal safe.
2019-06-26 13:50:06 -06:00
Paulo Matos
7422abb42a
Remove reference to NO_SCHEME_EXNS (#2712) 2019-06-26 17:03:12 +02:00
Matthew Flatt
a0023d5797 fix environment-variables-copy and case-normalization
Preserve the original case of an environment variable for
round-tripping on systems where environment variable names are
case-normalized.
2019-06-25 14:56:39 -06:00
Matthew Flatt
8c1dbae88b expander: improve extractor to recognize once-set variables
When `set!` is used to tie a recursove knot in a flattened linklet,
the expander can recognize that pattern and not complain that a
mutable variable might be shared across places. Improving that
inference means fewer `++global-ok` flags in Makefiles.

This commit also avoids single-quote as an escaping form in a
makefile, which doesn't work with nmake on Windows.
2019-06-25 08:43:38 -06:00
Matthew Flatt
3fb226ce2a cs: fix future-thread signaling
Fix confusion between signal and broadcast operation.
2019-06-24 20:14:52 -06:00
Matthew Flatt
b64e17388f cs: fix stdio/syslog GC logging as triggered by future thread
Always use the main `rktio` instance and don't try to explicitly start
atomic mode.
2019-06-24 20:00:51 -06:00
Matthew Flatt
309a0c2489 cs: fix future-logging race 2019-06-24 18:28:03 -06:00
Matthew Flatt
51ab4a5c6a thread: repairs for event logging
Fix RacketCS so that the future visualizer works.
2019-06-24 16:36:16 -06:00
Matthew Flatt
0106abaf6e bump version number
Since it removes an built-in place-local definition, commit 564dcf339a
can affect compilation for Racket CS.
2019-06-24 15:29:45 -06:00
Matthew Flatt
0d3d0d7d86 thread: add notes on the behavior of futures 2019-06-24 14:54:37 -06:00
Matthew Flatt
564dcf339a cs: fix memory accounting and futures
Also avoid problems with interrupting a rapidly allocating
computation and shutting down the main custodian.
2019-06-24 13:59:03 -06:00
Matthew Flatt
a5a84ea8c6 remove accidentally committed debugging printout 2019-06-24 08:14:58 -06:00
Matthew Flatt
1192225c97 avoid some compiler warnings 2019-06-23 06:46:28 -06:00
Matthew Flatt
1e84b11462 expander: repair extraction when using an existing Racket build
Recent improvements to module-name resolution caching exposed a
problem in the extraction setup.
2019-06-22 07:43:02 -06:00
Matthew Flatt
f00de510de cs configure: support installed libz and libzl4
Continue to build the bundled-with-Chez zlib and lz4 by default, but
support `--enable-libz` and `--enable-liblz4`, and turn those on when
the Chez Scheme directory doesn't have bundled versions. That should
make things build right for distributions where repackaging
dependencies is disallowed or discouraged.
2019-06-22 07:11:09 -06:00
Matthew Flatt
6647d832bb configure: further improvements for NetBSD and OpenBSD
Enable ELF support for `racketcs` embedding, and add `paxctl +m`
build steps for NetBSD.
2019-06-22 06:23:47 -06:00
Matthew Flatt
7706b447a5 configure: propagate ARFLAGS to libffi configure 2019-06-21 21:54:22 -06:00
Matthew Flatt
5fb38fc246 cs: sync include path for {Free,Open}BSD 2019-06-21 21:12:17 -06:00
Matthew Flatt
e68269b357 makefile: avoid automatic "Makefile" rebuild 2019-06-21 19:46:39 -06:00
Matthew Flatt
90b79524aa revise build to avoid ld and nicear
The Chez Scheme build process now create an archive instead of linking
"kernel.o". Adjust the Racket CS build to use archives instead of
"kernel.o".

Also, modernize the Racket build's use of `ar`. Using the flags `rc` by
default (instead of `ruv`) should avoid the need for `nicear`.
2019-06-21 16:53:58 -06:00
Matthew Flatt
5c51096a88 cs: repair filesystem-change-evt
Correct an incomplete adaptation in a2a67a9660.
2019-06-21 13:35:33 -06:00
Matthew Flatt
c7f7170a3e avoid compiler warning 2019-06-21 09:50:32 -06:00
Matthew Flatt
6e70d8ec1d nicer nicear: suppress "modifier ignored" warning
If GUN ar is configured for deterministic mode by default, then

  ar: `u' modifier ignored since `D' is the default (see `U')

prints. Suppress that to avoid stderr output.
2019-06-21 09:49:11 -06:00
Matthew Flatt
db3b75eaf1 expander: add shadow filesystem for Windows in collection lookup
Checking for directories when searching for a collection can be
especially slow with the Windows filesystem, but Windows also supports
filesystem-change events. So, cache information about the existence of
paths, relying on filesystem-change events to detect with the cache is
out of date.

Related to racket/drracket#281
2019-06-21 09:27:12 -06:00
Matthew Flatt
a2a67a9660 filesystem-change-evt: fix use of failure thunk
Also, allow the failure thunk to be #f to get the default behavior.
2019-06-21 09:27:12 -06:00
Matthew Flatt
ec5b45e4f8 cs: inline arithmetic-shift and other bitwise operations 2019-06-20 18:31:19 -06:00
Matthew Flatt
9083c6abb4 schemify: use unsafe box operation for lifted mutable variables 2019-06-20 18:30:55 -06:00
Matthew Flatt
bf692f572d cs: avoid indirection through Chez Scheme for raise 2019-06-20 14:37:03 -06:00
Matthew Flatt
3f35504355 thread: refactor scheduler poll-and-select loop
Further reduce redundant checks, and also avoid an excessive delay
after making the process sleep.
2019-06-20 14:36:43 -06:00
Matthew Flatt
6d3eff55a4 cs: repair for external signals
Like 2a1404f9a3, but for Ctl-C.
2019-06-20 12:14:48 -06:00
Matthew Flatt
35ff9137e7 cs: tweak return for call/ec and call-with-continuation-barrier
The prompt installed for an escape continuation or continuation
barrier is never used to delimit a captured continuation, so the
return from the continuatiton can be streamlined slightly.

The benefit is very small (but detectable in the macro expander's use
of barriers). There's an opportunity to use `call/1cc` instead of
`call/cc`, but that change does seem to help --- neither Chez Scheme's
current `call/1cc` nor the opportunistic variant of `call/cc` use to
implement continuation attachments.
2019-06-20 08:48:56 -06:00
Matthew Flatt
30393ae0fa cs: linear-time prompt check
Add cache for `continuation-prompt-available?` so it's amortized
constant time.
2019-06-20 08:48:56 -06:00
Ryan Culpepper
685d067361 syntax/parse: fix handling of ~seq with action patterns 2019-06-20 16:36:14 +02:00
Matthew Flatt
2a1404f9a3 cs & io: fix fd semaphore polling
Reducing external-event polling exposed a problem with fd semaphore
checking, where the check before sleeping didn't abandon the sleep if
an fd semaphore was posted.

Also, fix a bug with interrupted network address lookup.
2019-06-19 18:13:37 -06:00
Matthew Flatt
1ba4d76fe0 cs & thread: avoid excessive polling for external events
Reduce polling in the case that threads that block and swap rapidly,
in which case polling on every thread swap can be useless and
expensive.
2019-06-19 17:27:24 -06:00
Matthew Flatt
ba8d442e75 cs & thread: refactor and finish futures implementation
Complete the implementation of futures, fsemaphores, future logging,
and their cooperation with threads, places, and custodians.
2019-06-19 12:50:19 -06:00
Ryan Culpepper
eb4ec000b0 syntax/parse: use generic tree functions in analyses 2019-06-19 16:21:43 +02:00
Ryan Culpepper
4b64cdef54 syntax/parse: add multiple pattern-processing passes
- pair specialization
- and/ord normalization, and cleanup
- add pat:seq-end to list-pattern
2019-06-19 16:21:43 +02:00
Ryan Culpepper
29e46bea78 syntax/parse: add generic (dynamic) tree traversal library 2019-06-19 16:21:43 +02:00
Ryan Culpepper
e845d0861d syntax/parse: add explicit pattern checks 2019-06-19 16:21:43 +02:00
Ryan Culpepper
fa78f5ebd3 syntax/parse: add well-formed pattern predicates 2019-06-19 16:21:43 +02:00
Ryan Culpepper
769dfb9e34 syntax/parse: add hpat:single; {single,head}-pattern types disjoint 2019-06-19 16:21:43 +02:00
Ryan Culpepper
5ab82ccdd4 syntax/parse: code reorganization 2019-06-19 16:21:43 +02:00
Ryan Culpepper
1c01df60ce syntax/parse: use logging instead of conditional eprintf, show more patterns 2019-06-19 16:21:43 +02:00
Ryan Culpepper
39bacd45d5 syntax/parse: simplify head pattern compilation
The continuation expression for a head pattern evaluates to a
procedure that takes the rest of the term and the current progress.
2019-06-19 16:21:43 +02:00
Ryan Culpepper
6e46dd1b0d syntax/parse: fix saving of eh-alternatives
Avoid adding extra syntax wrapping. This doesn't matter for parsing,
but it does matter for pattern analyses.
2019-06-19 16:21:43 +02:00
Ryan Culpepper
4a7717679a syntax/parse: clean up insertion of default expressions in patterns 2019-06-19 16:21:43 +02:00
Ryan Culpepper
233c9b8f50 syntax/parse: fix abstract failure pattern analysis 2019-06-19 16:21:43 +02:00
Ryan Culpepper
bad4dd909d syntax/parse: delete dead make-dummy-stxclass 2019-06-19 16:21:43 +02:00
Ryan Culpepper
51d7060ff0 syntax/parse: add missing failure -> failure* 2019-06-19 16:21:43 +02:00
Ryan Culpepper
7fb0250191 syntax/parse: update comments 2019-06-19 16:21:43 +02:00
Ryan Culpepper
6577791664 syntax/parse: improve minimatch on structs, vectors; delete dead code 2019-06-19 16:21:43 +02:00
Stephen De Gabrielle
38ef00fca3 raco pkg new changed to create APACHE and MIT license files 2019-06-19 09:17:53 -04:00
Ryan Culpepper
4cb37a1d8a template: improve ASTs, use smart constructors
Improvements include:
- less scattered handling of constant templates
- better recognition of constant templates, like (1 (... 2)), where
  the template syntax is not identical to its value
- better code for (x ... ...), where x is trusted
2019-06-19 14:48:28 +02:00
Ryan Culpepper
2915657c27 template: parse ellipses using stack of map environments
This is like the psyntax approach but frames are mutable
and track extra information.
2019-06-19 14:48:28 +02:00
Matthew Flatt
6184de2389 ffi: fix use of struct malloc mode for function results
Relevant to #2702
2019-06-17 15:32:14 -06:00
Matthew Flatt
1824fe5e41 io: add shortcut to get semaphore on blocking fd read
When reading from an input fd blocks, instead of creating a general
event that creates a semaphore, use the semaphore directly (when
available). Also, treat a semaphore internally as an event that
always produces 0.

This change speeds up the "echo" shootout benchmark.

This change speeds up the "echo" shootout benchmark.
2019-06-17 10:08:40 -06:00
Matthew Flatt
97e61b5f25 thread: avoid repeated polls while scanning available threads
Poll for external events just once before starting a search for an
available thread, instead of polling every iteration in the search.
2019-06-17 10:08:27 -06:00
Matthew Flatt
6d200e6143 cs: remove compile-as-independent? mode
This slower mode hasn't turned out to be needed, and since it hasn't
been used, it probably doesn't work anymore.
2019-06-17 09:10:39 -06:00
Matthew Flatt
9d55443e23 cs: force inline of applicable-struct support
When the schemify pass cannot determine that a call is to a primitive
procedure, it generates an `#%app` form that expands to

  ((extract-procedure rator) rand ...)

Force `extract-procedure` to be inlined (by making it a macro), so the
expansion is

  (let ([tmp rator])
    ((if (#%procedure? tmp) tmp (slow-extract-procedure tmp)) rand ...))

which is usefully faster in the common case that `rator` turns out to
be a primitive procedure.
2019-06-17 09:10:08 -06:00
Matthew Flatt
ae1bf1b9fc cs: lock-free eq-hash-code
Chez Scheme doesn't provide `eq-hash-code`, so it's implemented with a
weak `eq?`-based hash table that maps values to fixnums (except for
numbers, symbols, and characters). The table had a lock to support
concurrent use in multiple places, and that became a major source of
contention in parallel builds. Change the implementation to use a new
`eq-hashtable-try-atomic-cell` operation, which effectively moves
contention from the hash table to individual buckets (where it should
be much rarer).
2019-06-17 09:09:30 -06:00
Matthew Flatt
f27dbb7951 cs: fix cross-module inlining for separate compilation
Commit fe708871bd broke cross-module inlining for modules that are
compiled in different Racket processes. The problem is that
cross-module information is represented by prefab structures, and the
change caused Chez Scheme's fasl for prefabs to generate a different
structure type on different runs.

To solve the problem, use `racket/fasl` for cross-module information,
instead. But cross-module information also has inlining information as
correlated objects, so make those supported by `racket/fasl`, too.
2019-06-15 10:05:05 -06:00
Ben Greenman
b40e247edd contract-out: struct, keep original struct id
The first time a struct is provided through `(contract-out (struct id ....))`,
 save `id` to access its transformer binding later.

On reprovides:
- hang on to the original `id`
- use its transformer to recover the original predicate/accessor/mutator names

Also, fix a bug where the order of the mutator ids reported by the
struct info was getting reversed

Probably, nobody noticed that bug. They'd have to work around the renaming
issue in #2572 first.
2019-06-14 13:54:47 -05:00
Paulo Matos
ddaf3f5022
Regenerate exports (#2697)
This should have been done after e13fac3ccf, where schemef.h was changed.
2019-06-14 17:05:21 +02:00
Matthew Flatt
4c01f60d56 module name resolver: adjust resolver cache
The default module name resolver uses a cache to map module names to
resolved-path information. The cache was weak in a way that turns out
to be much weaker on Racket CS, essentially because Chez Scheme is
tuned to fire a minor GC more frequently.

The new cache cuts 45 minutes(!) from a 2h15m single-process
distribution build of Racket CS on Linux. That brings it under a factor
of 1.5 of the non-CS build time, instead of over a factor of 2.

Thanks to Caner and Sam for pointing out LONG ago (maybe a year ago)
that the cache works badly for Pycket. Since the cache doesn't make a
big difference for `racketcs -cl racket`, though, it took me this long
to understand that it can be such a big deal for Racket CS when
performing a distribution build.
2019-06-14 06:24:06 -06:00
Matthew Flatt
61bf75962c raco exe: make generated name for embedded module deterministic
Help avoid problems with serialization by making the generation of
embedded module symbolic names deterministic and relatively
insensitive to module order. The generated name is based on a
combination of `path->module-path` and paths relative to the
main module of the executable.

Related to #2693
2019-06-13 07:50:39 -06:00
Alexander B. McLin
9c95e31d26 cs: get_self_path implementation for FreeBSD 2019-06-12 12:46:21 -06:00
Matthew Flatt
9c4519628c cs: enable strip on install for FreeBSD 2019-06-12 07:01:05 -06:00
Matthew Flatt
1b729d157b cs: sync LDFLAGS for racketcs on BSDs 2019-06-12 06:52:15 -06:00
Matthew Flatt
0423ec9841 Windows: fix setup/winstrip for different variants
For the normal 3m Racket builds in non-cross mode, CGC DLLs have been
incorrectly left behind (e.g., in the Utah snapshot distributions).
2019-06-12 06:07:34 -06:00
Matthew Flatt
e51c44fa3d Use 3m to build CS on Windows
The extra time to build 3m via CGC seems worth it, especially when
building Chez Scheme's boot files.
2019-06-11 20:01:41 -06:00
Matthew Flatt
d8c3edd3e1 io: tiny performance tweak for path-element checking 2019-06-11 18:38:19 -06:00
Matthew Flatt
b1632232ca cs: reduce PLT_LINKLET_TIMES overhead 2019-06-11 16:44:15 -06:00
Matthew Flatt
41dc6f1335 measure resolver time instead of resolve calls in instantiate
The total time of module name resolver calls is more useful, because
each one takes longer, there should be many fewer, and there are
tasks that end up resolving module paths.
2019-06-11 15:53:37 -06:00
Matthew Flatt
a0ce64c5c4 rktio: add missing header
NetBSD needs <sys/time.h>.
2019-06-11 08:06:29 -06:00
Ben Greenman
bcd10a9114 file/tar: add #:timestamp parameter
Add a keyword argument that matches the arg. to `zip`

Fixes an "unbound" id in the docs
2019-06-10 13:24:11 -04:00
Matthew Flatt
d136245e3b expander as pkg: repair source mode
When support for machine-independent bytecode was added, the bootstrap
implementation of linklets ended up being slightly uncooperative.
Source terms from the bootstrap became wrapped as machine-independent
form. For various reasons, things worked anyway, except that
`--linklets` mode prints bytecode instead of S-expressions. Fix the
bootstrap implementation to cooperate correctly.

Related to #2688
2019-06-10 07:22:55 -06:00
Matthew Flatt
c020bd4feb racket/fasl: repair for +nan.f
The `racket/fasl` implementation wasn't updated with the change
to disable reading for lfoating-point literals.
2019-06-10 07:22:55 -06:00
Matthew Flatt
2f47629f74 optimize: repair some make-struct-type[-property] handling
Don't discard expressions that will fail due to trying to make a
prefab struct type from a parent that isn't a prefab. Similarly, don't
discard a `make-struct-type` with a built-in property that has a
guard. Don't discard a `make-struct-type-property` with a literal
guard procedure that has the wrong arity.

Related to #2685
2019-06-09 07:27:35 -06:00
Matthew Flatt
07e35566e2 optimizer: repair unsafe-mutable-hash-iterate-next and similar
Related to #2685
2019-06-09 07:27:35 -06:00
Matthew Flatt
b133bea92e optimizer: abs expects and produces reals, not numbers
Related to #2685
2019-06-09 07:27:35 -06:00
Matthew Flatt
34cd1e2a2b optimizer: don't discard potential hash errors
If `hasheq` is given an odd number of arguments or if `make-hasheq` is
given a bad argument, then the error should be preserved.

Related to #2685
2019-06-09 07:27:35 -06:00
Paulo Matos
2cd3679d8b
Fix typo s/assuptions/assumptions/ 2019-06-08 22:46:42 +02:00
Matthew Flatt
b2e95542d8 io and expander: performance tweaks 2019-06-05 17:52:37 -06:00
Matthew Flatt
a72220a3ac bytecode optimizer: remove exact->inexact on known flonum
And similar for `real->double-flonum`. Also, convert those to
`unsafe-fx->fl` when the argument is known to be a fixnum.
2019-06-05 15:21:49 -06:00
Robby Findler
a51231ffa2 use regular old append when possible 2019-06-05 12:52:51 -05:00
Matthew Flatt
c8e9083f0e repair for JIT-inlined unsafe-make-flrectangular 2019-06-05 10:07:04 -06:00
Matthew Flatt
edd74d6ecf makefile: configure with --enable-racket => no 3m dependency CS
Adjust the makefile that ends up in <builddir> with `--enable-cs` or
`--enable-csdefault` (as opposed to `--enable-csonly`) so that `make
racketcs` doesn't imply `make racket3m` if `--enable-racket` has
supplied an existing Racket.

Also fix `make install-cs` related to GRacket for the case that Racket
3m/CGC isn't built.

Relevant to #2683
2019-06-05 07:07:32 -06:00
Paulo Matos
eec118f4fb
Do not memcpy with null pointer as 2nd arg (#2682)
Caught by test:ubsan:cs
2019-06-05 14:40:23 +02:00
Paulo Matos
c40b24d0d3 Remove stray right paren from configure docs for ubsan 2019-06-04 23:51:27 +02:00
Matthew Flatt
0ca19cfa08 avoid retaining unneeded runstacks in continuations
While a continuation is set up to avoid retaining runstacks, partly by
storing a prompt ID instead of a prompt record, prompt records can
remain on the C stack and get captured anyway. Mitigate that problem
by making the runstack link weak in some prompt record.

Racket CS doesn't have this problem, of course.

Relevant to jeapostrophe/lux#10
2019-06-04 13:53:15 -06:00
Paulo Matos
6eb2175f7a
Fix UNSAFE_FX use of type for v, instead of intptr_t (#2653) 2019-06-04 20:56:10 +02:00
Matthew Flatt
b8617c24e9 unbreak cify build 2019-06-04 09:27:44 -06:00
Matthew Flatt
758e02fa39 schemify: fix bad check on mutated state 2019-06-04 07:34:13 -06:00
Matthew Flatt
03710757ef io: fix newline on custom output port
Closes #2677
2019-06-04 07:24:31 -06:00
Matthew Flatt
fcdd8a91dc disable single-flonum reading by default
Add `single-flonum-available?` and `read-single-flonum`, where the
latter controls whether numbers that have an "s" or "f" exponent
marker are parsed as single-flonums are normal flonums. The parameter
is disabled by default, which changes the meaning of most existing
code that has a literal number with "s" or "f", including `+inf.f`,
`inf.f`, and `+nan.f`.

The compiler constant-folds `single-flonum-available?` and
`real->single-flonum` on a literal number, so use a combination of
those to replace most uses of a single-flonum literal. Single-flonums
within quoted data are less convenient.
2019-06-04 06:46:53 -06:00
Alexis King
88b00d75f7 syntax/parse: Fix syntax instead of quote-syntax in def-litset
fixes #2673
2019-06-01 23:47:05 -05:00
Matthew Flatt
a4545594f6 fix make include setup in configure for Racket CS
Relevant to #2669
2019-05-31 06:44:07 -06:00
Gustavo Massaccesi
daba5db44a simplify code and test for print-pair-curly-braces
After the change that makes printing of struct ignore print-pair-curly-braces
it is possible to simplify the code in io/print and the associated tests.
2019-05-30 13:55:00 -03:00
Matthew Flatt
bdb578606e repairs for bytes-utf-8-index
For traditional Racket, fix `bytes-utf-8-index` to accept 5 arguments
as documented. For Racket CS, fix `bytes-utf-8-index` to return an
index relative to the byte string's start.

Closes #2670
2019-05-30 08:13:38 -06:00
Matthew Flatt
8c652de835 net/url: avoid failure on bad proxy environment variable
Related to #2663
2019-05-29 15:13:03 -06:00
Matthew Flatt
6381e3c009 print-pair-curly-braces: don't affect constructor output
When `print-pair-curly-braces` is true, change the built-in printer to
not use curly braces to group a constructor with its argument.
Restrict its effect to quoted lists, which is more what you expect and
more consistent with `pretty-print`.

Also, change `pretty-print` to not use `{` when using the `list`,
`list*`, `cons`, or `mcons` constructors.

Closes #2662
2019-05-28 19:14:48 -06:00
Gustavo Massaccesi
a121f45aac cs: use print-pair-curly-braces 2019-05-28 10:04:23 -03:00
Gustavo Massaccesi
006265e447 cs: use print-mpair-curly-braces 2019-05-28 10:04:23 -03:00
Jesse Alama
674242dfcf Say "GRacketCS" rather than "GracketCS"
On case-sensitive filesystems on macOS, these are
distinct (leads to a file not found error). On
case-insensitive systems, the change should not matter.
2019-05-28 06:34:58 -06:00
Matthew Flatt
155733eada io: fix function name in some error messages 2019-05-27 13:56:20 -06:00
Matthew Flatt
40846e3ed9 racket/system: add some missing synchronization
These changes are intended to address "input port is closed" errors
that have been showing up with Racket CS, possibly because its
scheduler exposed missing synchronization.
2019-05-27 10:39:19 -06:00
Matthew Flatt
0bffb7035d cs: fix weak equal? hash tables
The pruning step was wrong, causing lists of cleared weak boxes to
accumulate. This leak particularly affected `datum-intern-literal`.
2019-05-27 08:23:52 -06:00
Matthew Flatt
9d3a49f265 cs: move letrec conversion to schemify
Instead of having schemify generate `letrec*` and convert as needed
through a Chez Scheme macro, have schemify perform any necessary
conversion to get the right use-before-definition error messages and
`call/cc` interaction.

This change improves the conversion, since schemify has more
information about bindings, but it also avoids sending Racket terms
through a macro-generating macro at the Chez Scheme level. Avoiding
the macro-generating macro avoids a kind of leak in Chez Scheme, where
a gensym used in a template may become ineligible for GC due to the
way `free-id=?` may both reify the gensym's unique name and attach a
property to the gensym.
2019-05-27 06:03:50 -06:00
Matthew Flatt
fe708871bd cs: avoid a leak due to prefab declarations 2019-05-26 11:56:25 -06:00
Matthew Flatt
f0c39b1f81 cs & threads: fix weak reference from custodian
Using a will executor to turn a reference from weak to strong still
seems like an ok idea, but it needs to be a regular will executor,
because a custodian-registered value is likely to involve have a
nested self-reference.
2019-05-25 18:31:15 -06:00
Matthew Flatt
e43bfd5767 cs: fix compression-conversion build step to support LZ4 2019-05-25 07:36:06 -06:00
Matthew Flatt
fb8368e373 cs: fix handling of non-typical make-struct-type forms
Some checks were missing to guard the transformation of a `struct`
expansion into a Chez Scheme `define-record-type` expansion.
2019-05-25 07:36:06 -06:00
Matthew Flatt
b33075f4c5 raco setup: fix target machine reporting 2019-05-25 07:36:06 -06:00
Matthew Flatt
3d3f1a408c get-lib-search-dirs: repair for cross-compile mode
More generally, repair the internal `exe-relative-path->complete-path`
function to work when the current directory is not the original
current directory and `racket` is started with a relative path.
Currently, it happens that `exe-relative-path->complete-path` is
called with a potentially different directory only by
`get-lib-search-dirs`.
2019-05-25 07:36:06 -06:00
Matthew Flatt
5896462e1a cs: uncompress boot files
When the compression format changed to LZ4, which is much faster to
decompress than zlib, the configure script changed to enable
compression by default. Bytecode tends to benefit all around from
compression, but the boot files take 20ms or so longer to load --- not
a lot of time when loading typical amounts of code, but a signficiant
cost for a minimal startup. This commit allows compression to be
controlled separately for boot files, and it configures them as
uncompressed by default.
2019-05-23 13:58:05 -06:00
Matthew Flatt
d9c8ef964c generate version string from individual numbers
Thanks to @sorawee for pointing me to
  https://stackoverflow.com/a/5459929/718349
2019-05-22 16:48:25 -06:00
Matthew Flatt
b219f92113 fix version number
Correct mistake in prvious commit.
2019-05-22 15:12:59 -06:00
Matthew Flatt
9178169370 bump version number
Syncing with the main Chez Scheme branch changes the header on
compressed bytecodes, so force recompilation of Racket CS ".zo"s.
2019-05-22 13:43:01 -06:00
Matthew Flatt
a23e0a3a57 cs: fix checking and arity of unsupported extfl functions 2019-05-22 10:36:42 -06:00
Matthew Flatt
ba0934521e cs: rewrite division-by-zero error message 2019-05-22 10:36:42 -06:00
Matthew Flatt
ceef969d48 cs: remove trailing space in error message 2019-05-22 08:37:22 -06:00
Matthew Flatt
55c8c12f2f planet: adapt to work with Racket CS overlay build 2019-05-22 08:30:41 -06:00
Matthew Flatt
0b74787419 cs: fix chaperone-of? for hash tables with nested chaperones 2019-05-22 08:30:20 -06:00
Paulo Matos
e2ab4869d7
Remove unnecessary MZ_USE_JIT (#2602)
* Remove irrelevant #ifdefs MZ_USE_JIT

Bonus points - fixes a compiler warning on aarch64 and a typo.

* Fixes a compiler warning on aarch64 for unused current_linklet_native_lambdas
2019-05-22 16:25:04 +02:00
Paulo Matos
ce76c673b1
Simplify conditionals after removing dead store of has_space (#2489)
* Simplify conditionals after removing dead store of has_space

The conditional simplification looks good to me. The biggest issue
here was to understand if when `pipe_quote` is true, we can and should
go to the else clause. Actually the more I look at it the more I think
this uncovers and earlier bug where if pipe_quote is true, result and
total_length are left at NULL and 0 respectively after the block.
2019-05-22 15:30:44 +02:00
Matthew Flatt
cd31b308af cs: sync error message for undefined identifier 2019-05-22 07:01:48 -06:00
Matthew Flatt
266c5eeb9b threads: fix for multiple threads with the same wakeup time 2019-05-21 13:57:42 -06:00
Matthew Flatt
7067ac8bfa cs: fix weak reference for GC-callback registration 2019-05-21 10:48:23 -06:00
Matthew Flatt
97672bb00c change datum->syntax treatment of code inspectors
Change `datum->syntax` so that it limits the transfer of a code
inspector from a source syntax object; the code inspector is kept only
if a macro is being expanded and the macro has the same code inspector
(or, more generally, the weaker of the two code inspectors is
preserved).

This change is a kind of defense-in-depth to prevent the use of
unarmed syntax with `datum->syntax` to access unexported bindings from
the module where a syntax object originates.

The general approach is Ryan's idea. This particular implementation is
a simplification of the general idea, and we'll see whether it's
worakble and sufficient.
2019-05-21 09:59:19 -06:00
Matthew Flatt
ed5bb40109 cs: implement compile-enforce-module-constants 2019-05-21 09:59:19 -06:00
Matthew Flatt
b268f77ae9 cs: fix vector-set! and set-box! impersonation
Use the result from an interposition to install into the vector or
box, instead of the original value.
2019-05-21 09:59:19 -06:00
Matthew Flatt
541a8e870f cs: fix struct constructor result for object-name 2019-05-20 06:48:08 -06:00
Matthew Flatt
55728352f4 schemify: optimize local struct declarations
Rewrite locally declared structure types to expose them to the
compiler in the same way as module-level declarations.
2019-05-20 06:48:08 -06:00
Paulo Matos
6e7920e204
Enable ubsan configure argument for CS (#2658)
* Refactor --enable-ubsan to m4 macro and include it from racket and cs
* Regenerate configure scripts
* upload ubsan artifacts even if it fails
2019-05-20 11:41:22 +02:00
Alexis King
18e897bfb8 expander extract: Improve purity analysis for struct type properties
The changes in aab63ad3 introduced a dependency on
racket/private/promise, which the analysis was not capable of dropping
due to the use of the `prop:force` property. This caused trouble for the
thread layer, since it introduced a reference to `error`, which is
defined in the io layer. This change adds some additional detection for
struct type properties with guards that accept procedures of particular
arities, which allows `prop:force` to be marked as pure.

Also, a typo in the thread layer’s Makefile meant globals weren’t
actually getting tracked, so this fixes that, too.
2019-05-19 10:48:04 -05:00
Alexis King
aab63ad31d Add for[*]/foldr[/derived] and reimplement for[*]/stream using it
`for/fold` is a left fold, which is normally what you want in a
call-by-value language such as Racket, but it makes efficient lazy
iteration difficult. This commit adds a new `for/foldr` iteration form
(along with `for*/` and `/derived` variants) that provides a right fold
operation that offers complete control over precisely how lazy the
iteration ought to be.

In simple microbenchmarks, reimplementing `for/stream` to use
`for/foldr` instead of `for` plus a generator can be almost 40x faster
on large streams.
2019-05-19 10:47:54 -05:00
Matthias Felleisen
52bde149f3 where to find the docs and the tests 2019-05-18 12:57:00 -04:00
Matthew Flatt
cc73ec8d69 reader: see new parameter values in read/recursive
When `read/recursive` is used, do not inherit parameter values
recorded by an enclosing `read`, and instead look them up again.
This change restores behavior of the old reader.

Closes #2661
2019-05-18 12:52:45 -04:00
Matthew Flatt
39fe53f5d5 reader: fix number->string case insensitivity
For example, `1+2I` and `+INF.FI` should parse as numbers.

Closes #2660
2019-05-18 12:22:01 -04:00
Matthew Flatt
236e2768f8 cs: fix structure-preicate-procedure? for some cases
Fix `structure-preicate-procedure?` on a predicate returned by a
`make-struct-type` call that isn't effectively inlined by schemify.
2019-05-18 12:22:01 -04:00
Matthew Flatt
2c16beb942 cs & threads: fix plumber flushing interleaved with addition
A plumber is supposed to gather all callbacks before running any of
them so that callbacks added by a callback are not run.
2019-05-18 12:21:51 -04:00
Matthew Flatt
7f92443a5f adjust printing of renamed procedures
When ">" appears in a procedure name, or when other characters appear
that would normally need to be escaped in a symbol, don't add escapes
since `#<....>` isn't readable anyway. This change makes renamed
procedures print in a consistent way with primitive procedures.

Similarly adjust the printing of structure type names.

Closes #2646
2019-05-18 09:55:23 -04:00
Matthew Flatt
a56c984db0 avoid incorrect unix-style inference
Closes #2659 by both recognizing `lib64` as a default path and by
having `--enable-origtree` override inference and specified when
running `configure` through the root makefile.
2019-05-18 07:56:02 -04:00
Matthew Flatt
cc487a4d9a cs: fix incorrect impersonator discard in chaperone-of? 2019-05-18 06:39:37 -04:00
Matthew Flatt
b3f66a4973 repair prop:impersonator-of interaction with {impersonator,chaperone}-of?
Relevant to #2644
2019-05-18 06:39:37 -04:00
Alexis King
6ae082fccd class/c: Swap after, not before, adding #:important blame context
Swapping the blame before adding #:important context associates the
important party with the negative party for the purposes of picking
“contract violation” versus “broke its own contract” messages in error
reporting. Therefore, only swap after adding the context.

fixes #2531
2019-05-17 19:57:26 -05:00
Matthew Flatt
ddb944d583 improve precision of / on complex numbers with small parts
Closes #2654
2019-05-14 07:57:03 -06:00
Matthew Flatt
0d55a05b46 cs: fix a case in unsafe-add-collect-callbacks
Fix a function-call shape that is used for GTK+2.
2019-05-12 14:45:26 -06:00
Matthew Flatt
ff95f1860a io: fix hostname lookup for tcp-listen
Need to lookup with "passive" flag. Some platforms/configurations
apparently don't care, but some do.
2019-05-11 18:56:57 -06:00
Paulo Matos
a672ac9907
Fix simple typo
s/emable/enable/
2019-05-11 17:48:01 +02:00
Matthew Flatt
59d5300f77 makefile: fix configure dependencies
Reconfigure if "cfg-racket" changes without "configure" changing.
2019-05-10 21:21:54 -06:00
Lukas Lazarek
001eeded9f racket/contract: Fix (box/c #:immutable #f) failing on mutable boxes 2019-05-10 21:05:23 -05:00
Matthew Flatt
bfe649bcc7 adjust GC behavior to be more usable without generational collection
Instead of limiting the nursery size and performing a full GC every
time a small nursery is full, allow the nursery to be proportional
to the total heap size if generational GC is disabled.
2019-05-10 19:45:05 -06:00
Paulo Matos
7c3a207f36 Add configure option --enable-generations (enabled by default).
This option allows the user to enable or disable (with
--disable-generations or --enable-generations=no) generations in
3m. Disabling generational collection is, in most cases, a bad
idea, but it may be necessary on a platform where signal handling
doesn't work well enough to support a write barrier that is
implemented with page protection.
2019-05-10 19:44:46 -06:00
Matthew Flatt
eeaac9c142 avoid unspecified NULL passed to memcpy
Closes #2632
2019-05-10 19:35:38 -06:00
Matthew Flatt
bb7836e734 cs: support --enable-natipkg 2019-05-10 17:35:53 -06:00
Paulo Matos
75cc43aa56
In autoconf 2.70 variable runstatedir was added - ignore (#2606)
Ignore new autoconf variable added in 2.70.
The interesting thing is that debian decided to backport this variable
to their 2.69 release so in some 2.69 autoconf this variable does not
exist but in debian ports 2.69 generates this variable. It is
nonetheless not useful for Racket, so add to ignore list.
2019-05-10 18:19:49 +02:00
Matthew Flatt
d5a46eb39d cs: repair build without --enable-racket
When using a built-for-bootstrapping Racket to build Racket CS, the
intermediate module loading module mode should be `--boot` instead of
`--chain`. The repo's top-level makefile takes care of that already,
but not `configure`-generated makefiles as may happen in a build from
a source distribution.
2019-05-10 07:20:31 -06:00
Robby Findler
2c3fce244c added #:unprotected-submodule 2019-05-08 20:32:04 -05:00
Matthew Flatt
b7d738d59a cm: fix lock more
Still trying to get it right for the repair started in 70e0cac062 and
continued in ef1004fdc0.
2019-05-06 20:17:38 -06:00
Matthew Flatt
93d84170d0 read: fix #e after #x
Corrects a bug in 0549bfb1e5 where `#x` causes the `e` in `#e` to be
interpreted as 14 instead of the character `#\e`.
2019-05-06 08:14:20 -06:00
Matthew Flatt
bed23e221e update racket HISTORY.txt for v7.3 2019-05-06 07:34:55 -06:00
Matthew Flatt
83ad6bd7c1 cs: fix banner and make startup use it
The string returned by `banner` was missing a "v" and a "." compared
to the traditional result. Avoid duplicating the string in "main.sps".
2019-05-05 17:34:04 -06:00
Matthew Flatt
151b5755c5 cs: repairs for inaccessible custodians and custodian boxes
Allows an inaccessible custodian to be GCed, promoting any values that
it manages to its parent custodian. Also repair memory accounting for
custodian boxes.

For values referenced by a custodian, the nature of the custodian's
weak references is slightly different on Racket CS. The reference is
weak enough that the value can be finalized via will (e.g., to close
an unused port), but it's not weak enough to allow weak boxes, weak
hash table keys, or ephemeron keys to be cleared. That's a consequence
of using ordered finalization instead of finalization/weakness levels.
This difference could be avoided at the cost of an extra wrapper for
any finalized value and a discipline of using such wrappers as the
user-visible reference for all custodian-managed values, but semi-weak
references so far appear to be practical and a better compromise.
2019-05-03 19:16:45 -06:00
Matthew Flatt
9951efc891 cs: fix unsafe-thread-at-root to use the root custodian
Otherwise, a finalization thread can get shut down, resulting in a
leak.
2019-05-03 15:00:33 -06:00
Matthew Flatt
ef1004fdc0 cm: fix lock
Commit 70e0cac062 neglected to use `#:for-lock? #t` as intended.
2019-05-03 12:57:58 -06:00
Matthew Flatt
f52fdfdd6e expander: preserve inlining annotations in machine-independent bytecode 2019-05-03 10:36:42 -06:00
Matthew Flatt
920c899ba8 thread: adjust use of later will executor for custodian
The use of a will executor for a custodian is a bit of a hack, and it
doesn't want the "keep live until executed" constraint. So, add an
optional internally.
2019-05-03 06:28:25 -06:00
Matthew Flatt
e13fac3ccf foreign: document internal make-late-will-executor
Also, rename from "stubborn" to "late" internally to be more
consistent and avoid overloading "stubborn" in the allocator.
2019-05-03 06:20:11 -06:00
Matthew Flatt
032479cf2c keep late will executors live with pending wills
If a late will executor has pending will, then it needs to stay
live until the enclosing place has terminated (and post-custodian
callbacks are run). Otherwise, `ffi/unsafe/alloc` can lose values
that it expects to finalize, and it reports an "internal error".

The late will executor for `register-finalizer` from `ffi/unsafe`
was kept live in traditional Racket, but only as an accident of
custodian shutdown in a terminating place: the shutdown process skips
threads, since that work is technically not necessary. Relying on that
coincidence is asking for trouble, though, so implement retention more
deliberately.
2019-05-03 05:39:15 -06:00
Matthew Flatt
358764faac cs: fix retention of late will executors
A late will executor must stay live as long as it has finalizations
registered.
2019-05-03 05:38:54 -06:00
Matthew Flatt
8f5f0a4330 cs: implement foreign-call locks 2019-05-02 20:09:43 -06:00
Matthew Flatt
d5243820f6 cs & schemify: faster ptr-ref and ptr-set! on primitive types
Recognize `(ptr-ref <ptr> _uint8)`, etc., and turn it into a more
direct `(ptr-ref/uint8 <ptr>)`, etc. This improvement speeds PNG
loading by a factor of 10 to 20, for example, because the
implementation expects the pattern to be recognized.
2019-05-02 17:31:40 -06:00
Ben Greenman
a13070f302 racket/contract: improve fast-append
test whether the 2nd arg is null once, rather than N times
2019-05-02 11:35:55 -04:00
Ben Greenman
721ef2050f racket/contract: move comment
Move a comment closer to the code it talks about
2019-05-02 11:35:55 -04:00
Matthew Flatt
5b929a7621 io: fix port custodian unregister
Make unregister match the register change in 11789ff8b0.
2019-05-02 07:26:20 -06:00
Matthew Flatt
651fc3ae5e ffi/unsafe/com: use ffi/file instead of C API 2019-05-01 14:43:36 -06:00
Matthew Flatt
92c12de018 cs: implement prop:exn:srclocs in exn:fail:read 2019-05-01 14:43:36 -06:00
Matthew Flatt
fb968db7a5 cs & thread: detect plumber-flush errors on place exit 2019-05-01 13:46:46 -06:00
Matthew Flatt
cfeef54a28 cs & threads: run post-custodian shutdown actions on place exit 2019-05-01 13:22:47 -06:00
Matthew Flatt
193bec6b7d cs & threads: more place-message repairs for graphs 2019-05-01 09:24:39 -06:00
Matthew Flatt
9268dcaad3 cs: better handling for contended hash-table locks
When the number of places approaches the number of available
processing cores, then a spin lock isn't good enough for a small
number of contended hash tables (maybe just one of them). When
contention is discovered, fall back to a mutex-based lock.
2019-05-01 09:24:39 -06:00
Alexis King
1101461434 rktio: Make sure not to close subprocess standard in/out/err
When spawning a new subprocess, it's possible that one or more of the
new process's standard input, output, or error descriptors use file
descriptor 0, 1, or 2, even if they don't correspond to any of the
parent process's original standard input, output, or error descriptors.
This can happen if the parent process closes one of its standard
descriptors, and the operating system reuses the file descriptor number
for a new descriptor.

Therefore, be more careful about closing and copying file descriptors in
the child process before calling `exec`. Specifically, move file
descriptors out of the way as needed so they aren't clobbered, and
accommodate cases where multiple standard streams may share the same
file descriptor in the parent process.

fixes #2634
2019-05-01 09:10:33 -05:00
Matthew Flatt
f3de3e4584 cs & threads: repairs for places
Includes a repair for handling vectors and prefab structs that are
involved in cycles.
2019-04-30 20:28:38 -06:00
Matthew Flatt
635c64e8bb racocs make: repair --no-deps destination 2019-04-30 19:00:52 -06:00
Matthew Flatt
1de69c4d37 cs & thread: repair retention of subcustodians
A subcustodian was incorrectly registered as weak for its parent,
which means that an unreferenced custodian could get lost when
shutting down an ancestor.
2019-04-30 18:10:17 -06:00
Matthew Flatt
dcb0f422a9 cs & io: fix shared byte strings over place channels 2019-04-30 17:46:10 -06:00
Matthew Flatt
f5836d7a30 racket/rerequire: repair for Racket CS 2019-04-30 17:46:10 -06:00
Matthew Flatt
5f53c91c6e cs: repair make-sibling-inspector 2019-04-30 17:46:10 -06:00
Matthew Flatt
164442ab26 fix place-message-allowed? on an empty vector 2019-04-30 17:46:10 -06:00
Matthew Flatt
436f3d8f64 io: fix handling of sharing in place messages 2019-04-30 17:46:10 -06:00
Matthew Flatt
11789ff8b0 io: fix socket/fd port custodian registration
Register the port, not the file descriptor, especially since a TCP
connection can have ports that share a file descriptor. Also, I think
a weak reference in the custodian doesn't work as intended (visible
through finalization) if the file descriptor is referenced with a
callback that closes over the port.
2019-04-30 14:40:17 -06:00
Matthew Flatt
cf08436e05 cs: fix custodian shutdown of TCP to use shutdown
In other words, send an EOF over TCP on custodian shutdown.
2019-04-30 14:40:17 -06:00
Matthew Flatt
258fb8fafd cs: use print-as-expression in default print handler 2019-04-30 14:40:17 -06:00
Matthew Flatt
a3fcaf92df racket/class: remove excessive syntax-protect
No `syntax-protect` is needed for `define/private`, etc., because no
new identifiers or expressions are introduced. Adding extra dye packs
can interfere with other macros that pull apart syntax (although maybe
the macros shouldn't do that without using `syntax-disarm`).
2019-04-30 09:07:59 -06:00
Matthew Flatt
dd22b8b599 io: correct custodian assumption
A custodian doesn't provide any order on shutting down the objects
that it manages (I was confused about some past experiments), so
avoid that assumption.
2019-04-29 17:39:24 -06:00
Matthew Flatt
b3b240ebc7 rktio: correct problem with change to growable poll set 2019-04-29 16:09:48 -06:00
Matthew Flatt
c4f44eaedd cs: fix cross-build bootstrap
Fix the relevant makefile target.
2019-04-29 13:29:09 -06:00
Matthew Flatt
bd5677da70 Revert "cs: fix cross-build bootstrap"
This reverts commit e13fcd6226.

Wasn't the right change, because the modified targets aren't used for
a cross build.
2019-04-29 13:29:09 -06:00
Ryan Culpepper
77a54c1af6
ffi-lib: log success, log failures with candidates tried (#2566) 2019-04-29 16:52:23 +02:00
Matthew Flatt
535bfcb0c3 cs: repair shared poll set initialization
Esspecially affects filesystem change events on Mac OS and BSDs.
2019-04-29 07:41:11 -06:00
Matthew Flatt
5c7d7aae68 rktio: fix fd leak in filesystem-change-evt with kqueue
Affects Mac OS and BSDs.
2019-04-29 07:41:11 -06:00
Ryan Culpepper
cbfaf428d2 syntax/parse: add describe frame if opaque even if no description
fixes #2627

Also fix a bug where eh-alternatives were mistakenly marked opaque.
2019-04-29 09:00:19 +02:00
Matthew Flatt
8f0fb72160 repair chaperone handling in potential place messages
Closes #2630
2019-04-28 10:27:34 -05:00
Matthew Flatt
e13fcd6226 cs: fix cross-build bootstrap 2019-04-27 19:53:21 -05:00
Ben Greenman
1a4192f697
typo: reword install/clone error message (#2609) 2019-04-27 11:43:21 -04:00
Alexis King
930046e729 wrap-expr/c: Add #:phase argument to control phase of introduced syntax
closes #2455
2019-04-26 12:34:27 -05:00
Ryan Culpepper
1481f3e8d9 sqlite3: fix reporting of insert-id 2019-04-26 13:35:08 +02:00
Matthew Flatt
8d77b8403c cs-boostrap: repairs to work in Racket CS 2019-04-25 20:45:42 -06:00
Matthew Flatt
01eec4ef9a expander: more reserved names to accomodate schemify
Compiling the Chez Scheme bootstrap library in Racket on Chez Scheme
is a good way to discover missing reserved symbols.
2019-04-25 20:04:14 -06:00
Matthew Flatt
c59ba15522 cs: unbreak async foreign callbacks
Adds a changed missed in 1624193210.
2019-04-25 19:52:00 -06:00
Matthew Flatt
776996fe24 cs: implement unsafe-{file-descriptor,socket}->semaphore
Use `unsafe-{file-descriptor,socket}->semaphore` internally to
make scheduling scalable for threads blocked on sockets, like
traditional Racket.
2019-04-25 19:29:33 -06:00
Matthew Flatt
05fe76f49a repair module name resolver
Revert an accidental change in 2d3ee903ec.
2019-04-25 17:19:47 -06:00
Matthew Flatt
2d3ee903ec cs: implement filesystem change events 2019-04-25 16:12:01 -06:00
Matthew Flatt
20672cd60a make Chez Scheme bootstrap work as a "cs-bootstrap" package 2019-04-25 10:09:26 -06:00
Matthew Flatt
1624193210 reduce overhead and precision of per-thread cpu times
Getting the current CPU time is relatively expensive, so get it only
on thread swaps where a thread used its full quantum or 1/100 swaps
otherwise. This approximation should work because thread-specific CPU
times are rarely requested, and they make the most sense for threads
that don't constantly swap out due to synchronization.
2019-04-25 08:23:32 -06:00
Matthew Flatt
84deff1d02 cs: more explicit handling of acessor/mutator errors
Formerly, an expression like `(arity-at-least-value 7)` could crash,
because the `arity-at-least-value` accessor is created in unsafe mode,
and the slow path to accessor errors attempted to use the accessor to
provoke an error message. Instead of using a potentially unsafe
accessor, have the slow path raise an error explicitly with
`raise-argument-arror`. That change has the added benefit of making
error messages mach traditional Racket (at least for structure types
that are not declared as "authentic").

The problem was exposed by tests added in 55dcdf5538.
2019-04-24 16:50:49 -06:00
Matthew Flatt
a600991ff7 cs: fix typo in error-message constructor 2019-04-24 15:42:26 -06:00
Matthew Flatt
92e937032d cs: repair number->string on most negative fixnum 2019-04-24 15:40:58 -06:00
Matthew Flatt
fa1861869e cs: use continuation marks for module context
Instead of a separate hash table mapping continuations to
linklet-instance names, use a continuation mark. That's faster,
because capturing a continuation means copying part of it on continue.
2019-04-24 15:05:46 -06:00
Matthew Flatt
688f03e208 cs: avoid some hashtable overhead during linklet instantiation 2019-04-24 12:54:38 -06:00
Matthew Flatt
a0b1791a9d declare deserializaton helper linklet as consistent
Declaring as consistent avoids some application indirections on Racket
CS, for example.
2019-04-24 12:33:00 -06:00
Matthew Flatt
42009925dc cs: reduce allocation on linklet instantiation
Avoid some closure creations and `append`s. The performance
improvement is very small, but measurable.
2019-04-24 11:03:04 -06:00
Matthew Flatt
d69f5cf00f cs: restore cross-module optimization
A backwards `if` in a7988c3813 disabled cross-module optimization.
2019-04-24 10:39:05 -06:00
Matthew Flatt
20e669f478 adjust local-require to help Check Syntax
Currently, Check Syntax has trouble correlating `require` forms and
references to imports that go through a macro-introduced rename
transformer. For example, there's no binding arrow from the final
`starting` to the `racket/list` in

 #lang racket/base
 (require (for-syntax racket/base))

 (define-syntax-rule (define-as-first mod starting)
   (begin
     (require (only-in mod
                       [first initial]))
     (define-syntax starting (make-rename-transformer #'initial))
     starting))

 (define-as-first racket/list starting)
 starting

But change the last two `starting`s to `initial`, and the binding
arrows work.

Until a general repair is in place for Check Syntax, this commit
adjusts 38d612dba6 to use the original export name for an immediate
binding, which acts as a hint to the current Check Syntax
implemenration.
2019-04-24 07:59:06 -06:00
Philip McGrath
c838d01c09 typo: inatll -> install 2019-04-24 06:12:19 -06:00
Matthew Flatt
31101c57db bytecode compiler: fix coordinate problem in letrec check
Example provided by Jay
2019-04-23 18:19:42 -06:00
Alexis King
72ab50a993 Establish free-id=? equivalences in intdefs with local bindings in scope
fixes #2594
2019-04-22 22:50:16 -05:00
Alexis King
38d612dba6 local-require: Remove last remaining use of syntax-local-get-shadower 2019-04-22 22:49:14 -05:00
Matthew Flatt
701a86b863 source "README.txt" corrections related to Racket CS builds 2019-04-22 19:06:24 -06:00
Matthew Flatt
e001f3b3cb include ChezScheme sources in a source distribution
Note that the source-distribution client must have a
"build/ChezScheme" checkout created, maybe by building as a 'cs
variant. A pruned version of that checkout is then included with other
sources. The resulting source distributon then works for building
either Racket variant.

Adapt the configure scripts and makefiles to use a "ChezScheme"
directory that is bundled with sources.
2019-04-22 16:56:17 -06:00
Matthew Flatt
21ad81b4fc cs bootstrap: move struct declaration to centralized module
Keep together declarations that need to match the Chez Scheme
implementation.
2019-04-22 07:24:38 -06:00
Gustavo Massaccesi
55dcdf5538 fix jit-inlining of struct primitives
Some expressions like (date-day) gave usually an arity error, but when they
were inlined by the JIT the arity check was wrong, so they produce a segfault
or a nonsensical result.
2019-04-20 20:09:57 -03:00
Matthew Flatt
4b586eeadf cs: faster Chez Scheme bootstrap
Improve record encoding to make it more exposed to the compiler.
2019-04-20 13:27:02 -06:00
Matthew Flatt
8c8979369f cs: switch Chez Scheme download to racket/ChezScheme at GitHub 2019-04-20 08:32:36 -06:00
Matthew Flatt
e2de99f0b9 cs: adjust build to use Racket bootstrap of Chez Scheme 2019-04-20 08:25:20 -06:00
Ben Greenman
f26b793e9a recursive contract: add else-branch to a cond
Raise an exception if none of the other cases match, instead of
returning `(void)` where a contract is expected
2019-04-19 20:43:44 -05:00
Matthew Flatt
e337c65204 implement bootstrap of Chez Scheme using Racket
Provide a way to build Chez Scheme from source using Racket. In the
short run, this lets us distribute source that ultimately depends only
on a C compiler (since a variant of Racket can be built from source
using just a C compiler).
2019-04-19 13:45:50 -06:00
Matthew Flatt
7e9d167101 expander: fix namespace-require/copy for some require specs 2019-04-19 13:44:14 -06:00
Ben Greenman
6d7550125f typo: change error messages for vectorof contract
- change an 'an' to 'a'
- remove 'immutable' where expecting either mutable or immutable (don't
  bother to specify which, because `vector-common.rkt` doesn't bother)
- remove extra ','
2019-04-18 07:15:08 -05:00
Matthew Flatt
e1ad8d4721 cs: fix path on discovered Chez Scheme library name
Corrects 8a368cac99.
2019-04-12 06:56:07 -06:00
Matthew Flatt
615677299e switch Mac OS back from poll to select
The `poll` system call doesn't work right for fifos, so switch
back to `select`, but use a new strategy to size fd_set buffers
instead of trying to use `getdtablesize` (because the result
of `getdtablesize` can change dynamically on Mac OS).

Also, add a check for input at the rktio level when trying to read
from devices other than regular files. Otherwise, Racket CS (which
doesn't have some redundant polling that is in traditional Racket)
sees spurious EOFs for unconnected fifos.

Closes #2577
2019-04-10 12:34:40 -06:00
Matthew Flatt
4c53b514cf cs: correction on compiler flags for object-name
Repairs a mistake in 40b8b5c675.
2019-04-10 07:55:24 -06:00
Matthew Flatt
8a368cac99 cs: fix discovery of Chez lib name on Windows 2019-04-10 07:52:11 -06:00
Paulo Matos
9e8b9d8959
Remove value store in ready_pos but unread (#2588)
* Remove value store in ready_pos but unread

* Move declaration of ready_pos to where it is used

* Make discard of return value of tcp_check_accept explicit

* Split declaration and var assignment to comply with xform
2019-04-10 14:14:57 +02:00
Paulo Matos
5a3d7b87e4
Remove dead assignment to ch (#2589)
Remove dead assignment to ch and make discard return value explicit
2019-04-10 08:37:37 +02:00
Paulo Matos
2919d21d1d
Remove dead assignment to target_offset (#2590) 2019-04-10 08:34:06 +02:00
Paulo Matos
93224561f8
Fix --enable-cify option (#2598)
I guess, a previous copy-paste AC_ARG_ENABLE meant that cify never had
its own option.
2019-04-10 08:32:52 +02:00
Matthew Flatt
40b8b5c675 expander extract: improve pure-function analysis
Improve the analysis enough to handle changes to
`make-keyword-procedure` (in 47467a1dba) and restore the Racket CS
build.
2019-04-09 16:12:31 -06:00
Gustavo Massaccesi
9f9b3f4443 cs: fix check of Chez Scheme version
Merge to v7.3
2019-04-09 18:03:57 -03:00
Matthew Flatt
ef49ccf87a cs: fix chaperone-struct on accessor/mutator taking a position
Closes #2570
2019-04-09 11:53:27 -06:00
Matthew Flatt
247c985702 cs: faster (current-memory-use 'cumulative)
A slow `(current-memory-use 'cumulative)` could causes misleading
results in `PLT_EXPANDER_TIMES` output for frequent actions.
2019-04-09 11:53:27 -06:00
Matthew Flatt
d61f56c77f cs: imprve fixnum hashing
Avoid collision for 0 and -1, for example.
2019-04-09 11:53:27 -06:00
Matthew Flatt
cc45dc044d cs: faster number->string on fixnums 2019-04-09 11:53:27 -06:00
Alexis King
1bf416a776 Make equal? on classes and objects see through class contracts
Making `equal?` do the right thing on classes turned out to be easy---it
just involved adding a straightforward `prop:equal+hash` property to the
`class` struct—but making it work properly for *objects* was the tricky
part. The trouble is that `equal?` on objects that don’t implement the
`equal<%>` interface is just ordinary structure equality, which can be
relevant if objects are inspectable. Writing `(inspect #f)` in a class
body is like making a struct `#:transparent`, and it has all the same
ramifications for equality.

The trouble is that `class/c` creates new wrapper classes, and every
class has its own struct type. Since the default behavior of `equal?` on
structs is to *never* be equal to structs of different types, even
subtypes, an object created from a contracted class can never be
`equal?` to an object created from the same class without contracts.

The solution is to add a `prop:equal+hash` property to `object%` itself
that emulates the default behavior of `equal?`, but sees through class
contract wrappers. Since struct type properties are inherited by
subtypes, this property will be present on all objects, and it only
needs to be attached once.

fixes #2279
2019-04-09 12:27:27 -05:00
Alexis King
47467a1dba Avoid creating procedures with internal source locations as names
Mainly, this improves `make-keyword-procedure`: when applied to a single
argument, it now uses `procedure-rename` to ensure the resulting
procedure has the appropriate name. A couple other changes also guard
against the case where a lambda expression has no inferred name and no
source locations information, which would lead to the source locations
in the implementation being used, instead.
2019-04-09 12:27:11 -05:00
Matthew Flatt
0d2dd8f578 cify: fix multiple-value return where braces are needed
Merge to v7.3
2019-04-08 13:15:19 -06:00
John Clements
5ce11626ef Post-release version for the v7.3 release 2019-04-08 10:55:30 -07:00
Paulo Matos
b9b6d97b30
Make second argument of scheme_os_getcwd a size_t (#2584)
By being an unsigned type, we ensure that when 0 is passed we know
that there's no smaller number. This aids the static analyzer.
2019-04-08 17:25:43 +02:00
Matthew Flatt
e6aef1093b expander: fix submodule order nondeterminism
The nondeterminstic order could lead to a mismatch that caused
Racket CS to crash on submodule tests.
2019-04-08 07:23:47 -06:00
Matthew Flatt
d87be8789e cs: use new $record-ref, etc., primitive
Also, speed up hashing and logging a little by adjusting semaphores to
succeed with `$record-cas!` when no waiting is necessary.
2019-04-08 11:13:01 +02:00
Matthew Flatt
39c67f8b6a cs: require Chez Scheme 9.5.3 2019-04-07 10:32:55 +02:00
Matthew Flatt
5a638073eb cs: avoid abuse of vector-ref for struct-ref
Use `$object-ref`, instead. Otherwise, cptypes can detect the abuse of
`#3%vector-ref` and make unwanted transformations.
2019-04-07 10:24:54 +02:00
Matthew Flatt
d8125082a2 cs: improve hash-code mixing 2019-04-07 10:24:54 +02:00
Alexis King
b6db4f7be1 class/c: Fix init arg contract projections being dropped
Previously, all init arg contracts’ first order checks were always
checked, but a typo meant all but one of the projections was always
dropped! This fixes that, and it removes a little nearby dead code while
we’re at it.
2019-04-04 15:27:14 -05:00
AlexKnauth
935c558717 fix uses of raise-arguments-error
one message string and no field-value pairs
2019-04-02 11:10:16 -04:00
Matthew Flatt
cbd565a3fd fix interpreted begin0 to for a 0-result case
In some cases, 0 results will be represented by a NULL results-array
pointer. Fix the interpreter to detect a single result completion
through a count of 1 instead of a NULL result-array pointer.

Also, remove a bug extra push operation in the JIT-generated code for
`begin0`. (Other features of the JIT-generated code compensated for
the extra push in cases where the bytecode compiler did't optimize
away the `begin0`, so it turns out not to have caused a problem, but
that's a surprising and fragile set of coincidences.)

Closes #2571
2019-03-30 20:41:01 -06:00
Matthew Flatt
e7456d3e9e io: avoid some unneeded work when sending paths to rktio 2019-03-30 20:41:01 -06:00
Matthew Flatt
dd9e11e1c7 cs: fix $value confusion in schemify and begin0
The attempted repair for `$value` in 6c195d521c was wrong.
2019-03-29 11:00:44 -06:00
Matthew Flatt
253f0f4383 cs: add guard for prop:arity-string
Relevant to #2569
2019-03-29 10:59:04 -06:00
Matthew Flatt
fdad73df32 cs: fix keyword-procedure chaperone with properties
Closes #2569
2019-03-29 10:46:29 -06:00
Matthew Flatt
793d655770 cs: limit linklet performance stats to main place
Avoids crashes due to a lack of synchronization, and makes
Racket CS consistent with Racket.
2019-03-29 10:21:15 -06:00
Matthew Flatt
6c195d521c cs: fix compilation of begin0 with only one expression
The problem was especially bad in the fallback interpreter,
where an ill-formed `begin` was created as a nested expression.
2019-03-29 10:06:26 -06:00
Robby Findler
7a9b1d065e Adjust ->i so that it sorts the pre/post conditions based on the dependency
order (like it does with the argument and result contracts), but ensuring
that the pre and post conditions come before the arguments (if possible)

closes #2560
2019-03-28 17:08:25 -05:00
Robby Findler
e1835074f5 refactor ->i implementation
so that it collects the pre/post conditions into sorted order with the
arguments (based on the dependencies), but then discards that
information and always evaluates the pre and post conditions after the
argument/result contract checks
2019-03-28 17:08:25 -05:00
bdeket
eea771ea64 improve accuracy of tanh function (#2565)
improve accuracy of tanh function

using the implementation of https://www.math.utah.edu/~beebe/software/ieee/tanh.pdf

by changing from (/ (- 1 exp2z) (+ 1 exp2z)) to (- 1 (/ 2 (+ 1 exp2z)) the accuracy after rounding is increased (I was comparing with bftanh) and removes the fluctuations around z=18.35
using the polynomial for z ϵ(1.290e-8 to 0.549) seems to increase the accuracy after rounding even further
see comparison: http://pasterack.org/pastes/48436

especially the fact that  (< (tanh 18.36)(tanh 18.37)) ;=> #t was tripping me up
the two extra conditions (z . < . 1.29e-8) and (z . < . 0.549) are optional to solve this
2019-03-28 05:36:18 -06:00
Matthew Flatt
82d5b46819 ELF tools: don't treat non-allocated section as allocated
For example, don't fail in shifting file offsets by misinterpreting an
unallocated section's null address as requiring a shift of virtual
addresses.
2019-03-27 15:07:08 -06:00
Matthew Flatt
db677018d0 remove unused debugging code
Closes #2564
2019-03-27 08:19:29 -06:00
Ryan Culpepper
0502e537d7 syntax/parse: update fix #1452
- Propagate disappeared uses from any pattern stx, not only those
  attached to forms that themselves have a disappearing use.
- Fix for new local-apply-transformer handling of scopes.
2019-03-26 18:30:43 +01:00
Ryan Culpepper
6c3031a5f7 add optional intro? argument to record-disappeared-uses 2019-03-26 18:30:43 +01:00
Georges Dupéron
85fe092ed9 Fixes #1452 syntax-parse discards the 'disappeared-uses property added by pattern-expanders 2019-03-26 18:30:43 +01:00
Georges Dupéron
c618ec803a Merge pull request #1691 from jsmaniac/syntax-parse-regexp
Adds built-in syntax classes which match regular expressions
2019-03-26 17:20:10 +01:00
Ryan Culpepper
22a9b0cf35 syntax/parse: fix spurious description for eh-alt-set
closes #2551
2019-03-26 16:58:46 +01:00
Alexis King
db3c1d4cb9 units: Avoid use-before-initialization errors in signature contracts
This commit fixes an issue with the fix for contracted bindings in
signatures implemented in commit 5fb75e9f82. While the previous fix
worked in simple cases, it introduced a problem: although signatures
that define contracted bindings were able to refer to other bindings
in the signature in the binding contracts, but anyone doing so was
at the mercy of the exporting unit’s definition order. For example,
given a signature

  (define-signature a^
    [(contracted
      [ctc contract?]
      [val ctc])])

then a unit exporting the signature would cause a
use-before-initialization error if its definition for val appeared above
its definition for ctc.

This limitation did not exist in the units implementation prior to the
introduction of the sets-of-scopes expander in Racket v6.3 (after which
contracted bindings were broken until the aforementioned fix in Racket
v7.2). However, the fact that they worked at all seems semi-accidental:
instead of properly indirecting references to signature bindings within
binding contracts, the contract expressions were simply placed in a
context in which the existing names were bound. However, this meant that
any export that renamed identifiers could cause problems, which the
implementation strategy taken in this commit handles just fine.
2019-03-25 13:58:51 -05:00
Lassi Kortela
1600bc5dc6 file/untar: allow leading as well as trailing blanks (#2553)
Some really old tar files can have both leading and trailing
blanks (nul/space characters) in the same octal number field in the
header.
2019-03-24 18:33:52 -06:00
Robby Findler
683492f6fe allow some redirections in the url that looks for the new version 2019-03-24 19:21:07 -05:00
Matthew Flatt
70e0cac062 compiler/cm: fix ".zo" file locking in -MCR mode 2019-03-23 14:47:36 -06:00
Matthew Flatt
3127b324c4 cs: more attempts to fix Chez Scheme submodule update
When `#:extra-repo-dir` is used in a site configuration, the
extra repos need to have a "master" branch to enable updates.
2019-03-23 10:40:59 -06:00
Matthew Flatt
32330c1327 cs: another fix for Windows build repo update 2019-03-22 20:35:47 -06:00
Matthew Flatt
0736898ccd cs: fix Windows build repo update
repair for 66efceee0e
2019-03-22 17:36:16 -06:00
Matthew Flatt
0fc4f69d1e cs: add needed header space for Mac OS executables 2019-03-22 11:55:24 -06:00
Matthew Flatt
66efceee0e cs: fix Windows script for updating Chez Scheme checkout 2019-03-22 08:41:08 -06:00
Matthew Flatt
e34dbdc4f4 defend against bad hash type in bytecode
The change to make `#hash()`, etc., unique made it easy for the fuzz
tester to crash the bytecode reader.
2019-03-22 07:34:36 -06:00
Matthew Flatt
3501fce192 expander: syntax-make-delta-introducer and mpi shifts
When the result of `syntax-make-delta-introducer` adds scopes,
it needs to carry along any shifts that might be relevant.

The new implementation risks adding lots of redundant shifts. In this
case, it might be worth spending extra effort at shift-transfer time
to check whether the shift is redundant.

Closes #2542
2019-03-22 07:18:06 -06:00
Matthew Flatt
7332060b69 raco make: fix parallel-build prefetch for relative submodule paths
Closes #2543
2019-03-21 18:58:20 -06:00
Matthew Flatt
0be2178f0e cs: fix build of cross-compile racket 2019-03-21 07:52:48 -06:00
Matthew Flatt
d0a98cb42a cs: update for LZ4 compression 2019-03-21 07:52:48 -06:00
Alexis King
8910ff0a39 units: Fix mistake in 86bb85931d that could cause compile-time failures
Specifically, if a contracted binding was applied as a function inside
another contract, it would lead to a syntax error.
2019-03-19 14:24:41 -05:00
AlexKnauth
780647f0eb return a procedure from make-variable-like-transformer
So that make-variable-like-transformer produces a value that passes both procedure? and set!-transformer?
2019-03-19 15:43:04 +01:00
Matthew Flatt
201015a4b6 cs: avoid uppercase in Windows header and library references 2019-03-18 13:10:43 -06:00
Matthew Flatt
f94fba12da struct: disallow #:extra-name with #:omit-define-syntaxes 2019-03-17 06:54:55 -06:00
Robby Findler
ed2381ee59 when collapsing use contract-stronger only on trustworthy contracts 2019-03-17 07:04:23 -05:00
Ben Greenman
a2d87c353e typo: rename 'provide/contract-struct-expandsion-info-id' 2019-03-16 17:11:55 -04:00
Robby Findler
ce324be9f8 adjust contract-out to use fresh scopes for mangled identifiers
closes #2469
2019-03-15 22:13:10 -05:00
Matthew Flatt
b6a7f7bc38 expander: keep reference that is needed after all
Part of e7744efb7d triggered a test failure (that I missed by somehow
running tests incorrectly). It turns out that phase -1 transformer
bindings can be used in phase-0 code via shifting.

This change does not effect the repair for building with
machine-independent bytecode.
2019-03-14 07:39:20 -06:00
Matthew Flatt
e7744efb7d expander: avoid unneeded namespace reference
This change avoids the stair-step effect that is depicted in the
"current Racket -M" build plot from the January 2019 blog post about
Racket on Chez Scheme.

The stair step in that plot is a result of a combination of effects,
but one key part is that the `.set-transformer!` linklet import (to
support macro definitions) has a reference back to the namespace.
While `.set-transformer!` normally would not be captured in any
closure, `db/private/generic/prepared` creates a thread that causes
the "prefix" part of a closure to be moved to a thread's runstack
before it can be pruned by the GC. The stair-step problem happens only
when running directly from machine-independent form, because that form
is recompiled in a way that doesn't optimize away the unused
`.set-transformer!` import. The change in this commit avoids a
reference to the namespace in some cases where it will not be useful,
which turns out to be sufficient to address the build problem.

A more complete repair would be to change the compiler to pair a
closure prefix on the runstack with a liveness mask. An even more
complete repair is to switch to Racket CS. Racket CS is immune to the
problem, even when running from machine-independent bytecode, because
its closures do not keep extra references (with the tradeoff that
there's less sharing).
2019-03-14 06:37:23 -06:00
Matthew Flatt
0257b5cf71 raco pkg: fix --source mode for some installations
Some package installation modes did not support `--source`
and similar strip modes on an intermediate directory.
2019-03-13 12:38:09 -06:00
Matthew Flatt
5a96e89f95 cs: reduce communication for cross compilation
Communicating in terms of S-expression is convenient but wasteful,
so communicate in bytes.
2019-03-13 10:40:10 -06:00
Matthew Flatt
4248f9bea0 fix hash-table sorting of symbols with non-ASCII characters
Non-ASCII characters sorted before ASCII characters, instead of after.
2019-03-13 09:32:33 -06:00
Matthew Flatt
6d9ea44830 add unsafe-make-srcloc
This function was already in Racket CS.
2019-03-13 09:32:33 -06:00
Matthew Flatt
861ddac5bc expander: sort submodule names in a linklet bundle 2019-03-13 09:32:33 -06:00
Matthew Flatt
7c0a978f28 cs: remove some incorrect kernel exports
Remove `make-date[*]`, `double-flonum?`, `f[xl]vector-copy`, and
`compile`, which should not be exported by built-in modules.
2019-03-13 09:32:33 -06:00
Matthew Flatt
e79f07b6cc racket/fasl: fixed representation for +nan.0
To make fasl writing as determinsitic and portable as possible, write
+nan.0 and +nan.f always with a specific bit pattern.

This choice risks losing information that is potentially useful, but
given the way that Racket treats all NaN encodings as equivalent, that
rick seems low.
2019-03-13 09:32:33 -06:00
Matthew Flatt
6a35d64e95 repairs for change for machine-independent bytecode
Fix problems with moving some VM-specific handlign to schemify, and
fix some interning issues that the change exposed.
2019-03-13 09:32:33 -06:00
Matthew Flatt
df8501d8f0 make empty immutable hash tables unique
For example, `#hasheq()` is `eq?` to `(hasheq)` and `(hash-remove
(hasheq 'x 2) 'x)`. Making empty hash table unique avoids some
potential and actual inconsistencies between traditional Racket and
Racket CS, such as in machine-independent bytecode.
2019-03-13 09:32:33 -06:00
Matthew Flatt
6e958b627f expander: avoid VM-specific expansion
Move different handling of serialized syntax data to the schemify
layer instead of te expander, so that the result of compiling in
machine-independent form is the same for traditional Racket and Racket
CS.
2019-03-13 09:32:33 -06:00
Matthew Flatt
d0d391d76b raco setup: add --recompile-only
The `--recompile-only` flag is intended to help dectect build
problems, especially distribution builds where packages are
supposed to be in built form.
2019-03-13 09:32:33 -06:00
Matthew Flatt
ce708478e7 raco setup: add time to section printouts 2019-03-13 09:32:33 -06:00
Alexis King
bb42476157 syntax/parse: Add prop:syntax-class 2019-03-11 12:18:36 -05:00
Sam Tobin-Hochstadt
25efc68b17 Make sql-null a transparent struct.
This allows it to cooperate better with Typed Racket, particularly
regarding the `Any` type. The guard and use of `#:authentic` also
check that it's still a singleton in all cases.
2019-03-11 14:02:57 +01:00
Matthew Flatt
de82588e08 cs: fix cross-compile fasl 2019-03-09 13:01:23 -07:00
Matthew Flatt
17e5a56569 raco setup: allow dependency checking to continue after error
When reading a bytecode file fails, record the error and continue.
2019-03-09 08:42:54 -07:00
Matthew Flatt
e46e791724 cs: delayed parsing of cross-linklet info
Avoid parsing cross-linklet optimization information until it is
needed. This change also avoids a problem with saving hash codes
that are platform-specific.
2019-03-09 08:13:03 -07:00
Matthew Flatt
b7e0d52b96 setup/dirs: improve host lib dir search for cross-compile
Insteda of just consulting `lib-search-dirs` in the host system's
config during cross-build mode, use `lib-dir` if set to arrive at
the expected default when `lib-search-dirs` is not set.
2019-03-08 18:21:34 -07:00
Matthew Flatt
e4517afb56 expander: reject internal sequence that ends in define-syntaxes
For example, don't allow

 (let ()
   8
   (define-syntax-rule (m) 9))
2019-03-08 15:40:33 -07:00
Matthew Flatt
d9d8d39f00 cs: fix truncation of path information in optimization info
Handle not-this-platform paths that manage to evade the heuristics for
converting paths to and from relative form. Otherwise, building can go
wrong on on Windows when using machine-independent starting files
generated on Unix-like systems.
2019-03-06 14:00:27 -07:00
Matthew Flatt
875e3b290d raco setup: add --error-out and --error-in
The `--error-out` and `--error-in` flags are meant to work together to
chain a sequence of `raco setup` steps where one of them might fail,
but other steps should proceed. The last step in that sequence should
use only `--error-in`, so that it exits with failure if any of the
steps failed.

The `both` target of the toplevel makefile uses `--error-out` and
`--error-in` to let a Racket CS build proceed as long as the
traditional Racket build made it to the last `raco setup` step, which
means that it survives package-build errors.
2019-03-06 09:43:18 -07:00
Matthew Flatt
fe6d243a71 repair for recent 32-bit MinGW 2019-03-06 08:05:02 -07:00
Matthew Flatt
fa972f0476 cs: unbreak cross compilation
Better checking in a7988c3813 exposed a problem with the expander's
recompiler in the case of cross compiling.
2019-03-06 06:44:17 -07:00
Matthew Flatt
ed807f8584 cs: use cross-compiler server for fasl
The Chez Scheme fasl format is not machine-independent when record
types are involved, so use the process that serves compilation to also
serve fasl encoding.
2019-03-06 06:25:18 -07:00
Matthew Flatt
f68248ee3b setup/setup: expose package-dependency functionality
Closes #2512
2019-03-05 20:43:09 -07:00
Matthew Flatt
828dc1f276 raco setup: allow catching cycle errors
In parallel build mode, if attempting to compile a file triggers a
cycle error that is caught and discarded, don't leave behind a
dependency (that is effectively resolved by the error) in the
parallel-worker manager.
2019-03-05 20:27:20 -07:00
Alexander McLin
01edfbbfcf *BSD: add "111" to libcrypto.rkt
Allows `libcrypto.so.111` to be discovered by racket on FreeBSD
variants such as TrueOS.
2019-03-05 20:27:11 -07:00
Matthew Flatt
a7988c3813 cs: fill in recompile-linklet
It doesn't do anything, but make it a conforming variant of the
identity function. Also, fill in checking for `compile-linklet`,
and correction documentation errors for `compile-linklet` and
`recompile-linklet`.
2019-03-05 18:11:19 -07:00
Matthew Flatt
85571bb542 cs: fix cross-compiler initialization
Disable debugging information, for example.
2019-03-05 11:47:22 -07:00
Matthew Flatt
853efb5ec9 cs: fix PLT_LINKLET_SHOW_CP0
Repair the internal call to `expand/optimize` to convert Racket
correlateds to Chez Scheme annotations.
2019-03-05 11:22:59 -07:00
Matthew Flatt
a00dd06793 further makefile and compiler/cm repairs for cross-build 2019-03-05 06:55:00 -07:00
Matthew Flatt
9981effa4b cs: revise cross-compilation protocol and fill in build steps
Makefile and configure refinements, including targets to let the
distro-build package drive a cross-build from scratch. A cross
build on Mac OS for Windows now works, for example.
2019-03-04 07:00:59 -07:00
Matthew Flatt
29ad80905e log-message: make data argument optional
The intent was never for the data argument to be optional, but a
mistake in traditional Racket's argument dispatch for `log-message`
made it optional in some cases, so the simplest way forward is to make
it consistently optional. Repair traditional Racket to use `#f`
instead of a random value when the data argument is not provided.
2019-03-03 20:37:07 -07:00
Matthew Flatt
d71d68e72a cs: add cross-compilation hooks for Racket
Add options to load a "plug-in" cross compiler, which should be a Chez
Scheme patch file plus declarations for the built-in libraries. Since
loading a patch file replaces the initial compiler, a separate
cross-compiler process is used to load the plug-in.
2019-03-03 08:04:25 -07:00
Matthew Flatt
f720220c41 io: fix file-truncate to return (void) 2019-03-02 20:17:58 -07:00
Matthew Flatt
17e873bee8 cs: unbreak Windows build 2019-03-02 19:51:31 -07:00
Matthew Flatt
2c09b2c86d cs: unbreak ffi/unsafe immobile cells 2019-03-02 11:02:00 -07:00
Matthew Flatt
068cfc6330 cs: unbreak Makefile for non-cross build 2019-03-02 06:42:40 -07:00
Matthew Flatt
c890edeea4 json: fix checking of word boundary after true, false, and null
Thanks to Greg Hendershott for pointing out the problem.
2019-03-02 05:38:06 -07:00
Matthew Flatt
33a5c30073 first step of Racket CS cross-compilation for Windows
Adjust build process to be able to generate Racket.exe, etc, for
Racket CS using MinGW. Much of this cross-compilation support can work
for building other platforms, too, but some of the details are filled
in only for generating Windows executables.
2019-03-02 05:33:26 -07:00
Matthew Flatt
472ac6c26e tcp-connect: repair for error on connect syscall
When `connect` returns an error immediately, save that error instead
of expecting it to be available later via `getsockopt`. That avoids a
problem on TrueOS, for example.
2019-03-01 14:42:23 -07:00
Matthew Flatt
a80714aeee fix JIT-inlined unsafe-fl<, etc., for > 2 args and CGC
Some parts of the implementation used for comparison were omitted when
allocation operations are not supported (but comparisons don't
allocate). This problem was unconvered by running the "jitinline.rktl"
tests with RacketCGC.
2019-02-28 10:01:47 -07:00
Matthew Flatt
d238007cf8 fix JIT-inlined unsafe-flrandom
Relevant to racket/typed-racket#807
2019-02-28 09:24:54 -07:00
shhyou
e970a6194a In case', report binding info of else' in error 2019-02-27 18:47:31 -06:00
Matthew Flatt
68312e43bd ffi/com: fix argument checking in com-get-property
Closes #2470
2019-02-27 16:15:28 -07:00
Matthew Flatt
0fefd6936a raco exe: fix problem with submodules
A recent revision to the way modules are instantiated for handling
runtime paths did not work right for modules from source (i.e., no
bytecode available) that have submodules.

Closes #2486
2019-02-27 15:31:06 -07:00
Matthew Flatt
f80c71e642 expander: handle strange local-expand under begin-for-syntax
Avoids internal errors (including unsafe behavior) in an example like

```
  #lang racket

  (begin-for-syntax
    (local-expand
     #'(#%plain-module-begin
        (begin-for-syntax
          (define x 42)))
     'module-begin
     '()))

  (begin-for-syntax
    (println x))
```

This example is weird, because it creates an `x` binding that doesn't
survive to the full expansion. Before the repair, the disappearing
binding created trouble for the expanded-to-linklet pass.

The example is weird for a second reason, which is that it uses uses
`local-expand` in a place where it will be triggered by visiting the
module. It turns out that raising a syntax error at that time (from
`#%plain-module-begin`) did not work correctly due to lazy
instantiation of the expansion context.

Closes #2458
2019-02-25 15:25:22 -07:00
Matthew Flatt
84837f4330 fix struct/c and struct/dc for new syntax arming of struct ids 2019-02-25 13:10:08 -07:00
Matthew Flatt
aa42163b70 fix place-channel handling of hash tables that contain impersonators
Closes #2504
2019-02-25 10:41:30 -07:00
Matthew Flatt
1c299e99db add some missing syntax-protects
Add `syntax-protect` to some macro expansions, especially macros in
contex where unsafe operations are imported, which means that a
combination of `local-expand` and `datum->syntaxa could provide access
to the unsafe bindings absent `syntax-protect`.
2019-02-25 07:48:04 -07:00
Matthew Flatt
685a1ff040 number-parsing repair for some inexact numbers
The fast path for inexact numbers didn't guard against underflow
correctly.
2019-02-25 07:48:04 -07:00
Matthew Flatt
078f697a0b JIT repair for eqv? on extflonums
Since `eqv?` recognizes extflonums, don't implement a comparsion to an
immediate extflonum as `eq?`.
2019-02-24 17:34:10 -07:00
Matthew Flatt
a3dfc1478a number-parsing repair for no-extflonum builds 2019-02-24 08:21:49 -07:00
Matthew Flatt
47a37f6bbe repair for number parsing
Fix a problem recognizing the range of characters for bases larger
than 10.
2019-02-23 21:09:16 -07:00
Matthew Flatt
0549bfb1e5 rewrite number parser
Inspired by the way the Chez Scheme number parser works, change the
one in the expander to be faster and probably clearer. This improved
performance brings number parsing almost back in line with the v6.12
parser's performance.

The revised parser is faster because it goes through an input string
just once. The new parser is also more xcomplete; it doesn't rely on a
host-system `number->string` (except for dummy extflonums when
extflonums are not supported).

If you're reading the commit history, beware that the note on commit
be19996953 is incorrect about the change to parsing divide-by-zero
errors. (It explains a change that was edited away before merging.)
This commit really does change the bahvior, though, again as a better
match for v6.12. Specifically, "/0" (with no hashes) always triggers
divide-by-zero in an otherwise well-formed number, even if `#i` is
used.
2019-02-23 17:25:54 -07:00
Matthew Flatt
be828b184c json: speed up JSON parser
Speed up JSON parsing (usually around x4 to x8) by avoiding regexp
matching and using more direct byte and character operations. Along
similar lines, compute parsed numbers directly instead of converting
to a string and then using `string->number`.

The revised reader behaves differently only in the case of a bad input
stream, where it may consume more bytes from the stream than the old
one due to eagerly reading bytes instead of tentatively matching
peeked bytes. Also, a UTF-8 decoding error is just `exn:fail` like
other input-parsing errors, and not `exn:fail:contract`.
2019-02-22 19:22:53 -07:00
Matthew Flatt
4d43c9884c io: fix file-buffer performance when driven by peeks 2019-02-22 18:47:08 -07:00
Matthew Flatt
75c8c3ce37 fix bytes-utf-8-ref to accept 5 arguments as documented 2019-02-22 18:46:36 -07:00
Matthew Flatt
c4a23595b9 json: faster parsing
Replace some regexœp operations with more direct `peek-char` and
read-char` operations.
2019-02-22 13:06:49 -07:00
Jesse Alama
1eafd1518e Offer 7.2 in .travis.yml
Bring the boilerplate .travis.yml up-to-date.
2019-02-22 11:34:39 -07:00
Paulo Matos
7a6536ab6d Remove unnecessary exit(0);
This was necessary to avoid warnings in a specific compiler but after
adding MZ_DECLARE_NORETURN, this is now unnecessary.
2019-02-22 08:52:09 -07:00
Paulo Matos
ef8b31b527 Use noreturn attribute only when MZ_DECLARE_NORETURN 2019-02-22 08:52:09 -07:00
Paulo Matos
5b837b895f Put all declarations with NORETURN in a single line
If declarations are not in a single line makex.rkt gets confused and
mis-parses the declarations.
2019-02-22 08:52:09 -07:00
Paulo Matos
0659e51b3f Mark other error functions as NORETURN
Related to PR #2472, marks a few other functions as NORETURN.
Namely:
	- scheme_signal_error
	- scheme_wrong_count
	- scheme_wrong_count_m
	- scheme_case_lambda_wrong_count
	- scheme_wrong_type
	- scheme_wrong_contract
	- scheme_wrong_field_type
	- scheme_wrong_field_contract
	- scheme_arg_mismatch
	- scheme_contract_error
	- scheme_wrong_return_arity
	- scheme_unbound_global

Unfortunately static analysis is done per compilation unit, so
although, for example, scheme_wrong_contract calls scheme_raise_exn
and the latter is already marked NORETURN, the analyzer does not know
this. Therefore we need to manually propagate the NORETURN for each
function declaration.
2019-02-22 08:52:09 -07:00
Matthew Flatt
b7654d9a84 cs: avoid uninitialized bytevectors via ffi/unsafe
Zeroing out allocated memory is required by the specification of
`alloc` from `ffi/unsafe`.

Possibly relevant to #2493
2019-02-21 08:39:06 -07:00
Matthew Flatt
858a925c16 remove another dead assignment to buf, which also causes leak
These leaks happen just once in startup code, so they
didn't matter in practice --- but, obviously, its better to
fix them.
2019-02-20 16:35:27 -07:00
Matthew Flatt
a119804827 remove unused call to GC_set
Closes #2339
2019-02-20 16:35:27 -07:00
Matthew Flatt
6a94ce5c04 fix error-message typo 2019-02-20 16:35:27 -07:00
Paulo Matos
6fa0e4fc64 Avoid dead initialization of boot_offset
Assuming here that ELF_FIND_BOOT_SECTION and WIN32 are mutually exclusive.
2019-02-20 16:35:19 -07:00
Philip McGrath
fe563735be ffi/unsafe/alloc: handle keyword arguments
closes https://github.com/racket/racket/issues/2484
2019-02-20 16:29:28 -07:00
Paulo Matos
be054f6149 free buf to avoid memory leak 2019-02-20 16:27:58 -07:00
Paulo Matos
490105ed53 Remove dead store for rator 2019-02-20 16:25:38 -07:00
Paulo Matos
10d721eaea Remove dead store for did_alt 2019-02-20 16:24:45 -07:00
Paulo Matos
7e856b3b4d Remove dead assignment to buf which also causes leak 2019-02-20 16:23:30 -07:00
Paulo Matos
671611e992 Remove dead store for closure_size 2019-02-20 16:22:24 -07:00
Ryan Culpepper
d185257a75
add unsafe-poll-fd, unsafe-fd->evt (#2414)
The unsafe-fd->evt interface is based on unsafe-{file-descriptor,socket}->semaphore. 
The main differences are that these events are level-triggered, not edge-triggered, and 
they do not cooperate with ports created by unsafe-{file-descriptor,socket}->port.
2019-02-20 13:53:11 +01:00
Paulo Matos
166c97ecea
Fix missing parens
There's a paren mismatch introduced by a previous commit
2019-02-19 11:22:54 +01:00
Gustavo Massaccesi
5c1b1bf8cf fix with-syntax* when it has no patterns
This also fix define-inline for 0-arity functions.
2019-02-18 20:07:45 -03:00
Gustavo Massaccesi
3c4f160346 make file-stream-port? and terminal-port? total 2019-02-18 20:07:19 -03:00
Matthew Flatt
66f7e0c3e3 cs: fix slowness in set!, vector, and box operations 2019-02-18 11:59:28 -07:00
Matthew Flatt
f14d7e06bb Make noreturn attribute valid only for GNUC implementations
.. with an `exit` call to make the declaration clearly true to the
compiler.
2019-02-17 07:14:34 -07:00
Matthew Flatt
6117d8aff4 Revert "Make noreturn attribute valid only for GNUC implementations"
This reverts commit d033dd1ed2.
2019-02-17 07:09:48 -07:00
Paulo Matos
0124210b0b Avoid conn memory leak if try_connect fails (#2481) 2019-02-17 07:04:32 -07:00
Paulo Matos
41b282d3ae Merge pull request #2480 from LinkiTools/pmatos-clanganal-9
Avoid memcpy from null pointer in do_inotify_add
2019-02-17 07:04:06 -07:00
Paulo Matos
d033dd1ed2 Make noreturn attribute valid only for GNUC implementations 2019-02-17 07:03:46 -07:00
Paulo Matos
3e301d22b5 Mark scheme_raise_exn as noreturn - regenerate schemex
scheme_raise_exn raises an exception and doesn't return.
Static analysis tools find a huge amount of problems with regards
to memory leaks that are actually false positives because the tools
are not aware the function does not return. Marking it as such aids
further inspection of real problems.
2019-02-17 07:03:46 -07:00
Matthew Flatt
0567527be4 io: fix unsafe-poller
When asking a poller to register wakup events, handle an
"event is ready" response by canceling the sleep.

Closes #2482
2019-02-16 19:35:01 -07:00
Ryan Culpepper
edeae791ab syntax/parse: fix #:attr-name-separator, used by honu macros 2019-02-15 12:25:10 +01:00
Matthew Flatt
30e260835f fix \D, \S, \W in string regexp
The documentation and implementation were confused about whether \D,
\S, and \W match non-ASCII characters. Now they do. The new regexp
implementation (as used in Racket CS) already matched them.
2019-02-14 11:50:58 -07:00
Paulo Matos
f4c48dd9b5 Assigned value at initialization is never read
Assigning variable instead to NULL.
2019-02-14 08:11:50 -08:00
Paulo Matos
5ea27fc972 Remove unused variable did
Used to be useful but now it's no longer the case.
2019-02-14 08:10:24 -08:00
Paulo Matos
1722e49c85 Remove dead code
I understand what the idea is in this file, except this code won't
work like the author expected it to. Variables marked for wiping won't
be wiped unless they are marked as volatile. The compiler will simply
remove the code wiping the variables and issue a warning, which is
what brought me to look into this code in the first place.
2019-02-14 08:09:26 -08:00
Paulo Matos
136ea767e2 Free memory stored when error occurs - otherwise buffer leaks 2019-02-14 08:08:27 -08:00
Paulo Matos
14499aa822 Free buffer in case of unknown error - avoids memory leak 2019-02-14 08:07:49 -08:00
Paulo Matos
4014b066d1 Remove assignment - value stored to cpos is never read 2019-02-14 08:06:39 -08:00
Paulo Matos
04e6422c72 Ensure copied is not overwritten by another strdup causing a leak 2019-02-14 08:04:38 -08:00
Matthew Flatt
e7e9d02c9e native-libs: patches to adjust Pango font-face matching 2019-02-14 08:57:51 -07:00
Matthew Flatt
ecf3766d96 io: reduce overhead on display and write-bytes 2019-02-13 16:18:22 -07:00
Matthew Flatt
17c46c9c36 io: fix file and TCP ports as place messages 2019-02-13 10:48:55 -07:00
Matthew Flatt
a4bd83011b io: fix result of file-stream-port? 2019-02-13 10:41:12 -07:00
Matthew Flatt
5339a36187 io: fix file-stream-buffer-mode on file output ports 2019-02-13 10:20:04 -07:00
Matthew Flatt
c2d53143c1 io: improve syntax of internal class forms 2019-02-13 10:08:58 -07:00