Hi Thomas,
The trouble is that a "block" is very much a source-level concept; blocks 
aren't visible in bytecode at all. It has been a major design goal of AspectJ 
to support weaving of aspects into both source and bytecode on the same 
footing, which explains some of the awkward constructions. The same applies 
to Jimple: Since it must be possible to generate it from both source and 
bytecode, it doesn't have a concept of blocks.
There's been some discussion of pointcuts matching source-level features 
before, e.g. Bruno Harbulot's LoopsAJ 
[http://intranet.cs.man.ac.uk/cnc/projects/loopsaj.php] which tries to 
reconstruct loops by analysing the control flow in the bytecode. It's a bit 
trickier with blocks because they have no effect on the sequence of stack 
instructions that need to be executed.
It seems, then, that the only hope you may have is by modifying Jimple 
generation in the frontend (as Eric suggested), adding certain tags to 
instructions to reflect the associated block structure, and matching on 
those. Of course this will not work if you try to weave into bytecode.
What use did you have in mind for block pointcuts, out of interest?
- P
On Wednesday 16 April 2008 09:18:31 Thomas Pawlitzki wrote:
> Hello again,
>
> i tried a little bit with a new ShadowType and a new ShadowMatch.
>
> But i can not figure out how to implement the
> BlockShadowMatch.matchesAt() method.
>
> I compile the following mini example and log the infos i have for the
> matching test.
>
> Source Code:
> ------------------------------------
> public static void main(String[] args) {
> 		{
> 			int i = 0;
> 			System.out.println("Hello World");
> 		}
>
> 		Test t = new Test();
> 		t.foo();
> 	}
> ------------------------------------
>
> This infos i reveive at the matching test:
> ------------------------------------
> public static void main(java.lang.String[])
>     {
>         java.lang.String[] args;
>         int i;
>         java.io.PrintStream temp$0;
>         aspectjtest.Test t, temp$1;
>
>         args := @parameter0: java.lang.String[];
>         i = 0;
>         temp$0 = <java.lang.System: java.io.PrintStream out>;
>         virtualinvoke temp$0.<java.io.PrintStream: void
> println(java.lang.String)>("Hello World");
>         temp$1 = new aspectjtest.Test;
>         specialinvoke temp$1.<aspectjtest.Test: void <init>()>();
>         t = temp$1;
>         virtualinvoke t.<aspectjtest.Test: void foo()>();
>         return;
>     }
> ------------------------------------
>
> As you can see the blocks are not recognisable any more. So how can i
> decide when a block is entered?
>
> Greetings,
> Thomas
Received on Wed Apr 16 2008 - 14:55:08 BST
This archive was generated by hypermail 2.2.0 : Wed Apr 16 2008 - 20:40:11 BST