1. A system that caches runtime-generated code comprising: a processor; and a memory coupled to the processor that contains a program, which, when executed by the processor, is configured to cache a cacheable entity in a cache by performing the steps of: determining whether a dynamic-code-generating entity is a pure function; in response to determining that the dynamic-code-generating entity is a pure function, calculating an identifier for the cacheable entity, the cacheable entity comprising runtime-generated code generated based on the dynamic-code-generating entity, the runtime-generated code comprising intermediate byte code; determining whether the calculated identifier is found in a first cache configured to store the runtime-generated code; in response to determining that the calculated identifier is not found in the first cache, generating and storing the cacheable entity in the first cache; and in response to determining that the calculated identifier is found in the first cache: determining whether the calculated identifier is found in a second cache configured to store native binary code for the runtime-generated code that is generated from the intermediate byte code; and generating, loading, and executing the native binary code and storing the generated native binary code in the second cache in response to determining that the calculated identifier is not found in the second cache.