Commit Graph

3080 Commits

Author SHA1 Message Date
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
Gustavo Massaccesi
b9b71b20cc optimizer: add hidden list-pair? primitive
This is useful in the optimizer to track simultaneously the list? and pair?
types of an expression.
2016-03-25 19:17:10 -03:00
Gustavo Massaccesi
cff10bc5a8 extract types for branch when the tests is (not <expr>)
In some cases, complex variants of (if (not <expr>) tb fb) are not reduced.
Extract the type information of the tests in <expr> to use it in tb and fb.
2016-03-25 19:15:51 -03:00
Robby Findler
df157cdfd0 make cm compile all depdencies, not just the first one that needs it
This wouldn't matter if the dependencies recorded in the dep file were
exactly the same as the files that are actually loaded when a file is
required. But in the case of lazy-require (or, more accurately, when
the cm-accomplice library is used), the dependencies in the dep files
can include things that are, in some cases, not actually
required. This is no problem for raco setup, since it looks at all of
the files anyway, but it can cause a particularly bad interaction with
DrRacket's online compilation facility.

For example say there is some file, e.g., mzscheme/main that is
required lazily. So when you edit a file in DrRacket, it will traverse
the requires and lets say it sees that the of mzscheme/main's
dependencies need to be compiled.  So it will compile that dependency,
and then the ormap in this commit will be shortcircuited, which will
cause CM to stop looking at dependencies and decide to compile
mzscheme/main. So DrRacket will compile mzscheme/main, and then
whatever other pending compiles were going on and DrRacket's online
check syntax will complete, but because the lazy require doesn't
triggered, mzscheme/main isn't actually loaded during compilation.

Now you make another edit to the buffer and the same thing happens
except this time it gets past that first dependency of mzscheme/main
because there is now a .zo file for it from the last go 'round. But
say there isn't one for the second dependency. So it compiles that
file and compiles mzscheme/main now for a second time, but still
doesn't look at the third and fourth (etc) dependencies of
mzscheme/main.

Overall, this means that the second time you edit you file in
DrRacket, it should have been quick for the expansion portion to
finish because, after all, everything has been compiled and should
have been cached in .zo files. But because of the short circuiting, it
the .zo files weren't actually created and so your second edit is also
slow to come back.

After this commit, because of the ormap, the second edit will be
faster.

One worry with this commit is that it might change something that
could cause raco setup to go slower. To test that, I applied only this
change to a fresh checkout and did a full build. I then deleted all zo
files in racket/share/pkgs and timed 'raco setup -D' twice (four times
total). Here are the timings I get. The version of the code that uses
ormap:

  % ... delete .zo files ...
  % time raco setup -D
  real    9m2.354s
  user    37m5.176s
  sys     4m14.963s
  % ... delete .zo files ...
  % time raco setup -D
  real    9m2.421s
  user    37m43.793s
  sys     4m23.111s

The version of the code that uses the change in this commit:

  % ... delete .zo files ...
  % time raco setup -D
  real    8m58.852s
  user    36m51.369s
  sys     4m13.633s
  % ... delete .zo files ...
  % time raco setup -D
  real    8m53.980s
  user    37m40.262s
  sys     4m23.692s
2016-03-23 15:41:01 -05:00
Robby Findler
668e2ffbe2 fix error message 2016-03-23 15:41:01 -05:00
Robby Findler
790096529c report a reason when entering bootstrapping mode 2016-03-23 15:41:01 -05:00
Matthew Flatt
8b3ea4c842 avoid runstack issue with early GC 2016-03-19 08:33:06 -06:00
Matthew Flatt
0b7c8e0b2e fix GC registration of the initial parameterization 2016-03-19 08:33:06 -06:00
Vincent St-Amour
894873c2ff Fix arity checking for ->*.
Some functions were passing when they shouldn't have, only to fail when
the function is called.

Technically not backwards compatible, but should only affect functions
that were never called.
2016-03-18 12:36:05 -05:00
Matthew Flatt
b94e77a062 raco pkg migrate: fix cross-version locking 2016-03-17 17:01:57 -06:00
Matthew Flatt
b1ff73155f raco pkg update: avoid too-early normalization of clone URL
For example,

  raco pkg update --lookup gui-doc

should suggest uncloning "gui-lib", too, assuming they were
cloned in the usual way. Due to too-early normalization of
GitHub URLs, though, shared-clone detection was broken.
2016-03-17 17:01:57 -06:00
Matthew Flatt
e412a2d5a9 raco pkg {install,update,...}: add --dry-run 2016-03-17 17:01:57 -06:00
Matthew Flatt
d27bf66f1a revise hash function for flonums and extflonums
As suggested by Tony.

