Self-modifying code and run-time code generation (was: Forth Day ...)

Self-modifying code and run-time code generation (was: Forth Day ...)

Post by anto » Sun, 25 Nov 2007 19:42:50

XXXX@XXXXX.COM (Marcel Hendrix) writes:

I differentiate between self-modifying code (existing code is
changed), and run-time code generation (new code is generated at
run-time). Also, in the context of an interpreter, we have to
differentiate between native code and interpreted code. So, a Forth
interpreter necessarily does run-time code generation of interpreted

BTW, many restrictions that hurt self-modifying (native) code also
hurt run-time (native) code generation.

A static linker is usually used to combine non-executable code into an
executable, and is usually not called by the program itself, so in the
usual case: no.

A dynamic linker can be used for doing things that one might also do
with self-modifying code. Moreover, in some cases it works by
modifying existing code.

It's much easier to make run-time code generation thread-safe, but
RTCG also uses more memory.

That's a 200+-page document. I guess you mean stuff like: #Advanced%20macros%20Tutorial

BTW, I have recently come across work that uses self-modifying
(native) code profitably to specialize functions: Some papers from
this work (I have not read these, but those I have read had pretty bad

- anton
M. Anton Ertl
comp.lang.forth FAQs:
New standard:
EuroForth 2007:

1. how to declare / allocate a .text memory to do run-time code generation

2. Self-modifying HTML code?

Can an HTML web page dynamically modify its own code?

(without resort to Java or any other non-HTML complexities)

That is, is there any provision in HTML such that a single
"Next" button on a main or index.html page will:

a) Change an image displayed on that page (say Picture_1.jpg)
to the next image in a sequence (say Picture_2.jpg), AND

b) "Reprogram" the Next button so that when its clicked again
it will replace Picture_2.jpg with Picture_3.jpg, and so on
thru a sequence of images.

Result could be a "one page slide show" with

* index.html and Picture_1, Picture_2, etc, being the ONLY files on
the web site; no other intermediate "linking" HTML pages.

* Picture_1, Picture_2, etc, being pure JPEG files -- no hidden HTML.

* Any individual picture immediately replaceable with newer version,
with no recoding

* Identical index pages will work with different picture sequences
provided each index page and sequence are in different folders

* No "gallery" with thumbnails of individual slides needed

This is not possible in pure HTML . . right?

3. Fun with self-modifying code

4. self-modifying code under strongarm/xscale processors

5. Self-modifying Code

6. ECO code generation (Was: Code generation)

7. run time code generation in python

8. modify code at run time

9. Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code

10. __autoinit__ (Was: Proposal: reducing self.x=x; self.y=y;self.z=z boilerplate code)

11. modifying code in run time

12. __autoinit__ (Was: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code)

13. see code below, I am getting run time error '424' (Object Required)?

14. Possible to run code based on what time of day?

15. Forth MP Code? Pi Day.