Commit Graph

24 Commits

Author SHA1 Message Date
Oscar Waddell
b8d6d649bc ignore multiple-value return from interleaved init expressions in top-level-program
original commit: f5fd9d144b68af26244855c7c2f34be97298deea
2019-03-27 13:00:38 -04:00
Andy Keep
38d1000f70 Added fix for wpo bug from issue 386.
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
2019-03-17 14:18:42 -04:00
Oscar Waddell
78c3993817 expose default-library-search-handler and library-search-handler parameter
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
2019-03-14 14:31:02 -04:00
dyb
2daf225cab committing a handful of changes, none of which should be particularly
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
2019-02-11 20:06:42 -08:00
Oscar Waddell
8b9b2e6b10 restore the import code on reset to provide consistent error message
original commit: 3da0f8ed90b849ea4a72d37169fa78652058d70f
2018-08-25 18:35:29 -04:00
Oscar Waddell
47e236a07c clarify "unknown module" error message in determine-module-imports
original commit: 6af5ae075c4cce789d3528c3a6ef2620f90793e8
2018-08-25 18:35:29 -04:00
Andy Keep
1f0e42f0ec Merge branch 'pthread' of https://github.com/mflatt/ChezScheme into mflatt-pthread-2
original commit: 2230e5adcb61ac8b27c9deee682270f4e17fbafb
2018-04-21 22:09:05 -04:00
Matthew Flatt
270b0a44c5 Improvements to __collect_safe
Improve error reporting and improve docs as suggested by Andy, and
adjust `conv` -> `conv*` to fit a naming convention.

original commit: b34817aea5d3c4862e7bb313ee9f5281472a832f
2018-04-20 21:55:09 -06:00
Andy Keep
9f78570343 Changed the base language to allow for a list of conventions.
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
2018-04-20 16:50:28 -06:00
dyb
052e48e9e8 committing @akeep library change with rebuilt boot files:
- 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
2018-04-05 21:28:33 -07:00
dyb
30934965f3 - added identifier? checks to detect attempts to use non-identifier
field names in define-record-type field specs.
    syntax.ss,
    record.ms, root-experr*

original commit: be022d947b3831afcb4c538151899f9bd6559615
2018-04-04 15:34:54 -07:00
Oscar Waddell
9d1b935705 standalone export form now handles (import import-spec ...)
original commit: 09b6745679892fe2fac761d5849fe78b87d57dcf
2018-04-02 10:44:17 -04:00
Matthew Flatt
7c94235f6b Change __thread to __collect_safe
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
2018-03-28 09:29:47 -06:00
Matthew Flatt
22d4fd9978 Add __thread foreign-call convention
See the `foreign-callable` docs for a good example use.

original commit: e3463c78c511ad861dfa49865bb447e9777f9eb8
2018-03-14 17:20:33 -06:00
Matthew Flatt
743800bbb5 support struct args to and results from foreign procedures
original commit: f0a94bdb9f57c1bf7ffbb66693fb5476a6f0e65b
2018-03-12 21:01:47 -06:00
dybvig
f7c414bda3 Various updates, mostly to the compiler, including a new lambda
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
2018-01-29 09:20:07 -05:00
dyb
893dfe5d35 maybe-compile-{file,program,library} and automatic import
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
2017-11-07 21:49:08 -05:00
dyb
09366c6247 - the $case macro used by r6rs:case and case now unconditionally trims
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
2017-10-13 14:33:32 -04:00
Matthew Flatt
9d8cc87758 add locate-source cache and line+column components to source objects
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
2017-08-01 05:23:56 -06:00
Matthew Flatt
274322e06d fix (define-values () ....) to expand to a definition
Expanding to a definition means that it doesn't interrupt a definition
sequence.

original commit: c2d8a2fdc6ef40c5eba15904d6203032dc6f555e
2017-07-16 17:04:54 -06:00
Bob Burger
831ea8ad18 changed copyright year to 2017
7.ss, scheme.1.in, comments of many files

original commit: 06f858f9a505b9d6fb6ca1ac97234927cb2dc641
2017-04-06 11:41:33 -04:00
Gavin Whelan
339e25d47e - fixed a bug in case and exclusive-cond syntax-error calls causing an
exception in syntax-error instead of the intended error message.
    s/syntax.ss

original commit: 17a5c5d27b02b7c4a1edc5ee36a6aa43de62c4cb
2016-08-21 23:38:57 -04:00
Bob Burger
39410c8447 - Cygwin is now used on Windows, updated mats, eliminated unused killme
- 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
2016-06-10 10:07:07 -04:00
dyb
1356af91b3 initial upload of open-source release
original commit: 47a210c15c63ba9677852269447bd2f2598b51fe
2016-04-26 10:04:54 -04:00