1 /* 2 * Copyright (c) 2020, Red Hat, Inc. 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 */ 23 24 /* 25 * @test 26 * @summary Test for disabled Runtime.addressOf with 32-bit compressed oops 27 * @library /test/lib 28 * 29 * @run main/othervm -Xmx128m 30 * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure -Xcheck:jni 31 * -XX:-RuntimeAddressOf 32 * -Xint 33 * AddressOfDisabled 34 * 35 * @run main/othervm -Xmx128m 36 * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure -Xcheck:jni 37 * -XX:-RuntimeAddressOf 38 * -XX:TieredStopAtLevel=1 39 * AddressOfDisabled 40 * 41 * @run main/othervm -Xmx128m 42 * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure -Xcheck:jni 43 * -XX:-RuntimeAddressOf 44 * -XX:-TieredCompilation 45 * AddressOfDisabled 46 */ 47 48 /* 49 * @test 50 * @summary Test for disabled Runtime.addressOf with zero-based compressed oops 51 * @library /test/lib 52 * @requires vm.bits == 64 53 * 54 * @run main/othervm -Xmx4g 55 * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure -Xcheck:jni 56 * -XX:-RuntimeAddressOf 57 * -Xint 58 * AddressOfDisabled 59 * 60 * @run main/othervm -Xmx4g 61 * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure -Xcheck:jni 62 * -XX:-RuntimeAddressOf 63 * -XX:TieredStopAtLevel=1 64 * AddressOfDisabled 65 * 66 * @run main/othervm -Xmx4g 67 * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure -Xcheck:jni 68 * -XX:-RuntimeAddressOf 69 * -XX:-TieredCompilation 70 * AddressOfDisabled 71 */ 72 73 /* 74 * @test 75 * @summary Test for disabled Runtime.addressOf without compressed oops 76 * @library /test/lib 77 * @requires vm.bits == 64 78 * 79 * @run main/othervm -Xmx128m -XX:-UseCompressedOops 80 * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure -Xcheck:jni 81 * -XX:-RuntimeAddressOf 82 * -Xint 83 * AddressOfDisabled 84 * 85 * @run main/othervm -Xmx128m -XX:-UseCompressedOops 86 * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure -Xcheck:jni 87 * -XX:-RuntimeAddressOf 88 * -XX:TieredStopAtLevel=1 89 * AddressOfDisabled 90 * 91 * @run main/othervm -Xmx128m -XX:-UseCompressedOops 92 * -XX:+UnlockDiagnosticVMOptions -XX:+AbortVMOnCompilationFailure -Xcheck:jni 93 * -XX:-RuntimeAddressOf 94 * -XX:-TieredCompilation 95 * AddressOfDisabled 96 */ 97 98 import java.lang.reflect.Field; 99 100 public class AddressOfDisabled { 101 102 public static void main(String ... args) throws Exception { 103 for (int c = 0; c < RuntimeOfUtil.ITERS; c++) { 104 RuntimeOfUtil.assertEquals(-1, Runtime.addressOf(new Object())); 105 } 106 } 107 108 }