Commit Graph

37570 Commits

Author SHA1 Message Date
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
Gustavo Massaccesi
9cb0637f95 Don't add type information twice
In some cases, for example while using no_types, the optimizer can try to
add again the type information of a local variable. This creates unnecessary
internal storage to save the repeated information.
2016-02-04 15:41:51 -03:00
Gustavo Massaccesi
65838bd3c8 Try to collapse references in a branch using the type information of the other branch
A reference to a local may be reduced in a branch to a constant, while it's unchanged in the
other because the optimizer has different type information for each branch. Try to use the
type information of the other branch to see if both branches are actually equivalent.

For example, (if (null? x) x x) is first reduced to (if (null? x) null x) using the type
information of the #t branch. But both branches are equivalent so they can be
reduced to (begin (null? x) x) and then to just x.
2016-02-04 15:41:32 -03:00
Gustavo Massaccesi
3f246dd857 Use a sub_info to optimize branches
Create a new sub_info for each branch to hold the type information of the local variables, instead of handling the types manually.
2016-02-04 15:41:15 -03:00
Matthew Flatt
5031897c51 try again to clarify atomic mode's unsafety
Closes issue #1228
2016-02-03 10:51:17 -07:00
Gustavo Massaccesi
1b54b1c040 optimizer: reductions for expressions with fixnum
For example, reduce:

(= <fx> <fx>) ==> (unsafe-fx= <fx> <fx>)
(fxmax <fx> <fx>) ==> (unsafe-fxmax <fx> <fx>)
(zero? <fx>) ==> (unsafe-fx= <fx> 0)
(bitwise-not <fx>) ==> (unsafe-fxnot <fx>)
2016-02-03 13:11:59 -03:00
Gustavo Massaccesi
bbbe99db43 optimizer: use type predicates to calculate local types
The functions expr_implies_predicate was very similar to
expr_produces_local_type, and slighty more general.
Merging them, is possible to use the type information
is expressions where the optimizer used only the
local types that were visible at the definition.

For example, this is useful in this expression to
transform bitwise-xor to it's unsafe version.

(lambda (x)
  (when (fixnum? x)
    (bitwise-xor x #xff)))
2016-02-03 13:11:45 -03:00
Jay McCarthy
ced25315ac Merge pull request #1231 from simmone/xml
not sort xml attributes
2016-02-03 11:07:02 -05:00
Matthew Flatt
2ee721f351 clean up GC implementation
Try to make the GC implementation more readable by reordering
and reorganizing the code.
2016-02-03 06:59:05 -07:00
Chen Xiao
19c00dc91c xml attributes not sort 2016-02-03 16:52:15 +08:00
Leif Andersen
4c4874c26d Documentation for scheme_register_process_global is fixed.
It was previously both incomplete, and incorrect.
2016-02-02 17:55:06 -07:00
Gustavo Massaccesi
65eaff3a03 Avoid compiler warnings 2016-02-02 19:06:31 -03:00
Gustavo Massaccesi
2fb1d4f45d Fix typo 2016-02-02 19:06:23 -03:00
ben
7ea277e420 typo: numerator -> denominator 2016-01-30 20:40:55 -05:00
Matthew Flatt
4e7bb3071a OS X: support Unix-style install
Support "Unix-style" (as opposed to "in-place") installation for
OS X, which is mostly a matter of putting ".app" files in the
right place and correcting relative references.

Intended to fix #1180
2016-01-29 22:01:57 -07:00
Robby Findler
7a11d09134 fix tests 2016-01-29 06:14:39 -06:00
Robby Findler
ec4bd288bf add support for ... to -> contracts to indicate repeated arguments
also fix order of evaluation for ->
2016-01-28 15:34:57 -06:00