Optimizing Dynamic Dispatches through Type Invariant Region Analysis
- 308 Downloads
Object oriented languages lead to dynamic dispatches of most method calls due to limitations on static analysis which have significant run-time overheads. In this work, we propose a new optimization to cut this overhead which is based on the following key observation: run-time type testing of a method at every call-site is extraneous. The technique makes use of an important observation: most of the times a polymorphic object, although statically unknown in type, is fixed at run-time and never mutates. In such cases, run-time type testing for its methods is only needed when an object is instantiated. The type check is hoisted at the entry point of a region and its results are shared over all dispatches that lie within the region. We implemented this optimization in Vortex, an optimizing object-oriented compiler back-end, and with our framework, we observed an average speed-up of 9.22%. We avoided 91% of the dynamic dispatches with a speed-up of 17.9% in the best case.
KeywordsTable Lookup Type Test Region Size Type Check Type Invariant
Unable to display preview. Download preview PDF.
- 1.Dean, J., DeFouw, G., Grove, D., Litvinov, V., Chambers, C.: Vortex: An Optimizing Compiler for Object-Oriented Languages. In: OOPSLA 1996, 11th Conference on Object-Oriented Programming, Systems, Languages, and Applications, San Jose, CA (October 1996)Google Scholar
- 2.Grove, D., Dean, J., Garrett, C., Chambers, C.: Profile-Guided Receiver Class Prediction. In: OOPSLA 1995, Austin, TX (October 1995)Google Scholar
- 4.Deutsch, L.P., Schiffman, A.: Efficient Implement ation of the Smalltalk-80 System. In: Proceedings of the 11th. Symposium on the Principles of Programming Languages, Salt Lake City, UT (1984)Google Scholar