Commit Graph

1077 Commits

Author SHA1 Message Date
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
Matthew Flatt
3c8b5b672e windows: fix sgc allocation of executable pages 2014-08-12 07:33:43 +01:00
Matthew Flatt
881990eddf windows: switch projects to SGC by default 2014-08-12 06:44:55 +01:00
Matthew Flatt
a312f499cb racketcgc: use SenoraGC instead of Boehm GC by default
This new default for Unix and Mac OS X trades performance for
portability (hopefully), but for most users the switch affects only
for the build process, where `racketcgc` is used to build `racket`.

To continue using Boehm GC, configure with `--disable-sgc`.

For now, Boehm GC continues to be the default for Windows.
2014-08-12 05:14:44 +01:00
Matthew Flatt
2916fc34cc SenoraGC: support allocation of executable memory; tune for performance
Allocation of executable memory is intended to make SELinux
happier by mmapping with PROT_EXEC instead of using mprotect()
to allow execution after the fact.

Performance improvements bring SGC within 30% of the Boehm GC on
`racketcgc -cl racket`, which makes SGC an even more plausible
substitute.
2014-08-12 05:14:14 +01:00
Matthew Flatt
2220452b72 racket/place: protect place-creation bindings
Closes PR 14677
2014-08-11 10:48:58 +01:00
Matthew Flatt
c4508ad0d9 avoid cross-namespace submodule pollution via module-code cache
When a module is loaded with submodules intact, it should not be
cached and used for a later load that is intended to obtain the
module without submodules. Avoid mismatches by constraining the
cache to modules without submodules.
2014-08-11 10:26:32 +01:00
Matthew Flatt
2bdb8c1de5 fix rename-transformer-target for chaperoned structs 2014-08-11 07:41:47 +01:00
Matthew Flatt
5ef75682d7 fix run-time error reporting for variables in a submodule
Error reports used the "source" field of a module, which
doesn't have submodule information, or the "name" field of
a module, which might not match an actual filename (".ss"
vs. ".rkt"). Create the right combination.
2014-08-11 07:41:43 +01:00
Matthew Flatt
fe12e93192 bump version 2014-08-05 16:23:10 +01:00
Matthew Flatt
926e64f5f1 fix "fixing letrec" pass
Adjust the compiler pass to insert checks for #<unsafe-undefined>.
The chanegs amount to throwing out the old attempt to follow the
implementation sketched in "Fixing Letrec", and instead use a
simpler abstract interpretation.
2014-08-05 16:22:31 +01:00
Matthew Flatt
ac428f89fa use-before-definition analysis: fix checking of with-cont-mark form
Similar to the `set!` problem.
2014-08-05 16:00:19 +01:00
Matthew Flatt
6efac46b3f letrec-check analysis: remove no-op part of implementation
The `deferred_uvars` list is constucted so that it always
has the same length as `uvars`.
2014-08-05 16:00:19 +01:00
Matthew Flatt
837a55f484 use-before-definition analysis: fix handling of let[*]
Bindings in `let` and `let*` need to be tracked much the same
way as for `letrec`, so that

 (letrec ([b (let ([d (lambda () c)])
               (d))]
          [c 1])
   b)

raises an exception.
2014-08-05 16:00:19 +01:00
Matthew Flatt
7d85bccaa2 use-before-definition analysis: fix checking of set! form
Treat the RHS of `set!` as escaping to an unknown context, so
that any variables it references are treated as unprotected.
2014-08-05 16:00:19 +01:00
Matthew Flatt
30d30ce74c win32: fix 32-bit get-seconds 2014-07-31 09:53:07 +01:00
Matthew Flatt
9d17a35539 fix expand on a module containing lifts from expression
Another attempt at the bug that b95baa1d25 was intended to fix.
2014-07-30 10:33:52 +01:00
Matthew Flatt
b95baa1d25 fix expand on a module containing a #%declare form 2014-07-30 08:49:28 +01:00
Matthew Flatt
21f78ecd14 fix problem with (continuation-marks <thread>)
A thread can be swapped out while it's in transition between a
mandling of the mark-stack position and recovering from C-stack
overflow. Fix up that case.
2014-07-30 07:20:45 +01:00
Matthew Flatt
807b909e73 allow expand on cross-phase-persistent modules
Previoulsy, `expand` mode explicitly disallowed cross-phase declaration
in commit 2e652fc2b3. I'm not sure why, and that commit has no test
case that fails when the restriction is removed, so my best guess is
that it was a debugging strategy that I forgot to undo.
2014-07-30 06:30:44 +01:00
Leif Andersen
027fb52c66 mz-gdbinit script gives type when using pso
The mz-gdbinit script (generated by mk-gdbinit.rkt) gives the type when using
pso, even when the default template did not include the type.

It defaults to printing out only the name of the type without additional
information.
2014-07-29 14:22:07 +01:00
Matthew Flatt
41e7d346d1 adjust link-all to avoid conflicts 2014-07-29 10:48:33 +01:00
Matthew Flatt
04c36e2c09 adjust pack-all script to flush status messages 2014-07-29 10:48:32 +01:00
Matthew Flatt
135ccf094e Windows: use native Win32 API for dates
Allows conversion of negative "seconds" to reach dates before
1970, and fixes year-varying DST tracking for versions of
Windows that know about those details.

As far as I can tell, we have to compute ourselves whether a
date is in daylight-saving time based on specifications of
when daylight and standard times start. That part seems tricky
and could use extra review.
2014-07-25 15:37:35 +01:00
Matthew Flatt
816d09bb24 macro expander: fix #%top via local-expand
Fix bug in b25a2b83ba that breaks the teaching languages.
2014-07-25 11:21:20 +01:00
Matthew Flatt
8f8e3b7c65 close hole in chaperone implementation
Problem, example, and solution from Sam; see the dev mailing-list post
on 24-JUL-2014.

When a chaperoned accessor, mutator, or property accessor is used to
chaperone a struct, the chaproning procedure must not be able to
see things that the chaproned accessor, mutator, or property accessor
would not allow.
2014-07-25 11:02:08 +01:00
Matthew Flatt
b25a2b83ba The implementation of #%top within a module has, for a while,
required that the identifier wrapped by `#%top` not have a local
binding. Change the documentation to match the implementation in that
way. (Since local binding in an identifier's lexical information
contributes to its identity as a top-level binding, that specification
of `#%top` would make sense everywhere, but I've left the top level
alone for backward compatibility.)

