Finished the disassembler. Debugging the machine (too).
* src/Makefile.in: Make sure the assembler-compiler ran, generating
compiler/machines/svm/svm1-defns.h, assembler-db.scm, etc.
* src/Stage.sh: Punt avoiding subdirs with nothing to stage. A few
empty STAGE subdirs should not hurt, and maybe_mv is quiet.
* src/compiler/Clean.sh (distclean, maintainer-clean): Use maybe_rm
and clean up assembler compilation products.
* src/compiler/Stage.sh, src/etc/Stage.sh: Use maybe_mv to avoid
errors when the subdir has not been compiled, so that an incomplete
compile can be stashed and unstashed without horror.
* src/compiler/machines/svm/assembler-compiler.scm
(write-copyright+license): Resurrected with the 9.0.1 runtime system's
procedures. Used to generate the standard copyright though the GNU
standards suggest assembler-db's copyright should be copied.
(rt-defn-encoder-constructor): Include the opcode byte.
* src/compiler/machines/svm/assembler-rules.scm (interrupt-test-closure):
Folded into the enter-closure instruction, which knows the index.
* src/compiler/machines/svm/assembler-runtime.scm
(init-assembler-instructions!): Build fixed instruction assemblers in
smallest-to-largest order, else the largest encoding is always chosen.
(assemble-fixed-instruction): Punt consing a new bit-string.
(pc-relative-stats, pc-relative-selector): New. The former computes
static info about a class of variable-width instructions so that the
latter need only cons a handler. Use these in the variable-width
instruction encoders.
(fix-offset): Fix the width of a pc-relative offset, to force a wider
encoding than required by the actual magnitude. Use this procedure in
the primitive encoders. The bit tensioner cannot always find an
optimal solution, where no instruction is wider than its operands
require. Warn when this happens.
(decode-rt-coding-type): Return a list headed by the rt-defn name,
else signal a coding-error.
(coding-error): Signals a condition that the disassembler wants to
catch.
(define-pvt-signed, encode-signed-*, write-bytes): Accept bit-strings
as well as integers. See fix-offset.
(encode-unsigned-integer-8): Fixed.
(decode-rref): Give symbolic names to the fixed registers.
* src/compiler/machines/svm/compiler.pkg: Moved the (compiler
disassembler) package to inherit from (compiler assembler). The
disassembler uses many definitions in assembler-runtime.scm.
* src/compiler/machines/svm/compiler.sf: Syntax make.scm. It is not
mentioned in compiler.pkg, from which syntax-files!(decls.scm) gets
its list of files to syntax.
* src/compiler/machines/svm/decls.scm: Moved lapgen.scm from
lapgen-base to lapgen-body because it depends on assembler-runtime.
* src/compiler/machines/svm/disassembler.scm: New.
* src/compiler/machines/svm/lapgen.scm: Get the entry-types right with
those used in svm1-interp.c.
(encode-procedure-type): Take the frame size min/max per the RTL,
and convert them to required/optional arg counts. Use this in
generate/cons-*closure as well as make-procedure-label.
(encode-internal-procedure-offset): Punted. This encoding is also
generated by encode-continuation-offset.
* src/compiler/machines/svm/machine.scm (ea:uuo-entry-address): New,
encoding a peculiar type of pc-relative address.
(trap:set!, trap:define, trap:unbound?, trap:access): Not defined in
svm1-interp.c.
(interrupt-test-closure): Folded into the enter-closure instruction.
(closure-entry-size, entry-type-size, closure-first-offset): Added an
cc-entry type field to each closure entry.
* src/compiler/machines/svm/rules.scm (POP-RETURN): Added entry-type
and gc-offset half words before inst:interrupt-test-continuation, so
that this instruction can push its address on the stack.
(INVOCATION:UUO-LINK, INVOCATION:GLOBAL-LINK): Use the new
ea:uuo-entry-address.
(PROCEDURE-HEADER): Pass min/max directly to make-procedure-label
(generate/cons-closure, generate/cons-multiclosure): Added a cc-entry
type field before each entry point. Do NOT tag the target register.
No need to interrupt-test-closure after entering.
(generate-uuos): This is not actually generating LAP.
(interpreter-call:cache-reference, interpreter-call:cache-assignment):
(interpreter-call:cache-unassigned?): Need an entry point after the
trap instructions.
(Interpreter Calls, lookup-call, assignment-call): Removed. I could
not find the corresponding compiler utilities: comutil_access,
comutil_define, comutil_set, comutil_unbound_p_trap. The utilities I
DID find want a cache address. Removing these rules left lookup-call
and assignment-call unused.
* src/etc/compile-svm.sh: Use src/Stage.sh to un/stash the
cross-compiler.
* src/microcode/cmpint.c, src/microcode/cmpint.h: Move
trampoline_type_t to cmpint.h, where svm1-interp.c can include it.
* src/microcode/cmpintmd/svm1.c: Use new closure entry point type
field in read_cc_entry_type.
(store_trampoline_insns): Translate from abstract trampoline kinds to
trap-0 operations, e.g. TRAMPOLINE_K_APPLY to
SVM1_TRAP_0_OPERATOR_APPLY.
* src/microcode/cmpintmd/svm1.h:
* src/microcode/svm1-defns.h:
* src/microcode/svm1-interp.c:
21 files changed: