Article View: comp.arch
Article #2549Re: Self-modifying code
From: Andrew Klossner
Date: Thu, 12 Oct 1989 17:37
Date: Thu, 12 Oct 1989 17:37
36 lines
2175 bytes
2175 bytes
[]
"I had occasion to look at the generated code for both a CDC
6000-series Fortran compiler and an IBM 370-series COBOL
compiler. Both compilers used the same technique for inserting
argument addresses in subroutines (did you know COBOL has
subroutines?!!!)."
Did you know that COBOL has an instruction to modify a GOTO instruction?
ALTER LOOP-LABEL TO PROCEED TO ALL-DONE.
means change the destination of the GOTO at LOOP-LABEL from whatever it
is now to the label ALL-DONE. (I've heard that the ANSI COBOL
committee is doing away with this, and I've heard further that members
of the committee have been sued, but I don't know details.) Of course,
you can implement this without actually modifying any code, by
arranging that all branches which are targets of ALTER statements fetch
their targets from data space.
"The R{2,3}000, SPARC, Am29000, (and 88K, I believe) all have
the ability to perform a register-indirect call, where the
target of the call is sourced from a general-purpose register.
These instructions normally are used to build "big" addresses ..."
On the 88k, at least, these instructions are more often used to
implement indirect procedure calls, for example to translate the C
construct
return_value = (*procedure_ptr)(arg1, arg2);
The direct procedure call on the 88k can address plus-or-minus 128MB of
instruction space, which so far has been big enough for my codes. :-)
-=- Andrew Klossner (uunet!tektronix!frip.WV.TEK!andrew) [UUCP]
(andrew%frip.wv.tek.com@relay.cs.net) [ARPA]
Technical Details
Message-ID:
<4937@orca.WV.TEK.COM>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uakari.primate.wisc.edu!ginosko!uunet!zephyr.ens.tek.com!orca!frip!andrewReferences:
<1080@mipos3.intel.com> <6481@pt.cs.cmu.edu> <27743@amdcad.AMD.COM> <48682@ricerca.UUCP> <236@bbxsda.UUCP> <16542@siemens.siemens.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uakari.primate.wisc.edu!ginosko!uunet!zephyr.ens.tek.com!orca!frip!andrew From: andrew@frip.WV.TEK.COM (Andrew Klossner) Newsgroups: comp.arch Subject: Re: Self-modifying code Message-ID: <4937@orca.WV.TEK.COM> Date: 12 Oct 89 17:37:13 GMT References: <1080@mipos3.intel.com> <6481@pt.cs.cmu.edu> <27743@amdcad.AMD.COM> <48682@ricerca.UUCP> <236@bbxsda.UUCP> <16542@siemens.siemens.com> Sender: nobody@orca.WV.TEK.COM Reply-To: andrew@frip.wv.tek.com Organization: Tektronix, Wilsonville, Oregon Lines: 36