[net.lang] Self-modifying code and CDC Fortrans

jimb@azure.UUCP (01/17/84)

Then there's the some of the old CDC fortran compilers...  

The cyber machines have 60-bit words, and can fit up to 4 instructions in
a single word.  

Some of the Fortran compilers were able to encode the semantics of some
runtime library routines into a single word.  The (dumber, older)
compiler still generated ordinary, 1-word long subroutine calls to the
runtime routine, but the (newer, smarter) runtime routine would patch
the <= 1 word semantics back at the call address, replacing the
original call instruction.

The cybers run exceedingly fast when everything is inline, and when
loops are smaller than the internal cache.  Subroutine jumps flushed
the cache, so eliminating an extra call just about anywhere could make
some improvement.  This was much easier than properly fixing the
compiler in the first place.  Since the "systems" staff implemented
the mods, and since they was invisible to the "users" they were
certifiably "safe".

Ironically, some CDC models lacked "write-through" cache, so if you modified
an instruction which was already loaded in a cached loop, the CPU wouldn't
see it.  These bugs were extremely rare, and were probably attributed to
alpha particles.

I also recall a compiler-design professor (who was editor of ACM SigPlan
for a number years) that advocated having our toy/student compilers generate
machine code into a Fortran labeled common block.  Since the common
block names were ordinary external names to the linker, and since 
Fortran was so incredibly stupid, you could then "call" the common
block, and test out your code via direct execution.

I don't condone these techniques, but I report it for the record.

Cheers.

	...!tektronix!tekmdp!jimb