ABSTRACT
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.
- R. Anisko, V. David, and C. Vasseur. Transformers: a C++ program transformation framework. Tech. Report 0310, Laboratoire de Recherche et D& 233;veloppement de l'Epita, Le Kremlin-Bicêtre cedex, France, May 2004.Google Scholar
- J. Auerbach, C. Barton, MChu-Carroll, and M. Raghavachari. Flexible stub compilation from pairs of declarations. In Proc. 19th IEEE International Conference on Distributed Computing Systems, pp. 393--402, May 1999. Google Scholar
Digital Library
- J. Bachrach and K. Playford. The Java syntactic extender (JSE). In Proc. 2001 ACM Conference on Object-Oriented Programming Systems, Languages, and Applications, pp. 31--42, Oct. 2001. Google Scholar
Digital Library
- J. Baker and W. C. Hsieh. Maya: Multiple-dispatch syntax extension in Java. In Proc. 2002 ACM Conference on Programming Language Design and Implementation, pp. 270--281, June 2002. Google Scholar
Digital Library
- S. S. Bakken, A. Aulbach, E. Schmid, J. Winstead, L. T. Wilson, R. Lefdorf, A. Zmievski, and J. Ahto. PHP Manual. PHP Documentation Group, Feb. 2004. http://www.php.net/manual/.Google Scholar
- D. J. Barrett, A. Kaplan, and J. C. Wileden. Automated support for seamless interoperability in polylingual software systems. In Proc. 4th ACM SIGSOFT Symposium on Foundations of Software Engineering, pp. 147--155, Oct. 1996. Google Scholar
Digital Library
- D. M. Beazley. SWIG: An easy to use tool for integrating scripting languages with C and C++. In Proc. 4th USENIX Tcl/Tk Workshop, July 1996. Google Scholar
Digital Library
- G. Bierman, E. Meijer, and W. Schulte. The essence of data access in CΩ. In Proc. 19th European Conference on Object-Oriented Programming, vol. 3586 of LNCS, pp. 287--311, July 2005. Google Scholar
Digital Library
- J. Blosser. Java tip 98: Reflect on the visitor design pattern. JavaWorld, July 2000. http://www.javaworld.com/javaworld/javatips/jw-javatip98.html.Google Scholar
- M. Blume. No-longer foreign: Teaching an ML compiler to speak C ``natively''. Electronic Notes in Theoretical Computer Science, 59(1):36--52, Sept. 2001.Google Scholar
Cross Ref
- C. Brabrand, M. I. Schwartzbach, and M. Vanggaard. The metafront system: Extensible parsing and transformation. Electronic Notes in Theoretical Computer Science, 82(3):592--611, Dec. 2003.Google Scholar
Cross Ref
- M. Bravenboer, ÉTanter, and E. Visser. Declarative, formal, and extensible syntax definition for AspectJ. In Proc. 2006 ACM Conference on Object Oriented Programming Systems, Languages, and Applications, pp. 209--228, Oct. 2006. Google Scholar
Digital Library
- M. Bravenboer, Avan Dam, K. Olmos, and E. Visser. Program transformation with scoped dynamic rewrite rules. Fundamenta Informaticae, 69(1--2):123--178, 2005. Google Scholar
Digital Library
- M. Bravenboer and E. Visser. Concrete syntax for objects. In Proc. 2004 ACM Conference on Object-Oriented Programming Systems, Languages, and Applications, pp. 365--383, Oct. 2004. Google Scholar
Digital Library
- M. Bubak, D. Kurzyniec, and P. Luszczek. Creating Java to native code interfaces with Janet extension. In Proc. SGI Users's Conference, pp. 283--294, Oct. 2000.Google Scholar
- L. Cardelli, F. Matthes, and M. Abadi. Extensible syntax with lexical scoping. Tech. Report 121, Digital Equipment, Systems Research Center, Feb. 1994.Google Scholar
- M. Chakravarty, S. Finne, F. Henderson, M. Kowalczyk, D. Leijen, S. Marlow, E. Meijer, S. Panne, S. P. Jones, A. Reid, M. Wallace, and M. Weber. The Haskell 98 foreign function interface 1.0. http://www.cse.unsw.edu.au/~chak/haskell/ffi/, 2003.Google Scholar
- M. Chen, S. Goldenberg, S. Srinivas, V. Ushakov, Y. Wang, Q. Zhang, E. Lin, and Y. Zach. Java JNI bridge: A framework for mixed native ISA execution. In Proc. International IEEE Symposium on Code Generation and Optimization, pp. 65--75, Mar. 2006. Google Scholar
Digital Library
- J. Condit, M. Harren, S. McPeak, G. C. Necula, and W. Weimer. CCured in the real world. In Proc. 2003 ACM Conference on Programming Language Design and Implementation, pp. 232--244, June 2003. Google Scholar
Digital Library
- T. Ekman and G. Hedin. The JastAdd extensible Java compiler. In Proc. 2007 ACM Conference on Object-Oriented Programming Systems, Languages, and Applications, Oct. 2007. Google Scholar
Digital Library
- K. Fisher, R. Pucella, and J. Reppy. A framework for interoperability. Electronic Notes in Theoretical Computer Science, 59(1):3--19, Sept. 2001.Google Scholar
Cross Ref
- M. E. Fiuczynski, R. Grimm, Y. Coady, and D. Walker. patch (1) considered harmful. In Proc. 10th Workshop on Hot Topics in Operating Systems, pp. 91--96, June 2005. Google Scholar
Digital Library
- M. Furr and J. S. Foster. Polymorphic type inference for the JNI. In Proc. 15th European Symposium on Programming, pp. 309--324, Mar. 2006. Google Scholar
Digital Library
- E. Gamma, R. Helm, R. Johnson, and J. Vlissides. Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, Jan. 1995. Google Scholar
Digital Library
- S. E. Ganz, A. Sabry, and W. Taha. Macros as multi-stage computations: Type-safe, generative, binding macros in MacroML. In Proc. 2001 ACM International Conference on Functional Programming, pp. 74--85, Sept. 2001. Google Scholar
Digital Library
- V. Gapeyev, M. Y. Levin, B. C. Pierce, and A. Schmitt. XML goes native: Run-time representations for xtatic. In Proc. 14th International Conference on Compiler Construction, vol. 3443 of LNCS, pp. 43--58, Apr. 2005. Google Scholar
Digital Library
- J. Gosling, B. Joy, G. Steele, and G. Bracha. The Java Language Specification. Addison-Wesley, second edition, June 2000. Google Scholar
Digital Library
- R. Grimm. xtc (eXTensible C). http://cs.nyu.edu/rgrimm/xtc/.Google Scholar
- R. Grimm. Better extensibility through modular syntax. In Proc. 2006 ACM Conference on Programming Language Design and Implementation, pp. 38--51, June 2006. Google Scholar
Digital Library
- C. Grothoff. Walkabout revisited: The runabout. In Proc. 17th European Conference on Object-Oriented Programming, vol. 2743 of LNCS, pp. 101--125, July 2003.Google Scholar
- M. Harren, M. Raghavachari, O. Shmueli, M. G. Burke, R. Bordawekar, I. Pechtchanski, and V. Sarkar. Facilitating XML processing in Java. In Proc. 14th International World Wide Web Conference, pp. 278--287, May 2005. Google Scholar
Digital Library
- G. Hedin. The JastAdd extensible Java compiler. http://jastadd.cs.lth.se/web/extjava/index.shtml.Google Scholar
- L. Huelsbergen. A portable C interface for Standard ML of New Jersey. Tech. report, AT&T Bell Laboratories, Jan. 1996. http://www.smlnj.org/doc/SMLNJ--C/smlnj-c.ps.Google Scholar
- International Organization for Standardization. Information Technology--Programming Languages-C. ISO/IEC Standard 9899:TC2, May 2005.Google Scholar
- A. Kaplan, J. Bubba, and J. C. Wileden. The Exu approach to safe, transparent and lightweight interoperability. In Proc. 25th IEEE Computer Software and Applications Conference, pp. 393--400, Oct. 2001. Google Scholar
Digital Library
- D. Kurzyniec. Creating Java to native code interfaces with Janet extension. Master's thesis, University of Mining and Metallurgy, Kraków, Poland, Aug. 2000. http://janet-project.sourceforge.net/papers/janet_msc.pdf.Google Scholar
- X. Leroy, D. Doligez, J. Garrigue, D. Rémy, and J. Vouillon. The Objective Caml system release 3.09. http://caml.inria.fr/, Oct. 2005.Google Scholar
- S. Liang. The Java Native Interface: Programmer's Guide and Specification. Addison-Wesley, June 1999. Google Scholar
Digital Library
- J. Lind-Nielsen. BuDDy. http://buddy.sourceforge.net/.Google Scholar
- B. McCloskey and E. Brewer. A new approach to refactoring C. In Proc. 10th European Software Engineering Conference, pp. 21--30, Sept. 2005. Google Scholar
Digital Library
- E. Meijer, B. Beckman, and G. Bierman. Reconciling object, relations and XML in the .NET framework. In Proc. 2006 ACM SIGMOD International Conference on Management of Data, p. 706, June 2006. Google Scholar
Digital Library
- T. Millstein. Practical predicate dispatch. In Proc. 2004 ACM Conference on Object-Oriented Programming Systems, Languages, and Applications, pp. 345--364, Oct. 2004. Google Scholar
Digital Library
- G. C. Necula, S. McPeak, S. P. Rahul, and W. Weimer. CIL: Intermediate language and tools for analysis and transformation of C programs. In Proc. 11th International Conference on Compiler Construction, vol. 2304 of LNCS, pp. 213--228, Apr. 2002. Google Scholar
Digital Library
- N. Nystrom, M. R. Clarkson, and A. C. Myers. Polyglot: An extensible compiler framework for Java. In Proc. 12th International Conference on Compiler Construction, vol. 2622 of LNCS, pp. 138--152. Springer, Apr. 2003. Google Scholar
Digital Library
- N. Nystrom, X. Qi, and A. C. Myers. Nested intersection for scalable software composition. In Proc. 2006 ACM Conference on Object-Oriented Programming Systems, Languages, and Applications, pp. 21--36, Oct. 2006. Google Scholar
Digital Library
- J. Reppy and C. Song. Application-specific foreign-interface generation. In Proc. 5th International Conference on Generative Programming and Component Engineering, pp. 49--58, Oct. 2006. Google Scholar
Digital Library
- J. R. Rose and H. Muller. Integrating the Scheme and C languages. In Proc. 1992 ACM Conference on LISP and Functional Programming, pp. 247--259, June 1992. Google Scholar
Digital Library
- M. Roth and E. Pelegrí-Llopart. JavaServer Pages specification version 2.0. Tech. report, Sun Microsystems, Nov. 2003.Google Scholar
- A. Shalit. The Dylan Reference Manual. Addison-Wesley, Sept. 1996.Google Scholar
- T. Sheard and S. Peyton Jones. Template meta-programming for Haskell. ACM SIGPLAN Notices, 37(12):60--75, Dec. 2002. Google Scholar
Digital Library
- L. Stepanian, A. D. Brown, A. Kielstra, G. Koblents, and K. Stoodley. In lining Java native calls at runtime. In Proc. 1st ACM/USENIX Conference on Virtual Execution Environments, pp. 121--131, June 2005. Google Scholar
Digital Library
- Sun Microsystems. Java native interface specification, release 1.1, Jan. 1997.Google Scholar
- Sun Microsystems. Integrating native methods into Java programs. http://java.sun.com/docs/books/tutorialNB/download/tut-native1dot0.zip, May 1998.Google Scholar
- G. Tan, A. W. Appel, S. Chakradhar, A. Raghunathan, S. Ravi, and D. Wang. Safe Java native interface. In Proc. 2006 IEEE International Symposium on Secure Software Engineering, pp. 97--106, Mar. 2006.Google Scholar
- G. Tan and G. Morrisett. ILEA: Inter-language analysis across Java and C. In Proc. 2007 ACM Conference on Object-Oriented Programming Systems, Languages, and Applications, Oct. 2007. Google Scholar
Digital Library
- M. G. J. van den Brand, J. Scheerder, J. J. Vinju, and E. Visser. Disambiguation filters for scannerless generalized LR parsers. In Proc. 11th International Conference on Compiler Construction, vol. 2304 of LNCS, pp. 143--158. Springer, Apr. 2004. Google Scholar
Digital Library
- E. Visser. Syntax Definition for Language Prototyping. PhD thesis, University of Amsterdam, Sept. 1997.Google Scholar
- J. Visser. Visitor combination and traversal control. In Proc. 2001 ACM Conference on Object-Oriented Programming Systems, Languages, and Applications, pp. 270--282, Oct. 2001. Google Scholar
Digital Library
- D. Weise and R. Crew. Programmable syntax macros. In Proc. 1993 ACM Conference on Programming Language Design and Implementation, pp. 156--165, June 1993. Google Scholar
Digital Library
- J. Whaley. JavaBDD. http://javabdd.sourceforge.net/.Google Scholar
- M. Yuen, M. Fiuczynski, R. Grimm, Y. Coady, and D. Walker. Making extensibility of system software practical with the C4 toolkit. In Proc. AOSD Workshop on Software Engineering Properties of Languages and Aspect Technologies, Mar. 2006.Google Scholar
Index Terms
Jeannie: granting java native interface developers their wishes
Recommendations
Jeannie: granting java native interface developers their wishes
Proceedings of the 2007 OOPSLA conferenceHigher-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 ...
An efficient native function interface for Java
PPPJ '13: Proceedings of the 2013 International Conference on Principles and Practices of Programming on the Java Platform: Virtual Machines, Languages, and ToolsWe present an efficient and dynamic approach for calling native functions from within Java. Traditionally, programmers use the Java Native Interface (JNI) to call such functions. This paper introduces a new mechanism which we tailored specifically ...
Checking type safety of foreign function calls
Foreign function interfaces (FFIs) allow components in different languages to communicate directly with each other. While FFIs are useful, they often require writing tricky low-level code and include little or no static safety checking, thus providing a ...







Comments