Commit Graph

40920 Commits

Author SHA1 Message Date
Paulo Matos
9c2b84d849 Change return type of rktio_get_milliseconds to be unsigned
This fixes a major issue in arm 32bits, detected by ubsan, where
conversion of type to milliseconds results in overflow.

```
rktio_time.c:92:21: runtime error: signed integer overflow: 1584975753 * 1000 cannot be represented in type 'long int'
```
2020-03-28 08:55:24 -06:00
Matthew Flatt
9cb6debf44 cs & thread: memory accounting corrections
Repair trigger of a GC when using `current-memory-use`
on a custodian when a limit was just installed.
2020-03-28 08:39:42 -06:00
Paulo Matos
7621ccbb7b
Explicit zero assign to avoid warning (#3082)
GCC 9.3 things that `h2` might reach line 385 uninitialized.
```
./hash.c:385:14: warning: 'h2' may be used uninitialized in this function [-Wmaybe-uninitialized]
  385 |       h = (h + h2) & mask;
      |           ~~~^~~~~
```
2020-03-27 18:37:19 +01:00
Matthew Flatt
4a2cb6f577 bc: fix optimizer bug
Local-variable type information was not properly removed from
information threaded through optimization.

Closes #3081
2020-03-24 08:51:37 -06:00
Matthew Flatt
9222a135c3 cs: reliable GC callbacks on major GCs
A Chez Scheme garbage collection involves a rendezvous among threads
that are used to implement places and futures (and potentially other
things that create Chez-level threads). The thread that is used to
drive the garbage collection was not formerly specified, and callbacks
like the GC icon in DrRacket can only be run in the initial thread.
When a major collection was run in a non-initial thread, the callback
was simply skipped.

The Racket branch of Chez Scheme now drives a collection in the
initial thread whenever that thread is active. In Racket CS, the
initial thread can be inactive if it's waiting for external events,
and a place can meanwhile trigger a GC. Now, when the Racket CS GC
callback is called for a major collection in any thread other than the
initial one, it defers the major collection to an asynchornous
callback in the main thread (and meanwhile performs a minor
collection).

So, a major collection might now be delayed by just a little while if
the main thread is inactive, such as when it's waiting for external
events, but callbacks like the GC icon in DrRacket will be reliably
invoked for major collections.
2020-03-23 17:50:04 -06:00
Paulo Matos
4a62408b71
Fix typo in comment 2020-03-23 16:58:33 +01:00
Sorawee Porncharoenwase
3c966bc297 Unbreak syntax/to-string tests
It's still unclear what the specification of syntax->string regarding whitespace
before closing parens should be. The implementation also has not dealt with
the issue. This PR therefore removes whitespace before closing parens from
the tests.

Once the discussion at
https://github.com/racket/racket/issues/3071#issuecomment-601984438
has reached a conclusion and implemented, we can add these tests back.
2020-03-22 20:46:12 -04:00
lkh01
d9c064d06c make syntax->string work with unquote, quasiquote, etc. 2020-03-22 15:05:01 -04:00
lkh01
6a7ad2e49e add some tests for syntax->string 2020-03-22 15:05:01 -04:00
lkh01
40c589ef8a do not overwrite whitespace after a quote 2020-03-22 15:05:01 -04:00
lkh01
2a8e10b31a account for difference between quote and ' in syntax->string 2020-03-22 15:05:01 -04:00
Sam Tobin-Hochstadt
b1a415f232
Add additional syntax tests in GHA. (#3078)
Suggested by @sorawee.
2020-03-22 11:34:06 -04:00
Matthew Flatt
ba59d87ac4 makefile: add an advice-giving clean target
Implementing a thorough `clean` target for a repo-based is tedious and
error-prone. Instead, make the `clean` target suggest `git clean -d -x
-f .`, which is more effective in most situations (but seems too
dangerous to run automatically).
2020-03-21 15:09:58 -06:00
Matthew Flatt
9effeef7ab cs: fix stencil-vector HAMT for 32-bit platforms 2020-03-17 18:24:30 -06:00
Matthew Flatt
3390896a59 schemify: clean up unnecessary lets in interpreter
Collapse `let` with unused binding to `begin`, and then
collapse resulting nested `begin`s.
2020-03-17 18:24:30 -06:00
Ben Greenman
b69c1208b7 doc: typo, expr -> stx-expr 2020-03-17 12:12:25 -04:00
Sam Tobin-Hochstadt
c7a9690143 Fix recursive make invocation.
Eliminates warning in DrDr.
2020-03-16 13:35:59 -04:00
Matthew Flatt
8f256c9261 cs: fix error-print-width handling when output just fits the limit
For example, if the limit is 5, then "abcde" should print as "abcde",
not "ab...".
2020-03-13 16:12:34 -06:00
Sorawee Porncharoenwase
74c0844101 Also fix ~.a in 3m 2020-03-13 15:20:10 -06:00
Sorawee Porncharoenwase
b8eee66b72 add a test for minimum value for error-print-width 2020-03-13 15:20:10 -06:00
sorawee
8f286fc810 Fix #2986: error-print-width 3 shouldn't error 2020-03-13 15:20:10 -06:00
Matthew Flatt
c52d45613b minor whitespace corrections 2020-03-13 11:32:49 -06:00
Matthew Flatt
f1a177e880 cs: fix applicable struct implemented with applicable struct 2020-03-13 11:14:39 -06:00
Matthew Flatt
edfdcb0b6d add call-in-continuation
The `call-in-continuation` function generalizes applying a
continuation to values by accepting a thunk that is called in the
restored continuation. In other words, insteda of having to use the
pattern

 ((call/cc (lambda (k)
             .... (set! saved-k k) ...
             (lambda ()
               original-result))))
 ...
 (saved-k (lambda () new-result))

The extra call and thunk on the capture side can be omitted:

 (call/cc (lambda (k)
            .... (set! saved-k k) ...
            original-result))
 ...
 (call-in-continuation saved-k (lambda () new-result))

At the Chez Scheme level, a `call-in-continuation` in tail position
within a function can avoid forming a closure for its second argument.
The `call-in-continuation` function at the Racket CS level doesn't yet
provide that benefit.

The `call-in-continuation` operation is called `continuation-slice` in
Feeley's "A Better API for First-Class Continuations".
2020-03-13 09:46:12 -06:00
Matthew Flatt
9ef2124a38 speed up keyword expansion
Expansion of a procedure with keywords is quadratic due to generating
a nested sequence of `let`s, but speed it up by roughly a constant
factor by using a dintinct symbol for each nested layer.

Related to #3070
2020-03-13 09:46:12 -06:00
Matthew Flatt
f98d0a5cc1 cs: use call-in-continuation
Using `call-in-continuation` to apply a thunk within a continuation
slightly simplifies and speeds up parts of the implementation of
delimited continuations.
2020-03-13 09:46:12 -06:00
sorawee
3ddc1ca367
Fix typos (protect-syntax -> syntax-protect) (#3069) 2020-03-11 11:47:09 -04:00
Matthew Flatt
a105e47d35 Inside Racket docs: add advice on embedding files
Since embedding "petite.boot", "scheme.boot", and "racket.boot" can be
a good idea, add some advice to the documentation to show how that can
be done.
2020-03-08 18:05:59 -06:00
Matthew Flatt
601ffc9b36 avoid compiler warnings 2020-03-07 14:42:41 -07:00
Matthew Flatt
fab04633f3 makefile: add DISABLE_STATIC_LIBS 2020-03-07 14:24:50 -07:00
Matthew Flatt
0de88f203d struct: don't generate excessive struct-field-index code
The expansion of `struct` created far too much code to parameterize
`struct-field-index`, making expansion of a `struct` form with just
100 or 200 fields take a noticeably long time to expand.
2020-03-07 10:45:33 -07:00
Matthew Flatt
00b6803e36 cs: enable embedding in other applications
The "Inside: Racket C API" manual now has a CS part and a BC part.
2020-03-07 06:39:41 -07:00
Gustavo Massaccesi
d6d30d2fcc cs: sync with Chez Scheme change fix in cptypes 2020-03-07 08:07:30 -03:00
Matthew Flatt
e2c9544ed5 bc: fix hash-set key replacement for eq? values 2020-03-06 11:15:50 -07:00
sorawee
6685120c0a
Doc: more illustrative example for the filter-map function (#3066) 2020-03-05 21:46:15 -05:00
Matthew Flatt
b4dd4684d9 cs: fix problem getting structure hash codes 2020-03-05 11:28:28 -07:00
Sam Tobin-Hochstadt
8a63d80379 Preserve undocumented args syntax class attribute.
PR #2678 unintentionally removed this attribute, but it was used
at least by "collections-lib" and "static-rename-lib".

cc @sorawee @lexi-lambda @jackfirth @rmculpepper
2020-03-04 15:05:16 -05:00
Sorawee Porncharoenwase
cc76761c1f Update grammar in the syntax class page, s/subdefthing/defsubthing/ 2020-03-04 13:22:19 -05:00
Sorawee Porncharoenwase
3043dbd35c Expose function-header's name, document attributes, fix links 2020-03-04 13:22:19 -05:00
Sorawee Porncharoenwase
1b4126d1e5 Fix a typo, add examples, switch to non-experimental form 2020-03-04 13:22:19 -05:00
sorawee
29c518abbc
Allow multiple catalogs in raco pkg install and friends
Allow `--catalog` to be specified multiple times.
2020-03-04 07:02:45 -07:00
Ben Greenman
258eee40ce
contract: use impersonator prop. for impersonator-unconstrained-domain->/c (#3055)
rename the contract property from a chaperone prop to an impersonator
prop (looks like this was an old copy/paste error)
2020-03-03 15:50:19 -05:00
Štěpán Němec
95b9f0e210 doc: Fix some typos 2020-03-03 07:56:16 -07:00
Štěpán Němec
098a784b88 doc: Fix an error
".rkt" suffix is not added for relative path strings.

Discussed here: https://groups.google.com/d/msg/racket-users/lxQ-SqZ0QNY/8bqv0YqPDgAJ
2020-03-03 07:55:50 -07:00
Sorawee Porncharoenwase
3bb873aea8 Remove contract for define/generic
`local-id` and `method-id` don't have a syntax identifier as a value, so
a contract is inappropriate here.
2020-03-03 07:54:31 -07:00
Ben Greenman
a57f96ea9c
doc: contract, clarifications (#3061)
- reword the first-page explanation of chaperone contracts;
  try to give a positive description by talking about wrappers first
  (rather than starting with what chaperones maybe don't do)

- name the recognizer functions for chaperone & impersonator contracts
  (on the first page)

- clarify that `contract-projection` and `contract-val-first-projection`
  are bad --- that there's a preferred alternative

- describe the outputs of `contract-projection` and
  `contract-val-first-projection`; their docs were identical before, but
  now re-use prose from sec 8.7 (Building New Contract Combinators)
2020-03-01 08:49:36 -05:00
Ben Greenman
24cdc58951
style: consistent figure style (#3060)
Use a consistent style for the "good / bad" examples:

- start the code at the far left of each box
- keep a little space between the top of the box & the label
2020-02-28 08:42:59 -05:00
Ben Greenman
354dfbac04 doc: '-> void' to '-> void?'
(accepts anything non-#f vs. accepts (void))
2020-02-27 15:51:20 -05:00
kryptine
8dd65db7e2
Update package LICENSE files (#3048)
* Remove obsolete LGPL license files
* Add LICENSE files to packages
2020-02-25 14:13:34 -05:00
James Bornholt
ac41c8a361 Make get-pure-port redirection case-insensitive
GitHub's CDN seems to have recently started returning the `Location` header for a redirect with a lowercase `l`, which breaks the redirect logic. The HTTP spec says that header names are case-insensitive, so we need to look for either version.
2020-02-25 13:38:44 -05:00