[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-hotspot-runtime-dev
Subject:    about the fast path and slow path
From:       forax () univ-mlv ! fr (=?GB2312?B?UqimbWkgRm9yYXg=?=)
Date:       2012-07-20 10:48:24
Message-ID: 50093778.2080809 () univ-mlv ! fr
[Download RAW message or body]

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?
> Generally:
>
> "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:
>
> allocation:
>  - fast path: if enough space bump a pointer
>  - slow path: allocate a new thread-local allocation buffer then bump
> pointer
>
> 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
>
> classloading:
>  - fast path: class already loaded, just check in system dictionary and
> return
>  - 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.

> David

R??mi


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic