Commit Graph

3080 Commits

Author SHA1 Message Date
Matthew Flatt
3c563484c6 fix memory-management bug in struct->vector
Closes PR 15410
2017-02-25 08:32:08 -07:00
Matthew Flatt
481dc9b0e8 fix port line, col, and pos to stay at #f when set to #f 2017-02-23 19:56:21 -07:00
Matthew Flatt
39b2a61700 fix mutability checking in impersonator-struct
Thanks to Scott Moore for the repair.
2017-02-23 19:56:21 -07:00
Jay McCarthy
fafa9c2bbd Merge pull request #1618 from leafac/fix-git-checkout
Fix “git-checkout”
2017-02-13 10:29:51 -05:00
Leandro Facchinetti
7ae83ba1e6 Fix “git-checkout” by adding HTTP auto-reconnect 2017-02-11 08:55:41 -05:00
Robby Findler
0ace11ddcd fix bug in build-source-location
closes #1605
2017-02-10 20:43:11 -06:00
Alexis King
6632beeca9 Fix wrap-expr/c and expr/c to reflect the intended use
The expr/c syntax class, as well as its underlying implementation
function, wrap-expr/c, previously produced misleading error messages.
The main purpose of these tools is to ensure a user-provided expression
conforms to a macro-provided contract. However, contract errors produced
by these forms were consistent with situations where both value and
contract were provided by the same party.

This fixes the discrepancy by changing how these forms assign blame to
emulate contract errors that arise from improper function arguments,
since most expressions provided to macros are semantically similar to
function arguments. All examples within the documentation itself
reflect this use case.

These changes alter the contents of error messages raised by expr/c and
wrap-expr/c, which could theoretically break some test suites, but it’s
extremely unlikely that any non-test code would depend on the precise
wording of contract error messages, and the interface is otherwise
completely backwards-compatible.

fixes #1412
2017-02-08 11:04:04 -05:00
Matthew Flatt
a5e7972bde JIT: fix handling of index argument to bytes-set!
When the second argument to `bytes-set!` is a reference to a
module-level variable that is definitely defined but not a known
constant, then an incorrect reordering was used that would cause
the third argument value to get overwritten before the call.

Closes #1601
2017-02-08 07:52:52 -07:00
Matthew Flatt
b3223ad8d2 bytecode compiler: add missing stack check in SFS pass
C-implemented recursive pass needs stack-overflow
check and handling.

