This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Aspect-oriented after-like feature.


Hi,

I'm trying to implement something close to the "after advice" in
aspect-oriented  for C programs just as a proof of concept. It
consists in calling another function just before returning to the
caller. This "after" function should be able to access the original
returned value.

I've started by adding a TRY_FINALLY_EXPR node around the function
definition (copying the behavior for the __cyg_profile_func_exit
function), but it seems that accessing the returned value (or a copy
of this value) would be difficult this way.

So now, I'm trying to call this after function just before returning
by modifying the gimplify_return_expr function.  Basically what I
would like to build a call to the after function with the expression
originally "given to" return.

return result;  -> return after(result);

Supposing the after function's prototype is right and I know which
function to call (I have an attribute to specify which function to
call).


So far, I've been able to call the after function with the good
parameter, however, I'm not able to get the value returned by this
function to give back to the original caller.


My questions are:
Am I doing "conceptually" right ? Or is this completely silly..
Should it be done somewhere else ?
Is this already somewhere ?
What are the necessary steps to implement it in a "right" way ? (I've
not seen something related to that in any documentation.).


Thanks








What I've done so

-- 
Laurent


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]