Английская Википедия:Execute instruction

Материал из Онлайн справочника
Перейти к навигацииПерейти к поиску

Шаблон:Short description Шаблон:Machine code In a computer instruction set architecture (ISA), an execute instruction is a machine language instruction which treats data as a machine instruction and executes it.

It can be considered a fourth mode of instruction sequencing after ordinary sequential execution, branching, and interrupting.[1] Since it is an instruction that operates on other instructions like the repeat instruction, it has also been classified as a meta-instruction.[2]

Computer models

Many computer families introduced in the 1950s and 1960s include execute instructions: the IBM 709[1] and IBM 7090 (op code mnemonic: Шаблон:Mono),[3] the IBM 7030 Stretch (Шаблон:Mono, Шаблон:Mono),[4][1] the PDP-1/-4/-7/-9/-15 (Шаблон:Mono),[5][6] the UNIVAC 1100/2200 (Шаблон:Mono),[7] the CDC 924 (Шаблон:Mono),[8] the PDP-6/-10 (Шаблон:Mono), the IBM System/360 (Шаблон:Mono),[9] the GE-600/Honeywell 6000 (Шаблон:Mono, Шаблон:Mono),[10] the SDS-9xx (Шаблон:Mono),[11] the SDS 92 (Шаблон:Mono),[12] and the SDS Sigma series (Шаблон:Mono).[13]

Fewer 1970s designs include execute instructions: the Nuclear Data 812 minicomputer (1971) (Шаблон:Mono),[14] the HP 3000 (1972) (Шаблон:Mono),[15] and the Texas Instruments TI-990 (1975)[16] and its microprocessor version, the TMS9900 (1976) (Шаблон:Mono).[17] An execute instruction was proposed for the PDP-11 in 1970,[18] but never implemented for it[19] or its successor, the VAX.[20]

Modern instruction sets do not include execute instructions because they interfere with pipelining, prefetching, and other optimizations.Шаблон:Citation needed

Semantics

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.[1]

The System/360 supports variable-length target instructions. It also supports modifying the target instruction before executing it. The target instruction must start on an even-numbered byte.[9]

The GE-600 series supports execution of two-instruction sequences, which must be doubleword-aligned.[10]

Some architectures support an execute instruction which operates in a different protection and address relocation mode. For example, the ITS PDP-10 paging device supports a privileged-mode Шаблон:Mono 'execute relocated' instruction which allows memory reads, writes, or both to use the user-mode page mappings.[21] Similarly, the KL10 variant of the PDP-10 supports the privileged instruction Шаблон:Mono 'previous context XCT'.[22]

The execute instruction can cause several problems when one execute instruction points to another one and so on:

  • the processor may be uninterruptible for multiple clock cycles if the execute instruction cannot be interrupted in the middle of execution;
  • similarly, the processor may go into an infinite loop if the series of execute instructions is circular and uninterruptible;
  • if the execute instructions are on different swap pages, all of the pages need to be swapped in for the instruction to complete, which can cause thrashing.

Similar issues arise with multilevel indirect addressing modes.

Applications

The execute instruction has several applications:[1]

  • Functioning as a single-instruction subroutine without the usual overhead of subroutine calls; that instruction may call a full subroutine if necessary.[1]
  • Late binding
    • Implementation of call by name and other thunks.[1]
    • A table of execute targets may be used for dynamic dispatch of the methods or virtual functions of an object or class, especially when the method or function may often be implementable as a single instruction.[19]
    • An execute target may contain a hook for adding functionality or for debugging; it is normally initialized as a NOP which may be overridden dynamically.
    • An execute target may change between a fast version of an operation and a fully traced version.[23][24][25]
  • Tracing, monitoring, and emulation
    • This may maintain a pseudo-program counter, leaving the normal program counter unchanged.[1]
  • Executing dynamically generated code, especially when memory protection prevents executable code from being writable.
  • Emulating self-modifying code, especially when it must be reentrant or read-only.[18]
  • 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 operating system kernels to execute operations such as block copies within the virtual space of user processes.

Notes