Handout 7 CMSC 22610, W2011 Abstract Machine Design What are the requirements? * data representation - primitive data - integers (big-endian vs little-endian) - strings (pointers to heap-allocated char vectors) - structured data - tuples (pointers to heap-allocated word vectors) - datatype values (constructions) - tags and headers - boxed and unboxed values tagged values - heap allocation of structured data * environments - function closure environments - local environments (let decls) - global environments - structure and access - vector/array accessed by indexing - name mapping accessed by name lookup * variables - representation (indexes or offsets) - access * temporary storage of intermediate results (i.e. values that are never bound to a variable) - value stack * function representation (closures) - code - environment * function call and return - argument passing - returning results - "stack frames" or "activation records" - "return address" - local variable storage - special functions provided by the a.m. (C calls) * a.m. code - instructions - representation ("symbolic" or bytes) - primitive ops (e.g. integer addition) - control flow (e.g. if, case, (jump, conditional jump)) - book-keeping (e.g. stack manipulation) - linear vs tree structured code - labels vs code string pointers - instruction size: uniform or variable * a.m. structures - value stack, used for intermediate results - stack pointer register (SP -- top of stack) - current environment register (EV) - current "call frame" pointer (FP) - multiple stacks? - the heap (where compound data structures are allocated) * garbage collection of the heap (?)