Closes #1280
2016-03-15 05:28:04 -06:00
Matthew Flatt
182d648af6 improve some comments and an assertion 2016-03-14 18:17:10 -06:00
Robby Findler
8bcb035693 add suggest/c 2016-03-11 11:42:14 -06:00
Matthew Flatt
cbba4e75f9 fix inconsistency in cross-module inlined variable reference
The variable's position in its module was wrong, and
possibly the shape info. The demodularizer test exposed
the inconsistency.
2016-03-11 07:35:05 -07:00
Ian Harris
de0fbf2648 scalinger -> scaliger
This fixes racket/racket#757. Tests are included for both versions,
and documentation now only references the new, correctly named,
procedures.
2016-03-10 15:08:48 -06:00
Matthew Flatt
d22df41001 add support for preserved syntax properties
A syntax property is added as preserved or not. For backward
compatibility, the default for a 'paren-shape key is preserved, and
any other key's default is non-preserved.
2016-03-09 20:19:55 -07:00
Matthew Flatt
2213b61536 Windows (MinGW 64-bit): fix logging for place activity
Like 4d358d9914, but for 64-bit builds using MinGW.
2016-03-09 15:37:43 -07:00
Robby Findler
041cebc9c0 fix error message in ->i
in the case where the dependened on contract is a first-order contract, there
is a shortcircuit that incorrectly formulated the error message
2016-03-09 15:37:52 -06:00
Matthew Flatt
4d358d9914 Windows: fix logging for place activity
Logging tends to use "%Id" for `intptr_t` formatting,
at least with MSVC, but the log-string formatting function
didn't recognize the "%Id" pattern.
2016-03-09 13:14:38 -07:00
Robby Findler
0f73870a1b fix keyword argument order bug in ->i
the bug required all mandatory arguments to manifest