Also, change `local-expand` to never introduct `#%top`
wrappers. That's a little more consistent with what `#%top` has
evolved to mean, and it specifically works better with
`local-expand/capture-lifts`.

Closes PR 14635 and PR 14654
2014-07-25 09:07:46 +01:00
Matthew Flatt
ccda0e4abb macro expander: fix identifier-binding on fully expanded module
Fix the case of an identifier that is used as a binding in a module
but originated from a different module.
2014-07-25 07:21:06 +01:00
Matthew Flatt
1809df456a regexp-match: tune chunking of UTF-8 decoding
A `string-split` on a big string with lots of small matches sends the
regexp matcher a big string many times. Decoding 1024 bytes each time
is too much. Decoding 32 bytes is be a better trade-off between
chunking for large matches and being lazy for small matches.

For example, on a 60MB string with a space every 15 characters or so,
splitting on a space is about 3 times as fast with this adjustment.

I tried a few chunk sizes, and 32 worked the best in my experiments.
Naturally, as more bytes are read, the chunk size ramps up, so it's
a question of initial size; larger matches are relatively insensitive to
the initial size (so, again, it makes little sense to cater to large
matches with a large initial decoding size of 1024 bytes).
2014-07-24 16:07:01 +01:00
Matthew Flatt
fffcf9f921 equal?: remove redundant eqv? test 2014-07-24 14:39:51 +01:00
Matthew Flatt
f0e710179c filesystem-change-evt: report inotify_init() error correctly 2014-07-24 14:12:17 +01:00
Matthew Flatt
c570a86201 streamline some paths for equality and hashing
Cuts about 1/3 of the time for a string-hashing microbenchmark
provided by Pedro Ramos:

 #lang racket
 (define alphabet "abcdefghijklmnopqrstuvwxyz")
 (define (random-word n)
   (build-string n (lambda (x) (string-ref alphabet (random 26)))))
 (define words (for/list ([k 1000000])
                 (random-word 3)))
 (define d (make-hash))
 (time (for ([w (in-list words)])
         (if (hash-has-key? d w)
             (hash-set! d w (add1 (hash-ref d w)))
             (hash-set! d w 1))))
2014-07-24 13:33:11 +01:00
Matthew Flatt
a95e279219 fix submodule export of enclosing module's binding
When `x` and `x`-with-a-mark are both defined, then the order of
definitions affected the binding that `(provide x)` would export
in a submodule that uses `#f` as its language. The problem was
in the implementation of the implicit `require`, which needs to
look up a variable's symbolic name in two different environments
to set up the right mapping.
2014-07-23 16:46:51 +01:00
Matthew Flatt
df5bfe19c0 sync: accept 0 arguments
As suggested by Jonathan Schuster.

Note that the `choice-evt` constructor already accepted 0 arguments.
2014-07-23 07:55:17 +01:00
Matthew Flatt
7a5746d9a7 future: fix completion of a future that ends with a delayed tail call
The completion needs to be set up as an lightweight contination so
that it can be captured.

Merge to v6.1
2014-07-17 17:02:02 +01:00
Matthew Flatt
4541a75e76 future: fix slow path for inlined struct getter
Merge to v6.1
2014-07-17 17:02:01 +01:00
Matthew Flatt
76aefcb508 fix sleep timeout in scheduler
In the case that the current time equals exactly the timeout of
a `sync/timeout`, the Racket process could get stuck (using no CPU)
instead of continuing as it should.

How did we not find this before? Why am I suddenly able to replicate
the problem (i.e., hitting exactly the target timeout in the secheduler
at the millisecond granularity)?

Merge to v6.1
2014-07-17 07:53:55 +01:00
Matthew Flatt
bc69a9b05c Add replace-evt
As suggested by Jan Dvořák.

The event created by `replace-evt` is a kind of event-gated
version of `guard-evt`. In particular,

 (guard-evt thunk)

could be expressed as

 (replace-evt always-evt (lambda (_) (thunk)))

Use `replace-evt` as a shortcut for the case when you want to
synchronize on either A or C, but you need to wait for B to get C.
You could wait on A+B and then, if B is selected, wait on A+C;
wrapping B with `replace-evt` to generate C is a kind of shortcut that
is eaiser to write and avoids tear-down and re-setup of A.

The `replace-evt` constructor is more than a shortcut in the sense
that it builds the pattern A+B->A+C into `sync`, which enables
abstractions that need a B->C transition. So, `replace-evt` adds
expressiveness, but (perhap reassuringly) it does not add any new
rendezvous capability.

Naturally, the procedure given to `replace-evt` can produce
another `replace-evt`, and the event argument to
`replace-evt` could also be a `replace-evt`.
2014-07-15 15:22:11 +01:00
Matthew Flatt
a3af35754d prop:evt, prop:{input,output}-port and evt chaperones: fix up scheduling
Although it doesn't seem to be possible currently, avoid the case
that a property-based access or chaperone is called in a scheduler
context.
2014-07-15 09:12:14 +01:00
Matthew Flatt
fed14e1ce1 prop:evt: support chaperone when extracting field
Thanks to Sam for noticing this problem.
2014-07-15 08:50:13 +01:00
Matthew Flatt
a027e1445f chaperone-evt: don't drop other chaperones 2014-07-15 07:58:15 +01:00
Matthew Flatt
c72f441d93 JIT: fix array-size expression that is handled badly by xform
This bug (in xform, really) appears to be responsible for recent "JIT
buffer overflow" crashes. It could also cause other memory-corruption
crashes.

The bug could be triggered by any program that uses operators like
`+`, `<`, and `bitwise-ior` on more than 2 and less than 6 operands
(which is a lot of programs), but only if a certain allocation and
GC pattern happens at just the right time (which is why a crash was
relatively rare).

Merge to v6.1
2014-07-13 18:41:11 +01:00
Matthew Flatt
75e201cc06 optimizer: fix tail-position bug in recent optimizer change
Fixes a problem with a7a912eeab.

