Commit Graph

1077 Commits

Author SHA1 Message Date
Matthew Flatt
9372862ee2 GC: move minor work to clean-up phase instead of setup 2015-09-08 07:39:48 -06:00
Matthew Flatt
7eee429705 avoid traversing table of JITted code names on every GC
The table as a tree is traversed to prune empty branches,
but the travseral is needed only toward branches that
have changed. Skipping the traversal can save several
milliseconds on each collection.
2015-09-08 07:39:48 -06:00
Matthew Flatt
c401d86bb3 streamline name handling in make-struct-type
Name handling formerly interned symbols along the
way to allocating a plain string, which takes effort
and causes changes to the symbol table, which forces
a minor GC to traverse the whole symbol table. Skip
unnecessary symbol-interning steps.
2015-09-08 07:39:48 -06:00
Matthew Flatt
0ab94dd3e4 force GC more appropriately on phantom bytes
When the number of bytes recorded via phantom bytes approaches memory
use at the last GC, force a garbage collection.
2015-09-08 07:39:48 -06:00
Gustavo Massaccesi
27791ebab7 Remove ignored call/cc
Reduce (call/cc (lambda (<ignored>) body ...)) to (begin body ...)
2015-09-08 09:13:44 -03:00
Matthew Flatt
5ca752c92b fix problems with internal calls to syntax-track-origin 2015-09-07 08:22:21 -06:00
Matthew Flatt
4cb74da76c add patch for Mac OS X build of Cairo
Pull in a patch to avoid CGFontGetGlyphPath, which is deprecated.
2015-09-06 17:18:35 -06:00
Matthew Flatt
8566c67b35 make syntax-object unmarshaling more accepting
Defend against certain bad encodings, but accept an encoding
that includes more sharing than the built-in marshaling
could create.
2015-09-06 16:37:31 -06:00
Matthew Flatt
079f46fbc1 adjust top-level handling for identifiers without #%top
Refine the changes in 16c198805b so that `(define id ... id ... )` at
the top level compiles more consistently when `id` is an identifier
whose lexical context does not include `#%top`.
2015-09-06 08:06:07 -06:00
Matthew Flatt
c3f876d2f7 fix bug in mashaling paths
The change in commit fb8e08a2ac could lose part of a relative path.
2015-09-05 14:09:38 -06:00
Matthew Flatt
16c198805b prevent compile from binding in the current namespace
When `compile` is used on a top-level definition, do not
create a binding in the current namespace, but arrange for
a suitable binding to be in place for the target namespace.

Closes #1036
2015-09-05 10:58:44 -06:00
Matthew Flatt
24592f78fc ffi/unsafe/objc: add support for blocks
Also add some functions for manipualting classes and objects.
2015-09-04 08:31:52 -06:00
Matthew Flatt
8ee717520f fix sync when resumed after a break exception
This repair adjusts the bug fix of commit 769ad3e98. That older commit
ensured that `sync/enable-break` doesn't both break and accept a
channel message or semaphore wait. But it effectively disables those
actions if the break is continued.

Instead of (partially!) ending the `sync` get out of semaphore
and channel queues so that no event can be selected during
the break, and then get back in line if the break is continued.
2015-09-02 18:21:38 -06:00
Matthew Flatt
fb8e08a2ac adjust path encoding in bytecode and syntax-object sources
When a path is made relative for marshaling to bytecode, record
a list of byte strings in stead of a platform-specific relative
path.

For syntax-object source locations, convert any non-relative path to a
string that shows just the last couple of path elements preceded by
".../". This conversion avoids embedding absolute paths in bytecode,
but at the cost of some information. A more complete and consistent
solution would invove using a module-path index instead of a path, but
that would be a big change at several layers.
2015-09-02 18:21:38 -06:00
Matthew Flatt
a934bdf444 Adjust the bytecode format to accomodate syntax source locations
Make room in the bytecode format for source locations and 'paren-shape
property values for syntax objects. Saving source locations increases
bytecode size by about 10% on average.

Also, convert the internal representation of syntax properties to
use immutable hash tables, instead of lists.
2015-09-02 14:49:39 -06:00
Matthew Flatt
53821a4997 intern path values in bytecode 2015-09-01 15:54:41 -06:00
Matthew Flatt
929db29b67 add prop:expansion-contexts
The `prop:expansion-contexts` property can control the expansion
of a rename transformer in much the same that conditionals on
`(syntax-local-context)` can control the expansion of other
transformers.
2015-09-01 13:55:35 -06:00
Gustavo Massaccesi
c290de0f88 Fix typos 2015-09-01 11:46:41 -05:00
Blake Johnson
38317b87c2 setting the imported flag on toplevels 2015-08-31 16:13:08 -06:00
Matthew Flatt
9c0b6593b6 filesystem-change-evt: wide paths for Windows 2015-08-30 12:20:40 -06:00
Matthew Flatt
73e5313e1c fix starter icons for Windows cross-compile 2015-08-30 10:58:07 -06:00
Matthew Flatt
1b778bf34b fix GRacket paths for MinGW build 2015-08-30 07:01:10 -06:00
Matthew Flatt
6beff43439 fix expand[-syntax[-to-top-form]] to add namespace's scope
Make `expand` more consistent with `eval` and with the old expander.
2015-08-29 11:44:33 -06:00
Matthew Flatt
94e5b1723b JIT simplification
Remove unused and confusing attempt to avoid runstack sync.
2015-08-28 20:24:46 -06:00
Matthew Flatt
ab6b58a476 avoid compiler warning 2015-08-28 20:21:29 -06:00
Gustavo Massaccesi
152787cb0e JIT: inline string=? and bytes=? 2015-08-28 20:57:39 -03:00
Matthew Flatt
79738d3bf6 fix no-places build 2015-08-28 17:27:17 -06:00
Matthew Flatt
bfb4d34715 fix memory accounting for useless channels
Fix accounting for a channel that is without a
peer for sending and/or receiving.
2015-08-28 17:05:38 -06:00
Matthew Flatt
b016246096 avoid interferences among places for memory accounting
All places uses the same accounting bit for objects
that are in the shared space. Each place also flips
the bit value it wants on each accounting, so if two
places are accounting at the same time with opposite
bit values and can reach the same objects, they can
interefere. It's even possible for them to race
through cycles and cause each other to loop forever.

Add a lock to ensure that there's only one bit value
in play for the shared space at any given time. A
place must stall if other places are busy with memory
accounting and an opposite bit value.
2015-08-28 17:05:37 -06:00
Matthew Flatt
a9078196b7 fix GC problem with in-flight place messages
While a place message is received by a thread but not yet
deserialized, if the message contains references to objects in the
shared space, and if a "master" GC happens (which crosses all places),
make sure that the references in the still-serialized message are
traversed.
2015-08-28 17:05:37 -06:00
Matthew Flatt
2773737c9c avoid races in marking shared-space objects
Although the race condition for setting mark bits
shouldn't matter, reasoning about the race is
difficult and asking for trouble, so don't do it.
2015-08-28 17:05:37 -06:00
Matthew Flatt
460743021d fix over-counting of place-message channel memory 2015-08-28 17:05:37 -06:00
Matthew Flatt
d71832f20e another MSVC MzCOM repair
Missed a line that was meant to be included with
commit a98947e81e.
2015-08-27 14:35:55 -06:00
Matthew Flatt
29784bda8e add cross-system-type and cross-system-library-subpath
Adjust installation tools to support cross-installation (i.e.,
installation for a platform other than the current one) as triggered
by "system.rktd" in "lib" having different information than the
running Racket executable.
2015-08-27 12:01:31 -06:00
Matthew Flatt
a98947e81e fix MSVC MzCOM build 2015-08-27 10:00:54 -06:00
Matthew Flatt
d4fb5ecec5 fix "GRacket.exe" capilization for MinGW build 2015-08-27 08:44:10 -06:00
Matthew Flatt
a3972487fb unbreak Linux build 2015-08-27 07:10:08 -06:00
Matthew Flatt
2a9022945d support for building MzCOM with MinGW 2015-08-26 14:07:19 -06:00
Matthew Flatt
828aff1476 unbreak non-Windows build 2015-08-26 10:02:02 -06:00
Matthew Flatt
ba7e2f11ec repair MinGW32 builds
Also, change floating-point handling to be like the MSVC build by
default, where the process is left in double-precision mode and
the mode is changed for exfl operations.

Includes repairs for integer-size mismatches in uses of Windows
threads.
2015-08-26 07:00:51 -06:00
Asumu Takikawa
fadcb78ffa Fixes to prop:rename-transformer
The error message for the guard used an incorrect contract.
Also removed an unused line that allows a box value in the
property. I don't think it was possible to trigger this line
anyway because of the dynamic check.
2015-08-25 08:20:49 -06:00
Blake Johnson
d86ccb1330 initializing ui->closures in the right place 2015-08-25 08:11:26 -06:00
Matthew Flatt
3d452fdba6 raco exe: make Windows exes as proper PE32 images
Instead of simply tacking bytecode onto the end of an executable,
generate a proper PE32 image.
2015-08-24 17:12:11 -06:00
Matthew Flatt
d16c5c08b6 Windows: update default icons
Includes a 256x256 icon.
2015-08-24 17:12:11 -06:00
Matthew Flatt
b9a5e92c37 file-truncate: flush on Windows before truncating
Otherwise, writes to the output port can get lost.
2015-08-24 15:08:21 -06:00
Matthew Flatt
cbb4ffee4d JIT: replace a multiplcation with a shift
In the implementation of `with-continuation-mark`.
2015-08-24 12:20:31 -06:00
Matthew Flatt
620ccbfa03 JIT: streamline values result delivered to let-values
In a case like

  (let-values ([(X ...) (with-continuation-mark M_k M_v
                          (values M ...))])
     ....)

