skip to main content
10.1145/1297027.1297030acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
Article

Jeannie: granting java native interface developers their wishes

Published:21 October 2007Publication History

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.

References

  1. 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 ScholarGoogle Scholar
  2. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  3. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  4. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  5. 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 ScholarGoogle Scholar
  6. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  7. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  8. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  9. J. Blosser. Java tip 98: Reflect on the visitor design pattern. JavaWorld, July 2000. http://www.javaworld.com/javaworld/javatips/jw-javatip98.html.Google ScholarGoogle Scholar
  10. 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 ScholarGoogle ScholarCross RefCross Ref
  11. 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 ScholarGoogle ScholarCross RefCross Ref
  12. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  13. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  14. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  15. 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 ScholarGoogle Scholar
  16. L. Cardelli, F. Matthes, and M. Abadi. Extensible syntax with lexical scoping. Tech. Report 121, Digital Equipment, Systems Research Center, Feb. 1994.Google ScholarGoogle Scholar
  17. 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 ScholarGoogle Scholar
  18. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  19. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  20. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  21. K. Fisher, R. Pucella, and J. Reppy. A framework for interoperability. Electronic Notes in Theoretical Computer Science, 59(1):3--19, Sept. 2001.Google ScholarGoogle ScholarCross RefCross Ref
  22. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  23. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  24. E. Gamma, R. Helm, R. Johnson, and J. Vlissides. Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, Jan. 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  26. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  27. J. Gosling, B. Joy, G. Steele, and G. Bracha. The Java Language Specification. Addison-Wesley, second edition, June 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. R. Grimm. xtc (eXTensible C). http://cs.nyu.edu/rgrimm/xtc/.Google ScholarGoogle Scholar
  29. R. Grimm. Better extensibility through modular syntax. In Proc. 2006 ACM Conference on Programming Language Design and Implementation, pp. 38--51, June 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. 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 ScholarGoogle Scholar
  31. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  32. G. Hedin. The JastAdd extensible Java compiler. http://jastadd.cs.lth.se/web/extjava/index.shtml.Google ScholarGoogle Scholar
  33. 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 ScholarGoogle Scholar
  34. International Organization for Standardization. Information Technology--Programming Languages-C. ISO/IEC Standard 9899:TC2, May 2005.Google ScholarGoogle Scholar
  35. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  36. 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 ScholarGoogle Scholar
  37. 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 ScholarGoogle Scholar
  38. S. Liang. The Java Native Interface: Programmer's Guide and Specification. Addison-Wesley, June 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. J. Lind-Nielsen. BuDDy. http://buddy.sourceforge.net/.Google ScholarGoogle Scholar
  40. B. McCloskey and E. Brewer. A new approach to refactoring C. In Proc. 10th European Software Engineering Conference, pp. 21--30, Sept. 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  42. T. Millstein. Practical predicate dispatch. In Proc. 2004 ACM Conference on Object-Oriented Programming Systems, Languages, and Applications, pp. 345--364, Oct. 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  44. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  45. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  46. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  47. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  48. M. Roth and E. Pelegrí-Llopart. JavaServer Pages specification version 2.0. Tech. report, Sun Microsystems, Nov. 2003.Google ScholarGoogle Scholar
  49. A. Shalit. The Dylan Reference Manual. Addison-Wesley, Sept. 1996.Google ScholarGoogle Scholar
  50. T. Sheard and S. Peyton Jones. Template meta-programming for Haskell. ACM SIGPLAN Notices, 37(12):60--75, Dec. 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  51. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  52. Sun Microsystems. Java native interface specification, release 1.1, Jan. 1997.Google ScholarGoogle Scholar
  53. Sun Microsystems. Integrating native methods into Java programs. http://java.sun.com/docs/books/tutorialNB/download/tut-native1dot0.zip, May 1998.Google ScholarGoogle Scholar
  54. 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 ScholarGoogle Scholar
  55. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  56. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  57. E. Visser. Syntax Definition for Language Prototyping. PhD thesis, University of Amsterdam, Sept. 1997.Google ScholarGoogle Scholar
  58. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  59. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  60. J. Whaley. JavaBDD. http://javabdd.sourceforge.net/.Google ScholarGoogle Scholar
  61. 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 ScholarGoogle Scholar

Index Terms

  1. Jeannie: granting java native interface developers their wishes

        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
        About Cookies On This Site

        We use cookies to ensure that we give you the best experience on our website.

        Learn more

        Got it!