Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/2500828.2500849acmconferencesArticle/Chapter ViewAbstractPublication PagespppjConference Proceedingsconference-collections
research-article

Implementing a Java JIT compiler in Haskell: case study

Published: 11 September 2013 Publication History

Abstract

We present a JVM prototype implemented in the purely-functional language Haskell. It exploits several features of the language, such as strong static typing to implement an intermediate representation, and abstraction mechanism to express machine code generation in the manner of a domain specific language.
The compiler consists of (i) a pass to transform Java bytecode to a register-based intermediate representation, (ii) application of an existing data-flow analysis framework to our intermediate representation and (iii) machine code generation that targets the x86 architecture. The implementation follows a compile-only approach. To implement certain Java features efficiently, code patching is used.
Various code samples demonstrate the elegance of our prototype. Results prove reasonable performance compared to real-world implementations.

References

[1]
S. Finne, D. Leijen, E. Meijer, and S. Peyton Jones. Calling Hell from Heaven and Heaven from Hell. In Proceedings of the fourth ACM SIGPLAN international conference on Functional programming, ICFP '99, pages 114--125. ACM, 1999.
[2]
M. Grabmüller and D. Kleeblatt. Harpy: Run-Time Code Generation in Haskell. In Proceedings of the ACM SIGPLAN workshop on Haskell workshop, Haskell '07, pages 94--94. ACM, 2007.
[3]
G. Hutton and E. Meijer. Monadic parsing in Haskell. Journal of functional programming, 8(04):437--444, 1998.
[4]
S. P. Jones, G. Washburn, and S. Weirich. Wobbly Types: Type Inference for Generalised Algebraic Data Types. Technical report, 2004.
[5]
G. Mainland, R. Leshchinskiy, S. Peyton Jones, and S. Marlow. Haskell beats C using generalized stream fusion. In submission, 2013.
[6]
M. Poletto and V. Sarkar. Linear Scan Register Allocation. ACM Transactions on Programming Languages and Systems, 21(5):895--913, 1999.
[7]
N. Ramsey, J. a. Dias, and S. Peyton Jones. Hoopl: A Modular, Reusable Library for Dataflow Analysis and Transformation. In Proceedings of the third ACM Haskell symposium on Haskell, Haskell '10, pages 121--134, New York, NY, USA, 2010. ACM.
[8]
C. Wimmer, M. Haupt, M. L. Van De Vanter, M. Jordan, L. Daynès, and D. Simon. Maxine: An approachable Virtual Machine for, and in, Java. ACM Transactions on Architecture and Code Optimization, 9(4):30, 2013.

Index Terms

  1. Implementing a Java JIT compiler in Haskell: case study

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Conferences
    PPPJ '13: Proceedings of the 2013 International Conference on Principles and Practices of Programming on the Java Platform: Virtual Machines, Languages, and Tools
    September 2013
    188 pages
    ISBN:9781450321112
    DOI:10.1145/2500828
    Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for third-party components of this work must be honored. For all other uses, contact the Owner/Author.

    Sponsors

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 11 September 2013

    Check for updates

    Author Tags

    1. Haskell
    2. Java
    3. code generation
    4. data-flow analysis
    5. intermediate representation
    6. virtual machine

    Qualifiers

    • Research-article

    Conference

    PPPJ '13
    PPPJ '13: virtual machines, languages, and tools
    September 11 - 13, 2013
    Stuttgart, Germany

    Acceptance Rates

    Overall Acceptance Rate 29 of 58 submissions, 50%

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • 0
      Total Citations
    • 139
      Total Downloads
    • Downloads (Last 12 months)3
    • Downloads (Last 6 weeks)1
    Reflects downloads up to 10 Nov 2024

    Other Metrics

    Citations

    View Options

    Get Access

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media