hotspot/test/compiler/6852078/Test6852078.java
author drchase
Tue, 26 Feb 2013 15:38:24 -0800
changeset 15815 7691985f1fe3
parent 5547 f4b087cbb361
permissions -rw-r--r--
8007776: Test6852078.java timeouts Summary: if more than 100 seconds and more than 100 iterations have both passed, then exit is allowed. Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4428
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
     1
/*
15815
7691985f1fe3 8007776: Test6852078.java timeouts
drchase
parents: 5547
diff changeset
     2
 * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
4428
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
     4
 *
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
     7
 * published by the Free Software Foundation.
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
     8
 *
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    13
 * accompanied this code).
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    14
 *
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4428
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4428
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4428
diff changeset
    21
 * questions.
4428
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    22
 *
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    23
 */
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    24
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    25
/**
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    26
 * @test
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    27
 * @bug 6852078
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    28
 * @summary Disable SuperWord optimization for unsafe read/write
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    29
 *
15815
7691985f1fe3 8007776: Test6852078.java timeouts
drchase
parents: 5547
diff changeset
    30
 * @run main Test6852078
4428
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    31
 */
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    32
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    33
import java.util.*;
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    34
import java.nio.ByteBuffer;
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    35
import com.sun.corba.se.impl.encoding.ByteBufferWithInfo;
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    36
import com.sun.jndi.toolkit.corba.CorbaUtils;
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    37
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    38
public class Test6852078 {
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    39
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    40
    public Test6852078(String [] args) {
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    41
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    42
        int capacity = 128;
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    43
        ByteBuffer bb = ByteBuffer.allocateDirect(capacity);
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    44
        ByteBufferWithInfo bbwi = new ByteBufferWithInfo( CorbaUtils.getOrb(null, -1, new Hashtable()), bb);
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    45
        byte[] tmpBuf;
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    46
        tmpBuf = new byte[bbwi.buflen];
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    47
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    48
        for (int i = 0; i < capacity; i++)
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    49
            tmpBuf[i] = bbwi.byteBuffer.get(i);
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    50
    }
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    51
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    52
    public static void main(String [] args) {
15815
7691985f1fe3 8007776: Test6852078.java timeouts
drchase
parents: 5547
diff changeset
    53
        long start = System.currentTimeMillis();
4428
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    54
        for (int i=0; i<2000; i++) {
15815
7691985f1fe3 8007776: Test6852078.java timeouts
drchase
parents: 5547
diff changeset
    55
            // To protect slow systems from test-too-long timeouts
7691985f1fe3 8007776: Test6852078.java timeouts
drchase
parents: 5547
diff changeset
    56
            if ((i > 100) && ((System.currentTimeMillis() - start) > 100000))
7691985f1fe3 8007776: Test6852078.java timeouts
drchase
parents: 5547
diff changeset
    57
               break;
4428
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    58
            Test6852078 t = new Test6852078(args);
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    59
        }
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    60
    }
d1617f46285d 6852078: HSX 14/16 in jdk 5.0: api/javax_management api/org_omg jck tests crashes or make tnameserv crash
cfang
parents:
diff changeset
    61
}