Category Archives: cgo
Revision Notes
Identification Often (5 different papers) you will be asked to produce the symbol table, attribute records, and links between these, corresponding to a C program that has a lot of nested scope. Remember; this is not the program running, it … Continue reading
Optimisation
Optimisation isn’t actually optimisation; it doesn’t result in optimal code. So what does it do? Preserve the meaning of the program On average improves the program (run time, space, program size) Is worth the cost of extended compile time + … Continue reading
Tree-based languages (continued?)
Tiling algorithms Sorry, when did this become about tiles? In RISC you have small tiles, in CISC you have large tiles. Oh, this makes sense; tree tiles are bits of trees that can be matched up together to form complex … Continue reading
Liveness Analysis
Liveness analysis is related to allocating registers. Two temporary values can fit in the same register if they’re never ‘live’ at the same time. A temporary is live if it holds a value that will be used in the future. … Continue reading
Code Generation
Intermediate code generation is useful for: Storage allocation; fix address or offsets for each variable identifier. Translation to intermediate code. The slides are pretty confusing…
Intermediate Languages
You’re going to have to write a lot of compilers if you go from language to assembly. So why not put an intermediate language in the middle. Then you can reuse optimisation phases and mainly it saves a huge amount … Continue reading
Garbage Collection 2
Cost of Garbage Collection I think basically if you have a very small reachable heap copying is good (Cheney’s Algorithm). But otherwise Mark-and-Sweep is pretty good. Mark Phase with Pointer Reversal Note: You’d do this because doing a DFS down … Continue reading
Memory Organisation and Procedure Call Protocol
Generally RAM is split up into (in order): Code Static Data Stack Free Space Heap And code memory is usually split up into code for procedures, with entry points at the bottom (lowest address) for each procedure. Storage can be … Continue reading
Data Representation
First, a summary of Run Time Organisation Run time organisation deals with the general issues of mapping high-level programming language constructs onto low-level features of the target machine. We are going to look at: Data representation. Memory organisation. Procedure call … Continue reading
Attribute Grammars
An attribute grammar, at its simplest, is a grammar with attributes attached to it. Previously we’ve discussed transforming the abstract syntax tree by explicitly traversing the tree. But instead we can do this shorter, implementation-independent specification. The ‘attributes’ in an … Continue reading