Path: blob/master/test/hotspot/jtreg/vmTestbase/jit/t/t042/t042.java
40948 views
/*1* Copyright (c) 2008, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25*26* @summary converted from VM Testbase jit/t/t042.27* VM Testbase keywords: [jit, quick]28*29* @library /vmTestbase30* /test/lib31* @run main/othervm jit.t.t042.t04232*/3334package jit.t.t042;3536import nsk.share.TestFailure;37import nsk.share.GoldChecker;3839// The special little twiddle that occurs when you invoke a method40// of an array.4142public class t04243{44public static final GoldChecker goldChecker = new GoldChecker( "t042" );4546static void sameAs(Object x, Object y, String call)47{48t042.goldChecker.print(call + ": ");49if(x == null)50t042.goldChecker.println("left object is null");51if(x != null)52t042.goldChecker.println(x.equals(y));53}5455public static void main(String argv[])56{57int a[] = new int[3];58int b[] = null;59int c[] = a;60Object x = a;61Object y = new Object();62Object z = null;6364sameAs(a, a, "sameAs(a, a)");65sameAs(a, b, "sameAs(a, b)");66sameAs(a, c, "sameAs(a, c)");67sameAs(a, x, "sameAs(a, x)");68sameAs(a, y, "sameAs(a, y)");69sameAs(a, z, "sameAs(a, z)");7071t042.goldChecker.println();72sameAs(b, a, "sameAs(b, a)");73sameAs(b, b, "sameAs(b, b)");74sameAs(b, c, "sameAs(b, c)");75sameAs(b, x, "sameAs(b, x)");76sameAs(b, y, "sameAs(b, y)");77sameAs(b, z, "sameAs(b, z)");7879t042.goldChecker.println();80sameAs(c, a, "sameAs(c, a)");81sameAs(c, b, "sameAs(c, b)");82sameAs(c, c, "sameAs(c, c)");83sameAs(c, x, "sameAs(c, x)");84sameAs(c, y, "sameAs(c, y)");85sameAs(c, z, "sameAs(c, z)");8687t042.goldChecker.println();88sameAs(x, a, "sameAs(x, a)");89sameAs(x, b, "sameAs(x, b)");90sameAs(x, c, "sameAs(x, c)");91sameAs(x, x, "sameAs(x, x)");92sameAs(x, y, "sameAs(x, y)");93sameAs(x, z, "sameAs(x, z)");9495t042.goldChecker.println();96sameAs(y, a, "sameAs(y, a)");97sameAs(y, b, "sameAs(y, b)");98sameAs(y, c, "sameAs(y, c)");99sameAs(y, x, "sameAs(y, x)");100sameAs(y, y, "sameAs(y, y)");101sameAs(y, z, "sameAs(y, z)");102103t042.goldChecker.println();104sameAs(z, a, "sameAs(z, a)");105sameAs(z, b, "sameAs(z, b)");106sameAs(z, c, "sameAs(z, c)");107sameAs(z, x, "sameAs(z, x)");108sameAs(z, y, "sameAs(z, y)");109sameAs(z, z, "sameAs(z, z)");110t042.goldChecker.check();111}112}113114115