Wed, 28 Aug 2013 19:25:18 -0400
8023900: [TESTBUG] Initial compact profile test groups need adjusting
Reviewed-by: dcubed, mchung, hseigel
1 /*
2 * Copyright (c) 2009, 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 */
24 /**
25 * @test
26 * @bug 6589834
27 * @summary deoptimization problem with -XX:+DeoptimizeALot
28 *
29 * @run main Test_ia32
30 */
32 /***************************************************************************************
33 NOTE: The bug shows up (with several "Bug!" message) even without the
34 flag -XX:+DeoptimizeALot. In a debug build, you may want to try
35 the flags -XX:+VerifyStack and -XX:+DeoptimizeALot to get more information.
36 ****************************************************************************************/
37 import java.lang.reflect.Constructor;
39 public class Test_ia32 {
41 public static int NUM_THREADS = 100;
43 public static int CLONE_LENGTH = 1000;
45 public static void main(String[] args) throws InterruptedException, ClassNotFoundException {
47 Reflector[] threads = new Reflector[NUM_THREADS];
48 for (int i = 0; i < threads.length; i++) {
49 threads[i] = new Reflector();
50 threads[i].start();
51 }
53 System.out.println("Give Reflector.run() some time to compile...");
54 Thread.sleep(5000);
56 System.out.println("Load RMISecurityException causing run() deoptimization");
57 ClassLoader.getSystemClassLoader().loadClass("java.rmi.RMISecurityException");
59 for (Reflector thread : threads)
60 thread.requestStop();
62 for (Reflector thread : threads)
63 try {
64 thread.join();
65 } catch (InterruptedException e) {
66 System.out.println(e);
67 }
69 }
71 }
73 class Reflector extends Thread {
75 volatile boolean _doSpin = true;
77 Test_ia32[] _tests;
79 Reflector() {
80 _tests = new Test_ia32[Test_ia32.CLONE_LENGTH];
81 for (int i = 0; i < _tests.length; i++) {
82 _tests[i] = new Test_ia32();
83 }
84 }
86 static int g(int i1, int i2, Test_ia32[] arr, int i3, int i4) {
88 if (!(i1==1 && i2==2 && i3==3 && i4==4)) {
89 System.out.println("Bug!");
90 }
92 return arr.length;
93 }
95 static int f(Test_ia32[] arr) {
96 return g(1, 2, arr.clone(), 3, 4);
97 }
99 @Override
100 public void run() {
101 Constructor[] ctrs = null;
102 Class<Test_ia32> klass = Test_ia32.class;
103 try {
104 ctrs = klass.getConstructors();
105 } catch (SecurityException e) {
106 System.out.println(e);
107 }
109 try {
110 while (_doSpin) {
111 if (f(_tests) < 0)
112 System.out.println("return value usage");
113 }
114 } catch (NullPointerException e) {
115 e.printStackTrace();
116 }
118 System.out.println(this + " - stopped.");
119 }
121 public void requestStop() {
122 System.out.println(this + " - stop requested.");
123 _doSpin = false;
124 }
126 }