Commit Graph

36124 Commits

Author SHA1 Message Date
Lehi Toskin
bc99eb0eef Fix grammar mistake 2016-02-26 23:54:15 -05:00
ben
f83cec1b04 fix (combinations n k) bug
Now using Gosper's hack to enumerate length k binary numbers.
New implementation is shorter & a little more obviously correct
(if you trust the bit-twiddling)
https://en.wikipedia.org/wiki/Combinatorial_number_system#Applications
2016-02-26 17:59:59 -05:00
Ryan Culpepper
301b47df2c saved-errno tests for windows 2016-02-26 17:57:56 -05:00
Ryan Culpepper
5aff9925ad add tests for saved-errno 2016-02-26 17:57:56 -05:00
Ryan Culpepper
c1664610e1 update version number for ffi change 2016-02-26 17:57:56 -05:00
Ryan Culpepper
2cc4b66184 add saved-errno setter variant
This makes it easier to create mock foreign functions
(or wrap existing ones) for testing.
2016-02-26 17:57:56 -05:00
ben
f2bef56a2e margin-note to say #:auto-value is evaluated once 2016-02-26 17:47:54 -05:00
Matthew Flatt
81b5d74ed6 fix mishandling of the continuation-mark depth
When a chaperone-wrapped function leads to a slow-path tail
call, the continuation-mark depth can be made too deep when
resolving the slow tail call.

Closes #1265
2016-02-26 16:39:05 -05:00
Robby Findler
7151d6d034 add missing history annotation 2016-02-26 08:10:42 -06:00
Robby Findler
990555cd8d fix arity checking for -> contract with ellipses
closes #1266
2016-02-26 08:10:42 -06:00
Matthew Flatt
d9971292a6 make compiled-expression-recompile work on top-level forms
Mostly just fill in some corners, but also fix a bug with lifted
functions that accepted a boxed argument and have less than three
arguments total.

