1 / 12

Aspect Oriented Compilation

Aspect Oriented Compilation. James L. Simister Department of Computer Science University of Utah. What Are Objects?. A system’s functional units Patterned after some natural division of labor Interact according to well-defined interfaces Co-locate data with code that acts on that data.

josef
Download Presentation

Aspect Oriented Compilation

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. Aspect Oriented Compilation James L. Simister Department of Computer Science University of Utah

  2. What Are Objects? • A system’s functional units • Patterned after some natural division of labor • Interact according to well-defined interfaces • Co-locate data with code that acts on that data

  3. What’s Wrong with Objects? • What about functionality that inherently belongs to several components, and cannot be contained by a single object? • Architecture of program vs. architecture of task • Examples: • Debugging/tracing • Communication • Synchronization

  4. What Are Aspects? • A system’s units that cross-cut other (multiple) components • Patterned after some natural division of labor • Interact according to well-defined interfaces • Co-locate data with code that acts on that data, even though the functionality may be distributed between many other system components

  5. Aspect Example - Part I /** * The HelloWorld class implements an application that * simply displays "Hello World!" on the standard output. */ class HelloWorld { public static void main(String[] args) { System.out.println("Hello world!"); } }

  6. Aspect Example - Part II /** * The Trace aspect injects tracing messages before and after * method main of class HelloWorld. */ aspect Trace { static advice void main(String[] args) & HelloWorld { before { System.out.println("*** Entering HelloWorld.main ***"); } after { System.out.println("*** Exiting HelloWorld.main ***"); } } }

  7. Aspect Example - Output *** Entering HelloWorld.main *** Hello World! *** Exiting HelloWorld.main ***

  8. Proposal • Design and implement a compiler for an Aspect-Oriented Language • Investigate the advantages of an aspect compiler vs. an aspect preprocessor • Investigate challenges of optimization in Aspect-Oriented Compilation

  9. The Compiler • Input: • Toy OO Language • Somewhat patterned after AspectJ • Translation • Weave aspects into base code • Output: • Sparc Assembly

  10. Compiler Vs. Pre-Processor • What limits are placed on aspects when using a pre-processor? • What limits are placed on aspects when using a compiler? • What useful aspects need access to compiler knowledge or analysis, rather than just syntax? • Can aspects be more powerful or useful as first-class data structures? If so, how?

  11. Optimization • Techniques: • Register Allocation • Redundant/Unreachable Code Elimination • Common Subexpression Elimination • How do aspects make optimization harder? • How do aspects make optimization easier?

  12. Project Summary • Implement a compiler for a simple language with objects and aspects • Research methods of declaring and implementing aspects • Observe benefits/challenges affecting optimization with regards to aspects

More Related