0
Using Aspects for
    Language
   Portability

  Lennart Kats   Eelco Visser
DSLs
Stratego
SDF
Spoofax
DSL compilers
      (code generators)

DSL        Generator
Backend targets the
           platform

DSL     Frontend   Backend
Backend targets the
           platforms

DSL     Frontend   Backend


                   Backend


                   Bac...
“So switching to another
 platform is just a little
 matter of switching the
    backend, right?”
          (wrong)
Why not?

• platform-exclusive libraries
• platform escapes and native calls
• interoperability and integration with
  pla...
Then what?

Use aspect weaving to address portability
    issues in programs and libraries!
Our case study


              Frontend   Backend   C/POSIX
Stratego/XT
Our case study


              Frontend   Backend   C/POSIX
Stratego/XT


                         Backend
Why Java?




            (spoofax.org)
Architecture

Frontend



Backend
Architecture

Frontend     Standard libs



Backend       Programs
Architecture

Frontend     Standard libs    Primitives



Backend       Programs       Platform libs
Architecture

Frontend     Standard libs    Primitives



Backend       Programs       Platform libs
Architecture

Frontend     Standard libs           Primitives



Backend       Programs              Platform libs



    ...
1. Glue code aspects

Override functions and library invocations
to work with platform-specific libraries
•   SGLR vs. JSGL...
2. Migration aspects

Because we cannot solve all portability
problems (right away)
•   There may be no alternative for a ...
2. Migration aspects


Warn developers about unportable code


Perform “next best” operation
3. Integration aspects

Enhance platform integration:

• error handling (exceptions, console vs. GUI)
• logging
• hooks
• ...
4. Optimization aspects
Address platform performance issues of...


...expensive operations
...common operations (bottlene...
Summary

Many additional portability issues

• replacing the backend is not enough!

AOP elegantly addresses them

• four ...
Using Aspects for Language Portability (SCAM 2010)
Upcoming SlideShare
Loading in...5
×

Using Aspects for Language Portability (SCAM 2010)

653

Published on

Software platforms such as the Java Virtual Machine or the CLR .NET virtual machine have their own ecosystem of a core programming language or instruction set, libraries, and developer community. Programming languages can target multiple software platforms to increase interoperability or to boost performance. Introducing a new compiler backend for a language is the first step towards targeting a new platform, translating the language to the platform\'s language or instruction set. Programs written in modern languages generally make extensive use of APIs, based on the runtime system of the software platform, introducing additional portability concerns. They may use APIs that are implemented by platform-specific libraries. Libraries may perform platform-specific operations, make direct native calls, or make assumptions about performance characteristics of operations or about the file system. This paper proposes to use aspect weaving to invasively adapt programs and libraries to address such portability concerns, and identifies four classes of aspects for this purpose. We evaluate this approach through a case study where we retarget the Stratego program transformation language towards the Java Virtual Machine.

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
653
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide


  • DSLs and other high-level languages
    target SOFTWARE PLATFORM instead

  • (no javascript logo google found me this one instead)
  • want to have the same programs and the same libraries run on the new platform


  • To show you how we can do that we did a case study
    our SCAM language
  • To show you how we can do that we did a case study
    our SCAM language
  • To show you how we can do that we did a case study
    our SCAM language
  • To show you how we can do that we did a case study
    our SCAM language
  • To show you how we can do that we did a case study
    our SCAM language
  • Running Stratego on Java was kind of a big deal for us

    Other advantages: performance, developer community










  • “hides differences among platforms”
  • pp-java
  • pp-java



  • Transcript of "Using Aspects for Language Portability (SCAM 2010)"

    1. 1. Using Aspects for Language Portability Lennart Kats Eelco Visser
    2. 2. DSLs Stratego SDF Spoofax
    3. 3. DSL compilers (code generators) DSL Generator
    4. 4. Backend targets the platform DSL Frontend Backend
    5. 5. Backend targets the platforms DSL Frontend Backend Backend Backend
    6. 6. “So switching to another platform is just a little matter of switching the backend, right?” (wrong)
    7. 7. Why not? • platform-exclusive libraries • platform escapes and native calls • interoperability and integration with platform applications • performance and stack behavior
    8. 8. Then what? Use aspect weaving to address portability issues in programs and libraries!
    9. 9. Our case study Frontend Backend C/POSIX Stratego/XT
    10. 10. Our case study Frontend Backend C/POSIX Stratego/XT Backend
    11. 11. Why Java? (spoofax.org)
    12. 12. Architecture Frontend Backend
    13. 13. Architecture Frontend Standard libs Backend Programs
    14. 14. Architecture Frontend Standard libs Primitives Backend Programs Platform libs
    15. 15. Architecture Frontend Standard libs Primitives Backend Programs Platform libs
    16. 16. Architecture Frontend Standard libs Primitives Backend Programs Platform libs Portability aspects
    17. 17. 1. Glue code aspects Override functions and library invocations to work with platform-specific libraries • SGLR vs. JSGLR • ORM • communication • etc.
    18. 18. 2. Migration aspects Because we cannot solve all portability problems (right away) • There may be no alternative for a library • Primitives may make assumptions about the platform (e.g., POSIX vs. Java)
    19. 19. 2. Migration aspects Warn developers about unportable code Perform “next best” operation
    20. 20. 3. Integration aspects Enhance platform integration: • error handling (exceptions, console vs. GUI) • logging • hooks • user interaction (console vs. GUI vs. web)
    21. 21. 4. Optimization aspects Address platform performance issues of... ...expensive operations ...common operations (bottlenecks) by using platform-specific code or by using code more suited for the platform
    22. 22. Summary Many additional portability issues • replacing the backend is not enough! AOP elegantly addresses them • four classes of portability aspects • encapsulate platform concerns in separate libraries
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×