ABSTRACT
Safepoints are a virtual machine mechanism that allows one thread to suspend other threads in a known state so that runtime actions can be performed without interruption and with data structures in a consistent state. Many virtual machines use safepoints as a mechanism to provide services such as stop-the-world garbage collection, debugging, and modification to running code such as installing or replacing classes. Languages implemented on these virtual machines may have access to these services, but not directly to the safepoint mechanism itself. We show that safepoints have many useful applications for the implementation of guest languages running on a virtual machine. We describe an API for using safepoints in languages that were implemented under the Truffle language implementation framework on the Java Virtual Machine and show several applications of the API to implement useful guest-language functionality. We present an efficient implementation of this API, when running in combination with the Graal dynamic compiler. We also demonstrate that our safepoints cause zero overhead with respect to peak performance and statistically insignificant overhead with respect to compilation time. We compare this to other techniques that could be used to implement the same functionality and demonstrate the large overhead that they incur.
- H. -J. Boehm and M. Weiser. Garbage Collection in an Uncooperative Environment. Softw., Pract. Exper., 18(9):807--820, 1988. Google ScholarDigital Library
- M. D. Bond, M. Kulkarni, M. Cao, M. Zhang, M. Fathi Salmi, S. Biswas, A. Sengupta, and J. Huang. Octet: Capturing and controlling cross-thread dependences efficiently. In ACM SIGPLAN Notices, volume 48, pages 693--712, 2013. Google ScholarDigital Library
- L. P. Deutsch and A. M. Schiffman. Efficient Implementation of the Smalltalk-80 System, 1984.Google ScholarDigital Library
- R. Forax. JSR 292 Goodness: Almost static final field., 2011. https://weblogs.java.net/blog/forax/archive/2011/12/17/jsr-292-goodness-almost-static-final-field.Google Scholar
- M. Grimmer, C. Seaton, T. Würthinger, and H. Mössenböck. Dynamically composing languages in a modular way: supporting C extensions for dynamic languages. In Proc. of Modularity, pages 1--13, 2015. Google ScholarDigital Library
- S. Herhut, R. L. Hudson, T. Shpeisman, and J. Sreeram. River Trail: A path to parallelism in JavaScript. In ACM SIGPLAN Notices, volume 48, pages 729--744, 2013. Google ScholarDigital Library
- U. Hölzle, C. Chambers, and D. Ungar. Debugging optimized code with dynamic deoptimization. In Proc. of PLDI, pages 32--43, 1992. Google ScholarDigital Library
- M. N. Kedlaya, B. Robatmili, C. Caşcaval, and B. Hardekopf. Deoptimization for dynamic language JITs on typed, stack-based virtual machines. In Proc. of VEE, pages 103--114, 2014. Google ScholarDigital Library
- F. Khan, V. Foley-Bourgon, S. Kathrotia, E. Lavoie, and L. Hendren. Using JavaScript and WebCL for Numerical Computations: A Comparative Study of Native and Web Technologies. In Proc. of DLS, pages 91--102, 2014. Google ScholarDigital Library
- L. Lu, W. Ji, and M. L. Scott. Dynamic enforcement of determinism in a parallel scripting language. In Proc. of PLDI, page 53, 2014. Google ScholarDigital Library
- N. D. Matsakis. Parallel Closures: A New Twist on an Old Idea. In Proc. of USENIX HotPar, 2012. Google ScholarDigital Library
- C. Nutter, T. Enebo, O. Bini, N. Sieger, et al. JRuby, 2015. http://jruby.org/.Google Scholar
- Oracle. OpenJDK, 2015. http://openjdk.java.net/.Google Scholar
- Oracle. Class SwitchPoint, 2015. http://docs.oracle.com/javase/8/docs/api/java/lang/invoke/SwitchPoint.html.Google Scholar
- Oracle Labs. GraalJS - High-Performance JavaScript Engine, 2015. http://www.oracle.com/technetwork/oracle-labs/program-languages.Google Scholar
- J. Rose et al. JSR 292: Supporting Dynamically Typed Languages on the Java Platform, 2011. https://jcp.org/en/jsr/detail?id=292.Google Scholar
- K. Russell and D. Detlefs. Eliminating synchronization-related atomic operations with biased locking and bulk rebiasing. ACM SIGPLAN Notices, 41(10):263--272, 2006. Google ScholarDigital Library
- C. Seaton, M. L. Van De Vanter, and M. Haupt. Debugging at Full Speed. In Proc. of Dynamic Languages and Applications (DYLA), 2014. Google ScholarDigital Library
- C. Seaton, B. Daloze, K. Menard, T. Würthinger, et al. JRuby+Truffle - a High-Performance Truffle Backend for JRuby, 2015. https://github.com/jruby/jruby/wiki/Truffle.Google Scholar
- C. Seaton, B. Daloze, K. Menard, T. Würthinger, et al. A JRuby+Truffle fork with the branches used for evaluation, 2015. https://github.com/eregon/jruby/tree/safepoint.Google Scholar
- C. Seaton et al. Bench9000, 2014. https://github.com/jruby/bench9000.Google Scholar
- 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 Proc. of Onward!, pages 187--204, 2013. Google ScholarDigital Library
- T. Würthinger, A. Wöß, L. Stadler, G. Duboscq, D. Simon, and C. Wimmer. Self-optimizing AST interpreters. In Proc. of DLS, page 73, 2013. Google ScholarDigital Library
- M. Zhang, J. Huang, M. Cao, and M. D. Bond. Low-overhead Software Transactional Memory with Progress Guarantees and Strong Semantics. In Proc. of PPoPP, pages 97--108, 2015. Google ScholarDigital Library
Index Terms
- Techniques and applications for guest-language safepoints
Recommendations
An object storage model for the truffle language implementation framework
PPPJ '14: Proceedings of the 2014 International Conference on Principles and Practices of Programming on the Java platform: Virtual machines, Languages, and ToolsTruffle is a Java-based framework for developing high-performance language runtimes. Language implementers aiming at developing new runtimes have to design all the runtime mechanisms for managing dynamically typed objects from scratch. This not only ...
Truffle: a self-optimizing runtime system
SPLASH '12: Proceedings of the 3rd annual conference on Systems, programming, and applications: software for humanityWe present Truffle, a novel framework for implementing managed languages in Java™. The language implementer writes an AST interpreter, which is integrated in our framework that allows tree rewriting during AST interpretation. Tree rewrites incorporate ...
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 ...
Comments