Bytecode annotations - annotations op and custom backtraces
Jonathan Worthington
jonathan at jnthn.net
Wed Jan 7 16:12:44 UTC 2009
Francois Perrad wrote:
> Jonathan Worthington a écrit :
>> Hi,
>>
>> I've got PDD13 bytecode annotations implemented, plus the things
>> mentioned in PDD19 (so they're now parsed and stored in the bytecode)
>> and PDD23 (the .annotations method on exceptions, to get the
>> annotations that applied when the exception was thrown).
>>
>> Now this stuff is done, I'm ready to merge the branch in, after some
>> feedback from folks++ on IRC. However, I have a couple more thoughts
>> on things we might do to make this more useful (post-merge, since I
>> doubt they'll be so disruptive).
>>
>> 1) In Perl 6, you can do things like $?FILE and $?LINE to get the
>> current file and line number. I think the easiest way to make this
>> work will be an annotations op.
>>
>> $P0 = annotations # gets a hash of all annotations in force
>> $P0 = annotations 'line' # value of the 'line' annotation only
>>
>> 2) I think we're going to want some better control over generating
>> backtraces. I suggest a backtrace method on an Exception object. It
>> will return an array of hashes, which represent the backtrace and
>> contain the keys:
>>
>> sub - the Sub PMC of the sub that had been called (or sub
>> subclass of it)
>> annotations - a hash of the annotations in force at the point the
>> exception was thrown in the top entry, and those in force at the
>> point of call down the rest of the chain
>>
>> This should give HLL developers the ability to emit backtraces as
>> they wish (since the language they are implementing may want a trace
>> emitted in a given form).
>>
>> Want? Not want?
>>
>
> Yes, Lua wants it. I think partcl too.
>
> Lua lost its user backtrace since Parrot 0.7.0.
OK, some people said yes and nobody screamed no, so these features are
now in place, and backtrace is documented in the Exceptions PDD.
Feedback and bug reports welcome.
> Since this release, it's become useless.
>
With regard to backtraces, or are there more general issues? (If so, you
may have written them elsewhere, I just don't remember reading them.)
I think this is going to be enough to mark bytecode annotations as
"landed" in the release schedule. However, I see that "bytecode testing
framework" has been also written along side it. Anyone know what that's
about?
Thanks,
Jonathan
More information about the parrot-dev
mailing list