1 / 10

Introducing ABC: Programming Languages and AOP

Oege de Moor Programming Tools Group University of Oxford joint work with Ganesh Sittampalam, Sascha Kuzins, Chris Allan, Pavel Avgustinov, Julian Tibble, Damien Sereni (Oxford)

zhen
Download Presentation

Introducing ABC: Programming Languages and AOP

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Oege de Moor Programming Tools Group University of Oxford joint work with Ganesh Sittampalam, Sascha Kuzins, Chris Allan, Pavel Avgustinov, Julian Tibble, Damien Sereni (Oxford) Laurie Hendren, Jennifer Lhoták, Ondřej Lhoták, Bruno Dufour, Christopher Goard, Clark Verbrugge (McGill) Aske Simon Christensen (Århus) Introducing ABC:Programming Languages and AOP

  2. Roadmap • Novel features • The fun has just begun • Performance • It may become cheap • ABC: the AspectBench Compiler • Extensible: Polyglot • Analysis & optimisation: Soot

  3. a e b f d c h g Tracecuts joinpoint tree before a, before b, before c, after c, before d, after d, after b, before e, before f, before g, after g, before h, after h, after f, after e, after a

  4. Observer as tracecut aspectobserver { tracecutupdate(Subjects, Observero): // declaration of events of interest: create_observer: after returning(o) call(Observer.new(..)) && args(s) update_subject: after call(* Subject.update(..)) && target(s); // regular expression pattern to match against suffixes of traces: create_observer update_subject+ // advice to execute (once for each (s,o) binding) { o.update_view(); } }

  5. Performance

  6. Polyglot Java compiler Java extracts of source AspectJ extension Jimple Soot analysis and transformation framework aspectInfo intertype adjuster advice weaver The AspectBench Compiler AspectJ source, and jars analyse & optimise class files

  7. Polyglot: scope for intertype decls public class A { int x; class B { int x; } } aspect Aspect { static int x; static int y; int A.B.foo() { class C { int x = 3; int bar() {return x + A.this.x;} } return (new C()).bar() + x + y; } } need to disambiguate: when do we refer to host? • no explicit receiver? if it was introduced into environment by the host, give it “this” from host. • explicit “this” or “super”? if there is no qualifier and we're not inside a local class, it refers to the host. If there is a qualifier Q, it refers to the host if the host has an enclosing instance of type Q. implementation: • extend environment type • new AST nodes “hostSpecial” (this/super) • ITDs add accessible members from host • rewrite rules to disambiguate this/super to “Special” or “hostSpecial”

  8. Jimple publicstatic int Aspect$foo$1(A$B) { A$B this$2; Aspect$1C $r0; int $i0, $i1, $i2, $i3, $i4; this$2 := @parameter0: A$B; $r0 = new Aspect$1C; specialinvoke $r0.<Aspect$1C: void <init>(A$B)>(this$2); $i0 = virtualinvoke $r0.<Aspect$1C: int bar()>(); $i1 = this$2.<A$B: int x>; $i2 = $i0 + $i1; $i3 = <Aspect: int y>; $i4 = $i2 + $i3; return $i4; } • 3-address intermediate form • proven basis for static analysis • easy to weave into

  9. ABC performance

  10. ABC Summary • A second compiler helps language research • precise language description • Whole-program, aimed at • extensibility, • static analysis • performance of compiled code • Suite of tools: decompiler, performance measurement, visualisation in Eclipse • Small, easy to learn: < 500 classes, 45 KLOC • Current status: • pass majority of ajc tests • likely release mid-October

More Related