This question is about a semantic variation of reference-related expressions. A hot heap location is one that
Question:
This question is about a semantic variation of reference-related expressions. A hot heap location is one that is accessed more often by a program.
- Extend Reflang to support hot store locations. The first step in keeping track of hot store locations is to augment the store locations to have an addition integer field, access-count.
- The second step is to enhance the logic of accessing a store location to increment access-count on both reads and writes of memory locations.
To achieve this semantics, modify the Reflang interpreter as follows:
1. Modify the heap so that each location is a pair of the value and a number (from now on, we will call this number access_count). You can also use a separate list to keep track of access_count for locations. Initially, the value of access_count for each location is 0.
2. Modify the interpreter so that, for every read of a location and assignment to the location, the field access_count of the location is incremented up 1.
3. Add a frequency expression to Reflang with the following syntax that takes a location and evaluates to the access_count of that location:
Step by Step Answer:
An Experiential Introduction To Principles Of Programming Languages
ISBN: 9780262045452
1st Edition
Authors: Hridesh Rajan