This section deals both with setup instructions, when a four-bit tag field is associated with each 32 bits of memory in order to indicate the type of its contents, that are used in the computer's otherwise normal mode of operation in order to prepare for the operation of programs for which type restrictions are enforced, and with operation in that mode.
When tagged word mode is specified among the bits which specify data formats, the cache is used so that an extra four bits are associated with each 32-bit word in memory. If an alternate memory width is in effect, four bits may be associated with 36, 40, 48, or 60 bits in memory instead.
These four bits have the values:
0000 Uninitialized 0001 Subsequent Word of Multi-Word Item 0010 Array Descriptor 0011 Character String 0100 Register Packed 0101 Register Packed Long 0110 Simple Floating 0111 Simple Floating Long 1000 Byte 1001 Halfword 1010 Integer 1011 Long 1100 Executable Code 1101 Floating 1110 Double 1111 Quad
The only immediate effect of setting tagged word mode is to cause these bits to be set to the appropriate value whenever data is stored in memory.
In addition, the OST (Override Storage Type) mode-independent instruction can be used to prefix an instruction that stores data in memory, so as to explicitly set the tag bits to a chosen value instead of the one associated with the type of the value stored.
If the bit in the Program Status Block labelled Type-Enforced Mode is set, then, if tagged word mode is also in effect for the data memory accessed by the instruction, an error will take place on any load or store instruction if the memory operand of that instruction does not have the correct tag value; in addition, an error will take place if control is transferred to any location not tagged as executable code.
Because of this, all storage used by a program running in type-enforced mode, and all code belonging to that program, must be labelled by a supervisory program accessing that storage in tagged word mode, but not running in type-enforced mode, before that program starts. One exception to that rule exists; even in type-enforced mode, any type of data may be stored in memory which is tagged as uninitialized, but once that is done, the memory will be tagged for future accesses. In this way, the number of calls to the supervisory program when it is desired to erase objects from memory can be minimized.
Stateful scratchpad mode and mutable scratchpad mode are identical when type-enforced mode is in effect; the tag bits associated with the operand located in the scratchpad determine the type of the instruction, and thus the bits indicating a type in the Program Status Block are not used.
Also, indexed instructions are modified in this mode. The first operand of the instruction is located ignoring the index, and must be tagged as an array descriptor. This descriptor consists of a 32-bit pointer to the array data, followed by the 32-bit length of the array. The contents of the index register, provided they are less than the given length, are added to the value in the pointer to locate the actual operand of the instruction. This actual operand must be tagged as being of the correct type.
Since there is no distinction between the contents of an array and simple variables of the same type, it is possible to access an array element directly as though it were a simple variable.