[haXe] Stack traces in Flash target
Asger Ottar Alstrup
asger at area9.dk
Fri Apr 28 08:12:30 CEST 2006
On 4/27/06, David Rorex <drorex at gmail.com> wrote:
>
>
> The difference between your code and Nicolas's, is that his code can track
> what line the functions are called from. Yours will be able to track the
> call stack, but not the exact lines.
>
[Fine examples showing the difference]
Yes, you are right that the two approaches are at different ends on the
granularity versus runtime penalty trade-off scale.
It would be great if haXe supported either of these approaches. Cannase,
please, please, please consider to put either on your TODO list ;-)
As a backup plan, we are considering to implement a simple version of the
call-annotation approach without compression with the source location lookup
table. In other words, at first, we would just implement a transformation
like this:
var a : MyObject;
a.call(b);
is transformed into
var a : MyObject;
_global.callstack.push("foo.hx", 20, "MyObject", "call");
var _tmp = a.call(b);
_global.callstack.pop();
tmp;
This will obviously bloat the object code tremendously and slow things down
by a ridicolous factor, but we're just trying to make the smallest possible
change that provides a stack trace facility. If haXe at some point does
string pooling, I guess that would reduce the bloat quite a bit. In terms of
performance, it is obviously still much slower to push 3 objects and an int
than pushing an int as the lookup approach would, but as a first iteration,
I think we are ready to accept quite a steep runtime penalty.
This transformation can be done at two levels: Either at the AST-level as a
"source-to-source" tranformation, I suppose as a part of typer.ml, or it can
be done when the .swf is generated in genswf.ml. Which approach is the
easiest? I would think it was easier at the AST-level, but I don't know the
code.
Regards,
Asger
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.motion-twin.com/pipermail/haxe/attachments/20060428/cb6f8b07/attachment-0001.htm
More information about the Haxe
mailing list