Content deleted Content added
Guy Harris (talk | contribs) →TODO: Only if the code is generated at run time, and *that* only because the article discusses run-time generation even if existing code is *not* being modified, which I think is an error on the pare of the article. |
→Disadvantages: new section |
||
(4 intermediate revisions by 4 users not shown) | |||
Line 1:
{{WikiProject
{{WikiProject Computer science |importance=Mid}} {{WikiProject Computing |software=y |software-importance=Low }}
==TODO==
Line 71 ⟶ 74:
:Awww, go on, it's not all that bad. What is required is a calm attitude and appreciation of the actual environment. By using the stack working area, you ensure the avoidance of clashes in a quite proper way. This is what multi-stack designs are all about, and by writing in assembler (with proper commentary) you need not be constrained by the shibboleths of the prating orthodoxists of flabbier computer languages that constrain themselves and declare it good. In other words, I have misbehaved also, and declare it good. [[User:NickyMcLean|NickyMcLean]] ([[User talk:NickyMcLean|talk]]) 19:51, 18 December 2008 (UTC)
:I'd call that "run-time code generation", not "self-modifying code". Unfortunately, this page covers both topics; there is some overlap, in that code could generate other code at run time on top of existing code, which involves both run-time code generation and self-modifying code, but some self-modifying code doesn't involve particularly sophisticated code generation, and run-time code generation may generate ''new'' code into "empty" memory rather than replacing ''existing'' code. I'd classify what you did as the latter; the generated code is on the stack, the code you copied is just a template used by the code-generation process. [[User:Guy Harris|Guy Harris]] ([[User talk:Guy Harris|talk]]) 08:18, 15 May 2022 (UTC)
== JIT? ==
Line 140 ⟶ 144:
Does anyone know if there is a citation for the anecdote of using self-mod code as a copy protection technique on the Apple II? I remember reading about it somewhere 20 years ago when I was 'into' the Apple II in high school (back when "20 megabytes" was considered "really in-humanly humungously big" LOL) [[User:Jimw338|Jimw338]] ([[User talk:Jimw338|talk]]) 21:35, 14 March 2013 (UTC)
:Don't know about Apple II, but I hae one PC game that used self-mod as copy protection. One had to käy in sequence from The manual and If it was correct The software rewrote some instructiins so that The program would run. The reason I sound it was because I had copied disk and no manual. Used assembler debugger to check what was going on and found that self modifing codes. Bypassed IT and The game functioned like it should. [[Special:Contributions/217.140.200.97|217.140.200.97]] ([[User talk:217.140.200.97|talk]]) [[Special:Contributions/217.140.200.97|217.140.200.97]] ([[User talk:217.140.200.97|talk]]) 20:06, 9 April 2025 (UTC)
== Really bad ==
Line 187 ⟶ 193:
Is Massalin's Synthesis kernel really relevant here? I propose removing it. [[User:Peter Flass|Peter Flass]] ([[User talk:Peter Flass|talk]]) 16:26, 11 January 2019 (UTC)
* '''Keep''' - surely it is an example of self-modifying code, and done by an operating system to itself? As distinct from an operating system modifying its various internal tables or linked-lists to activate or terminate a new task.[[User:NickyMcLean|NickyMcLean]] ([[User talk:NickyMcLean|talk]]) 08:49, 12 January 2019 (UTC)
== Reality check from Redmond. ==
Article should mention that self-modifying code is essentially incompatible with '''digitally signed executables''' (which is a common practice and gradually becoming a de facto requirement within the Microsoft Windows OS ecosystem). [[Special:Contributions/94.21.160.52|94.21.160.52]] ([[User talk:94.21.160.52|talk]]) 23:06, 5 December 2024 (UTC)
== Disadvantages ==
This does not seem to belong in the "Disadvantages" section: ''"Self-modifying code can be rewritten as code that tests a flag and branches to alternative sequences based on the outcome of the test, but self-modifying code typically runs faster."'' The statement that it can be rewritten doesn't seem to be a disadvantage, and the statement that it runs faster seems clearly to be an advantage.
So, this could possibly be listed in "Advantages" as: ''"Self-modifying code typically runs faster than equivalent code that tests a flag and branches to alternative sequences based on the outcome of a test."'' - but seems a bit redundant with the existing "Fast paths can be established for a program's execution..." statement. Comments? [[User:Harris7|Harris7]] ([[User talk:Harris7|talk]]) 12:00, 21 June 2025 (UTC)
|