Re: [abc-users] return stmt

From: Amjad Nusayr <anusayr_at_cs.nmsu.edu>
Date: Mon, 04 Aug 2008 13:48:20 -0600

Eric,
The example I was running is on old example I had on my PC I downloaded
more than a year ago, when I first started testing with ajc, and abc. I
just saw it and decided to see if everything is fine on abc.

the files are attached if you wan to give it a try.

Amjad

Eric Bodden wrote:
>> Any clues??
>>
> Not really.
>
> It would help to have the body printed at that point. Can you insert...
>
> System.err.println(b);
>
> ... right before the line where the exception is thrown? (line 268)
>
> Eric
>
> 2008/8/3 Amjad Nusayr <anusayr_at_cs.nmsu.edu>:
>
>> Hi
>> I was missing around with AOP using plain abc; without any extensions and I
>> got an exception with I tried to compile my files, I used "abc -debug
>> doValidate -argfile files.lst" and got this...
>>
>> Exception in thread "main" polyglot.util.InternalCompilerError: unhandled
>> except
>> ving/optimisation
>> at abc.main.CompileSequence.runSequence(CompileSequence.java:142)
>> at abc.main.Main.run(Main.java:406)
>> at abc.main.Main.main(Main.java:144)
>> Caused by: polyglot.util.InternalCompilerError: Last stmt should be
>> ReturnStmt o
>> mt
>> at abc.soot.util.Restructure.restructureReturn(Restructure.java:268)
>> at
>> abc.weaving.weaver.ShadowPointsSetter.restructureBody(ShadowPointsSet
>> at
>> abc.weaving.weaver.ShadowPointsSetter.insertExecutionSP(ShadowPointsS
>> )
>> at
>> abc.weaving.weaver.ShadowPointsSetter.setShadowPointsPass1(ShadowPoin
>> 105)
>> at
>> abc.bbs.weaving.weaver.ShadowPointsSetter.setShadowPointsPass1(Shadow
>> ava:61)
>> at abc.bbs.weaving.weaver.Weaver.inlineConstructors(Weaver.java:43)
>> at abc.weaving.weaver.Weaver.weave(Weaver.java:185)
>> at abc.main.CompileSequence.weave(CompileSequence.java:496)
>> at abc.main.CompileSequence.runSequence(CompileSequence.java:115)
>> ... 2 more
>>
>>
>> Any clues??
>>
>> Amjad
>>
>>
>>
>
>
>
>

// trace stuff dealing with Foo
aspect Trace_v1 {
  pointcut methodCall() : call(* Foo.*(..)); // doesn't include constructors
  pointcut constructorCall() : call(Foo.new(..));

  pointcut methodExecution() : execution(* Foo.*(..)); // again, no ctors
  pointcut constructorExecution() : execution(Foo.new(..));

  pointcut fieldGet() : get(* Foo.*);
  pointcut fieldSet() : set(* Foo.*);

  pointcut objectInitialization() : initialization(Foo.new(..));
  pointcut classInitialization() : staticinitialization(Foo);

  pointcut exceptionHandler() : handler(Foo);

  before() : methodCall() {
    System.out.println("A method call to Foo is about to occur");
  }
  before() : constructorCall() {
    System.out.println("A constructor call to Foo is about to occur");
  }
  before() : methodExecution() {
    System.out.println("A method execution in Foo is about to occur");
  }
  before() : constructorExecution() {
    System.out.println("A constructor execution in Foo is about to occur");
  }
  before() : fieldGet() {
    System.out.println("Someone is about to get a field from Foo");
  }
  before() : fieldSet() {
    System.out.println("Someone is about to set a field in Foo");
  }
  before() : objectInitialization() {
    System.out.println("Foo is about to undergo instance initialization");
  }
  before() : classInitialization() {
    System.out.println("Foo is about to undergo class initialization");
  }
  before() : exceptionHandler() {
    System.out.println("A exception of type Foo is about to be handled");
  }

  after() : methodCall() {
    System.out.println("A method call to Foo just occurred");
  }
  after() : constructorCall() {
    System.out.println("A constructor call to Foo just occurred");
  }
  after() : methodExecution() {
    System.out.println("A method execution in Foo just occurred");
  }
  after() : constructorExecution() {
    System.out.println("A constructor execution in Foo just occurred");
  }
  after() : fieldGet() {
    System.out.println("Someone just got a field from Foo");
  }
  after() : fieldSet() {
    System.out.println("Someone just set a field in Foo");
  }
  after() : objectInitialization() {
    System.out.println("Foo has just undergone instance initialization");
  }
  after() : classInitialization() {
    System.out.println("Foo has just undergone class initialization");
  }
  after() : exceptionHandler() {
    System.out.println("A exception of type Foo has just been handled");
  }
}

public class Foo extends RuntimeException {
  int i;

  public static void main(String[] args) {
    System.out.println("== At top of main()");

    System.out.println("== constructing an object");
    Foo f = new Foo();

    System.out.println("== calling method helloWorld()");
    f.helloWorld();

    System.out.println("== getting a field...");
    int twice = 2 * f.i;

    System.out.println("== setting a field...");
    f.i = twice;

    System.out.println("== calling method exceptionThrower()");
    try {
      f.exceptionThrower();
    } catch(Foo fooException) {
      System.out.println("== caught an exception");
    }

    System.out.println("== At end of main()");
  }

  void helloWorld() {
    System.out.println("Hello world!");
  }

  void exceptionThrower() {
    throw this;
  }
}
Received on Mon Aug 04 2008 - 20:48:29 BST

This archive was generated by hypermail 2.2.0 : Mon Aug 04 2008 - 21:20:12 BST