Commit Graph

3080 Commits

Author SHA1 Message Date
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
Gustavo Massaccesi
004fd02501 optimizer: don't mark (-) as omittable
The application of some procedures are omittables when the arguments have
certain properties. Check the arity of the procedure before marking the application as omittable.
The only case that appears to be relevant is the expression (-).
2016-07-31 08:54:54 -03:00
Gustavo Massaccesi
8bb79deaa2 extend reductions for eq? to expressions with eqv? and equal?
The relevant predicates are almost disjoint. The superposition
is solved with predicate_implies and predicate_implies_not.

This is also valid considering the equivalence classes modulo
eqv? and equal?. So if the optimizer knows that two expressions
X and Y have different relevant types, then it can reduce
(equal? X Y) ==> (begin X Y #f).
2016-07-31 08:50:43 -03:00
Leif Andersen
99b35a5d08 gracket should use gui-interactive.rkt
Previously it used interactive.rkt, which is problematic when the user
wants to have a different file for interactive.rkt and gui-interactive.rkt
2016-07-30 13:45:11 -04:00
Leif Andersen
4c61013ef2 Default repl should remain using ">" for prompt
Although xrepl uses ->, the default prompt should be `>`, to
maintain compatability with old shell scripts.
2016-07-29 23:17:26 -04:00
Alexis King
169472487e Wrap various syntax/parse forms in with-disappeared-uses (#1397)
fixes #1396
2016-07-29 13:11:49 -04:00
Ben Greenman
ba8b848f94 Accept path-string in syntax/modcode
Changes signatures in `syntax/modcode` to accept `path-string?` arguments
 instead of `path?`.
Before, the docs listed `path-string?` but the contracts used `path?`.
Now they agree.
2016-07-29 12:26:10 -04:00
Matthew Flatt
6e4a4f4949 validator: thread structure-type info all the way through
The optimizer now makes more choices based on imported structure-type
info that thet validator needs to reconstruct, so pass that
information all the way through.
2016-07-29 09:45:11 -06:00
Matthew Flatt
3f4e7d90cb improve compiler recognition of stuct constrcutors
Allow a `struct` form to be recognized when it provides
a number as the 8th argument to `make-struct-type`. In
particular, that change allows the construction of
optional-keyword functions to be recognized as a
purely functional operation.

Also, allow the optimizer to use information about imports
when deciding whether a module-level form is functional.
It's ok to use that information, because the validator has
it, too.

This combination of changes allows something like

 (define (f #:optional [x #f])
   (later))

 (define (later) ....)

to compile to a reference to `later` wihout a check.
2016-07-28 08:23:51 -06:00
Matthew Flatt
0d0cf535de compiler: fix copy propagation in letrec-check pass
Fixing dead-code cleanup in the letrec-check pass exposed
a bug in a part of the letrec check interpretation that is
analogous to copy propagation. The copy's representation
now refers to the original variable, instead of copying
the current set of deferrals (which is wrong if the original
is a `letrec`-bound variable that hasn't yet accumulated
its closures).
2016-07-28 08:23:50 -06:00
Matthew Flatt
cc9889d7ab fix setup for the letrec-check pass
Due to an obvious problem in the setup, the letrec-check pass wasn't
running an intended dead-code pruning pass. Correcting the problem
cuases one test in "optimize.rktl" to change, because the letrec-check
pass can see more in one case than thanother.

(Problem discovered by accidentally fixing the setup in a Racket
branch based on "linklets".)
2016-07-28 08:22:10 -06:00
Matthew Flatt
0198847980 wrap scheme/interactive load with error boilerplate 2016-07-26 10:55:43 -06:00
Matthew Flatt
453684b694 don't use isspace() on a signed character 2016-07-26 10:53:05 -06:00
Matthew Flatt
b9a9fdaa3f check for "config.rktd" before trying to read it for interactive 2016-07-26 10:47:19 -06:00
Matthew Flatt
fc345ed249 add use-compiled-file-check
Along with the `PLT_COMPILED_FILE_CHECK` environment variable, allows
the timestamp check to be disabled when deciding whether to use a
compiled bytecode file.

In accomodating this change, `raco make` and `raco setup` in all modes
check whether the SHA1 hash of a module source matches the one
recorded in its ".dep" file, even if the timestamp on the bytecode
file is newer. (If the compile-file check mode is 'exists, the
timestamp is completely ignored.)
2016-07-26 10:27:08 -06:00
Leif Andersen
e0e2708f4e Attempt to youse scheme_make_integer in dynamic_require 2016-07-26 10:14:38 -04:00
Leif Andersen
a6b7af9733 Made changes based on Matthew's comments.
1. Changed the API documentation for scheme_make_hash_tree, adding primitives for:

* SCHEME_hashtr_eq
* SCHEME_hashtr_equal
* SCHEME_hashtr_eqv

2. Changed direct uses of scheme_make_hash_tree to use these enumed values.

3. Fixed bugs in documentation

4. Defaults to racket/interactive (and racket/gui/interactive) if there is nothing in the config file
2016-07-26 10:14:38 -04:00
Leif Andersen
d0f9e4ba81 gr_config_init macro should not exist any more 2016-07-26 10:14:38 -04:00
Leif Andersen
8588c43709 Oops, file checking should be on filename. 2016-07-26 10:14:38 -04:00
Leif Andersen
b0f266fad1 Moved xrepl to be part of bootloader directly. 2016-07-26 10:14:38 -04:00
Leif Andersen
314485edfb Start up xrepl when repl is loaded. 2016-07-26 10:14:38 -04:00
Leif Andersen
bd1ceb21d6 Add racketrc file to the etc/ folder. 2016-07-26 10:14:38 -04:00
Tony Garnock-Jones
1ba42bb70d Skip whitespace more liberally when parsing PLTSTDERR and friends.
Now accepts any whitespace, not just spaces, ignores both leading and
trailing whitespace, and accepts multiple whitespace characters
separating subterms.
2016-07-25 19:17:35 -04:00
Stephen Chang
99dd403ef6 fix another renaming provide src loc 2016-07-21 16:53:00 -04:00
Matthew Flatt
64a1209bb5 remove the other(!) debugging printf 2016-07-20 22:41:00 +02:00
Matthew Flatt
8f4250ca45 remove debugging printf
Consider merge to v6.6 with 7318b1fd34
2016-07-20 11:32:57 +02:00
Matthew Flatt
7318b1fd34 fix equal? for futures
Closes PR 15331

Consider merge to v6.6
2016-07-20 09:28:18 +02:00
Matthew Flatt
e2dd92c9c1 add v6.6 to Racket "HISTORY.txt"
Merge to v6.6
2016-07-20 09:28:18 +02:00
Leif Andersen
6c0dfa7053 Trying to use xrepl no longer swallos all errors. 2016-07-19 16:36:04 -04:00
Leif Andersen
b1adf65fd0 Make xrepl the default repl if it is installed 2016-07-19 16:36:04 -04:00
Stephen Chang
046f3eef37 fix src loc for renaming provide 2016-07-19 15:53:13 -04:00
Jonathan Schuster
562f5f01f6 Fix bugs in type errors for data/queue 2016-07-19 13:51:38 -05:00
William J. Bowman
5a9241076e Fixed location of traced procedures. Closes #1300 2016-07-19 12:24:26 -05:00
Gustavo Massaccesi
e5e781c4ec optimizer: add more type annotations for procedures related with list?
After refactoring the test for the inferred types of some procedures that
use vector?/bytes?/string?/list? it was easier to spot the missing information.

Note that in the documentation, some arguments like the position in
  (vector-ref <vector> <position>)
are documented as exact-nonnegative-integer? but due to the implementation
details they are actually in a subset of fixnum?s.
2016-07-17 14:04:24 -03:00
Matthew Flatt
ca6c67be68 fix unsafe-immutable-hash-... on hash table from read
When `read` parses a literal hash table, it inserts an placeholder
just in case it's needed for cycles. The `unsafe-immutable-hash-...`
operations in some cases did not detect and remove the placeholder.

Closes #1376

Merge to v6.6
2016-07-15 06:23:20 -06:00
Matthew Flatt
d1c2daf15b make variable-reference->namespace enable top-level mode
The namespace returned by `variable-reference->namespace` (or
`namespace-anchor->namespace`) may be used via `eval` to define new
bindings, so enable top-level binding support for the namespace.
2016-07-14 15:10:05 -06:00
Matthew Flatt
521ff7cc67 fix broken GC-traversal registration
Bug was part of 95f6a2342b
2016-07-14 06:58:59 -06:00
Matthew Flatt
9c94e5a8df optimizer: propagate info for super struct from requires
Allows a struct declaration to be recognized when it inherits
from an imported struct.
2016-07-13 13:53:07 -06:00
Matthew Flatt
95f6a2342b optimizer: connect struct predicates and accessors
for example, make the optimizer convert something like

 (struct a (x))
 (lambda (v) (if (a? v) (a-x v) #f))

to

 (struct a (x))
 (lambda (v) (if (a? v) (unsafe-struct-ref v 0) #f))
2016-07-13 13:53:07 -06:00
Matthew Flatt
591fcb6228 optimizer: recognize more struct declarations
The optimizer change in e887fa56d1 recognized struct declarations that
involved only whitelisted properties to guarantee that constructor
properties are preserved --- while `prop:chaperone-unsafe-undefined`
can affect the constructor, and other properties might imply that one.
But the optimizer's transformer aren't actually invalidated by
`prop:chaperone-unsafe-undefined`; the JIT's assumptions are affected,
but that's handled in a different way. So, remove the whitelist and
allow any property list.
2016-07-13 13:53:07 -06:00
Benjamin Greenman
3afa58e8d1 edit: make object/c-helpers private (#1374)
Fixes the TR "undocumented public identifiers" DrDr error
2016-07-12 16:16:42 -04:00
Matthew Flatt
e76df3bb00 adjust otimizer to keep the validator in sync
Sacrifice a tiny bit of information in the optimizer as of dce42313ad
to avoid confusing the valdiator.

See also discussion for #1365
2016-07-11 18:36:20 -06:00
Matthew Flatt
671adc0de2 tweaks to hashing
Faster hasing of booleans, correct potential loss of distinction
for a compound structure that ends in a symbol or keyword, and
shortcuiting lookup in an empty immutable hash table.
2016-07-11 15:42:50 -06:00
Ryan Culpepper
52bfb32cd3 syntax/parse: only check for empty match on unbounded EH patterns
This change permits EH patterns like (~once <nullable>), because the
match will happen at most once, so there is no danger of divergence.
Thanks to Alex Knauth for pointing out this special case.

Merge to release branch.
2016-07-11 13:04:07 -04:00
Gustavo Massaccesi
397d604182 optimizer: add types for something->immutable-something 2016-07-09 02:16:54 -03:00
Gustavo Massaccesi
f8b3ba8253 optimizer: reduce ignored ifs
The optimizer tries to reduce the `if` assuming that the result will be used.
In case it later detects that the result will be ignored, it can try to
apply some additional reductions to the branches and to the whole expression.
2016-07-09 02:16:40 -03:00
Jay McCarthy
9a5aa89fb5 Switch from deprecated Posix function removed in Android's LB64 ABI 2016-07-08 20:54:09 -04:00
Gustavo Massaccesi
dce42313ad optimizer: add string? to list of relevant predicates
Also add the type information for a few related functions like
string-append and bytes-append.
2016-07-08 21:07:22 -03:00
Robby Findler
9cf9897b16 raise a syntax error uses of keywords in case-> 2016-07-08 15:36:44 -05:00
Sam Tobin-Hochstadt
8d698389e7 Add a way to recognize cpointer predicates. (#1368)
Similar to `struct-predicate-procedure?`. Allows Typed Racket
(and the contract system generally) to avoid chaperone wrapping
for cpointer predicates.
2016-07-08 12:40:03 -04:00
Ben Greenman
4650a12350 export object/c-stronger helper functions
So that Typed Racket can use them to implement object/c-opaque
2016-07-08 12:06:29 -04:00
Matthew Flatt
b0c55b7394 OpenSSL v1.1 support
The SSL_library_init() function has been removed. (There's a new
SSL_init_ssl() function, but calling it is optional.) The
SSL_load_error_strings() function is similarly gone.

The SSLv23_client_method() and SSLv23_server_method() functions
are also gone. The new TLS_client_method() and TLS_server_method()
functions are better names for what SSLv23_client_method() and
SSLv23_server_method() evolved to do.

Finally, the dance for server-triggered renogotiation needs to
change, since the old dance involved manipulating the structure
directly.

Merge to v6.6
2016-07-08 09:28:49 -06:00
Matthew Flatt
42be8aadff fix collision handling for eq?-based immutable hash with #ts
When creating a collision node, make sure the "has a value" bit
is set, since the "has a hash code" bit should imply it.

This bug was made easier to trigger by 3fbb384604, but it was
potentially a problem for scope sets before.

Closes #1366

Merge to v6.6
2016-07-08 07:29:14 -06:00
Matthew Flatt
fd85bcaf21 fix printing of eq[v]?-based hash tables
Merge to v6.6
2016-07-08 07:29:07 -06:00
Vincent St-Amour
e10c57623c Post-release version for the v6.6 release 2016-07-07 15:39:47 -05:00
Sam Tobin-Hochstadt
8377fa842f Improve compilation of hash table patterns with literal keys. 2016-07-04 18:39:43 -04:00
Matthew Flatt
c5868e9ab1 fix JIT-inlined immutable? for chaperones 2016-07-01 19:18:35 -06:00
Matthew Flatt
1f00509705 JIT-inline immutable? 2016-07-01 13:30:50 -06:00
Matthew Flatt
e92b07728f repair for define-cpointer-type 2016-07-01 13:30:50 -06:00
Matthew Flatt
f16f54a1b1 fix mismatch in future primitives when futures are disabled
Closes #1356
2016-07-01 08:50:15 -06:00
Matthew Flatt
0f12c8e0dc fix compiler warning for the no-threads build 2016-07-01 08:50:15 -06:00
Matthew Flatt
3fbb384604 add hash-keys-subset?
This function exposes the fast subset operation that is built in for
immutable hash tables (and used by the set-of-scopes implementation).

Also, make the space optimization implicit for `eq?`-based hash tables
that contain only #t values (instead of explicit and only available
internally). It turns out to be easy and efficient to make the
representation automatic, because the HAMT implementation can support
a mixture of nodes with some containing explicit values and some
containing implicit #t values.
2016-06-30 08:22:18 -06:00
Matthew Flatt
8ae013cdb1 unbreak --enable-sgcdebug 2016-06-30 07:47:54 -06:00
Matthew Flatt
2662850ca1 restore lost Tsint8 2016-06-30 07:47:54 -06:00
Alexis King
e86fa9f055 Improve with-disappeared-uses and add record-disappeared-use
Now with-disappeared-uses surrounds its body with let, so it can contain
multiple body expressions. The record-disappeared-use function is like
record-disappeared-uses but for a single identifier.
2016-06-29 12:50:14 -05:00
Alexis King
517c3cfef9 Track disappeared uses of match expanders within match forms (#1349) 2016-06-27 14:13:12 -04:00
Matthew Flatt
b9445023c1 simpler #%linklet bootstrap hook 2016-06-26 07:23:36 -06:00
Matthew Flatt
4a1afa66c8 add partial #%linklet primitive module
The `#%linklet` module is intended to eventually provide
a simplified compiler for the core Racket language. For
now, it provides minimal hooks for bootstrapping an
expander implementation.
2016-06-22 14:19:24 -06:00
Gustavo Massaccesi
9978696991 Fix confusing indentation 2016-06-22 09:25:55 -03:00
Matthew Flatt
871392f09a add inspector-superior? 2016-06-17 10:23:47 -06:00
Matthew Flatt
e887fa56d1 optimizer: allow some properties in recognized struct declarations
When the properties argument for `make-struct-type` is non-empty,
then we cant; guarantee that `make-struct-type` succeeds, but
if it does, then we can still know that the result is a structure
type and (as long as `prop:chaperone-unsafe-undefined` is not
involved) the properties don't affect the constructor, predicate,
selector, or mutators.
2016-06-15 17:38:34 -07:00
Matthew Flatt
ed3e5d3e7d different eq? hash code for symbol, unreadable symbol, and key
The `eq?` hash code of a symbol, unreadable symbol, or keyword depends
only on the character content, but all in exactly the same way, so
that the same string would produce the same hash code for all. That's
not a big deal for hashing, but it doesn't seem like a good idea, and
it can be confusing.
2016-06-15 17:15:11 -07:00
Ryan Culpepper
2eb806d20c syntax/parse: fix progress ordering 2016-06-15 18:12:56 -04:00
Matthew Flatt
c71f33f9f8 fix mcons handling by built-in printer in expression mode 2016-06-11 06:53:31 -06:00
Matthew Flatt
b6e252c1e3 fix phase shifting in dynamic-require
Closes #1339
2016-06-11 06:34:52 -06:00
Matthew Flatt
cc717f1183 raco make -j: avoid changing the current directory
Make `raco make -j` consistent with `raco make` --- while `raco setup`
continues to set the current directory during compilation.
2016-06-10 04:34:52 -06:00
Matthew Flatt
b1be0a452e more clean-up of references to pre-defined modules 2016-06-10 04:34:52 -06:00
Vincent St-Amour
5489fb937e Move helper to a common file.
To avoid ->i depend on ->.
2016-06-08 14:43:58 -05:00
Matthew Flatt
416c9ecec0 fix GC dump printing for 64-bit Windows 2016-06-06 06:25:26 -07:00
Matthew Flatt
c1c427a281 move '#%utils implementation into "collects/racket/private".
For now, this copies the code of "startup.rktl". The intent is that
"startup.rktl" will go away with a new bootstrap process.
2016-05-27 06:23:40 -06:00
Matthew Flatt
94c636fe2b remove unneeded #%utils reference 2016-05-26 17:08:10 -06:00
Matthew Flatt
e4020cb591 fix typo 2016-05-26 17:08:10 -06:00
Leif Andersen
cb9d08d2ee Forgot to update the contract on resolve-module-path 2016-05-25 16:34:33 -04:00
Leif Andersen
c3313b13dc Make relative directory argument for resolve-module-path-* have a default to #f
The resolve-module-path-* functions effectively already had a default argument,
which is #f, this allows you to just directly call it with one argument.
2016-05-23 20:48:59 -04:00
Jay McCarthy
5e43c190be Fix issue 1329 2016-05-23 20:32:37 -04:00
Vincent St-Amour
a1ca38f30e Move some contract helpers. 2016-05-20 14:24:59 -05:00
Vincent St-Amour
26663bb2d7 Have opt/c and ->i put on impersonator-prop:blame.
To be consistent with other combinators.
2016-05-20 14:24:56 -05:00
Vincent St-Amour
d86c69fc21 Fix arity error message. 2016-05-20 14:24:52 -05:00
migeed-z
8d082a47c6 Typo; hypen -> hyphen 2016-05-20 14:21:31 -05:00
Robby Findler
d0d85b2f31 fix source locations for listof applications
and any other contract that is defined via
define/subexpression-pos-prop
2016-05-18 19:32:41 -05:00
Matthew Flatt
c0fa2eecd5 add module-compiled-indirect-exports and co.
That information is needed sometimes to compile expanded syntax to
bytecode form.
2016-05-18 13:13:15 -06:00
Matthew Flatt
f1bba3c2d0 another fix to serializer for cycles containing immutable
When walking up the cycle chain to find the mutable item,
intermediate items need to be marked as potentially
shared, and a mutable item should not be added more
than once.
2016-05-16 19:12:10 -06:00
Matthew Flatt
6ba3461738 fix serializer for cycles containing immutable structs 2016-05-16 18:06:18 -06:00
Ryan Culpepper
add08c902d syntax/parse: record nullability in ehpat
Non-nullable ellipsis-head patterns can omit the null match check.
2016-05-16 17:47:45 -04:00
Ryan Culpepper
3da626d483 syntax/parse: add nullability analysis and check ellipsis-head patterns
Currently logs a warning and continues, but eventually this should be a
compile-time error.
2016-05-16 17:13:57 -04:00
Ryan Culpepper
fb5c1310d8 syntax/parse: add dynamic check for null ellipsis-head match
Otherwise, nullable ellipsis-head patterns could cause infinite loop.
2016-05-16 17:13:57 -04:00
Ryan Culpepper
669460da34 syntax/parse: parse side clauses directly as action patterns
Eliminates the clause:* structures.
2016-05-16 17:13:57 -04:00
Matthew Flatt
f327a44080 fix begin-for-syntax under splicing-let
This fixes an immediate problem, but the macro expander should have
complained about an unbound `maybe` at phase 2. (A new implementation
of the macro expander detected the unbound `maybe`.)
2016-05-16 13:07:44 -06:00
Ryan Culpepper
c9074c26dc syntax/parse: fix ellipsis "optimization" for null tail pattern
The transformation also has the effect of making ellipsis patterns
with nullable heads, such as ((~seq x:sc ...) ...), terminate
rather than looping forever.

To do: add null eh match check and error.
2016-05-16 10:35:20 -04:00
Matthew Flatt
2109b26c15 repair for hash-table adjustment
Fix 49fd1e41da for some compilers.
2016-05-15 21:06:23 -06:00
Matthew Flatt
a134d0c0a3 racket/serialize: support keywords and regexp values 2016-05-15 20:03:15 -06:00
Matthew Flatt
b243ce894a GC: give main allocation pages back to the GC less eagerly 2016-05-15 17:44:58 -06:00
Matthew Flatt
7fbe6a4097 GC: avoid trying to prime a full page cache 2016-05-15 17:44:58 -06:00
Matthew Flatt
49fd1e41da improve immutable hash table on sequential inserts
Inserting keys with sequential hash codes --- as in 0, 1, 2, 3, etc.
--- performed badly compared to random keys, because it triggered the
worst case of allocation: allocate a node of size 1, then 2, then 3,
then 32, then 32 plus a subtree of size 1, then 32 plus a subtree of
size 2, and so on. By rearranging the bits in a hash code, arrange
for nodes that are more like 4-wide instead of 32-wide. In other
words, the tree become wider with thinner branches, instead of growning
just as a thick branch to the left.

Of course, there's now a different sequence of inserts that used
to perform well and now perform badly (the inverse of the new
reordering), but that case seems much more likely than the cae
of sequential inserts.
2016-05-15 17:44:58 -06:00
Ryan Culpepper
80364d85dd syntax/parse: add progress-ordering to ~and
In (~and p1 p2), a failure in p2 now always dominates a failure in p1.
Consequently, if a pattern succeeds, its failures don't matter.

Add {pat,hpat,action}:ord wrappers, ord prframes. Apply ordering to
main pattern and side clauses. Add better progress analysis to
eliminate order wrapping.
2016-05-13 14:40:16 -04:00
Ryan Culpepper
158f087d8e syntax/parse: remove attrs from pattern structs, desugar hpat:optional 2016-05-13 14:40:16 -04:00
Ryan Culpepper
91a03eecb3 syntax/parse: add separate pattern for simple vars 2016-05-13 14:40:16 -04:00
Matthew Flatt
678369f187 avoid generating shared call code for too many arguments
Although the JIT would not try to use a block of shared code for more
than a certain number of arguments, it could in rare cases (related to
self tail calls, for example) generate the code and attempt to install
it in the array of shared-code pointers.
2016-05-13 11:56:48 -06:00
Matthew Flatt
1149d6cdcd ffi/unsafe: add checking of _array values
When an array value is provided, make sure that it's an array
with at least the expected length (or longer) and same element
layout. That's weaker than checking that the array elements have
the right type, because an `eq?` check at the ctype layer seems
too strong, and the ctype API doesn't provide enough information
for a more flexible equality.
2016-05-10 10:56:32 -06:00
Matthew Flatt
d92be80f77 unbreak line-based flushing
Repairs a problem introduced by 8e7792d85a.
2016-05-09 12:49:06 -06:00
Matthew Flatt
8e7792d85a reduce overhead for simple port char/byte reads/writes
Cut the overhead by 30% or so by making the fast path need less
cooperation with the GC.
2016-05-09 09:11:47 -06:00
Matthew Flatt
6c9a4cb470 avoid a compiler warning 2016-05-05 15:19:47 -06:00
John Clements
7c26614343 make match exception transparent
This push makes the exn:misc:match exception transparent. This
matches other racket-raised user exceptions.

The motivation for this change was breakage in the handin-server;
specifically, the discussion in

https://groups.google.com/forum/#!topic/racket-users/nEos3-osoWE

...in which the handin-server was not behaving the same on exn:misc:match
because it was not transparent. This caused the handin server to
refuse to rewrite these exceptions, resulting in less helpful
messages for users.
2016-05-04 14:19:04 -07:00
Ryan Culpepper
9d3c193bcf syntax/parse: fix ~datum pattern with compound datum 2016-05-03 05:07:29 -04:00
Ryan Culpepper
430e6e9567 syntax/parse: different fix for deterministic compilation
The previous fix (1acaf011) caused a performance regression
(compilation time?), reported by stchang. Reverting to quote.

Apparently, the problem with gensym and deterministic compilation
isn't the uninterned-ness; it's the global counter used for the
name. So use a compilation-local counter instead.
2016-05-03 04:38:26 -04:00
Ryan Culpepper
c8f3536694 Revert "syntax/parse: fix for deterministic compilation"
This reverts commit 1acaf0111d.
2016-05-03 03:11:08 -04:00
Asumu Takikawa
25c9e9347a Fix nested quasisyntax infinite looping
Thanks to Michael Ballantyne for the bug report
2016-05-02 15:15:47 -04:00
Matthias Felleisen
fdcbe249f9 re-organized in preparation for additions 2016-05-01 09:47:39 -04:00
Matthew Flatt
76418e9be8 path->module-path: make sure result is always a module path
Avoid creating a result that is intended as a module path but
has elements that are not syntactically allowed, such as a "."
in a collection-path element.
2016-05-01 07:00:36 -06:00
Robby Findler
bb03281308 add flat-contract-with-explanation
closes #1314
2016-04-30 21:04:08 -05:00
Robby Findler
45acc19f44 improve source location in internal-definition errors for syntax-case,
syntax-case*, and datum-case
2016-04-26 16:09:30 -05:00
Matthew Flatt
fb88abd992 fix accidentally committed debugging mode 2016-04-26 14:32:08 -06:00
Matthew Flatt
528b14025f fix syntax-local-lift-module-end-declaration in higher phases
A phase shift was mising on `begin-for-syntax`es introduced by
`syntax-local-lift-module-end-declaration`, which is in turn
used to implement` module+`, so `module+` didn't work under
two or more `begin-for-syntaxes`.

Closes #1312
2016-04-26 10:45:56 -06:00
Matthew Flatt
99b3ed55be make syntax objects work as preserved syntax properties
Syntax objects generally make sense as properties in other syntax
objects, but they require special care when marshaling to bytecode
(as syntax objects do in general). To make that special handling
possible and reliable, constrain the shape of allowed values.
2016-04-26 10:18:46 -06:00
Vincent St-Amour
5cc030e2ad Avoid redundant checking. 2016-04-25 15:41:27 -05:00
Vincent St-Amour
264a11f899 Add procedure-impersonator*?.
Mostly useful to determine whether using `unsafe-chaperone-procedure` is ok.
2016-04-25 15:41:19 -05:00
Matthew Flatt
35ab9ffdb8 rename relectly added path-extension to path-get-extension
The name `path-extension` created a conflict for an existing
registered package, so it should not have been added to
`racket/path`.

Also, `path-get-extension` was intended to work on a path
that is syntactically a directory, so fix and test that.
2016-04-24 20:30:51 -06:00
Matthew Flatt
18fd9949a6 fix unmarshaling of perserved syntax properties
Unmarshaling was broken for a syntax object that doesn't have
a 'paren-shape property.
2016-04-24 07:19:02 -06:00
Robby Findler
68b8bf760a make #f always coerce into the same (eq?) contract and make
(or/c #f #t) (or (or/c #t #f)) coerce into the same thing
that boolean? coerces into (and make that also always be eq?)
2016-04-22 15:43:19 -05:00
Robby Findler
bbac97129e avoid an extra call to the contract-specific method for checking stronger
Before this commit, when contract-stronger? is called, it would not
be able to return #f until it calls the contract-specific stronger
method twice
2016-04-22 14:54:33 -05:00
Ryan Culpepper
1acaf0111d syntax/parse: fix for deterministic compilation
Lift compile-time gensyms to vars bound to run-time gensyms.
2016-04-22 09:54:30 -04:00
Matthew Flatt
b523c9c13f local-transformer-expand: catch lifts in 'top-level mode
Change the one expansion mode as far as I can tell) that disables
lifts so that lifts are now allowed, which means that
`(syntax-transforming?)` implies `(syntax-transforming--with-lifts?)`.

The old documentation incorrectly characterized when lifts
were allowed. Ryan noticed the documentation problem, and that
observation led to this simplication.
2016-04-21 13:58:05 -06:00
Matthew Flatt
9ff64fc6ed GC: guard against excessive fragmentation in incremental mode
Although excessive fragmentation is already detected at the end
of a major GC, it can get out of hand already during a long
incremental phase. So, check for excessive fragmentation and
bail out to a major GC when it happens.

Related to PR 15287
2016-04-19 16:26:42 -06:00
Robby Findler
fa4a6d4c13 fix the 'just check existence' part of object/c contracts 2016-04-19 14:07:50 -05:00
Matthew Flatt
3b1b4a0d26 string->url: always mark as absolute when a host is present
Fixes a failure in the web server tests caused by d23b296627.

Formerly, `(string->url "http://racket-lang.org")`, with no trailing
slash, would produce a `url` structure with `path-absolute?` as #f.
That doesn't exactly make sense, because a URL with a host must always
have an absolute path component. Claiming a relative path component
interacts badly with extending a URL with a path later. (Although
`combine-url/relative` compenstate, a similar function in the web
server doesn't.) The revised `url->string` always sets `path-absolute?`
to #t when a host is present, and whether the path is empty or contains
an empty string still records whether a trailing "/" was present.

The `url->string` function, meanwhile, now needs to use whether the
path is empty to determine whether a "/" should be added after
the host name, not whether `path-absolute?` is true.
2016-04-19 05:42:07 -06:00
Matthew Flatt
ddd4190edf GC: improve backtrace info for 'interior pointers 2016-04-19 05:25:07 -06:00
Matthew Flatt
84bffd41af GC: fix backtrace reporting
The addition ot limited recursive marking broke the implementation
of memory-debugging backtraces.
2016-04-18 18:39:20 -06:00
Matthew Flatt
027dd9a43c untgz and gunzip: report unexpected end-of-file
Report an explicit "unexpected end-of-file" error instead of
a later contract failure on #<eof> insteda of a byte

Closes #1204
2016-04-18 08:25:41 -06:00
Ryan Culpepper
837fe2a91a use group-by 2016-04-18 09:13:11 -04:00
Ryan Culpepper
6da3e88bd8 fix and update syntax/parse/debug 2016-04-18 09:13:11 -04:00
Ryan Culpepper
4e6438eaf2 syntax/parse: add groups of post progress
This is a partial solution to the ~and problem, only for side clauses.
In (~and p1 p2 p3), one often wants errors in p2 to take precedence over
errors in p1, and likewise for p3 over p2. One solution is ~commit, but
that prevents backtracking. Another is ~post, but then two ~post wrappers
are needed around p3. Also, it doesn't make sense to compare progress of
the third #:with clause from stxclass A to the second #:with clause of
stxclass B and say third beats second.

So, generalize 'post to (post group index); post frames are comparable to
each other only if group is the same, then compared by index. (Post still
beats CAR and CDR.) Each set of side clauses shares a group.

For simplicity of code generation for now, use gensyms to identify groups.
2016-04-18 09:13:11 -04:00
Matthew Flatt
51061c0829 fallback for sqlite3_clear_bindings
Work with older SQLite, such as the one with Fedora 6

Closes #769

Merge to v6.5
2016-04-17 14:24:52 -06:00
Matthew Flatt
dda791c8cb remove unneeded use of long-double function
Using stdtold() instead of strtod() causes trouble with the
version of gcc on Fedora 6.

Merge to v6.5
2016-04-17 11:35:50 -06:00
Matthew Flatt
f75729ef41 raco pkg: improve error reporting for bad URLs
Related to #1257
2016-04-17 09:10:06 -06:00
Matthew Flatt
d23b296627 URL string conversions: disallow host plus relative path
Closes #1257
2016-04-17 09:02:19 -06:00
Matthew Flatt
53ffad767b net/url-string: support URLs that contain IPv6 literals
Since an IPv6 literal address includes ":"s, it must be written
between "[" and "]" as a host name.

Based on a patch by @Phlosioneer and comments by @Blaisorblade,
with additional changes to make `url->string` work.

Closes #980
Closes #1243
2016-04-16 21:19:33 -06:00
Matthew Flatt
8993398033 Add #:name and #:extra-name to struct
A `#:name` identifier picks the name that is bound to static
information about a structure type. An `#:extra-name` identifier
specifies an additional name to be bound to the information.
This pair of options is analogous to `#:constructor-name`
and `#:extra-constructor-name`.

Based on Jen Axel's suggestion and implementation.

Closes #1309
2016-04-16 18:39:48 -06:00
Matthew Flatt
4d9427af44 add path-extension, path-has-extension? and path-{add,replace}-extension
Provide a cleaned-up set up path-extension functions. In contrast
to `path-{add,replace}-suffix` and `filename-extension`, a dot
at the beginning of a path element is not treated as an extension
separator. Also, `path-extension` returns an extension including
its separator, which is more consistent with other extension
functions.

The new `path-has-extension?` function replaces many uses of
regexp matching in the base collections.

Closes #1307
2016-04-16 17:56:34 -06:00
Matthew Flatt
4cc3aad30b fix problem with (open-input-file #:for-module? #f ...)
Also, clarify failure handling in the docs.

Closes #1298
2016-04-16 10:34:18 -06:00
Matthew Flatt
a6e773f69b fix syntax checking in for/vector
Closes #1308
2016-04-16 09:48:08 -06:00
Spencer Florence
123755437c remove bad srcloc from define-runtime-path (#1203) 2016-04-16 09:39:28 -06:00
Matthew Flatt
2dce66925a update HISTORY.txt for v6.5
Merge to v6.5
2016-04-16 07:01:38 -06:00
Matthew Flatt
e1a5e41ddc The set of environment variables accessible via getenv is
restricted through `get-info`, which prunes the environment
variable set before it loads the "info.rkt" file. All
environment variables are pruned except those listed in
`PLT_INFO_ALLOW_VARS` (separated by semicolons).

Related to emina/rosette#17.
2016-04-15 09:56:59 -06:00
Matthew Flatt
6369e56709 add support for tethering to a config or addon dir
Add a hook to `raco setup` to make copies of installed executables,
where the copies start with the configuration or addon directory
of creation time, instead of the default installation or user-specific
path.

Although the same effect can be achived by setting environment
variables such as PLTADDONDIR, tethered executables can be easier
to work with and compose better with other programs.

See also #1206 for some discussion, although this change does
not exactly address the original idea there.
2016-04-15 06:42:15 -06:00
Gustavo Massaccesi
91d6c69565 Avoid compiler warning 2016-04-13 19:23:56 -03:00
Gustavo Massaccesi
b93d94bb67 optimizer: allow duplication of toplevels 2016-04-11 23:08:23 -03:00
Gustavo Massaccesi
2d0f8f6c0f reduce (unbox (box x)) and extend reductions to unsafe-cXr
Reduce (unbox (box x)) => x

Extend the reductions for cXr to the unsafe versions, for
example reduce (unsafe-car (cons x y)) => x

Check and save types in unsafe operations
2016-04-11 21:14:22 -03:00
Gustavo Massaccesi
c4e5a0b190 check for single value expressions in ensure_single_value
Only wrap the argument when the optimizer is not sure that
it is a single valued expression. This allows to remove the
checks in the calling sites.
2016-04-11 21:13:37 -03:00
Vincent St-Amour
f33a4ba471 Fix ->* pre/desc and post/desc handling. 2016-04-11 17:12:23 -05:00
Robby Findler
3636e35480 more compiler/cm log message cleanup 2016-04-10 21:23:12 -05:00
Matthew Flatt
c0bbfe8237 fix raco pkg show --rx on bad patterns
Fix error reporting so it's not an internal error. Also,
report errors before printing a scope, and update the docs
for earlier changes.

Closes #1251
2016-04-08 19:10:56 -06:00
Matthew Flatt
13ebd0e1c8 adjustments for regexp failure handler
Pass a string to the handler to describe the problem.
Also, fix minor issues (GC registration, contracts and `history`
in docs) and make `pregexp`, etc., report compilation errors as
`pregexp`, etc.
2016-04-08 18:34:51 -06:00
Asumu Takikawa
436fca7134 Add optional failure thunk for regexp and friends 2016-04-08 17:15:39 -06:00
Matthew Flatt
c59e1a2ea9 Add note about MMTabBarView 2016-04-08 09:37:14 -06:00
Matthew Flatt
7a339f45b9 Merge pull request #1303 from jsmaniac/doc-changes
Update to the package template + small documentation changes
2016-04-08 09:37:04 -06:00
Vincent St-Amour
249e8eabab Post-release version for the v6.5 release 2016-04-07 11:43:45 -05:00
Georges Dupéron
c0b6378e49 Updated package template.
* Add 6.4 version, as this is now the default one to download on the website.
* raco doc <<name>> should use raco docs <<name>>
* raco is now on the PATH, remove warning
* Change `raco setup --check-deps <<name>>` to `raco setup --check-pkg-deps --pkgs <<name>>` (the former seems obsolete).
* Move `raco pkg install --deps search-auto` to the `install:` section, so that it is done before running the tests
* Move `raco pkg install --deps search-auto cover`, to the `after_success section`, since `raco cover` is run there.
* Fixed .travis.yml syntax (wrong indentation for fields under "matrix:")
* Clone https://github.com/greghendershott/travis-racket.git to a separate directory, not a subdirectory of the current package, as this can cause problems (see https://travis-ci.org/jsmaniac/type-expander/jobs/121099218#L824)
2016-04-07 15:01:01 +02:00
Gustavo Massaccesi
4bcb657f08 fix copy of rator in finish_optimize_application3 2016-04-06 16:42:33 -03:00
Michael McConville
596c571ab1 sizeof(char) is always 1
POSIX and ANSI specify that char is always 1 byte, and I'm almost
certain that no systems violate this. Regardless, the SIZEOF_CHAR macro
is never used.
2016-04-06 12:52:08 -06:00
Matthew Flatt
50ddbee87f change CRLF to LF in a Windows source file 2016-04-06 12:51:14 -06:00
Matthew Flatt
6a5cecee0a make (system-type 'machine) not depend on the secutiry guard
Allow `system-type` on non-Windows platforms to run `uname` to get
machine information, even in a sandbox or other contexts with a
limiting secutiry guard.
2016-04-06 12:51:14 -06:00
Jay McCarthy
782f5798a2 Fix issue 1286 2016-04-06 10:18:03 -04:00
Jay McCarthy
e4c0b75cae Indent 2016-04-06 10:09:16 -04:00
Jay McCarthy
cf70c4a241 Minimal optimizer safe-to-unsafe commit 2016-04-05 15:43:47 -04:00
Matthew Flatt
ffbdc4b61c fix related to continuations
Check that it works to apply a continuation that shares with
an enclosing continuation, where a runstack overflow happens
between the continuations.

Closes PR 15281
2016-04-04 11:19:53 -06:00
Gustavo Massaccesi
09313a0942 optimizer: clone K in (if (if x y #f) z K) reduction
in case K is a once used variable
2016-04-03 12:17:51 -03:00
Matthew Flatt
193178028d fix 'origin info in submodule expansion
While expanding a module, the root of module-relative references is a
fresh notion of "this module".

After expansion, "this module" is shifted to "an expanded module",
which is a global constant (for top-level modules). When an expanded
module is re-expanded, "an expanded module" is shifted to a fresh
"this module" during re-expansion, and so on.

One problem with this approach is that the shift from "this module" to
"an expanded module" isn't applied to syntax properties --- but
there's some extra trickery to make it work out by mutating "this
module" to make it look like "an expanded module".

Submodule expansion introduces an intermediate "parent of this module"
that wasn't currently covered by the extra trickery, so fix that.
2016-04-03 06:39:07 -06:00
Matthew Flatt
794061ba1d syntax/modcollapse: repair for submodule referenced from submodule
While cross-submodule references within a top-level module worked
right, submodule references across top-level modules did not work
right.
2016-04-01 15:25:50 -06:00
Matthew Flatt
161a9edb57 Windows: another PE update fix
Corrects problems with a4d569ae31 to unbreak MinGW-based builds.
2016-03-31 14:40:39 -06:00
Eric Dobson
236b17f625 Make compile-file always return a path as documented. 2016-03-31 09:28:10 -06:00
Vincent St-Amour
5c10eb13eb Revert "Attempt at adding ->im; will be reverted."
This reverts commit 3d987bf1fda9039fee9efafe21f9f78a0ef4feca.
2016-03-30 19:31:24 -05:00
Vincent St-Amour
7c458d10d7 Attempt at adding ->im; will be reverted.
`->i` already supports method contracts (for use wihin `object-contract`,
whose `->i` support is tested, but undocumented), which would make `->im`
possible.

Unfortunately, that support is very incomplete, missing support for using
`this` in contracts, making this `->im` (or the undocumented `->i` +
`object-contract` combo) basically useless.

Once/if that is added, then this commit would enable `->im`. Until then,
it's mostly useful for future reference (hence will be reverted).

In the meantime, it's possible to use `->i` within class/object contracts
with an explicit `this` argument, so nothing critical is lost, just a tiny
shortcut.
2016-03-30 19:31:23 -05:00
Vincent St-Amour
209f2db611 Don't use syntax parameters for method contracts.
Can be done with plain old functions.
2016-03-30 19:31:23 -05:00
Vincent St-Amour
0aec872710 Don't export internal helpers.
Not used anywhere, including in pkgs, not documents, and should never have been exported.

And they're going away.
2016-03-30 19:31:23 -05:00
Vincent St-Amour
077e6da2cb ->2 -> -> 2016-03-30 19:31:23 -05:00
Vincent St-Amour
62aa2b75bf Remove old implementation of ->. 2016-03-30 19:31:22 -05:00
Vincent St-Amour
427fe9340c Remove unused file. 2016-03-30 19:31:22 -05:00
Vincent St-Amour
585ca37c5b Add support for method contracts to ->2.
Should allow removal of old -> implementation.

Temporarily (almost) duplicates code, which will be fixed by removing the old ->.
2016-03-30 19:31:22 -05:00
Matthew Flatt
a4d569ae31 Windows: fix PE update for ".rsrc" not at end
Support creating executables when the base executable has
sections after ".rsrc", as long as there's room to add
a section to the section table. The new resource data is
written to the end of the file and vitrual space, but the
old space needs to be recorded as a section to keep them
contiguous.

MSVC 2015 puts a ".reloc" section after ".rsrc".
2016-03-30 16:27:58 -07:00
Matthew Flatt
153e19edc5 work around modulo failure on 64-bit Windows with MSVC 2008
Something about loading the MinGW-built "londdouble.dll" interferes
with fmod() in some cases --- but only on the first call?
2016-03-30 09:14:55 -06:00
Matthew Flatt
91eaf40b1f fix modulo and remainder related to most negative fixnum
Robby noticed the bug while looking for undefined behavior.
2016-03-30 09:14:54 -06:00
Robby Findler
bfd2404328 move late-neg projection warnings to the info level in the logger
because right now they are too noisy to be useful to anyone other
than contract system maintainers. Once the problems inside the contract
library itself is fixed, consider moving these back to warning
2016-03-30 09:29:50 -05:00
Ryan Culpepper
fafa83a8a0 syntax/parse: reorder and compress error messages
Collect common types of frame (eg message, literal, etc) and
report together. For literals, symbols, and other atoms, compress
multiple entries to list. For example:
  before: "expected the identifier `X' or expected the identifier `Y'"
  now:    "expected one of these identifiers: `X' or `Y'"
2016-03-28 15:36:52 -04:00
Ryan Culpepper
a86931d5f9 syntax/parse: improve error reporting
Previously, syntax-parse would only report errors for one maximal
progress equivalence class (and generate a useless "and other errors
occurred" message). But approach to linearizing the tree of failures
behaved badly if there was too much branching even for a single progress
equiv class. So now it dumps all of the maximal failures into one pile
and tries to find shared "sync points" (frames and terms) to linearize
the failure tree.

In particular, this eliminates the "and other errors" message.

Also updated and improved comments.
2016-03-28 15:36:52 -04:00
Ryan Culpepper
25b2ec2e03 syntax/parse: fix bug that disabled opt, improve debugging 2016-03-28 15:36:52 -04:00
Robby Findler
cf595678f6 clean up logging of compiler/cm a little
use trace-printf for all of the printing (which logs to info@compiler/cm
already) and make all of the indentation printing use the nicer:

   |  |  |  |  |

style, and avoid creating the indentation strings unless they are actually used
2016-03-27 17:29:19 -05:00
Gustavo Massaccesi
ab546d662e Fix SCHEME_LISTP 2016-03-27 10:52:33 -03:00
Robby Findler
20e2e839cb add current-path->mode 2016-03-26 18:39:17 -05:00
Matthew Flatt
9a3e16edff fix problem with lifted bindings and the top level
Repair a mismatch between `syntax-local-lift-expression` and the
way that `compile` tries to avoid creating bindings while
compiling a top-level `define` form.

Closes #1284 and #1282
2016-03-26 16:00:51 -06:00
Matthew Flatt
f7182e7a5c GC on Linux: adjust handler to not abort on SI_KERNEL signals
The meaning of SI_KERNEL signals is not clear, but ignoring
them seems to let the process continue ok. (These signals show
up when running `typed-racket-test/main --int`.)
2016-03-26 13:58:34 -06:00
Sam Tobin-Hochstadt
b1ba506b52 Remove unused variable. 2016-03-26 14:33:43 -04:00