Return-Path: Delivered-To: apmail-incubator-harmony-dev-archive@www.apache.org Received: (qmail 17065 invoked from network); 18 Aug 2006 10:15:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 18 Aug 2006 10:15:10 -0000 Received: (qmail 54352 invoked by uid 500); 18 Aug 2006 10:15:07 -0000 Delivered-To: apmail-incubator-harmony-dev-archive@incubator.apache.org Received: (qmail 54289 invoked by uid 500); 18 Aug 2006 10:15:06 -0000 Mailing-List: contact harmony-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-dev@incubator.apache.org Received: (qmail 54278 invoked by uid 99); 18 Aug 2006 10:15:06 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Aug 2006 03:15:06 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [130.56.64.72] (HELO messaging2.anu.edu.au) (130.56.64.72) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Aug 2006 03:15:03 -0700 Received: from [150.203.163.99] by messaging2.anu.edu.au (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTP id <0J4600CU8V4GJI30@messaging2.anu.edu.au> for harmony-dev@incubator.apache.org; Fri, 18 Aug 2006 20:14:41 +1000 (EST) Date: Fri, 18 Aug 2006 20:14:55 +1000 From: Robin Garner Subject: Re: [drlvm][vm, mmtk] adding thread-local storage functionality to vmmagic In-reply-to: To: harmony-dev@incubator.apache.org Message-id: <44E5931F.2010503@anu.edu.au> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7BIT References: <4dd1f3f00608161412l6fae05afm48b73b864d61b842@mail.gmail.com> <4dd1f3f00608170541of0093f0g82ebbc89f4289059@mail.gmail.com> User-Agent: Thunderbird 1.5.0.5 (X11/20060728) X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Egor Pasko wrote: > On the 0x1C8 day of Apache Harmony Mikhail Fursov wrote: > >> Egor, >> Why do you think we need to support platform specific issues in helpers? Is >> there any example that shows that we can't write a helper without reference >> platform details? >> > > It depends on how much of a helper code we want to write in Java. We > can always say: "hey, this is platform-dependent, let it be a whole > vmmagic and let JIT take care". If it is a large piece of code, > it is not good to code it down in JIT IR(s) and is better written in > Java. I think, we all agree here. > > As a 1 more example ... maybe some day we decide to inline fast-path > of spinlocks. > > Which is a) a helper b) is platfrom-dependent. > > Implementing fast-path-spins in JIT IR is not a lot to do. But > specifying the interface and updating all components (JITs) to handle > that way of interaction on all platforms .. may make a burden. Coding > spin-locking in Java would make it difficult to write optimal (think of > explicitly parallel architectures...) > > Both approaches seem to be quite complicated here. But all-in-JIT > approach seems to have more chances to be faster here. > > Thus, it would be good to have both: > * vmmagic (inlined by JITs) > * helpers (partially) written in Java (using vmmagic) > and decide how fine-grained those magics should be depending on > specific situation. > > >> I think we should avoid #ifdef's in Java as much as we can. >> > > Yes, my vision is the same. At least, until we come accross a large > piece of system-dependent code that is good to be inlined by JIT. I > think, it is not likely to happen, large pieces of code tend to work > longer :) and inlining them does not give so much benefit.. > > Jikesrvm uses "//-#if" style constructs for platform-specific codes, and it's something we are working hard to get rid of. I think it's something you should definitely avoid at all costs. One possible alternative is to use annotations instead, and the preprocessing infrastructure that goes with them. But it's always better to try to abstract over the particular concern somehow. As a last resort, write platform-specific versions of whole classes, and selectively include them at compile time. Of course chase down the platform specific bits so they are as small as possible. My thoughts on the thread-local storage issue is that it's a more general issue of accessing shared data structures from the Java side of the fence. So perhaps a method such as Object org.vmmagic.utility.accessVmStructure() or even better, declare object instances with a pragma annotation @IntrinsicDataStructure("name") MutatorContext myMutatorContext; and the compiler generates code to fetch the address. Has better type safety, potentially. -- robin --------------------------------------------------------------------- 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