1

TruffleC | Proceedings of the 2014 International Conference on Principles and Pr...

 1 year ago
source link: https://dl.acm.org/doi/10.1145/2647508.2647528
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

ABSTRACT

This paper presents TruffleC, a C interpreter that allows the dynamic execution of C code on top of a Java Virtual Machine (JVM). Rather than producing a static build of a C application, TruffleC is a self-optimizing abstract syntax tree (AST) interpreter combined with a just-in-time (JIT) compiler. Our self-optimizing interpreter specializes the AST based on run-time feedback. AST specialization relies on optimistic assumptions and allows us to build inline caches for polymorphic function pointer calls, to profile runtime values and to potentially replace them with constants, or to speculatively remove code that was not executed yet.

After AST specialization, the JIT compiler translates the AST to highly optimized machine code. The machine code uses dynamic deoptimization points at which the control switches back to the interpreter in case of a violated assumption.

We evaluated TruffleC using a C micro-benchmark in terms of peak performance. This evaluation showed that TruffleC outperforms the code produced by industry standard compilers such as GCC or Clang/LLVM. The evaluation of other benchmarks ("Computer Language Benchmarks Game") showed that the TruffleC performance is on average only 7% slower than the best performance out of the GCC and Clang/LLVM performances.

References

  1. HotSpot JVM. Java version history (J2SE 1.3). http://en.wikipedia.org/wiki/Java_version_history, 2013.
  2. IBM. Java 2 Platform. Standard Edition. http://www.ibm.com/developerworks/java/jdk/, 2013.
  3. Clang/LLVM. http://clang.llvm.org/, 2014.
  4. GCC (GNU C Compiler). http://gcc.gnu.org/, 2014.
  5. JNI: Java Native Interface. http://docs.oracle.com/javase/7/docs/technotes/guides/jni/, 2014.
  6. Linux kernel coding style. https://www.kernel.org/doc/Documentation/CodingStyle, 2014.
  7. LLJVM. http://da.vidr.cc/projects/lljvm/, 2014.
  8. 'C. http://pdos.csail.mit.edu/tickc/, 2014.
  9. R. Allen and S. Johnson. Compiling c for vectorization, parallelization, and inline expansion. In ACM SIGPLAN Notices, volume 23, pages 241--249. ACM, 1988.
  10. B. Alliet and A. Megacz. Complete translation of unsafe native code to safe bytecode. In Proceedings of the 2004 Workshop on Interpreters, Virtual Machines and Emulators, IVME '04, pages 32--41, New York, NY, USA, 2004. ACM. ISBN 1-58113-909-8.. URL http://doi.acm.org/10.1145/1059579.1059589.
  11. M. Arnold, S. Fink, D. Grove, M. Hind, and P. Sweeney. A survey of adaptive optimization in virtual machines. Proceedings of the IEEE, 93(2):449--466, 2005. ISSN 0018-9219..
  12. J. Auslander, M. Philipose, C. Chambers, S. J. Eggers, and B. N. Bershad. Fast, effective dynamic compilation. In ACM SIGPLAN Notices, volume 31, pages 149--159. ACM, 1996.
  13. P. P. Chang, S. A. Mahlke, W. Y. Chen, and W.-M. W. Hwu. Profile-guided automatic inline expansion for c programs. Software: Practice and Experience, 22(5):349--369, 1992.
  14. R. Cytron, J. Ferrante, B. K. Rosen, M. N. Wegman, and F. K. Zadeck. Efficiently computing static single assignment form and the control dependence graph. ACM Trans. Program. Lang. Syst., 13(4):451--490, Oct. 1991. ISSN 0164-0925.. URL http://doi.acm.org/10.1145/115372.115320.
  15. A. M. Erosa and L. J. Hendren. Taming control flow: A structured approach to eliminating goto statements. In Computer Languages, 1994., Proceedings of the 1994 International Conference on, pages 229--240. IEEE, 1994.
  16. B. Fulgham and I. Gouy. The computer language benchmarks game. http://benchmarksgame.alioth.debian.org/, 2014.
  17. M. Grimmer, M. Rigger, L. Stadler, R. Schatz, and H. Mössenböck. An Efficient Native Function Interface for Java. In Proceedings of the 2013 International Conference on Principles and Practices of Programming on the Java Platform: Virtual Machines, Languages, and Tools, PPPJ '13, pages 35--44, New York, NY, USA, 2013. ACM. ISBN 978-1-4503-2111-2.. URL http://doi.acm.org/10.1145/2500828.2500832.
  18. W. L. Harrison III and Z. Ammarguellat. Parcel and miprac: parallelizers for symbolic and numeric programs. In Proceedings of International Workshop on Compilers for Parallel Computers, pages 329--346. Citeseer, 1990.
  19. U. Hölzle, C. Chambers, and D. Ungar. Debugging optimized code with dynamic deoptimization. SIGPLAN Not., 27(7):32--43, July 1992. ISSN 0362-1340.. URL http://doi.acm.org/10.1145/143103.143114.
  20. S. Kågström, H. Grahn, and L. Lundberg. Cibyl: an environment for language diversity on mobile devices. In Proceedings of the 3rd international conference on Virtual execution environments, pages 75--82. ACM, 2007.
  21. M. Mock, M. Das, C. Chambers, and S. J. Eggers. Dynamic points- to sets: A comparison with static analyses and potential applications in program understanding and optimization. In Proceedings of the 2001 ACM SIGPLAN-SIGSOFT workshop on Program analysis for software tools and engineering, pages 66--72. ACM, 2001.
  22. Oracle. OpenJDK: Graal project. http://openjdk.java.net/projects/graal/, 2014.
  23. E. Rohou, A. C. Ornstein, and M. Cornero. Cli-based compilation flows for the c language. In Embedded Computer Systems (SAMOS), 2010 International Conference on, pages 162--169. IEEE, 2010.
  24. S. Saha, J. Lawall, and G. Muller. An approach to improving the structure of error-handling code in the linux kernel. ACM SIGPLAN Notices, 46(5):41--50, 2011.
  25. L. Stadler, G. Duboscq, H. Mössenböck, and T. Würthinger. Compilation queuing and graph caching for dynamic compilers. In Proceedings of the Sixth ACM Workshop on Virtual Machines and Intermediate Languages, VMIL '12, pages 49--58, New York, NY, USA, 2012. ACM. ISBN 978-1-4503-1633-0.. URL http://doi.acm.org/10.1145/2414740.2414750.
  26. L. Stadler, G. Duboscq, H. Mössenböck, and T. Würthinger. Compilation queuing and graph caching for dynamic compilers. In Proceedings of the Sixth ACM Workshop on Virtual Machines and Intermediate Languages, VMIL '12, pages 49--58, New York, NY, USA, 2012. ACM. ISBN 978-1-4503-1633-0.. URL http://doi.acm.org/10.1145/2414740.2414750.
  27. L. Stadler, T. Würthinger, and H. Mössenböck. Partial escape analysis and scalar replacement for java. In Proceedings of Annual IEEE/ACM International Symposium on Code Generation and Optimization, CGO '14, pages 165:165--165:174, New York, NY, USA, 2014. ACM. ISBN 978-1-4503-2670-4.. URL http://doi.acm.org/10.1145/2544137.2544157.
  28. W. H. Wen-mei and P. P. Chang. Inline function expansion for compiling c programs. Urbana, 51:61801, 1989.
  29. T. Würthinger, A. Wöß, L. Stadler, G. Duboscq, D. Simon, and C. Wimmer. Self-optimizing ast interpreters. In Proceedings of the 8th Symposium on Dynamic Languages, DLS '12, pages 73--82, New York, NY, USA, 2012. ACM. ISBN 978-1-4503-1564-7.. URL http://doi.acm.org/10.1145/2384577.2384587.
  30. T. Würthinger, C. Wimmer, A. Wöß, L. Stadler, G. Duboscq, C. Humer, G. Richards, D. Simon, and M. Wolczko. One VM to rule them all. In Proceedings of the 2013 ACM international symposium on New ideas, new paradigms, and reflections on programming & software, pages 187--204. ACM, 2013.

Comments

0 Comments


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK