Part of
the homework for 22C:116, fall 2002
by
Douglas W. Jones
THE UNIVERSITY
OF IOWA
Department of Computer Science
Always, on every assignment, please write your name legibly as it appears on your University ID and on the class list! All assignments will be due on Fridays at the start of class, and unless there is what insurance companies call "an act of God", the only exceptions to this rule will be by advance arrangement.
O.M(P)
There are several well-known approaches to implementing polymorphic objects;
The fastest stores, in each object, pointers to the code of the polymorphic
methods of that object's class. Objects with many polymorphic methods
are therefore large. To minimize the object size, we can store, in each
object, a pointer to the descriptor for the object's class, and store pointers
to all of the polymorphic methods in the class descriptor.
Problem: Give code or pseudocode at the machine language level for the example call given above. Use the machine architecture you know best, or alternatively, give code in C (not C++) instead of machine code or machine-level pseudocode.
Pseudocode, by the way, gives details about some computation with an informal disregard for syntactic formality.
The Question What is the difference between the information pushed on the stack by a typical function call and by response to a typical interrupt.