Subject: CS490 Minutes 2.1 Function calling... --------------------- - Access link is last parameter - Params passed in source order on stack - The callee adjusts the stack to clean up - Return values live in EAX - Access links are stack addresses. As such, they always have their low bit clear, making them look like integers to the stack walking code. EBP RA AL PARM X ... PARM 2 PARM 1 Structures/Object Handles ------------------------- - 0 (zero) is NULL. - Objects in the GC heap all are preceeded by a 32 bit object header. This object header is broken into three fields. The MSb indicates whether the object contains "raw" data (1=yes, 0=no). If set to 0, this object is scanned for object references after forwarding. The 2nd MSb indicates whether the GC has forwarded the object or not (This only uses 3 combinations of the four bits, leaving room for expansion). The lower 30 bits contain either an address or a size, depending on the value of the Forwarding bit. If the Forwarding bit is clear, the lower 30 bits contain the "actual" size of the object. For a string, this value may very well not be a multiple of 4, even though a multiple of four bytes was allocated to it. To get the heap objects size, round to the next greatest multiple of four ((size+3) & ~3). If the forwarding bit is set, the lower 30 bits contain the forwarding address of the object (for the GC). This address needs to be shifted left by two bits before it is used. The object header looks like this: -------------------------------------------- | R | F | Size/Address | -------------------------------------------- 31 30 29-0 - Strings are 8 bit chars, stored on the heap. No terminating null byte. - Arrays are always 32 bits in size, having entries composed of either integers or object references. Intermediate representation --------------------------- - Will be a writeable language. A parser for the IR could be written. - Based on SAM - Infinite registers - Supports globals, strings, literals, local vars, uplevel references.