expert

Correct for nine minutes, then wrong

A JIT speculates that a hot method's receiver is always the same class, inlines the target directly and skips dynamic dispatch. A batch job runs correctly for its first several million records and produces silently wrong output on a later batch.

The symptom

The wrong output begins at the point where the input starts containing a subclass that overrides the method. The interpreter and the first-tier compiler both handle it correctly. Only the optimizing tier is wrong, and only after the method has been recompiled at that tier.

Commit first

Speculating on a receiver type is legal. Name the stage, and name the thing that must accompany every speculation for it to remain legal. Then say what must happen when that thing fails — there is a specific mechanism, and it has a name.