Different pointer representations on the same machine
Henry Spencer
henry at utzoo.uucp
Thu Feb 16 06:04:16 AEST 1989
In article <3675 at arcturus> evil at arcturus.UUCP (Wade Guthrie) writes:
>I have seen references on the net to computers which have different
>representations for different types of pointers (even some computers
>which represent different types of pointers as different sizes).
>
>Could I have some examples...
The usual reason for this is that the machine was designed as a word-
addressed box and does not easily support pointer-to-character. This
means that pointer to character needs enough extra bits to address a
character within a word.
On machines with wide words, the extra bits can often be found within a
pointer, as "unused" bits; then one just needs special code for handling
pointer-to-character that (a) picks those bits out, (b) uses the rest of
the pointer to access a word, and (c) uses the picked bits to pull a
character out of that word. The PDP-10 and the Cray-1 are examples of
such machines (the 10 is an unusually favorable case because it has some
instructions that do roughly what's wanted).
On machines with narrow words (e.g. 16-bit word-addressed machines), the
situation is much stickier, because there usually aren't any spare bits
in a pointer. Then one may have to add a whole extra word to the
representation of pointer-to-character to contain the extra bit(s), with
appropriate changes in code generation anywhere such pointers are used
or moved around. Some of the smaller Data General machines are like this,
as are other minicomputers of similar vintage.
Pointer-to-short can also need such arrangements on word-addressed machines
with fairly wide words.
--
The Earth is our mother; | Henry Spencer at U of Toronto Zoology
our nine months are up. | uunet!attcan!utzoo!henry henry at zoo.toronto.edu
More information about the Comp.lang.c
mailing list