[Info-vax] Native compilers

John Reagan xyzzy1959 at gmail.com
Sat Mar 5 13:05:55 EST 2022


As a follow-up and something else to focus on...  As we continued to do more testing of the native
Macro-32 compiler, we had various ACCVIOs and LIB$GET_VM errors on programs that used macros.
It had no clear pattern other than perhaps something to with macro processing.  It wasn't clear if it
was part of the macro body scanning or macro expansion.  [We're using DELTA to debug these things
at the moment, the symbolic debugger is almost ready but it didn't like debugging a full MACRO.EXE
image.]

At some point it felt to me that perhaps the cross Macro-32 compiler was unable to compile the native
Macro-32 compiler [such is life in the world of bootstrapping compilers].  We finally found the faulty instruction

MOVL (R7)+,R7

Yes, that auto-increment is worthless and serves no purpose, but it is a legal VAX instruction.  That
particular one is used in 5 different places (perhaps cut-n-pasted years ago?  This stuff is late 1970s
vintage code).

So where do you think a broken compiler would insert the "increment R7 by 4"?  LOL.  We removed the
autoincs from the operands and all is working now.  Of course, we'll fix the Macro compiler.    

The x86 is actually the first non load/store architecture that the Macro compiler has to deal with.  We
had to make some design changes to try to incorporate memrefs directly into the instruction that
performs the operation.  The MOVL path in the compiler essentially tries to fetch the first operand into
the second operand and then handle the autoinc if needed.  We do that on all targets.  Other instructions 
with that pattern might look the same but are treated differently.

And while I was looking around for other strange/exotic VAX instructions, I bumped across this one
(which ironically we got right since we used some temporary registers)

MOVAL (R3)+,(R3)+

Again, a legal VAX instruction, and one that will hurt your brain thinking about that it is doing (it is in
code that is initializing some self-referencing data structures)



More information about the Info-vax mailing list