Commit Graph

31329 Commits

Author SHA1 Message Date
Stephen Bloch
ca98f85c39 Re-added error checks in the color=? function, so error message comes
from the function you actually called, rather than an internal.
2013-12-17 14:53:05 -05:00
Asumu Takikawa
f4d5b00ea5 Refactor tc-utils
Use an explicit `provide` list and delete unused functions.
2013-12-17 14:40:24 -05:00
Matthew Flatt
4fc71002e8 raco setup: more on docindex database creation
Commit 6ff7359212 didn't create a directory that might be missing
before trying to create a file in the directory.

Merge bug fix to v6.0 (pending review)
2013-12-17 07:11:22 -07:00
Asumu Takikawa
098f398a14 Fix base env types that are too conservative
These accessors and removers required the target value
to have the same type variable as the collection, but
that's more conservative and less useful than Any.
2013-12-17 01:33:47 -05:00
Eric Dobson
7060bdd0f8 Add a bunch of tests for contract creation error messages.
Also minor fixes to said error messages.
2013-12-16 21:04:36 -08:00
Robby Findler
09e28b272c remove use of exported set!'d identifier from contract examples
(replacing it with an accessor function)

Also add some for-label requires and remove a guaranteed-to-fail
test case (the bug is documented in the contract gotchas section)
2013-12-16 22:37:37 -06:00
Matthew Flatt
a9f64f4615 MzCOM: fix versioning and collection path
Merge bug fix to v6.0 (pending review)
2013-12-16 21:08:35 -07:00
Matthew Flatt
6ff7359212 raco setup: create docindex database before trying to read
Commit 0f80c71fab propagates read-only mode so that a documentation
database is not created for read operations, but `raco setup` (with
documentation-index support) attempts to read the database before
writing to it. Change `raco setup` to make sure the database
exists if a later write operation is expected to create it.

Merge bug fix to v6.0 (pending review)
2013-12-16 18:44:39 -07:00
Vincent St-Amour
ac480e7535 Update Typed Racket history.
Please merge to 6.0.
2013-12-16 17:05:39 -05:00
Vincent St-Amour
46260a6e85 Remove dependencies of typed-racket-more. 2013-12-16 17:04:16 -05:00
Vincent St-Amour
e0caf456dd Remove dependency on scheme-lib. 2013-12-16 17:04:16 -05:00
Vincent St-Amour
2195bdd15a Remove some SRFI dependencies. 2013-12-16 17:04:16 -05:00
Vincent St-Amour
c48a0e5b76 Remove dependency from benchmarks to legacy TR languages. 2013-12-16 17:04:16 -05:00
Vincent St-Amour
9a67230ae0 Split legacy Typed Racket languages into their own module. 2013-12-16 17:04:15 -05:00
Matthew Flatt
0f80c71fab setup/doc-db: propagate read-only flag for database connection
Fixes a problem installation Planet packages under Windows,
for example, where attempting to open a read-only file in
write mode triggers an extremely slow result.

Merge bug fix to v6.0 (pending review)
2013-12-16 14:38:26 -07:00
Matthew Flatt
ec5157d78f setup/setup: fix #:make-doc-index? default
Making the default match the docs fixes Planet package installation,
which otherwise tries to rebuild the index too frequently.

Merge bug fix to v6.0 (pending review)
2013-12-16 14:38:26 -07:00
Eric Dobson
edb04b8bfe Add test to track tr memory usage. 2013-12-16 09:42:27 -08:00
Matthew Flatt
1ceca069c8 more repairs to function-name inference
The main change is to add an option to `syntax-local-infer-name` to
select whether `syntax-local-name` is used, and to use the new option
to disable `syntax-local-name` for the function expression in a
keyword `#%app`.

Improvements in the expander/compiler generalize a previous repair.

Merge to v6.0
2013-12-16 09:07:36 -07:00
Matthew Flatt
37dd4fc2b0 fixes for keyboard navigation and tab panels
The geometry used for keyboard navigation and tab-panel% instances
was wrong. That problem, in turn, exposed a potential infinite
loop in the function that computes the next tab position (when
geometries overlap). Fix both.

Closes PR 14255

Merge to v6.0
2013-12-16 07:16:42 -07:00
Robby Findler
4a7c36e96e catch networking errors and show a dialog
that doesn't say "internal error"

closes PR 14254
2013-12-15 21:20:35 -06:00
Eric Dobson
ef6af9c47c Fix broken TR code. 2013-12-15 17:00:53 -08:00
Eric Dobson
5d4cb8c08b Make top interaction commands lazily loaded. 2013-12-15 14:13:07 -08:00
Eric Dobson
8e51f2b5ac Remove unused export. 2013-12-15 14:01:03 -08:00
Matthew Flatt
4abe7d2657 fix incorrect propagation of name via syntax-local-name
Merge to v6.0
2013-12-14 21:11:08 -07:00
Matthew Flatt
80d0b2fcc3 fix for-label import of a submodule
Closes PR 14155

