Return-Path: Delivered-To: apmail-incubator-harmony-dev-archive@www.apache.org Received: (qmail 36584 invoked from network); 9 Nov 2006 17:19:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Nov 2006 17:19:02 -0000 Received: (qmail 58380 invoked by uid 500); 9 Nov 2006 17:19:09 -0000 Delivered-To: apmail-incubator-harmony-dev-archive@incubator.apache.org Received: (qmail 58347 invoked by uid 500); 9 Nov 2006 17:19:09 -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 58338 invoked by uid 99); 9 Nov 2006 17:19:09 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Nov 2006 09:19:09 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of gcjhd-harmony-dev@m.gmane.org designates 80.91.229.2 as permitted sender) Received: from [80.91.229.2] (HELO ciao.gmane.org) (80.91.229.2) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Nov 2006 09:18:55 -0800 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1GiDXQ-0007ys-AO for harmony-dev@incubator.apache.org; Thu, 09 Nov 2006 18:18:06 +0100 Received: from msfwpr01.ims.intel.com ([62.118.80.132]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 09 Nov 2006 18:18:04 +0100 Received: from Salikh.Zakirov by msfwpr01.ims.intel.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 09 Nov 2006 18:18:04 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: harmony-dev@incubator.apache.org From: Salikh Zakirov Subject: Re: [drlvm] Class unloading support - tested one approach Date: Thu, 09 Nov 2006 20:17:24 +0300 Lines: 43 Message-ID: References: <5836de490610240251p120dfa56x736fbb5eb1898aca@mail.gmail.com> <4551B15B.2070101@anu.edu.au> <5836de490611080250l6dfbd38cw8778f7a055373d82@mail.gmail.com> <4551B83D.9020706@anu.edu.au> <4551CBDB.90004@anu.edu.au> <45531ED7.7030904@sablevm.org> <455324E1.2040301@anu.edu.au> <45535741.2080207@sablevm.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: msfwpr01.ims.intel.com User-Agent: Thunderbird 1.5.0.7 (Windows/20060909) In-Reply-To: <45535741.2080207@sablevm.org> Sender: news X-Virus-Checked: Checked by ClamAV on apache.org Etienne Gagnon wrote: > "Revival" is only needed if you use the finalization-like approach. If > you only do class-unloading GC when the nursery is empty, then no > revival is needed. Ah, I think I got it. You mean running a minor collection, and then "class unloading" full heap collection sequentially, without any mutator work in between? Then, the correctness is observed easily: 1) all mature objects has their vtable marks set to 1 2) after minor collection, the nursery is empty => all live objects already have vtable marks == 1 Thus, if we find a classloader with vtable marks == 0, then it has no object instances, and its reachability is defined solely by reachability of java.lang.ClassLoader instance and existence of the method frames, which can be checked, respectively, by enumerating class loader roots as weak roots, and scanning stacks. Note, that the class loader, which became eligible for unloading during epoch N, will not be unloaded until the end of the epoch N+1. However, in the case of non-generational collector, the "minor collection followed by unloading collection" becomes effectively two successive garbage collections. On the other side, "finalization-like" design goes as follows: 1) clean vtable marks before "class unloading" collection 2) enumerate classloader roots as weak and collect array of user classloader pointers for later use -- let's call it "unload list" 3) trace the heap 4) scan vtable marks and "revive" marked class unloaders, by adding the strong root from the previously collected "unload list". Remove the revived classloaders from unload list. 5) repeat steps (3) and (4) until there is no classloaders to revive 6) unload the classloaders, pointed by the "unload list" -- this reclaims native resources 7) let the GC finish collection and reclaim unreachable objects -- this reclaims java objects This design unloads classloaders at the end of the very same epoch when they became unloadable. The voting definitely was premature, as it turns out that even the design under discussion can be elaborated to multiple substantially different designs.