[Dwarf-Discuss] implicit_value vs stack_value

paul.robinson at sony.com paul.robinson at sony.com
Mon Jan 4 11:30:26 PST 2021


Happy New Year, everybody!

A colleague just had a question for me about DW_OP_implicit_value
which led me to wonder why we have both that and DW_OP_stack_value.
Looking at http://dwarfstd.org/ShowIssue.php?issue=071227.1 which
introduced the latter, it says in part:

  (This operator is similar to DW_OP_implicit_value, issue "070426.1".  The
  latter only permits the description of values known to be literals at
  compile-time; this proposal permits the description of values which
  have known expressions at compile-time.  It is more general; since 
  a sequence of DW_OP_constxx, DW_OP_value can replace every instance
  of DW_OP_implicit_value, this proposal also includes the removal of
  DW_OP_implicit value from the standard.)

...although I don't think "the removal of DW_OP_implicit_value" actually
happened.

I have come up with only two advantages that DW_OP_implicit_value would
have, compared to DW_OP_stack_value:
1) it can express a value larger than one expression-stack element in
   a single operation;
2) it's faintly possible that it's simpler for a producer to produce.

But, DW_OP_stack_value would frequently result in a more compact 
representation, for example:
  DW_OP_implicit_value 4 0 0 0 0 => 6 bytes
  DW_OP_lit0 DW_stack_value => 2 bytes

I don't see much value 😉 in actually deprecating or removing
DW_OP_implicit_value, now that it's out in the world; is it worth
adding a non-normative note that DW_OP_stack_value is actually more
general?

Thanks,
--paulr



More information about the Dwarf-Discuss mailing list