8016610: javac, add new internal symbols to make operator resolution faster
Reviewed-by: jjg
Contributed-by: maurizio.cimadamore@oracle.com
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java Wed Jun 19 13:00:00 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java Wed Jun 19 22:07:05 2013 +0100
@@ -570,15 +570,18 @@
arrayClass.members().enter(arrayCloneMethod);
// Enter operators.
- enterUnop("+", doubleType, doubleType, nop);
- enterUnop("+", floatType, floatType, nop);
- enterUnop("+", longType, longType, nop);
- enterUnop("+", intType, intType, nop);
+ /* Internally we use +++, --- for unary +, - to reduce +, - operators
+ * overloading
+ */
+ enterUnop("+++", doubleType, doubleType, nop);
+ enterUnop("+++", floatType, floatType, nop);
+ enterUnop("+++", longType, longType, nop);
+ enterUnop("+++", intType, intType, nop);
- enterUnop("-", doubleType, doubleType, dneg);
- enterUnop("-", floatType, floatType, fneg);
- enterUnop("-", longType, longType, lneg);
- enterUnop("-", intType, intType, ineg);
+ enterUnop("---", doubleType, doubleType, dneg);
+ enterUnop("---", floatType, floatType, fneg);
+ enterUnop("---", longType, longType, lneg);
+ enterUnop("---", intType, intType, ineg);
enterUnop("~", longType, longType, lxor);
enterUnop("~", intType, intType, ixor);
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Wed Jun 19 13:00:00 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Wed Jun 19 22:07:05 2013 +0100
@@ -74,8 +74,11 @@
context.put(treeInfoKey, this);
Names names = Names.instance(context);
- setOpname(POS, "+", names);
- setOpname(NEG, names.hyphen);
+ /* Internally we use +++, --- for unary +, - to reduce +, - operators
+ * overloading
+ */
+ setOpname(POS, "+++", names);
+ setOpname(NEG, "---", names);
setOpname(NOT, "!", names);
setOpname(COMPL, "~", names);
setOpname(PREINC, "++", names);