Closes #1607
2017-02-06 17:19:57 -07:00
Matthew Flatt
2333251a26 note OpenSSL upgrade for native libraries 2017-02-06 17:19:57 -07:00
Robby Findler
84048f6776 avoid call to coerce-contract when we know it is already a contract 2017-02-05 14:37:04 -06:00
Robby Findler
8c5c8da1a7 fix fast path to not ignore pre/post conditions and bail out appropriately 2017-02-05 14:36:43 -06:00
Sam Tobin-Hochstadt
71a43f34c8 Use correct base path for finding gracket. (#1609)
Fixes error in http://drdr.racket-lang.org/38697/pkgs/compiler-test/tests/compiler/embed/test.rkt#output1
2017-02-03 15:19:28 +00:00
Sam Tobin-Hochstadt
8a49a8e545 Fix for PLT_DELAY_FROM_ZO custodian. 2017-02-02 17:06:40 +00:00
Ryan Culpepper
2def574c3c syntax/parse: clean up "at"/"within"-term handling
Added comments and examples about "at" and "within" terms
Fixed ps->stx+index bugs related to struct and vector patterns
2017-02-02 01:06:14 -05:00
Ryan Culpepper
de60c00f56 syntax/parse: fix ps->stx+index; fixes #1602
Collapse CDR frames separated by ORD, POST, etc. For example,
(1 ORD 2 stx) should be same as (3 stx).
2017-02-02 00:25:20 -05:00
Stephen Chang
fe9f0e6e92 fix segfault when using preserved stx prop with non-interned-symbol key
closes #1594
2017-02-01 22:21:04 -05:00
Matthew Flatt
69d7636770 fix position counting with internal read shortcut
The primitive `read` uses a shortcut --- a private "ungetc"
implementation --- that did not count position correctly for
non-ASCII characters.

Closes #1599
2017-01-30 20:01:22 -07:00
Matthew Flatt
6c9dbea31f make pretty-print-newline work on any output port
The documentation says that it should work on any output port,
although there's special treatment of ports that originate
from `pretty-print` itself.

Closes #1579.
2017-01-30 05:41:49 -07:00
Matthew Flatt
572b96a6ef add 'gui-bin-dir as a separate configuration option
Allow the directory for GUI executables to be specified as different
from console executables. The defaults for those two are different
on Mac OS, and configuring them differently might be useful to
address #1575.

Although there is probably no demand on Windows or Unix for splitting
the console and GUI bin directories, this patch tries to make things
work sensible there. On Windows, there's a corner case where a
launcher that starts GRacket (especially with `-z`) is intended to be
a console executable. The launcher creator can be told that via a
`subsystem` option, but a new `#:console?` argument was needed for
`make-gracket-launcher-path` lets the path selector know.
2017-01-30 05:41:49 -07:00
Sam Tobin-Hochstadt
80abc0a020 Fix warning. 2017-01-30 12:40:23 +00:00
Gustavo Massaccesi
a21b33a760 mark struct operations as single valued and mark preserving
Also, the optimizer recognizes struct operations as procedures,
so it will reduce

  (procedure? my-struct?) ==> #t
2017-01-29 20:05:46 -03:00
Gustavo Massaccesi
601587c068 advance effect clocks after reductions
After some reductions, the new rator advance less the effect
clocks than the original rator. For example in

    (equal? x 7) ==> (eq? x 7)

    (my-struct? x) ==> #t or #f
2017-01-29 20:05:46 -03:00
Gustavo Massaccesi
b73e1dfd6c consider the flags of unclonable lambdas for reductions
The lambdas can be marked as single valued and/or mark preserving.
With this information is possible to remove unnecessary wrapping
like the `values` in

    (let ([f (lambda () '(1))])
      (display f f)
      (values (f)))

or in reductions like

   (car (list (f))) ==> (values (f)) ==> (f)

Moreover, this is useful to test that the optimizer has marked
correctly the function f as single valued and mark preserving.
2017-01-29 20:05:45 -03:00
Matthew Flatt
aa130df8b2 fix prop:custom-write printing on structure ports
When a `prop:custom-write` function prints to a given port for
recursive printing, don't reject a port that is a structure port.

Relevant to #1579
2017-01-27 18:04:20 -07:00
Matthew Flatt
03f2deeea9 fix module->namespace problem resoring bindings
If a module has any sort of complex bindings, such as a definition of
a macor-introduced identifiers, then `module->namespace` and variants
(like `variable-reference->namespace`) need to recreate suitable
bindings. Make sure that the module-path index for recreated bindings
is the run-time one, not the compile-time one.

Closes #1584
2017-01-27 17:30:35 -07:00
Gustavo Massaccesi
0a5c510b72 advance the vclock for a values with 0 or more than 1 argument
To avoid moving expressions that may have a side effect, the optimizer must
recognize that in this position this will cause an error and advance
the virtual clock.

Currently the only primitive that is flagged as SCHEME_PRIM_IS_OMITABLE and
may have multiple return values is `values`.

Thanks to Robby for finding the original version of the test.
2017-01-27 18:18:26 -03:00
Matthew Flatt
0e12201c4d fix bytecode writer for immediate compile-time values
When a hash table or other special value appears immediately on the
right-hand side of `define-values`, it needs to be protected by an
explicit quote when writing to bytecode.

Closes #1580
2017-01-27 09:07:53 -07:00
Matthew Flatt
89512edad9 fix JIT handling of struct type property predicates and accessors
When the JIT guesses that a rator will always be a struct type
property or accessor, the run-time check to confirm that guess
was broken.
2017-01-27 07:53:03 -07:00
Jay McCarthy
420330fef0 Protecting literal data, like vectors and hashes, from tagged paren styles 2017-01-25 17:47:39 -05:00
Vincent St-Amour
45bacf4917 Update raco pkg new for v6.8.
(cherry picked from commit 420f4795b6da2b8206ec9e2812d42123b8284fa1)
2017-01-24 14:50:13 -06:00
Georges Dupéron
e311d671de Applied changes requested by @rmculpepper for PR #1587 2017-01-23 20:32:40 -05:00
Georges Dupéron
6a07a3f986 Fixes several issues with syntax/parse, and adds some tests.
* byte-regexp? values should not be considered 3D syntax.
* hash? values are now allowed in serialized syntax properties with (template … #:properties (…))
* marshalling properties which were prefab structs called map on the result of struct->vector, changed it to struct->list as the struct "name" is always serializable.
2017-01-23 20:32:40 -05:00
Matthew Flatt
a9ae341105 in-bytes: use unsafe-bytes-ref
In the same way that `in-vector` uses `unsafe-vector-ref`,
make `in-bytes` expand to a use of `unsafe-bytes-ref`.
2017-01-22 07:57:46 -07:00
Matthew Flatt
aead07b5de bytecode compiler: fix misuse of "optimize" mode on a "resolved" form
Thanks to Robby for the test.
2017-01-20 21:35:09 -07:00
Matthew Flatt
736cdfb2c1 yet more repairs to the interaction of errors and let-values
Continuing the saga that includes 8190a7730d and d1ba9fbb6e, it turns
out that a 0-binding clause as the last one isn't so special after
all. A little later in the optimizer, now that we're sometimes moving
an error to the body, we can't assume that the body can be discard
if an error was detected.
2017-01-20 18:07:05 -07:00
Gustavo Massaccesi
d1ba9fbb6e fix wcm on error in let's
Repairs a problem with 8190a7730d, which can incorerctly
move an erroring experssion into tail position.
2017-01-20 15:04:11 -07:00
Matthew Flatt
8190a7730d fix optimizer bug related to errors and zero-values binding 2017-01-20 12:19:05 -07:00
Matthew Flatt
d0b5de398e fix internal function names 2017-01-20 10:44:25 -07:00
Matthew Flatt
80e8e0f9e0 fix a mismatch between the optimizer and validator
Thanks to Leif for the report and test case.
2017-01-18 15:39:38 -07:00
Matthew Flatt
ecaa14544f add v6.8 HISTORY note 2017-01-16 15:40:34 -07:00
Matthew Flatt
3f2de918d8 fix variable-reference->namespace for phase > 0
Set up bindings and shift phases as needed to make
`variable-reference->namespace` work in a run-time position when the
enclosing module is instantiated at a phase other than 0.

Thanks to Rohin Shah for the bug report.
2017-01-16 08:53:57 -07:00
Matthew Flatt
b138c340e1 fix extended {read,peek}-char-or-special
The changes in 08ca76b741 require the primitives to be reclassified
from non-CM to general.

Also, add an internal shortcut for checking arity.
2017-01-15 10:02:57 -07:00
Matthew Flatt
2cf6691439 expose read capabilities of string->number
Extend the `string->number` parser for use by readers, which need
error messages and/or extflonum results.
2017-01-13 08:09:19 -08:00
Matthew Flatt
08ca76b741 extend {read,peek}-char-or-special
Support an external implementation of `read-syntax` by exposing
functionality that is currently internal to `read-syntax`: a srcloc
argument to a "special"-producing port function and wrapping special
results to reliably distinguish them from characters.
2017-01-13 08:09:18 -08:00
Matthew Flatt
7ef20dd606 transplant-output-port: defend against weird ports
Avoid an error within `transplant-output-port` if the given output
port's position somehow goes down instead of up.

Merge to v6.8
2017-01-11 08:06:25 -07:00
Matthew Flatt
a860791d6f Windows: avoid using pipe code for file redirection
When Racket is run with stdout or stderr redirected to a file,
then it must be treated as a regular file, otherwise flushing
and position counting doesn't work right.

Merge to v6.8
2017-01-11 06:48:07 -08:00
Michael Myers
e2070b882d Replace arithmetic with bit operations
quotient/remainder is replaced with word-index and bit-index, expt with arithmetic-shift.
2017-01-10 21:59:22 -06:00
Gustavo Massaccesi
3eb86584c0 use flags of lambdas if they can't be inlined
Merge to 6.8 release.
2017-01-10 14:39:09 -03:00
Matthew Flatt
aa9d5e5614 expander: avoid misinterpreting unforced module context
Use the simple-scope shortcut only when the module context
is itself simple.

Merge to v6.8
2017-01-10 09:40:46 -07:00
Matthew Flatt
8ff011fc51 fix srcloc collapse for a path to a file in a root directory 2017-01-08 07:14:28 -06:00
Alexis King
dc9aa8a569 Fix source location in errors reported by define/match 2017-01-07 08:22:13 -08:00
Vincent St-Amour
57e787eec2 Post-release version for the v6.8 release 2017-01-07 07:40:13 -06:00
Robby Findler
ba060131d1 fix syntax error source location for define/contract
closes #1561
2017-01-04 16:53:26 -06:00
Robby Findler
057ab0c5ff fixed error messages to say struct/c when appropriate 2017-01-04 16:49:38 -06:00
Alexis King
597661fa4e Make range from racket/list act like in-range when used with for 2017-01-03 15:26:42 -08:00
Robby Findler
cff1c1dd4e fix interaction between real? and flat-named-contract
and fix opters, which were just broken for flat-named-contract and names

closes #1559
2017-01-03 17:06:42 -06:00
Matthew Flatt
78bbcec963 avoid trying to load Foundation framework on non-Mac OS
Relevant to #1549
2017-01-03 12:48:38 -07:00
Alexander Hedges
f1d853eeac Use JIT on powerpc 2017-01-03 11:39:40 -07:00
Alexander Hedges
d031f30d2a Add support for PowerPC on FreeBSD 2017-01-03 11:39:40 -07:00
Robby Findler
efb96c97b5 add #:name-for-blame to define-module-boundary-contract 2017-01-03 07:10:30 -06:00
Matthew Flatt
ada002616e fix Win64 native stack trace
Fix Win64-specific bug in 7812c604f4.
2017-01-02 12:42:02 -07:00
James Bornholt
ae21f8f875 Make PLTDISABLEGC work again
In e59f888, new GCs no longer inherit the `avoid_collection` value set by
PLTDISABLEGC, and so that setting is lost as soon as the master place spawns
(due to `GC_switch_out_master_gc`).
2017-01-02 11:24:11 -07:00
Matthew Flatt
e041d0f32f fix optimizer bug related to detected arity errors
When multiple-binding `let-values` form is split into a single-binding
form on the grounds that the right-hand side will definitely error,
the optimizer's effect clocks were advance incorrectly.

Closes #1552
2017-01-02 07:00:22 -07:00
Matthew Butterick
fc194d7337 update copyright year to 2017 2017-01-02 06:42:31 -07:00
Matthew Flatt
869d48b784 error context printing: show repeat counts
Instead of duplicating a context line, show "[repeats <n> times]".
This improvement particularly helps avoid showing less context
now that `for/list` creates a non-tail recursion to build up
the result list.
2017-01-02 06:42:31 -07:00
Robby Findler
66b199307c Adjust and/c so that it cooperates with between/c
Specifically, when it sees these contracts:

  (and/c real? negative?)
  (and/c real? positive?)
  (and/c real? (not/c positive?))
  (and/c real? (not/c negative?))

it generates the corresponding use of >=/c, <=/c, </c, or >/c, but
those contracts have also been adjusted to report their names as
(and/c real? ...).

This mostly is an improvement for contract-stronger, but also make it
so that (between/c -inf.0 +inf.0) just uses the real? predicate
directly, instead of a more complex function
2016-12-29 09:30:39 -06:00
Robby Findler
9019e8b318 make real? and (between/c -inf.0 +inf.0) be the same contract
mostly this just makes contract-stronger? work (slightly) better
2016-12-28 18:56:30 -06:00
Matthew Flatt
710320e3dc "Mac OS X" -> "Mac OS"
Although "macOS" is the correct name for Apple's current desktop OS,
we've decided to go with "Mac OS" to cover all of Apple's Unix-like
desktop OS versions. The label "Mac OS" is more readable, clear in
context (i.e., unlikely to be confused with the Mac OSes that
proceeded Mac OS X), and as likely to match Apple's future OS names
as anything.
2016-12-23 12:18:36 -07:00
Matthew Flatt
5cc5bb7c55 fix GRacket makefile to detect ".icns" change 2016-12-23 11:40:09 -07:00
Matthew Flatt
88aa7fdeff don't reorder some unsafe expressions that can depend on an effect
For example, an `unsafe-unbox` call should not be moved past the
call to an unknown function that might change a box's content.

Thanks to Sergey Pinaev for the report.
2016-12-23 08:01:30 -07:00
Matthew Flatt
5a4391dd90 don't share "gmp.c" compilation between CGC and 3m
Using `--disable-jit` causes futures to be disabled, and places are
always disabled for CGC; in that case thread-local variables are
not needed. Meanwhile, the 3m build still has places, so a "gmp.c"
compiled without thread-local support is broken.
2016-12-22 19:40:08 -07:00
Gustavo Massaccesi
992f990860 optimizer: merge lookup_constant_proc and optimize_for_inline
The objective of lookup_constant_proc and the first part of
optimize_for_inline was to find out if the value of an expression was a
procedure and get it to analyze its properties or try to inline it. Both
were called together in a few places, because each one had some special
cases that were missing in the other.

So, move the lookup and special cases from optimize_for_inline to
lookup_constant_proc, and keep only the code relevant to inlinig in
optimize_for_inline.
2016-12-22 23:34:27 -03:00
Matthew Flatt
d4ec96e35c recognize EROFS for file-or-directory-permissions
Closes #1478
2016-12-22 18:10:19 -07:00
Matthew Flatt
4bff048fb3 update app icons to new Racket logo 2016-12-22 13:36:52 -07:00
Matthew Flatt
eaa486db11 unbreak no-places, no-futures build 2016-12-22 10:50:27 -07:00
Matthew Flatt
cefb3aec2a make glib logging hook work with extra threads
If an OS-level thread other than a Racket thread logs a message, then
the message needs to be queued instead of handled immediately.

If multiple places are running, then the right handler thread is not
clear, so just queue to the main place's thread.

Closes racket/gui#66
Closes racket/drracket#77
2016-12-22 09:35:04 -07:00
Matthew Flatt
00171a3c2c file/[un]tar: support for long paths
Implement POSIX.1-2001/pax and GNU extensions for long paths and links
in `untar` and `tar`. Add a `#:format` argument to `tar` to select
among POSIX.1-2001/pax, GNU, or error encoding for long paths.
2016-12-21 16:00:12 -07:00
Matthew Flatt
9eb7d6b84e fix uses of namespace context without ensuring prepared
Closes #1530
2016-12-21 16:00:12 -07:00
Robby Findler
deaf48ae30 add #:use-wrapper-proc to racket/surrogate 2016-12-21 15:12:15 -06:00
Robby Findler
3e191fef04 misc small improvements to racket/surrogate
(generate less code in macro, add some basic test cases,
 small improvement to syntax errors, and small docs clarification)
2016-12-21 12:35:59 -06:00
Tony Garnock-Jones
b99639ff97 Detect and propagate errors from tar to result of tar-gzip. 2016-12-20 17:44:52 +13:00
Matthew Butterick
3e4a0353cf fix misuse of trace-printf 2016-12-19 19:17:00 -07:00
Robby Findler
98c3906059 missed a spot in b100f4b 2016-12-17 17:09:09 -06:00
Robby Findler
21cf407616 fix a bug in 003e8c7
closes #1539
2016-12-17 08:16:13 -06:00
Robby Findler
b100f4bb75 fix error in 003e8c7 2016-12-15 17:35:23 -06:00
Robby Findler
8918279b21 adjust ->i so that when it sees that it got a flat contract,
it doesn't apply it the second time (since we know that the
only difference for indy blame is in the negative position
and we know that flat contracts never assign negative blame)

This commit combined with the two previous (2b9d855 and 003e8c7) do
not seem to have a significant effect on the performance of ->i
contract checking. In particular, I see a 50% slowdown between the
version before and the version after these commits on the third `time`
expression below, but no significant difference on the first two.

(without the improvement to flat-contract?, these commits are
a significant slowdown to `g`)

 #lang racket
 (require profile)
 (define f
   (contract (->i ([y () integer?]
                   [x (y) integer?])
                  (values [a () integer?]
                          [b (a) integer?]))
             values
             'pos 'neg))

 (define g
   (contract (->i ([y () (<=/c 10)]
                   [x (y) (>=/c y)])
                  (values [a () (<=/c 10)]
                          [b (a) (>=/c a)]))
             values
             'pos 'neg))

 (define (slow-predicate n)
   (cond
     [(zero? n) #t]
     [else (slow-predicate (- n 1))]))

 (define h
   (contract (->i ([y () slow-predicate]
                   [x (y) slow-predicate])
                  (values [a () slow-predicate]
                          [b (a) slow-predicate]))
             values
             'pos 'neg))

 (time
  (for ([x (in-range 100000)])
    (f 1 2) (f 1 2) (f 1 2)
    (f 1 2) (f 1 2) (f 1 2)
    (f 1 2) (f 1 2) (f 1 2)))

 (time
  (for ([x (in-range 100000)])
    (g 1 2) (g 1 2) (g 1 2)
    (g 1 2) (g 1 2) (g 1 2)
    (g 1 2) (g 1 2) (g 1 2)))

 (time
  (for ([x (in-range 10000)])
    (h 50000 50000)))
2016-12-15 12:43:17 -06:00
Robby Findler
2b9d855231 special case the flat-contract? predicate to avoid having
to create the whole contract struct for values that get coerced to flat contracts
2016-12-15 12:42:48 -06:00
Robby Findler
003e8c7870 avoid evaluating the dependent contract expressions multiple times in ->i 2016-12-15 12:42:48 -06:00
Robby Findler
f1d6e8bfe8 bring down below 102 columns 2016-12-15 12:42:48 -06:00
Matthew Flatt
8a7852ebbf fix re-expansion of a simple #%module-body form with submodules
Closes #1538
2016-12-15 08:05:02 -07:00
Matthew Flatt
4683b023ab fix another space-safety issue in interpreter loop
When the main interpreter loop is called for an application where the
argument array coincides with the current runstack pointer, then the
protocol is that the callee gets to modify that space --- and it
should modify that space as arguments become unused. The interpreter
was always copying arguments to a fresh space, though.
2016-12-15 08:05:02 -07:00
Gustavo Massaccesi
f2be44dea4 optimizer: allow wcm with multiple return value in noncm_expression 2016-12-15 10:39:16 -03:00
Gustavo Massaccesi
22d61c41d5 optimizer: merge single_valued_expression and definitely_no_wcm_in_tail
Both function have a similar purpose and implementation, so merge them to consider
all the special cases for both uses.

In particular, detect that:
  (if x (error 'e) (void)) is single-valued
  (with-continuation-mark <chaperone-key> <val> <omittable>) is  not tail sensitive.

Also, as ensure_single_value was checking also that the expression was has not a
continuation mark in tail position, it added in some cases an unnecessary
wrapper. Now ensure_single_value checks only that the expression produces
a single vale and a new function ensure_single_value_noncm checks both
properties like the old function.
2016-12-14 20:18:21 -03:00
Gustavo Massaccesi
6d1018fbe8 optimizer: fix interaction of arithmetic reductions and wcm
Also fix a similar problem with branches reduction in a Boolean context.
2016-12-14 20:13:28 -03:00
Matthew Flatt
dc0898f5ef ffi/unsafe/objc: check for bad protocol
Raise an exception instead of installing NULL as a protocol for a
class.
2016-12-14 13:39:29 -07:00
Matthew Flatt
ce370c2f64 fix preservation of properties absent a source location 2016-12-14 08:13:17 -07:00
Matthew Flatt
6ec5b27f81 JIT: simplify output for begin0 that's just for its non-tail effect
Don't store away and restore multiple results if it's obvious
that nothing happens in between.
2016-12-13 19:20:41 -07:00
Matthew Flatt
7204d3136b avoid unnecessary void accumulator for for[*] 2016-12-13 19:20:41 -07:00
Matthew Flatt
d7b18e7a9c adjust map and for ... in-list to not retain their lists
Adjust list and stream handling as sequences so that during the body

 (for ([i (in-list l)])
   ....)

then `i` and its cons cell in `l` are not implicitly retained while
the body is evaluated. A `for .... in-stream` similarly avoids
retaining the stream whose head is being used in the loop body.

The `map`, `for-each`, `andmap`, and `ormap` functions are similarly
updated.

The `make-do-sequence` protocol allows an optional extra result so
that new sequence types could have the same properties. It's not clear
that using `make-do-sequence` is any more useful than creating the new
sequence as a stream, but it was easier to expose the new
functionality than to hide it.

Making this work required a repair to the optimizer, which would
incorrectly move an `if` expression in a way that could affect
space complexity, as well as a few repairs to the run-time system
(especially in the vicinity of the built-in `map`, which we should
just get rid of eventually, anyway).
2016-12-13 19:20:41 -07:00
Matthew Flatt
5e94a906cd compile simple for/list to avoid reverse
Compile a `for[*]/list` form to behave more like `map` by `cons`ing
onto a recursive call, instead of accumulating a list to reverse.

This style of compilation requires a different strategy than before.
A form like

 (for*/fold ([v 0]) ([i (in-range M)]
                     [j (in-range N)])
   j)

compiles as nested loops, like

 (let i-loop ([v 0] [i 0])
   (if (unsafe-fx< i M)
       (i-loop (let j-loop ([v v] [j 0])
                 (if (unsafe-fx< j N)
                     (j-loop (SEL v j) (unsafe-fx+ j 1))
                     v))
               (unsafe-fx+ i 1))
       v))

instead of mutually recursive loops, like

 (let i-loop ([v 0] [i 0])
   (if (unsafe-fx< i M)
       (let j-loop ([v v] [j 0])
         (if (unsafe-fx< j N)
             (j-loop (SEL v j) (unsafe-fx+ j 1))
             (i-loop v (unsafe-fx+ i 1))))
       v))

The former runs slightly faster. It's difficult to say why, for
certain, but the reason may be that the JIT can generate more direct
jumps for self-recursion than mutual recursion. (In the case of mutual
recursion, the JIT has to generate one function or the other to get a
known address to jump to.)

Nested loops con't work for `for/list`, though, since each `cons`
needs to be wrapped around the whole continuation of the computation.
So, the `for` compiler adapts, depending on the initial form. (With a
base, CPS-like approach to support `for/list`, it's easy to use the
nested mode when it works by just not fully CPSing.)

Forms that use `#:break` or `#:final` use the mutual-recursion
approach, because `#:break` and #:final` are easier and faster that
way. Internallt, that simplies the imoplementation. Externally, a
`for` loop with `#:break` or `#:final` can be slightly faster than
before.
2016-12-13 18:27:06 -07:00
Ryan Culpepper
e0ccdc769a syntax/parse: factor out stxclass options passed on to pattern reps
And fix recent pattern-has-cut? for stxclasses w/ no-delimit-cut option.
2016-12-12 11:34:48 -05:00
Ryan Culpepper
8e5ccd3239 syntax/parse: improve minimatch stx errors 2016-12-12 11:00:38 -05:00
Ryan Culpepper
bcc8535b78 syntax/parse: reduce allocation when parsing cannot fail
When parsing cannot fail, avoid allocating expectstacks and
failures (thanks samth for the idea). Allocation still happens
for progress and failuresets (conses of #t, now), though.

Compile with `PLTSTDERR="debug@syntax-parse"` to log cannot-fail
syntax-parse expressions and syntax class definitions.
2016-12-12 11:00:38 -05:00
Ryan Culpepper
e676ba74a5 syntax/parse: add pattern-has-cut? 2016-12-12 11:00:38 -05:00
Alexis King
db8d8f8d75 Improve the type error messages for many functions from racket/list
related to discussion in #1533
2016-12-10 20:38:44 -08:00
Alexis King
62170e6218 Add index(es)-of and index(es)-where to racket/list 2016-12-10 13:01:12 -08:00
Matthew Flatt
9c1b870769 optimizer: fix interaction of escaping expressions and wcm
The optimizer can detect that some expressions will escape through
an error, and it can discard surrounding code in that case. It should
not change the tailness of a `with-continuation-mark` form by
liftng it out of a nested position, however. Doing so can eliminate
stack frames that should be visible via errotrace, for example.
This change fixes the optimizer to wrap an extra `(begin ... (void))`
around an expression if it's lifted out of a nested context and
might have a `with-continuation-mark` form in tail position.
2016-12-09 08:58:40 -07:00
Matthew Flatt
7812c604f4 fix native stack traversal for stack dumps
When caching the result of a stack traversal, adjust
the actual stack only after the traversal is complete
to avoid interfering with libunwind's decoding of the
stack.
2016-12-09 06:47:43 -07:00
Jay McCarthy
2b3128cdb4 Protect raco setup from default deps value (see line 638 and 557) 2016-12-08 15:43:15 -05:00
Matthew Flatt
8f9d4860fd change syntax to preserve all properties on a template
In

 (with-syntax ([x ....])
   #'(x y))

and property on the source syntax object `(x y)` was lost in
constructing a new syntax object to substitute for `x`, while
properties on preserved literal syntax objects, such as `y`
were intact. Change `syntax` to preserve properties for
reconstructed parts of the template.

This change exposes a problem with 'transparent taint modes,
where the internal "is original?" property was preserved while
losing scopes that wuld cancel originalness. So, that's fixed
here, too.
2016-12-07 09:15:14 -07:00
Matthew Flatt
24c2f8077c fix declaration mismatch for no-places build 2016-12-06 14:37:16 -07:00
Matthew Flatt
2605437617 unbreak no-futures build 2016-12-06 14:30:12 -07:00
Matthew Flatt
6fe17be82f fix interaction of futures with memory limits
The continuation of a future being evaluated concurrently was not
correctly attributed to the future's custodian (as inherited from
from the creating thread).
2016-12-06 11:21:30 -07:00
Matthew Flatt
20842aaf3a make make-vector future-safe
One interesting corner case is when a vector is allocated
in a way that would exceed a memory limit. The custodian
captured with a future is used to guard large allocations.
2016-12-06 11:21:30 -07:00
Sam Tobin-Hochstadt
8b915ea977 Avoid uninitialized-variable warning. 2016-12-05 10:01:03 -05:00
Gustavo Massaccesi
25dc89a238 more reductions in ignored expressions
extend optimize_ignore to go inside expressions with
begin, begin0 and let.

Also, try to reuse begin's in the first argument of
make_discarding_sequence.
2016-12-04 23:18:43 -03:00
Matthew Flatt
200fbe9b95 fix rename-file-or-directory for raising exn:failsystem:fail:exists
Broken by 0133954c84, which avoided a made-up `EEXIST` but left in
place a no-loner-appropriate test for raising `exn:failsystem:fail:exists`.
2016-12-01 10:21:11 -07:00
Matthew Flatt
af555731a6 adjust generated #ifdefs in FFI
Make sure `#` is start at the start of the line using
the `IFDEF` function, although we'll probably never
again use a compiler old enough for this to matter.
2016-12-01 10:21:11 -07:00
Robby Findler
cbcbc6ae0c avoid adding bogus names to arguments of various contract combinators
closes #1528
2016-12-01 09:34:16 -06:00
Vincent St-Amour
8130b571c4 Fix compilation on ARM.
From Juan Francisco Cantero Hurtado.

Closes #748.
2016-11-29 12:26:26 -06:00
Matthew Flatt
ac04d1e544 repair broken allocation
Commit 4b02c169d7 incorrectly used a size calculation for
structs in the case a serialized structure representation.
2016-11-28 19:38:32 -07:00
Matthew Flatt
ba1f5be532 fix potential crash when printing a changing hash table
If a mutable hash table changes while it's being printed,
various parts of the printing function could see a mismatch
between the current size and an old array size. To avoid this
problem, extract the size whenever extracting the array.
2016-11-28 18:17:36 -07:00
Matthew Flatt
4b02c169d7 improve allocation reports, especially in backtrace mode
Track total bytes allocated for various tags and categories
in backtrace mode, and improve structure reporting to include
byte counts.

Strip away a more ad-hoc counting that was added recently.
2016-11-28 08:49:07 -07:00
Sam Tobin-Hochstadt
34fdd2863a Avoid traversing immutable vectors when specified.
This adds #:eager as an option for controlling this behavior.

Using `#:eager 10` is a 2x improvement in performance for configuration 010001
of the suffixtree benchmark from Takikawa et al, POPL 2016.

The default behavior is unchanged. This is configurable because some
programs are much faster when eager checking is performed. For example:

(require racket/contract)
(collect-garbage)
(time (for/sum ([_ 100000])
        (vector-ref (contract (vectorof integer? #:eager #t) #(1) 'pos 'neg)
                    0)))
(collect-garbage)

(time (for/sum ([_ 100000])
        (vector-ref (contract (vectorof integer? #:eager #f) #(1) 'pos 'neg)
                    0)))

The second loop is 3-4 times slower than the first. However, making
the vector much larger will make the difference go the other way.
2016-11-22 11:28:30 -05:00
Matthew Flatt
201d3760b7 fix syntax-source-module repair
Try again on 3a782d01db, which broke contract tests by
mangling the module path index attached to a module.
2016-11-21 20:43:46 -07:00
Matthew Flatt
3a782d01db fix interaction of module->namespace and syntax-source-module
An identifier that gets a module context via `module->namespace` plus
`namespace-syntax-introduce` should not count as having the module as
its source as reported by `syntax-source-module`.

The correct behavior happened for the wrong reason prior to commit
cb6af9664c.

Closes #1515
2016-11-21 17:40:44 -07:00
Vincent St-Amour
87161fc5f3 Add more missing properties. 2016-11-21 15:46:25 -06:00
Matthew Flatt
02b0a30988 improve ellipsis-count checking wrapper
For a template expression that involevs ellipses, a wrapper is added
to catch failures an report as an "incompatible ellipsis match count"
error. The wrapper was only added when there are multiple pattern
variables with ellipses, but it turns out that it's possible to fail
with incompatible counts using a single pattern variable.

Besides handlign that case, the revised check avoids an unnecessary
wrapper in cases where multiple pattern variables have ellipses but
they are used independently in a template.

Closes #1511
2016-11-21 10:01:36 -07:00
Vincent St-Amour
cf2030b0b1 Add missing properties to contract chaperone. 2016-11-21 11:00:02 -06:00
Sam Tobin-Hochstadt
c5cce7aa7b Fix test for values, and simplify test case. (#1525)
Repairs 7c22c42c7.
2016-11-21 11:02:56 -05:00
Matthew Flatt
7c22c42c72 fix optimizer imprecision for values
Without this repair,

 #lang racket/base
 (require 2htdp/abstraction)
 (for/list ((dropping-which-one (in-naturals)))
   1)

fails to compile with a "optimizer clock tracking has gone wrong"
error. A variant of this test (that doesn't depend on `2htdp`)
is now in the "optimize.rktl"; a simpler and more direct test
should be possible, but I wasn't able to construct one.
2016-11-20 18:06:46 -07:00
Robby Findler
09c1174f7e add the #:extra-delay argument to recursive-contract 2016-11-19 15:56:18 -06:00
Ryan Culpepper
f1128cca97 syntax/parse: fix literal-set->predicate and datum-literals 2016-11-16 18:58:44 -05:00
Gustavo Massaccesi
85eee2bbbc optimizer: remove argument of finish_optimize_application
The value of rator_flags was calculated in optimize_application and used in
finish_optimize_application, but it is possible to calculate it directly in
finish_optimize_application, and then remove some internal coupling.

This also simplifies other locations where the rator of an application was
changed and then it was necessary to recalculate the value of rator_flags
to complete the optimization steps.
2016-11-15 11:39:11 -03:00
Gustavo Massaccesi
9ebfdb54e7 extend reductions for expressions like (if (if X Y #f) Z K)
=> (if X (if Y Z K) K) where K is a constant,
to expressions where the inner `if` is (if X Y #t) or (if X #t/#f Y)
2016-11-15 11:37:17 -03:00
Gustavo Massaccesi
c3595c56b4 extend reductions for expressions like (let ([x (let ([y M]) N)]) P)
=> (let ([y M]) (let ([x N]) P))

to expressions where the outer `let` has more than one clause, for example

(let ([x (let ([y M]) N)]
      [z _])
  P)
2016-11-15 10:43:26 -03:00
Matthew Flatt
115dec6fd9 fix bug in scheduler
When a thread that is blocked on a set of semaphores and channels
is suspended and resumed after one of the events becomes ready,
and if the event has a wrapper function, then the wrapper was
not applied and the event selection was not reported correctly.

Thanks to Philip McGrath for reporting the problem.
2016-11-14 08:21:42 -07:00
Sam Tobin-Hochstadt
3b9354f16b Handle quasi-list patterns better inside prefab struct patterns.
Reported by William Bowman.
2016-11-09 19:47:12 -05:00
Matthew Flatt
db26a24f2f Windows: fix timezone calculation
Comparing to daylight-saving time change was performed incorrectly, so
that days in the same month as a change and the hour within the day before
the switch hour were all treated as pre-switch (instead of counting
only days up to the switch as pre-switch).

Thanks to Jon Zeppieri for the repair and George Neuner for
the report.
2016-11-09 05:57:05 -08:00
Vincent St-Amour
e7a6573a20 Fix configure.ac for NetBSD.
From Aleksej Saushev.

C.f. http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/lang/racket/patches/
2016-11-08 12:49:58 -06:00
Alexis King
393afa3759 Track the origin of modules produced by module+ forms
This ensures the 'origin property is propagated from macros that expand
to module+ forms.
2016-11-08 10:15:48 -08:00
Matthew Flatt
0d4e2a3275 configure: add -Wno-nullability-completeness for xform output
Mac OS X header files for 10.12 include `_Nullable` and `_Nonnull`
annotations. When those appear in xform output, they're no longer
counted as being in system headers, and so nullability
completeness is enabled. Disable is explicitly when the flag is
supported.
2016-11-04 05:05:22 -06:00
Gustavo Massaccesi
5833390396 optimizer: extend the reductions like (equal? x y) => (eq? x y)
This kind of reductions were applied only when x or y was a constant.

Classify the relevant predicates in 4 categories. In particular,
if <expr> satisfy pred? we can use this classification to apply
the correct reduction:

(equal? <expr> y) ==> [no reduction, unless y has a different type]
(equal? <expr> y) ==> (eqv? <expr> y)
(equal? <expr> y) ==> (eq? <expr> y)
(equal? <expr> y) ==> (begin <expr> (pred? y))
2016-11-01 20:40:01 -03:00
Gustavo Massaccesi
7c1cb1a2f0 optimizer: add symbol?, keyword? and char? to the relevant predicates
Also, add a new primitive interned-char? that is hidden, but it's
useful to track in the optimizer the the chars? with a value < 256
that are interned because they are treated specially, and if they
are equal? then they are eq?.
2016-11-01 20:40:00 -03:00
Robby Findler
3760de1fa9 improve the error message in ->* 2016-11-01 17:50:31 -05:00
Robby Findler
2f53b436f9 small error message tweak 2016-11-01 11:58:58 -05:00
Andrew Kent
82204d1444 faster in-*-id-table (#1499) 2016-10-30 14:28:13 -04:00
Andrew Kent
2070db9c01 report locations in default error handler 2016-10-30 17:19:32 +01:00
Matthew Flatt
19bfe3e44d xform: another Apple divergence from normal C tokenization
Make xform work with

  __attribute__ ((availability(macosx, introduced = 10.12.1)))

where `10.12.1` is not a normal C token.
2016-10-30 12:19:42 +01:00
Georges Dupéron
df2b1dad45 Fixes #1497 free-id-table-ref! with procedure failure argument stores the procedure, not its result 2016-10-28 10:47:48 -05:00
Georges Dupéron
432afc4561 raco pkg new: include v6.5 and v6.6 and v6.7 in .travis.yml 2016-10-26 21:02:15 -05:00
Matthew Flatt
cb6af9664c fix expand + compile + write + read + module->namespace
... + prefix-in + relative-path module. All of those ingredients
(or some similar alternatives) are necessary to trigger a slow
way of saving module context for interaction evaluation where
a module-path index shift was getting lost.
2016-10-26 17:09:30 -06:00
Gustavo Massaccesi
f159295e55 optimizer: add boolean? to the list of relevant predicates
Previously the relevant predicates where disjoint, and until this commit
the only predicate that recognizes #f was `not`. So it's necessary to fix
two reductions to allow other predicates that recognize #f, like `boolean?`.

Add a hidden `true-object?` primitive that recognizes only #t, that is also
useful to calculate unions and complements with `boolean?` and `not`.

Also, extend a special case for expressions like
    (or (symbol? x) (something))
where the optimizer is confused by the temporal variable that saves the
result of `(symbol? x)`, and the final expression is equivalent to
    (let ([temp (symbol? x)])
      (if temp #t (something)))
This extension detects that the temporal variable is a `boolean?` and
reduces the expression to
    (if (symbol? x) #t (something))
2016-10-25 16:49:13 -03:00
Craig Allen
b826b176d2 mistake in passing get-timestamp rather than sys-type to write-central-directory
It's worth noting that this hasn't caused me an issue, I came across it as I wanted to see what sys-type actually did. I couldn't say what the affect of this change would be and don't have a use case for it, it just looks wrong!
2016-10-23 11:25:17 -06:00
Matthew Flatt
c4d7e8bf1b improve ubsan support
Provide `--enable-ubsan` to simplify `-fsanitize=undefined` builds,
where alignment and floating-point divide-by-zero need to be
disabled to get useful results.

Also, repair undefined behavior exposed by the test suite. Most of the
repairs are avoiding `memset(..., NULL, 0)` --- which is an unhelpful
requirement, IMO. The other two repairs are worthwhile but unlikely to
have caused trouble.
2016-10-22 21:35:02 -06:00
Matthew Flatt
8ccde1e5b3 update HISTORY.txt for v6.7
Merge to v6.7
2016-10-15 07:10:44 -06:00
Matthew Flatt
9011fe7d83 fix optimizer on bitwise-and
The optimizer assumed a fixnum result if either argument to
`bitwise-and` implies a fixnum result. That's not correct if the
fixnum agument is negative.

Thanks to Peter Samarin for a bug report.

Merge to v6.7
2016-10-13 11:39:39 -06:00
Matthew Flatt
a9f2765b4f another errno in a signal handler 2016-10-13 11:27:28 -06:00
Matthew Flatt
6e2978fe5c save errno in write barrier signal handler
In case a write barrier happens between the set and use
of `errno`, make sure the barrier doesn't cause the
`errno` value to change in the process of making other
system calls.
2016-10-13 11:27:28 -06:00
Matthew Butterick
9422d66601 improve vertical positioning & paren shaping in syntax->string 2016-10-12 16:02:32 -05:00
Vincent St-Amour
ecadde3a65 Add #:logger keyword argument to with-intercepted-logging.
Closes #1486.
2016-10-11 11:50:33 -05:00
Vincent St-Amour
d171218215 Post-release version for the v6.7 release 2016-10-07 14:52:26 -05:00
Vincent St-Amour
d597983bb9 Make pkg git credential format extensible.
Thanks to Eli.
2016-10-07 14:17:31 -05:00
Vincent St-Amour
456a72a36c Have id-table-ref! call its failure thunks.
Closes PR15346.
2016-10-07 13:58:47 -05:00
Matthew Flatt
a1a2d9c2c7 fix missing expansion context for prop:rename-transformer proc
When calling a procedure that is attached as a
`prop:rename-transformer` property value, make sure that
any available expansion context is accessible as reflected by
`(syntax-transforming?)`.

Syntax parameters as rename transformers particularly rely on that
information for local expansion.

Thanks to Jay for the "stxparam.rktl" test.

Closes #1479
2016-10-07 08:58:44 -06:00
Alexis King
d9750064b9 Merge pull request #1472 from lexi-lambda/pkg-git-credentials
Add support for git-backed packages that require authentication
2016-10-06 18:24:24 -07:00
Ben Greenman
97c65102b3 add file/glob
implements globbing for path strings
- glob : globs -> listof path
  in-glob : globs -> sequenceof path
  glob-match? : globs path-string -> boolean
- wildcards are: * ? [...]
- braces {} get expanded to multiple globs
- if pattern ends with /, only match directories
- wildcards don't capture dotfiles by default (keyword arg overrides)
2016-10-06 18:41:26 -04:00
Alexis King
c459886fc5 Add some warnings about checkout credentials being stored unencrypted 2016-10-06 11:48:48 -07:00
Matthew Flatt
9887669ab0 fix single-argument write-byte and write-char
Repairs a mistake in 8e7792d8

Closes PR 15363
2016-10-04 10:09:48 -06:00
Alexis King
6d63e4443f Make raco pkg try git-checkout-credentials when cloning a repository 2016-09-29 14:21:07 -07:00
Ryan Culpepper
c08a2fd57c syntax/parse: add #:and and #:post side-clauses 2016-09-29 17:21:07 -04:00
Alexis King
afa17a3df6 Adjust net/git-checkout to raise exn:fail:git instead of exn:fail
This allows things like the package system to detect when something goes
wrong with the git transfer without catching everything else, too.
2016-09-29 13:59:52 -07:00
Alexis King
8de889df5e Add support for the 'git-checkout-credentials raco config option 2016-09-29 13:58:42 -07:00
Alexis King
d409fb5e2e Add #:username and #:password arguments to net/git-checkout
This can be used to provide authentication for accessing repositories
over HTTP(S), such as private repositories on GitHub.
2016-09-29 13:58:39 -07:00
Matthew Flatt
00644821de fix regexp-matching bug
In a pattern like

 a*b

a naive attempt to match will take quadratic time on an input that
contains all "a"s an no "b". To improve that case, the regexp compiler
detects that a match will require a "b" and checks the input for a "b"
to enable linear-time failure.

That optimization mishandled `(?!...)` and `(?<!...)` patterns,
treating the must-not-match subpatterns as things that must match.
So,

  (regexp-match "a*(?!b)" "aaaxy")

returned false, because the input doesn't contain "b".

Thie commit repairs the optimization.

Closes #1468
2016-09-24 14:46:28 -06:00
Matthew Flatt
c19848f990 fix optimizer bug
Fix a regression relative to v6.4 caused by a refactoring of the
compiler between v6.4 and v6.5. The refactoring lost information about
letrecs that are converted internally to let* when a mutable variable
is involved, and it ends up allocating a closure before the box of a
mutable variable that is referenced by the closure. Something like
`with-continuation-mark` is needed around the closure's `lambda` to
prevent other optimizations from hiding the bug.

Closes #1462
2016-09-15 11:19:13 -06:00
Matthew Flatt
2174f4a029 fix optimizer bug
Closes #1461

Thanks to Gustavo for tracking down the problem.
2016-09-15 07:58:21 -06:00
Matthew Flatt
cfb2a7aa32 in-directory: sort entries
Make `in-directory` more like `directory-list` by sorting
directory content.
2016-09-15 06:11:30 -06:00
John Clements
63d0f79847 add xml-attribute-encode function 2016-09-14 09:34:27 -07:00
Alex Knauth
62f5b2c4e4 syntax/srcloc: disarm and rearm when rebuilding syntax (#1448) 2016-09-12 18:08:57 -04:00
Ryan Culpepper
fd4ce5afe4 add more codes to lookup-errno, relax contract (#1433)
lookup-errno now returns #f when given an unknown symbol instead
of raising a contract error. It should not return #f for any
symbol that it previously accepted.
2016-09-12 18:07:44 -04:00
Alexis King
6e6056b9b8 Propagate srcloc information in wrap-expr/c from syntax/contract (#1418) 2016-09-12 18:06:57 -04:00
Robby Findler
a01cf359eb bring line lengths down below recommended widths 2016-09-08 21:45:50 -05:00
Matthew Flatt
ce6b9d5931 fix chaperone-of? on bytecode-unmashaled hash tables
Closes #1456
2016-09-08 20:23:07 -06:00
Sam Tobin-Hochstadt
94dbcb12dc Make sql-null? a struct predicate. (#1450)
This allows Typed Racket to know that it's pure and safe to use
as an opaque value.
2016-09-07 10:57:10 -04:00
Andrew Kent
42f4784735 add vector-sort to racket/vector (#1398)
* add vector interface to private/sort.rkt
2016-09-06 17:07:20 -04:00
AlexKnauth
95e8ade091 procedure-rename: don't convert procs into methods or methods into procs 2016-09-05 11:30:27 -05:00
Jay McCarthy
5b1658c6b4 Merge pull request #1446 from AlexKnauth/cdot-left-assoc
make cdot reader left associative
2016-09-01 20:40:56 -04:00
Matthew Flatt
cd44e78211 fix dynamic-require on certain forms of re-export from #%kernel
Closes #1445
2016-09-01 09:19:11 -06:00
AlexKnauth
d648c8cc42 make read-cdot group datums from left-to-right
so that X.Y.Z is read as (#%dot (#%dot X Y) Z)
2016-09-01 09:17:29 -04:00
Matthew Flatt
6444d078eb fix validation of known structure mutators
Specifically, fix the case where the structure type for the mutator
includes "auto" fields (with no corresponding constructor argument).
2016-08-29 19:09:37 -06:00
Robby Findler
f878afb82b misc minor improvments to unconstrained-domain->
- add an optimization based on procedure-result-arity
 - make it generate less code
 - fix a few bugs
2016-08-29 12:36:50 -05:00
Robby Findler
56c97474b0 rename a variable to clarify its use 2016-08-29 12:36:49 -05:00
Jay McCarthy
34ad1cec3f Error rather than return weird #%dot 2016-08-29 11:12:15 -04:00
Jay McCarthy
c1242fa52a Fix handling of dots at end, maybe should be an error. Closes PR1439 2016-08-29 08:11:13 -04:00
Vincent St-Amour
00f0311473 setup-plt -> raco setup
Survived unnoticed for 6+ years.
2016-08-24 15:33:07 -05:00
Robby Findler
6983adc31d fix box/c-as-expression
closes PR 15341
2016-08-24 14:30:44 -05:00
Andrew Kent
753d97335c add location info to the match error msg (#1430) 2016-08-24 13:51:23 -04:00
Brian Lachance
07718022b4 Support an empty (values) range in ->i 2016-08-23 14:31:36 -05:00
Ryan Culpepper
471f37158a syntax/parse: allow pattern expanders to produce EH patterns
fixes #1427
2016-08-22 19:47:41 -04:00
Matthew Flatt
a5f0e6dcfc identifier-binding: add mode to report top-level binding info 2016-08-22 08:54:34 -06:00
Matthew Flatt
5f9576cb22 fix space-safety in compiler
The `if` case of the compiler's space-safety pass abused its "last
non-tail call relative to the closest enclosing binding" state as
"last non-tail call relative to the enclosing run time", which could
cause it to not clear a stack position as needed to maintain space
safety.
2016-08-22 06:50:15 -06:00
Gustavo Massaccesi
d4158c2b04 JIT: Allow the jitter to reverse the arguments of string=? 2016-08-19 20:05:37 -03:00
Alex Knauth
42dcc525b1 add lang-reader-module-paths to factor out copy-pasted code (#1347)
* add lang-reader-module-paths to syntax/module-reader

to be used as the third argument to make-meta-reader in lang-extensions
like at-exp

* document lang-reader-module-paths

* use lang-reader-module-paths in at-exp
2016-08-19 07:42:59 -06:00
William J. Bowman
998bfba4c4 skip-installed from all scopes, not current (#1361)
closes issue #1115
2016-08-19 06:56:12 -06:00
Alexis King
0b21818100 Preserve syntax-original?-ness and syntax properties from splicing forms (#1413)
This makes two changes to the forms in racket/splicing to adjust how
syntax properties are propagated through expansion:

  1. Uses of make-syntax-introducer are passed #t as the first argument,
     which causes the introduced scope to be consider a use-site rather
     than macro-introduction scope. This prevents syntax objects from
     being unnecessarily marked as unoriginal, in the syntax-original?
     sense.

  2. Uses of syntax/loc have been adjusted to copy syntax properties
     from original syntax objects, which were previously discared. Forms
     that were spliced into the surrounding context, such as begin,
     define-values, and define-syntaxes, recreated the top-level syntax
     objects, which did not preserve syntax properties from the
     originals.

This is not a perfect solution, mostly because it potentially elides
properties that may be associated with captured literals (that is,
properties attached directly to begin, define-values, or define-syntaxes
identifiers themselves). However, it seems to accommodate most of the
common use-cases: propagation of syntax-original?-ness and forms like
`struct`, which attach properties like 'sub-range-binders.

fixes #1410
2016-08-19 06:33:20 -06:00
Robby Findler
8df0d6bba3 finish (-> void?) optimization 2016-08-18 13:16:15 -05:00
Robby Findler
bd2f889251 minor cleanups 2016-08-18 13:16:14 -05:00
Tim Brown
c9f6f6aa31 Merge branch 'master' into tmp-http-connect-proxy-merge
Fixed conflict with Tony’s head? definition
2016-08-18 14:40:08 +01:00
Matthew Flatt
36548ea289 JIT: recognize unsafe-struct-ref argument sequences
A `struct-copy` form can generates a call for a constructor that
includes a sequence of `unsafe-struct-ref` arguments. Each
`unsafe-struct-ref` must still check for a chaperone. Make the JIT
recognize that pattern an turn it into a single test instead of
one test per `unsafe-struct-ref`.
2016-08-17 18:05:17 -06:00
Alexis King
232c80e340 Record disappeared uses from syntax/parse/experimental/template (#1423) 2016-08-17 17:50:56 -04:00
AlexKnauth
1b1b400f91 add #:newline? argument to pretty-printing functions 2016-08-17 15:44:39 -05:00
AlexKnauth
1af7ec7088 reformat pretty.rkt a bit
#lang instead of module, spaces instead of tabs, other whitespace and
indentation
2016-08-17 15:44:38 -05:00
Jay McCarthy
986ea517d1 Merge pull request #1415 from tonyg/fix_1414_fd_leak_HEAD
Explicitly close the http-conn on http-sendrecv with method HEAD.
2016-08-15 09:18:18 -04:00
Matthew Flatt
ab6f578eca another repair for older MSVC 2016-08-15 06:24:55 -06:00
Tony Garnock-Jones
72db2b7147 Explicitly close the http-conn on http-sendrecv with method HEAD. Fixes #1414. 2016-08-14 18:32:38 -04:00
Matthew Flatt
2c65aa8512 unbreak compile with MSVC 2016-08-14 07:33:27 -06:00
Matthew Flatt
c9da43378f restore SCHEME_INPORT_VAL and SCHEME_OUTPORT_VAL 2016-08-13 14:15:54 -06:00
Matthew Flatt
db95651454 internal support for measuring allocation counts 2016-08-13 14:15:54 -06:00
Matthew Flatt
b0ecafb731 more GC stats on exit 2016-08-13 14:15:54 -06:00
Matthew Flatt
0034c31820 track cumulative allocation
Extend `current-memory-use` to accept a 'cumulative flag.
2016-08-13 14:15:54 -06:00
Jay McCarthy
a0a0e41908 Allow NULL ptr return so we can see error message 2016-08-11 19:31:15 -04:00
Tim Brown
29997da340 Merge branch 'master' into http-connect-proxy 2016-08-10 17:00:11 +01:00
Tim Brown
7fb52529f8 PR#1411 Tests
http-proxy/ contains a suite of almost useful (but mostly useless) servers.

These can be used to test http-client, and url.rkt

git proxy is not tested yet --  I really wouldn’t know how
2016-08-10 16:08:16 +01:00
Robby Findler
d22a771c98 avoid dropping provide/contract-original-contract property 2016-08-09 16:25:54 -05:00
Tim Brown
08c1865461 PR#1411 Implementation for jeapsotrophe's comments
See github commentary for rationale behind changes

Also documentation for `tcp-or-tunnel-connect`
2016-08-09 15:37:29 +01:00
Tim Brown
321000b831 https and git proxying via HTTP CONNECT
This patch adds https and git proxying through HTTP’s `CONNECT` method.

**Sanity Checks Needed:**
1. Is the git protocol proxying necessary?
   It might be overkill, and I haven’t overly tested it since `raco pkg
   install` uses https as its transport anyway
2. If anyone is better clued up on HTTP `CONNECT` best practice, then
   please check the headers that I pass (in `http-client.rkt`)
3. Is HTTP `CONNECT` the only/best way to proxy HTTPS? It is what *curl*
   uses (which might be a good indicator)
4. Will the ports be closed properly? (does anyone see a fid leak?)
  - how do I test for that? Open (and allegedly close) 1024 tunnels?
5. The `abandon-p` definitions in `http-conn-CONNECT-tunnel` could
   probably be reduced, but they’re defined as they are to allow me to
   put debugging hooks in
6. No tests or documentation yet
7. I edited this with *vim*, and therefore the indentation is a la vim.
   I looked at doing a global reindent (of git-checkout) and so much
   changed that I abandoned that as an idea. It indentation is too
   “off-style” then feel free to change it :-)

**git-checkout.rkt:**
- `initial-connect` now tries to use a git proxy (see `url.rkt`, below)
  when *transport*=`git`
- (if *transport*=`https`, then `url.rkt`’s standard proxying will be
  used)

**http-client.rkt:**
- `http-conn-open!` can now be passed a
  `(list/c base-ssl?/c input-port? output-port? (-> port? void?))` to
  describe:
  - maybe a negotiated ssl context
  - two tunnel (or other arbitrary) ports to use instead of newly
    `...-connect`ed ports
  - an abandon function for those ports
- `http-conn-send!` has a function `print-to` which curries
  `(fprintf to)`, but allows a hook for an `eprintf` for debugging
- **added `http-conn-CONNECT-tunnel`:** this opens an new `http-conn`
  and arranges for CONNECT tunneling to `target-host` and `target-port`
- factored contracts into `base-ssl?/c` and `base-ssl?-tnl/c`
- added contract for `http-conn-CONNECT-tunnel`

**url.rkt:**
- `proxiable-url-schemes`: now includes `https` and `git`
- `env->c-p-s-entries`: the environment variable “parser” now takes a
  rest-list of lists of environment variables, and the scheme that these
  variables proxy is garnered from the variables’ names. As before
  there are:
  - `plt_http_proxy` and `http_proxy`
  - `plt_https_proxy` and `https_proxy`
  - `plt_git_proxy` and `git_proxy`
  during the previous iteration of obtaining the proxy variables at
  startup, we discussed the appropriate naming conventions for these
  variables. This doesn’t seem to deviate from that
- `env->c-p-s-entries`: having a proxy url that isn’t strictly:
  `http://hostname:portno` (e.g.  having a training slash) generates a
  log warning, not an error. It was beginning to bug me
- `proxy-servers-guard`: accepts any one of the `proxiable-url-schemes`
  (not just `http`)
- no proxy is agnostic to the URL scheme
- `proxy-tunneled?`: returns false for `http`, which is proxied using an
  HTTP proxy. Returns true for other URL schemes -- which go through a
  tunnel
- **`make-ports`:** tests whether a tunnel proxy is necessary. If so, it
  creates a tunnel and plumbs the connections
- elsewhere, anywhere that tests for proxy, now tests for
  `(and proxy (not proxy-tunneled? url))`, because tunneled HTTPS
  connections are direct (once they’re through the tunnel, IYSWIM)
2016-08-09 12:50:17 +01:00
Matthew Flatt
bf53f02bb1 fix problem with the mandatory-keywords change
Repairs a problem with 7bcc9afd4c as exposed by the contract test
suite.
2016-08-08 07:45:35 -06:00
Matthew Flatt
ad230d2ca0 improve structure-type property handling
Make the optimizer recognize and track `make-struct-property-type`
values, and use that information to recognize `make-struct-type`
calls that will defnitely succeed because a property that hs no
guard is given a value in the list of properties.

Combined with the change to require-keyword expansion, this
change allows the optimizer to inline `f` in

 (define (g y)
   (f #:x y))

 (define (f #:x x)
   (list x))

because the `make-struct-type` that appears between `g` and `f`
is determined to have no side-effect that would prevent `f` from
having its expected value.
2016-08-07 15:59:02 -06:00
Matthew Flatt
7bcc9afd4c adjust required-keyword expansion to improve optimization
Make the definition of a function with a required keyword expand in a
way that allows the optimizer to recognize it as a form that has no
errors or externally visible side effects.

The old expansion of

 (define (f #:x x) ...)

included

 (define lifted-constructor (make-required ....))
 (define f (lifted-constructor (lambda ....) ....))

where `make-required` calls `make-struct-type` and returns just the
constructor.

The new expansion instead has

 (define-values (_ lifted-constructor _ _ _)
   (make-struct-type ....))
 (define f (lifted-constructor (lambda ....) ....))

In other words, `make-required` is inlined by macro expansion,
so that the optimizer will be able to see it and eventually
conclude that no side effects have taken place.
2016-08-07 14:25:27 -06:00
Matthew Flatt
62b8f7aaa3 fix syntax-local-lift-values-expression
When lifts are captured as `let`, make sure the variable
bindings aren't reversed.
2016-08-07 14:22:35 -06:00
Matthew Flatt
a229640251 Update "foreign.rktc" for --enable-ffipoll
This is an adjustment for 96d212d376, since "foreign.rktc" is the
source for "foreign.c".
2016-08-04 20:53:45 -06:00
Matthew Flatt
3769d82b74 fix allocation
Repairs a mistake in 95f6a2342b.
2016-08-04 20:18:34 -06:00
Matthew Flatt
b1e406b5a7 fix redundant-require checking
When a module defines and exports an identifier at two phases,
and when another module imports both of them at the same phase,
an error was not reported as it should have been.
2016-08-04 20:18:34 -06:00
Jay McCarthy
96d212d376 Adding FFI polling mode
With this option, FFI calls always block until scheme_check_foreign_work
is called by the program embedding Racket.

This is needed for embedding Racket into contexts where you do not
control the event loop, need Racket to make FFI calls, and those FFI
calls must occur on a thread within the event loop. A good example of
this is with OpenGL FFI calls that require the current thread to hold
the OpenGL/EGL context.

An important point about this is that scheme_check_foreign_work will
only execute a single FFI call. So if this is used for OpenGL rendering,
you'll want to run it a lot.
2016-08-04 13:47:08 -04:00
Vincent St-Amour
4716a6eb00 Fix set-symmetric-difference when passed the same set multiple times.
Closes #1403.
2016-08-03 13:02:14 -05:00
Rohin Shah
b3b16b36a1 Fix bug in #:defined-table implementation, add test for #:defined-table 2016-08-01 15:23:31 -05:00
Ryan Culpepper
31fdac8773 syntax/parse: use pattern for default min repc error
see #1393

Also fix first-desc:* to only use constant descriptions.
2016-08-01 10:47:39 -04:00
Ryan Culpepper
9bf30e0977 syntax/parse: nullability analysis improvement
An S-pattern used as an H-pattern is not nullable.
2016-08-01 10:47:39 -04:00
Ryan Culpepper
2e96b60120 syntax/parse: fix internal debugging code (delete iattrs field) 2016-08-01 10:47:39 -04:00
Ryan Culpepper
f968b87385 syntax/parse: remove unused field from pat:pair, pk/pair 2016-08-01 10:47:38 -04:00
Ryan Culpepper
d6a3a22989 syntax/parse: propagate description-if-constant to annotated pvars
fixes #1392
2016-08-01 10:47:38 -04:00
Ryan Culpepper
71fbe4ad7d syntax/parse: remove unused field from rhs struct 2016-08-01 10:47:38 -04:00
Ryan Culpepper
22b5d6b2da syntax/parse: add description-if-constant field to stxclass
Also remove (inline) options, integrate structs and improve comments.
2016-08-01 10:47:38 -04:00
Ryan Culpepper
3a7bf955c0 remove useless requires 2016-08-01 10:47:38 -04:00
Ryan Culpepper
ce1bf2503d syntax/parse: combine away pattern-expander*.rkt modules 2016-08-01 10:47:38 -04:00
Ryan Culpepper
6fe55ec307 syntax/parse: trim txlifts helper module 2016-08-01 10:47:38 -04:00
Ryan Culpepper
0a7d97df86 syntax/parse: fix dependencies, add deps test
Removes residual dep on racket/contract (again!)
Removes use of racket/struct (which depends on contract)
List other residual dependencies in sc.rkt
2016-08-01 10:47:38 -04:00
Gustavo Massaccesi
bfa269982f optimizer: don't move APPN_FLAG_OMITTABLE inside lambdas
Some expressions are omittable only when the arguments have certain types.
In this case the application is marked with APPN_FLAG_OMITTABLE instead of relaying on the flags of the primitive.

The optimizer can't use this flag to move the expression inside a lamba or across a potential continuation capture, unlike other omittable expressions. They can be moved
only in more restricted conditions.

For example, in this program

  #lang racket/base

  (define n 10000)
  (define m 10000)
  (time
   (define xs (build-list n (lambda (x) 0)))
   (length xs)
   (define ws (list->vector xs)) ; <-- omittable
   (for ([i (in-range m)])
     (vector-ref ws 0)))     ; <-- ws is used once

If the optimizer moves the expression in the definition of ws inside the recursive
lambda that is created by the for, then the code is equivalent to:

  #lang racket/base

  (define n 10000)
  (define m 10000)
  (time
   (define xs (build-list n (lambda (x) 0)))
   (length xs)
   (for ([i (in-range m)])
     (vector-ref (list->vector xs) 0)))     ; <-- moved here

And the new code is O(n*m) instead of O(n+m). This example is a minimized version
of the function kde from the plot package, where n=m and the bug changed the run
time from linear to quadratic.
2016-07-31 08:58:54 -03:00