Merge to v6.0
2013-12-14 20:27:55 -07:00
Robby Findler
2199d96100 implement a little bit of the random generation for the new ->
(just enough to pass the test suite)
2013-12-14 15:47:31 -06:00
Eric Dobson
1d0164f51b Cleanup duplication in check-subforms-unit. 2013-12-14 09:42:50 -08:00
Eric Dobson
ee47fe5f25 Minor cleanup in prims. 2013-12-14 09:42:50 -08:00
Eric Dobson
fced81a541 Make better interface for properties with only booleans. 2013-12-14 09:42:50 -08:00
Eric Dobson
15fddbafe0 Make syntax class for syntax properties. 2013-12-14 09:40:16 -08:00
Jay McCarthy
87135b110b Fix PR14247
Add "Connection: close" to requests that we know will end after one
request.

Read upto 1K bytes at a time on requests rather than just 1 at a time.

Change closing semantics to be "close" and not "abandon"
2013-12-14 08:00:41 -07:00
Robby Findler
074f21203a another fix to the first-order check I added earlier today
(discovered by the test suites run by drdr)
2013-12-13 19:19:25 -06:00
John Clements
b44c23ba20 tiny doc typo 2013-12-13 16:45:28 -08:00
John Clements
ed3bf9a3c0 rackety 2013-12-13 16:45:28 -08:00
Robby Findler
14645b8cc5 fix class/c first-order check for interface contracts 2013-12-13 16:20:59 -06:00
Robby Findler
52c74701ec improve the first-order checking for the current class/c implementation
(not strictly necessary, but the new, still pending class/c first-order
checking checks the arities of the methods and those additional
tests got put into the test suite, so the easiest thing for now
is just to make the current class/c implementation do that check too)
2013-12-13 12:02:53 -06:00
Robby Findler
45b4bd5667 test case illustrating set! problem
(derived from drdr failure for
 scribblings/guide/contracts-examples/1-test.rkt)
2013-12-13 11:49:55 -06:00
Robby Findler
1f1550ae55 fix some bugs in the traversal function in any-wrap that I introduced
Also, rename the function so that errors like this don't take me as long to find
2013-12-12 22:48:57 -06:00
Robby Findler
ecc1facdaa improve source locations for uses of contracted variables 2013-12-12 22:48:57 -06:00
Robby Findler
4bcb44c442 separate out the error location tests
also, Rackety
2013-12-12 22:48:56 -06:00
Asumu Takikawa
34c5b32746 Quote the identifier in the declaration error msg
Please merge to v6.0
2013-12-12 16:25:21 -05:00
Asumu Takikawa
f1d35f6ec9 Better error msg for annotations on unbound ids
Closes PR 14246

Please merge to v6.0
2013-12-12 16:25:21 -05:00
Robby Findler
af8f13b16a fix spelling error 2013-12-12 15:24:02 -06:00
Matthew Flatt
0b48e883da fix reducing arity or chaperoning keyword-valued prop:procedure
Fix various problems, including a bad result from `procedure-arity`
and problems with chaperones and arity error messages when a
structure's `prop:procedure` value is a keyword-accepting procedure.

Merge to v6.0
2013-12-12 12:15:10 -07:00
Eric Dobson
48a16b2b8a Add types to hasheq and hasheqv.
Merge to 6.0.
2013-12-12 08:32:06 -08:00
Matthew Flatt
861384d36d Mac OS X: fix executable creation for LC_DYLIB_CODE_SIGN_DRS
The LC_DYLIB_CODE_SIGN_DRS load command is relatively new, and
it needs to be updated when we shift __LINKEDIT to add
__PLTSCHEME.

Merge to v6.0
2013-12-11 19:54:58 -07:00
Robby Findler
c321f6dd0c Change contract system so that projections are more first-order friendly
The main changes are the addition of a new way to specify projections,
using the #:val-first-projection keyword argument; the main goal of the
new API is that more information can be supplied to the projection on
the server side of the contract boundary. In addition, the arrow contracts
will now, internally and in some cases (see define-module-boundary-contract)
return functions that accept one additional argument than the original
function did and then insert the name of the negative party into call sites.

The rough idea is that if you have a program like this one:

  #lang racket/base
  (define (f x) (+ x 1))
  (provide (contract-out [f (-> integer? integer?)]))

