harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Weldon Washburn" <weldon...@gmail.com>
Subject Re: [drlvm][vm, mmtk] adding thread-local storage functionality to vmmagic
Date Thu, 17 Aug 2006 12:41:56 GMT
On 17 Aug 2006 14:01:51 +0700, Egor Pasko <egor.pasko@gmail.com> wrote:
> On the 0x1C8 day of Apache Harmony Weldon Washburn wrote:
> > Windows uses ia32 segment register fs:14 for fast thread-local storage
> > access.  I think Linux somehow uses the gs segment register.
>
> In general, it is implementation-specific (not older kernels).
>
> Here is a good link for that:
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4915203

I took a look.  It mentions some kernels use GS register, some have an
TLS related API that uses the LDT and some use the upper 10 bits of
ESP as a unique thread value.  The upper 10 can then be used as an
index or hash into a JVM data struct that holds thread local data.

We need some approach to handle old linux kernels that use ESP.  Maybe
add a compiler instrinsic that returns the current ESP contents
shifted right by 22 bits.  Something like:

int index = espShiftedRightBy22Bits();

>
> I wonder, how to handle system-dependent code with Java vmmagic :(
> A simple if-then-else would make an #ifdef replacement?

Good point.  We should have a project-wide standard on "java #ifdef".
Feel free to propose something.


>
> --
> Egor Pasko, Intel Managed Runtime Division
>
>
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
>


-- 
Weldon Washburn
Intel Middleware Products Division

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Mime
View raw message