< prev index next >

test/hotspot/jtreg/compiler/c2/aarch64/TestFarJump.java

Print this page

  1 /*
  2  * Copyright (c) 2022, BELLSOFT. 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  */

 72             if (match.length() != 8) {
 73                 continue;
 74             }
 75             int dump = (int)Long.parseLong(match, 16);
 76             int encoding = Integer.reverseBytes(dump);
 77             // Check the first instruction only. The raw pointer can be confused with the encoded adrp instruction:
 78             // emit_exception_handler() = far_call() + should_not_reach_here() = ADRP + ADD + BLR + DCPS1 + raw_pointer
 79             return isADRP(encoding);
 80         }
 81         return false;
 82     }
 83 
 84     static void runVM(boolean bigCodeHeap) throws Exception {
 85         String className = TestFarJump.class.getName();
 86         String[] procArgs = {
 87             "-XX:-Inline",
 88             "-Xcomp",
 89             "-Xbatch",
 90             "-XX:+TieredCompilation",
 91             "-XX:+SegmentedCodeCache",
 92             "-XX:CompileOnly=" + className + "::main",
 93             "-XX:ReservedCodeCacheSize=" + (bigCodeHeap ? "256M" : "200M"),
 94             "-XX:+UnlockDiagnosticVMOptions",
 95             "-XX:+PrintAssembly",
 96             className};
 97 
 98         ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(procArgs);
 99         OutputAnalyzer output = new OutputAnalyzer(pb.start());
100         List<String> lines = output.asLines();
101 
102         ListIterator<String> itr = lines.listIterator();
103         while (itr.hasNext()) {
104             String line = itr.next();
105             if (line.contains("[Exception Handler]")) {
106                 String next1 = itr.next();
107                 String next2 = itr.next();
108                 System.out.println(line);
109                 System.out.println(next1);
110                 System.out.println(next2);
111                 boolean containsADRP = containsADRP(next1) || containsADRP(next2);
112                 if (bigCodeHeap && !containsADRP) {
113                     throw new RuntimeException("ADRP instruction is expected on far jump");
114                 }
115                 if (!bigCodeHeap && containsADRP) {

  1 /*
  2  * Copyright (c) 2024, BELLSOFT. 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  */

 72             if (match.length() != 8) {
 73                 continue;
 74             }
 75             int dump = (int)Long.parseLong(match, 16);
 76             int encoding = Integer.reverseBytes(dump);
 77             // Check the first instruction only. The raw pointer can be confused with the encoded adrp instruction:
 78             // emit_exception_handler() = far_call() + should_not_reach_here() = ADRP + ADD + BLR + DCPS1 + raw_pointer
 79             return isADRP(encoding);
 80         }
 81         return false;
 82     }
 83 
 84     static void runVM(boolean bigCodeHeap) throws Exception {
 85         String className = TestFarJump.class.getName();
 86         String[] procArgs = {
 87             "-XX:-Inline",
 88             "-Xcomp",
 89             "-Xbatch",
 90             "-XX:+TieredCompilation",
 91             "-XX:+SegmentedCodeCache",

 92             "-XX:ReservedCodeCacheSize=" + (bigCodeHeap ? "256M" : "200M"),
 93             "-XX:+UnlockDiagnosticVMOptions",
 94             "-XX:CompileCommand=option," + className + "::main,bool,PrintAssembly,true",
 95             className};
 96 
 97         ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(procArgs);
 98         OutputAnalyzer output = new OutputAnalyzer(pb.start());
 99         List<String> lines = output.asLines();
100 
101         ListIterator<String> itr = lines.listIterator();
102         while (itr.hasNext()) {
103             String line = itr.next();
104             if (line.contains("[Exception Handler]")) {
105                 String next1 = itr.next();
106                 String next2 = itr.next();
107                 System.out.println(line);
108                 System.out.println(next1);
109                 System.out.println(next2);
110                 boolean containsADRP = containsADRP(next1) || containsADRP(next2);
111                 if (bigCodeHeap && !containsADRP) {
112                     throw new RuntimeException("ADRP instruction is expected on far jump");
113                 }
114                 if (!bigCodeHeap && containsADRP) {
< prev index next >