Commit Graph

12 Commits

Author SHA1 Message Date
Matthew Flatt
4e3b829227 add $app
Using `#3%$app` disables a `procedure?` check in an application.

original commit: d7960da9e3c3a864a4df42cb8bb71d9b205aeb95
2019-09-19 07:30:42 -06:00
Matthew Flatt
e95fb6008b add procedure-known-single-valued?
original commit: f2a45ea588003c662bc2109e38ff052832d0c262
2019-01-22 06:37:12 -07:00
Matthew Flatt
54282dedc4 Merge branch '17-5-Types-Pass' of github.com:gus-massa/ChezScheme
original commit: caf857a33e13c116afa6e2d960eccbada3604190
2019-01-11 15:35:20 -07: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
Andy Keep
18b12f21fd Fixes and small improvements for type recovery.
Removed counter field from prelex, using the operand field instead to
provide the index into the fxmap.  This follows other uses within the compiler
where we use the operand field as a little place for state that is used
within a single pass.  This has a few advantages.  First, it keeps the record a
little smaller.  Second, it means that the prelex numbering can start from 0
for each compilation unit, which should help keep the numbers for the fxmap a
bit smaller in longer running sessions with multiple calls to the compiler.
Finally, it avoids adding to the burden of the tc-mutex, since within the pass
it is safe for us to set the prelexes, since only the instance of the pass
holding this block of code has a handle on it.  As part of this change
prelex-counter is now defined in cptypes and the operand is cleared after the
variables go out of scope.
  base-lang.ss

Fixed the highest-set-bit function in fxmap so that it will work in the 32-bit
versions of Chez Scheme.  The fxsrl by 32 raises an exception, and was leading
to tests to fail in 32-bit mode.
  fxmap.ss

Restructured predicate-implies? so that it uses committed choice instead of
uncommitted choice in comparing x and y.  Basically, this means, instead of
doing:
(or
  (and (predicate-1? x) (predicate-1? y) ---)
  (and (predicate-2? x) (predicate-2? y) ---)
  ...)
we now do:
(cond
  [(predicate-1? x) (and (predicate-1? y) ---)]
  [(predicate-2? x) (and (predicate-2? y) ---)]
  ...)
This avoids running predicates on x that we know will fail because an earlier
predicate matches, generally getting out of the predicate faster.  This did
require a little restructuring, because in some cases x was dominant and in
other cases y was dominant.  This is now restructured with y dominate, after
the eq? and x 'bottom check.

Replaced let-values calls with cata-morphism syntax, including removal of maps
that built up a list of values that then needed to be separated out with
(map car ...) (map cadr ...) etc. calls.  This avoid building up structures we
don't need, since the nanopass framework will generate a mutltivalued let for
these situations.

The if clause in cptypes/raw now uses types1 (the result of the recursive call
on e1) in place of the incoming types clause when processing the e2 or e3
expressions in the cases where e1 is known statically to produce either a false
or non-false value.

Fixed a bug with directly-applied variable arity lambda.  The original code
marked all directly-applied variable arity lambda's as producing bottom,
because it was chacking for the interface to be equal to the number of
arguments.  However, variable arity functions are represented with a negative
number.  For instance, the original code would transform the expression:
(begin
  ((lambda (a . b) (set! t (cons* b a t))) 'a 'b 'c)
  t)
to
((lambda (a . b) (set! t (cons* b a t))) 'a 'b 'c)
anticipating that the call would raise an error, however, it is a perfectly
valid (if some what unusual) expression.  I tried to come up with a test for
this, however, without building something fairly complicated, it is difficult
to get past cp0 without cp0 turning it into something like:
(let ([b (list 'b 'c)])
  (set! t (cons* b 'a t))
  t)

Fixed make-time, time-second-set!, and time-second to indicate that second can
be an exact-integer, since it is not really restricted to the fixnum range (and
if fact we even test this fact in the mats on 32-bit machines).
  primdata.ss

Changed check of prelex-was-assigned (which is not reliably on the input to any
give pass) with prelex-assigned, which should always have an accurate, if
conservative, value in it.

Added enable-type-recovery parameter to allow the type recover to be turned on
and off, and added cptype to the cp0 not run path that runs cpletrec, so that
cptypes can be run independent of cp0.  This is helpful for testing and allows
us to benefit from type recovery, even in cases where we do not want cp0 to
perform any inlining.
  compile.ss, front.ss, primdata.ss

Stylistic changes, mostly for consistency with other parts of the compiler,
though I'm not married to these changes if you'd really prefer to keep things
the way the are.
1. clauses of define-record type now use parenthesis instead of square brackets.
2. indented by 2 spaces where things were only indented by one space
3. define, let, define-pass, nanopass pass productions clauses, now use
   parenthesis for outer markers instead of square brackets.
  fxmap.ss,

original commit: 5c6c5a534ff708d4bff23f6fd48fe6726a5c4e05
2018-04-12 21:54:01 -03:00
Jon Zeppieri
168065175d Hashing of prelex for cptypes
original commit: c3d5c784cdf1ffe73abc35f824e588509d98df38
2018-04-12 21:53:20 -03:00
Gustavo Massaccesi
e37833b603 Add signatures field to primref record
primref.ss, primvars.ss

original commit: 0d044806bd5c645bf2c4caf701c2615d6150f8bf
2018-04-12 21:53:16 -03: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
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
dyb
1356af91b3 initial upload of open-source release
original commit: 47a210c15c63ba9677852269447bd2f2598b51fe
2016-04-26 10:04:54 -04:00