Commit Graph

37836 Commits

Author SHA1 Message Date
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
Matthew Flatt
2a1dd00320 bytecode updates for v6.4.0.8 2016-02-14 06:44:39 -07: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
Robby Findler
71f338430b clean up some confusion about the timing of errors
specifically, always wait for the neg party to come in
before signalling any errors
2016-02-10 17:36:37 -06:00
Vincent St-Amour
640895645f Fix contract-stronger? to work with late-neg projections. 2016-02-10 15:40:59 -06:00
Stephen Chang
b37d322638 add history for url-regexp 2016-02-10 13:34:11 -05:00
Stephen Chang
a321c85a29 update string->url doc with better regexp
to sync with e6a0caa147
2016-02-10 13:13:12 -05:00
Stephen Chang
e6a0caa147 Use better regexp for string->url input contract.
Closes #929
2016-02-10 12:54:03 -05:00
Stephen Chang
5ffe007f5c Add faster non-generic in-*-set sequences
closes #1217
2016-02-10 11:24:38 -05:00
Sam Tobin-Hochstadt
c2d31b14f7 Yet another IP for Northwestern.
Also make test failures more informative.
2016-02-10 09:39:24 -05:00
Matthew Flatt
5b37bac183 xform: another signbit intrinsic 2016-02-10 06:07:20 -07:00
Matthew Flatt
f21aa8661b xform: more signbit variants 2016-02-09 08:21:41 -07:00
Matthew Flatt
1cffde1df8 fix parallel raco setup failure on dependency cycles
The failure should be an individual module failure, instead of
terminating `raco setup`.
2016-02-09 08:01:42 -07:00
Matthew Flatt
50db01bf2c bump version 2016-02-09 07:38:28 -07:00
Matthew Flatt
c1b9cd6828 xform: recognize some floating-point intrinsics
GCC v6.0 apparently adds `__builtin_isnan`. Guess at some other future
additions, while we're at it.

Closes #1222
2016-02-09 07:38:28 -07:00
Matthew Flatt
18990701a6 xform: better reporting for disallowed call 2016-02-09 07:38:28 -07:00
Matthew Flatt
9a8fd2912f avoid some C undefined behavior
Found with `-fsanitize=undefined`. The only changes that are potentially
bug repairs involve some abuses of pointers that can end up misaligned
(which is not an x86 issue, but might be on other platforms). Most of
the changes involve casting a signed integer to unsigned, which
effectively requests the usual two's complement behavior.

Some undefined behavior still present:

  * floating-point operations that can divide by zero or coercions
    from `double` to `float` that can fail;

  * offset calculations such as `&SCHEME_CDR((Scheme_Object *)0x0)`,
    which are supposed to be written with `offsetof`, but using
    a NULL address composes better with macros.

  * unaligned operations in the JIT for x86 (which are ok, because
    they're platform-specific).

Hints for using `-fsanitize=undefined`:

 * Add `-fsanitize=undefined` to both CPPFLAGS and LDFLAGS

 * Add `-fno-sanitize=alignment -fno-sanitize=null` to CPPFLAGS to
   disable those checks.

 * Add `-DSTACK_SAFETY_MARGIN=200000` to CPPFLAGS to avoid stack
   overflow due to large frames.

 * Use `--enable-noopt` so that the JIT compiles.
2016-02-09 07:38:28 -07:00
Stephen Chang
06c15dbf89 add tests for non-generic in-hash- sequences 2016-02-08 15:01:08 -05:00
Matthew Flatt
91d85a1fb5 doc clarification on pkg catalog protocol 2016-02-07 13:34:47 -07:00
Matthew Flatt
463c32c61d make alarm-evt tests more likely to pass
The `alarm-evt` tests are inherently racy, since they depend on
the scheduler polling quickly enough. The old time values were
close enough that a test failure is particularly likely on
Windows, where the clock resolution is around 16ms. To reduce
failures, make the time differents much bigger.

Closes issue #1232
2016-02-07 13:34:47 -07:00
Matthew Flatt
35acfab903 fix internal array size on module redeclaration
If a module is redeclared with more phases than before,
expand the `running` array.
2016-02-07 13:34:47 -07:00
Gustavo Massaccesi
7982a59a1d Fix eq? reduction 2016-02-07 16:49:06 -03:00
Sam Tobin-Hochstadt
f4beeeb7e1 Increase timeout. 2016-02-05 17:58:59 -05:00
Stephen Chang
048c4b4a73 add unsafe-hash-iterate ops; add specific hash table sequences
- refactor for.rkt: abstract in-hash- definitions
- refactor hash_table_next in hash.c
- move hash fn headers to schpriv.h

closes #1229
2016-02-05 14:30:34 -05:00
Gustavo Massaccesi
89e00da75e Swap arguments of optimize_get_predicate 2016-02-04 15:42:09 -03:00