hotspot/test/compiler/runtime/Test8010927.java
author tpivovarova
Tue, 12 Jul 2016 18:24:48 +0300
changeset 40059 c2304140ed64
parent 38152 hotspot/test/compiler/runtime/8010927/Test8010927.java@80e5da81fb2c
child 40631 ed82623d7831
permissions -rw-r--r--
8132919: Put compiler tests in packages Reviewed-by: vlivanov, dpochepk Contributed-by: igor.ignatyev@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17622
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
     1
/*
29678
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 28190
diff changeset
     2
 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
17622
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
     4
 *
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
     7
 * published by the Free Software Foundation.
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
     8
 *
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    13
 * accompanied this code).
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    14
 *
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    18
 *
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    21
 * questions.
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    22
 */
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    23
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    24
/*
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    25
 * @test
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    26
 * @bug 8010927
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    27
 * @summary Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
33730
30e064828045 8140189: [TESTBUG] Get rid of "@library /../../test/lib" in jtreg tests
cjplummer
parents: 29678
diff changeset
    28
 * @library /test/lib /testlibrary
36851
03e2f4d0a421 8153737: Unsupported Module
chegar
parents: 33730
diff changeset
    29
 * @modules java.base/jdk.internal.misc
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    30
 * @build compiler.runtime.Test8010927
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    31
 * @run driver ClassFileInstaller sun.hotspot.WhiteBox
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    32
 *                                sun.hotspot.WhiteBox$WhiteBoxPermission
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    33
 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+IgnoreUnrecognizedVMOptions
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    34
 *                   -XX:+WhiteBoxAPI -Xbootclasspath/a:. -Xmx64m -XX:NewSize=20971520
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    35
 *                   -XX:MaxNewSize=32m -XX:-UseTLAB -XX:-UseAdaptiveSizePolicy
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    36
 *                   compiler.runtime.Test8010927
17622
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    37
 */
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    38
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    39
package compiler.runtime;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    40
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    41
import jdk.internal.misc.Unsafe;
17622
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    42
import sun.hotspot.WhiteBox;
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    43
17622
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    44
import java.lang.reflect.Field;
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    45
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    46
/**
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    47
 * The test creates uncommitted space between oldgen and young gen
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    48
 * by specifying MaxNewSize bigger than NewSize.
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    49
 * NewSize = 20971520 = (512*4K) * 10 for 4k pages
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    50
 * Then it tries to execute arraycopy() with elements type check
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    51
 * to the array at the end of survive space near unused space.
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    52
 */
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    53
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    54
public class Test8010927 {
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    55
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    56
    private static final Unsafe U;
17622
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    57
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    58
    static {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    59
        try {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    60
            Field unsafe = Unsafe.class.getDeclaredField("theUnsafe");
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    61
            unsafe.setAccessible(true);
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    62
            U = (Unsafe) unsafe.get(null);
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    63
        } catch (Exception e) {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    64
            throw new Error(e);
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    65
        }
17622
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    66
    }
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    67
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    68
    public static Object[] o;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    69
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    70
    public static final boolean debug = Boolean.getBoolean("debug");
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    71
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    72
    // 2 different obect arrays but same element types
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    73
    static Test8010927[] masterA;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    74
    static Object[] masterB;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    75
    static final Test8010927 elem = new Test8010927();
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    76
    static final WhiteBox wb = WhiteBox.getWhiteBox();
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    77
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    78
    static final int obj_header_size = U.ARRAY_OBJECT_BASE_OFFSET;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    79
    static final int heap_oop_size = wb.getHeapOopSize();
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    80
    static final int card_size = 512;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    81
    static final int one_card = (card_size - obj_header_size) / heap_oop_size;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    82
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    83
    static final int surv_size = 2112 * 1024;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    84
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    85
    // The size is big to not fit into survive space.
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    86
    static final Object[] cache = new Object[(surv_size / card_size)];
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    87
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    88
    public static void main(String[] args) {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    89
        masterA = new Test8010927[one_card];
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    90
        masterB = new Object[one_card];
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    91
        for (int i = 0; i < one_card; ++i) {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    92
            masterA[i] = elem;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    93
            masterB[i] = elem;
17622
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
    94
        }
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    95
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    96
        // Move cache[] to the old gen.
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    97
        long low_limit = wb.getObjectAddress(cache);
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    98
        System.gc();
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    99
        // Move 'cache' to oldgen.
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   100
        long upper_limit = wb.getObjectAddress(cache);
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   101
        if ((low_limit - upper_limit) > 0) { // substaction works with unsigned values
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   102
            // OldGen is placed before youngger for ParallelOldGC.
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   103
            upper_limit = low_limit + 21000000l; // +20971520
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   104
        }
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   105
        // Each A[one_card] size is 512 bytes,
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   106
        // it will take about 40000 allocations to trigger GC.
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   107
        // cache[] has 8192 elements so GC should happen
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   108
        // each 5th iteration.
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   109
        for (long l = 0; l < 20; l++) {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   110
            fill_heap();
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   111
            if (debug) {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   112
                System.out.println("test oop_disjoint_arraycopy");
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   113
            }
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   114
            testA_arraycopy();
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   115
            if (debug) {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   116
                System.out.println("test checkcast_arraycopy");
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   117
            }
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   118
            testB_arraycopy();
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   119
            // Execute arraycopy to the topmost array in young gen
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   120
            if (debug) {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   121
                int top_index = get_top_address(low_limit, upper_limit);
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   122
                if (top_index >= 0) {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   123
                    long addr = wb.getObjectAddress(cache[top_index]);
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   124
                    System.out.println("top_addr: 0x" + Long.toHexString(addr) + ", 0x" + Long.toHexString(addr + 512));
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   125
                }
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   126
            }
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   127
        }
17622
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
   128
    }
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   129
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   130
    static void fill_heap() {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   131
        for (int i = 0; i < cache.length; ++i) {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   132
            o = new Test8010927[one_card];
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   133
            System.arraycopy(masterA, 0, o, 0, masterA.length);
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   134
            cache[i] = o;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   135
        }
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   136
        for (long j = 0; j < 256; ++j) {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   137
            o = new Long[10000]; // to trigger GC
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   138
        }
17622
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
   139
    }
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   140
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   141
    static void testA_arraycopy() {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   142
        for (int i = 0; i < cache.length; ++i) {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   143
            System.arraycopy(masterA, 0, cache[i], 0, masterA.length);
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   144
        }
17622
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
   145
    }
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   146
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   147
    static void testB_arraycopy() {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   148
        for (int i = 0; i < cache.length; ++i) {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   149
            System.arraycopy(masterB, 0, cache[i], 0, masterB.length);
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   150
        }
17622
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
   151
    }
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   152
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   153
    static int get_top_address(long min, long max) {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   154
        int index = -1;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   155
        long addr = min;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   156
        for (int i = 0; i < cache.length; ++i) {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   157
            long test = wb.getObjectAddress(cache[i]);
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   158
            if (((test - addr) > 0) && ((max - test) > 0)) { // substaction works with unsigned values
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   159
                addr = test;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   160
                index = i;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   161
            }
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   162
        }
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
   163
        return index;
17622
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
   164
    }
4037daf22a17 8010927: Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
kvn
parents:
diff changeset
   165
}