GetMaxCallTargetOffsetTest.java revision 12657:6ef01bd40ce2
10SN/A/*
211238Sjuh * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
30SN/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
40SN/A *
50SN/A * This code is free software; you can redistribute it and/or modify it
60SN/A * under the terms of the GNU General Public License version 2 only, as
72362SN/A * published by the Free Software Foundation.
80SN/A *
92362SN/A * This code is distributed in the hope that it will be useful, but WITHOUT
100SN/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
110SN/A * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
120SN/A * version 2 for more details (a copy is included in the LICENSE file that
130SN/A * accompanied this code).
140SN/A *
150SN/A * You should have received a copy of the GNU General Public License version
160SN/A * 2 along with this work; if not, write to the Free Software Foundation,
170SN/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
180SN/A *
190SN/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
200SN/A * or visit www.oracle.com if you need additional information or have any
212362SN/A * questions.
222362SN/A */
232362SN/A
240SN/A/*
250SN/A * @test
260SN/A * @bug 8136421
270SN/A * @requires vm.jvmci
280SN/A * @library / /test/lib/
290SN/A * @library ../common/patches
300SN/A * @modules java.base/jdk.internal.misc
310SN/A * @modules jdk.internal.vm.ci/jdk.vm.ci.hotspot
320SN/A * @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
330SN/A * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
340SN/A *                   compiler.jvmci.compilerToVM.GetMaxCallTargetOffsetTest
350SN/A */
360SN/A
370SN/Apackage compiler.jvmci.compilerToVM;
380SN/A
390SN/Aimport jdk.test.lib.Asserts;
400SN/Aimport jdk.vm.ci.hotspot.CompilerToVMHelper;
410SN/A
420SN/Apublic class GetMaxCallTargetOffsetTest {
430SN/A    public static void main(String args[]) {
440SN/A        new GetMaxCallTargetOffsetTest().runTest();
450SN/A    }
460SN/A
470SN/A    private void runTest() {
480SN/A        long offset1 = CompilerToVMHelper.getMaxCallTargetOffset(0L);
490SN/A        Asserts.assertNE(offset1, 0L,
500SN/A                "Unexpected maxCallTargetOffset for 0L");
510SN/A        long offset2 = CompilerToVMHelper.getMaxCallTargetOffset(100L);
520SN/A        Asserts.assertNE(offset2, 0L,
530SN/A                "Unexpected maxCallTargetOffset for 100L");
540SN/A        long offset3 = CompilerToVMHelper.getMaxCallTargetOffset(1000000L);
550SN/A        Asserts.assertNE(offset3, 0L,
560SN/A                "Unexpected maxCallTargetOffset for 1000000L");
570SN/A        // there can be 2 same offsets, but not 3
580SN/A        Asserts.assertFalse(offset1 == offset2 && offset2 == offset3,
590SN/A                "All 3 offsets are unexpectedly equal: " + offset1);
600SN/A    }
610SN/A}
620SN/A