added fix for whole program/library compilation bug with help from
@owaddell who originally reported the problem in issue 386. this bug
arises from the way the parts of the combined library, and their
binary dependencies, are invoked when one of the constituent libraries
is invoked. consider, for example, a combined library that contains
(A) and (B), where (B) depends on a binary library (C). depending on
the sort order of (A) and (B), which may be unconstrained in the
partial ordering established by library dependencies, invoking (A) may
result in the invoke code for (B) being run first, without (B) ever
being explicitly invoked. this can result in bindings required from
(C) by the invoke code in (B) to be unbound. even in the case where
(A) comes before (B) in the topological sort, if they are combined
into the same cluster, (B)'s invoke code will be run as part of
invoking (A). the solution is two part: first we extend the invoke
requirements of the first library in the cluster to include the binary
libraries that precede it in the topological sort and add a dependency
on the first library in the cluster to all of the other libraries in
the cluster. this means no matter which library in the cluster is
invoked first, it will cause the first library to be invoked, in turn
ensuring the binary libraries that precede it are invoked. when there
are multiple clusters, a dependency is added from each cluster to the
first library in the cluster that precedes it. this ensures that
invoking a library in a later cluster first, will still cause all of
the dependencies of the previous clusters to be invoked. ultimately,
these extra dependencies enforce an ordering on the invocation of the
source and binary libraries that matches the topological sort, even if
the topological sort was under constrained. to maintain the property
that import requirements are a superset of the invoke and visit
requirements, we also extend the import requirements to include the
extended invoke requirements. the import requirements are also added
to the dependency graph to further constrain the topological sort and
ensure that we do not introduce artificial cycles in the import graph.
compile.ss,
7.ms,
root-experr*, patch*
original commit: 09bba001a33a5ee9268f1e5cf0cc118e8a2eec7f
exposed the default-library-search-handler and a library-search-handler
parameter to permit more control over the search for libraries during
import, compile-whole-library, and compile-whole-program
original commit: 7b4fdd374f9cb973de1143bfcc830194b36befda
controversial, unless I damaged something in the process of integrating
them with other recent changes. the user's guide and release notes
have been updated as well to reflect the changes of interest to end
users.
- the body of load-library is now wrapped in a $pass-time with
to show the time spent loading libraries separately from the time
spent in expand.
syntax.ss
- interpret now plays the pass-time game
interpret.ss
- added compile-time-value? predicate and
compile-time-value-value accessor
syntax.ss, primdata.ss,
8.ms, primvars.ms, root-experr*
- $pass-stats now returns accurrate stats for the currently timed
pass.
7.ss
- compile-whole-program and compile-whole-library now propagate
recompile info from the named wpo file to the object file
to support maybe-compile-program and maybe-compile-library in
the case where compile-whole-{program,library} overwrites the
original object file.
compile.ss,
7.ms, mat.ss, primvars.ms
- replaced the ancient and unusable bintar with one that creates
a useful tarball for binary installs
bintar
- generated Mf-install InstallBin (InstallLib, InstallMan) now
correctly indirects through InstallPrefix if the --installbin
(--installlib, --installman) configure flag is not present.
src/configure
- removed definition of generate-procedure-source-information
patch.ss
- guardian tconc cells are now allocated in generation 0 in the hope
that they can be released more quickly.
gc.c
- added ftype-guardian syntax: (ftype-guardian A) creates a new
guardian for ftype pointers of type A, the first base field (or
one of the first base fields in the case of unions) of which must
be a word-sized integer with native endianness representing a
reference count. ftype pointers are registered with and retrieved
from the guardian just like objects are registered with and
retrieved from any guardian. the difference is that the garbage
collector decrements the reference count before resurrecting an
ftype pointer and resurrects only those whose reference counts
become zero, i.e., are ready for deallocation.
ftype.ss, cp0.ss, cmacros.ss, cpnanopass.ss, prims.ss, primdata.ss,
gc.c,
4.ms, root-experr*
- fixed a bug in automatic recompilation handling of missing include
files specified with absolute pathnames or pathnames starting with
"./" or "..": was erroring out in file-modification-time with a
file-not-found or other exception rather than recompiling.
syntax.ss,
7.ms, root-experr*, patch*
- changed inline vector-for-each and string-for-each code to
put the last call to the procedure in tail position, as was
already done for the library definitions and for the inline
code for for-each.
cp0.ss,
5_4.ms, 5_6.ms
- the compiler now generates better inline code for the bytevector
procedure. instead of one byte memory write for each argument,
it writes up to 4 (32-bit machines) or 8 (64-bit machines) bytes
at a time, which almost always results in fewer instructions and
fewer writes.
cpnanopass.ss,
bytevector.ms
- packaged unchanging implicit reader arguments into a single record
to reduce the number of arguments.
read.ss
- recoded run-vector to handle zero-length vectors. it appears
we're not presently generating empty vectors (representing empty
groups), but the fasl format permits them.
7.ss
original commit: 7be1d190de7171f74a1ee71e348d3e6310392686
Aviod turning an error like
(let ([x (values 1 2)]) x)
or
(car (list (values 1 2)))
into a program that returns multiple values.
original commit: 4efb3d6f226d9131f87023e45ff2b7e4713da8ae
Improve error reporting and improve docs as suggested by Andy, and
adjust `conv` -> `conv*` to fit a naming convention.
original commit: b34817aea5d3c4862e7bb313ee9f5281472a832f
Changed the base language foregin and fcallable forms to accept a list of
conventions, which are each symbols, instead of a single convention, which was
a list of conventions, mostly to make it clear in the grammar what is going on.
base-lang.ss, cp0.ss cpcheck.ss, cpcommonize.ss, cpletrec.ss, cpnanopass.ss,
cprep.ss, cpvalid.ss, interpret.ss, syntax.ss,
Fixed a place where we were checking for eq? of two conventions, which now
should be equal? since it is a list (assuming this list will always be in a
consistent order).
cpcommonize.ss
Removed a spurious definition of convention?
np-languages.ss
original commit: dabf5a8abeaef12cdfcb36d9aac236dda9ac9158
- fixed an issue with the library system where an exception that occurs
during visit or revisit left the library in an inconsistent state that
caused it to appear that it was still in the process of running. This
manifested in it raising a cyclic dependency exception, even though
there really is not a cyclic dependency. The various library
management functions involved will now reset the part of the library
when an exception occurs. This also means that if the library visit
or revisit failed for a transient reason (such as a missing or
incorrect library version that can be fixed by updating the
library-directories) it is now possible to recover from these errors.
expand-lang.ss, syntax.ss, interpret.ss, compile.ss, cprep.ss,
8.ms
original commit: 6dbd72496fb4eaf5fb65453d0ae0a75f0ef2ad80
Also, report an error if a string type is misused as an argument (for
foreign procedures) or result (for foreign callables) with
`__collect_safe`.
original commit: cdbfa3d86cb0719bf0979b3fe0aa5c4383282b77
commonizatio pass and support for specifying default record
equal and hash procedures:
- more staid and consistent Mf-cross main target
Mf-cross
- cpletrec now replaces the incoming prelexes with new ones so
that it doesn't have to alter the flags on the incoming ones, since
the same expander output is passed through the compiler twice while
compiling a file with macro definitions or libraries. we were
getting away without this just by luck.
cpletrec.ss
- pure? and ivory? now return #t for a primref only if the prim is
declared to be a proc, since some non-proc prims are mutable, e.g.,
$active-threads and $collect-request-pending.
cp0.ss
- $error-handling-mode? and $eol-style? are now properly declared to
be procs rather than system state variables.
primdata.ss
- the new pass $check-prelex-flags verifies that prelex referenced,
multiply-referenced, and assigned flags are set when they
should be. (it doesn't, however, complain if a flag is set
when it need not be.) when the new system parameter
$enable-check-prelex-flags is set, $check-prelex-flags is
called after each major pass that produces Lsrc forms to verify
that the flags are set correctly in the output of the pass.
this parameter is unset by default but set when running the
mats.
cprep.ss, back.ss, compile.ss, primdata.ss,
mats/Mf-base
- removed the unnecessary set of prelex referenced flag from the
build-ref routines when we've just established that it is set.
syntax.ss, compile.ss
- equivalent-expansion? now prints differences to the current output
port to aid in debugging.
mat.ss
- the nanopass that patches calls to library globals into calls to
their local counterparts during whole-program optimization now
creates new prelexes and sets the prelex referenced, multiply
referenced, and assigned flags on the new prelexes rather than
destructively setting flags on the incoming prelexes. The
only known problems this fixes are (1) the multiply referenced
flag was not previously being set for cross-library calls when
it should have been, resulting in overly aggressive inlining
of library exports during whole-program optimization, and (2)
the referenced flag could sometimes be set for library exports
that aren't actually used in the final program, which could
prevent some unreachable code from being eliminated.
compile.ss
- added support for specifying default record-equal and
record-hash procedures.
primdata.ss, cmacros.ss, cpnanopass.ss, prims.ss, newhash.ss,
gc.c,
record.ms
- added missing call to relocate for subset-mode tc field, which
wasn't burning us because the only valid non-false value, the
symbol system, is in the static generation after the initial heap
compaction.
gc.c
- added a lambda-commonization pass that runs after the other
source optimizations, particularly inlining, and a new parameter
that controls how hard it works. the value of commonization-level
ranges from 0 through 9, with 0 disabling commonization and 9
maximizing it. The default value is 0 (disabled). At present,
for non-zero level n, the commonizer attempts to commonize
lambda expressions consisting of 2^(10-n) or more nodes.
commonization of one or more lambda expressions requires that
they have identical structure down to the leaf nodes for quote
expressions, references to unassigned variables, and primitives.
So that various downstream optimizations aren't disabled, there
are some additional restrictions, the most important of which
being that call-position expressions must be identical. The
commonizer works by abstracting the code into a helper that
takes the values of the differing leaf nodes as arguments.
the name of the helper is formed by concatenating the names of
the original procedures, separated by '&', and this is the name
that will show up in a stack trace. The source location will
be that of one of the original procedures. Profiling inhibits
commonization, because commonization requires profile source
locations to be identical.
cpcommonize.ss (new), compile.ss, interpret.ss, cprep.ss,
primdata.ss, s/Mf-base,
mats/Mf-base
- cpletrec now always produces a letrec rather than a let for
single immutable lambda bindings, even when not recursive, for
consistent expand/optimize output whether the commonizer is
run or not.
cpletrec.ss,
record.ms
- trans-make-ftype-pointer no longer generates a call to
$verify-ftype-address if the address expression is a call to
ftype-pointer-address.
ftype.ss
original commit: b6a3dcc814b64faacc9310fec4a4531fb3f18dcd
compilation now treat a malformed object file as if it were
not present and needs to be regenerated. A malformed object
file (particularly a truncated one) might occur if the compiling
processes is killed or aborts before it has a chance to delete
a partial object file.
syntax.ss,
7.ms
original commit: c2cb8c79a925c0eb2f9d589e3a497712800bd1dc
redundant keys and expands into exclusive-cond rather than cond.
it catches references to => before expanding into exclusive-cond
to avoid supporting => as an undocumented and useless extension
of the case syntax. the r6rs:case and case macros now require
multiple clauses rather than leaving the enforcement to exclusive-cond,
and the exclusive-cond macro now requires multiple clauses rather
than leaving the enforcement to cond.
syntax.ss,
4.ms, root-experr*, patch*
original commit: 303921d8515b101c558a056dcf9c05f7cad97f4a
Add optional beginning-line and beginning-column components to a
source object, so that line and column information can be recorded
independent of the file. Add `locate-source-object-source` to use
the recorded information. Add a cache for `locate-source` as enabled by
the `use-cache?` optional argument, which can avoid compilation times
that are quadratic in the number of `let-values` or `define-values`
forms.
original commit: b36fab81d5041a54ce01a422395eee79d2f930bc
- added a cast to eliminate warnings in c/number.c
- fixed bug in Windows version of directory-separator-predicate in s/6.ss when path-* procedures are passed a path that is not a string.
- fixed bug in s/cp0.ss on Windows with $foreign-wchar?.
- fixed spelling of non-existent
original commit: dd1b741f7572cb0d5a6210c7c796aee7c4026040