1. A method comprising: executing ahead-of-time (AOT) compiled code for a particular program; detecting that a target function of the particular program should be just-in-time (JIT) compiled; in response to detecting that the target function of the particular program should be JIT compiled, generating a JIT-compiled version of the target function; patching an AOT-compiled version of the target function to the JIT-compiled version of the target function; and in response to patching the AOT-compiled version of the target function to the JIT-compiled version of the target function, executing the JIT-compiled version of the target function in place of the AOT-compiled version when the target function is invoked; wherein the method is performed by one or more computing devices.