8016610: javac, add new internal symbols to make operator resolution faster
authorvromero
Wed, 19 Jun 2013 22:07:05 +0100
changeset 18414 ee1e93e83d2b
parent 18413 5052b6314aad
child 18415 0ac940625f1d
child 18643 fdd7572e0c18
8016610: javac, add new internal symbols to make operator resolution faster Reviewed-by: jjg Contributed-by: maurizio.cimadamore@oracle.com
langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java
langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java
--- 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);