where the bytecode compiler cannot convert to a sequence of `let`
bindings, make the JIT implement `values` as delivering argument
results directly to the corresponding variable locations.
2015-08-24 12:20:30 -06:00
Blake Johnson
674ab66d7b Added support for ref args in lifts to unresolver 2015-08-18 14:40:41 -06:00
Matthew Flatt
629697d14a remove accidentally added file 2015-08-17 12:36:51 -06:00
Matthew Flatt
1b493f2146 fix MzCOM's atexit replacement 2015-08-17 10:16:02 -06:00
Matthew Flatt
641c56b6e9 repair leak in managing OS-level locks 2015-08-17 09:51:20 -06:00
Matthew Flatt
693cdc673d GC: use ofm_malloc() and ofm_free() for admin allocation
Using ofm_....() makes it easier to check that memory allocated for GC
administrtation is itself reclaimed.
2015-08-17 09:39:11 -06:00
Matthew Flatt
fea2b1ce5e repairs for MinGW build
Fix compiler warnings and installation bugs related to the
".exe" extension.
2015-08-17 08:32:12 -06:00
Matthew Flatt
0caf079637 add syntax-local-lift-module 2015-08-14 16:52:56 -06:00
Matthew Flatt
111a7e085d fix prefab checking in printer
Mishandling of a chaproned prefab when, for example, determining
whether to use quoted printing caused the `tests/compiler/zo` test to
sometimes fail.
2015-08-14 07:28:37 -06:00
Matthew Flatt
e82e61e84c restore needed call in unresolver
Add back a call incorrectly removed in bd82646d81.
2015-08-13 18:22:51 -06:00
Gustavo Massaccesi
07816f2ca4 Use scheme_getenv in eval.c 2015-08-13 19:05:40 -03:00
Blake Johnson
12315ec964 using correct inspector for unresolved module 2015-08-13 15:13:46 -06:00
Juan Francisco Cantero Hurtado
f3098a946a Fix an error in racket-test-core/number.rktl on OpenBSD-current/sparc64
"Errors were:
(Section (got expected (call)))
((numbers) (0.0 -0.0 (#<procedure:round> -0.0)))
((numbers) (125.0+0.0i 125.0-0.0i (#<procedure:z-round> 125.00000000000023-0.0i)))
((numbers) (100.0+0.0i 100.0-0.0i (#<procedure:z-round> 99.99999999999999-0.0i)))"
2015-08-13 15:13:46 -06:00
Matthew Flatt
33cf716835 include phantom bytes consistently in memory-use reports 2015-08-13 15:13:46 -06:00
Matthew Flatt
bd82646d81 avoid compiler warnings 2015-08-13 11:57:06 -06:00
Matthew Flatt
7741b4b361 local-expand: fix argument checking
Also, fix contract in the docs, since the first argument is allowed to
be an S-expression.
2015-08-13 11:48:20 -06:00
Matthew Flatt
02574d2501 SGC: use PRIdPTR and PRIxPTR
Avoid compiler warnings by using the right format string.
2015-08-12 14:48:11 -06:00
Matthew Flatt
956d538164 fix missing zero of allocated atomic memory in unresolver 2015-08-11 16:01:54 -06:00
Blake Johnson
d39801c937 ref_args off by one 2015-08-11 16:01:54 -06:00
Matthew Flatt
13bd013528 fix JIT-inlined set-cpointer-tag! for non-x86 2015-08-11 16:01:53 -06:00
Matthew Flatt
820ab7126c fix enum mismatch in ARM JIT
Also, recognize `__ARM_ARCH_6ZK__`.
2015-08-11 16:01:53 -06:00
Matthew Flatt
1757348b23 repairs for MSVC
Don't use `for (int i ....`, which is too modern.
2015-08-10 17:14:09 -06:00
Blake Johnson
fbe8537f18 add compiled-expression-recompile
Uses an unresolver pass, which is expanded to work on more programs.
2015-08-10 16:39:43 -06:00
Matthew Flatt
2661d46929 toward deterministic bytecode generation
Progress toward making the bytecode compiler deterministic, so that a
fresh `make base` always produces exactly the same bytecode from the
same sources. Most changes involve avoiding hash-table order
dependencies and adjusting scope identity. The namespace used to load
a reader extension is also better defined. Plus many other little
changes.

The identity of a scope that is unmarshaled from a bytecode file now
incorporates the hash of the file, and the relative order of scopes is
preserved in a bytecode file. This combination allows compilation to
start with modules that loaded and compiled in different orders
(including delayed loading of bytecode fragments within one file).

Formerly, a reader extension triggered by `#lang` or `#reader` was
loaded in whatever namespace happens to be current. That's
unpredictable and can pollute a module build at the level of bytecode.
To help make builds deterministic, reader extensions are now loaded in
a root namespace of the current namespace.

Deterministic compilation in general relies on deterministic macros.
The two most common ways for a macro to be non-deterministic are by
using `gensym` (use `generate-temporaries`, instead) and by using an
unsorted hash-table traversal (don't do that).

At this point, bytecode generation is unlikely to be completely
deterministic, since I uncovered non-determinism mostly by iterating
attempts over the base collections. For now, the intent is not to
provide guarantees outside of the compilation of the base collections
--- but "more deterministic" is likely to be useful in the short run,
and we can improve further in the long run.
2015-08-07 15:48:39 -06:00
Matthew Flatt
0efd052218 fix single-float hashing 2015-08-07 05:30:25 -06:00
Matthew Flatt
6bcb449b55 fix impersonator-property:application-mark propagation
Propagate the mark value only if it's on the current continuation
frame, as originally intended. Adjust the docs to clarify.
2015-08-07 05:30:25 -06:00
Matthew Flatt
0480f55f67 add with-immediate-continuation-mark bytecode form
Specialize a
  (call-with-immediate-continuation-mark _key (lambda (_arg) _body) _def-val)
call to an internal
  (with-immediate-continuation-mark [_arg (#%immediate _key _def_val)] _body)
form, which avoids a closure allocation and more.

This optimization is useful for contracts, which use
`call-with-immediate-continuation-mark` to avoid redundant
contract checks.
2015-08-07 05:30:25 -06:00
Matthew Flatt
c308915047 minor streamlining of foreign-call path
JIT-inline `cpointer-tag` and `set-cpointer-tag!`, plus minor
shortcuts and GC hints in Racket->C conversion.
2015-08-06 14:44:30 -06:00
Matthew Flatt
bf76ced8ba work around EPERM error from access()
On OS X, it seems that access() can sometimes fail with EPERM
when checking for execute permission on a file without it.
I've previously seen this result when running as the superuser,
but that's apparently not the only possibility; a long path
may also be relevant.
2015-08-01 21:59:19 -06:00
Matthew Flatt
086d02003a fix linking of compiled reference to a top-level variable
Re-linking in a new namespace doesn't need the namespace of
compilation.

A "namespac.rktl" test exposed this problem, where the "transfer a
definition of a macro-introduced variable" test could fail if a GC
occurred between compilation in one namespace and evaluation in
another.
2015-07-31 11:17:25 -06:00
Matthew Flatt
1f2e0dacb3 minor adjustments
SGC header correction plus extra assert.
2015-07-31 07:32:34 -06:00
Gustavo Massaccesi
a1f04604df JIT: Inline keyword? 2015-07-30 21:27:26 -03:00
Jay McCarthy
2602ff530d Adding no major collection guarantee to collect-garbage minor collections 2015-07-30 11:42:13 -06:00
Jay McCarthy
2f22f86c0a Adding minor collections to collect-garbage 2015-07-30 11:42:13 -06:00
Matthew Flatt
26158a51d2 raise-syntax-error: fix srcloc reporting on #f as 3rd arg 2015-07-29 11:54:18 -06:00
Matthew Flatt
7864436594 fix top-level scope introduction
Although `eval-syntax` is not supposed to add the current namespace's
"outer edge" scope, it must add the "inner edge" scope to be consistent
with adding the inner edge to every intermediate expansion (as in
other definition contexts).

In addition, `eval`, `eval-syntax`, `expand`, and `expand-syntax`
did not cooperate properly with `local-expand` on the inner edge.
2015-07-28 13:14:00 -06:00
Rui Paulo
84996ff2ac sconfig: FreeBSD uses clang. 2015-07-25 20:57:59 -06:00
Rui Paulo
6dd1aa0cd8 sconfig: add FreeBSD/arm. 2015-07-25 20:57:40 -06:00
Matthew Flatt
98bd78e7f0 remove unused counter 2015-07-25 20:56:09 -06:00
Matthew Flatt
5e2b6c2b74 JIT: repair some runstack-pointer syncs
Some failure paths were missing an update before calling failure
code, and the new failure paths need to unconditionally update the
runstack pointer (because the common stub doesn't know whether the
calling context needs an update).
2015-07-25 20:49:58 -06:00
Gustavo Massaccesi
8430daa628 Jitinline string-length and bytes-length
Previously only the unsafe versions were inlined in the jit compiler.
2015-07-25 20:31:44 -03:00
Matthew Flatt
9593b4c806 make-syntax-introducer: add optional argument to change kind of scope
Genereating a use-site scope, instead of a macro-introduction scope,
prevents the scope's presense from triggering a #f result from
`syntax-original?`.
2015-07-25 14:37:54 -06:00
Matthew Flatt
1d380864e9 remove accidentally committed debugging change 2015-07-23 09:09:03 -06:00
Matthew Flatt
f4d05aaba8 fix bytecode-marshaling problem related to rename transformers 2015-07-23 08:04:34 -06:00
Matthew Flatt
120f1329c6 change bytecode marshaling of scopes
This change mostly reverts 1465ff25fc, which turned out to be a hassle
because it created more cyclic structure.

A simpler strategy is to allow a phase-specific scope to be detached
(perhaps temporarily, due to on-demand loading of bytecode) from its
group; when that's possible, the scope is not reachable from a place
where it can be moved to other syntax objects, so it's ok to be
detached. Debugging output needs to handle that gracefully, though.
Also, in case of broken bytecode, fix up a detached scope if it
does end up in an unexpected place.
2015-07-23 08:04:34 -06:00
Matthew Flatt
176777b05f adjust transfer of compiled in one namespace and run in another
Formerly, compiling a definition in one namespace and evaluating it in
another would cause the definition to take place in the original
namespace --- unless the compiled code is marshaled to a byte string
and back. Adjust the "linking" process to redirect the variable
definition and any references to the new namespace. (This is a change
relative to the compiler with the old macro expander.)

Also, repair a compiled `require` form along similar lines. (This is
*not* a change relative to the compiler with the old macro expander;
the mismatch is part of the motivation for changing `define`
handling.)
2015-07-22 10:54:31 -06:00
Matthew Flatt
1465ff25fc in ".zo", keep module's set of scopes together
For a set of phase-specific scopes that correspond to the "inside
edge" of a module, make sure the whole set is marshaled together.
2015-07-21 12:50:48 -06:00
Matthew Flatt
57ea02616c fix inspector tracking in syntax objects
Repair a NULL vs. #f mismatch.
2015-07-20 13:41:04 -06:00
Matthew Flatt
3d87d61039 fix expansion loop in a definition context
Add the current definition context's scope to any expression that is
produced by macro expansion before trying to expand again, in case the
expansion needs to refer to a definition introduced by a previous
expansion.

Previously, the scope was added before any expansion and after any
expansion, but that misses intermediate points.

The old expander had this bug, too (some of the new tests fail there),
but it showed up less often and was sometimes considered correct, for
various reasons.
2015-07-20 13:20:03 -06:00
Matthew Flatt
0bc5a1b06a fix nested begin-for-syntax
Initialize a phase-2 namespace before trying to use it.
2015-07-19 12:07:53 -06:00
Gustavo Massaccesi
597eb161f5 avoid compiler warning 2015-07-18 20:44:36 -06:00
Matthew Flatt
1eba8ac2a7 fix place-channel support for eq[v] hash tables
Bug caught by an existing test.
2015-07-18 20:44:36 -06:00
Matthew Flatt
053cfc0ddb fix an incorrect simpliciation in the GC
I had tried to simplify the "generation 0" allocation function to
always use `GEN0_PAGE_SIZE`, but "generation 0" is also used for place
messages, in which case a much smaller size should be used.

The "place-in-channel-fnl.rkt" test exposed this problem.
2015-07-17 09:55:17 -06:00
Matthew Flatt
123f724c47 fix GC problem with chains of ephemerons
A recent GC change (included with the set-of-scopes expander)
allows the GCs marking procedure to recur directly to a limited
depth, instead of always pushing pointers onto a stack. Direct
recursion is not cmopatible with ephemeron-resolution process,
so switch to no-recur mode.

This problem was uncovered by an existing test.
2015-07-17 02:10:04 -06:00
Matthew Flatt
dd0ced3c02 avoid compiler warnings 2015-07-16 21:04:01 -06:00
Matthew Flatt
aaee824f68 optimizer: fix coordinate shift when a letrec is split
The combination of splitting a `letrec` and optimizing
the resulting `(let ([x <proc>]) x)` to just `<proc>`
used a bad coordinate shift, which made property testing
incorrect, etc.

For reasons that are not clear, the new expander triggered
the problem through an existing test.
2015-07-16 18:18:58 -06:00
Matthew Flatt
b72dceb865 avoid excessive fallbacks via eval-syntax
The `eval-syntax` function (which is used by other functions, such as
loading a module) should not install fallback-binding scopes from
the current namespace.
2015-07-16 14:20:00 -06:00
Matthew Flatt
fc5e32e526 switch to set-of-scopes expander
The development history for set-of-scopes is preserved in a "scope"
branch in the main Racket repository, which is commit
 ae88c96f50
2015-07-16 14:20:00 -06:00
Matthew Flatt
bfc2b27d65 fix optimizer's single-use tracking, especially on inlining
When `(let ([x ...]) (let ([y x]) ... y ... y ...))` turns into
`(let ([x ...]) ... x ... x ...)`, make sure that `x` is not
still marked as single-use. Incorrect marking as single-use could
cause the optimizer to inline too much, for example.

Thanks to Gustavo for tracking down the problem.
2015-07-16 07:48:17 -06:00
Gustavo Massaccesi
bfc9eb8d62 Add ´not´ to the relevant predicates list
Previously all the predicates recognized only non-#f things, so ´not´ can be
added to the list of disjoint predicates. But many of the parts of the code
relied on the non-#f property and had to be modified.
2015-07-14 19:20:11 -03:00
Gustavo Massaccesi
dfc64053b7 Infer type from comparisons in test positions
In (if (eq? x <pred?-expr>) <tbranch> <fbranch>) infer that the type of
x is pred? in the tbranch.

Also, reduce (eq? x y) => #f when the types are different.
2015-07-14 19:19:50 -03:00
Gustavo Massaccesi
bc2cf531e3 Reduce variables with type null? and void? to null and #<void>
The optimizer reduces the variables with a known type to #t in a Boolean context.
But some predicates imply that the variable has a definite values, so they can be
reduced in a non-Boolean context too.

For example, in (lambda (x) (if (null? x) x 0))) reduce the last x ==> null.
2015-07-14 19:19:28 -03:00
Gustavo Massaccesi
58300857db Fix bug in type propagation to avoid the reduction of mutable variables
This fixes the bug twice:
* Don't reduce mutable variables with a type to #t in a Boolean context.
* Don't record the type of mutable variables when a predicate is
     checked in a test condition.
2015-07-14 19:19:05 -03:00
Gustavo Massaccesi
b7ae673ee0 Mark (values <expr>) as single valued
While reducing some ignored constructors, the optimizer may wrap the arguments
<expr> in (values <expr>) to ensure that it's a single value non-cm expression.
This avoids the unnecessary nesting of (values (values <expr>)).

Similarly, add the cases for begin and begin0 to single_valued_noncm_expression
2015-07-14 13:43:54 -03:00
Gustavo Massaccesi
d0c9a894fb Mark many port primitives as non-cm 2015-07-14 13:28:28 -03:00
Matthew Flatt
d6fa581a4c increase signal-handling stack size
On 64-bit Linux platforms other than x86_64 (e.g., AArch64), SIGSTKSZ
isn't big enough. Use a stack 10 times as large.
2015-07-03 12:41:37 -06:00
Matthew Flatt
ff492f9bb6 add comments on how page alisngment 2015-07-03 12:40:26 -06:00
Matthew Flatt
331b104345 JIT: inline ptr-ref and ptr-set!
Special treatment of `ptr-ref` and `ptr-set!` applies when the second
argument is one of a few primitive C types: `_int`, `_double`, etc.
2015-07-02 15:59:35 -06:00
Matthew Flatt
b782b9a4db fix no-places, no-futures build 2015-07-02 14:48:19 -06:00
Matthew Flatt
0cda0c98b0 fix GC for non-x86 64-bit platforms
A test for 64-bitness was broken, checking specifically for x86_64
instead of the general 64-bit flag.
2015-07-02 07:26:06 -06:00
WarGrey Gyoudmon Ju
8a817e577c disable HAVE_POLL_SYSCALL in solaris: poll(2) is the CPU eater, and this problem affects all TCP applications including plt-web-server. 2015-07-01 18:21:01 -06:00
Matthew Flatt
40f79dd72e configure: fix --enable-noopt
Broken by cf8c3c9cfe, which shifted optimization flags from
CFLAGS to PREFLAGS when using a gcc-stype preprocessor.
2015-06-30 16:27:34 -06:00
Gustavo Massaccesi
72132ea3aa Reoptimize propagated constants
Reduces them to #t or #f when they are copied to a Boolean context
2015-06-29 23:44:47 -03:00
Matthew Flatt
6f6a792d06 fix memory-management problem with #:lock-name
Repairs a bug in 290020c597.
2015-06-26 07:44:43 +08:00
Matthew Flatt
290020c597 ffi/unsafe: add #:lock-name option to _fun and _cprocedure
While `#:in-original-place? #t` provides one way to serialize
foreign calls, it acts as a single lock and requires expensive
context switches. Using an explicit lock can be more efficient
for serializing calls across different places.

For example, running "plot.scrbl" takes 70 seconds on my machine
in the original place and using `#:lock-name` in any place,
while it took 162 seconds in a non-main place with Cairo+Pango
serialization via `#:in-original-place? #t`.

Internally, the named lock combines compare-and-swap with a
place channel. That strategy gives good performance in the case
of no contention, and it cooperates properly with the Racket
scheduler where there is contention.
2015-06-25 10:35:22 +08:00
Matthew Flatt
9931d5ef1c avoid compiler warning 2015-06-24 07:17:39 +08:00
Matthew Flatt
f7e1fcd557 log a warning for shadowing an import with a definition 2015-06-24 07:15:29 +08:00
Gustavo Massaccesi
95bac91268 Propagate types form the body of let's forms and inlined functions
The optimizer was able to use the type information gained outside
the let's to reduce expressions inside the lets. For example, in
  (lambda (z) (car z) (let ([o (random)]) (pair? z)))
it reduces (pair? z) ==> #t.

This enable the propagation in the other direction so in
  (lambda (z) (let ([o (random)]) (car z)) (pair? z))
it reduces (pair? z) ==> #t too.
2015-06-23 16:52:40 -03:00
Gustavo Massaccesi
1a091f535e Intersect types gathered in if branches 2015-06-23 16:46:23 -03:00
Matthew Flatt
ea016bec96 allow definition in module to shadow a preceding import
This change is experimental and intended to reduce (but certainly not
eliminate) the problem of breaking existing code by adding exports to
a module.
2015-06-23 21:31:57 +08:00
Matthew Flatt
ca57adcf2d fix slow leak in link-establishing thread-resume
Using `(thread-resume t1 t2)` would not prevent a GC of t1, but it
would create an intermediate record to make the link from t1 to t2,
and that intermediate record would leak due to a missing level of
indirection in a table-cleanup traveral. The leak not only accumulated
memory, it also caused ever slower traversals of the table in an
attempt to clean up.

(Since the leak is small and the leaking object is not directly
accessible, I don't have a good idea on how to test this repair
automatically, but see the program in the PR.)

Closes PR 15099.
2015-06-22 16:53:52 +08:00
Matthew Flatt
bf12a2bdd7 bump version number
Should have bumped it with the xform changes.
2015-06-07 09:03:01 -06:00
Matthew Flatt
d95200f19a remove setting of socket send buffer size
Modern OS configurations likely use an even larger buffer size, and
making it small can have substantial negative performance effects
(e.g., with PostgreSQL over TCP).
2015-06-06 10:50:44 -06:00
Matthew Flatt
4deacddde8 attempt to fix xform problem
Mark some pointer arithmetic as ok.
2015-06-06 09:21:23 -06:00
Matthew Flatt
cf8c3c9cfe adjust auto-configuration of CPPFLAGS vs. CFLAGS
When AC_PROG_CC picks GCC, move its selection of CFLAGS
into CPPFLAGS, so that preprocessing will have the same
optimization and debugging flags as compilation.

Arguably, AC_PROG_CC plus AC_PROG_CPP should do that
soemhow, but it's understandable that the autoconf
implementers didn't cover the possibility of
preprocessing that changes with the optimization level.

Closes #945
2015-06-06 07:55:14 -06:00
Matthew Flatt
298feb1bb6 fix problem with expand and local-require
When `local-require` is used in a non-phase-0 position and it is
`expand`ed (as opposed to compiled directly), then the generated
`#%require` form had the wrong binding phase.

Merge to v6.2
2015-05-15 10:44:20 -06:00
Gustavo Massaccesi
6c2888937a Make (make-vector <number>) omittable
In many use cases the length of the vector is fixed and know,
so we are sure that make-vector will not raise an error and
we can recognize these expressions as omittable and drop
them when the result is ignored.
2015-05-14 16:36:35 -03:00
Gustavo Massaccesi
2be6eb9570 Mark the result of more procedures as vector?
The result of some procedures is a vector, but they are not omittable
because they may rise an error. With the recent changes of the
predicate reduction these cases are correctly handled.
2015-05-14 16:36:21 -03:00
Matthew Flatt
6f984d868c fix expander problem with set! 2015-05-09 18:35:25 -06:00
Matthew Flatt
0304fedf92 Makefile: make SRC_CATALOG work for in-place and unix-style
Configure an in-place or unix-style build to use the given
SRC_CATALOG before the default catalogs.
2015-05-03 21:41:46 -07:00
Gustavo Massaccesi
4c10a9efac Check the type of the arguments of more procedures
The optimizer checks the type of the argument of some unary procedures and
uses the gathered information to replace them by the unsafe version, reduce
predicates and detect type errors. This extends the checks to more procedures
that have no unsafe version and procedures that have more than one argument.
2015-05-03 15:15:24 -03:00
Gustavo Massaccesi
e8ad90a14d Remove duplicate code in scheme_omittable_expr 2015-05-01 10:01:24 -03:00
Ryan Culpepper
d48840f23b Post-release version for the v6.2 release 2015-04-27 09:36:47 -04:00
Matthew Flatt
11939df0f2 fix custodian-managed-list for weakly held objects 2015-04-18 07:06:33 +01:00
Matthew Flatt
469763ca37 Adjust use of readtable argument in read/recursive
Use the given readtable more consistently to parse
delimiters in the top-level form. This change particularly
addresses problems with trying to restore the original
`(` when parsing a hash table, but allowing nested
forms to still use a different `(` mapping.
2015-04-15 13:01:58 -06:00
Matthew Flatt
16ce8fd90d fix an optimizer bug
Optimization of an identifier in a test position passed a
pre-optimization offset to a function that expects a
post-optimization offset.
2015-04-12 06:48:07 -06:00
Juan Francisco Cantero Hurtado
667b9e9b71 Clarify the minimum CPU requirements in README
The JIT needs SSE2, not just SSE.
2015-04-10 14:12:54 -06:00
Matthew Flatt
be1a63cf50 fix SSE detection to detect SSE2
SSE isn't enough, because the JIT needs SSE2
2015-04-10 14:03:44 -06:00
Matthew Flatt
8e22b22630 fix string-titlecase based on case-ignoreable chars
Fix extraction of case-ignorable characters from the Unicode
database.
2015-04-10 13:30:58 -06:00
Matthew Flatt
23ec573e51 repair chaperone handling in current-command-line-arguments 2015-04-06 12:44:47 -05:00
Matthew Flatt
f7d4f7b234 MinGW build repairs and improvements 2015-03-28 09:50:01 -06:00
Matthew Flatt
5fff8e2056 internal hooks to build "Racket.exe" without "libracket3m.dll"
For now, setting `libracket-dll?` to #f in
  racket/src/worksp/gc2/make.rkt
enables that build mode.
2015-03-28 09:50:01 -06:00
Jay Kominek
3ad60aa67a fix integer-length overflow (PR14986) improve performance on integer-length of negative bignums 2015-03-26 11:20:40 -06:00
Matthew Flatt
2dd29f7e3d fix pessimism in optimizer reordering
When determing whether expressions can be reordered, a reference to a
module-defined variable was considered unreorderable when it is
known to have a value and no further mutation, but the value isn't
constant across all runs.
2015-03-26 09:15:13 -06:00
Matthew Flatt
21d925d1f0 GC backtrace: add limited support for distinguishing new and old objects 2015-03-26 09:15:13 -06:00
Matthew Flatt
d7cea5a1db GC atexit: report total GC msecs 2015-03-19 10:01:10 -06:00
Sam Tobin-Hochstadt
f73b4066a7 Add prop:object-name. 2015-03-18 09:55:27 -04:00
Matthew Flatt
3c4ed61a42 fix no-extflonum build
Repairs over-eager commit 9c9e922b4a
2015-03-18 06:44:41 -06:00
Matthew Flatt
eb95960e7c fix memory-management bug in syntax-object lexical info 2015-03-18 04:44:57 -06:00
Matthew Flatt
9c9e922b4a support extflonum optimizations even without extflonum support
As suggested by Gustavo
2015-03-17 19:33:10 -06:00
Gustavo Massaccesi
7981513b95 More redutions of predicates
The optimizer had some reductions of predicates applications, like (pair? X),
only when X was very simple and the type of X was obvious.
Use expr_implies_predicate and make_discarding_sequence to allow
the reduction of more complex expressions.

Also, the reduction of procedure? and fixnum? were special cases in
optimize_application2. Move the checks to expr_implies_predicate
to take advantage of the reductions in more general cases.
2015-03-17 19:28:37 -06:00
Ryan Culpepper
bb48859c9b Post-release version for the v6.2 release 2015-03-17 07:38:54 -04:00
Matthew Flatt
eca0c18730 fix at-exit close handling for non-main place
This bug has been causing problems since the change to the `math`
library to register mpfr_free_cache() only once per place.
2015-03-13 12:30:31 -06:00
Matthew Flatt
4af6770ed4 initialize stack variable to make Valgrind happier
Although failing to initialize probably isn't a bug, fulling
initializing a buffer passed to epoll_ctl() seems like a good
idea.
2015-03-13 12:30:31 -06:00
Matthew Flatt
2e813c2aee GC: fix test for old-page compaction
Missing indirection found via memcheck
2015-03-13 12:30:31 -06:00
Matthew Flatt
7f5ed17222 remove special-casing of OS X and Linux for thread stack size
There doesn't seem to be a reason for the special case other than
history.
2015-03-13 12:30:31 -06:00
Matthew Flatt
332b380ca2 repair impersonator-porperty predicate and accessor
Repair for b923269569, helpfully reported again by Scott
2015-03-09 15:33:41 -06:00
Matthew Flatt
5749d4080c add tracking of require and provide subforms
Use `syntax-track-origin` and 'disappeared-use properties to
communicate `require` and `provide` form bindings to tools such as
Check Syntax.

Relevant to PR 13186
2015-03-09 15:28:08 -06:00
Matthew Flatt
59777ca17a increase time thread's stack size
On 64-bit FreeBSD 10.1, 4k is too small.
2015-03-09 13:33:19 -06:00
Matthew Flatt
b923269569 make impersonator properties sensitive to prop:impersonator-of
When a structure type has `prop:inpersonator-of`, follow it
when attemptng to access imperonator properties.

This change fixes a problem with `impersonate-procedure` as
reported by Scott Moore.
2015-03-08 19:27:11 -06:00
Matthew Flatt
c458cd9799 remove over-eager namespace cleanup in the compiler/expander
The compiler/expander attempted to clear out references in a namespace
used only during macro expansion, but it's possible for references to
be retained (via unusual macros), so get rid of the broken attempt to
help the GC.
2015-03-05 11:21:25 -07:00
Matthew Flatt
04ce921e8f fix optimize problem
Gustavo's tests in de3fa9a855 illustrate the problem. The solution
is simply passing 1 for `optimized_rator` to optimize_for_inline().
Additional changes generalize optimize_for_inline() a little (although
that generality doesn't seem to be useful at the moment) and collapse
some variables that represent the same value.
2015-02-27 10:01:09 -07:00
Matthew Flatt
6cf28d55cd fix memory-management problem in putenv
Problem reported by Sergey Pinaev: free(oldbuffer) should be called
AFTER putenv(buffer).

Also, respond correctly to an (unlikely) putenv() failure.
2015-02-27 08:18:13 -07:00
Matthew Flatt
c5e9f42cee adjust use of TARGET_OS_IPHONE in C preprocessing
Some Mac headers `#define` it as 0, so depend on its value instead
of its definedness.
2015-02-23 08:29:27 -07:00
Matthew Flatt
af6c39611d configure: initial support for an iOS build
A new `--enable-ios=<sdk-path>` flag in combination with `--host=...`
sets up the right compiler options for compiling the Racket runtime
system as a framework to use in an iOS application.

I don't know whether the resulting framework actually works, but
compiling and linking is a step forward.
2015-02-22 08:45:40 -07:00
Gustavo Massaccesi
4b8517b27c Recognize more procedures in scheme_optimize_apply_values
scheme_optimize_apply_values reduces (call-with-values gen proc)
to (#%apply-values proc gen) when recognizes proc as a procedure.
This extends the expressions that are recognized as procedures.
2015-02-16 10:06:52 -07:00
Gustavo Massaccesi
0c5944d64a Reduce (procedure? <inlineable>) => #t 2015-02-16 10:06:51 -07:00
Matthew Flatt
a8026824dd adjust optimizer to improve intra-module inlining
Instead of delaying the registration of some constants until a
group of expressions is re-optimized, add constant information as
it is discovered, which can expose some additional optimizations.

The old grouping was probably aimed at avoiding excessive code growth,
but I think that other and better controls are now in place. The
overall size of ".zo" files in an installation did not grow
significantly with this change.

Closes PR 14978
2015-02-16 10:01:16 -07:00
Matthew Flatt
1c4c76dd57 fix printing of ellipses in long error context 2015-02-15 08:10:27 -07:00
Gustavo Massaccesi
9c67f8be6a Ignore fuel in optimize_for_inline when it's used just to get a known procedure
Fix 7f61a6
2015-02-14 18:40:20 -07:00
Matthew Flatt
abe1233734 make hash-table order invertible at build time
For detecting and debugging accidental dependencies on hash-table
order, it might be helpful to invert the order at the lowest level. To
do that, uncomment `#define REVERSE_HASH_TABLE_ORDER` in "hash.c".
2015-02-13 18:28:48 -07:00
Matthew Flatt
0b82125ce9 remove misleading call
The `extractors` array is allocated on start-up (which is why it's
ok for places).
2015-02-13 06:59:27 -07:00
Matthew Flatt
f5da16b56d fix interaction of nack-guard-evt and choice-evt
If the result of `nack-guard-evt` is a `choice-evt`, then chosing any
of the combined events should avoid the NACK.
2015-02-12 15:24:45 -07:00
Gustavo Massaccesi
84543217f9 Add flexpt to is_inline_unboxable_op list 2015-02-12 10:14:51 -07:00
Matthew Flatt
1409ff1d24 fix position of lifted requires in expansion
The macro expander formerly put all lifted requires at the start of a
module, but that doesn't work with re-expansion if a module has
submodules and lifted requires that refer to submodules. Put lifted
submodules in the right place, instead: just before the form whose
expansion added the lifted require.
2015-02-10 17:53:08 -07:00
Matthew Flatt
bc6670c8e0 fix marshaling of module language info
Language info needs to be quote-protected in case it contains
a hash table or graph structure.
2015-02-09 17:26:05 -07:00
Matthew Flatt
9c7d0b8794 Unicode 7.0
Closes PR 14971
2015-02-09 11:33:13 -07:00
Matthew Flatt
2ada651dd3 {chaperone,impersonate}-struct: allow structure type as a witness
Also, do not allow `struct-type` as a wrapped operation in
`chaperone-stuct` without a witness.

Related to PR 14970
2015-02-08 06:52:24 -07:00
Matthew Flatt
acdb0b0e90 fix prefab-key? for inferred field count
Instead of inferring a field count of 0, accept a key that
works with some number of fields.

Closes PR 14964
2015-02-03 10:48:18 +01:00
vraid
68074f7fd7 fix typo 2015-02-02 17:27:42 -05:00
Matthew Flatt
83974a42ee native-libs script: build MPFR for Windows as thread-safe 2015-01-27 20:07:49 -07:00
Matthew Flatt
60704c9198 Windows: fix reparsing with UNC targets 2015-01-27 18:07:46 -07:00
Matthew Flatt
f30b3a50fd Windows: fix problems with junctions and symlinks
Racket wasn't reparsing correctly; the strategy worked ok
for links created by `mklink`, but not with other tools that
leave the "printed name" field blank.

A consequence of various fixes is that reparse points like
"My Documents" (in a typical configuration) correctly resolve
to actual paths like "Documents".

Finally, `directory-exists?` didn't handle root directories like
"C:/" correctly. The query would actually report properties of
the OS-level current working directory, and when junctions are
involved, the current directory can be a link instead of a directory.

Relevant to PR 14950 and PR 14912
2015-01-27 17:48:52 -07:00
Matthew Flatt
d3383e3e35 dynamic-require: fix re-export shortcut 2015-01-27 13:46:33 -07:00
Matthew Flatt
a72ef3ec05 syntax-local-lift-require: fix problems for meta-compile-time use
Various repairs correct problems with `local-require` in a
phase-1 context.
2015-01-27 09:49:28 -07:00
Matthew Flatt
7bee7bbadc collapse-module-path-index: support relative module path flattening
Unlike `collapse-module-path`, it makes sense for
`collapse-module-path-index` to convert a relative module path index
to a plain module path. In other words, `collapse-module-path-index`
can convert a module path index to a module path.
2015-01-27 08:40:10 -07:00
Gustavo Massaccesi
e36382d500 Add SCHEME_PRIM_WANTS_FLONUM_SECOND flag to flexpt 2015-01-25 07:51:45 -07:00
Gustavo Massaccesi
6ab68eb97d Add SCHEME_PRIM_PRODUCES_FIXNUM flag to unsafe-fxvector-ref 2015-01-25 07:51:45 -07:00
Matthew Flatt
68c5d3d1d6 fix error message for inexact->exact on +inf.f 2015-01-24 10:12:35 -07:00
Matthew Flatt
778a95294c fix requested stack depth as needed by on-demand JITting
Found by stack-overflow checking added in 3408209f66.
2015-01-23 12:10:04 -07:00
Matthew Flatt
2ffb546c95 fix vector-set-performance-stats! for CGC
Also, fix the build for a no-futures, no-places configuration.
2015-01-22 13:03:00 -07:00
Matthew Flatt
db40c2f4ce corrections to GC out-of-memory handling 2015-01-22 10:16:32 -07:00
Matthew Flatt
cffb63be56 correction to recent repair to places
Corrects 5b20690876
2015-01-22 10:16:32 -07:00
Matthew Flatt
7196dc0e74 add peak memory use to vector-set-performance-stats! 2015-01-22 10:16:32 -07:00
Matthew Flatt
0c13a4a1f1 places: avoid redundant atexit() registrations
Register only in the original place.
2015-01-21 06:11:05 -07:00
Matthew Flatt
1893f73fac fix GC peak-memory logging 2015-01-21 05:10:51 -07:00
Matthew Flatt
5b20690876 places: no allocation while low-level locks are held 2015-01-20 19:26:42 -07:00
Matthew Flatt
857950a2b2 fix prefix-use flags on a closure that ignores its captured prefix
Optimization can cause a `lambda` that was going to refer to a
top-level variable or syntax object to not refer to it after all.
Ideally, the prefix should be dropped from the closure, but
the change here is more conservative: it fixes the `lambda`s
annotation that's used by the GC to indicate that nothing will
be used from the prefix.
2015-01-20 12:58:51 -07:00
Matthew Flatt
e42bf573e1 JIT: clear tail-call rator when handling directly
Clearing is needed for space safety.
2015-01-20 11:37:04 -07:00
Matthew Flatt
cca2ee5e68 fix --disable-jit build
Also, avoid a compiler warning.
2015-01-20 07:50:17 -07:00
Matthew Flatt
5ac22ef3b8 another GC backtrace repair
Special treatment of a "prefix" in a closure needs special
backtrace support.
2015-01-19 21:29:55 -07:00
Matthew Flatt
3eef017911 track whether a closure uses syntax objects
For GC purposes, if a "prefix" (a closure frame that caprues
top-level or module-level bindings) may refer to syntax objects
that are not used by any reachable closure, in which case the
syntax object can be dropped. This pruning of syntax objects
uses the infrastructure already in place to prune variables.

Syntax objects were not included in the original pruning
implementation, because they are unlikely to create
finalization cycles in the way that global-variable
references can. A syntax object can retain a namespace's
table of module imports, however, which can be substantial
and worth releasing of a closure is only held, say, for
a low-level finalization action.
2015-01-19 21:29:55 -07:00
Matthew Flatt
df88e0dd8a fix clearing of JIT's code-name table
Although names were cleared correctly, the trie used for
the mapping was not pruned correctly, so lots of empty
branches could accumulate (especially in 64-bit mode).
2015-01-19 21:29:54 -07:00
Matthew Flatt
7f5a834fdb allow weak hash tables to shrink 2015-01-19 21:29:54 -07:00
Matthew Flatt
e3591d30b9 fix bugs in GC backtrace support
Lots of problems have made GC backtrace support unreliable (as
enabled for debugging via `configure --enable-backtrace`).
2015-01-19 21:29:54 -07:00
Matthew Flatt
57832309ef bump version number 2015-01-19 21:29:54 -07:00
Matthew Flatt
676109f638 compiler: never retain namespace for constantness-test argument
Even when `(variable-reference-constant? (#%variable-reference ....))`
cannot be optimized to a boolean, the expression should not retain a
reference to the enclosing namespace. That space guarantee is
important for the compilation of calls to keyword-accepting functions.
2015-01-19 21:29:54 -07:00
Matthew Flatt
ab5baca97c optimizer: fix variable-reference-constant? on module-level identifier
Allow optimization when the reference variable is known to have
a fixed value, not only when it's a constant value.
2015-01-19 21:29:54 -07:00
Matthew Flatt
c6802ed107 namespace-attach-module: fix handling of for-template
The handling of `for-template` imports by `namespace-attach-module`
didn't match the docs. The actual handling was to refrain from
attaching instances of a phase-0 module if the instance was reachable
only through a `for-template`. The rationale had to do with such
modules instances being created only through instantiation of
phase-1 modules, and phase-1 module instances aren't attached;
it doesn't work well that way, though, when different modules
are attached with intervening `namespace-require`s on the target
namespace.

The change includes a documentation correction. Previously and still,
only modules at the same phase as the attached module (as opposed to
the same phase or less) are instantiated in the target namespace.

Closes PR 14938
2015-01-18 11:19:49 -07:00
Matthew Flatt
825af972db log GC's peak memory use on exit 2015-01-18 10:03:26 -07:00
Matthew Flatt
5e6debf854 make: DESTDIR must be an absolute path
Clarify in the installation notes, and add a check in the makefile.

Closes PR 14935
2015-01-15 06:09:21 -07:00
Matthew Flatt
9f3c82c30a Windows: change delete-{file,directory} to attempt permission correction
If a file or directory delete fails, try adjusting the file or directory
permissions to allow writes, then try deleting again. This process should
provide a more Unix-like experience and make programs behave more
consistently.

A new `current-force-delete-permissions` parameter provides access to
the raw native behavior.
2015-01-13 11:58:36 -07:00
Matthew Flatt
33da6564a1 fix handling of empty paths in PATH on Windows
Check for an empty path after dropping `"`s, instead of before.
Otherwise, a bad PATH setting interferes with functions like
`find-executable-path`, which in turn can prevent DrRacket from
starting up.

Closes PR 14930
2015-01-13 06:48:40 -07:00
Matthew Flatt
719917f812 compiler: fix inlining of #%variable-reference 2015-01-13 06:45:59 -07:00
Matthew Flatt
486debd704 repair to recent JIT repair
Fix a jump-mode bug introduced with 3408209f66. The bug is most
visible on PPC.
2015-01-10 19:15:49 -07:00
Matthew Flatt
f2a8c31d9f avoid ambigious else
even though another `else` currently resolves the ambiguity
2015-01-09 08:54:44 -07:00
Gustavo Massaccesi
7f61a68552 Ignore fuel in optimize_for_inline when it's used just to get a known procedure 2015-01-09 08:54:13 -07:00
Gustavo Massaccesi
1b3949c233 Add flags to application in finish_optimize_application3
(finish_optimize_application and finish_optimize_application2 already do this.)
2015-01-09 08:54:13 -07:00
Gustavo Massaccesi
feb8f10165 Mark error in expression when an arity mismatch is detected during optimization
This enables further reductions, for example (begin (car x x) z) => (car x x)
2015-01-09 08:54:13 -07:00
Gustavo Massaccesi
6d8ba1fd67 Mark errors in expression when a wrong type is detected during optimization
This enables further reductions,
for example (begin (car x) (unbox x) z)  => (begin (car x) (unbox x))
2015-01-09 08:54:13 -07:00
Matthew Flatt
c56c9250f1 fix JIT-inlined make-rectangular combining single and double
The single must be coernced to a double in that case.
2015-01-07 14:44:02 -07:00
Matthew Flatt
e82487429b fix bad case-lambda sharing that breaks let-depth tracking 2015-01-06 12:58:52 -07:00
Matthew Flatt
3408209f66 fix potential stack overflow with JIT-inlined apply
If the slow path has to be taken because the number of
list elements is greater than the stack size, then the
old implementation would copy all the arguments --- which
still might be too much for the available stack space.
Avoid that copy.

Also, add pad word to the end of the stack to help detect
overflow.
2015-01-06 12:58:52 -07:00
Gustavo Massaccesi
25013320be Fix is_arity_list 2014-12-29 07:26:15 -07:00
Gustavo Massaccesi
17665d33a2 Remove dead code after errors
For example, reduce (begin x (error 'e) y) ==> (begin x (error 'e)) and
(f (error 'e) y ) ==> (begin f (error 'e)).

Also, reduce (if (error 'e) x y) ==> (error 'e) and propagate the type information
and clocks when only one branch produce an error.
2014-12-29 07:24:22 -07:00
Gustavo Massaccesi
92615049aa Fix make_discarding_first_sequence
Ensure that the first expression is single valued.
2014-12-29 07:24:09 -07:00
Matthew Flatt
e21f75fa1b Win64: fix stack-trace imprecision
Propagates repairs of 71e0bdfcff to Win64 stack handling.
2014-12-19 20:31:07 -07:00
Matthew Flatt
31ebe213cc reject prefab specs with bad mutability indices
Closes PR 14887
2014-12-19 20:12:44 -07:00
Matthew Flatt
9419bf42a1 fix enforcement of size limit in prefab struct descriptions
Closes PR 14888
2014-12-19 20:12:44 -07:00
Juan Francisco Cantero Hurtado
26c4607c3b Add various changes to sconfig and configure.
- Modify the features used by OpenBSD (not everything was
  tested). Mostly copied from Linux, FreeBSD and NetBSD.
- Add support for Bitrig, a fork of OpenBSD. Eventually
  they will differ more and more from OpenBSD.
- Typos and extra trailing spaces.
- Update config.guess and config.sub from GNU.
2014-12-19 05:22:58 -07:00
Matthew Flatt
95617a200b fix UDP receive on Windows
When the received message is larger than the space available, it's
still received.
2014-12-18 10:51:50 -07:00
Matthew Flatt
b05d07ad10 generalize {impersonator,chaperone}-of? on immutable hash tables 2014-12-18 06:49:10 -07:00
Matthew Flatt
71e0bdfcff more repairs to stack trace and caching
Fixes problems with d15fda9d6b, but also fixes a problem that
could show up in non-libunwind mode and cause lost frames.
2014-12-15 13:38:59 -07:00
Matthew Flatt
6f5ab2851d avoid a compiler warning 2014-12-14 08:52:26 -07:00
Matthew Flatt
d15fda9d6b fix native-stack caching with libunwind
The implementation of caching stack-trace information in the
stack didn't work right in libunwind mode, with the result that
`(current-continuatiom-marks)` took O(N) time for a continuation
of size N, when it should be amortized constant time.
2014-12-14 08:46:14 -07:00
Gustavo Massaccesi
58ef3fdaa8 Mark immutable? as omitable 2014-12-14 08:46:14 -07:00
Gustavo Massaccesi
ababa86c44 Increase SCHEME_PRIM_OPT_TYPE_SHIFT
Otherwise, two optimization flags collide:

 SCHEME_PRIM_ALWAYS_ESCAPES = SCHEME_PRIM_PRODUCES_FLONUM = 8192
2014-12-14 08:46:14 -07:00
Matthew Flatt
d6c26f9742 fix PLT_DELAY_FROM_ZO
Fetching bytecode from a previously read file was broken in the case
of a bytecode file with submodules.

Closes PR 14878
2014-12-12 07:59:17 -07:00
Matthew Flatt
d780930056 fix syntax-disarm with a #f second argument 2014-12-12 07:59:16 -07:00
Matthew Flatt
195a46a23e fix problem with truncated value printing and stack overflow
A value-printing truncation discovered after a stack-overflow handle
and return could go badly, because the truncation escape wasn't
reset correctly after overflow handling (in contrast to truncation
discovered during the overflow handling, which was handled correctly).

Closes PR 14870
2014-12-09 09:22:12 -07:00
Matthew Flatt
99c6f529e5 add makefile step to adjust for movements within "pkgs"
The step doesn't currently adapt to additionals or removals
from "pkgs", so further support may be needed in the future.
2014-12-08 06:36:17 -07:00
Matthew Flatt
4b36a8e9b5 fix handling of "links.rktd" errors 2014-12-08 05:33:09 -07:00
Matthew Flatt
d6b4523336 pkg/dirs-catalog added
This utility that is needed by `make` turns out to be useful in other
scripts.
2014-12-07 11:19:29 -07:00
Matthew Flatt
5af2611704 pkg-directory: add #:cache argument
The cache enables multiple calls to `pkg-directory` to load
installed-package information only once.
2014-12-05 16:57:36 -07:00
Matthew Flatt
2837c995a9 fix continuation reuse in non-JIT mode
The continuation mark to generate stack traces interfered with the
detection of equivalent continuations.
2014-12-05 10:16:56 -07:00
Matthew Flatt
38da2aa2e7 fix a problem mixing JIT and non-JIT code
Crashes the "optimize.rktl" test suite when the JIT supported but
disabled, because that test suite re-enables the JIT.
2014-12-05 10:16:40 -07:00
Gustavo Massaccesi
2d95c39051 simplify treatmenet of begin0 and discarding expressions
Since `begin0` at the bytecode level always evaluates an initial
expression in non-tail position, we don't have to work so hard
to ensure that an extra expression sticks around.
2014-12-05 07:00:40 -07:00
Gustavo Massaccesi
60934f1415 optimizer: more optimizations for begin0
Move begin0 inside begin, for example
(begin0 (begin X Y) Z) ==> (begin X (begin0 Y Z))
Try to replace more begin0 with begin when the first expression is movable
Drop the begin0 when it has only one non omitable expression that preserves
the continuation marks.
2014-12-05 06:56:29 -07:00
Matthew Flatt
c6d2548e22 make: fix Unix-style build 2014-12-04 19:30:01 -07:00
Matthew Flatt
d05c00de3e fix build for a fresh checkout 2014-12-04 13:05:53 -07:00
Matthew Flatt
d593f5420b make: link packages via local catalog
Change the way that packages in "pkgs" are handled by `make`:
create a catalog that causes them to be installed on demand
as directory links.
2014-12-04 12:46:03 -07:00
Sam Tobin-Hochstadt
2987338218 Split almost everything else from the main repository.
The source to the split packages is in repositories under the
`racket` organization on GitHub. The repositories are all named
according to the pkg name, except for multiple-package
repositories such as `racket/compiler` which is named based on the
old directory name without the `-pkgs` suffix. Thus

   `pkgs/compiler-pkgs` -> https://github.com/racket/compiler

The Makefile has also been adjusted to pull packages from the
catalog when you type `make`. This currently relies on some tricks
that will break if you try to specify a particular set of `PKGS` on
the command line. We plan to improve this soon.

The packages in `pkgs/racket-pkgs` and `pkgs/base` are staying in
the repository, since they logically belong with the core code.

The `plt-services` package is still in the repository, but will
move out soon.
2014-12-04 10:33:19 -05:00
Matthew Flatt
f3dba3eb6b fix over-eager shortcut in the implementaiton of continuation jumps
Don't jump past a prompt when jumping to a continuation that is
a prefix of the current one.

Reported by Max New
2014-12-03 07:15:34 -07:00
Gustavo Massaccesi
60433b15f7 optimizer: fix do_make_discarding_sequence
The optimizer converts (car (cons X Y)) to (begin0 X Y) and then reduces
it to (begin Y X) if X is movable.
Check that the movement is safe for space and for continuation captures.
2014-11-30 14:28:56 -07:00
Matthew Flatt
5fca59e2ed fix problems with continuations & sharing
When continuation C2 extends continuation C1, C2 shares the copy
of the internal stack with C1. It needs to skip the bit of
C1's stack that corresponds to arguments to `call/cc`, though.
That skipping assumed that `call/cc` takes 1 argument, but it can
take 2. The bug broke `racklog`, which captures continuations using
its own prompt. (It seems like there should be a simple test that
is independent of Racklog, but I couldn't construct it.)

Meanwhile, the continuation shouldn't retain the arguments to
`call/cc`, so clear them. (That was easy to test.) Sharing still
has to compensate for the locations of the arguments, though.
2014-11-25 16:37:41 -07:00
Matthew Flatt
d0b94f48e0 {chaperone,impersonate}-procedure*: fix argument propagation
Fix the "self" argument propagation through an impersonator that has
no redirection function (but that probably has impersonator
properties).

Closes PR 14852
2014-11-24 16:27:11 -07:00
Matthew Flatt
aa5e7d1039 remove redundant declaration & GC registration 2014-11-20 07:50:11 -07:00
Matthew Flatt
67ec4fb982 fix use of embedded bytecode 2014-11-20 07:50:10 -07:00
Matthew Flatt
80a7ff831f read: reject non-Latin-1 characters in byte-string literals
This is a backward-incompatible change, but the old behavior (truncate
the character value to 8 bits) was never intended and seems clearly bad.
2014-11-13 09:46:27 -07:00
Matthew Flatt
1681126ed5 add {impersonate,chaperone}-procedure*
The new variants pass a "self" argument to the wrapper procedure in
the same way that `{impersonate,chaperone}-struct` provides a "self"
argument to redirection procedures.
2014-11-12 10:10:23 -07:00
Matthew Flatt
50a8863169 fix places-GC trigger when a large message is pending
A large message that hasn't been delivered can trigger a inter-place
GC. The intent is to force a GC to avoid messages piling up that can
never be delivered, but the GC didn't adjust to a state where messages
stay both undelivered and uncollected, and it would continuosly
trigger GCs. Trigger a GC only if the pending-message size has grown
relative to the previous GC.
2014-11-12 09:30:30 -07:00
Matthew Flatt
a88c79fd5b expt: repair for non-integer power of negative inexact
If the inexact approximation of the power is an integer, then
the result was a real number when it should be a complex number.
2014-11-05 09:50:32 -07:00
Matthew Flatt
1e9d7c1d2a expt: repair for large power of inexact between 0 and -1
Closes PR 14824
2014-11-05 09:50:31 -07:00
Matthew Flatt
b9d8f65fc9 reduce CPP noise 2014-11-05 09:50:31 -07:00
Matthew Flatt
edd50a24a8 optimizer: preserve implied properties from a let RHS
In an expression such as

 (let ([x (car y)])
   ....)

the information that `y` must be a pair didn't reach the body of the
`let` in most cases.
2014-11-03 06:06:04 -07:00
Matthew Flatt
89106b6708 optimizer: refine tracking of when space safety is a constraint
Some expression movements are limited by the possibility of retaining
a value in a way that interacts with space safety, but primitives that
return immediately shouldn't get in the way of those movements.
2014-11-03 06:06:04 -07:00
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
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
Leif Andersen
627c775b6f Add 'subprocesses mode to current-process-milliseconds 2014-11-02 06:41:59 -07: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
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
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
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
Matthew Flatt
9291726482 racket/file: add make-parent-directory*
Also, clarify behavior of `make-directory*` in the case of a relative
path when the current directory does not exist.
2014-10-27 16:01:49 -06:00
Matthew Flatt
2d85fdc02f libffi: restore some small patches
Also, revert file-permission changes.
2014-10-27 11:18:16 -06:00
Gustavo Frederico Temple Pedrosa
9832ad7750 Update libffi to 3.1
Update libffi to 3.1 to add support for new architectures.
2014-10-27 11:18:16 -06:00
Matthew Flatt
f31c6563e4 make read-line interruptable on a primitive port
Closes PR 14800

Merge to v6.1.1
2014-10-27 07:00:30 -06:00
Matthew Flatt
a352470914 work around a kqueue bug(?) on Mac OS X
There seems to be a problem in kqueue() on Mac OS X for watching for
FIFO write availability, where adding a read event for the same FIFO
(at a different file descritor) can disable the write event.

Merge to v6.1.1
2014-10-26 09:51:17 -06:00
Matthew Flatt
2679638e74 fd read and write: avoid redundant O_NONBLOCK flag setting 2014-10-26 09:21:28 -06:00
Matthew Flatt
b2509614e2 fd write: accomodate non-partial writes to a non-full descriptor
If a write to a non-blocking descriptor fails, then try again
with fewer bytes, since nothing in the spec write() seems to
promise writing partial amounts. In particular, writing to
a FIFO no Mac OS X might fail even if there are a few bytes of
space; as it happens, the select() function seems to compensate
and claim that such a FIFO is full, but kqeueue() doesn't.
2014-10-26 09:21:28 -06:00
Matthew Flatt
1f764a3dba fix internal meta-continuation comparison for continuation sharing
The check that the current meta-continuation matches the captured one
would always fail (I think), since the current meta-continuation is
pruned on capture. Keep a weak link to the original meta-continuation
to enable detection of capturing a continuation that matches or
extends one that was previously captured.

Enabling sharing exposed a problem with the code that saves
continuation marks for partial sharing, since that implementation
became out of sync with the main implementation (so merge the
implementations).
2014-10-22 13:14:58 -06:00
Matthew Flatt
d9f2a84951 repairs for {impersonator,chaperone}-struct
Commit 0b71b8481d didn't have the tests that I thought I had
written, and so the changes were unsurprisingly buggy.
2014-10-21 21:09:36 -06:00
Matthew Flatt
8a45f9d341 impersonated mutator: fix internal stack overflow
This is not a new bug, but it was exposed by the interaction
of the changed to the impersonated-mutator protocol and
the `unstable/option` test suite.
2014-10-21 13:53:09 -06:00
Matthew Flatt
0b71b8481d {impersonator,chaperone}-struct: change protocol to receive self
When calling a wrapper procedure for a field accessor or mutator,
provide the structure that was originally passed to the accessor or
mutator, instead of the value that was wrapped to create an
impersonator.

This is a backward-incompatible change, but I can't find any uses of
that initial argument to the wrapper procedure. Also, a wrapper can
capture the original value in its closure, while passing "self" allows
wrappers that are sensitive to overridden impersonator properties.
2014-10-21 10:05:02 -06:00
Matthew Flatt
3323605fa9 racket/udp: adjust receive into a zero-sized buffer
The OS doesn't necessarily react to a zero-sized buffer the way
that `udp-receive!` is supposed to work, so provide only a
non-zero-sized buffer to the OS.
2014-10-21 07:31:07 -05:00
Matthew Flatt
1cc86d3cea ffi/unsafe: fix make-sized-byte-string on a #f argument
In particular, a #f argument can make sense if the length is 0.
Technically, a byte string's byte array is supposed to be nul-terminated,
but many uses of byte strings get away without that terminator. I've
adjust the documentation to note that `bytes-copy` will work with a
non-terminated byte string.

Merge to v6.1.1
2014-10-14 16:43:20 -06:00
Matthew Flatt
d4ad0a20e4 macro expander: fix an internal hash-table traversal bug
This bug could result in weird "cannot re-define a constant: lifted.0.2"
errors, or probably even worse collsisions of definitions, but I think
only in a namespace created from `module->namespace`.

So far, I haven't been able to create a reasonably small test,
because so many things have to line up in just the right way.

Merge to v6.1.1
2014-10-10 17:51:07 -06:00
Matthew Flatt
3692abf61e Windows: add "CP" before code page number as locale encoding
If you set the locale to something like "us_EN.1252", then
"1252" was returned as the encoding, but "CP1252" is more likely
to be recognized by `bytes-open-converter`.
2014-10-10 17:51:07 -06:00
Matthew Flatt
d8793e5b8b Always convert string<->paths with UTF-8 on Windows
Also, document representation information on paths. In particular,
explain that Unix and Mac OS X paths are natively byte strings, while
Windows paths are natively UTF-16 code-unit sequences. The byte-string
representation of a Windows path is a UTF-8-like encoding of the UTF-16
code-unit sequence, which is why it makes no sense to convert it using
the current locale's encoding.
2014-10-10 17:51:07 -06:00
Matthew Flatt
7e984c6009 fix allocation bug in equal? on deeply nested values
Based on the core file, this bug seems likely responsible for the
`raco setup` crash on DrDr for push 29346.

Merge to v6.1.1
2014-10-10 08:20:33 -06:00
Ryan Culpepper
653939ffa7 Post-release version for the v6.1.1 release 2014-10-08 14:39:56 -04:00
Matthew Flatt
40f5ec070a configure: add --enable-natipkg and 64-bit Linux native libraries
The `--enable-natipkg` configuration option adds "-natipkg" to the
platform library subpath. The suffix is intended to trigger the
installation of packages that supply native libraries for supported
platforms (where 64-bit Linux is the supported platform, for now, for
main-distribution packages), instead of relying on libraries installed
via the OS's package manager.

The intended client for "-natipkg" is the package-build service, where
installing packages via the OS package manager would require network
access and either trust or constrained installations. The build
machine is intentionally disconnected from the network and can only
access Racket packages, so repackaging native libraries as Racket
packages makes those libraries accessible.

A disadvantage of this approach to installing native libraries is that
it creates work for implementers of packages that access native
libraries. Those implementers will have to supply packages for 64-bit
Linux versions of native libraries to the degree needed to build and
(eventually) test the package. An advantage of the approach is that it
requires no changes to the package system; it will be cheap to replace
this approach if we find a better way to deal with native libraries
and/or OS packages in the package-build service.
2014-10-08 05:19:33 -06:00
Matthew Flatt
9d864b1182 fix UDP improvement for Windows 2014-10-03 06:44:47 -06:00
Matthew Flatt
2a387aceea racket/network: improve UDP support
Generalize `udp-send-to`, etc., to try each possibility of
a resolved address (instead of just the first one) like
`udp-connect!` does. This matters, for example, when using
"localhost" as an address, when the machine resolves "locahost"
to both "127.0.0.1" and "::1", and when the socket is created
for the second one that would be tried.

Also, detect and discard asynchronous ICMP errors.
2014-10-02 11:33:38 -06:00
Matthew Flatt
b946d4639e JIT: fix allocation of letrec-bound closure over unboxed flonums
The closure could be allocated as uninitialized memory with the
expectation that it would be filled right away, but boxing values
to put in the closure could expose the uninitialized memory to
the GC. Fix the problem by boxing before allocating closures.
2014-10-01 13:13:37 -06:00
Matthew Flatt
cf7c013477 Windows: fix handling of junctions as links
On Windows, a "soft link" or "junction" is different from a
"symbolic link". The current Windows documentation is
incomplete in that it describes the behavior of GetFileAttributesEx
for a symbolic link, but not for a junction, and I guessed wrong.
For consistency, junctions need to be treated like symbolic links.
2014-09-27 20:45:13 -06:00
Matthew Flatt
2eb943e0de racket/place: fix nested-place termination 2014-09-26 06:41:41 -06:00
Matthew Flatt
116e06407b racket/draw Windows: patch Cairo for clipped DC surface creation 2014-09-25 16:17:29 -06:00
Matthew Flatt
a64a1cb177 racket/gui: DPI-aware on Windows
The `racket/draw` library is now independent of the screen resolution
on Windows. Font sizes in "points" are the only place where the
resolution mattered before, and now `racket/draw` assumes a
traditional 96dpi on Windows and Linux (and a traditional 72dpi
on Mac OS X).

Setting the scale for "text and other items" in Windows now adjusts
the backing scale of screen and canvas-compatible bitmaps, as well as
setting a scale on canvas drawing. Window and screen positions and
sizes are similarly scaled; for example, if the screen is 2048x1436
with text scaled by 200%, then `racket/gui` reports the display size
as 1024x768 (and the display backing scale as 2.0).

Backing scales of 1.25 and 1.5 are common for Windows. Rounding
associated with those scales could cause trouble for virtual -> actual
-> virtual conversions.
2014-09-24 08:40:52 -06:00
Robby Findler
404c067286 improve chaperone-procedure error messages a little 2014-09-21 16:53:16 -05:00
Matthew Flatt
a8d0534e65 chaperones: allow procedure chaperones that supplies no redirection
The same as the change for structure chaperones, but for procedures.
2014-09-21 12:13:55 -05:00
Matthew Flatt
1f1a10db87 chaperones: allow struct chaperones that supply no redirections
(as requested by Asumu)

A witness accessor or mutator is still required to create a structure
chaperone, but `#f` can be provided in place of a redirection, and
then impersonator properties can be attached to the chaperone.

At the same time, adjust `(chaperone-of? v1 v2)` so that `v1` as a
chaperone is not required to preserve non-redirecting chaperones of
`v2`.

The overall consequence is that a redirection procedure can cooperate
with a (suitably protected) impersonator property to override
redirection behavior without running afoul of the chaperone invariant
and without requiring O(N) space for O(N) overrides. For example, the
contract system can implement the re-application of a contract with
different blame information by overriding blame information as
represented by properties, instead of adding a new chaperone layer
every time that blame changes.

... and all the same for non-chaperone impersonators, of course.
2014-09-21 11:51:36 -05:00
Matthew Flatt
43d6684ab9 avoid stack-overflow in scheduler-triggered foreign calls
While a foreigh call is normally guarded by a check on the amount
of available stack space, a callbacks triggered by the
scheduler will first put Racket in no-stack-overflow mode, and
then it's too late to check stack space before making further
foreign calls. With Cocoa, there's some chance that the process
will run out of space. Avoid the mismatch by checking the stack
availability at the start of a scheduler iteration.
2014-09-18 06:06:21 -05:00
Matthew Flatt
ad2243ee01 restore accidentally removed GC check
Fixes a mistake in commit 768b93be82, which dropped a check that is
needed to trigger GCs during a sequence of large-block allocations.

Closes PR 14738
2014-09-12 12:22:55 -06:00
Gustavo Massaccesi
1542398822 optimizer: move more things inside let and begin
Refactor the code to move inside 'let' or 'begin'.

Also, in the test position of a 'if', recognize the 'not' inside a 'let' or 'begin'.
For example, transform (if (begin ... (not p)) x y) => (if (begin ... p) y x)
Previously, this conversion was made only when
the 'not' was the outermost expression.

And use the refactored code to move application inside 'let' or 'begin' in a single step
For example, transform ((let (...) ... (let (...) ... f) x) => (let (...) ... (let (...) ... (f x))
In the conversion, it's necessary to shift x to the new coordinates inside the 'let's.
In the new version x is shifted only once.
2014-09-07 19:33:46 -06:00
Matthew Flatt
cddfdca835 JIT: fix problem with arity checking with >= 25 arguments 2014-09-07 18:41:16 -06:00
Matthew Flatt
f9f43a4be7 avoid compiler warnings 2014-09-07 07:47:19 -06:00
Matthew Flatt
289e908ab2 string-normalize-...: fix memcpy that should be memmove 2014-09-05 22:02:13 -06:00
Matthew Flatt
230ce10b11 bump version 2014-09-05 21:13:16 -06:00
Matthew Flatt
51d91032f5 optimizer: fix bug
Repair a typo in b0f4a32049; thanks to Blake Johnson.
2014-09-05 21:10:16 -06:00
Matthew Flatt
79f7a642e1 avoid compiler warnings 2014-09-05 19:06:02 -06:00
Matthew Flatt
33e97745e9 treat OS page manager (especially Linux) more gently
Batch up mprotect() calls when cleaning up a place. Hopefully,
this will avoid ENOMEM errors from mprotect() on DrDr's build.
2014-09-05 17:49:41 -06:00
Matthew Flatt
af9e891215 module caching: ensure consistency of directory paths
Use `path->directory-path` to normalize directory paths and
increase use of the cache.
2014-09-05 15:54:18 -06:00
Matthew Flatt
bc48e9b935 win32: reduce allocation in the scheduler
It's not clear that the changes affect anything in practice,
but they avoid unnecessary allocation and quadratic behavior
in principle.
2014-09-05 15:54:17 -06:00
Matthew Flatt
cd17e08f12 check result of mprotect() 2014-09-05 13:49:27 -06:00
Matthew Flatt
59d3663106 ffi/unsafe win32: fix inefficiency in call-in-orig-thread mode
The problem made simultaneous rendering of "plot" and "math"
documentation about 10 times slower than it should be.
2014-09-05 10:34:27 -06:00
Matthew Flatt
f32d4b0187 minor cleanup on thread termination 2014-09-04 23:49:50 +02:00
Matthew Flatt
52514a4af4 fix interaction of alarm-evt and replace-evt
With `replace-evt` the time that the system needs to wake up
to check the event can drift later, but scheduling state was
carried in a way that works only if the wake-up time drifts
earlier.

Unfortunately, I don't know how to write a test for this bug.
The usual stategy of using `system-idle-evt` to detect busy
waiting doesn't work here, because the business happens despite
the scheduler's conclusion that the system is idle.

As reported by Jan Dvořák on the mailing list.
2014-09-04 23:49:28 +02:00
Matthew Flatt
b942a21846 fix module-code caching
Fixes a problem with c4508ad0d9, which disabled module-code
caching too often. A symptom of the disabled cache was that
running "math/scribblings/math.scrbl" would use twice
as much memory.
2014-09-03 12:16:29 +02:00
Matthew Flatt
b0f4a32049 fix cross-module function inlining and argument use-count tracking
Order mismatch between tracking an use could cause a multiply-used
argument to be treated after inlining as a single-use argument.

Closes PR 14717
2014-09-01 12:08:44 +02:00
Matthew Flatt
76f1ebded9 Mac OS X: incorporate Pango repair for Yosemite
Pango 1.36.6 fixes the problem, so update native libraries
and the Coretext patch.
2014-08-29 10:12:27 -06:00
Matthew Flatt
768b93be82 improve GC handling of out-of-memory
There's a point in attempting to allocate a new large page
where it makes sense to GC and try again.
2014-08-29 10:12:27 -06:00
Gustavo Massaccesi
35eb65628e optimizer: use the equal? => eq? transformation to the optimizer phase
For some types, (equal? x y) is transformed into (eq? x y) in the resolve phase.
This commit adds this transformation to the optimizer phase. This improves
constant folding and enable some optimizations that are prevented
because equal? can run arbitrary code.

Also, transform   (eq? #f x) => (not x)   and   (eq? '() x) => (null? x)   to use
the type information of x when it's known.
2014-08-26 09:18:43 -06:00
Gustavo Massaccesi
fdf1a1f7ae optimizer: Remove unused flag added in d14b4a8 2014-08-24 07:29:55 -06:00
Matthew Flatt
769c5b6edd optimizer: another ((begin ... proc) x) to (begin ... (proc x))
The tranformation this time applies before optimization of the rator
and complements Gustavo's variant, which applies after optimization of
the rator.
2014-08-23 09:13:49 -06:00
Gustavo Massaccesi
d14b4a8095 optimizer: transform ((begin ... proc) x) to (begin ... (proc x))
Currently the optimizer can convert ((let (...) ... proc) x) to
(let (...) ... (proc x)). This is useful especially if proc can be
inlined. Extend this to begin's forms.
2014-08-23 08:59:39 -06:00
Gustavo Massaccesi
1f2f7a1df4 optimizer: more optimizations for unary operations
Previously, the optimizer simplified the application of some unary functions inside let,
for example (car (let () ... (cons 1 2)) => (let () ... 1). This commit extends this to begin forms,
like (car (begin ... (cons 1 2)) => (begin ... 1).

Also, constant folding and some reductions were only availed in the direct case, for example
(procedure? car) => #t. With this commit these reductions are extended to the expressions
inside let and begin, for example (procedure? (let () (begin ... car))) => (let () (begin ... #t).
2014-08-21 09:37:10 -06:00
Tobias Hammer
e637d78a09 fix cross compile on QNX
got broken in 2e284cc783
The racket version of libunwind is not compatible with QNX but old-style stacktraces are still working with the default gcc version
2014-08-20 16:47:20 -06:00
Matthew Flatt
b2b00010e3 annotate and check packages for build and binary modes
If "p" is available as a source package, which is typical, then `raco
pkg install --binary p` would strip away the build dependencies of "p",
so that "p" would not install properly.

This commit changes `raco pkg install` to look for an annotation on
the package and complain if the annotation is inconsistent with the
requested conversion: a binary package cannot be used as a source
package or vice versa. (A built package, as provided by a snapshot
site, can be used as any kind of package.)
2014-08-15 15:41:27 +01:00
Matthew Flatt
906ba45c6c reegxp-match: fix problem with lazy string decoding and output port
Closes PR 14684
2014-08-13 13:28:51 +01:00
Matthew Flatt
c359f7ac29 build less when a pre-built racket is supplied
Adjust dependency tracking and makefile rules to that when
`--enable-racket=...` is provided to `configure`, intermediate
CGC objects are not compiled.

The new approach uses dependency tracking that was already supported
by xform, previously used only for Windows.
2014-08-13 07:33:09 +01:00
Matthew Flatt
7e141a89f7 suppress ar output for SGC library
The `nicear` script avoids stderr output on DrDr.
2014-08-13 07:33:09 +01:00
Matthew Flatt
a266d623aa windows: better approach to manifest
Works for VS 2008 and 2012, at least.
2014-08-12 18:07:28 +01:00
Matthew Flatt
3b962a235d Revert "windows: remove custom manifest"
This reverts commit 67007451b3.

Seems to be needed after all.
2014-08-12 16:43:26 +01:00
Matthew Flatt
fa66067359 fix no-places, no-futures build 2014-08-12 15:58:43 +01:00
Matthew Flatt
fc8b2f02f9 Windows: more changes to auto-adapt to Visual Studio version
Although newer versions of Visual Studio can open 2010 projects, the
meaning of the project turns out to be: use 2010 tools. So, I've added
a step in the build script to automatically upgrade the solutions and
projects based on the version of Visual Studio that is being run.

Meanwhile, since my previous tests for VS 2012 and VS 2013 were using
VS 2010 projects, I wasn't actually testing with the 2012 and 2013
compilers. Additional changes are needed to make those work, notably a
fresh implementation of setjmp() and longjmp() for Win64.

This was all very painful, but the projects are now in much better
shape, so maybe it won't be so bad from here.
2014-08-12 15:55:37 +01:00
Matthew Flatt
67007451b3 windows: remove custom manifest
The manifest was intended to enable XP-style controls, but at this
point it doesn't seem to do anything except interefere with some
variants of the build tools.
2014-08-12 15:42:13 +01:00
Matthew Flatt
df375daef4 avoid NULL argument to memcpy()
gcc 4.9 takes advantage of the specification of undefined behavior if
you pass a NULL to memcpy(), even if the last argument is 0
2014-08-12 08:47:14 +01:00