Google Groups Home
Help | Sign in
Message from discussion Performance characteristics of mutable static primitives?
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
John Cowan  
View profile
 More options Apr 3, 7:26 pm
From: "John Cowan" <johnwco...@gmail.com>
Date: Thu, 3 Apr 2008 19:26:21 -0400
Local: Thurs, Apr 3 2008 7:26 pm
Subject: Re: [jvm-l] Re: Performance characteristics of mutable static primitives?

On Thu, Apr 3, 2008 at 7:01 PM, John Rose <John.R...@sun.com> wrote:
>  Yes.  You can then cast it to the subclass and go on from there.

That's what I had hoped, but the JLS doesn't actually seem to guarantee this.

>  > If so, that provides a different approach
>  > to thread-local state, where the state is held in the instance
>  > variables of MyThread objects, and the JVM is used to thread them
>  > through :-) the code until the point where they're needed.

>  That's how Java thread locals are implemented in the JVM.

I don't understand how that can be, as I can create as many
ThreadLocals as I want.  They can't all fit in the Thread object,
surely.  And how can reference to them be fast if they have to
indirect through a Thread subclass object?

>  You can only use this approach if (a) you control the creation of the
>  thread and can specify your own subclass for it,

That's what I had in mind.

>  You might be interested to know that Hotspot intrinsifies
>  Thread.currentThread to a couple of instructions; it's cheap.  We did
>  that to make things like thread locals efficient.

Good.

--
GMail doesn't have rotating .sigs, but you can see mine at
http://www.ccil.org/~cowan/signatures


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google