Commit Graph

37570 Commits

Author SHA1 Message Date
Matthew Flatt
71b4f5f6c0 doc corrections for syntax-make-delta-introducer 2016-08-13 14:15:54 -06:00
Matthew Flatt
c9da43378f restore SCHEME_INPORT_VAL and SCHEME_OUTPORT_VAL 2016-08-13 14:15:54 -06:00
Matthew Flatt
21d5d909a6 doc correction for ffi/unsafe/alloc 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
14e1d13fe6 PR#1411 documentation tippex 2016-08-09 14:30:50 +01:00
Tim Brown
a5583485b6 PR#1411 Documentation 2016-08-09 14:12:04 +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
Leif Andersen
dc13793c24 sandwitch -> sandwich
(Apparently the other way was incorrectly in my dictionary.)
2016-08-01 12:41:56 -04: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
1f94c4ed3a syntax/parse: fix test for drdr; suppress logging output 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
Leif Andersen
cb1a1e233e Cannot show system build paths in docs 2016-08-01 09:34:12 -04:00
Leif Andersen
1b050905e9 Add example for collection-file-path 2016-07-31 23:19:49 -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
Ben Greenman
22546a3f22 typo: description of module-compiled-name argument 2016-07-30 02:14:01 -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
Ryan Culpepper
b7bd836f0f document this-syntax and #:auto-nested-attributes
fixes #1185, #1350
2016-07-29 17:39:33 -04:00
Stephen Chang
c56efb22a6 remove mention of syntax-id-rules in Macros section of Guide 2016-07-29 16:19:43 -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