1 /* 2 * Copyright (c) 2022, 2024, Oracle and/or its affiliates. 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 package compiler.valhalla.inlinetypes; 25 26 public class InlineTypeRegexes { 27 // Regular expressions used to match nodes in the PrintIdeal output 28 private static final String START = "(\\d+(\\s){2}("; 29 private static final String MID = ".*)+(\\s){2}===.*"; 30 private static final String END = ")"; 31 // Generic allocation 32 public static final String ALLOC_G = "(.*call,static.*wrapper for: C2 Runtime new_instance" + END; 33 public static final String ALLOCA_G = "(.*call,static.*wrapper for: C2 Runtime new_array" + END; 34 // Inline type allocation 35 public static final String MYVALUE_ARRAY_KLASS = "\\[(precise )?compiler/valhalla/inlinetypes/MyValue"; 36 public static final String ALLOC = "(.*precise compiler/valhalla/inlinetypes/MyValue.*\\R(.*(?i:mov|xorl|nop|spill).*\\R)*.*C2 Runtime new_instance" + END; 37 public static final String ALLOCA = "(.*" + MYVALUE_ARRAY_KLASS + ".*\\R(.*(?i:mov|xorl|nop|spill).*\\R)*.*C2 Runtime new_array" + END; 38 public static final String LOAD = START + "Load(B|C|S|I|L|F|D|P|N)" + MID + "@compiler/valhalla/inlinetypes/.*" + END; 39 public static final String LOADK = START + "LoadK" + MID + END; 40 public static final String STORE = START + "Store(B|C|S|I|L|F|D|P|N)" + MID + "@compiler/valhalla/inlinetypes/.*" + END; 41 public static final String LOOP = START + "Loop" + MID + "" + END; 42 public static final String COUNTEDLOOP = START + "CountedLoop\\b" + MID + "" + END; 43 public static final String COUNTEDLOOP_MAIN = START + "CountedLoop\\b" + MID + "main" + END; 44 public static final String TRAP = START + "CallStaticJava" + MID + "uncommon_trap.*(unstable_if|predicate)" + END; 45 public static final String LINKTOSTATIC = START + "CallStaticJava" + MID + "linkToStatic" + END; 46 public static final String NPE = START + "CallStaticJava" + MID + "null_check" + END; 47 public static final String CALL = START + "CallStaticJava" + MID + END; 48 public static final String CALL_LEAF = "(CALL, runtime leaf|call_leaf,runtime)"; 49 public static final String CALL_LEAF_NOFP = "(CALL, runtime leaf nofp|call_leaf_nofp,runtime)"; 50 protected static final String CALL_UNSAFE = START + "CallStaticJava" + MID + "# Static jdk.internal.misc.Unsafe::" + END; 51 public static final String STORE_INLINE_FIELDS = START + "CallStaticJava" + MID + "store_inline_type_fields" + END; 52 public static final String SCOBJ = "(.*# ScObj.*" + END; 53 public static final String LOAD_UNKNOWN_INLINE = START + "CallStaticJava" + MID + "C2 Runtime load_unknown_inline" + END; 54 public static final String STORE_UNKNOWN_INLINE = "(.*" + CALL_LEAF + ".*store_unknown_inline.*" + END; 55 public static final String INLINE_ARRAY_NULL_GUARD = "(.*call,static.*wrapper for: uncommon_trap.*reason='null_check' action='none'.*" + END; 56 public static final String INTRINSIC_SLOW_PATH = "(.*call,static.*wrapper for: uncommon_trap.*reason='intrinsic_or_type_checked_inlining'.*" + END; 57 public static final String CLONE_INTRINSIC_SLOW_PATH = "(.*call,static.*java.lang.Object::clone.*" + END; 58 public static final String CLASS_CHECK_TRAP = START + "CallStaticJava" + MID + "uncommon_trap.*class_check" + END; 59 public static final String NULL_CHECK_TRAP = START + "CallStaticJava" + MID + "uncommon_trap.*null_check" + END; 60 public static final String NULL_ASSERT_TRAP = START + "CallStaticJava" + MID + "uncommon_trap.*null_assert" + END; 61 public static final String RANGE_CHECK_TRAP = START + "CallStaticJava" + MID + "uncommon_trap.*range_check" + END; 62 public static final String UNHANDLED_TRAP = START + "CallStaticJava" + MID + "uncommon_trap.*unhandled" + END; 63 public static final String PREDICATE_TRAP = START + "CallStaticJava" + MID + "uncommon_trap.*predicate" + END; 64 public static final String MEMBAR = START + "MemBar" + MID + END; 65 public static final String CHECKCAST_ARRAYCOPY = "(.*" + CALL_LEAF_NOFP + ".*checkcast_arraycopy.*" + END; 66 public static final String JLONG_ARRAYCOPY = "(.*" + CALL_LEAF_NOFP + ".*jlong_disjoint_arraycopy.*" + END; 67 public static final String FIELD_ACCESS = "(.*Field: *" + END; 68 public static final String SUBSTITUTABILITY_TEST = START + "CallStaticJava" + MID + "java.lang.runtime.ValueObjectMethods::isSubstitutable" + END; 69 public static final String CMPP = START + "(CmpP|CmpN)" + MID + "" + END; 70 }