The `tests/racket/test` test suite now passes with
`PLT_RECOMPILE_COMPILE` set --- except for the "optimize.rktl" test
suite, wher emore work is needed to ensure that optimizations
don't get lost.
2016-02-26 06:03:11 -05:00
Matthew Flatt
f0500c64d3 Windows: always get errno from "MSVCRT.dll" 2016-02-26 06:03:10 -05:00
Stephen Chang
15f47ef62e fix context of macro-generated default-in-hash- internal ids 2016-02-25 23:40:30 -05:00
Vincent St-Amour
f71474baca Add missing "not".
Found by Greg Hendershott back in September.
2016-02-25 16:09:53 -06:00
John Clements
a45330815d add note about sorting with NaN 2016-02-25 15:51:04 -06:00
Gustavo Massaccesi
5a378ca883 More reductions for (if t v v) and (eq? v v)
Reduce
(eq? v v) ==> #t
(if t v v) ==> (begin t v)
(if v v #f) ==> v
when v is a local or a top level variable.

Previously, the last two reductions were used only
with local variables.

Also, move the (if x #t #f) ==> (not x) reduction
after branch optimization.
2016-02-24 21:56:04 -03:00
Gustavo Massaccesi
6cd225e073 avoid compiler warning 2016-02-24 21:55:05 -03:00
Stephen Chang
3e29101e48 properly throw exn when in-hash seq input is wrong type of hash
- refactors define-in-hash-sequences
- closes #1256
2016-02-24 14:43:44 -05:00
ben
c15a357417 add #:exact-columns option to table-display
Least invasive change I could think of to solve #1252.
When `--full-checksum` is set, never truncates the checksum column.

Examples:
```
$ raco pkg show typed-racket
Installation-wide:
 Package       Checksum               Source
 typed-racket  32d0a97058b797a8ef...  clone...=typed-racket
User-specific for installation "development":
 [none]
```

```
$ raco pkg show --full-checksum typed-racket
Installation-wide:
 Package       Checksum                                  Source
 typed-racket  32d0a97058b797a8efe794336dde069156b98630  clone...=typed-racket
User-specific for installation "development":
 [none]
```

```
$ raco pkg show --long typed-racket
Installation-wide:
 Package         Checksum                                    Source
 typed-racket    32d0a97058b797a8efe794336dde069156b98630    (clone "/Users/ben/code/racket/fork/extra-pkgs/typed-racket/typed-racket" "git://github.com/racket/typed-racket/?path=typed-racket")
User-specific for installation "development":
 [none]
```
2016-02-23 19:23:08 -05:00
Asumu Takikawa
98ba277948 Normalize path to have a trailing slash
The regexp-based helper did not work correctly for
a path like the one in the following use:

  raco pkg install -n foo /
2016-02-22 21:53:22 -05:00
Matthew Flatt
9494216a9b fix a problem with hash-remove
When a key is removed at a level that other only has a collision
table, the HAMT representation was not adjusted properly by
eliminating the layer. As aresult, table comparison via
`equal?` could fail. The problem could show up with hash tables
used to represent scope sets, where an internal "subset?" test
could fail and produce an incorrect binding resolution.
2016-02-22 15:24:17 -07:00
Jay McCarthy
619ef41f7d If full-checksum, table can be as long as necessary 2016-02-22 09:32:06 -05:00
Matthew Flatt
c0bb539af7 make an optimizer function private 2016-02-21 08:07:27 -07:00
Matthew Flatt
d050bd79d9 revert an optimizer transformation
The transformation from

 (begin (let <bindings> (begin <e1> ...)) <e2> ...)

to

 (let <bindings> (begin <e1> ... <e2> ...))

makes things look simpler and might help the optimizer a little. But
it also tends to make the run-time stack deeper, and that slows some
programs a small but measurable amount.

A better solution would be to keep the transformation but add another
pass that moves expressions out of a `let`.
2016-02-21 08:07:26 -07:00
Matthew Flatt
537292ef45 optimizer: fix calculation of used local variables (again)
Mostly reverts a52a08146a, then repairs the problem in a way
that does not add variables unnecessarily to nested closures.
2016-02-21 08:07:26 -07:00
Gustavo Massaccesi
01458e22fa Don't burn fuel when a single use function is inlined
Since this operation only moves the code and doesn't make the final
bytecode bigger, it's not necessary to decrease the fuel and then it
is available for further inlining.
2016-02-21 08:07:26 -07:00
Matthew Flatt
0619af508b merge unresolver implementations
Merge the original implementation for cross-module inlining
with the new one for recompiling.
2016-02-21 08:07:26 -07:00
Robby Findler
be628e21a6 noticed some @tech{} cleanup opportunities and added some examples
for the random generation functionality
2016-02-21 08:27:21 -06:00
Robby Findler
c4ebd771bb add some @tech{}s 2016-02-20 19:23:18 -06:00
Matthew Flatt
e32e1383fe fix test that was supposed to be Windows-specific 2016-02-19 18:58:49 -07:00
Matthew Flatt
0606228959 add comments 2016-02-19 18:57:57 -07:00
Matthew Flatt
5f7d0317e8 improve names for some internal structures and functions
Changes:

    ...unclosed_procedure... -> lambda
    ...procedure_compilation... -> lambda
    ..._Closure_Data -> ..._Lambda
    `code` field in Scheme_Lambda -> `body` field
    ..._CLOSURE_DATA_FLAGS -> ..._LAMBDA_FLAGS
    CLOS_... -> LAMBDA_... (e.g., CLOS_IS_METHOD)
    SCHEME_COMPILED_CLOS_CODE -> SCHEME_CLOSURE_CODE
    SCHEME_COMPILED_CLOS_ENV -> SCHEME_CLOSURE_ENV

    ..._compiled_... -> ..._ir_... (where "ir" is "intermediate
                                    representation")
    ..._Compiled_... -> ..._IR_... (e.g., Scheme_Compiled_Let_Value)
    Scheme_Let_Header -> Scheme_IR_Let_Header (since it's IR-only)
    Closure_Info -> Scheme_IR_Lambda_Info

    make_syntax_compiler -> make_primitive_syntax
    scheme_syntax_compiler_type -> scheme_primitive_syntax_type
    ..._syntax -> ..._compiler (e.g., lambda_syntax -> lambda_compile)

    scheme_..._prim -> scheme_..._proc
    scheme_values_func -> scheme_values_proc

Closes #1249
2016-02-19 18:57:57 -07:00
Matthew Flatt
37a8031803 windows: fix overflow handling in seconds->date 2016-02-19 18:57:06 -07:00
Matthew Flatt
a52a08146a optimizer: fix calculation used local variables
The calculation of used variables in a possibly unused function did
not work right when the function is referenced by a more deeply
nested function that itself is unused. The extra uses triggered by
more nested uses need to be registered as tentative in the more nested
frame, not in the outer frame.

Closes #1247
2016-02-18 21:21:27 -07:00
Matthew Flatt
2b4bfcf854 raco setup: repair doc build
Fix mistake in 1005701b8e.
2016-02-18 16:26:15 -07:00
Sam Tobin-Hochstadt
f7c55a8bc6 Make explicit that this simplifies using the FS. 2016-02-18 18:07:18 -05:00
Matthew Flatt
a0f7b618f7 fix failure in cross-module inliner
Recent compiler changes expose a bug in the cross-module
inliner when it turns out to be unable to inline a candidate.
2016-02-18 14:09:35 -07:00
Matthew Flatt
1005701b8e raco setup: defend against bad scribblings in "info.rkt"
Closes #1142
2016-02-18 13:45:53 -07:00
Matthew Flatt
6a78beecdf raco setup: more consistently defend against bad "info.rkt"
Closes #1244
2016-02-18 13:28:19 -07:00
Matthew Flatt
0133954c84 avoid a made-up OS error in rename-file-or-directory
On Unix and OS X, the check to avoid replacing an existing
file or directory is made by Racket, rather than the OS,
so don't claim a system error if the operation fails for
that reason.

Also, update the docs to clarify that the check is not
atomic with the move.

Closes issue #1158
2016-02-18 13:12:55 -07:00
Sam Tobin-Hochstadt
79fcdf4201 Remove unused variables to eliminate compiler warnings. 2016-02-18 12:57:52 -05:00
Sam Tobin-Hochstadt
b92ef72c8c fix typo 2016-02-18 10:49:24 -05:00
Matthew Flatt
db04b47cdb add stack-overflow check in compiler's letrec-check pass
Closes PR 15247
2016-02-17 06:16:31 -07:00
Matthew Flatt
0c38da0ee2 change intermediate representation for the bytecode optimizer
Correct the second-biggest design flaw in the bytecode optimizer:
instead of using a de Bruijn-like representation of variable
references in the optimizer pass, use variable objects.

This change is intended to address limitations on programs like the
one in

 http://bugs.racket-lang.org/query/?cmd=view&pr=15244

where the optimizer could not perform a straightforward-seeming
transformation due to the constraints of its representation.

Besides handling the bug-report example better, there are other minor
optimization improvements as a side effect of refactoring the code. To
simplify the optimizer's implementation (e.g., eliminate code that I
didn't want to convert) and also preserve success for optimizer tests,
the optimizer ended up getting a little better at flattening and
eliminating `let` forms and `begin`--`let` combinations.

Overall, the optimizer tests in "optimize.rktl" pass, which helps
ensure that no optimizations were lost. I had to modify just a few
tests:

 * The test at line 2139 didn't actually check against reordering as
   intended, but was instead checking that the bug-report limitation
   was intact (and now it's not).

 * The tests around 3095 got extra `p` references, because the
   optimizer is now able to eliminate an unused `let` around the
   second case, but it still doesn't discover the unusedness of `p` in
   the first case soon enough to eliminate the `let`. The extra
   references prevent eliminating the `let` in both case, since that's
   not the point of the tests.

Thanks to Gustavo for taking a close look at the changes.

 LocalWords:  pkgs rkt
2016-02-16 21:05:15 -07:00
Jay McCarthy
bfc2611ff2 Attempt to detect if a sub-test file failed 2016-02-16 15:06:07 -05:00
Robby Findler
f93e0df781 explain shortcoming in define-opt/c
related to #1238
2016-02-15 14:28:16 -06:00
Vincent St-Amour
068af526de Fix test that is broken without space-efficient wrappers. 2016-02-12 13:23:21 -06:00
Vincent St-Amour
0961cf9412 Fix test failures for new double-wrapping tests.
Everything passes.
2016-02-12 13:23:21 -06:00
Vincent St-Amour
6ee45a156d Extend test suite to try double-wrapping everywhere.
To provide additional testing for space-efficient wrappers.

Currently has some failures.
2016-02-12 13:23:21 -06:00
ben
0e1f17b520 option to limit prefix in ~a,~s,~v,~e,~.a,~.s,~.v 2016-02-11 19:51:47 -05:00