The existing test suite caught this bug, but I somehow overlooked
the failure report.
2014-07-11 13:59:57 +01:00
Matthew Flatt
f57c1c8e2a fix GC-cooperation bug in vector->values
The `vector->values` function set up multiple return values
badly in the case that the given vector is chaperoned.
The problem could lead to NULL as results for `vector->values`.

Merge to v6.1
2014-07-11 13:31:17 +01:00
Matthew Flatt
94bd5369b5 avoid over-large buffer for tail calls
Applying to a large number of arguments once causes the run-time
system to maintain a too-large buffer for managing tail calls in
the future. Decay the buffer size as it is reallocated.
2014-07-11 07:43:02 +01:00
Matthew Flatt
a7a912eeab optimizer: generalize moving expressions to single-value context
Gemeralize Gustavo's change so that immediately-used right-hand sides
can be moved into any position that (like the binding context) enforces
single-valuedness --- for arbitrary right-hand expressions.
2014-07-11 06:02:14 +01:00
Gustavo Massaccesi
25c05d66b6 optimizer: allow to move once_used to test position 2014-07-11 06:02:14 +01:00
Gustavo Massaccesi
82ffd40592 optimizer: transform (if v x v) to (if v x #f) 2014-07-11 06:02:14 +01:00
Matthew Flatt
8f20264a83 fix marshaling of #'(.... . ()) to bytecode 2014-07-11 06:02:13 +01:00
Matthew Flatt
7ccac3c054 fix guard on references to unsafe functions in bytecode
The protection against unsafe-function references was designed for
bytecode that referred to unsafe operations indirectly, and that
was broken when the compiler changed to refer to unsafe functions
directly in bytecode (to simplify JIT inlining bytecode optimization).
Actually, the relevant code (now removed) seems to be pointless,
since protected-binding checking should cover it already. Maybe
something else changed, or maybe the code was not properly checked
in the first place.

Now, `read` rejects a bytecode stream if it contains a direct
reference to an unsafe function and the code inspector is not the
original code inspector. It's still possible to synthesize bytecode
that contains an indirect reference, and then protected-binding
checking does its job.
2014-07-10 07:10:03 +01:00
Matthew Flatt
efa9a1e920 fix protected-export checking in dynamic-require
The `dynamic-require` funciton was not checking correctly for
re-exported bindings.
2014-07-10 07:10:03 +01:00
Matthew Flatt
8559192944 fix order of file close and kqueue de-registration
Thanks to memcheck.

Merge to v6.1.
2014-07-10 07:10:03 +01:00
Matthew Flatt
45eb084d27 fix uses of uninitilized memory
Thanks to memcheck. (I'm unable to get far with Racket and memcheck,
but I get this far.)

Merge to v6.1.
2014-07-10 07:10:03 +01:00
Ryan Culpepper
406ba23077 Post-release version for the v6.1 release 2014-07-08 20:54:31 -04:00
Matthew Flatt
139452dcc2 read: fix long-double error reporting
This repair corrects an ocassional test failure in the `read`
test suite.
2014-07-08 08:00:16 +01:00
Matthew Flatt
7dde0e98cf refine attempt at debugging output for JIT buffer overflow 2014-07-08 07:02:42 +01:00
Juan Francisco Cantero Hurtado
6922ba8c23 Define SCHEME_PLATFORM_LIBRARY_SUBPATH for some architectures on OpenBSD 2014-07-07 06:17:40 +01:00
Matthew Flatt
8d6870a7c3 fill in some missing history on Racket's slice of lightning 2014-07-04 06:21:26 +01:00
Matthew Flatt
f93f52474f fix encoding of CMN in ARM JIT
It looks like bits 12 through 15 of the ARM encoding for CMN
should be 0s, not 1s, although many processors don't care.
2014-07-04 05:17:20 +01:00
Matthew Flatt
b99260bb32 fix declaration for non-places, non+futures build 2014-07-04 05:17:20 +01:00
Matthew Flatt
116555c517 optimizer: fix crashing bug
A continuation of 22b7cc6a5e: a second old bug in
shift_closure_compilation() than became more exposed.
2014-07-02 12:09:50 +01:00
Matthew Flatt
31c35d8da2 add missing casts that are required by some C compilers 2014-06-26 13:06:42 +01:00
Matthew Flatt
5cbe6cfdcb work around bug(?) in Mac OS X select()
Using select() to check whether a pipe is ready for writing seems to
fail on Mac OS X 10.8 and 10.9. See the PR for a small C program to
demonstrate. It's possible that the small program is broken and
there's no bug, but the program works on Linux and on Mac OS X 10.7
and 10.6.

Although poll() seems to work, switching completely to poll() is not a
good option on Mac OS X, since poll() does not support devices on that
platform.

The kqueue() facility seems to handle pipes and writing ok, so work
around the bug by enabling the use of kqueue() on pipes.

Closes PR 14596
2014-06-25 09:56:44 +01:00
Matthew Flatt
94a5c6e3fb add more debugging output for a JIT-buffer-overflow internal error
Show the content of the buffer and the content of the temporary buffer
used to predict the size; then, I should be able to track down the
source of a mismatch.
2014-06-25 07:46:39 +01:00
Matthew Flatt
d3e008af50 racket/tcp: use %E instead of %e for socket error reporting
Using "%E" is right for WinSock errors, instead of "%e".
2014-06-24 11:40:21 +01:00
Matthew Flatt
58eab92dc3 Fix reading of badly encoded symbols from bytecode
This is the third try to fix the bug exposed by "fuzz.rkt". Previous
repairs addressed a symptom at the point of printing bad symbols,
instead of the cause at a failure to validate a symbol's encoding
when reading bytecode. This one fixes reading.
2014-06-23 16:21:48 +01:00
Matthew Flatt
408d6bb773 Fix UTF-8 symbol repair
Commit 6a5a3037b4 was not quite right, because it used sightly the
wrong variant among a dozen decoding functions.  The test suite caught
the problem, but I forgot to run it before pushing.

Also, repair the "Inside" documentation on the function that was
incorrectly used, and document the new variant.
2014-06-23 15:35:25 +01:00
Matthew Flatt
6a5a3037b4 avoid getting stuck on non-UTF-8 symbol encodings in bytecode
Found by fuzz tester, and this bug seems to be a common reason for
the fuzz test to time out.
2014-06-23 13:27:52 +01:00
Matthew Flatt
431321f2cb fix use of wrong comparsion macro
The wrong comparison could possibly (though not likely) cause an
operation-skipping optimization to be missed.
2014-06-23 10:44:56 +01:00
Matthew Flatt
93fdbdc79c optimizer: refine virtual clock, more precise shift-fuel tracking
Allow an effect-free `if` to not increment the effect-tracking
virtual clock (but increment the clock during branches, to avoid
moving computation into a branch).

Spend empty-`let`-elimination fuel more precisely, so that more
empty `let`s can be removed while still avoiding quadratic
compile times.
2014-06-23 06:28:50 +01:00
Matthew Flatt
22b7cc6a5e optimizer: improvements mostly for splitting of multiple-value bindings
Convert

 (let-values ([(<id> ...) (if <id-t>
                              (values <e1> ...)
                              (values <e2> ...))])
    ....)

to

 (let ([<id> (if <id-t> <e1> <e2>)]
       ...)
    ....)

which duplicates the `(if <id-t> ....)` test, but that's likely to
be worthwhile to avoid multiple-values shuffling and enable more
constant and copy propagation.

A related improvement is to more eagerly discard `let` wrappers
with unused bindings during optimization, which could enable
further optimization, and allow moving conditionals relative
to other expressions to avoid intermediate binding.

Eagerly discarding `let` wrappers exposed a bug in the optimizer's
shifting of variable locations by exercising the relavant shifting
operation in shift_closure_compilation().

Closes PR 14588
2014-06-20 11:05:07 +01:00
Matthew Flatt
16a0727231 optimizer: fix reordering in let+values+values splitting
While the commit comment in 3150b31eb7 still seems right, the changed
overlooked the fact that the arguments to a split `values` might get
reordered (due to the way binding positions are calculated). Fix the
optimizer to make sure that reordering is allowed.

The change touches a lot of code, because we want to use
"omittable" to implement "movable", and it's not ok to
reorder access of mutable variables (in case some other thread is
mutating them). We have to fix all the calls to "omittable"
to support the slight generalization.
2014-06-20 08:08:17 +01:00
Matthew Flatt
da979b6c8d optimizer: fix with-continuation-mark optimization
Misuse of the function to optimize applications constrained the
body of a `with-continuation-mark` form to a single result
value.
2014-06-20 06:41:39 +01:00
Matthew Flatt
9c05eff875 make installers: give MSVC setup "x86_amd64" instead of "x64" by default
The "x86_amd64" mode seems to work more often, especially with
Visual Studio Express installations.
2014-06-19 15:09:26 +01:00
Matthew Flatt
92f76764c7 optimizer: recognize that arguments to void are ignored 2014-06-19 15:09:26 +01:00
Matthew Flatt
780a825d34 optimizer: boolean conversion on app of predicate-matching primitives 2014-06-19 15:09:26 +01:00
Gustavo Massaccesi
50ef3a8295 optimizer: optimizes the argument of not in a Boolean context
This enables more reductions, for example: (not (if x y 2)) => (not (if x y #t))
2014-06-19 15:09:26 +01:00
Matthew Flatt
23f6d1a651 optimizer: reorganize & generalize dropping of ignored operations
The optimizer was willing to convert `(pair? (cons w (random)))` to
`(begin (random) #t)`, but not `(car (cons w (random)))` to
`(begin (random) w)` because the `(car (cons ....))` transformation
required simple ignored arguments. Put the treatment of ignored,
non-omittable arguments of a dropped operation in one place. Also,
recognize expressions within `begin` whose results will be ignored.
2014-06-19 15:09:26 +01:00
Matthew Flatt
9fed5b585a windows: fix symbolic link handling to match the OS
Windows parses relative-path links with yet another set of rules ---
slightly different from the many other existing rules for parsing
paths. Unfortunately, a few OS calls don't provide an option for
having the OS follow links, so we have to re-implement (our best guess
at) the OS's parsing of links.
2014-06-19 05:28:16 +01:00
Matthew Flatt
e1c735f66f win64: fix fixnum-to-extfl conversion 2014-06-19 05:28:16 +01:00
Matthew Flatt
3e3cb71680 win32: support symbolic links
Windows supports symbolic links in Vista and later.
2014-06-19 05:28:16 +01:00
Matthew Flatt
c8c0972fec ignore .sl.cache files
Created by `msbuild`?
2014-06-19 05:28:15 +01:00
Matthew Flatt
2193d2ad87 optimizer: add missing "else"
Thanks to David Vanderson
2014-06-19 05:28:15 +01:00
Matthew Flatt
6a1ace3522 optimizer: unwrap let and begin around constant test in if
Takes advantage of Gustavo's improvements
2014-06-17 12:41:23 +01:00
Gustavo Massaccesi
2063511bfd optimizer: local known to satisfy predicate => #t in a boolean context
For example, `(if (pair? x) (if x e1 e2) e3)` => `(if (pair? x) e1 e3)`.
2014-06-17 12:41:23 +01:00
Gustavo Massaccesi
7cb37d1bc8 optimizer: reduce constants to #t/#f in boolean contexts
While something like `(if 7 e1 e2)` was already reduced to `e1`,
this improvement makes `(if (let ([x (random)]) 7) e1 e2)`
reduce to `(if (let ([x (random)]) #t) e1 e2)`.
2014-06-17 12:41:23 +01:00
Matthew Flatt
36aaf3dd7b bitwise-bit-field: repair fixnum overflow problems
Bug reported by Roman Klochkov
2014-06-17 07:17:16 +01:00
Matthew Flatt
6778604bd2 Makefile: improve DESTDIR support 2014-06-16 11:41:00 +01:00
Matthew Flatt
4f96f6fe62 Windows: long double fix for MSVC 2013 2014-06-16 10:25:34 +01:00
Matthew Flatt
cee00a1c6e Windows build: use msbuild instead of devenv or vsexpress 2014-06-16 10:25:34 +01:00
Matthew Flatt
5e3ddea2ae syntax-local-lift-...: fix for use during module visit
Closes PR 14573
2014-06-15 09:24:11 +01:00
Matthew Flatt
49691c4000 fix glib build for Windows 64
The previous build attempted to cooperate with Valgrind in a way that
truncates a 64-bit address to a 32-bit address. Disable Valgrind
cooperation. (Other builds seem ok for now, but future rebuilds will
disable Valgrind cooperation for them, too.)
2014-06-13 16:32:51 +01:00
Matthew Flatt
dda2520a12 fix --enable-sgcdebug build 2014-06-13 16:32:51 +01:00
Matthew Flatt
aa487175ad change default MSVC projects to Visual Studio 2010 (version 10) and up
Visual Studio 2008 is still supported by "9.sln" projects and
".vcproj" files, while ".sln" and ".vcxproj" work for 2010, 2012,
and 2013. The "build.bat" script detects which version of
Visual Studio is active and uses the appropriate ".sln" files.

The bad news is that we have two copies of each project until we
decide to drop support for Visual Studio 2008. (We had two copies
before, but one copy was unmaintained.) The good news is that
we have only 2 copies of each project, because recent versions of
Visual Studio are willing to use 2010 projects as-is.

Change project and related files to text instead of always CRLF,
because that seems to be ok for modern Windows tools.
2014-06-13 16:32:51 +01:00
Matthew Flatt
b7610c405d distro-build: move a file out that is accessed directly
The "pack-all.rkt" file is needed before (and only before) the
distro-build package itself is ready, so move it to the "racket/src"
directory.
2014-06-13 16:32:51 +01:00
Matthew Flatt
f90bf5e43b win32: repair for VS Studio build
Thanks to Gustavo Massaccesi

Closes PR 14555
2014-06-09 06:57:22 -06:00
Matthew Flatt
8aaa3fc5b5 document and deprecate 3-argument call to default module name resolver
Calling the default module name resolver with three arguments logs an
error message. The intent is that 3-argument support will be removed,
eventually.
2014-06-09 08:46:44 +01:00
Matthew Flatt
b055db088c racket/base: fix module-compiled-submodules name handling
Mandled name handling breaks pkg binary-mode submodule stripping.
2014-06-02 21:34:42 +01:00
Matthew Flatt
8638a55b67 optimizer report use-before-definition check at debug level
It's too common and noisy as a warning.
2014-06-02 19:59:30 +01:00
Matthew Flatt
e17acf5fef Win64: fix JIT floating-point constant
Repairs commit 71591a62a4 for Win64, where `long` != `intptr_t`
2014-06-02 18:26:50 +01:00
Matthew Flatt
a539f4ed25 fix typo in Windows "build.bat" 2014-06-02 17:27:09 +01:00
Matthew Flatt
43d81b06da fix collection-file-path & related for binary package installation
Binary package installation failed in the case of collection
splicing, because module-name resolution via `collection-file-path`
did not check for compiled files along hte search path of
registered collection directories.
2014-06-02 11:57:08 +01:00
Matthew Flatt
9d94ef725e update bytecode compiler/optimizer overview in source comments
Explain the recently added "letrec_check" pass.
2014-05-31 20:26:16 +01:00
Matthew Flatt
1558e1243a JIT: improve transition from 32-bit to 64-bit jumps
Use a recursive call to try again, instead of trying to reset local
state. The reset-local-state variant is definitely broken in
some caes, though I could not provoke the JIT buffer overflow
that I was hoping to fix with this change.
2014-05-31 20:26:16 +01:00
Matthew Flatt
2eef2ce409 optimizer: fix inference bug
The optimizer's inference that could incorrectly that that a
conditional produced a flonum (when it actually produced a fixnum or a
fixnum in one branch and flonum in the other).
2014-05-30 18:50:26 +01:00
Matthew Flatt
948a709b47 clarify comment in JIT implementation
Refines commmit c0ec9702e8.
2014-05-30 12:51:53 +01:00
Matthew Flatt
d1be74fc3b compiler letrec_check pass: recognize effect-free primitives
As in "Fixing Letrec". This improvement corrects a performance
regression with the revised expansion of R5RS `letrec`, which
wraps right-hand sides with `values`.

Besides detecting effect-free primitives, we have to fix the
treatment of the right-hand side for a multi-binding `letrec-values`
clause. For now, we conflate all of the bindings in a single
clause.
2014-05-30 12:51:21 +01:00
Matthew Flatt
71591a62a4 JIT: better code for floating-point constants on x86+SSE 2014-05-30 08:18:25 +01:00
Matthew Flatt
9b1a2e7b37 JIT: minor comparison repairs
Fix some comparisions that are written as pointer comparisons
when they're actually integer comparisons. Also, remove an
unnecessarily slow variant of pointer compairson for x86_64.
2014-05-30 07:51:05 +01:00
Matthew Flatt
c0ec9702e8 JIT: fix potential problem in transition to 64-bit jumps
On x86_64, the JIT compiler initially generates code with 32-bit
jumps, but it switches to 64-bit jumps when so much code is allocated
that it gets spaced out enough. That transition could happen during a
recursive call to the JIT compiler or while one place is in the JIT
and other installs a shared code pointer, in which case a bad jump
could be generated. This problem is unlikely to happen, but it looks
possible.
2014-05-30 07:07:28 +01:00
Matthew Flatt
9393592a80 optimizer: another little step toward type inference
Generalize some of the tracking and optimization of predicates
with respect to constructors and bindings.

This generalization exposed an old bug in the optimizer, which is
that information accumulated in the "then" branch of a conditional
was not reliably flushed when continuing analysis after the conditional.
2014-05-29 09:22:29 +01:00
Matthew Flatt
eac2ce0ef6 optimizer: ad hoc optimization of predicates applied to constructions
This is probably more of a job for Typed Racket, but maybe it's
useful to detect some obviously unnecessary allocations of lists, etc.

Closes PR 14532
2014-05-28 20:11:24 +01:00
Matthew Flatt
ca315e6f34 optimizer: more ad hoc car and cdr cases
Closes PR 14533
2014-05-28 19:55:42 +01:00
Matthew Flatt
dad9d001e1 optimizer: enable movement of constants that shouldn't be duplicated
Closes PR 14531
2014-05-28 19:55:41 +01:00
Matthew Flatt
ec96592702 optimizer: treat known procedure bindings, etc., as #t for if
Closes PR 14526
2014-05-27 09:27:15 +01:00
Matthew Flatt
e16b6fd06e logger: fix problems with level checking, add option to log-message
Logged messages could get dropped if a log receiver is specialized
to a name that is provided as an argument to `log-message` instead
of used from the target logger.

Add an option to `log-message` to avoid adding the name to the
start of the message string, which is needed to propagate messages
from one logger to another.
2014-05-26 18:56:50 +01:00
Matthew Flatt
0e9f468d3f repair JIT bug
The bug incorrectly tracks the value that is available in virtual
register R0 --- only in the case that some value was known to be ready
in R0, and some other value was known to be ready in R1, and a value
is moved from R1 to R0.

Closes PR 14523
2014-05-25 21:45:20 +01:00
Matthew Flatt
dfeba12997 MzCOM: avoid the ATL framework
Building MzCOM without ATL means that Visual Studio Express --- or
other free compilers, in principle --- can build MzCOM. It also cleans
up and simplifies the build.

The non-ATL implementation is based on "Com in Plain C" by
Jeff Glatt, and uses a lot of his code (with instructive
comments intact).
2014-05-21 08:58:33 +01:00
Matthew Flatt
165bae6c2c repair and streamline VS 2008 projects 2014-05-21 08:51:37 +01:00
Matthew Flatt
a57e712ba3 add scheme_jit_now() 2014-05-20 09:01:40 +01:00
Matthew Flatt
9b78847be0 add unix-style makefile target
Also, revise "INSTALL.txt" to better explain the build options.
2014-05-20 09:01:40 +01:00
Matthew Flatt
a0485cb58c fix build for module name resolver cache change
The xform bootstrap sets `current-library-collections-path` without
changing the namespace, which is a bad idea that was exposed by
the module name resolved cache change (commit a7ad0e3a01).
2014-05-17 21:25:05 +01:00
Matthew Flatt
02bc905c02 repair for identifier handling
Repairs commit d67082ea60.
2014-05-17 19:56:25 +01:00
Matthew Flatt
35c996d041 add scheme_jit_find_code_end 2014-05-17 07:20:04 +01:00
Matthew Flatt
d67082ea60 adjust handling of identifiers without module context by set!
... and `#%variable-reference`, adding a special case for an identifier
that is bound in the encloding module.
2014-05-17 07:20:04 +01:00
Matthew Flatt
a7ad0e3a01 default module name resolver: fix cache
The cache was keyed on `current-library-collection-paths`, but
not other parameters such as `current-library-collection-links`,
so it was too "sticky" in the case that some parameters changed.
Adjust the cache to be specific to loaded module in a namespace's
module registry.
2014-05-14 06:10:50 -06:00
Matthew Flatt
be04593a31 fix bug in insertion of guards to prevent use before definition 2014-05-12 08:09:23 -06:00
Matthew Flatt
1d87c95bf0 reduce calls to current-process-milliseconds on thread swap
Call `current-process-milliseconds` once per swap, instead of twice.
2014-05-12 04:57:44 -06:00
Matthew Flatt
98b91a11e4 faster path for TCP input
Avoid polling a file descriptor to determine whether it has bytes;
just try to read, and then go to epoll/kevent mode when available,
skipping a poll/select.
2014-05-12 04:57:44 -06:00
Matthew Flatt
97da48ab67 remove/adjust obsolete C preprocessor cases
Mac OS Classic and Palm ae long since unsupported.

TCP support implies sockets (since old Mac TCP is gone).

For what it's worth, make the build work without TCP support, although
no one ever builds that way.
2014-05-12 04:57:44 -06:00
Matthew Flatt
b15aea28c2 fix accidental disabling of thread-specific process-milliseconds 2014-05-10 19:29:54 -06:00
Matthew Flatt
d5b42f8c50 add plumbers, remove custodian-tidy-all
In v6.0.1.7, I tried to give a port-flushing job to custodians. They
turned out to be unqualified, so let's try employing specialists.

Thanks to Eli for pointing out the problem with the v6.0.1.7 design:
attaching callbacks to custodians allows a sandboxed task to escape
through the custodian hierarchy. Plumbers avoid this problem by
having no hierarchy.
2014-05-09 07:06:27 -06:00
Matthew Flatt
1bd604073a add custodian-tidy-all 2014-05-07 07:41:13 -06:00
Matthew Flatt
2e284cc783 enable DWARF-based stack unwind for x86
Newer versions of gcc seem to use -fno-frame-pointer by
default for x86, which disables Racket's stack traces.
Use DWARF information to get them back.
2014-05-04 11:47:31 -06:00
Matthew Flatt
9cd528ca08 racket/base: add #:for-module? argument to open-input-file
Exposes a feature that is used by the default load handler to
raise `exn:fail:{syntax,filesystem}:missing-module` exceptions.
2014-05-03 20:05:59 -06:00
Matthew Flatt
573c127002 make pkg-links: shortcut for no-change case
Taking a shortcut skips dependency and module-declaration checks, but
that job is now covered by `raco setup`.
2014-05-02 12:30:31 -06:00
Matthew Flatt
68421f05dd places: improve comments on msg_chain treatment 2014-05-01 19:13:55 -06:00
Matthew Flatt
6d4c25a322 places: fix gc of place channels containing place channels
The bug was a kind of typo: using `&` where `%` was intended to
implement a counter wraparound.

This bug is an even more likely candidate to be resopnsible for the
occassional crashes from the DrRacket easter-egg test.
2014-05-01 19:13:55 -06:00
Matthew Flatt
04a60d713b fix sync on inaccessible place channel
Commit 5ea4c2ab68 broke GCing of a thread that is blocked
via `sync` (as opposed to `place-channel-get`) on a place
channel whose write end is inaccessible.
2014-04-29 12:56:19 -06:00
Matthew Flatt
f2335ae4dc fix performance bug in equal? on vectors 2014-04-29 06:58:36 -06:00
Matthew Flatt
afb75c7cfe linux: close "/proc/self/maps" after finding the stack base 2014-04-28 17:50:50 -06:00
Matthew Flatt
acf250891f fix wrong size for memset
Probably the assignments cover the structure, anyway.
2014-04-28 17:42:17 -06:00
Matthew Flatt
2ff4802a14 configure: for BSDs, enable pthreads by default, but don't force enabled 2014-04-28 13:07:26 -06:00
Matthew Flatt
bc871b904e need CAS only for futures or places 2014-04-28 13:07:26 -06:00
Matthew Flatt
04c4538f44 speed up inexact->exact
Parse IEEE floating-point numbers directly.

Thanks to Neil T.!
2014-04-27 16:51:23 -06:00
Matthew Flatt
d682c940bd repairs to precision of exact->inexact et al.
Thanks to Neil T.!
2014-04-27 16:51:23 -06:00
Matthew Flatt
64bfb58dad racket/base: add string-port? 2014-04-27 10:25:06 -06:00
Matthew Flatt
83dcf446a3 fix clean-up handling for the main thread of a terminated place
This bug might be reposnible for the occassional crashes seen in
DrDr for the easter-egg test.

Merge to v6.0.1
2014-04-27 09:15:18 -06:00
Matthew Flatt
5232b099a2 revise error printed for kernel-/debugger-sent SIGSEGVs 2014-04-27 09:15:17 -06:00
Matthew Flatt
cdd6bf438a no getprotobyname on Android 2014-04-26 20:10:52 -06:00
Matthew Flatt
ffb0dd52c5 ARM JIT: fix software floating-point
I broke uses of LDRD and STRD when compacting the set of registers
used by the JIT. The LDRD and STRD instructions are given one
register explicitly, but they implicitly use the next regsister, too,
and the specified register must be even-numbered. Lining up a pair of
registers requires a little shuffling before and after the operation.

Also, the LDRDI and STRD encodings were broken, and the inlined
fl->fx conversion was not right.

Closes PR 14470
2014-04-26 20:10:51 -06:00
Matthew Flatt
b88f391c1c configure: add --enable-sysroot
The `--enable-sysroot` flag simplifies an Android cross-compilation,
for example.
2014-04-26 20:10:51 -06:00
Matthew Flatt
4d2b24b325 clean-ups to commit 4fde0e9901 2014-04-24 10:21:52 -06:00
Matthew Flatt
4fde0e9901 avoid write-barrier memory protection for 'atomic-interior allocation
Split 'atomic-interior allocation to separate pages from other 'interior
allocation, and do not page-protect 'atomic-interior memory. Otherwise,
atomic-interior memory passed from one place to another --- especially
via the `#:in-original-place?` option on foreign functions --- can crash
due to triggering a write barrier in the wrong place.

Commit c18f6e8d6d, which changed some cross-place arguments to Pango and
Cairo to be 'atomic-interior, exposed the problem.

Merge to v6.0.1
2014-04-22 09:36:37 -06:00
Matthew Flatt
6856e5253f fix incorrect sharing of submodule-declaration tables
Cuts the peak memory use of

 racket -c -l match

from 1.2 GB to 400 MB on a 64-bit machine.
2014-04-21 15:41:59 -06:00
Matthew Flatt
7f8f8c0b59 dump-memory-stats: add mode to return a tag count 2014-04-21 15:41:59 -06:00
Matthew Flatt
0985bcda66 minor allocation speedup for immutable hash tables 2014-04-21 15:41:58 -06:00
Matthew Flatt
4e3ff69798 fix taint-transparent syntax to lose lexical context
When submodules were introduced, the handling of taint-transparent
syntax changed to keep its lexical context. Restore the original
behavior, which is necessary to protect bindings, and fix taint
handling on submodules.
2014-04-20 20:20:33 -06:00
Matthew Flatt
7bccae1ce0 fix type mismatch in JIT 2014-04-19 15:21:26 -06:00
Matthew Flatt
3fa9f99e2c racket/unsafe/undefined: add chaperone-struct-unsafe-undefined 2014-04-19 11:14:37 -06:00
Matthew Flatt
a01b12e5ef optimizer: don't move expressions into a with-continuation-mark
... unless the optimizer can prove that the expression doesn't
inspect continuation marks.
2014-04-19 11:14:37 -06:00
Matthew Flatt
46a66819cc add 'undefined-error-name property for letrec bindings 2014-04-17 06:58:01 -06:00
Matthew Flatt
13db06d5df racket/draw Cocoa: fix (again!) surroate-pair patch for Pango 2014-04-17 06:37:15 -06:00
Matthew Flatt
22b48e03c8 make assignment-before-initialization an error
Recent changes made use-before-initialization an error for
`letrec` bindings, `class` fields, and `unit` definitions.
Now, assignment-before-initialization is also an error.
2014-04-17 06:37:15 -06:00
Matthew Flatt
52ea013f87 add static annotations on local functions 2014-04-17 06:37:14 -06:00
Claire Alvis
a6ea577869 make indentation match other files
(Actually by Matthew, but setting Claire as the author so
that it will be easier to see via `git blame` in the future
if I mangle Claire's code.)
2014-04-17 06:37:14 -06:00
Matthew Flatt
d212fc7eba racket/draw Cocoa: fix surroate-pair patch for Pango 2014-04-16 12:53:07 -06:00
Matthew Flatt
6ce5e3d34a optimizer repair related to use-before-defined
Don't optimize away a use-before-definition in an early compiler
pass. (More specifically, adjust the meaning of a flag within an
optimization helper function so that it works for decisions before the
letrec-fixing pass.)
2014-04-16 07:02:50 -06:00
Matthew Flatt
2b63977f24 avoid compiler warnings 2014-04-15 20:15:05 -06:00
Claire Alvis
a283f3d804 removing dead code in fun.c 2014-04-15 15:06:41 -06:00
Matthew Flatt
d4cf4f4ee8 remove unnecessary "return;"s
Some compilers particularly dislike

 return function_that_returns_void();
2014-04-15 15:06:41 -06:00
Matthew Flatt
0fcde57817 fix Windows projects for new file 2014-04-15 15:06:41 -06:00
Matthew Flatt
574b8a5d3b move internal undefined to unsafe-undefined 2014-04-15 15:06:28 -06:00
Claire Alvis
fbb419a9fa removing debugging code 2014-04-15 15:06:26 -06:00
Matthew Flatt
714ac04b55 JIT-inline check-not-undefined 2014-04-15 15:06:25 -06:00
Claire Alvis
72c958df62 all necessary changes to check references to uninitialized letrec variables
includes a new pass, letrec_check, two new primitives, and
changes to packages that grabbed the letrec undefined value
2014-04-15 15:03:10 -06:00
Matthew Flatt
800641e11a racket/draw Cocoa: hack to make Courier New work in 10.{7,8}
The bounding box in the Courier New font is wrong in Mac OS X
10.7 and 10.8. Recognize that combination and make the bounding
box bigger as a workaround.
2014-04-15 14:57:49 -06:00
Matthew Flatt
16dcc6f62a fix excessive correction of bounding
Commit 69984fb231 extended glyph bounding boxes in the wrong
(pre-scaled) coordinate system.
2014-04-15 14:40:13 -06:00
Matthew Flatt
69984fb231 racket/gui Cocoa: repairs for Cairo and Pango
* Fix a clipped-rendering problem for text in Cairo.

 * Fix Pango's CoreText back-end to support non-BMP characters.

   Note that Emoji characters still do not render. Cairo uses
   CGContextShowGlyphsWithAdvances() to draw glyphs, but it
   would need to use CTFontDrawGlyphs() to make Emoji work.
   (Mozilla has a patch to do that for some older version
   of Cairo, so look there if it seems worth doing one day.)

 * Disable Pango's CoreText font fallbacks in favor of the
   Racket-implemented fallback.

   This is not obviously a good idea, but it restore the
   `racket/draw` hack of prefering "Arial Unicode MS". Otherwise,
   various symbol glyphs are chosen badly, such as #\u273A,
   at least on my machine.

 * Drop the clusters argument to `pango_cairo_show_glyph_string`,
   which turns out to be unnecessary.
2014-04-15 11:22:54 -06:00
Matthew Flatt
8bbc00c7c1 fix equal? on chaperoned values
Recursive traversal of components should use chaperoned access of
the components, not direct access.
2014-04-14 10:14:20 -06:00
Matthew Flatt
393456563e avoid overflow in poll() timeout calculation
Closes PR 14410

Merge to v6.0.1
2014-04-13 19:09:08 -06:00
Matthew Flatt
414507699b fix problem with syntax-local-lift-require
Closes PR 13797

Merge to v6.0.1
2014-04-13 19:08:56 -06:00
Matthew Flatt
4807dce556 fix equal-[secondary-]hash-code for impersonators
Merge to v5.0.1
2014-04-13 08:38:38 -06:00
Matthew Flatt
1f5d08dc29 fix a leak related to submodules
The leak caused compile-time environments to be retained until
the next module complation, so it doesn't affect much.
2014-04-12 09:35:07 -06:00
Matthew Flatt
86d5940139 clear a cached syntax object
Another potential (but minor in practice) leak
2014-04-12 09:35:07 -06:00
Matthew Flatt
9c74269877 compile: fix namespace leak related to submodules and compilation
A reference intended to be temporary from a submodule to its enclosing
module wasn't NULLed out.
2014-04-11 06:20:34 -06:00
Matthew Flatt
23cf3ba11e upgrade pre-built libraries for Windows and Mac OS X
Mostly upgrades the drawing stack to the latest Cairo, Pango, Glib,
etc., but also upgrades the OpenSSL library on Windows to 1.0.1g.

The new "racket/src/native-libs" directory provides scripts to
rebuild the libraries from source. Those script are fragile, because
library sources and configuration scripts are fragile. The
scripts at least archive some expertise/advice in a mostly executable
form.
2014-04-09 07:35:37 -06:00
Ryan Culpepper
152cf764a0 Post-release version for the v6.0.1 release 2014-04-08 08:47:35 -04:00
Matthew Flatt
15630b5245 avoid compiler warning 2014-04-05 07:31:58 -06:00
Matthew Flatt
6d54632319 places on Windows: fix OS thread identification
The bug particularly broke `#:async-apply` handling for an FFI callback,
causing the current thread always to be equated with the target thread.
For example, the teachpack documentation (which now renders images
to SVG) kept crashing on a multi-place build due to callbacks getting
invoked in the wrong place.
2014-04-05 07:13:28 -06:00
Matthew Flatt
1d8cfea1fc ffi/unsafe: add _stdbool 2014-04-04 09:57:42 -06:00
Matthew Flatt
120d17fccc fix makefile for MinGW cross-compile 2014-04-03 07:16:50 -06:00
Matthew Flatt
418ee07f4e module: disallow definition skipping
Invoking a non-composable, empty continuation during the right-hand
side of a variable definition skips the definition --- while continuing
the module body. The compiler assumes, however, that variable references
later in the module do not need a check that the variable is undefined.
Fix that mismatch by changing `module` to double-check that defined
variables are really defined before continuing the module body.
(The check and associated prompt are skipped in simple cases, such as
function definitions.)

A better choice is probably to move the prompt to the right-hand
side of a definition, both in a module and at the top level. That's
a much different language, though, so we should consider the point again
in some future variant of Racket.

Closes PR 14427
2014-04-01 18:15:01 -06:00
Matthew Flatt
709ff43174 unboxing improvement in the JIT
Improve the "can unbox test" to include patterns that were already covered
by the more restrictive "can unbox without disturbing N registers" test
(which is always tried first, but the weaker test recurs within patterns
that the stronger test does not recognize).
2014-03-27 14:30:03 -06:00
Matthew Flatt
6af65ee19a avoid compiler warnings 2014-03-26 12:46:01 -06:00
Matthew Flatt
cdce954128 configure: test for large page sizes
Intended to fix PPC64 builds.
2014-03-26 12:30:33 -06:00
Matthew Flatt
e28303033a tweak bitwise-operation optimization
Recognize arguments that are variables bound to fixnums.
2014-03-18 11:42:56 -06:00
Matthew Flatt
a86b851f74 fix compiler--validator mismatch on bitwise specializations 2014-03-18 09:16:58 -06:00
Matthew Flatt
6182541889 fix handling of code compiled to ignore
When the compiler sees `(if #f A B)`, it compiles A in a throwaway
mode, but the throwaway mode need to produce a slightly more plausible
result than it was so that further throwaway transformation is not
confused.
2014-03-16 09:18:40 -06:00
Matthew Flatt
8a5c50485c Another makefile CFLAGS/CPPFLAGS adjustment
Missed another spot in c97184b581.
2014-03-12 18:45:09 -06:00
Tony Garnock-Jones
139b228f2e Add TAGS target to toplevel makefile. Adjust clean target to match. 2014-03-12 18:45:09 -06:00