-
Notifications
You must be signed in to change notification settings - Fork 29
Description
The demo in the README shows that an object of function type shows up as having size zero, even though the function symbol will have a size equal to the number of instruction bytes.
The size of zero is deliberate, because all functions of the same signature should have the same function uniqtype. If we had to have a separate size, this doesn't scale (causes uniqtype explosion), and is wrong anyway because it is mixing distinct levels of abstraction (if you're using an allocation as a function, you're not viewing it as a bunch of instruction bytes). However, the size of zero can appear a bit odd... at the least, I should update the README to remark on this.
Really there is a level of abstraction below the function type, which views the data as instructions. We even have an allocator for modelling such structures: it's a "packed sequence" (src/allocators/packed-seq.c
). The allocator maintains a bitmap of element starts (here, instruction starts) and has a function that can decode each variable-length element, returning type and size information for it.
This idea of there being uniqtypes (functions) but also a layer of allocation below that (packed sequences of instructions) doesn't fit into the current design, which assumes uniqtypes are attached only at the leaf level. Somehow we need to relax our design or bolt on some new feature for descending a level.
This might relate to #16 about meta-completeness. E.g. if we want our chunk inserts to themselves be queryable, we seem to have some awkward containment relation (a malloc chunk has a certain type but also contains a bunch of bytes from another, higher meta-level, i.e. that of its containing allocator).