Jeannie: granting java native interface developers their wishes

Higher-level languages interface with lower-level languages such as C to access platform functionality, reuse legacy libraries, or improve performance. This raises the issue of how to best integrate different languages while also reconciling productivity, safety, portability, and efficiency. This paper presents Jeannie, a new language design for integrating Java with C. In Jeannie, both Javaand C code are nested within each other in the same file and compile down to JNI, the Java platform's standard foreign function interface. By combining the two languages' syntax and semantics, Jeannie eliminates verbose boiler-plate code, enables static error detection across the language boundary, and simplifies dynamic resource management. We describe the Jeannie language and its compiler, while also highlighting lessons from composing two mature programming languages.

[1]  Qi Zhang,et al.  Java JNI Bridge: a framework for mixed native ISA execution , 2006, International Symposium on Code Generation and Optimization (CGO'06).

[2]  Eelco Visser,et al.  Declarative, formal, and extensible syntax definition for aspectJ , 2006, OOPSLA '06.

[3]  Simon L. Peyton Jones,et al.  Template meta-programming for Haskell , 2002, Haskell '02.

[4]  Guy L. Steele,et al.  The Java Language Specification , 1996 .

[5]  Wolfram Schulte,et al.  The essence of data access in Cω: the power is in the dot! , 2005 .

[6]  Dean W. Gonzalez,et al.  “=” considered harmful , 1991, ALET.

[7]  M. Petró‐Turza,et al.  The International Organization for Standardization. , 2003 .

[8]  Angela Demke Brown,et al.  Inlining java native calls at runtime , 2005, VEE '05.

[9]  Ralph Johnson,et al.  design patterns elements of reusable object oriented software , 2019 .

[10]  Gavin M. Bierman,et al.  The Essence of Data Access in Comega , 2005, European Conference on Object-Oriented Programming.

[11]  Eric A. Brewer,et al.  ASTEC: a new approach to refactoring C , 2005, ESEC/FSE-13.

[12]  Martín Abadi,et al.  Extensible Syntax with Lexical Scoping , 1994 .

[13]  Joost Visser Visitor combination and traversal control , 2001, OOPSLA '01.

[14]  Eelco Visser,et al.  Syntax definition for language prototyping , 1997 .

[15]  Michael R. Clarkson,et al.  Polyglot: An Extensible Compiler Framework for Java , 2003, CC.

[16]  Sheng Liang,et al.  Java Native Interface: Programmer's Guide and Reference , 1999 .

[17]  Manuel M. T. Chakravarty,et al.  The haskell 98 foreign function interface 1 , 2003 .

[18]  John H. Reppy,et al.  Application-specific foreign-interface generation , 2006, GPCE '06.

[19]  Eelco Visser,et al.  Program Transformation with Scoped Dynamic Rewrite Rules , 2006, Fundam. Informaticae.

[20]  Jonathan Bachrach,et al.  The Java syntactic extender (JSE) , 2001, OOPSLA '01.

[21]  Christian Grothoff Walkabout Revisited: The Runabout , 2003, ECOOP.

[22]  Xin Qi,et al.  J&: nested intersection for scalable software composition , 2006, OOPSLA '06.

[23]  George C. Necula,et al.  CIL: Intermediate Language and Tools for Analysis and Transformation of C Programs , 2002, CC.

[24]  Andrew Shalit,et al.  The Dylan Reference Manual , 1996 .

[25]  Andrew W. Appel,et al.  Safe Java Native Interface , 2006 .

[26]  Eelco Visser,et al.  Disambiguation Filters for Scannerless Generalized LR Parsers , 2002, CC.

[27]  Daniel Weise,et al.  Programmable syntax macros , 1993, PLDI '93.

[28]  Jack C. Wileden,et al.  Automated support for seamless interoperability in polylingual software systems , 1996, SIGSOFT '96.

[29]  Brian Beckman,et al.  LINQ: reconciling object, relations and XML in the .NET framework , 2006, SIGMOD Conference.

[30]  Damien Doligez,et al.  The Objective Caml system release 2.04 , 2002 .

[31]  Amr Sabry,et al.  Macros as multi-stage computations: type-safe, generative, binding macros in MacroML , 2001, ICFP '01.

[32]  BravenboerMartin,et al.  Concrete syntax for objects , 2004 .

[33]  Wilson C. Hsieh,et al.  Maya: multiple-dispatch syntax extension in Java , 2002, PLDI '02.

[34]  Todd D. Millstein,et al.  Practical predicate dispatch , 2004, OOPSLA.

[35]  Marian Bubak,et al.  Creating Java to Native Code Interfaces with Janet , 2001, Sci. Program..

[36]  J. Gregory Morrisett,et al.  Ilea: inter-language analysis across java and c , 2007, OOPSLA.

[37]  Riccardo Pucella,et al.  A framework for interoperability , 2001, Electron. Notes Theor. Comput. Sci..

[38]  Torbjörn Ekman,et al.  The jastadd extensible java compiler , 2007, OOPSLA.

[39]  Robert Grimm,et al.  Making Extensibility of System Software Practical with the C 4 Toolkit , 2006 .

[40]  Lorenz Huelsbergen A Portable C Interface for Standard ML of New Jersey , 1996 .

[41]  James Gosling,et al.  The Java Language Specification, 3rd Edition , 2005 .

[42]  Jeffrey S. Foster,et al.  Polymorphic Type Inference for the JNI , 2006, ESOP.

[43]  George C. Necula,et al.  CCured in the real world , 2003, PLDI '03.

[44]  Robert Grimm,et al.  Better extensibility through modular syntax , 2006, PLDI '06.

[45]  Alan Kaplan,et al.  The Exu approach to safe, transparent and lightweight interoperability , 2001, 25th Annual International Computer Software and Applications Conference. COMPSAC 2001.

[46]  Sheng Liang,et al.  Java Native Interface: Programmer's Guide and Specification , 1999 .

[47]  Matthias Blume No-Longer-Foreign: Teaching an ML compiler to speak C "natively" , 2001, Electron. Notes Theor. Comput. Sci..

[48]  Guy L. Steele,et al.  Java Language Specification, Second Edition: The Java Series , 2000 .

[49]  John R. Rose,et al.  Integrating the Scheme and C languages , 1992, LFP '92.

[50]  Robert Grimm,et al.  Patch (1) Considered Harmful , 2005, HotOS.

[51]  Eelco Visser,et al.  Concrete syntax for objects: domain-specific language embedding and assimilation without restrictions , 2004, OOPSLA '04.

[52]  Vivek Sarkar,et al.  XJ: facilitating XML processing in Java , 2005, WWW '05.

[53]  Xavier Leroy The objective caml system release 3 , 2001 .

[54]  Claus Brabrand,et al.  The metafront System: Extensible Parsing and Transformation , 2003, LDTA@ETAPS.

[55]  Benjamin C. Pierce,et al.  XML Goes Native: Run-Time Representations for Xtatic , 2005, CC.

[56]  Joshua S. Auerbach,et al.  Mockingbird: flexible stub compilation from pairs of declarations , 1999, Proceedings. 19th IEEE International Conference on Distributed Computing Systems (Cat. No.99CB37003).

[57]  David M. Beazley,et al.  SWIG: An Easy to Use Tool for Integrating Scripting Languages with C and C++ , 1996, Tcl/Tk Workshop.