Loading...
Loading...
Browse 3 real-world technical and behavioral interview questions about Jit. Review scenarios, edge cases, and architectural best practices.
A JIT compiles against a profile gathered earlier, so its fast code rests on assumptions that can be invalidated: a new receiver type at a call site, a branch taken for the first time, a class loaded that gives an interface a second implementation. The method deoptimises and recompiles from a worse profile. It also connects deoptimisation to the point an interviewer is testing.
The compiler cannot know, so it emits an indirect call through a per-class table of function pointers that the object carries a reference to. The lookup itself is a couple of memory accesses; the real cost is the optimisations the compiler cannot perform when the target is not known until run time.
Source is tokenised, parsed, checked, lowered to an intermediate representation, optimised and emitted - either ahead of time to machine code or to bytecode executed by a runtime. A JIT compiles hot bytecode at run time using profiles, which is why managed programs get faster after warm-up. Use this compilers answer to show the decision, trade-off, and evidence rather than a memorised definition.