Self modifying code, lambda calculus - Re: ENIAC programming
bqt at update.uu.se
Thu Sep 17 18:17:28 CDT 2015
On 2015-09-17 18:01, Paul Koning wrote:
>> On Sep 16, 2015, at 11:36 PM, ben <bfranchuk at jetnet.ab.ca> wrote:
>> On 9/16/2015 9:25 PM, Toby Thain wrote:
>>> On 2015-09-16 6:18 PM, Dave G4UGM wrote:
>>>> It is notable that in order to solve all problems, a computer must permit
>>>> self modifying code.
>>> Is that true? AFAIK Lambda calculus can describe any computable function
>>> (as can a Turing machine), and it has no concept of "self modifying code".
>> I never studied any of that, but you do have to LOAD and RUN the program ToSolveAnythingBut42
>> some how so I guess that would count AS Self Modifying Code.
> "load" is an operation in a RAM stored program computer, sure. But self-modifying code means a program that modifies its own code during execution. That is a scheme that has on rare occasions been used in history. You could also apply the term to instructions that store state in the form of instructions in memory for later use, such as "return jump" in CDC machines. But I wouldn't apply the term there; that's just a particular mechanism different from, but functionally equivalent, to a return address stack.
Well, "rare" is a strong claim. I know of this rather popular machine
from DEC, the PDP-8, on which you have self-modifying code all over the
And I'm not talking about the fact that the return address is stored in
the first word of the function. I agree that this is not really
self-modifying code at all. But any time you have multiple fields in a
PDP-8, and you call a function in one field from another, the only way
to know where to return to is by having the data field contain the field
of the caller. And then the called function needs to change back to the
callers field before doing a return. And the change field instruction is
an instruction where the field is a part of the opcode, so the called
function needs to read out the data field, create a change instruction
field instruction, include the target field, and write this instruction
into itself right before the return instruction.
And there are plenty of other examples of self-modifying code on the
PDP-8, but all the others I can think of becomes way more complex to
Johnny Billquist || "I'm on a bus
|| on a psychedelic trip
email: bqt at softjar.se || Reading murder books
pdp is alive! || tryin' to stay hip" - B. Idol
More information about the cctech