fix perf bug with xor promotion
This commit is contained in:
parent
d0e4485d42
commit
cd4f4594d6
|
@ -826,6 +826,10 @@ public final class AnalyzerCaster {
|
|||
final Sort sort0 = from0.sort;
|
||||
final Sort sort1 = from1.sort;
|
||||
|
||||
if (sort0 == Sort.DEF || sort1 == Sort.DEF) {
|
||||
return Definition.DEF_TYPE;
|
||||
}
|
||||
|
||||
if (sort0.bool || sort1.bool) {
|
||||
return Definition.BOOLEAN_TYPE;
|
||||
}
|
||||
|
|
|
@ -343,7 +343,22 @@ public class DefOptimizationTests extends ScriptTestCase {
|
|||
assertBytecodeExists("def x = 1; def y = 2; double d = x ^ y",
|
||||
"INVOKEDYNAMIC xor(Ljava/lang/Object;Ljava/lang/Object;)D");
|
||||
}
|
||||
|
||||
public void testBooleanXorOptLHS() {
|
||||
assertBytecodeExists("boolean x = true; def y = true; return x ^ y",
|
||||
"INVOKEDYNAMIC xor(ZLjava/lang/Object;)Ljava/lang/Object;");
|
||||
}
|
||||
|
||||
public void testBooleanXorOptRHS() {
|
||||
assertBytecodeExists("def x = true; boolean y = true; return x ^ y",
|
||||
"INVOKEDYNAMIC xor(Ljava/lang/Object;Z)Ljava/lang/Object;");
|
||||
}
|
||||
|
||||
public void testBooleanXorOptRet() {
|
||||
assertBytecodeExists("def x = true; def y = true; boolean v = x ^ y",
|
||||
"INVOKEDYNAMIC xor(Ljava/lang/Object;Ljava/lang/Object;)Z");
|
||||
}
|
||||
|
||||
public void testLtOptLHS() {
|
||||
assertBytecodeExists("int x = 1; def y = 2; return x < y",
|
||||
"INVOKEDYNAMIC lt(ILjava/lang/Object;)Z");
|
||||
|
|
Loading…
Reference in New Issue