Compiler-Guaranteed Safety in Code-Copying Virtual Machines

  • Gregory B. Prokopski
  • Clark Verbrugge
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4959)


Virtual Machine authors face a difficult choice between low performance, cheap interpreters, or specialized and costly compilers. A method able to bridge this wide gap is the existing code-copying technique that reuses chunks of the VM’s binary code to create a simple JIT. This technique is not reliable without a compiler guaranteeing that copied chunks are still functionally equivalent despite aggressive optimizations. We present a proof-of-concept, minimal-impact modification of a highly optimizing compiler, GCC. A VM programmer marks chunks of VM source code as copyable. The chunks of native code resulting from compilation of the marked source become addressable and self-contained. Chunks can be safely copied at VM runtime, concatenated and executed together. This allows code-copying VMs to safely achieve speedup up to 3 times, 1.67 on average, over the direct interpretation. This maintainable enhancement makes the code-copying technique reliable and thus practically usable.


Virtual Machine Basic Block Java Virtual Machine Target Block Copyable Code 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


  1. 1.
    Bélanger, D.: SableJIT: A retargetable just-in-time compiler. Master’s thesis, McGill University (August 2004)Google Scholar
  2. 2.
    Ertl, M.A., Gregg, D.: Retargeting JIT compilers by using C-compiler generated executable code. In: Parallel Architecture and Compilation Techniques (PACT 2004), pp. 41–50 (2004)Google Scholar
  3. 3.
    Ertl, M.A., Gregg, D., Krall, A., Paysan, B.: Vmgen: a generator of efficient virtual machine interpreters. Softw. Pract. Exper. 32(3), 265–294 (2002)zbMATHCrossRefGoogle Scholar
  4. 4.
    Ertl, M.A., Thalinger, C., Krall, A.: Superinstructions and replication in the Cacao JVM interpreter. Journal of.NET Technologies 4, 25–32 (2006); Journal papers from .NET Technologies 2006 conferenceGoogle Scholar
  5. 5.
    Gagnon, E.M.: A Portable Research Framework for the Execution of Java Bytecode. PhD thesis, McGill University (2002)Google Scholar
  6. 6.
    Grant, B., Philipose, M., Mock, M., Chambers, C., Eggers, S.J.: A retrospective on: an evaluation of staged run-time optimizations in DyC. SIGPLAN Not. 39(4), 656–669 (2004)CrossRefGoogle Scholar
  7. 7.
    Gu, D., Verbrugge, C., Gagnon, E.: Code layout as a source of noise in JVM performance. In: Component And Middleware Performance workshop, OOPSLA (2004)Google Scholar
  8. 8.
    Gu, D., Verbrugge, C., Gagnon, E.M.: Relative factors in performance analysis of Java virtual machines. In: VEE 2006: Proceedings of the 2nd international conference on Virtual execution environments, pp. 111–121. ACM Press, New York (2006)CrossRefGoogle Scholar
  9. 9.
    Prokopski, G.B., Gagnon, E.M., Arcand, C.: Bytecode testing framework for SableVM code-copying engine. Technical Report SABLE-TR-2007-9, Sable Research Group, School of Computer Science, McGill University, Montréal, Québec, Canada (September 2007)Google Scholar
  10. 10.
    Rossi, M., Sivalingam, K.: A survey of instruction dispatch techniques for byte-code interpreters. Technical Report TKO-C79, Faculty of Information Technology, Helsinki Univeristy of Technology (May 1996)Google Scholar
  11. 11.
    Stephenson, B., Holst, W.: Multicodes: optimizing virtual machines using bytecode sequences. In: OOPSLA 2003: Companion of the 18th annual ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, pp. 328–329. ACM Press, New York (2003)CrossRefGoogle Scholar
  12. 12.
    Suganuma, T., Ogasawara, T., Takeuchi, M., Yasue, T., Kawahito, M., Ishizaki, K., Komatsu, H., Nakatani, T.: Overview of the IBM Java just-in-time compiler. IBM Syst. J. 39(1), 175–193 (2000)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2008

Authors and Affiliations

  • Gregory B. Prokopski
    • 1
  • Clark Verbrugge
    • 1
  1. 1.Sable Research Group School of Computer ScienceMcGill UniversityMontrealCanada

Personalised recommendations