closes PR 15267
2016-03-08 21:50:15 -06:00
Matthew Flatt
26d28a28fe fix mismatch between optimizer snd run-time on "constant" detection
Cross-module inlining that pulls a variable reference across a
module boundary imposes a more struct requirement that run-time
"constant" detection is consistent with the optimizer's view of
"constant" within a module. So, make sure they're the same.
2016-03-08 16:37:28 -07:00
Vincent St-Amour
747185184b Don't store result arity of reduced-arity functions in a field.
Instead compute it on the fly.
2016-03-08 17:00:53 -06:00
Vincent St-Amour
9fdffc446a Further cleanup and robustness. 2016-03-08 16:56:06 -06:00
Vincent St-Amour
b5503151ac Split impersonator property into two.
To avoid future confusion.
2016-03-08 16:31:20 -06:00
Vincent St-Amour
d80a8244a2 Fix the fix in 686bc68.
Original fix did not break correctness, but did introduce too much wrapping.
2016-03-08 16:21:58 -06:00
Vincent St-Amour
686bc68b0a Fix object/c multiple-wrapping optimization.
A shortcut in the optimization made it drop all but the most recent contract.
2016-03-08 15:51:51 -06:00
Gustavo Massaccesi
509da64135 reduce (let ([x <expr>]) #f) => (begin <expr> #f)
Sometimes the optimizer removes all the references to a variable but it
doesn't detect that the variable is unused, so it keeps the definition.

Later, the sfs detects the unused variable so it marks it, but it doesn't
remove the let form.
2016-03-07 20:30:46 -03:00
Matthew Flatt
ffbae2c090 fix resolve-path to always return a path (not a string)
Closes #1132
2016-03-07 15:34:57 -07:00
Vincent St-Amour
e90e587a91 Generalize procedure-result-arity to work on reduced-arity procedures. 2016-03-07 16:25:13 -06:00
Matthew Flatt
c1d44cedba allow cross-module inlining to introduce a variable reference
Formerly, cross-module inlining would not work for a function like

  (define (f x)
    (if .... .... (slow x)))

unless `slow` was also inlined into `f`. This commit changes
cross-module inlining so that it allows a call to `f` to be replaced
with an expression that references other module-level bindings (that
are not primitives), such as `slow`.

Adjusting the inlining rules can always make some program worse. In
this case, a hueristic about whether to export an optimized or
unoptimized variant of a fnuciton for inlining tends to collide with
the adjusted inlining rule, so this commit tweaks that heuristic, too.
2016-03-07 07:13:14 -07:00
Matthew Flatt
7e2195fdba fix optimizer bug
Fix a bug introduced by one of the last few bytecode-compiler
changes.
2016-03-05 13:10:21 -07:00
Matthew Flatt
bfb14637a6 fix validator and JIT to match with-continuation-mark compilation
Compiler changes allow the body of a `with-continuation-mark`
form to produce an unboxed value, but the validator and JIT
were not updated for that change.
2016-03-05 05:51:06 -07:00
Matthew Flatt
79ad86d891 fix optimization related to with-continuation-mark
Fix mistake intoduced in 5904acc69a adding `with-continuation-mark`
to single_valued_noncm_expression().
2016-03-05 05:17:37 -07:00
Matthew Flatt
2bfb851ccc optimizer: generalize intraprocedural type tracking
Enable the optimizer to figure to figure out that a loop
argument is always a real number, for example, in much the
same way that it can detect fixnums and flonums for unboxing.

Unboxing information was only needed at the resolve level,
but `real?` information is useful only to the optimizer, so
the generalization enables the optimizer to reach
approximations of type information earlier (e.g., among
a subset of a function's arguments).
2016-03-05 05:17:37 -07:00
Matthew Flatt
8ec35de0b2 generalize predicate tracking to support numerics 2016-03-05 05:17:37 -07:00
Matthew Flatt
1c8881dbef optimizer: convert (let ([x M]) x) to (begin0 M #f)
For simple enough M, `(let ([x M]) x)` is already converted
to just M, but add a conversion for other forms that gets rid
of the binding while preserving non-tailness.
2016-03-05 05:17:37 -07:00
Matthew Flatt
254dac4625 optimizer: drop redundant with-continuation-marks
Simplify `(wcm <k1> <v1> (wcm <k1> <v2> <e>))` to
`(begin <v1> (wcm <k1> <v2> <e>))` for a simple enough <k1>.
A variable simple enough, so this is useful for improving
errortrace output.
2016-03-05 05:17:37 -07:00
Robby Findler
b52a4b3318 make struct-out leave behind a disappeared use for its argument
closes PR 15263
2016-03-03 03:38:53 -06:00
Sam Tobin-Hochstadt
8eadc197a9 Use syntax-local-introduce to fix arrows in match. 2016-03-02 18:03:46 -05:00
Matthew Flatt
9b4f830268 improve hashing on structs, especially prefabs
Use the structure-type name, in addition to the structure
content. Including the name is espeically useful for
distinguishing prefabs structs that differ in the prefab
name.
2016-03-02 10:42:57 -07:00
Matthew Flatt
97d951af54 improve equal-hash-code on interned symbols
Compute an `equal?` hash code for `read`able values that
is a constant, at least for a given version of Racket. Only
(interned) symbols failed to have that property before.
2016-03-02 10:31:34 -07:00
Matthew Flatt
3617e1f81e xform: add XFORM_ASSERT_NO_CONVERSION
A `XFORM_ASSERT_NO_CONVERSION` declaration makes xform check that
an procedure that is intended to avoid instrumentation actually
does avoid it.
2016-03-02 09:48:24 -07:00
Robby Findler
753def919b cooperate better with check syntax for variables generated by #:pre and #:post in ->i
closes PR 15256
2016-03-01 00:56:34 -06:00
Sam Tobin-Hochstadt
e94081c5aa Initialize variables to avoid compiler warnings. 2016-02-29 12:21:55 -05:00
Matthew Flatt
59f3f82460 GC: fix initialization of mark tables for places
Fixes a mistake in 7d90b27524.
2016-02-29 06:08:29 -07:00
Matthew Flatt
3b25e22dd6 add XFORM_NONGCING_NONALIASING annotation
An `XFORM_NONGCING_NONALIASING` function doesn't trigger a GC, and
when it is given an argument that is an address of a local variable,
it fills in that address and doesn't leak it. This annotation allows
the xform transformation (to support precise GC) avoid some work for
some hash-iteration functions.
2016-02-28 17:19:34 -07:00
Matthew Flatt
8a59534669 adjust unsafe hash-table iteration implementation
Restore exports available to embedding, extending, and FFI
applications, and shift boundary back between hash-table
implementation details (in "hash.c") and Racket interface
(in "list.c").
2016-02-28 16:23:52 -07:00
Matthew Flatt
3ac2c69f6c add explanations for primitive-property flags 2016-02-28 15:14:53 -07:00
Matthew Flatt
428d02c78c enumerate some guidelines for changing the core implementation 2016-02-28 15:14:53 -07:00
Gustavo Massaccesi
828335a879 optimizer: split optimize_info_lookup
With the old representation of local variables, optimize_info_lookup
had to search the stack for the frame with the information about the
variable. This was complicated so it has many flags to be used in
different situations and extract different kind of information.

With the new representation this process is easier, so it's possible
to split the function into a few smaller functions with an easier
control flow.

In particular, this is useful to avoid marking a variable as used
inside a lambda when the reference in immediately reduced to a
constant using the type information.
2016-02-28 17:59:34 -03:00
Gustavo Massaccesi
5ef3a53002 special cases for small hashes in unsafe_scheme_hash_tree_iterate_*
The iterator saves the return points in a list. For small immutable hashes,
encode the values in the list in the bits of a fixnum to avoid allocations.
2016-02-28 15:34:16 -03:00
Matthew Flatt
7d90b27524 add support for defining GC traversals through ffi/unsafe
Expose tagged allocation and a function that interprets a description
of tagged shapes. As a furst cut, the description can only specify
constant offsets for pointers within the object, but future extensions
are possible.
2016-02-27 20:33:50 -07:00
Matthew Flatt
e4f0b69b72 fix chaperone-of? and property-only impersonators
Closes #1263
2016-02-27 19:50:54 -06:00
Matthew Flatt
032b1871d1 bytecode compiler: break up and improve comments at final let step 2016-02-27 18:13:14 -06:00
Matthew Flatt
d70616ec65 raco exe: fix 32-bit ELF updating
Closes #1264
2016-02-27 18:12:57 -06:00
ben
f83cec1b04 fix (combinations n k) bug
Now using Gosper's hack to enumerate length k binary numbers.
New implementation is shorter & a little more obviously correct
(if you trust the bit-twiddling)
https://en.wikipedia.org/wiki/Combinatorial_number_system#Applications
2016-02-26 17:59:59 -05:00
Ryan Culpepper
c1664610e1 update version number for ffi change 2016-02-26 17:57:56 -05:00
Ryan Culpepper
2cc4b66184 add saved-errno setter variant
This makes it easier to create mock foreign functions
(or wrap existing ones) for testing.
2016-02-26 17:57:56 -05:00
Matthew Flatt
81b5d74ed6 fix mishandling of the continuation-mark depth
When a chaperone-wrapped function leads to a slow-path tail
call, the continuation-mark depth can be made too deep when
resolving the slow tail call.

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

The `tests/racket/test` test suite now passes with
`PLT_RECOMPILE_COMPILE` set --- except for the "optimize.rktl" test
suite, wher emore work is needed to ensure that optimizations
don't get lost.
2016-02-26 06:03:11 -05:00
Matthew Flatt
f0500c64d3 Windows: always get errno from "MSVCRT.dll" 2016-02-26 06:03:10 -05:00
Stephen Chang
15f47ef62e fix context of macro-generated default-in-hash- internal ids 2016-02-25 23:40:30 -05:00
Gustavo Massaccesi
5a378ca883 More reductions for (if t v v) and (eq? v v)
Reduce
(eq? v v) ==> #t
(if t v v) ==> (begin t v)
(if v v #f) ==> v
when v is a local or a top level variable.

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

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

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

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

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

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

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

to

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

 LocalWords:  pkgs rkt
2016-02-16 21:05:15 -07:00
ben
0e1f17b520 option to limit prefix in ~a,~s,~v,~e,~.a,~.s,~.v 2016-02-11 19:51:47 -05:00
Robby Findler
71f338430b clean up some confusion about the timing of errors
specifically, always wait for the neg party to come in
before signalling any errors
2016-02-10 17:36:37 -06:00
Vincent St-Amour
640895645f Fix contract-stronger? to work with late-neg projections. 2016-02-10 15:40:59 -06:00
Stephen Chang
e6a0caa147 Use better regexp for string->url input contract.
Closes #929
2016-02-10 12:54:03 -05:00
Stephen Chang
5ffe007f5c Add faster non-generic in-*-set sequences
closes #1217
2016-02-10 11:24:38 -05:00
Matthew Flatt
5b37bac183 xform: another signbit intrinsic 2016-02-10 06:07:20 -07:00
Matthew Flatt
f21aa8661b xform: more signbit variants 2016-02-09 08:21:41 -07:00
Matthew Flatt
1cffde1df8 fix parallel raco setup failure on dependency cycles
The failure should be an individual module failure, instead of
terminating `raco setup`.
2016-02-09 08:01:42 -07:00
Matthew Flatt
50db01bf2c bump version 2016-02-09 07:38:28 -07:00
Matthew Flatt
c1b9cd6828 xform: recognize some floating-point intrinsics
GCC v6.0 apparently adds `__builtin_isnan`. Guess at some other future
additions, while we're at it.

Closes #1222
2016-02-09 07:38:28 -07:00
Matthew Flatt
18990701a6 xform: better reporting for disallowed call 2016-02-09 07:38:28 -07:00