Skip to main content

Module image_cache

Module image_cache 

Source
Expand description

Image bytecode predecode cache.

Predecoding a javm_exec::PvmProgram is expensive (basic-block analysis, gas cost computation, instruction predecoding); doing it per CALL would dominate the per-invocation cost. The cache is keyed by Image content_hash so identical Images share a single Predecoded (the bytecode is content-addressed; identical content always produces identical decoded state).

Stage 3 stores predecoded PvmProgram directly. A future optimization can swap in JIT-compiled bytes for the same key and serve both paths from one cache.

Structsยง

ImageCache
Map from Image::content_hash to a parsed PvmProgram. The PvmProgram is wrapped in Arc so the same predecoded body can be referenced from multiple in-flight InstanceEntries (siblings) and from concurrent threads (the kernel may eventually be multi-threaded).