[Soot-list] How to generate Jimple code? (re: How to get my args pointcut to match?)

Dean, John John.Dean at park.edu
Wed Dec 19 17:34:10 EST 2012


Eric et al.,

First the background...
I'm not able to get an args pointcut to match with my new loopPar pointcut. My loopPar pointcut does match when it's used by itself. I can get args to match when it's used with standard pointcuts (like with a method call pointcut).

In the email below this one, it was suggested that I investigate my shadow match class's getTargetContextValue method. I have tried many different things, including streamlining it to the point where it simply returns an ArrayList of a Jimple integer. But I still can't get the args pointcut to match.

In the email below this one, it was also suggested that I generate Jimple code to an output file to see if that provides any clues. In writing my loopPar pointcut, I never generated Jimple code to an output file. Over the past several days, I've tried to do that, but no luck so far.

My build.xml file includes this line:

<arg line="-O0 +soot -f J -soot -sourceroots sandbox/loopPar -d sandbox/aj/out/loopPar"/>

Unfortunately, that does not appear to generate any .jimple file (and no file generated in the output directory, sandbox/aj/out/loopPar).

Yesterday, I stumbled across a soot tutorial page (http://www.sable.mcgill.ca/soot/tutorial/intro/) that tells me to enter java soot.Main at the command prompt to see if soot is set up properly. Entering that command generates the error message:

Error: Could not find or load main class soot.Main

The tutorial page says that that is an indication that soot is not installed properly. That is surprising because I installed something way back in June, and I've been successfully compiling and running my new loopPar pointcut for quite a while.

But maybe I installed abc without installing the part of soot that's needed to generate Jimple? In my installation directories, I see lots of mentions of soot (including soot subdirectories), so I know I've something installed with soot.

Yesterday and today, I've been looking for solutions that don't require a complete reinstallation of abc and soot because I'm worried that some of my prior work (configuration settings?) will be lost, and it will take me a long time to get everything working again.

1. Do you have any suggestions for how to get my soot working so I can generate Jimple code to an output file (so I can make progress on my args pointcut issue)? Is there a way to do it without having to do a complete reinstallation of everything?

2. One other thing... When I run my ant file in attempting (unsuccessfully) to generate Jimple code, my command prompt output generates several warnings which I don't understand. Here's the first such warning:

abc:  [javac] c:\000parallelLoops\parallelLoops\abc-1.3.0-transcut-4.0\abc\build.xml:157: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds

If you have any thoughts about that warning, let me know.

Thanks,
John

-----Original Message-----
From: eric.bodden at gmail.com [mailto:eric.bodden at gmail.com] On Behalf Of Eric Bodden
Sent: Monday, October 22, 2012 1:02 AM
To: Dean, John
Cc: abc-users at sable.mcgill.ca
Subject: Re: [Abc-users] How to get my args pointcut to match?

Hi John.

It may be useful to take a look at the code that gets generated, for instance using the command-line options "+soot -f J -soot". This will emit Jimple files.

The matching happens inside the method matchesAt(..). That may also be worthwhile looking at. I cannot see anything wrong with your code - it looks ok to me. So I guess we both must be missing something.

Eric

On 21 October 2012 02:33, John Dean <jdean4 at kc.rr.com> wrote:
> Hi Eric,
>
> As you suggested, I implemented a method getArgsContextValues() in my 
> RegionShadowMatch class.
> As you said, I have verified that that method is indeed called 
> automatically. My problem is that my args pointcut is causing my 
> advice to not match.
> I have tried to pinpoint the problem by simplifying 
> getArgsContextValues() to just the following (it is patterned after 
> eaj's getArgsContextValues()
> methods):
>
> public List getArgsContextValues()
> {
>   System.out.println("@@ top of getArgsContextValues");
>   ArrayList<JimpleValue> al = new ArrayList<JimpleValue>();
>   al.add(new JimpleValue((Immediate) IntConstant.v(1)));
>   return al;
> }
>
> Here is my advice:
>
> void around(int testArg):
> loopPar() && args(testArg))
> {
>   etc.
>
> And here is my simple loop that I'm trying to match:
>
> for (int a=0; a<2; a++)
> {
>   System.out.println("a = " + a);
> }
>
> I compile successfully. When I run, I get a warning saying that the 
> advice doesn't have any matches. Thus, the for loop runs without the 
> around doing anything.
> If I remove the args(testArg), then my loopPar pointcut does match 
> successfully and the around works correctly.
>
> 1. Do I have to register args(int) somewhere so abc can recognize it?
>
> 2. Since args can be associated with other pointcuts (like a method 
> call), how are loopPar and my new args(int) associated with each other?
>
> 3. Is there anything else I need to do to get the args to match?
>
> Thanks,
> John
>
> -----Original Message-----
> From: eric.bodden at gmail.com [mailto:eric.bodden at gmail.com] On Behalf 
> Of Eric Bodden
> Sent: Saturday, October 20, 2012 3:49 AM
> To: john.dean at park.edu
> Cc: abc-users at sable.mcgill.ca
> Subject: Re: [Abc-users] How to add an args pointcut?
>
> Hi John.
>
> The class abc.weaving.matching.ShadowMatch implements the method 
> getArgsContextValues(). Your compiler extension most likely implements 
> the loop pointcut through a custom subclass of ShadowMatch. Inside 
> this class, all you need to do is implement getArgsContextValues() 
> such that it returns references to the right values. The method is called automatically by abc.
>
> Eric
>
> On 19 October 2012 14:41, John Dean <jdean4 at kc.rr.com> wrote:
>> Eric,
>>
>> Thanks for your reply from yesterday.
>> I think I understand what you're saying, but I'm having trouble 
>> following through on something. I'm hesitant to ask it because I feel 
>> like I should be able to figure it out on my own, but I've spent 
>> several hours and no luck yet. Anyway....
>>
>> As you imply (?), I think I need to call 
>> abc.weaving.aspectinfo.Args.matchesAt(MatchingContext)and pass in my 
>> own version of MatchingContext as an argument. Before I write that 
>> code, I'd like to see an example of someone else calling that method.
>> I've searched in every file in eaj that contains "matchesAt" and I 
>> can't find any calls to the Args version of matchesAt.
>>
>> Can you tell me where I can find an example of calling
>> abc.weaving.aspectinfo.Args.matchesAt(MatchingContext) so I can use 
>> it as a pattern for my call?
>> Or if you think I'm barking up the wrong tree, please tell me.
>>
>> Thanks,
>> John
>>
>> -----Original Message-----
>> From: eric.bodden at gmail.com [mailto:eric.bodden at gmail.com] On Behalf 
>> Of Eric Bodden
>> Sent: Thursday, October 18, 2012 11:42 AM
>> To: john.dean at park.edu
>> Cc: abc-users at sable.mcgill.ca; Hossein Sadat-Mohtasham
>> Subject: Re: [Abc-users] How to add an args pointcut?
>>
>> Hi John.
>>
>> Did you have a look at the following method?
>> abc.weaving.aspectinfo.Args.matchesAt(MatchingContext)
>>
>> This method binds "context values" by dispatching to:
>> abc.weaving.aspectinfo.ArgVar.matchesAt(WeavingEnv, ContextValue)
>>
>> ... which creates a Bind residue.
>>
>> I think that for your pointcut you just need to create the "right"
>> context values in your shadow-match class. For an example, look at:
>> abc.eaj.weaving.matching.ArrayGetShadowMatch.getTargetContextValue()
>>
>> Eric
>>
>> On 18 October 2012 18:28, John Dean <jdean4 at kc.rr.com> wrote:
>>> abc user's group,
>>>
>>> For my Ph.D. dissertation, I am attempting to implement a 
>>> parallelizable loop pointcut. I am using Hossein Sadat-Mohtasham's
>> "transcut"
>>> aspect-oriented compiler as a starting point (thanks, Hossein!), and 
>>> his compiler is built on top of abc. I've implemented the code which 
>>> identifies loops as parallelizable, and my next step is to add an 
>>> args pointcut that will work in conjunction with my new looppar 
>>> pointcut (specifically, my new args pointcut needs to match min, 
>>> max, and stride values for a loop). I've read the article "abc : An 
>>> extensible AspectJ compiler" and I've skimmed abc's Args.java and 
>>> other source code files with "Args" in their names, but I can't find 
>>> anything specific yet that tells me how to add a new args pointcut.
>>>
>>> Does anyone have any suggestions for how I should proceed to add an 
>>> args pointcut that will work in conjunction with my new looppar pointcut?
>>>
>>> Thanks,
>>> John
>>>
>>>
>>>
>>> _______________________________________________
>>> Abc-users mailing list
>>> Abc-users at sable.mcgill.ca
>>> http://mailman.cs.mcgill.ca/mailman/listinfo/abc-users
>>
>>
>>
>> --
>> Eric Bodden, Ph.D., http://sse.ec-spride.de/ http://bodden.de/ Head 
>> of Secure Software Engineering Group at EC SPRIDE
>> Tel: +49 6151 16-75422    Fax: +49 6151 16-72051
>> Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt
>>
>
>
>
> --
> Eric Bodden, Ph.D., http://sse.ec-spride.de/ http://bodden.de/ Head of 
> Secure Software Engineering Group at EC SPRIDE
> Tel: +49 6151 16-75422    Fax: +49 6151 16-72051
> Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt
>



--
Eric Bodden, Ph.D., http://sse.ec-spride.de/ http://bodden.de/ Head of Secure Software Engineering Group at EC SPRIDE
Tel: +49 6151 16-75422    Fax: +49 6151 16-72051
Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 7777 bytes
Desc: not available
Url : http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20121219/ccbbbf8f/attachment.bin 


More information about the Soot-list mailing list