Return-Path: Delivered-To: apmail-incubator-harmony-dev-archive@www.apache.org Received: (qmail 54971 invoked from network); 5 Jul 2006 00:36:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Jul 2006 00:36:55 -0000 Received: (qmail 14676 invoked by uid 500); 5 Jul 2006 00:36:52 -0000 Delivered-To: apmail-incubator-harmony-dev-archive@incubator.apache.org Received: (qmail 14513 invoked by uid 500); 5 Jul 2006 00:36:51 -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 14502 invoked by uid 99); 5 Jul 2006 00:36:51 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Jul 2006 17:36:51 -0700 X-ASF-Spam-Status: No, hits=2.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,RCVD_IN_BL_SPAMCOP_NET,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of gshimansky@gmail.com designates 66.249.92.172 as permitted sender) Received: from [66.249.92.172] (HELO ug-out-1314.google.com) (66.249.92.172) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Jul 2006 17:36:50 -0700 Received: by ug-out-1314.google.com with SMTP id q2so1525138uge for ; Tue, 04 Jul 2006 17:36:28 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:reply-to:to:subject:date:user-agent:references:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:message-id; b=bXmfYaCVjtC6FGHiAVloQAYaSIXSkdb8BSPJN2E4uhAm4FjBTzEOHWdU7O75iRRN4oTDRtexXrXXmOEVKUmCUY0FwSMXC95XODfdD2t/VfiLXGhN4y1OgBh9j9R34hCkhBfMvv8kW1QAniu+hqxSM6dfTN6lc1tsRj2Lb0ffwwk= Received: by 10.66.240.12 with SMTP id n12mr7102981ugh; Tue, 04 Jul 2006 17:36:28 -0700 (PDT) Received: from ppp83-237-44-37.pppoe.mtu-net.ru ( [83.237.44.37]) by mx.gmail.com with ESMTP id w40sm937752ugc.2006.07.04.17.36.27; Tue, 04 Jul 2006 17:36:28 -0700 (PDT) From: Gregory Shimansky Reply-To: harmony-dev@incubator.apache.org To: harmony-dev@incubator.apache.org Subject: Re: [drlvm] Signed jars cannot be used in classpath Date: Wed, 5 Jul 2006 04:36:25 +0400 User-Agent: KMail/1.9.1 References: <200607010259.50768.gshimansky@gmail.com> <200607050400.35464.gshimansky@gmail.com> In-Reply-To: <200607050400.35464.gshimansky@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200607050436.25905.gshimansky@gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hello I've found a flaw in my logic (while trying to go to sleep this early in the morning) down below because it is Platform.FILE_SYSTEM which has to be uninitialized while I've written that it is Platform.NETWORK_SYSTEM. I think I've just got line lumbers shifted somehow due to attempts to add debug prints into classlib. I am still sure that my idea about uninitialized constants in bootstrap is correct. It is not the first time I see this. On Wednesday 05 July 2006 04:00 Gregory Shimansky wrote: > On Tuesday 04 July 2006 14:00 Alexey Varlamov wrote: > > > > This is AFAIK something that drlvm doesn't have in kernel classes at > > > > the moment. I think the correct way to fix the problem would be to > > > > add one and invoke it somehow... but I don't really know the > > > > subtleties of classloader hierarchy so I am not sure how and when it > > > > should be invoked. > > > > > > Hmm, yes that is something that needs fixing. > > > > I volunteer to look into this. > > It looks like the most recent changes to classlib in file operations > created an unresolved bootstrap dependency if security/ directory with its > rules and policies is copied from classlib's lib/ to drlvm lib/ directory. > In this case security cannot initialize correctly because the field > FileInputStream.fileSystem is null at the moment when it is needed. Stack > trace looks like this: > > ****** STACK DUMP: ************ > java/io/FileInputStream.(Ljava/io/File;)V (FileInputStream.java:66) > java/security/Security$1.run()Ljava/lang/Object; (Security.java:113) > java/security/AccessController.doPrivilegedImpl(Ljava/security/PrivilegedAc >tion;Ljava/security/AccessControlContext;)Ljava/lang/Object; (NULL:-1) > java/security/AccessController.doPrivileged(Ljava/security/PrivilegedAction >;)Ljava/lang/Object; (NULL:-1) > java/security/Security.()V (Security.java:116) > org/apache/harmony/security/fortress/PolicyUtils$SecurityPropertyAccessor.r >un()Ljava/lang/String; (PolicyUtils.java:148) > org/apache/harmony/security/fortress/PolicyUtils$SecurityPropertyAccessor.r >un()Ljava/lang/Object; (PolicyUtils.java:127) > java/security/AccessController.doPrivilegedImpl(Ljava/security/PrivilegedAc >tion;Ljava/security/AccessControlContext;)Ljava/lang/Object; (NULL:-1) > java/security/AccessController.doPrivileged(Ljava/security/PrivilegedAction >;)Ljava/lang/Object; (NULL:-1) > java/security/Policy.getDefaultProvider()Ljava/security/Policy; > (Policy.java:150) > java/security/Policy.getAccessiblePolicy()Ljava/security/Policy; > (Policy.java:195) > java/security/Policy.getPolicy()Ljava/security/Policy; (Policy.java:131) > java/lang/ClassLoader.()V (NULL:-1) > java/lang/Class.desiredAssertionStatus()Z (NULL:-1) > java/util/HashMap.()V (HashMap.java:27) > org/apache/harmony/luni/platform/AdapterManager.()V > (AdapterManager.java:34) > org/apache/harmony/luni/platform/Platform.()V (Platform.java:34) > java/io/FileOutputStream.(Ljava/io/FileDescriptor;)V > (FileOutputStream.java:119) > java/lang/System.createErr()Ljava/io/PrintStream; (NULL:-1) > java/lang/System.()V (NULL:-1) > java/lang/Thread.(Ljava/lang/ThreadGroup;Ljava/lang/Runnable;Ljava/la >ng/String;J)V (NULL:-1) > java/lang/Thread.()V (NULL:-1) > > At first I was curious as to why FileInputStream. is not in the > stack, but I did bytecode dump and found that Sun's javac 1.5 optimized > methods to include code into them. So it included line > > private IFileSystem fileSystem = Platform.getFileSystem(); > > into constructor's code and so the value of IFileSystem FILE_SYSTEM from > Platform was returned. But since Platform. is clearly in the stack, > Platform's was not finished yet by that time. Dumping bytecode for > compiled Platform shows that line 34 is really the assignment of constant > NETWORK_SYSTEM which turns out to be null later down the stack. > > This is a quite fundamental problem with classlib's bootstrap and we don't > have any defined bootstrap sequence. When something is initialized in > there is no way to be 100% sure it is really initialized in many > classes which are commonly used because is called only once and > bootstrap recursion may get to call some methods of a class before > actually completes. The workaround for this is instead of using > > Whatever WHATEVER1 = Something.something(); > or > > Whatever WHATEVER2 = new Whatever(); > > do the following > > method() { > if (WHATEVER1 == null) > WHATEVER1 = Something.something(); > > if (WHATEVER2 == null) > WHATEVER2 = new Whatever(); > } > > but this is ugly, inefficient and my in theory turn classlib bootstrap into > infinite recursion. > > I don't know a general solution for this. The order of class resolution, > java compiler optimizations and other factors may affect the bootstrap > sequence. -- Gregory Shimansky, 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