Return-Path: Delivered-To: apmail-incubator-harmony-dev-archive@www.apache.org Received: (qmail 76443 invoked from network); 13 Oct 2006 09:25:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 13 Oct 2006 09:25:39 -0000 Received: (qmail 99716 invoked by uid 500); 13 Oct 2006 09:25:36 -0000 Delivered-To: apmail-incubator-harmony-dev-archive@incubator.apache.org Received: (qmail 99682 invoked by uid 500); 13 Oct 2006 09:25:35 -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 99671 invoked by uid 99); 13 Oct 2006 09:25:35 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Oct 2006 02:25:35 -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, 13 Oct 2006 02:25:34 -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 <0J72003D9I60I040@messaging2.anu.edu.au> for harmony-dev@incubator.apache.org; Fri, 13 Oct 2006 19:25:12 +1000 (EST) Date: Fri, 13 Oct 2006 19:25:54 +1000 From: Robin Garner Subject: Re: [drlvm] The first GC helper with fast-path implemented in Java: gc_alloc In-reply-to: To: harmony-dev@incubator.apache.org Message-id: <452F5BA2.2080706@anu.edu.au> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7BIT References: <9623c9a50610112041t5e1851cek96c15b133d723140@mail.gmail.com> <9623c9a50610122009n7f1eba4cpfe7f40a3cd83a7ef@mail.gmail.com> <51d555c70610130055v6a8cd57eq995763a1f0b3cefa@mail.gmail.com> User-Agent: Thunderbird 1.5.0.7 (X11/20060922) X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Mikhail Fursov wrote: > On 10/13/06, Rana Dasgupta wrote: >> >> Why is this a problem, am I misunderstanding? Even with conventional >> helpers, the jit needs to know the helper method signatures. We don't >> need >> to worry about universality of GC's. Any compatible GC will need to >> implement exactly the same helper fastpath contract interface as Xiao >> Feng >> says elsewhere. > > > Yes. The only amendment from me is that JIT does not want to know if GC is > compatible or not. For example some GC developers may try to implement bump > pointer allocation by decrementing the offset in a block (like a stack) or > to do some cleaning like Ivan did. > But I'm agree with you that our GCv4.1 and GC_GEN could use the same > fast-path helper. > > I asked this question because of MMTk collectors. It has slightly different > format of the allocation sequence. If you look into the WB helpers you see > that the difference is even more than allocation one. IIRC the MMTk WB > helper needs 4 params to be reported from JIT while our GC_GEN only 2. > So we > have to support in JIT different versions of the same helper. As far as the MMTk 'alloc' method goes, MMTk is simply providing flexibility that you don't need to use if you don't want to. The Java helper can supply default values for alignment and allocator, and MMTk won't mind. The barriers are slightly different. We require the Source object, target object and slot in order to a) be a substituting write barrier, b) implement object-remembering barriers, c) implement reference counting. The fourth parameter differentiates between ASTORE, AASTORE and PUTSTATIC barriers, and again if you only have one of these (or take the same action in all cases), a hard-wired default will do. If there's a really good reason you can only supply slot and target, some of the MMTk generational collectors (eg GenMS) will work, but some of the more interesting ones like GenRC won't. > >> I don't think that the jit needs to know that an object being >> finalizable >> implies not to invoke the fastpath. This to me suggests that the jit >> determines allocation policy. I don't see a problem passing the object >> typeinfo or allocation handle to the helper. It is needed for object init >> anyway. > > > Doing isFinalizable check during a compile time instead of runtime looks > like a reasonable optimization to me.Moreover, once you want to do it in > runtime, you have to add special magic isFinalizable(type). So we can add > such an option (configurable from the command-line or property file) to the > JIT. There are reasons why the JIT might want to - if not control, then at least influence - allocation policy. Pretenuring is one optimization that comes to mind. One advantage of controlling allocation through method parameters is that if they are statically resolvable, they are easy for the compiler to optimize out after constant propagation. Having the compiler specialize code that involves (eg) looking up an allocation handle is a much bigger ask than checking a bit in a parameter. MMTk takes advantage of this quite a lot - the allocation fastpath of a typical plan may look impossibly heavy at first glance, but in most cases it optimizes out to a handful of instructions. Designing the interface in a way that appears like you are dynamically checking for finalizability(is that a word?), coupled with some constant folding and dead code elimination can give you the best of both worlds. It allows you to implement compile time optimization (in which case inlining, constant folding, dead code elimination etc do the work), but also gives you the opportunity to implement initially a slow way, and if there are infrequent difficult cases, leave them as runtime checks. cheers -- 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