Path: blob/master/test/hotspot/jtreg/vmTestbase/jit/regression/b4446672/b4446672.java
41159 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* @bug 444667226*27* @summary converted from VM Testbase jit/regression/b4446672.28* VM Testbase keywords: [jit, quick]29*30* @library /vmTestbase31* /test/lib32* @run main/othervm jit.regression.b4446672.b444667233*/3435package jit.regression.b4446672;3637import nsk.share.TestFailure;3839public class b4446672 {4041public static void main(String[] args) {42new b4446672().run();43}4445private void run() {46new GCThread().start();47new TestThreadStarter().start();4849while (!gcing) Thread.yield();50while (!starting) Thread.yield();51done = true;52while (!testing) Thread.yield();53}5455class TestThread extends Thread {56public void run() {57System.out.println ("TestThread.");58testing = true;59}60}6162class TestThreadStarter extends Thread {63public void run() {64System.out.println ("TestThreadStarter.");65starting=true;66testThread.start();67}68}6970class GCThread extends Thread {71public void run() {72System.out.println ("GCThread run.");73synchronized (testThread) {74System.out.println ("GCThread synchronized.");75while (!done) {76gcing=true;77Thread.yield();78System.gc();79}80}81System.out.println ("GCThread done.");82}83}8485TestThread testThread = new TestThread();86boolean done = false;87boolean gcing = false;88boolean testing = false;89boolean starting = false;90}919293