[comp.lang.asm370] Self Modifying Code

rrh@june.cs.washington.edu (Robert R. Henry) (06/15/89)

I am interested in readers' experiences with self-modifying code.

Specifically, I'm interested in knowing of 'standard' programming
tricks that have been used in conjunction with self modifying code, and
in what kinds of programs and on what kinds of architectures self
modifying or self generating code has proven to be useful.

I'm interested in any of these three kinds of self-modifications,
although for the moment I'm focusing on fine-grain modifications:

*fine-grain shape-preserving self modifications (such as changing an
instruction every time through a loop)

*medium/coarse-grain shape-preserving self modifications (similar to
relinking code prior to executing it)

*shape-altering modifications via on-the-fly code generation (this is
used in some bit-blit kernels, and in some interpreters for lisp and
smalltalk)

Please don't flame me about system's level issues.  I'm perfectly aware
that self-modifying code is not reentrant; is not sharable; it can't
reside in a ROM; it must be paged; it leads to serious cache coherency
problems; it isn't easy to understand; it is architecture and
perhaps implementation dependent.

Please send mail directly to me, and I'll (eventually) post a summary.

Thanks,
	Robert R. Henry
	Computer Science Department
	University of Washington

rrh@JUNE.CS.WASHINGTON.EDU ("Robert R. Henry") (06/15/89)

I am interested in readers' experiences with self-modifying code.

Specifically, I'm interested in knowing of 'standard' programming
tricks that have been used in conjunction with self modifying code, and
in what kinds of programs and on what kinds of architectures self
modifying or self generating code has proven to be useful.

I'm interested in any of these three kinds of self-modifications,
although for the moment I'm focusing on fine-grain modifications:

*fine-grain shape-preserving self modifications (such as changing an
instruction every time through a loop)

*medium/coarse-grain shape-preserving self modifications (similar to
relinking code prior to executing it)

*shape-altering modifications via on-the-fly code generation (this is
used in some bit-blit kernels, and in some interpreters for lisp and
smalltalk)

Please don't flame me about system's level issues.  I'm perfectly aware
that self-modifying code is not reentrant; is not sharable; it can't
reside in a ROM; it must be paged; it leads to serious cache coherency
problems; it isn't easy to understand; it is architecture and
perhaps implementation dependent.

Please send mail directly to me, and I'll (eventually) post a summary.

Thanks,
        Robert R. Henry
        Computer Science Department
        University of Washington

A01MES1@NIU.BITNET (Michael Stack) (06/15/89)

> I am interested in readers' experiences with self-modifying code.

Over the last twenty years, my experience is:

>  ... self-modifying code is not reentrant; is not sharable; it can't
> reside in a ROM; it must be paged; it leads to serious cache coherency
> problems; it isn't easy to understand; it is architecture and
> perhaps implementation dependent.

... plus, it leads to coding errors (how did you forget that one?).


Michael Stack
Northern Illinois University