Commit Graph

34523 Commits

Author SHA1 Message Date
Matthew Flatt
9a94366c2c optimizer: fix reordering problems
When a variable X is bound to an expression that implies properties of
other bindings, and if X is used only once and can be replaced by
its value expression, then further optimization of that expression must
not assume the properties that are established by evaluating the
expression.

Also, don't move expressions past unsafe operations, since the expression
might implicitly guard against unsafety.

Closes PR 14819
2014-11-03 06:06:04 -07:00
Matthew Flatt
0d6deb84de README tweak
Based on a suggestion from freshlikeesch.
2014-11-03 06:06:04 -07:00
freshlikeesch
b424e97e60 Professionalism
Line 11: "may" instead of "can"
Line 11: "implies" instead of "means"
Line 14: "states" instead of "means"
Line 17: -resources should be clear and separated-
2014-11-03 06:06:04 -07:00
Matthew Flatt
823e8cf8d3 repair for more recent MinGW
I think that `-static-libgcc` didn't solve any problems with gcc
3.7.x, but with 3.8.x, divdi3() shows up, and that leads to
a "libgcc_s.dll" dependency unless `-static-libgcc` is used.
2014-11-03 06:06:04 -07:00
Asumu Takikawa
03153d46ec Update TR type for current-process-milliseconds 2014-11-03 01:25:15 -05:00
Asumu Takikawa
f59b36a951 Fix Editor<%> and Snip% types 2014-11-02 22:10:43 -05:00
Matthew Flatt
c7688818fa racket/gui gtk: fix event handling on choice%
Button-click handling foir `choice%` could continuously
re-queue an event that isn't handled by default, leading
to stack overflow and a crash.
2014-11-02 09:14:29 -07:00
Matthew Flatt
795d26a673 setup/dirs: don't include (find-dll-dir) in (get-lib-search-dirs)
I don't see a reason to include `(find-dll-dir)` in the result of
`(get-lib-search-dirs)`. It's practically always redundant, and
including it causes problems for sandboxes --- since `(find-dll-dir)`
must inspect the Racket executable on Windows and Mac OS X, and that
access is normally not allowed by a sandbox.
2014-11-02 08:40:29 -07:00
Matthew Flatt
822541e0a0 sync version in "base" package 2014-11-02 07:33:46 -07:00
Leif Andersen
627c775b6f Add 'subprocesses mode to current-process-milliseconds 2014-11-02 06:41:59 -07:00
Asumu Takikawa
566668e0b9 Adjust type of log-level? for recent changes 2014-11-01 21:48:18 -04:00
Matthew Flatt
0b200abe63 unbreak GC for Linux and some other Unix variants
Corrects another problem with cceda78374.
2014-11-01 14:08:11 -06:00
Matthew Flatt
fe557c0e93 Cygwin: one more repair
Also, add a missing dependency that caused me to miss this correction
before.
2014-11-01 10:42:28 -06:00
Matthew Flatt
cdf0dc8ed2 Windows: MinGW fixes 2014-11-01 08:17:52 -06:00
Matthew Flatt
cceda78374 restore Cygwin support
Fix various configuration problems, and make the build work with 3m
(probably for the first time).

The repairs include corrections for the manual link table, but also
switch Cygwin to relying on normal DLL exports, instead, to work
properly with the FFI.

The `--enable-shared` comfiguration option is no longer required for
Cygwin. When it is used, the `gracket` launcher does not work right,
because the Cygwin DLL is in the "bin" directory and "gracket.exe" is
in the "lib" directory. Along similar lines, stand-alone executables
won't work with `--enable-shared`.

The change to `ffi/winapi` makes it match the documentation.
2014-11-01 06:50:24 -06:00
Matthew Flatt
d7ee4c3fb5 change logger terminology: "name" => "topic"
Originally, the symbolic "name" of a logger was just a string to
prefix any message sent to a logger. The symbol has evolved instead
into a first-class component of an event to be used for message
selection and filtering; the word "topic" more clearly communicates
that role.

