about the fast path and slow path
forax at univ-mlv.fr
Fri Jul 20 03:48:24 PDT 2012
On 07/20/2012 05:12 AM, David Holmes wrote:
> On 20/07/2012 12:39 PM, ½¯³å wrote:
>> What is the fast path and slow path?
> "fast path" - a code path optimized for speed because it is the common case
> "slow path" - what we have to do when the "fast path" is not applicable
> For example:
> - fast path: if enough space bump a pointer
> - slow path: allocate a new thread-local allocation buffer then bump
> monitor acquisition:
> - fast path: object is unlocked and unbiased so simply CAS in current
> thread ID into object header
> - slow path: object is unlocked but biased, so revoke bias and use
> BasicLock to lock
> - fast path: class already loaded, just check in system dictionary and
> - slow path: class is not loaded, so load it
> And there are many other examples. And it isn't necessarily just a
> choice of two things: the slow path typically has many branches and
> different lengths depending on the exact circumstances.
Also, the JIT itself tend to consider the user code not called in the
interpreter as a slow path too.
segregating slow path and fast path is a generic optimization technique.
More information about the hotspot-runtime-dev