skip to main content
10.1145/1449764.1449772acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article

Mixing source and bytecode: a case for compilation by normalization

Published:19 October 2008Publication History

ABSTRACT

Language extensions increase programmer productivity by providing concise, often domain-specific syntax, and support for static verification of correctness, security, and style constraints. Language extensions can often be realized through translation to the base language, supported by preprocessors and extensible compilers. However, various kinds of extensions require further adaptation of a base compiler's internal stages and components, for example to support separate compilation or to make use of low-level primitives of the platform (e.g., jump instructions or unbalanced synchronization). To allow for a more loosely coupled approach, we propose an open compiler model based on normalization steps from a high-level language to a subset of it, the core language. We developed such a compiler for a mixed Java and (core) bytecode language, and evaluate its effectiveness for composition mechanisms such as traits, as well as statement-level and expression-level language extensions.

References

  1. A. V. Aho, M. S. Lam, R. Sethi, and J. D. Ullman. Compilers: Principles, Techniques, and Tools (2nd Edition). Addison Wesley, August 2006. Google ScholarGoogle Scholar
  2. P. Avgustinov, A. S. Christensen, L. Hendren, S. Kuzins, J. Lhoták, O. Lhoták, O. de Moor, D. Sereni, G. Sittampalam, and J. Tibble. abc: an extensible AspectJ compiler. In Aspect-oriented software development (AOSD'05), pages 87--98, New York, NY, USA, 2005. ACM. Google ScholarGoogle Scholar
  3. J. Bachrach and K. Playford. The Java syntactic extender (JSE). In Proceedings of the 16th ACM SIGPLAN conference on Object oriented programming, systems, languages, and applications (OOPSLA'01), volume 36 of ACM SIGPLAN Notices, pages 31--42, New York, NY, USA, 2001. ACM. Google ScholarGoogle Scholar
  4. M. G. J. van den Brand, J. Scheerder, J. Vinju, and E. Visser. Disambiguation filters for scannerless generalized LR parsers. In N. Horspool, editor, Compiler Construction (CC 2002), volume 2304 of Lecture Notes in Computer Science, pages 143--158, Grenoble, France, April 2002. Springer-Verlag. Google ScholarGoogle Scholar
  5. M. Bravenboer, E. Dolstra, and E. Visser. Preventing injection attacks with syntax embeddings. A host and guest language independent approach. In J. Lawall, editor, Generative Programming and Component Engineering (GPCE 2007), pages 3--12, New York, NY, USA, October 2007. ACM. Google ScholarGoogle Scholar
  6. M. Bravenboer, K. T. Kalleberg, R. Vermaas, and E. Visser. Stratego/XT 0.17. A language and toolset for program transformation. Science of Computer Programming, 72(1-2):52--70, June 2008. Special issue on experimental software and toolkits. Google ScholarGoogle Scholar
  7. M. Bravenboer and E. Visser. Concrete syntax for objects. Domain-specific language embedding and assimilation without restrictions. In D. C. Schmidt, editor, Proceedings of the 19th ACM SIGPLAN Conference on Object-Oriented Programing, Systems, Languages, and Applications (OOPSLA'04), pages 365--383, Vancouver, Canada, October 2004. ACM Press. Google ScholarGoogle Scholar
  8. C. Clifton. MultiJava: Design, implementation, and evaluation of a Java-compatible language supporting modular open classes and symmetric multiple dispatch. Technical Report 01-10, Department of Computer Science, Iowa State University, Nov. 2001.Google ScholarGoogle Scholar
  9. C. Clifton, T. Millstein, G. T. Leavens, and C. Chambers. Multijava: Design rationale, compiler implementation, and applications. ACM Transactions on Programming Languages and Systems (TOPLAS), 28(3):517--575, 2006. Google ScholarGoogle Scholar
  10. J. Danaher, I. Angelina Lee, and C. Leiserson. Programming with exceptions in JCilk. Science of Computer Programming, 63(2):147--171, 2006. Google ScholarGoogle Scholar
  11. A. B. Dov. infomancers-collections. http://code.google.com/p/infomancers-collections/Google ScholarGoogle Scholar
  12. S. Ducasse, O. Nierstrasz, N. Schärli, R. Wuyts, and A. Black. Traits: A mechanism for fine-grained reuse. ACM Transactions on Programming Languages and Systems (TOPLAS), 28(2):331--388, 2006. Google ScholarGoogle Scholar
  13. T. Ekman and G. Hedin. The JastAdd extensible Java compiler. In Proceedings of the 22nd ACM SIGPLAN conference on Object-oriented programming systems and applications (OOPSLA'07), pages 1--18, New York, NY, USA, 2007. ACM. Google ScholarGoogle Scholar
  14. J. Gosling, B. Joy, G. Steele, and G. Bracha. The Java Language Specification. Prentice Hall PTR, Boston, Mass., third edition, 2005. Google ScholarGoogle Scholar
  15. J. C. Hardwick and J. Sipelstein. Java as an intermediate language. Technical Report CMU-CS-96-161, School of Computer Science, Carnegie Mellon University, August 1996.Google ScholarGoogle Scholar
  16. Z. Hemel, L. C. L. Kats, and E. Visser. Code generation by model transformation. A case study in transformation modularity. In J. Gray, A. Pierantonio, and A. Vallecillo, editors, Proceedings of the International Conference on Model Transformation (ICMT 2008), volume 5063 of Lecture Notes in Computer Science, pages 183--198. Springer, June 2008. Google ScholarGoogle Scholar
  17. M. Hirzel and R. Grimm. Jeannie: granting Java Native Interface developers their wishes. In R. P. Gabriel, D. F. Bacon, C. V. Lopes, and G. L. S. Jr., editors, Object-Oriented Programming, Systems, Languages, and Applications, (OOPSLA'07), pages 19--38. ACM, 2007. Google ScholarGoogle Scholar
  18. J. B. Kam and J. D. Ullman. Monotone data flow analysis frameworks. Acta Inf., 7:305--317, 1977.Google ScholarGoogle Scholar
  19. L. C. L. Kats. java-csharp: C#-inspired language extensions for Java. http://strategoxt.org/Stratego/JavaCSharp/.Google ScholarGoogle Scholar
  20. G. Kiczales, J. Lamping, A. Menhdhekar, C. Maeda, C. Lopes, J.-M. Loingtier, and J. Irwin. Aspect-oriented programming. In M. Aks¸it and S. Matsuoka, editors, Proceedings of the European Conference on Object-Oriented Programming (ECOOP'07), volume 1241 of Lecture Notes in Computer Science, pages 220--242. Springer, 1997.Google ScholarGoogle Scholar
  21. S. Liang. Java Native Interface: Programmer's Guide and Reference. Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA, 1999. Google ScholarGoogle Scholar
  22. T. Lindholm and F. Yellin. The Java Virtual Machine Specification. Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA, second edition, 1999. Google ScholarGoogle Scholar
  23. F. Logozzo and M. Fähndrich. On the relative completeness of bytecode analysis versus source code analysis. In L. Hendren, editor, Compiler Construction (CC'08), volume 4959 of Lecture Notes in Computer Science, pages 192--212. Springer, 2008. Google ScholarGoogle Scholar
  24. J. Melton and A. Eisenberg. Understanding SQL and Java Together: A Guide to SQLJ, JDBC, and Related Technologies. Morgan Kaufmann, 2000. Google ScholarGoogle Scholar
  25. J. Meyer and T. Downing. Java Virtual Machine. O'Reilly & Associates, Inc., Sebastopol, CA, USA, 1997. Google ScholarGoogle Scholar
  26. J. Miecznikowski and L. Hendren. Decompiling Java using staged encapsulation. Workshop on Decompilation Techniques, appeared in Proceedings of the Working Conference on Reverse Engineering (WCRE'01), pages 368--374, 2001. Google ScholarGoogle Scholar
  27. S. Murer, S. Omohundro, D. Stoutamire, and C. Szyperski. Iteration abstraction in Sather. ACM Transactions on Programming Languages and Systems (TOPLAS), 18(1):1--15, 1996. Google ScholarGoogle Scholar
  28. N. Nystrom, M. Clarkson, and A. Myers. Polyglot: An Extensible Compiler Framework for Java. Compiler Construction (CC'03), 2622:138--152, Apr. 2003. Google ScholarGoogle Scholar
  29. M. Odersky and al. An overview of the Scala programming language. Technical Report IC/2004/64, EPFL Lausanne, Switzerland, 2004.Google ScholarGoogle Scholar
  30. S. Pedroni and N. Rappin. Jython Essentials. O'Reilly Media, Inc., 2002.Google ScholarGoogle Scholar
  31. S. L. Peyton Jones and A. L. M. Santos. A transformation-based optimiser for Haskell. Science of Computer Programming, 32(1-3):3--47, September 1998. Google ScholarGoogle Scholar
  32. K. Seymour and J. Dongarra. Automatic translation of Fortran to JVM bytecode. In Joint ACM Java Grande -- ISCOPE 2001 Conference, Stanford University, California, June 2-4, 2001, New York, NY 10036, USA, 2001. ACM. Google ScholarGoogle Scholar
  33. Y. Smaragdakis and D. Batory. Mixin layers: an object-oriented implementation technique for refinements and collaboration-based designs. ACM Transactions on Software Engineering and Methodology (TOSEM), 11(2):215--255, 2002. Google ScholarGoogle Scholar
  34. G. Steele. Growing a language. Higher-Order and Symbolic Compututation, 12(3):221--236, October 1999. Google ScholarGoogle Scholar
  35. Sun Microsystems. The annotation processing tool (apt). http://java.sun.com/j2se/1.5.0/docs/guide/apt.Google ScholarGoogle Scholar
  36. M. Tatsubori, S. Chiba, K. Itano, and M.-O. Killijian. OpenJava: A class-based macro system for Java. In W. Cazzola, R. J. Stroud, and F. Tisato, editors, First OOPSLA Workshop on Reflection and Software Engineering (OORaSE'99), volume 1826 of Lecture Notes in Computer Science, pages 117--133. Springer, Nov. 1999. Google ScholarGoogle Scholar
  37. The XDoclet team. XDoclet: attribute-oriented programming. http://xdoclet.sourceforge.net/Google ScholarGoogle Scholar
  38. A. Tolmach. An external representation for the GHC core language. http://haskell.org/ghc/docs/papers/core.ps.gz, September 2001.Google ScholarGoogle Scholar
  39. R. Vallée-Rai, P. Co, E. Gagnon, L. Hendren, P. Lam, and V. Sundaresan. Soot - a Java bytecode optimization framework. In CASCON '99: Proceedings of the 1999 conference of the Centre for Advanced Studies on Collaborative research, page 13. IBM, 1999. Google ScholarGoogle Scholar
  40. A. van Deursen, P. Klint, and F. Tip. Origin tracking. Journal of Symbolic Computation, 15(5/6):523--545, 1993. Google ScholarGoogle Scholar
  41. E. VanWyk, O. de Moor, K. Backhouse, and P. Kwiatkowski. Forwarding in attribute grammars for modular language design. In R. N. Horspool, editor, Proceedings of the 11th International Conference on Compiler Construction (CC'02), volume 2304 of Lecture Notes on Computer Science, pages 128--142, London, UK, 2002. Springer-Verlag. Google ScholarGoogle Scholar
  42. E. Van Wyk, L. Krishnan, A. Schwerdfeger, and D. Bodin. Attribute grammar-based language extensions for Java. In E. Ernst, editor, European Conference on Object Oriented Programming (ECOOP'07), volume 4609 of Lecture Notes on Computer Science, pages 575--599. Springer Verslag, July 2007. Google ScholarGoogle Scholar
  43. E. Visser. Meta-programming with concrete object syntax. In D. Batory, C. Consel, and W. Taha, editors, Generative Programming and Component Engineering (GPCE 2002), volume 2487 of Lecture Notes in Computer Science, pages 299--315, Pittsburgh, PA, USA, October 2002. Springer-Verlag. Google ScholarGoogle Scholar
  44. J. Warmer and A. Kleppe. Building a flexible software factory using partial domain specific models. In J. Gray, J.-P. Tolvanen, and J. Sprinkle, editors, Proceedings of the 6th OOPSLA Workshop on Domain-Specific Modeling (DSM 2006), volume TR-37 of Computer Science and Information System Reports, pages 15-22, Finland, October 2006. University of Jyväskylä.Google ScholarGoogle Scholar

Index Terms

  1. Mixing source and bytecode: a case for compilation by normalization

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader