1 /* 2 * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* 25 * @test 26 * 27 * @summary converted from VM Testbase jit/t/t064. 28 * VM Testbase keywords: [jit, quick] 29 * 30 * @library /vmTestbase 31 * /test/lib 32 * @run driver jdk.test.lib.FileInstaller . . 33 * @build jit.t.t064.t064 34 * @run driver ExecDriver --java jit.t.t064.t064 35 */ 36 37 package jit.t.t064; 38 39 import nsk.share.TestFailure; 40 import nsk.share.GoldChecker; 41 42 // Main() does getstatics of k.b and putstatics of l.b. K.set() does putstatics 43 // of k.b; l.show() does getstatics of l.b. The idea is, you jit only 44 // main. If the jit and the VM agree about the container size of a static 45 // field of type byte, you get the right answers. If not, the test fails. 46 class k 47 { 48 static byte b; 49 static int i = -129; set()50 static void set() 51 { 52 b = (byte) i; 53 ++i; 54 } 55 } 56 57 class l 58 { 59 static byte b; 60 static int i = -129; show()61 static void show() 62 { 63 t064.goldChecker.println("l.b == " + b); 64 } 65 } 66 67 class t064 68 { 69 public static final GoldChecker goldChecker = new GoldChecker( "t064" ); 70 main(String argv[])71 public static void main(String argv[]) 72 { 73 int i; 74 for(i=0; i<258; i+=1) 75 { 76 k.set(); 77 t064.goldChecker.println("k.b == " + k.b); 78 l.b = (byte) l.i; 79 ++l.i; 80 l.show(); 81 } 82 t064.goldChecker.check(); 83 } 84 } 85