This is just a documentation change. The `logger-name` function would
be better called `logger-default-topic`, but it's staying the same for
compatibility.

Based on comments from Tony Garnock-Jones.
2014-10-31 16:48:41 -06:00
Matthew Flatt
58eb802468 add log-all-levels and log-level-evt
These two functions allow the creation of relays that receive events
on logger B where there are interested receivers for logger A.

Based on comments from Tony Garnock-Jones.
2014-10-31 16:48:41 -06:00
Matthew Flatt
38ac6e052c compiler/cm: filtered logging propagation instead of manual
With the new propagation-filtering support, CM's accomplice channel
doesn't need a receiver that accepts all events, and so less logging
logging work will be triggered during compilation.
2014-10-31 16:48:29 -06:00
Matthew Flatt
159c82fc4a make-logger: support specification of events to propagate
Events to propagate to a parent are described in the same way
as events to receive for a log receiver. The default is still
to propagate all events to the parent, which corresponds to
a propagation specification of 'debug.

Making a propagation-filtering specification built-in, instead of
allowing arbitrary filter functions, keeps `log-level?` efficient and
avoid hooks that might be implemented by untrusted code.
2014-10-31 16:48:29 -06:00
Matthew Flatt
83b4595741 log-level?, log-max-level: accept optional name argument
Change `log-error`, etc., to check the name that will be used for
the message, in addition to the log level.
2014-10-31 16:48:29 -06:00
Matthew Flatt
65e323d266 make-logger: rescind optional callback argument
The optional callback argument was added (by me) in f2d87085. This is
a backward-incompatible change, but allowing an arbitrary callback
on a logger now seems like an especially bad idea; forms like
`log-error` otherwise work in constrained contexts, while an arbitrary
callback function allows potentially untrusted code in those contexts.
Meanwhile, the addition doesn't satisfactorily solve the original
problem, since it intereferes with `log-level?` and similar filters.
2014-10-31 16:48:29 -06:00
Ryan Culpepper
a02beaa821 check-require: fix submod-related bugs 2014-10-31 15:13:14 -04:00
Robby Findler
73f4fa86a3 Replace the racket/list shuffle function with
the fisher-yates shuffling algorithm.

Thanks to Daniel Prager for the push to fix this and doing
most of the work.

The timing tests below seem to indicate that it takes a constant
amount of time per element (about 1/7th of a microsecond per element
on my laptop) and even for 10 element lists it runs faster than
the sort-based version that this code replaces.