then the contract system produces something much closer to this:

  #lang racket/base
  (define (f x) (+ x 1))

  (provide (rename-out [external-f f]))
  (define (external-f neg-party x)
    (check-integer neg-party x)
    (define ans (f x))
    (check-integer neg-party ans)
    ans)

  (define local-blame-information ...)
  (define (check-integer neg-party v)
    (unless (integer? v)
      (raise-blame-error local-blame-information
                         #:missing-party neg-party
                         ...)))

where 'raise-blame-error' can now cope with blame objects that don't
have negative part information in them (when the #:missing-party
argument is supplied, essentially just reassembling the original blame
record at that point)

Then, on the client side, if we had

   (f x)

it gets transformed into

   (f '<<my-modules-name>> x)

and if we had

   (let ([g f])
     ...)

you get a slow path:

    (let ([g (lambda (x) (f '<<my-modules-name>> x))])
      ...)

(where we don't create a wrapper lambda, of course, we actually create
a procedure chaperone)

The performance improvements seem pretty good (see below for the
precise programs that I ran and the numbers I got):

  first order contract microbenchmark: 6x speedup
  higher-order contract microbenchmark: 1.5x speedup
  first-order TR contract interop micro benchmark: 6x speedup

This also improves the memory use for DrRacket by about 3% (from about
236.8 mb to 231.3 mb), presumably because more of the data structures
created by the contract system can be created only once, on the server
side.

Be aware, however, that not all combinators are using the new
projections and the code that translates between the two APIs
is slow.

Also there are a bunch of other changes that got made while I was
doing this. Most notably, the change above were not designed for the
performance improvements to arrow contracts, but to make it possible
to implement class/c contracts with a (hopefully) negligible space
overhead. That work is not yet finished, but this commit includes some
changes to the class system to prepare the way for those changes.

Unfortuantely, these changes slow down 'send' on microbenchmarks by
about 24%. The change comes from the addition of an extra 'if' (and
predicate test and possibly the extra let expresison) that's inserted
into the expansion. I'm not happy about that (I was shooting for 10%)
but I'm not sure that we can do much about it (except perhaps double
check my measurements, see below).

Other misc changes:

- improve arity mismatch error messages by including the arity of the
  given procedure (closes PR 14220)

- Adjust case-> so it generates less code. This seems to reduce the
  size of the math library .zo files by about 3% (from 10440k to
  10156k for me)

- speeds up the contract tests a bit

- move recontract out into racket/contract (also, document it)

- added define-module-boundary-contract

- streamline TR's any-wrap/c and adjust it to use
  #:val-first-projection instead of #:projection

- adjust a bunch of contracts to print more nicely

- and, of course, Rackety

--------------------------------

The precise programs that I tried and their timings (the raw data
for the performance claims above):

 #lang racket/base
(module m racket/base
  (require racket/contract/base)
  (define (f x) x)
  (provide (contract-out [f (-> any/c any/c)])))

(require 'm)
(time
 (for ([x (in-range 100000)])
   (f 1) (f 2) (f 3) (f 4) (f 5) (f 6) (f 7) (f 8)
   (f 1) (f 2) (f 3) (f 4) (f 5) (f 6) (f 7) (f 8)
   (f 1) (f 2) (f 3) (f 4) (f 5) (f 6) (f 7) (f 8)
   (f 1) (f 2) (f 3) (f 4) (f 5) (f 6) (f 7) (f 8)
   (f 1) (f 2) (f 3) (f 4) (f 5) (f 6) (f 7) (f 8)
   (f 1) (f 2) (f 3) (f 4) (f 5) (f 6) (f 7) (f 8)
   (f 1) (f 2) (f 3) (f 4) (f 5) (f 6) (f 7) (f 8)))

pre-push timings:

cpu time: 3553 real time: 3552 gc time: 52
cpu time: 3548 real time: 3552 gc time: 52
cpu time: 3525 real time: 3525 gc time: 54
cpu time: 3547 real time: 3547 gc time: 47

post-push timings:

cpu time: 515 real time: 515 gc time: 15
cpu time: 522 real time: 522 gc time: 17
cpu time: 560 real time: 560 gc time: 19
cpu time: 514 real time: 515 gc time: 19
cpu time: 507 real time: 507 gc time: 17

A second order example using vectors (note that vector/c isn't yet
updated to the #:val-first-projection, so it will be way slower)

 #lang racket/base
(module m racket/base
  (require racket/contract/base)
  (define (f x) (vector-ref x 0))
  (provide (contract-out [f (-> (vectorof any/c) any/c)])))

(require 'm)
(define v (vector void))
(time
 (for ([x (in-range 10000)])
   (f v) (f v) (f v) (f v) (f v) (f v) (f v) (f v)
   (f v) (f v) (f v) (f v) (f v) (f v) (f v) (f v)
   (f v) (f v) (f v) (f v) (f v) (f v) (f v) (f v)
   (f v) (f v) (f v) (f v) (f v) (f v) (f v) (f v)
   (f v) (f v) (f v) (f v) (f v) (f v) (f v) (f v)
   (f v) (f v) (f v) (f v) (f v) (f v) (f v) (f v)
   (f v) (f v) (f v) (f v) (f v) (f v) (f v) (f v)))

pre-push timings:

cpu time: 744 real time: 745 gc time: 20
cpu time: 679 real time: 679 gc time: 18
cpu time: 695 real time: 695 gc time: 23
cpu time: 743 real time: 742 gc time: 21
cpu time: 780 real time: 786 gc time: 21
cpu time: 723 real time: 726 gc time: 25

post-push timings:

cpu time: 448 real time: 448 gc time: 18
cpu time: 470 real time: 469 gc time: 19
cpu time: 466 real time: 465 gc time: 16
cpu time: 457 real time: 456 gc time: 15
cpu time: 465 real time: 466 gc time: 24

Using contracts in TR

 #lang racket/base
(module m typed/racket/base
  (: f (Any -> Any))
  (define (f x) x)
  (provide f))

(require 'm)
(time
 (for ([x (in-range 10000)])
   (f 1) (f 2) (f 3) (f 4) (f 5) (f 6) (f 7) (f 8)
   (f 1) (f 2) (f 3) (f 4) (f 5) (f 6) (f 7) (f 8)
   (f 1) (f 2) (f 3) (f 4) (f 5) (f 6) (f 7) (f 8)
   (f 1) (f 2) (f 3) (f 4) (f 5) (f 6) (f 7) (f 8)
   (f 1) (f 2) (f 3) (f 4) (f 5) (f 6) (f 7) (f 8)
   (f 1) (f 2) (f 3) (f 4) (f 5) (f 6) (f 7) (f 8)
   (f 1) (f 2) (f 3) (f 4) (f 5) (f 6) (f 7) (f 8)))

pre-push timings:

cpu time: 357 real time: 357 gc time: 6
cpu time: 446 real time: 447 gc time: 4
cpu time: 361 real time: 359 gc time: 4
cpu time: 366 real time: 366 gc time: 5
cpu time: 368 real time: 367 gc time: 6

post-push timings

cpu time: 63 real time: 63 gc time: 7
cpu time: 64 real time: 63 gc time: 8
cpu time: 63 real time: 64 gc time: 8
cpu time: 58 real time: 58 gc time: 8
cpu time: 59 real time: 59 gc time: 7

Slowdown for 'send':

 #lang racket/base
(require racket/class)
(define c% (class object% (define/public (m x) x) (super-new)))
(define o (new c%))
(time
 (for ([x (in-range 100000)])
   (send o m 1) (send o m 2) (send o m 3) (send o m 4)
   (send o m 5) (send o m 6) (send o m 7) (send o m 8)
   (send o m 1) (send o m 2) (send o m 3) (send o m 4)
   (send o m 5) (send o m 6) (send o m 7) (send o m 8)
   (send o m 1) (send o m 2) (send o m 3) (send o m 4)
   (send o m 5) (send o m 6) (send o m 7) (send o m 8)
   (send o m 1) (send o m 2) (send o m 3) (send o m 4)
   (send o m 5) (send o m 6) (send o m 7) (send o m 8)
   (send o m 1) (send o m 2) (send o m 3) (send o m 4)
   (send o m 5) (send o m 6) (send o m 7) (send o m 8)))

timings pre-push:

cpu time: 251 real time: 251 gc time: 0
cpu time: 275 real time: 275 gc time: 0
cpu time: 250 real time: 250 gc time: 0
cpu time: 246 real time: 246 gc time: 0
cpu time: 247 real time: 246 gc time: 0

timings post-push:

cpu time: 303 real time: 302 gc time: 0
cpu time: 333 real time: 333 gc time: 0
cpu time: 315 real time: 315 gc time: 0
cpu time: 317 real time: 317 gc time: 0
cpu time: 311 real time: 310 gc time: 0
2013-12-11 12:05:30 -06:00
Robby Findler
542e256206 fix stacks when in test coverage mode
(most of the commit is a rather involved test case....)
2013-12-10 12:32:14 -06:00
Robby Findler
19d9d9a8ae tweak the spacing in the bernoulli sequence 2013-12-10 12:32:14 -06:00
Robby Findler
70a86aac84 fix bug in number rendering 2013-12-10 12:32:13 -06:00