Feature request: Macro call on every function

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Feature request: Macro call on every function

Cauê W.
I know this would be kind of heavy, but I think it's the best way to create target-independent debuggers/profiler tools. This way we can add a code at the beginning/end of each function that allows us to debug/profile the code

What do you think?

Cheers!
Cauê

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Feature request: Macro call on every function

Nicolas Cannasse
Le 02/08/2011 18:10, Cauê Waneck a écrit :
> I know this would be kind of heavy, but I think it's the best way to
> create target-independent debuggers/profiler tools. This way we can add
> a code at the beginning/end of each function that allows us to
> debug/profile the code
>
> What do you think?

With the new @:build behavior, you can modify all the fields at
building-time, for instance by adding wrappers around each method.

nicolas


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Feature request: Macro call on every function

Cauê W.
With the new @:build behavior, you can modify all the fields at building-time, for instance by adding wrappers around each method.

That's great!!
Could we be able to add a @:build behavior on every builded class? This would be very good for profiling, for example on numerous mobile platforms we are supporting.

Thank you!
Cauê

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Feature request: Macro call on every function

Marcelo de Moraes Serpa
Cauê,

I know it's not related to the post, but I think it'd be valuable if you could share how you are using/plan on using this specific feature to create platform-independent dbg tools. Would you mind sparing some time to write about it in the wiki? :) I'd be eager to read, and I'm sure it'd add a lot of value to haXe, even if indirectly.

Thanks,

Marcelo.

On Tue, Aug 2, 2011 at 11:44 AM, Cauê Waneck <[hidden email]> wrote:
With the new @:build behavior, you can modify all the fields at building-time, for instance by adding wrappers around each method.

That's great!!
Could we be able to add a @:build behavior on every builded class? This would be very good for profiling, for example on numerous mobile platforms we are supporting.

Thank you!
Cauê

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Feature request: Macro call on every function

Cauê W.
Hey Marcelo!

I don't have a lot of time right now to evolve on this, but the main idea would be :

For profiling, we'd add a custom static structure that would take care of the stack manipulation (enter in the "stack" when the function enters, and "exit" it every time before the function returns) with the current time indication (Timer.getTime(), e.g.)

once every frame this information would be sent to a server that would take care of displaying and analyzing this info. Pretty straight-forward

For debugging, the best way to work this would be with platforms that work with blocking/synchronous calls. Not all platforms support this, but the ones that don't (flash and js) already have native debugger features, so we could maybe work this out on a standardized fashion (e.g. add native breakpoints also).

When you add breakpoints to a function part, we'd need a macro script that would take this function part, unroll all local variables (emulating the stack) to be sent to the debugger server, and add a blocking call that will send these objects and hold the application until the debugger releases it. It would be pretty easy to inspect objects using the current haxe reflect api, so looking inside objects and their values would be cross-target and easy to implement, even though maybe an object hash would be necessary to add ids to each of these objects). We wouldn't be able to step into/through the function calls, but we'd be able to add lots of breakpoints if we need a similar behavior. Also a stack manipulation could be added so we know the call stack (the same way as in the profiler).

Thanks
Cauê


2011/8/2 Marcelo de Moraes Serpa <[hidden email]>
Cauê,

I know it's not related to the post, but I think it'd be valuable if you could share how you are using/plan on using this specific feature to create platform-independent dbg tools. Would you mind sparing some time to write about it in the wiki? :) I'd be eager to read, and I'm sure it'd add a lot of value to haXe, even if indirectly.

Thanks,

Marcelo.

On Tue, Aug 2, 2011 at 11:44 AM, Cauê Waneck <[hidden email]> wrote:
With the new @:build behavior, you can modify all the fields at building-time, for instance by adding wrappers around each method.

That's great!!
Could we be able to add a @:build behavior on every builded class? This would be very good for profiling, for example on numerous mobile platforms we are supporting.

Thank you!
Cauê

--

haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org