< prev index next > test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java
Print this page
import compiler.lib.ir_framework.driver.irmatching.mapping.*;
import compiler.lib.ir_framework.driver.irmatching.parser.VMInfo;
import compiler.lib.ir_framework.shared.CheckedTestFrameworkException;
import compiler.lib.ir_framework.shared.TestFormat;
import compiler.lib.ir_framework.shared.TestFormatException;
+ import compiler.valhalla.inlinetypes.InlineTypeIRNode;
import jdk.test.lib.Platform;
import jdk.test.whitebox.WhiteBox;
import java.util.HashMap;
import java.util.Map;
*/
public class IRNode {
/**
* Prefix for normal IR nodes.
*/
- private static final String PREFIX = "_#";
+ public static final String PREFIX = "_#";
/**
* Prefix for composite IR nodes.
*/
private static final String COMPOSITE_PREFIX = PREFIX + "C#";
/**
private static final String POSTFIX = "#_";
private static final String START = "(\\d+(\\s){2}(";
private static final String MID = ".*)+(\\s){2}===.*";
private static final String END = ")";
- private static final String STORE_OF_CLASS_POSTFIX = "(:|\\+)\\S* \\*" + END;
- private static final String LOAD_OF_CLASS_POSTFIX = "(:|\\+)\\S* \\*" + END;
+ private static final String STORE_OF_CLASS_POSTFIX = "( \\([^\\)]+\\))?(:|\\+)\\S* \\*" + END;
+ private static final String LOAD_OF_CLASS_POSTFIX = "( \\([^\\)]+\\))?(:|\\+)\\S* \\*" + END;
public static final String IS_REPLACED = "#IS_REPLACED#"; // Is replaced by an additional user-defined string.
public static final String VECTOR_SIZE = "_@";
public static final String VECTOR_SIZE_TAG_ANY = "any";
* // IR_NODE_MAPPINGS. This can be done by using the helper methods defined after all IR node placeholder string
* // definitions.
* }
*/
+ // Valhalla: Make sure that all Valhalla specific IR nodes are also properly initialized. Doing it here also
+ // ensures that the Flag VM is able to pick up the correct compile phases.
+ static {
+ InlineTypeIRNode.forceStaticInitialization();
+ }
+
public static final String ABS_D = PREFIX + "ABS_D" + POSTFIX;
static {
beforeMatchingNameRegex(ABS_D, "AbsD");
}
macroNodes(ALLOC, regex);
}
public static final String ALLOC_OF = COMPOSITE_PREFIX + "ALLOC_OF" + POSTFIX;
static {
- String regex = START + "Allocate\\b" + MID + "allocationKlass:.*\\b" + IS_REPLACED + "\\s.*" + END;
- macroNodes(ALLOC_OF, regex);
+ allocateOfNodes(ALLOC_OF, IS_REPLACED);
+ }
+
+ public static void allocateOfNodes(String irNodePlaceholder, String allocatee) {
+ String regex = START + "Allocate\\b" + MID + "allocationKlass:.*\\b" + allocatee + "\\s.*" + END;
+ macroNodes(irNodePlaceholder, regex);
}
public static final String ALLOC_ARRAY = PREFIX + "ALLOC_ARRAY" + POSTFIX;
static {
String regex = START + "AllocateArray\\b" + MID + END;
macroNodes(ALLOC_ARRAY, regex);
}
public static final String ALLOC_ARRAY_OF = COMPOSITE_PREFIX + "ALLOC_ARRAY_OF" + POSTFIX;
static {
+ allocateArrayOfNodes(ALLOC_ARRAY_OF, IS_REPLACED);
+ }
+
+ public static void allocateArrayOfNodes(String irNodePlaceholder, String allocatee) {
// Assuming we are looking for an array of "some/package/MyClass". The printout is
// [Lsome/package/MyClass;
// or, with more dimensions
// [[[Lsome/package/MyClass;
// - maybe a non-empty sequence of characters ending on a word boundary
// this sequence is omitted if the given name is already fully qualified (exact match)
// but will eat the package path prefix in the cases described above
// - the name we are looking for
// - the final ";".
- String name_part = "\\[+.(" + partial_name_prefix + ")?" + IS_REPLACED + ";";
+ String name_part = "\\[+.(" + partial_name_prefix + ")?" + allocatee + ";";
String regex = START + "AllocateArray\\b" + MID + "allocationKlass:" + name_part + ".*" + END;
- macroNodes(ALLOC_ARRAY_OF, regex);
+ macroNodes(irNodePlaceholder, regex);
}
public static final String OR = PREFIX + "OR" + POSTFIX;
static {
beforeMatchingNameRegex(OR, "Or(I|L)");
beforeMatchingNameRegex(CALL, "Call.*Java");
}
public static final String CALL_OF = COMPOSITE_PREFIX + "CALL_OF" + POSTFIX;
static {
- callOfNodes(CALL_OF, "Call.*");
+ callOfNodes(CALL_OF, "Call.*", IS_REPLACED + " " );
}
public static final String CALL_OF_METHOD = COMPOSITE_PREFIX + "CALL_OF_METHOD" + POSTFIX;
static {
- callOfNodes(CALL_OF_METHOD, "Call.*Java");
+ callOfNodes(CALL_OF_METHOD, "Call.*Java", IS_REPLACED + " ");
+ }
+
+ public static final String STATIC_CALL = PREFIX + "STATIC_CALL" + POSTFIX;
+ static {
+ beforeMatchingNameRegex(STATIC_CALL, "CallStaticJava");
}
public static final String STATIC_CALL_OF_METHOD = COMPOSITE_PREFIX + "STATIC_CALL_OF_METHOD" + POSTFIX;
static {
- callOfNodes(STATIC_CALL_OF_METHOD, "CallStaticJava");
+ staticCallOfMethodNodes(STATIC_CALL_OF_METHOD, IS_REPLACED + " ");
+ }
+
+ public static void staticCallOfMethodNodes(String irNodePlaceholder, String calleeRegex) {
+ callOfNodes(irNodePlaceholder, "CallStaticJava", calleeRegex);
+ }
+
+ public static final String CALL_LEAF_NO_FP = PREFIX + "CALL_LEAF_NO_FP" + POSTFIX;
+ static {
+ beforeMatchingNameRegex(CALL_LEAF_NO_FP, "CallLeafNoFP");
+ }
+
+ public static final String CALL_LEAF_NO_FP_OF_METHOD = COMPOSITE_PREFIX + "CALL_LEAF_NO_FP_OF_METHOD" + POSTFIX;
+ static {
+ callLeafNoFpOfMethodNodes(CALL_LEAF_NO_FP_OF_METHOD, IS_REPLACED);
+ }
+
+ public static void callLeafNoFpOfMethodNodes(String irNodePlaceholder, String calleeRegex) {
+ callOfNodes(irNodePlaceholder, "CallLeafNoFP", calleeRegex);
}
public static final String CAST_II = PREFIX + "CAST_II" + POSTFIX;
static {
beforeMatchingNameRegex(CAST_II, "CastII");
public static final String CMP_P = PREFIX + "CMP_P" + POSTFIX;
static {
beforeMatchingNameRegex(CMP_P, "CmpP");
}
+ public static final String CMP_N = PREFIX + "CMP_N" + POSTFIX;
+ static {
+ beforeMatchingNameRegex(CMP_N, "CmpN");
+ }
+
public static final String COMPRESS_BITS = PREFIX + "COMPRESS_BITS" + POSTFIX;
static {
beforeMatchingNameRegex(COMPRESS_BITS, "CompressBits");
}
vectorNode(DIV_VD, "DivVD", TYPE_DOUBLE);
}
public static final String DYNAMIC_CALL_OF_METHOD = COMPOSITE_PREFIX + "DYNAMIC_CALL_OF_METHOD" + POSTFIX;
static {
- callOfNodes(DYNAMIC_CALL_OF_METHOD, "CallDynamicJava");
+ callOfNodes(DYNAMIC_CALL_OF_METHOD, "CallDynamicJava", IS_REPLACED);
}
public static final String EXPAND_BITS = PREFIX + "EXPAND_BITS" + POSTFIX;
static {
beforeMatchingNameRegex(EXPAND_BITS, "ExpandBits");
public static final String IF = PREFIX + "IF" + POSTFIX;
static {
beforeMatchingNameRegex(IF, "If\\b");
}
+ public static final String INLINE_TYPE = PREFIX + "INLINE_TYPE" + POSTFIX;
+ static {
+ beforeMatchingNameRegex(INLINE_TYPE, "InlineType");
+ }
+
// Does not work for VM builds without JVMCI like x86_32 (a rule containing this regex will be skipped without having JVMCI built).
public static final String INTRINSIC_OR_TYPE_CHECKED_INLINING_TRAP = PREFIX + "INTRINSIC_OR_TYPE_CHECKED_INLINING_TRAP" + POSTFIX;
static {
trapNodes(INTRINSIC_OR_TYPE_CHECKED_INLINING_TRAP, "intrinsic_or_type_checked_inlining");
}
beforeMatchingNameRegex(LOAD, "Load(B|UB|S|US|I|L|F|D|P|N)");
}
public static final String LOAD_OF_CLASS = COMPOSITE_PREFIX + "LOAD_OF_CLASS" + POSTFIX;
static {
- loadOfNodes(LOAD_OF_CLASS, "Load(B|UB|S|US|I|L|F|D|P|N)");
+ anyLoadOfNodes(LOAD_OF_CLASS, IS_REPLACED);
+ }
+
+ public static void anyLoadOfNodes(String irNodePlaceholder, String fieldHolder) {
+ loadOfNodes(irNodePlaceholder, "Load(B|UB|S|US|I|L|F|D|P|N)", fieldHolder);
}
public static final String LOAD_B = PREFIX + "LOAD_B" + POSTFIX;
static {
beforeMatchingNameRegex(LOAD_B, "LoadB");
}
public static final String LOAD_B_OF_CLASS = COMPOSITE_PREFIX + "LOAD_B_OF_CLASS" + POSTFIX;
static {
- loadOfNodes(LOAD_B_OF_CLASS, "LoadB");
+ loadOfNodes(LOAD_B_OF_CLASS, "LoadB", IS_REPLACED);
}
public static final String LOAD_D = PREFIX + "LOAD_D" + POSTFIX;
static {
beforeMatchingNameRegex(LOAD_D, "LoadD");
}
public static final String LOAD_D_OF_CLASS = COMPOSITE_PREFIX + "LOAD_D_OF_CLASS" + POSTFIX;
static {
- loadOfNodes(LOAD_D_OF_CLASS, "LoadD");
+ loadOfNodes(LOAD_D_OF_CLASS, "LoadD", IS_REPLACED);
}
public static final String LOAD_F = PREFIX + "LOAD_F" + POSTFIX;
static {
beforeMatchingNameRegex(LOAD_F, "LoadF");
}
public static final String LOAD_F_OF_CLASS = COMPOSITE_PREFIX + "LOAD_F_OF_CLASS" + POSTFIX;
static {
- loadOfNodes(LOAD_F_OF_CLASS, "LoadF");
+ loadOfNodes(LOAD_F_OF_CLASS, "LoadF", IS_REPLACED);
}
public static final String LOAD_I = PREFIX + "LOAD_I" + POSTFIX;
static {
beforeMatchingNameRegex(LOAD_I, "LoadI");
}
public static final String LOAD_I_OF_CLASS = COMPOSITE_PREFIX + "LOAD_I_OF_CLASS" + POSTFIX;
static {
- loadOfNodes(LOAD_I_OF_CLASS, "LoadI");
+ loadOfNodes(LOAD_I_OF_CLASS, "LoadI", IS_REPLACED);
}
public static final String LOAD_KLASS = PREFIX + "LOAD_KLASS" + POSTFIX;
static {
beforeMatchingNameRegex(LOAD_KLASS, "LoadKlass");
beforeMatchingNameRegex(LOAD_L, "LoadL");
}
public static final String LOAD_L_OF_CLASS = COMPOSITE_PREFIX + "LOAD_L_OF_CLASS" + POSTFIX;
static {
- loadOfNodes(LOAD_L_OF_CLASS, "LoadL");
+ loadOfNodes(LOAD_L_OF_CLASS, "LoadL", IS_REPLACED);
}
public static final String LOAD_N = PREFIX + "LOAD_N" + POSTFIX;
static {
beforeMatchingNameRegex(LOAD_N, "LoadN");
}
public static final String LOAD_N_OF_CLASS = COMPOSITE_PREFIX + "LOAD_N_OF_CLASS" + POSTFIX;
static {
- loadOfNodes(LOAD_N_OF_CLASS, "LoadN");
+ loadOfNodes(LOAD_N_OF_CLASS, "LoadN", IS_REPLACED);
}
public static final String LOAD_OF_FIELD = COMPOSITE_PREFIX + "LOAD_OF_FIELD" + POSTFIX;
static {
String regex = START + "Load(B|C|S|I|L|F|D|P|N)" + MID + "@.*name=" + IS_REPLACED + ",.*" + END;
beforeMatchingNameRegex(LOAD_P, "LoadP");
}
public static final String LOAD_P_OF_CLASS = COMPOSITE_PREFIX + "LOAD_P_OF_CLASS" + POSTFIX;
static {
- loadOfNodes(LOAD_P_OF_CLASS, "LoadP");
+ loadOfNodes(LOAD_P_OF_CLASS, "LoadP", IS_REPLACED);
}
public static final String LOAD_S = PREFIX + "LOAD_S" + POSTFIX;
static {
beforeMatchingNameRegex(LOAD_S, "LoadS");
}
public static final String LOAD_S_OF_CLASS = COMPOSITE_PREFIX + "LOAD_S_OF_CLASS" + POSTFIX;
static {
- loadOfNodes(LOAD_S_OF_CLASS, "LoadS");
+ loadOfNodes(LOAD_S_OF_CLASS, "LoadS", IS_REPLACED);
}
public static final String LOAD_UB = PREFIX + "LOAD_UB" + POSTFIX;
static {
beforeMatchingNameRegex(LOAD_UB, "LoadUB");
}
public static final String LOAD_UB_OF_CLASS = COMPOSITE_PREFIX + "LOAD_UB_OF_CLASS" + POSTFIX;
static {
- loadOfNodes(LOAD_UB_OF_CLASS, "LoadUB");
+ loadOfNodes(LOAD_UB_OF_CLASS, "LoadUB", IS_REPLACED);
}
public static final String LOAD_US = PREFIX + "LOAD_US" + POSTFIX;
static {
beforeMatchingNameRegex(LOAD_US, "LoadUS");
}
public static final String LOAD_US_OF_CLASS = COMPOSITE_PREFIX + "LOAD_US_OF_CLASS" + POSTFIX;
static {
- loadOfNodes(LOAD_US_OF_CLASS, "LoadUS");
+ loadOfNodes(LOAD_US_OF_CLASS, "LoadUS", IS_REPLACED);
}
public static final String LOAD_VECTOR_B = VECTOR_PREFIX + "LOAD_VECTOR_B" + POSTFIX;
static {
vectorNode(LOAD_VECTOR_B, "LoadVector", TYPE_BYTE);
beforeMatchingNameRegex(STORE_B, "StoreB");
}
public static final String STORE_B_OF_CLASS = COMPOSITE_PREFIX + "STORE_B_OF_CLASS" + POSTFIX;
static {
- storeOfNodes(STORE_B_OF_CLASS, "StoreB");
+ storeOfNodes(STORE_B_OF_CLASS, "StoreB", IS_REPLACED);
}
public static final String STORE_C = PREFIX + "STORE_C" + POSTFIX;
static {
beforeMatchingNameRegex(STORE_C, "StoreC");
}
public static final String STORE_C_OF_CLASS = COMPOSITE_PREFIX + "STORE_C_OF_CLASS" + POSTFIX;
static {
- storeOfNodes(STORE_C_OF_CLASS, "StoreC");
+ storeOfNodes(STORE_C_OF_CLASS, "StoreC", IS_REPLACED);
}
public static final String STORE_D = PREFIX + "STORE_D" + POSTFIX;
static {
beforeMatchingNameRegex(STORE_D, "StoreD");
}
public static final String STORE_D_OF_CLASS = COMPOSITE_PREFIX + "STORE_D_OF_CLASS" + POSTFIX;
static {
- storeOfNodes(STORE_D_OF_CLASS, "StoreD");
+ storeOfNodes(STORE_D_OF_CLASS, "StoreD", IS_REPLACED);
}
public static final String STORE_F = PREFIX + "STORE_F" + POSTFIX;
static {
beforeMatchingNameRegex(STORE_F, "StoreF");
}
public static final String STORE_F_OF_CLASS = COMPOSITE_PREFIX + "STORE_F_OF_CLASS" + POSTFIX;
static {
- storeOfNodes(STORE_F_OF_CLASS, "StoreF");
+ storeOfNodes(STORE_F_OF_CLASS, "StoreF", IS_REPLACED);
}
public static final String STORE_I = PREFIX + "STORE_I" + POSTFIX;
static {
beforeMatchingNameRegex(STORE_I, "StoreI");
}
public static final String STORE_I_OF_CLASS = COMPOSITE_PREFIX + "STORE_I_OF_CLASS" + POSTFIX;
static {
- storeOfNodes(STORE_I_OF_CLASS, "StoreI");
+ storeOfNodes(STORE_I_OF_CLASS, "StoreI", IS_REPLACED);
}
public static final String STORE_L = PREFIX + "STORE_L" + POSTFIX;
static {
beforeMatchingNameRegex(STORE_L, "StoreL");
}
public static final String STORE_L_OF_CLASS = COMPOSITE_PREFIX + "STORE_L_OF_CLASS" + POSTFIX;
static {
- storeOfNodes(STORE_L_OF_CLASS, "StoreL");
+ storeOfNodes(STORE_L_OF_CLASS, "StoreL", IS_REPLACED);
}
public static final String STORE_N = PREFIX + "STORE_N" + POSTFIX;
static {
beforeMatchingNameRegex(STORE_N, "StoreN");
}
public static final String STORE_N_OF_CLASS = COMPOSITE_PREFIX + "STORE_N_OF_CLASS" + POSTFIX;
static {
- storeOfNodes(STORE_N_OF_CLASS, "StoreN");
+ storeOfNodes(STORE_N_OF_CLASS, "StoreN", IS_REPLACED);
}
public static final String STORE_OF_CLASS = COMPOSITE_PREFIX + "STORE_OF_CLASS" + POSTFIX;
static {
- storeOfNodes(STORE_OF_CLASS, "Store(B|C|S|I|L|F|D|P|N)");
+ anyStoreOfNodes(STORE_OF_CLASS, IS_REPLACED);
+ }
+
+ public static void anyStoreOfNodes(String irNodePlaceholder, String fieldHolder) {
+ storeOfNodes(irNodePlaceholder, "Store(B|C|S|I|L|F|D|P|N)", fieldHolder);
}
public static final String STORE_OF_FIELD = COMPOSITE_PREFIX + "STORE_OF_FIELD" + POSTFIX;
static {
String regex = START + "Store(B|C|S|I|L|F|D|P|N)" + MID + "@.*name=" + IS_REPLACED + ",.*" + END;
beforeMatchingNameRegex(STORE_P, "StoreP");
}
public static final String STORE_P_OF_CLASS = COMPOSITE_PREFIX + "STORE_P_OF_CLASS" + POSTFIX;
static {
- storeOfNodes(STORE_P_OF_CLASS, "StoreP");
+ storeOfNodes(STORE_P_OF_CLASS, "StoreP", IS_REPLACED);
}
public static final String STORE_VECTOR = PREFIX + "STORE_VECTOR" + POSTFIX;
static {
beforeMatchingNameRegex(STORE_VECTOR, "StoreVector");
vectorNode(SUB_VD, "SubVD", TYPE_DOUBLE);
}
public static final String SUBTYPE_CHECK = PREFIX + "SUBTYPE_CHECK" + POSTFIX;
static {
- beforeMatchingNameRegex(SUBTYPE_CHECK, "SubTypeCheck");
+ String regex = START + "SubTypeCheck" + MID + END;
+ macroNodes(SUBTYPE_CHECK, regex);
}
public static final String TRAP = PREFIX + "TRAP" + POSTFIX;
static {
trapNodes(TRAP, "reason");
/**
* Apply {@code regex} on all machine independent ideal graph phases up to and including
* {@link CompilePhase#BEFORE_MATCHING}.
*/
- private static void beforeMatching(String irNodePlaceholder, String regex) {
+ public static void beforeMatching(String irNodePlaceholder, String regex) {
IR_NODE_MAPPINGS.put(irNodePlaceholder, new RegexTypeEntry(RegexType.IDEAL_INDEPENDENT, regex));
}
/**
* Apply {@code irNodeRegex} as regex for the IR node name on all machine independent ideal graph phases up to and
IR_NODE_MAPPINGS.put(irNodePlaceholder, new SinglePhaseRangeEntry(CompilePhase.BEFORE_MACRO_EXPANSION, regex,
CompilePhase.BEFORE_STRINGOPTS,
CompilePhase.BEFORE_MACRO_EXPANSION));
}
- private static void callOfNodes(String irNodePlaceholder, String callRegex) {
- String regex = START + callRegex + MID + IS_REPLACED + " " + END;
+ private static void callOfNodes(String irNodePlaceholder, String callRegex, String calleeRegex) {
+ String regex = START + callRegex + MID + calleeRegex + END;
IR_NODE_MAPPINGS.put(irNodePlaceholder, new RegexTypeEntry(RegexType.IDEAL_INDEPENDENT, regex));
}
/**
* Apply {@code regex} on all machine dependant ideal graph phases (i.e. on the mach graph) starting from
* {@link CompilePhase#MATCHING}.
*/
- private static void optoOnly(String irNodePlaceholder, String regex) {
+ public static void optoOnly(String irNodePlaceholder, String regex) {
IR_NODE_MAPPINGS.put(irNodePlaceholder, new RegexTypeEntry(RegexType.OPTO_ASSEMBLY, regex));
}
private static void machOnly(String irNodePlaceholder, String regex) {
IR_NODE_MAPPINGS.put(irNodePlaceholder, new RegexTypeEntry(RegexType.MACH, regex));
IR_NODE_MAPPINGS.put(irNodePlaceholder, new SinglePhaseRangeEntry(CompilePhase.AFTER_PARSING, regex,
CompilePhase.AFTER_PARSING,
CompilePhase.PHASEIDEALLOOP_ITERATIONS));
}
- private static void loadOfNodes(String irNodePlaceholder, String irNodeRegex) {
- String regex = START + irNodeRegex + MID + "@\\S*" + IS_REPLACED + LOAD_OF_CLASS_POSTFIX;
+ private static void loadOfNodes(String irNodePlaceholder, String irNodeRegex, String loadee) {
+ String regex = START + irNodeRegex + MID + "@(\\w+: ?)*[\\w/]*\\b" + loadee + LOAD_OF_CLASS_POSTFIX;
beforeMatching(irNodePlaceholder, regex);
}
- private static void storeOfNodes(String irNodePlaceholder, String irNodeRegex) {
- String regex = START + irNodeRegex + MID + "@\\S*" + IS_REPLACED + STORE_OF_CLASS_POSTFIX;
+ private static void storeOfNodes(String irNodePlaceholder, String irNodeRegex, String storee) {
+ String regex = START + irNodeRegex + MID + "@(\\w+: ?)*[\\w/]*\\b" + storee + STORE_OF_CLASS_POSTFIX;
beforeMatching(irNodePlaceholder, regex);
}
private static void fromBeforeRemoveUselessToFinalCode(String irNodePlaceholder, String irNodeRegex) {
String regex = START + irNodeRegex + MID + END;
< prev index next >