Abstract
We introduce a just-in-time specializer for Prolog. Just-in-time specialization attempts to unify of the concepts and benefits of partial evaluation (PE) and just-in-time (JIT) compilation. It is a variant of PE that occurs purely at runtime, which lazily generates residual code and is constantly driven by runtime feedback.
Our prototype is an on-line just-in-time partial evaluator. A major focus of our work is to remove the overhead incurred when executing an interpreter written in Prolog. It improves over classical offline PE by requiring almost no heuristics nor hints from the author of the interpreter; it also avoids most termination issues due to interleaving execution and specialization. We evaluate the performance of our prototype on a small number of benchmarks.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Bala, V., Duesterwald, E., Banerjia, S.: Dynamo: a transparent dynamic optimization system. ACM SIGPLAN Notices 35, 1–12 (2000)
Barker, S., Leuschel, M., Varea, M.: Efficient and flexible access control via logic program specialisation. In: Proceedings PEPM 2004, pp. 190–199. ACM Press, New York (2004)
Bolz, C.F.: Automatic JIT Compiler Generation with Runtime Partial Evaluation. Master thesis, Heinrich-Heine-Universität Düsseldorf (2008), http://www.stups.uni-duesseldorf.de/thesis_detail.php?id=14
Bolz, C.F., Cuni, A., Fijalkowski, M., Rigo, A.: 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, Genova, Italy, pp. 18–25. ACM, New York (2009)
Bolz, C.F., Rigo, A.: How to not write a virtual machine. In: Proceedings of 3rd Workshop on Dynamic Languages and Applications, DYLA 2007 (2007)
Chang, M., Bebenita, M., Yermolovich, A., Gal, A., Franz, M.: Efficient just-in-time execution of dynamically typed languages via code specialization using precise runtime type inference. Technical report, Donald Bren School of Information and Computer Science, University of California, Irvine (2007)
Chang, M., Smith, E., Reitmaier, R., Bebenita, M., Gal, A., Wimmer, C., Eich, B., Franz, M.: Tracing for Web 3.0: Trace compilation for the next generation web applications. In: Proceedings of the 2009 ACM SIGPLAN/SIGOPS International Conference on Virtual Execution Environments, Washington, DC, USA, pp. 71–80. ACM Press, New York (2009)
Consel, C., Hornof, L., Noël, F., Noyé, J., Volansche, N.: A uniform approach for compile-time and run-time specialization. In: Danvy, O., Thiemann, P., Glück, R. (eds.) Dagstuhl Seminar 1996. LNCS, vol. 1110, pp. 54–72. Springer, Heidelberg (1996)
Consel, C., Noël, F.: A general approach for run-time specialization and its application to C. In: POPL, pp. 145–156 (1996)
De Schreye, D., Glück, R., Jørgensen, J., Leuschel, M., Martens, B., Sørensen, M.H.: Conjunctive partial deduction: Foundations, control, algorithms and experiments. The Journal of Logic Programming 41(2,3), 231–277 (1999)
Gal, A., Franz, M.: Incremental dynamic code generation with trace trees. Technical report, Donald Bren School of Information and Computer Science, University of California, Irvine (November 2006)
Gal, A., Probst, C.W., Franz, M.: HotpathVM: an effective JIT compiler for resource-constrained devices. In: Proceedings of the 2nd international conference on Virtual execution environments, Ottawa, Ontario, Canada, pp. 144–153. ACM, New York (2006)
Gallagher, J., Bruynooghe, M.: The derivation of an algorithm for program specialisation. New Generation Computing 9(3,4), 305–333 (1991)
Grant, B., Mock, M., Philipose, M., Chambers, C., Eggers, S.J.: DyC: an expressive annotation-directed dynamic compiler for C. Theoretical Computer Science 248, 147–199 (2000)
Hill, P., Gallagher, J.: Meta-programming in logic programming. In: Gabbay, D.M., Hogger, C.J., Robinson, J.A. (eds.) Handbook of Logic in Artificial Intelligence and Logic Programming, vol. 5, pp. 421–497. Oxford Science Publications, Oxford University Press (1998)
Hölzle, U., Chambers, C., Ungar, D.: Optimizing dynamically-typed object-oriented languages with polymorphic inline caches. In: America, P. (ed.) ECOOP 1991. LNCS, vol. 512, pp. 21–38. Springer, Heidelberg (1991)
Jones, N.D., Gomard, C.K., Sestoft, P.: Partial Evaluation and Automatic Program Generation. Prentice-Hall, Englewood Cliffs (1993)
Leuschel, M., Bruynooghe, M.: Logic program specialisation through partial deduction: Control issues. Theory and Practice of Logic Programming 2(4,5), 461–515 (2002)
Leuschel, M., Martens, B., De Schreye, D.: Controlling generalisation and polyvariance in partial deduction of normal logic programs. ACM Transactions on Programming Languages and Systems 20(1), 208–258 (1998)
Lloyd, J.W., Shepherdson, J.C.: Partial evaluation in logic programming. The Journal of Logic Programming 11(3,4), 217–242 (1991)
Martens, B., De Schreye, D.: Two semantics for definite meta-programs, using the non-ground representation. In: Apt, K.R., Turini, F. (eds.) Meta-logics and Logic Programming, pp. 57–82. MIT Press, Cambridge (1995)
Martens, B., Gallagher, J.: Ensuring global termination of partial deduction while allowing flexible polyvariance. In: Sterling, L. (ed.) Proceedings ICLP 1995, Kanagawa, Japan, June 1995, pp. 597–613. MIT Press, Cambridge (1995)
Paleczny, M., Vick, C., Click, C.: The Java HotSpot server compiler. In: Proceedings of the Java Virtual Machine Research and Technology Symposium on Java Virtual Machine Research and Technology Symposium, Monterey, California, vol. 1. USENIX Association (2001)
Prestwich, S.: An unfold rule for full Prolog. In: Lau, K.-K., Clement, T. (eds.) Logic Program Synthesis and Transformation. Proceedings of LOPSTR 1992, Workshops in Computing. University of Manchester, pp. 199–213. Springer, Heidelberg (1992)
Rigo, A.: Representation-based just-in-time specialization and the Psyco prototype for Python. In: Heintze, N., Sestoft, P. (eds.) PEPM, pp. 15–26. ACM Press, New York (2004)
Rigo, A., Pedroni, S.: PyPy’s approach to virtual machine construction. In: Companion to the 21st ACM SIGPLAN conference on Object-oriented programming systems, languages, and applications, Portland, Oregon, USA, pp. 944–953. ACM Press, New York (2006)
Rigo, A., Pedroni, S.: JIT compiler architecture. Technical Report D08.2, PyPy Consortium (2007), http://codespeak.net/pypy/dist/pypy/doc/index-report.html
Sullivan, G.T.: Dynamic partial evaluation. In: Danvy, O., Filinski, A. (eds.) PADO 2001. LNCS, vol. 2053, pp. 238–256. Springer, Heidelberg (2001)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2010 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Bolz, C.F., Leuschel, M., Rigo, A. (2010). Towards Just-In-Time Partial Evaluation of Prolog. In: De Schreye, D. (eds) Logic-Based Program Synthesis and Transformation. LOPSTR 2009. Lecture Notes in Computer Science, vol 6037. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-12592-8_12
Download citation
DOI: https://doi.org/10.1007/978-3-642-12592-8_12
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-12591-1
Online ISBN: 978-3-642-12592-8
eBook Packages: Computer ScienceComputer Science (R0)