Skip to content
Preptima

Top 3 Jit Interview Questions

Browse 3 real-world technical and behavioral interview questions about Jit. Review scenarios, edge cases, and architectural best practices.

A method has been running fast for an hour and then gets slower, with no code change and no extra traffic. What might the runtime be doing?

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.

hardconcept

When you call an overridden method through a base-class reference, how does the runtime know which implementation to run?

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.

mediumconcept

Walk me through what happens between the source you write and the instructions the CPU runs, and where does a JIT fit into that?

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.

mediumconcept