Below is some code that I used to explore the shuffles. I used Mike
Bostock diagrams (http://bost.ocks.org/mike/shuffle/compare.html)
to double check that the FY algorithm was implemented properly.

 #lang racket/gui
(require pict)

;; some shuffling algorithms:

(define (st-shuffle l)
  (sort l < #:key (λ(_) (random)) #:cache-keys? #t))

(define (fy-shuffle l)
  (define a (make-vector (length l)))
  (for ([x (in-list l)] [i (in-naturals)])
    (define j (random (add1 i)))
    (unless (= j i) (vector-set! a i (vector-ref a j)))
    (vector-set! a j x))
  (vector->list a))

(define (naive-swap-random->random l)
  (define v (apply vector l))
  (define len (vector-length v))
  (for ([x (in-range len)])
    (define n (random len))
    (define m (random len))
    (define t (vector-ref v n))
    (vector-set! v n (vector-ref v m))
    (vector-set! v m t))
  (vector->list v))

;; replication of the ``Will it Shuffle?'' diagram

(define green '(0 100 0))
(define red '(165 42 42))

(define (shuffle-pict shuffle size)
  (define pict-size 300)
  (define sq-size (/ pict-size size))
  (define v (build-vector size (λ (i) (make-vector size 0))))
  (define ht (make-hash))
  (define l (build-list size values))
  (define shuffles 10000)
  (for ([x (in-range shuffles)])
    (for ([x (in-list (shuffle l))] [i (in-naturals)])
      (define r (vector-ref v x))
      (vector-set! r i (+ (vector-ref r i) 1))))
  (apply
   hc-append
   (for/list ([r (in-vector v)])
     (apply
      vc-append
      (for/list ([e (in-vector r)])
        (colorize (filled-rectangle sq-size sq-size #:draw-border? #f)
                  (triple->color
                   (sq-color shuffles size e))))))))

(define (sq-color shuffles size n)
  (define mid-point (/ shuffles size))
  (cond
    [(<= n mid-point)
     (interp-color red
                   (- 1 (map-between (/ mid-point 3) mid-point n)))]
    [else
     (interp-color green (map-between mid-point (* mid-point 3) n))]))

(define (map-between lower-bound upper-bound n)
  (cond
    [(<= lower-bound n upper-bound)
     (/ (- n lower-bound) (- upper-bound lower-bound))]
    [(<= n lower-bound) 0]
    [else 1]))

(define (interp-color color %)
  (define (i n) (- 255 (* (- 255 n) %)))
  (list (i (list-ref color 0))
        (i (list-ref color 1))
        (i (list-ref color 2))))

(define (triple->color triple)
  (define (get n) (inexact->exact (floor (list-ref triple n))))
  (make-object color% (get 0) (get 1) (get 2)))

(module+ test
  (require rackunit)
  (check-equal? (map-between 10 110 0) 0)
  (check-equal? (map-between 10 110 10) 0)
  (check-equal? (map-between 10 110 20) 1/10)
  (check-equal? (map-between 10 110 100) 9/10)
  (check-equal? (map-between 10 110 150) 1)
  (check-equal? (sq-color 1000 10 0) red)
  (check-equal? (sq-color 1000 10 100) (list 255 255 255))
  (check-equal? (sq-color 1000 10 1000) green))

(define (pictures)
  (values
   (shuffle-pict st-shuffle 60)
   (shuffle-pict fy-shuffle 60)
   (shuffle-pict naive-swap-random->random 60)))

;; timing tests

(define (time-it a-shuffler size iters)
  (printf "~a ~a ~a " (object-name a-shuffler) size iters)
  (flush-output)
  (define l (build-list size values))
  (collect-garbage) (collect-garbage) (collect-garbage)
  (time (for ([x (in-range iters)])
          (a-shuffler l))))

(define (timings)
  (time-it fy-shuffle 10 100000)
  (time-it fy-shuffle 100 10000)
  (time-it fy-shuffle 1000 1000)
  (time-it fy-shuffle 10000 100)

  (time-it st-shuffle 10 100000)
  (time-it st-shuffle 100 10000)
  (time-it st-shuffle 1000 1000)
  (time-it st-shuffle 10000 100))

(module+ main (timings))
2014-10-31 13:26:50 -05:00
Asumu Takikawa
d6b3434cc6 Fix type for window<%> for TR
Closes PR 14812
2014-10-31 11:16:03 -04:00
Asumu Takikawa
b7eeaf7608 Fix ordering issue in typechecking inner calls
Closes PR 14810
2014-10-30 03:22:09 -04:00
Asumu Takikawa
7829776f72 Add suppport for weak boxes in TR
Closes PR 14771
2014-10-30 03:22:09 -04:00
Burke Fetscher
cd00bc0595 redex: keep syntax info for nt aliases 2014-10-29 16:22:19 -05:00
Burke Fetscher
8ffa22dab6 redex: differentiate nts from different langauges 2014-10-29 16:22:19 -05:00
Burke Fetscher
f22d058aee redex: record nt syntax info for extended language 2014-10-29 16:22:19 -05:00
Stephen Chang
aed26e5178 fix typos in "Building New Contract Combinators" guide 2014-10-29 17:01:58 -04:00
Stephen Chang
ef34c5db01 restore set/c default #:kind to 'immutable; update tests and docs to match 2014-10-29 16:47:58 -04:00
Stephen Chang
40422d35d3 change set/c default #:kind to dont-care, to match docs
- add set/c tests
2014-10-29 16:31:25 -04:00
Robby Findler
3d2fdbc8cf small tweaks to raco show-dependencies
- print '#%kernel instead of (quote #%kernel)
- add -l for more human-friendly output that shows direct requires
2014-10-29 09:06:25 -05:00
Ryan Culpepper
e35019d4dc simplify paths before using as hash keys 2014-10-29 08:54:57 -04:00
Ryan Culpepper
095176736d db: add empty string test for "text" type 2014-10-29 08:54:57 -04:00
Asumu Takikawa
872e21eff1 Fix/add base-env types for Ref 14.4.3 2014-10-29 01:08:21 -04:00
Leif Andersen
6087d11a36 XFORM_END_SKIP -> XFORM_SKIP_PROC in example.
The XFORM_SKIP_PROC example incorrectly used XFORM_END_SKIP,
it should have used XFORM_SKIP_PROC instead.
2014-10-28 20:45:43 -04:00
Robby Findler
e18f8e904f simplify the drracket/check-syntax documentation a little 2014-10-28 17:10:21 -05:00
Robby Findler
0fa5f866ae make path->relative-string/library use "<doc>/...." prefixes files in the docs 2014-10-28 17:09:53 -05:00
Robby Findler
54fc2cd939 document setup/main-doc 2014-10-28 17:09:52 -05:00
Robby Findler
fa413f14a9 try to take the autowrap bitmap into account when sizing the repl input box 2014-10-28 17:09:52 -05:00
Robby Findler
00a7eaca2c adjust the wrap-bitmap-width field to always have an inexact number 2014-10-28 17:09:52 -05:00
Robby Findler
5052e82518 add the get-autowrap-bitmap-width method to text% 2014-10-28 17:09:52 -05:00
Asumu Takikawa
64bc7d4e85 Send thunks to check-syntax for type tooltips
This avoids the cost of computing the printed types
to some degree. It still does have overhead (~5%) over
not computing anything related to tooltips because of
the cost of traversing the type table and computing
tooltip locations.
2014-10-28 17:41:58 -04:00
Sam Tobin-Hochstadt
8582d94507 Add implies from typed-racket-lib to unstable-contract-lib.
Typed Racket, as of 8ea8c54eb, can add explicit require lines
to the expanded module, which can confuse the dependency
analyzer. An explicit implies declaration avoids the problem,
although I'm not sure that this is the right solution.
2014-10-28 15:12:32 -04:00
Sam Tobin-Hochstadt
8ea8c54eb4 Avoid requires of contracts when they're not used.
This changes when various libraries that provide contract
support to possible contracted bindings to declare when
those bindings are needed.

Probably, each static-contract combinator should manually
add to the list, instead of having one fixed static list,
but this is a start.

Saves about 10ms in startup for an empty TR module on my
laptop.

Thanks to Robby for the idea.
2014-10-28 12:04:49 -04:00
Robby Findler
ed0fa5da5b another attempt to eliminate references to the original
installation directory from the drracket tool docs

please include in 6.1.1
2014-10-28 11:03:42 -05:00
Matthew Flatt
8e34ef3a9d libffi: fix problems with gcc-4.0 on 32-bit Mac OS X
Based in part on https://trac.macports.org/changeset/122079
2014-10-28 08:06:13 -06:00
Robby Findler
01b0c11249 generalize the support for mouseover tooltips so that
the computation of the string doesn't have to happen
during macro expansion, but can happen only when check syntax
is in the picture
2014-10-28 08:25:37 -05:00
Robby Findler
6d4b708851 move find-string tests into the wxme test suite 2014-10-28 08:25:37 -05:00