Here you can ask questions and find or give answers to organizational, academic and other questions about studying computer science.

1.1k questions

1.2k answers


543 users

0 votes
In the videos arrays are regarded as constants and are therefore excluded from the read/write sets.

In the updated lecture slides they are included. Which definitions are correct for the exam? How exactly are the read and write sets for array accesses defined?

Thanks in advance!
in # Mandatory Modules Bachelor by (230 points)

1 Answer

0 votes
Best answer
Yes, that was a kind of a discussion for a while. On the one hand, you can argue that arrays are constants since a statement y[x1] = x2 is mapped to a store instruction sti x2,x1,y where y is a constant and thus only x1 and x2 are read and no variable is written.

On the other hand, from the viewpoint of program analysis, you may argue that y[x1] = x2 is updating the array y if you consider y not just as a base address (as done in the C programming language) and instead consider the value of variable y as being the entire array (as done in the F# programming language for instance).

So, dealing with the array is somehow a matter of taste. It does also not matter since we use that information for the dataflow analysis and that in turn is used for register allocation, and we never assign an array variable to a register (since we map array accesses to load/store instructions with the base address of y as a constant).
by (166k points)
selected by

Related questions

Imprint | Privacy Policy