Abstract
We are in the multi-core era. Dynamically-typed languages are in widespread use, but their support for multithreading still lags behind. One of the reasons is that the sophisticated techniques they use to efficiently represent their dynamic object models are often unsafe in multithreaded environments.
This paper defines safety requirements for dynamic object models in multithreaded environments. Based on these requirements, a language-agnostic and thread-safe object model is designed that maintains the efficiency of sequential approaches. This is achieved by ensuring that field reads do not require synchronization and field updates only need to synchronize on objects shared between threads.
Basing our work on JRuby+Truffle, we show that our safe object model has zero overhead on peak performance for thread-local objects and only 3% average overhead on parallel benchmarks where field updates require synchronization. Thus, it can be a foundation for safe and efficient multithreaded VMs for a wide range of dynamic languages.
- A.-R. Adl-Tabatabai, B. T. Lewis, V. Menon, B. R. Murphy, B. Saha, and T. Shpeisman. Compiler and Runtime Support for Efficient Software Transactional Memory. In Proceedings of the 27th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI ’06, pages 26–37. ACM, 2006. doi: 10.1145/1133981.1133985. Google Scholar
Digital Library
- C. F. Bolz and L. Tratt. The Impact of Meta-Tracing on VM Design and Implementation. Science of Computer Programming, pages 408–421, Feb. 2015. doi: 10.1016/j.scico.2013.02.001. Google Scholar
Digital Library
- C. F. Bolz, A. Cuni, M. Fijalkowski, and A. Rigo. Tracing the Meta-level: PyPy’s Tracing JIT Compiler. In Proceedings of the 4th Workshop on the Implementation, Compilation, Optimization of Object-Oriented Languages and Programming Systems, ICOOOLPS ’09, pages 18–25. ACM, 2009. doi: 10.1145/1565824.1565827. Google Scholar
Digital Library
- C. F. Bolz, L. Diekmann, and L. Tratt. Storage Strategies for Collections in Dynamically Typed Languages. In Proceedings of the 2013 ACM SIGPLAN International Conference on Object Oriented Programming Systems Languages & Applications, OOPSLA ’13, pages 167–182. ACM, 2013. doi: 10.1145/2509136.2509531. Google Scholar
Digital Library
- C. Chambers, D. Ungar, and E. Lee. An Efficient Implementation of SELF a Dynamically-Typed Object-Oriented Language Based on Prototypes. In Proceedings on Object-Oriented Programming Systems, Languages and Applications, OOPSLA, pages 49–70. ACM, October 1989. doi: 10.1145/74878.74884. Google Scholar
Digital Library
- D. Clifford, H. Payer, M. Stanton, and B. L. Titzer. Memento Mori: Dynamic Allocation-site-based Optimizations. In Proceedings of the 2015 International Symposium on Memory Management, ISMM ’15, pages 105–117. ACM, 2015. ISBN 978-1-4503-3589-8. doi: 10.1145/2754169.2754181. Google Scholar
Digital Library
- B. Daloze, C. Seaton, D. Bonetta, and H. Mössenböck. Techniques and Applications for Guest-Language Safepoints. In Proceedings of the 10th International Workshop on Implementation, Compilation, Optimization of Object-Oriented Languages, Programs and Systems, ICOOOLPS ’15, 2015. Google Scholar
Digital Library
- D. Dice. Implementing Fast Java Monitors with Relaxedlocks. In Proceedings of the 2001 Symposium on Java Virtual Machine Research and Technology Symposium - Volume 1, JVM’01, page 13. USENIX Association, 2001. Google Scholar
Digital Library
- T. Domani, G. Goldshtein, E. K. Kolodner, E. Lewis, E. Petrank, and D. Sheinwald. Thread-Local Heaps for Java. In Proceedings of the 3rd International Symposium on Memory Management, ISMM ’02, pages 76–87. ACM, 2002. ISBN 1-58113-539-4. doi: 10.1145/512429.512439. Google Scholar
Digital Library
- R. W. Floyd. Algorithm 97: Shortest Path. Commun. ACM, 5 (6):345, Jun. 1962. doi: 10.1145/367766.368168. Google Scholar
Digital Library
- Google. V8 – Google’s JavaScript engine, 2015. https://developers.google.com/v8/.Google Scholar
- U. Hölzle, C. Chambers, and D. Ungar. Optimizing Dynamically-Typed Object-Oriented Languages With Polymorphic Inline Caches. In ECOOP ’91: European Conference on Object-Oriented Programming, volume 512 of LNCS, pages 21–38. Springer, 1991. doi: 10.1007/BFb0057013. Google Scholar
Digital Library
- S. M. Imam and V. Sarkar. Savina - An Actor Benchmark Suite: Enabling Empirical Evaluation of Actor Libraries. In Proceedings of the 4th International Workshop on Programming Based on Actors Agents & Decentralized Control, AGERE! ’14, pages 67–80. ACM, 2014. doi: 10.1145/2687357.2687368. Google Scholar
Digital Library
- J. Juneau, J. Baker, F. Wierzbicki, L. Soto, and V. Ng. The Definitive Guide to Jython: Python for the Java platform. Apress, 2010. doi: 10.1007/978-1-4302-2528-7. Google Scholar
Digital Library
- T. Kalibera, M. Mole, R. Jones, and J. Vitek. A Blackbox Approach to Understanding Concurrency in DaCapo. In Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages and Applications, OOPSLA ’12, pages 335–354. ACM, 2012. doi: 10.1145/ 2384616.2384641. Google Scholar
Digital Library
- J. Laskey. Nashorn Multithreading and MT-safety, 2013. https://blogs.oracle.com/nashorn/entry/nashorn_ multi_threading_and_mt.Google Scholar
- J. Manson, W. Pugh, and S. V. Adve. The Java Memory Model. In Proceedings of the 32nd Symposium on Principles of Programming Languages, POPL ’05, pages 378–391. ACM, 2005. doi: 10.1145/1040305.1040336. Google Scholar
Digital Library
- V. J. Marathe, M. F. Spear, C. Heriot, A. Acharya, D. Eisenstat, W. N. Scherer III, and M. L. Scott. Lowering the Overhead of Nonblocking Software Transactional Memory. Technical report, Department of Computer Science, University of Rochester, 2006.Google Scholar
- S. Marr, C. Seaton, and S. Ducasse. Zero-Overhead Metaprogramming: Reflection and Metaobject Protocols Fast and without Compromises. In Proceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI ’15, pages 545–554. ACM, 2015. doi: 10.1145/2737924.2737963. Google Scholar
Digital Library
- S. Marr, B. Daloze, and H. Mössenböck. Cross-Language Compiler Benchmarking—Are We Fast Yet? In Proceedings of the 12th Symposium on Dynamic Languages, DLS 2016. ACM, 2016. doi: 10.1145/2989225.2989232. Google Scholar
Digital Library
- F. Morandat, B. Hill, L. Osvald, and J. Vitek. Evaluating the Design of the R Language: Objects and Functions for Data Analysis. In Proceedings of the 26th European Conference on Object-Oriented Programming, ECOOP’12, pages 104–131. Springer-Verlag, 2012. doi: 10.1007/978-3-642-31057-7_6. Google Scholar
Digital Library
- Mozilla. SpiderMonkey – Mozilla’s JavaScript engine, 2015. https://developer.mozilla.org/en-US/docs/Mozilla/ Projects/SpiderMonkey.Google Scholar
- Mozilla Developer Network. JS-THREADSAFE, 2015.Google Scholar
- https://developer.mozilla.org/en-US/docs/Mozilla/ Projects/SpiderMonkey/JSAPI_reference/JS_THREADSAFE.Google Scholar
- Nashorn authors. Project Nashorn, 2016. http://openjdk. java.net/projects/nashorn/.Google Scholar
- C. Nutter, T. Enebo, O. Bini, N. Sieger, et al. JRuby, 2016. http://jruby.org/.Google Scholar
- Oracle Labs. GraalVM: New JIT Compiler and Polyglot Runtime for the JVM, 2016. http://www.oracle.com/ technetwork/oracle-labs/program-languages/overview/ index.html.Google Scholar
- T. Pape, T. Felgentreff, R. Hirschfeld, A. Gulenko, and C. F. Bolz. Language-independent Storage Strategies for Tracing-JIT-based Virtual Machines. In Proceedings of the 11th Symposium on Dynamic Languages, DLS 2015, pages 104– 113. ACM, 2015. doi: 10.1145/2816707.2816716. Google Scholar
Digital Library
- E. Phoenix, B. Shirai, R. Davis, D. Bussink, et al. Rubinius, 2016. http://rubini.us/.Google Scholar
- K. Russell and D. Detlefs. Eliminating Synchronization-related Atomic Operations with Biased Locking and Bulk Rebiasing. In Proceedings of the 21st Annual ACM SIGPLAN Conference on Object-oriented Programming Systems, Languages, and Applications, OOPSLA ’06, pages 263–272. ACM, 2006. doi: 10.1145/1167473.1167496. Google Scholar
Digital Library
- C. Seaton, B. Daloze, K. Menard, P. Chalupa, T. Würthinger, et al. JRuby+Truffle – a High-Performance Truffle Backend for JRuby, 2016.Google Scholar
- https://github.com/jruby/jruby/wiki/ Truffle.Google Scholar
- V8 authors. V8 Design Elements - Hidden Classes, 2012. https://developers.google.com/v8/design#prop_access.Google Scholar
- N. Vasudevan, K. S. Namjoshi, and S. A. Edwards. Simple and Fast Biased Locks. In Proceedings of the 19th International Conference on Parallel Architectures and Compilation Techniques, PACT ’10, pages 65–74. ACM, 2010. doi: 10.1145/1854273.1854287. Google Scholar
Digital Library
- M. Wolczko. Benchmarking Java with Richards and Deltablue, 2013. http://www.wolczko.com/java_benchmarking.html.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 Proceedings of the 2013 ACM International Symposium on New Ideas, New Paradigms, and Reflections on Programming & Software, Onward!’13, pages 187–204. ACM, 2013. doi: 10.1145/2509578.2509581. Google Scholar
Digital Library
- A. Wöß, C. Wirth, D. Bonetta, C. Seaton, C. Humer, and H. Mössenböck. An Object Storage Model for the Truffle Language Implementation Framework. In Proceedings of the 2014 International Conference on Principles and Practices of Programming on the Java Platform: Virtual Machines, Languages, and Tools, PPPJ ’14, pages 133–144. ACM, 2014. Google Scholar
Digital Library
- doi: 10.1145/2647508.2647517.Google Scholar
- T. Würthinger, A. Wöß, L. Stadler, G. Duboscq, D. Simon, and C. Wimmer. Self-Optimizing AST Interpreters. In Proceedings of the 8th Dynamic Languages Symposium, DLS’12, pages 73– 82, October 2012. doi: 10.1145/2384577.2384587. Google Scholar
Digital Library
- M. Zhang, J. Huang, M. Cao, and M. D. Bond. Low-overhead Software Transactional Memory with Progress Guarantees and Strong Semantics. In Proceedings of the 20th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, PPoPP 2015, pages 97–108. ACM, 2015. doi: 10.1145/2688500.2688510. Google Scholar
Digital Library
Index Terms
Efficient and thread-safe objects for dynamically-typed languages
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 ...
Parallelization of dynamic languages: synchronizing built-in collections
Dynamic programming languages such as Python and Ruby are widely used, and much effort is spent on making them efficient. One substantial research effort in this direction is the enabling of parallel code execution. While there has been significant ...
Efficient and thread-safe objects for dynamically-typed languages
OOPSLA 2016: Proceedings of the 2016 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and ApplicationsWe are in the multi-core era. Dynamically-typed languages are in widespread use, but their support for multithreading still lags behind. One of the reasons is that the sophisticated techniques they use to efficiently represent their dynamic object ...







Comments