Issue 230324.2: Expression Operation Standard Extensibility Opcode
Author: | Mark Wielaard |
---|---|
Champion: | Mark Wielaard |
Date submitted: | 2024-01-22 |
Date revised: | |
Date closed: | 2024-03-04 |
Type: | Enhancement |
Status: | Accepted |
DWARF Version: | 6 |
Background
This is the standard extended opcode variant of the vendor extended opcode as proposed by Scott Linder in issue 230324.1.
Like the vendor extended opcode space, the standard opcode space is finite. Although not as tight. There are 224 possible standard opcodes. 172 are currently defined or reserved. Leaving 52 undefined.
To expand this encoding space we propose defining one DWARF operation in the official encoding space which acts as a "prefix" for extensions. It is followed by a ULEB128 encoded extension opcode, which is then followed by the operands of the corresponding vendor extension operation.
No extended opcodes are defined yet. And there are still free standard opcode numbers we can use. But it would be good to already define this extension mechanism. For newly added opcodes we can then decide to define them as extended opcodes to save some standard opcode numbers. Since an extended opcode will by definition be larger than a standard opcode we should only use extended opcodes for operations that are uncommon.
To make clear that this is a new namespace we propose that extension
opcodes will have names starting with DW_OP_EXT_
.
Proposal
In Section 2.5.1.7, p38, add a new code at the end of the list:
3.
DW_OP_extended
The
DW_OP_extended
opcode encodes an extension operation. It has at least one operand: a ULEB128 constant identifying the extension operation. The remaining operands are defined by the extension opcode (DW_OP_EXT_
). The extension opcode0
is reserved.
In Section 7.7.1, p226, add a new row to table 7.9:
Operation Code No. of Operands Notes DW_OP_extended
0xde 1+ ULEB128 extension opcode, followed by extension-defined operands
2024-03-04: Accepted. Some question about whether to include a length indicator (so consumers would be able to skip unknown opcodes), but agreed it was not necessary.