Content deleted Content added
it would be good to find a source for why XCT is out of fashion |
m →Computer models: Added jump table wikilink |
||
(47 intermediate revisions by 10 users not shown) | |||
Line 1:
{{
{{Machine code}}
In a [[Instruction set architecture|computer instruction set architecture (ISA)]], an '''execute instruction''' is a [[machine code|machine language instruction]] which treats data as a machine instruction and executes it.
It can be considered a fourth mode of instruction sequencing after [[program counter|ordinary sequential execution]], [[branch (computer science)|branching]], and [[interrupt
==Computer models==
Many computer families introduced in the 1950s and 1960s include ''execute'' instructions: the [[IBM
|url=http://www.bitsavers.org/pdf/univac/1107/UT-2463_CPU_Nov61.pdf
|title=Univac 1107 Central Computer |date=November 1961|page=12{{hyphen}}1}}</ref> the [[CDC 1604#The 924|CDC 924]] ({{mono|XEC}}),<ref name=924Man>{{cite manual
|url=http://bitsavers.informatik.uni-stuttgart.de/pdf/cdc/924/168B_CDC_924_Reference_Manual_Oct62.pdf
|title=Control Data 924 Computer Reference Manual |date=October 1962|page=2{{hyphen}}41}}</ref> the [[PDP-6]]/[[PDP-10|-10]] (
Fewer 1970s designs include ''execute'' instructions
|url=http://lansdale.com/datasheets/sl8x305_rev0.pdf|publisher=Lansdale Semiconductor Inc.|accessdate=20 June 2017}}</ref> An ''execute'' instruction was proposed for the [[PDP-11]] in 1970,<ref name="pdp11x">{{cite web |last=van de Goor |first=Ad |date=September 21, 1970 |title=The Execute Instruction |url=http://bitsavers.informatik.uni-stuttgart.de/pdf/dec/pdp11/memos/700921_The_Execute_Instruction.pdf |id=PDP-11/40 Technical Memorandum 18}}</ref> but never implemented for it<ref name="pdp11">{{cite manual |url=http://bitsavers.org/pdf/dec/pdp11/handbooks/PDP11_Handbook1979.pdf |title=PDP11 Processor Handbook: PDP11/04/34a/44/60/60 |date=1979 |publisher=[[Digital Equipment Corporation]]}}</ref> or its successor, the [[VAX]].<ref>{{cite manual |url=https://www.ece.lsu.edu/ee4720/doc/vax.pdf |title=VAX MACRO and Instruction Set Reference Manual |date=April 2001 |publisher=[[Compaq Computer Corporation]] |id=AA-PS6GD-TE}}</ref>
Modern instruction sets do not include ''execute'' instructions because they interfere with [[instruction pipeline|pipelining]], [[Prefetch input queue|prefetching]], and other optimizations.{{citation needed|date=July 2021}}
==Semantics==
Line 19 ⟶ 22:
The instruction to be executed, the target instruction, may be in a register or fetched from memory. Some architectures allow the target instruction to itself be an ''execute'' instruction; others do not.
The target instruction is executed as if it were in the memory ___location of the ''execute'' instruction. If, for example, it is a subroutine call instruction, execution is transferred to the subroutine, with the return ___location being the ___location after the ''execute'' instruction. However, some architectures implement variants of the ''execute'' instruction which inhibit branches.<ref name="brooks"/>
The System/360 supports variable-length target instructions. It also supports modifying the target instruction
Some architectures support an ''execute'' instruction which operates in a different [[Protection ring|protection and address relocation mode]]. For example, the [[Incompatible Timesharing System|ITS]] PDP-10 paging device supports a [[Protection ring|privileged-mode]]
The ''execute'' instruction can cause several problems when
* the processor may be
* similarly, the processor may go into an infinite loop if the series of ''execute'' instructions is circular and
* if the ''execute'' instructions are on different [[Page (computer memory)|swap pages]], all of the pages need to be swapped in for the instruction to complete, which can cause [[thrashing (computer science)|thrashing]].
Similar issues arise with [[Addressing mode#multilevel memory indirect|multilevel indirect addressing modes]].
==Applications==
The ''execute'' instruction has several applications:<ref name="brooks"/>
* Functioning as a single-instruction [[subroutine]] without the usual [[Calling convention|overhead of subroutine calls]]; that instruction may call a full subroutine if necessary.<ref name="brooks"/>
* [[Late binding]]
** Implementation of [[call by name]] and other [[thunks]].<ref name="brooks"/>
** A table of execute targets may be used for [[dynamic dispatch]] of the [[method (computer science)|methods]] or [[virtual function]]s of an [[object (computer science)|object]] or [[class (computer science)|class]], especially when the method or function may often be implementable as a single instruction.<ref name="pdp11"/>
** An execute target may contain a [[hooking|hook]] for adding functionality or for debugging; it is normally initialized as a [[NOP (code)|NOP]] which may be overridden dynamically.
** An execute target may change between a fast version of an operation and a fully traced version.<ref>{{cite book|first=Richard P.|last=Gabriel|author-link=Richard P. Gabriel|title=Performance and Evaluation of Lisp Systems|date=August 1985|isbn=9780262070935|page=32|publisher=MIT Press |url=https://www.dreamsongs.com/Files/Timrep.pdf}}</ref><ref>{{cite manual|first=Kent M.|last=Pitman|author-link=Kent Pitman|title=The Revised Maclisp Manual, Sunday Morning Edition|url=https://www.maclisp.info/pitmanual/|section-url=https://www.maclisp.info/pitmanual/system.html#
* Tracing, monitoring, and emulation
** This may maintain a pseudo-[[program counter]], leaving the normal program counter unchanged.<ref name="brooks"/>
* Executing dynamically generated code, especially when [[memory protection]] prevents executable code from being writable.
* Emulating self-modifying code, especially when it must be [[reentrancy (computing)|reentrant]] or read-only.<ref name="pdp11x"/>
* In the IBM System/360, the ''execute'' instruction can modify bits 8-15 of the target instruction, effectively turning an instruction with a fixed argument (e.g., a length field) into an instruction with a variable argument.
* Privileged-mode ''execute'' instructions as on the KL10 are used by [[Kernel (operating system)|operating system kernels]] to execute operations such as block copies within the virtual space of user processes.
==Notes==
|