Implicit Flag Form

Revision as of 13:03, 3 April 2007 by >Chris.quenelle
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

For discussion see the talk page

In order to save space, I propose we add a new form called DW_FORM_implicit_flag. If an attribute has this form, then it has an automatic value of '1' (that is, TRUE).

In order to set such an attribute to false, you would use an abbreviation table entry that doesn't include that attribute as a member.

Here's the scenario: I have 100 different DW_TAG_subprograms in my module. 50 of them have DW_AT_someflag set, and 50 of them don't.

Today I have two options:

1. I could create one abbrev table entry and allocate a byte in each die to record 1/0.

2. I could create two abbrev table entries. One with the flag attribute and one without. This saves 50 bytes of space.

I'd like to add a third mechanism

3. Create two abbrev table entries. One with the flag attribute and one without. In the abbrev table entry that has the flag, use the new form DW_FORM_implicit_flag to indicate the attribute has 0-length data, and the value is always 'true (1)'

In the libdwarf library all these mechanics are hidden. The abbrev table entries are automatically created in response to the attributes that are added to the dies. This extension would enable a new optimization in libdwarf, and would be transparent to users of libdwarf. It would not be transparent to implementations that directly read/write dwarf. In other similar read/writer implementations, I would expect this to be a fairly low-level tweak, and not have a big impact on most of the dwarf processing code.