Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] if(ENABLED) causes weave for constant

On 25 Feb 2009, at 11:45, Neale Upstone wrote:

For some development/debugging aspects, I want to be able to switch them
on and off and cause the weaver to ignore them.

You can try the following:

pointcut fail();
pointcut isEnabled(): !fail();  // Remove "!" to disable

before() : publicCalls() && isEnabled()
{
...
}

From a weaving efficiency point of view, wouldn't it be better to detect
that if() has been passed a constant and for the pointcut "publicCalls()
&& if(ENABLED)" to apply to no joinpoints?


Unlike Java, it seems that AspectJ delays all if-tests until runtime. However, I believe the research on SCoPE uses partial evaluation techniques to optimize this and many other if-tests, see:
http://portal.acm.org/citation.cfm?id=1218582

Best regards,
Bruno

--
Bruno De Fraine
Vrije Universiteit Brussel
Faculty of Applied Sciences, DINF - SSEL
Room 4K208, Pleinlaan 2, B-1050 Brussels
tel: +32 (0)2 629 29 75
fax: +32 (0)2 629 28 70
e-mail: Bruno.De.Fraine@xxxxxxxxx




Back to the top