Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 33251 invoked from network); 28 Sep 2007 11:05:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Sep 2007 11:05:14 -0000 Received: (qmail 33910 invoked by uid 500); 28 Sep 2007 11:05:04 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 33883 invoked by uid 500); 28 Sep 2007 11:05:04 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 33874 invoked by uid 99); 28 Sep 2007 11:05:04 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Sep 2007 04:05:04 -0700 X-ASF-Spam-Status: No, hits=-98.8 required=10.0 tests=ALL_TRUSTED,DNS_FROM_DOB,RCVD_IN_DOB X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Sep 2007 11:07:35 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id EC3B6714209 for ; Fri, 28 Sep 2007 04:04:50 -0700 (PDT) Message-ID: <13285762.1190977490965.JavaMail.jira@brutus> Date: Fri, 28 Sep 2007 04:04:50 -0700 (PDT) From: "Mikhail Loenko (JIRA)" To: commits@harmony.apache.org Subject: [jira] Closed: (HARMONY-4409) [drlvm][verifier] Harmony throws VerifyError (Incompatible argument for function) on generics/varargs specific bytecode while RI doesn't In-Reply-To: <26583888.1184071564702.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HARMONY-4409?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Mikhail Loenko closed HARMONY-4409. ----------------------------------- > [drlvm][verifier] Harmony throws VerifyError (Incompatible argument for function) on generics/varargs specific bytecode while RI doesn't > ---------------------------------------------------------------------------------------------------------------------------------------- > > Key: HARMONY-4409 > URL: https://issues.apache.org/jira/browse/HARMONY-4409 > Project: Harmony > Issue Type: Bug > Components: DRLVM > Reporter: Nina Rinskaya > Assignee: Mikhail Loenko > Priority: Minor > > Harmony throws VerifyError (Incompatible argument for function) on generics/varargs specific bytecode while RI doesn't. > This issue affects 1 EUT 3.2/3.3 testcase: org.eclipse.jdt.core.tests.compiler.regression.VarargsTest.test030 - 1.5 > To reproduce: > Compile the testcase below using Sun javac or BEA javac or Eclipse 3.3 compiler: > ---- X.java ---- > public class X { > public static void main(String[] args) { > test("X", new Integer(1)); > System.out.println("PASSED"); > } > public static void test(A... args) { > } > } > ---- End of X.java ---- > If you compile this code with Sun javac 1.5 (same with BEA 1.5/ Eclipse compiler 3.3), you'll get the following bytecode: > $javap -c X > Compiled from "X.java" > public class X extends java.lang.Object{ > public X(); > Code: > 0: aload_0 > 1: invokespecial #1; //Method java/lang/Object."":()V > 4: return > public static void main(java.lang.String[]); > Code: > 0: iconst_2 > 1: anewarray #2; //class java/io/Serializable > 4: dup > 5: iconst_0 > 6: ldc #3; //String X > 8: aastore > 9: dup > 10: iconst_1 > 11: new #4; //class java/lang/Integer > 14: dup > 15: iconst_1 > 16: invokespecial #5; //Method java/lang/Integer."":(I)V > 19: aastore > 20: invokestatic #6; //Method test:([Ljava/lang/Comparable;)V > 23: getstatic #7; //Field java/lang/System.out:Ljava/io/PrintStream; > 26: ldc #8; //String PASSED > 28: invokevirtual #9; //Method java/io/PrintStream.println:(Ljava/lang/String;)V > 31: return > public static void test(java.lang.Comparable[]); > Code: > 0: return > } > ---------------------------------- > Output on RI (Sun 1.5 and BEA 1.5, Sun 1.5 with -Xfuture option): > java version "1.5.0_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) > Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode) > PASSED > Output on Harmony: > Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable. > java version "1.5.0" > pre-alpha : not complete or compatible > svn = r551077, (Jun 27 2007), Windows/ia32/msvc 1310, release build > http://harmony.apache.org > Uncaught exception in main: > java.lang.VerifyError: (class: X, method: main([Ljava/lang/String;)V) Incompatible argument for function > FAILED to invoke JVM. > Ouput on Harmony with -noverify: > Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable. > java version "1.5.0" > pre-alpha : not complete or compatible > svn = r551077, (Jun 27 2007), Windows/ia32/msvc 1310, release build > http://harmony.apache.org > PASSED > ---------------------------------- > It looks that Harmony reports java.lang.VerifyError: (class: X, method: main([Ljava/lang/String;)V) Incompatible argument for function because of > 1: anewarray #2; //class java/io/Serializable > and > 20: invokestatic #6; //Method test:([Ljava/lang/Comparable;)V > For some reasons if all actual varargs method arguments implement specific interfaces (I reproduced it for java.io.Serializable, java.lang.Comparable, but it's not reproducible with custom interfaces and some other J2SE API interfaces. If both Comparable and Serializable are implemented, Serilalizable would be selected as array type) javac creates an array of this interface type for varargs arguments. RI verifier accepts such array as vararg method argument, but HY doesn't. It's not reproducible with non-generic types. > BCEL 5.2 tool (http://jakarta.apache.org/bcel) also reports verification issue: > java -cp C:\work\harmony-hdk-551077\jdk\jre\lib\boot\bcel-5.2\bcel-5.2.jar;. org.apache.bcel.verifier.Verifier X.class > ... > Pass 3b, method number 1 ['public static void main(String[] arg0)']: > VERIFIED_REJECTED > Constraint violated in method 'public static void main(String[] arg0)': > Instruction INVOKESTATIC constraint violated: Expecting a 'java.lang.Comparable[]' but found a 'java.io.Serializable[]' on the stack ( > which is not assignment compatible). > InstructionHandle: 20: invokestatic[184](3) 6 > ... > Unfortunately I can't find the expected behavior description in VM spec to prove which behavior is correct (invokestatic description says "The operand stack must contain nargs argument values, where the number, type, and order of the values must be consistent with the descriptor of the resolved method" where it's not clear what "consistent" means) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.