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

Done, will be in next dev build.

Now for:

final static boolean enabled = false;
pointcut p(): .... && if(enabled);

there will be nothing woven.

And as a lucky bonus, for:

final static boolean enabled = true;
pointcut p(): ... && if (enabled);

It will not bother to call the if() method - and if the rest of the pointcut can be evaluated statically then the whole thing will be evaluated statically and there will be no runtime test.

cheers,
Andy.


2009/2/25 Andy Clement <andrew.clement@xxxxxxxxx>
I think we should do some minimal level of analysis for constants.
Raised as: https://bugs.eclipse.org/bugs/show_bug.cgi?id=266165

Andy.

2009/2/25 Neale Upstone <neale.upstone@xxxxxxxxxx>

Thanks Bruno, that's working perfectly.

> -----Original Message-----
> From: aspectj-users-bounces@xxxxxxxxxxx
> [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Bruno
> De Fraine
> Sent: 25 February 2009 12:01
> To: aspectj-users@xxxxxxxxxxx
> Subject: 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
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
**********************************************************************
IMPORTANT NOTICE.
Confidentiality:  This e-mail and its attachments are intended for the above named only and may be confidential.  If they have come to you in error you must take no action based on them, nor must you copy or show them to anyone; please reply to this e-mail and highlight the error.
Security Warning:  Please note that this e-mail has been created in the knowledge that Internet e-mail is not a 100% secure communications medium.
We advise that you understand and observe this lack of security when e-mailing us.
Viruses:  Although we have taken steps to ensure that this e-mail and attachments are free from any virus, we advise that in keeping with good computing practice the recipient should ensure they are actually virus free.
Monitoring and Scanning:  Cambridge Cognition has monitoring and scanning systems in place in relation to emails sent and received to: monitor / record business communications; prevent and detect crime; investigate the use of the Company's internal and external email system; and provide evidence of compliance with business practices.

Cambridge Cognition Limited
Company Registration Number 4338746
Registered address:
Tunbridge Court
Tunbridge Lane
Bottisham
Cambridge
CB25 9TU
UK
**********************************************************************

_______________________________________________



Back to the top