Path: blob/master/test/hotspot/jtreg/compiler/runtime/cr6891750/Test6891750.java
41153 views
/*1* Copyright (c) 2009, 2018, 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* @bug 689175026* @summary deopt blob kills values in O527* @run main/othervm compiler.runtime.cr6891750.Test689175028*/2930package compiler.runtime.cr6891750;3132abstract class Base6891750 extends Thread {33abstract public long m();34}35class Other6891750 extends Base6891750 {36public long m() {37return 0;38}39}4041public class Test6891750 extends Base6891750 {42Base6891750 d;43volatile long value = 9;4445static int limit = 400000;4647Test6891750() {48d = this;4950}51public long m() {52return value;53}5455public long test(boolean doit) {56if (doit) {57long total0 = 0;58long total1 = 0;59long total2 = 0;60long total3 = 0;61long total4 = 0;62long total5 = 0;63long total6 = 0;64long total7 = 0;65long total8 = 0;66long total9 = 0;67for (int i = 0; i < limit; i++) {68total0 += d.m();69total1 += d.m();70total2 += d.m();71total3 += d.m();72total4 += d.m();73total5 += d.m();74total6 += d.m();75total7 += d.m();76total8 += d.m();77total9 += d.m();78}79return total0 + total1 + total2 + total3 + total4 + total5 + total6 + total7 + total8 + total9;80}81return 0;82}8384public void run() {85long result = test(true);86for (int i = 0; i < 300; i++) {87long result2 = test(true);88if (result != result2) {89throw new InternalError(result + " != " + result2);90}91}92}9394public static void main(String[] args) throws Exception {95Test6891750 Test6891750 = new Test6891750();96// warm it up97for (int i = 0; i < 200000; i++) {98Test6891750.test(false);99}100// set in off running101Test6891750.start();102Thread.sleep(2000);103104// Load a class to invalidate CHA105new Other6891750();106}107}108109110