1. A method for implementing a just-in-time compiler, comprising: obtaining a plurality of high-level code templates in a high-level programming language, wherein the high-level programming language is designed for compilation to an intermediate language capable of execution by a virtual machine, and wherein each high-level code template selected from the plurality of high-level code templates represents an instruction in the intermediate language; compiling the plurality of high-level code templates to native code to obtain a plurality of optimized native code templates, wherein compiling the plurality of high-level code templates is performed, prior to runtime, using an optimizing static compiler designed for runtime use with the virtual machine; marking a constant in an optimized native code template selected from the plurality of optimized native code templates with an annotation, wherein the annotation indicates that the constant requires modification by the just-in-time compiler at runtime; and implementing the just-in-time compiler using the plurality of optimized native code templates, wherein the just-in-time compiler is configured to substitute a copy of an optimized native code template selected from the plurality of optimized native code templates when a corresponding instruction in the intermediate language is encountered at runtime.