8296243: [IR Framework] Fix issues with IRNode.ALLOC* regexes
Reviewed-by: mdoerr, thartmann
This commit is contained in:
parent
8eb90e2d9c
commit
34d10f19f5
@ -167,27 +167,25 @@ public class IRNode {
|
|||||||
|
|
||||||
public static final String ALLOC = PREFIX + "ALLOC" + POSTFIX;
|
public static final String ALLOC = PREFIX + "ALLOC" + POSTFIX;
|
||||||
static {
|
static {
|
||||||
String idealIndependentRegex = START + "Allocate" + MID + END;
|
String optoRegex = "(.*precise .*\\R((.*(?i:mov|xorl|nop|spill).*|\\s*)\\R)*.*(?i:call,static).*wrapper for: _new_instance_Java" + END;
|
||||||
String optoRegex = "(.*precise .*\\R((.*(?i:mov|xorl|nop|spill).*|\\s*|.*LGHI.*)\\R)*.*(?i:call,static).*wrapper for: _new_instance_Java" + END;
|
allocNodes(ALLOC, "Allocate", optoRegex);
|
||||||
allocNodes(ALLOC, idealIndependentRegex, optoRegex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String ALLOC_OF = COMPOSITE_PREFIX + "ALLOC_OF" + POSTFIX;
|
public static final String ALLOC_OF = COMPOSITE_PREFIX + "ALLOC_OF" + POSTFIX;
|
||||||
static {
|
static {
|
||||||
String regex = "(.*precise .*" + IS_REPLACED + ":.*\\R((.*(?i:mov|xorl|nop|spill).*|\\s*|.*LGHI.*)\\R)*.*(?i:call,static).*wrapper for: _new_instance_Java" + END;
|
String regex = "(.*precise .*" + IS_REPLACED + ":.*\\R((.*(?i:mov|xorl|nop|spill).*|\\s*)\\R)*.*(?i:call,static).*wrapper for: _new_instance_Java" + END;
|
||||||
optoOnly(ALLOC_OF, regex);
|
optoOnly(ALLOC_OF, regex);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String ALLOC_ARRAY = PREFIX + "ALLOC_ARRAY" + POSTFIX;
|
public static final String ALLOC_ARRAY = PREFIX + "ALLOC_ARRAY" + POSTFIX;
|
||||||
static {
|
static {
|
||||||
String idealIndependentRegex = START + "AllocateArray" + MID + END;
|
String optoRegex = "(.*precise \\[.*\\R((.*(?i:mov|xor|nop|spill).*|\\s*|.*(LGHI|LI).*)\\R)*.*(?i:call,static).*wrapper for: _new_array_Java" + END;
|
||||||
String optoRegex = "(.*precise \\[.*\\R((.*(?i:mov|xor|nop|spill).*|\\s*|.*LGHI.*)\\R)*.*(?i:call,static).*wrapper for: _new_array_Java" + END;
|
allocNodes(ALLOC_ARRAY, "AllocateArray", optoRegex);
|
||||||
allocNodes(ALLOC_ARRAY, idealIndependentRegex, optoRegex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String ALLOC_ARRAY_OF = COMPOSITE_PREFIX + "ALLOC_ARRAY_OF" + POSTFIX;
|
public static final String ALLOC_ARRAY_OF = COMPOSITE_PREFIX + "ALLOC_ARRAY_OF" + POSTFIX;
|
||||||
static {
|
static {
|
||||||
String regex = "(.*precise \\[.*" + IS_REPLACED + ":.*\\R((.*(?i:mov|xorl|nop|spill).*|\\s*|.*LGHI.*)\\R)*.*(?i:call,static).*wrapper for: _new_array_Java" + END;
|
String regex = "(.*precise \\[.*" + IS_REPLACED + ":.*\\R((.*(?i:mov|xorl|nop|spill).*|\\s*|.*(LGHI|LI).*)\\R)*.*(?i:call,static).*wrapper for: _new_array_Java" + END;
|
||||||
optoOnly(ALLOC_ARRAY_OF, regex);
|
optoOnly(ALLOC_ARRAY_OF, regex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1182,10 +1180,11 @@ public class IRNode {
|
|||||||
IR_NODE_MAPPINGS.put(irNodePlaceholder, new RegexTypeEntry(RegexType.IDEAL_INDEPENDENT, regex));
|
IR_NODE_MAPPINGS.put(irNodePlaceholder, new RegexTypeEntry(RegexType.IDEAL_INDEPENDENT, regex));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void allocNodes(String irNode, String idealRegex, String optoRegex) {
|
private static void allocNodes(String irNode, String irNodeName, String optoRegex) {
|
||||||
|
String idealIndependentRegex = START + irNodeName + "\\b" + MID + END;
|
||||||
Map<PhaseInterval, String> intervalToRegexMap = new HashMap<>();
|
Map<PhaseInterval, String> intervalToRegexMap = new HashMap<>();
|
||||||
intervalToRegexMap.put(new PhaseInterval(CompilePhase.BEFORE_REMOVEUSELESS, CompilePhase.PHASEIDEALLOOP_ITERATIONS),
|
intervalToRegexMap.put(new PhaseInterval(CompilePhase.BEFORE_REMOVEUSELESS, CompilePhase.PHASEIDEALLOOP_ITERATIONS),
|
||||||
idealRegex);
|
idealIndependentRegex);
|
||||||
intervalToRegexMap.put(new PhaseInterval(CompilePhase.PRINT_OPTO_ASSEMBLY), optoRegex);
|
intervalToRegexMap.put(new PhaseInterval(CompilePhase.PRINT_OPTO_ASSEMBLY), optoRegex);
|
||||||
MultiPhaseRangeEntry entry = new MultiPhaseRangeEntry(CompilePhase.PRINT_OPTO_ASSEMBLY, intervalToRegexMap);
|
MultiPhaseRangeEntry entry = new MultiPhaseRangeEntry(CompilePhase.PRINT_OPTO_ASSEMBLY, intervalToRegexMap);
|
||||||
IR_NODE_MAPPINGS.put(irNode, entry);
|
IR_NODE_MAPPINGS.put(irNode, entry);
|
||||||
|
@ -104,6 +104,8 @@ class Basics {
|
|||||||
long l;
|
long l;
|
||||||
Object obj;
|
Object obj;
|
||||||
Object obj2;
|
Object obj2;
|
||||||
|
Object obj3;
|
||||||
|
Object obj4;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@IR(failOn = IRNode.STORE, phase = {CompilePhase.DEFAULT, CompilePhase.PRINT_IDEAL})
|
@IR(failOn = IRNode.STORE, phase = {CompilePhase.DEFAULT, CompilePhase.PRINT_IDEAL})
|
||||||
@ -243,6 +245,16 @@ class Basics {
|
|||||||
obj = new Object();
|
obj = new Object();
|
||||||
obj2 = new Object[1];
|
obj2 = new Object[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@IR(counts = {IRNode.ALLOC, "2", IRNode.ALLOC_ARRAY, "2"}, // works for all phases
|
||||||
|
phase = {CompilePhase.BEFORE_REMOVEUSELESS, CompilePhase.CCP1, CompilePhase.PRINT_OPTO_ASSEMBLY, CompilePhase.DEFAULT})
|
||||||
|
public void alloc2() {
|
||||||
|
obj = new Object();
|
||||||
|
obj2 = new Object[1];
|
||||||
|
obj3 = new Object();
|
||||||
|
obj4 = new Object[2];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class NoCompilationOutput {
|
class NoCompilationOutput {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user