src/share/classes/com/sun/tools/javac/jvm/Gen.java

changeset 1374
c002fdee76fd
parent 1358
fc123bdeddb8
child 1432
969c96b980b7
     1.1 --- a/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Tue Oct 23 13:58:56 2012 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Thu Oct 25 11:09:36 2012 -0700
     1.3 @@ -42,7 +42,7 @@
     1.4  
     1.5  import static com.sun.tools.javac.code.Flags.*;
     1.6  import static com.sun.tools.javac.code.Kinds.*;
     1.7 -import static com.sun.tools.javac.code.TypeTags.*;
     1.8 +import static com.sun.tools.javac.code.TypeTag.*;
     1.9  import static com.sun.tools.javac.jvm.ByteCodes.*;
    1.10  import static com.sun.tools.javac.jvm.CRTFlags.*;
    1.11  import static com.sun.tools.javac.main.Option.*;
    1.12 @@ -258,7 +258,7 @@
    1.13       */
    1.14      Symbol binaryQualifier(Symbol sym, Type site) {
    1.15  
    1.16 -        if (site.tag == ARRAY) {
    1.17 +        if (site.hasTag(ARRAY)) {
    1.18              if (sym == syms.lengthVar ||
    1.19                  sym.owner != syms.arrayClass)
    1.20                  return sym;
    1.21 @@ -305,13 +305,13 @@
    1.22       */
    1.23      int makeRef(DiagnosticPosition pos, Type type) {
    1.24          checkDimension(pos, type);
    1.25 -        return pool.put(type.tag == CLASS ? (Object)type.tsym : (Object)type);
    1.26 +        return pool.put(type.hasTag(CLASS) ? (Object)type.tsym : (Object)type);
    1.27      }
    1.28  
    1.29      /** Check if the given type is an array with too many dimensions.
    1.30       */
    1.31      private void checkDimension(DiagnosticPosition pos, Type t) {
    1.32 -        switch (t.tag) {
    1.33 +        switch (t.getTag()) {
    1.34          case METHOD:
    1.35              checkDimension(pos, t.getReturnType());
    1.36              for (List<Type> args = t.getParameterTypes(); args.nonEmpty(); args = args.tail)
    1.37 @@ -922,7 +922,7 @@
    1.38                  if (code.isAlive()) {
    1.39                      code.statBegin(TreeInfo.endPos(tree.body));
    1.40                      if (env.enclMethod == null ||
    1.41 -                        env.enclMethod.sym.type.getReturnType().tag == VOID) {
    1.42 +                        env.enclMethod.sym.type.getReturnType().hasTag(VOID)) {
    1.43                          code.emitop0(return_);
    1.44                      } else {
    1.45                          // sometime dead code seems alive (4415991);
    1.46 @@ -1110,7 +1110,7 @@
    1.47  
    1.48      public void visitSwitch(JCSwitch tree) {
    1.49          int limit = code.nextreg;
    1.50 -        Assert.check(tree.selector.type.tag != CLASS);
    1.51 +        Assert.check(!tree.selector.type.hasTag(CLASS));
    1.52          int startpcCrt = genCrt ? code.curPc() : 0;
    1.53          Item sel = genExpr(tree.selector, syms.intType);
    1.54          List<JCCase> cases = tree.cases;
    1.55 @@ -1817,8 +1817,8 @@
    1.56              // proceeding further.
    1.57              if ((tree.hasTag(PLUS_ASG) || tree.hasTag(MINUS_ASG)) &&
    1.58                  l instanceof LocalItem &&
    1.59 -                tree.lhs.type.tag <= INT &&
    1.60 -                tree.rhs.type.tag <= INT &&
    1.61 +                tree.lhs.type.getTag().isSubRangeOf(INT) &&
    1.62 +                tree.rhs.type.getTag().isSubRangeOf(INT) &&
    1.63                  tree.rhs.type.constValue() != null) {
    1.64                  int ival = ((Number) tree.rhs.type.constValue()).intValue();
    1.65                  if (tree.hasTag(MINUS_ASG)) ival = -ival;
    1.66 @@ -1969,7 +1969,7 @@
    1.67           */
    1.68          void appendString(JCTree tree) {
    1.69              Type t = tree.type.baseType();
    1.70 -            if (t.tag > lastBaseTag && t.tsym != syms.stringType.tsym) {
    1.71 +            if (!t.isPrimitive() && t.tsym != syms.stringType.tsym) {
    1.72                  t = syms.objectType;
    1.73              }
    1.74              items.makeMemberItem(getStringBufferAppend(tree, t), false).invoke();
    1.75 @@ -2067,7 +2067,7 @@
    1.76          // which is not statically a supertype of the expression's type.
    1.77          // For basic types, the coerce(...) in genExpr(...) will do
    1.78          // the conversion.
    1.79 -        if (tree.clazz.type.tag > lastBaseTag &&
    1.80 +        if (!tree.clazz.type.isPrimitive() &&
    1.81              types.asSuper(tree.expr.type, tree.clazz.type.tsym) == null) {
    1.82              code.emitop2(checkcast, makeRef(tree.pos(), tree.clazz.type));
    1.83          }
    1.84 @@ -2185,7 +2185,7 @@
    1.85      }
    1.86  
    1.87      public void visitLiteral(JCLiteral tree) {
    1.88 -        if (tree.type.tag == TypeTags.BOT) {
    1.89 +        if (tree.type.hasTag(BOT)) {
    1.90              code.emitop0(aconst_null);
    1.91              if (types.dimensions(pt) > 1) {
    1.92                  code.emitop2(checkcast, makeRef(tree.pos(), pt));

mercurial