Stephen Adams [Tue, 30 Jul 1996 19:29:57 +0000 (19:29 +0000)]
Typerew uses checking operations (e.g. CAR with type checks enabled,
or explicit calls to ERROR:WRONG-TYPE-ARGUMENT, etc) to deduce type
information about values in the program. The assumption is that the
error signalling code never returns.
This set of changes makes these operations bulletproof by arranging
that the continuations of the error signalling procedures cannot
resume the code that was compiled under the types deduced from the
assumption. The error continuations now `trap' by jumping to an
appropriate handler.
fakeprim.scm
New operator %halt.
New operator %reference.
errcont.scm
Edits a program to replace continuations to error procedures
(which typically merge back with the non-error case) with
continuations that just call %halt.
laterew.scm
Eliminate %reference.
rtlgen.scm
Recognise continuations containing %halt and produce terse code to
`trap' to the appropriate support procedure.
simplify.scm
Tweak to LETREC case for recognizing dead procedures earlier.
This allows `diamond' code to be linearized in one pass rather than
two.
typerew.scm
Changed to generate code to signal errors calling global procedure
%COMPILED-CODE-SUPPORT:SIGNAL-ERROR-IN-PRIMITIVE
Stephen Adams [Fri, 26 Jul 1996 14:38:26 +0000 (14:38 +0000)]
Initial cut at writing COERCE-TO-COMPILED-PROCEDURE in Scheme. The
next change will be to make the compiler generate calls to this
procedure rather than the primitive COERCE-TO-COMPILED-PROCEDURE,
which should result in both faster generation and invocation of
trampolines.
Eventually we might make the linker use this code too.
The code is a bit hairy and needs special initialization, hence the
changes in make.scm.
Stephen Adams [Fri, 26 Jul 1996 00:36:11 +0000 (00:36 +0000)]
Added new stack frame type for preservation frames (restore-regs).
Added a debugging-info method.
Changed the illegal-arg error handler for primitive procedures to
avoid using retry restarts when the primitive signalled a type or
range error when called from compiled code. This is necessary because
the compiler assumes that if it calls a primitive just to raise an
error then teh primitive will not return. This assumption allows type
inference to eliminate furthur checks.
In order to stop the debugger returning a value, the primitive should
be called `indirectly' via another compiler procedure which refuses to
return. I.e instead of compiling the error CAR operation as
INVOKE:PRIMITIVE
Stephen Adams [Wed, 24 Jul 1996 22:32:30 +0000 (22:32 +0000)]
Fixed a bug with constant folding binary operators: the continuation
was being ignored.
Added a whole bunch of code to rewrite return (and calls with few
arguments) sequences that are passing an inlined predicate or
conditional expression.
For limited cases, for example, returning (null? x) or tail-calling, e.g.
(f (if (pair? x) (car x) #F))
there is small benefit.
Stephen Adams [Wed, 24 Jul 1996 03:45:18 +0000 (03:45 +0000)]
. Fixed bug that was preventing CSE of flonums.
. Changed `CSE avoiding' rewrites to use CONSTANT-REGISTER-EXPRESSION, thus
including #F and '() in the games we play with `0'.
. Punted the `is-rtl-zero?' predicate as no longer used.
. Simplified REGISTER-KNOWN-FIXNUM-CONSTANT
. Added `CSE avoiding' rewrites for comparison operators.
Stephen Adams [Tue, 23 Jul 1996 19:11:20 +0000 (19:11 +0000)]
Removed lots (500 lines) of tagged-fixnum code. If you want it, use
RCS. Changed the comments to reflect the current code.
Made things more robust:
. Changed FITS-IN-nn-BITS? predicates to test for fixnum arguments.
. Changed all the register*constant and constant*register predicates
to be true only if the constant is a *fixnum* in the correct range.
. Punted the GUARANTEE-SIGNED-FIXNUM (as the predicates now guarantee it).
The net effect is that the compiler now compiles code like (fix:+ x
1.2) or (fix:* 'a n) to the obvious, albeit meaningless, instructions
rather than signalling a confusing error. Note that the midend
typerew phase can generate error messages for any of these conditions.
Stephen Adams [Tue, 23 Jul 1996 15:41:23 +0000 (15:41 +0000)]
Removed old (mostly unused) method of reporting type errors via bogus
re-writes that issue the warning and leave the program unchanged.
Replaced with type-checks based on the typedb information. All
operators with typedb information are checked (not just those with
rewrites). Checking (and thus warnings) are disabled by setting
COMPILER:TYPE-ERROR-WARNINGS? to false.
Stephen Adams [Mon, 22 Jul 1996 18:48:32 +0000 (18:48 +0000)]
Removed suggestion mechanism for rewrites. It was no longer used and
might be a problem because it couples type analysis to the use of the
information.
Stephen Adams [Fri, 19 Jul 1996 23:32:03 +0000 (23:32 +0000)]
Added rewrite code to replace an expression with a literal if the type
system tells us what the value must be. Most useful for
IF-predicates, as replacing <pred> by, e.g., (BEGIN <pred> '#T) allows
the dead code to be removed.
Added predicate code to yield a #T or #F value. Previously the
predicate information was being used only in the branches of an if.
Obviously, it is nice to know when the predicate is always true or
false.
Tweaked with inference rules for EQ?/EQV?/EQUAL?. This could be
better, for example, if (eq? x y) then we know the types must be in
the intersection. This would require work in TYPEREW/PRED.
Chris Hanson [Fri, 24 May 1996 07:33:41 +0000 (07:33 +0000)]
Fix bug: don't enqueue a process in the process-input-queue if it is
already in the queue. Otherwise, it can easily get entered very many
times: if there is input waiting, and the editor is busy, the process
will be queued as often as the select code can run.
Chris Hanson [Sat, 18 May 1996 06:16:11 +0000 (06:16 +0000)]
Change mechanism used to open files and sockets, so that interrupts
are enabled during the open. This is necessary, because any
network-based operation could potentially hang for long periods of
time, and it's desirable for the user to be able to interrupt out of
the operation.
This change requires microcode version 11.154 (or the corresponding
version 13).
In addition to this change, the low-level channel code was changed to
eliminate the now-obsolete gc-daemon interlocking code.
Chris Hanson [Fri, 17 May 1996 17:49:45 +0000 (17:49 +0000)]
Allow keyboard interrupts while opening sockets. This is only a
partial solution: there is a small window in which an interrupt can
arrive, leaving the descriptor open but forgotten.