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 * @bug 8146416
27 * @library /test/lib /testlibrary /
28 * @build sun.hotspot.WhiteBox
29 * @run main ClassFileInstaller sun.hotspot.WhiteBox
30 * sun.hotspot.WhiteBox$WhiteBoxPermission
31 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbatch -XX:CompileCommand=exclude,DeoptReallocFailure::main -Xmx100m DeoptReallocFailure
32 *
33 */
34 import java.lang.reflect.Method;
35 import sun.hotspot.WhiteBox;
36
37 class MemoryChunk {
38 MemoryChunk other;
39 Object[][] array;
40
41 MemoryChunk(MemoryChunk other) {
42 this.other = other;
43 array = new Object[1024 * 256][];
44 }
45 }
46
47 class NoEscape {
48 long f1;
49 }
50
51 public class DeoptReallocFailure {
52
53 static MemoryChunk root;
54 private static final WhiteBox WB = WhiteBox.getWhiteBox();
55
56 public static synchronized long test() {
57 NoEscape[] noEscape = new NoEscape[45];
58 noEscape[0] = new NoEscape();
59 for (int i=0;i<1024*256;i++) {
60 root.array[i]= new Object[45];
61 }
62 return noEscape[0].f1;
63 }
64
65 public static void main(String[] args) throws Throwable {
66
67 //Exhaust Memory
68 root = null;
69 try {
70 while (true) {
71 root = new MemoryChunk(root);
72 }
|
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 * @bug 8146416
27 * @library /test/lib /testlibrary /
28 *
29 * @build sun.hotspot.WhiteBox
30 * @run driver ClassFileInstaller sun.hotspot.WhiteBox
31 * sun.hotspot.WhiteBox$WhiteBoxPermission
32 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
33 * -XX:+WhiteBoxAPI -Xbatch -Xmx100m
34 * -XX:CompileCommand=exclude,compiler.uncommontrap.DeoptReallocFailure::main
35 * compiler.uncommontrap.DeoptReallocFailure
36 *
37 */
38
39 package compiler.uncommontrap;
40
41 import sun.hotspot.WhiteBox;
42
43 import java.lang.reflect.Method;
44
45 public class DeoptReallocFailure {
46 static class MemoryChunk {
47 MemoryChunk other;
48 Object[][] array;
49
50 MemoryChunk(MemoryChunk other) {
51 this.other = other;
52 array = new Object[1024 * 256][];
53 }
54 }
55
56 static class NoEscape {
57 long f1;
58 }
59
60 static MemoryChunk root;
61 private static final WhiteBox WB = WhiteBox.getWhiteBox();
62
63 public static synchronized long test() {
64 NoEscape[] noEscape = new NoEscape[45];
65 noEscape[0] = new NoEscape();
66 for (int i=0;i<1024*256;i++) {
67 root.array[i]= new Object[45];
68 }
69 return noEscape[0].f1;
70 }
71
72 public static void main(String[] args) throws Throwable {
73
74 //Exhaust Memory
75 root = null;
76 try {
77 while (true) {
78 root = new MemoryChunk(root);
79 }
|