about the fast path and slow path

David Holmes david.holmes at oracle.com
Thu Jul 19 20:12:29 PDT 2012


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.

David

> 
> ------------------------------------------------------------------------
> 
> This email (including any attachments) is confidential and may be 
> legally privileged. If you received this email in error, please delete 
> it immediately and do not copy it or use it for any purpose or disclose 
> its contents to any other person. Thank you.
> 
> ±¾µçÓÊ(°üÀ¨Èκθ½¼þ)¿ÉÄܺ¬ÓлúÃÜ×ÊÁϲ¢ÊÜ·¨Âɱ£»¤¡£ÈçÄú²»ÊÇÕýÈ·µÄÊÕ¼þÈË£¬ 
> ÇëÄúÁ¢¼´É¾³ý±¾Óʼþ¡£Çë²»Òª½«±¾µçÓʽøÐи´ÖƲ¢ÓÃ×÷ÈÎºÎÆäËûÓÃ;¡¢»ò͸¶±¾ÓÊ 
> ¼þÖ®ÄÚÈÝ¡£Ð»Ð»¡£


More information about the hotspot-runtime-dev mailing list