changeset 1844:be10ac0081b2

8016610: javac, add new internal symbols to make operator resolution faster Reviewed-by: jjg Contributed-by: maurizio.cimadamore@oracle.com
author vromero
date Wed, 19 Jun 2013 22:07:05 +0100
parents 29dcd6715b04
children b3458329d060 6debfa63a4a1
files src/share/classes/com/sun/tools/javac/code/Symtab.java src/share/classes/com/sun/tools/javac/tree/TreeInfo.java
diffstat 2 files changed, 16 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/javac/code/Symtab.java	Wed Jun 19 13:00:00 2013 +0100
+++ b/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/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Wed Jun 19 13:00:00 2013 +0100
+++ b/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);