Suppose a garbage-collected interepreter uses the following four kinds of records:
Tag 1: a record containing one integer and one pointer
Tag 2: a record containing two pointers
Tag 3: a record containing three integers
Tag 4: a record containing one pointer
(An "integer" is an immediate integer, not a tagged integer representing a value in the interpreted language.)The interpreter has two registers, which always contain pointers, and a memory pool of size 30. The allocator/collector is a two-space copying collector, so each space is of size 15. Records are allocated consecutively in to-space, starting from the first memory location, 0.The following is a snapshot of memory just before a collection where all memory has been allocated:
Register 1: 3
Register 2: 0
To space: 1 7 12 4 0 3 3 3 3 2 5 3 1 14 0
What are the values in the two registers and the new to-space after collection? Assume that unallocated memory in to-space contains 0.Express your answer as a function answer-for-12.1 that takes no arguments and returns a list of 17 numbers (register 1, then register 2, then to-space slots).
Last update: Monday, November 25th, 2002mflatt@cs.utah.edu