< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java

Print this page

        

*** 91,100 **** --- 91,101 ---- private final Operators operators; private final Check chk; private final Attr attr; private TreeMaker make; private DiagnosticPosition make_pos; + private final ClassWriter writer; private final ConstFold cfolder; private final Target target; private final Source source; private final TypeEnvs typeEnvs; private final Name dollarAssertionsDisabled;
*** 113,122 **** --- 114,124 ---- rs = Resolve.instance(context); operators = Operators.instance(context); chk = Check.instance(context); attr = Attr.instance(context); make = TreeMaker.instance(context); + writer = ClassWriter.instance(context); cfolder = ConstFold.instance(context); target = Target.instance(context); source = Source.instance(context); typeEnvs = TypeEnvs.instance(context); dollarAssertionsDisabled = names.
*** 471,481 **** this.pos = pos; Name varName = names .fromString(target.syntheticNameChar() + "SwitchMap" + target.syntheticNameChar() + ! names.fromUtf(ClassWriter.externalize(forEnum.type.tsym.flatName())).toString() .replace('/', '.') .replace('.', target.syntheticNameChar())); ClassSymbol outerCacheClass = outerCacheClass(); this.mapVar = new VarSymbol(STATIC | SYNTHETIC | FINAL, varName, --- 473,483 ---- this.pos = pos; Name varName = names .fromString(target.syntheticNameChar() + "SwitchMap" + target.syntheticNameChar() + ! writer.xClassName(forEnum.type).toString() .replace('/', '.') .replace('.', target.syntheticNameChar())); ClassSymbol outerCacheClass = outerCacheClass(); this.mapVar = new VarSymbol(STATIC | SYNTHETIC | FINAL, varName,
*** 2633,2649 **** // Equality checks involving a constant and null, e.g. // "" == null // are safe to simplify as no side-effects can occur. private boolean isTrue(JCTree exp) { ! if (exp.type.isTrue()) return true; Boolean b = expValue(exp); return b == null ? false : b; } private boolean isFalse(JCTree exp) { ! if (exp.type.isFalse()) return true; Boolean b = expValue(exp); return b == null ? false : !b; } /* look for (in)equality relations involving null. --- 2635,2651 ---- // Equality checks involving a constant and null, e.g. // "" == null // are safe to simplify as no side-effects can occur. private boolean isTrue(JCTree exp) { ! if (ConstFold.isTrue(exp.type.getTag(), exp.type.constValue())) return true; Boolean b = expValue(exp); return b == null ? false : b; } private boolean isFalse(JCTree exp) { ! if (ConstFold.isFalse(exp.type.getTag(), exp.type.constValue())) return true; Boolean b = expValue(exp); return b == null ? false : !b; } /* look for (in)equality relations involving null.
*** 2728,2742 **** /** Visitor method for assert statements. Translate them away. */ public void visitAssert(JCAssert tree) { tree.cond = translate(tree.cond, syms.booleanType); ! if (!tree.cond.type.isTrue()) { JCExpression cond = assertFlagTest(tree.pos()); List<JCExpression> exnArgs = (tree.detail == null) ? List.nil() : List.of(translate(tree.detail)); ! if (!tree.cond.type.isFalse()) { cond = makeBinary (AND, cond, makeUnary(NOT, tree.cond)); } --- 2730,2744 ---- /** Visitor method for assert statements. Translate them away. */ public void visitAssert(JCAssert tree) { tree.cond = translate(tree.cond, syms.booleanType); ! if (!ConstFold.isTrue(tree.cond.type.getTag(), tree.cond.type.constValue())) { JCExpression cond = assertFlagTest(tree.pos()); List<JCExpression> exnArgs = (tree.detail == null) ? List.nil() : List.of(translate(tree.detail)); ! if (!ConstFold.isFalse(tree.cond.type.getTag(), tree.cond.type.constValue())) { cond = makeBinary (AND, cond, makeUnary(NOT, tree.cond)); }
*** 3096,3106 **** } tree.arg = boxIfNeeded(translate(tree.arg, tree), tree.type); if (tree.hasTag(NOT) && tree.arg.type.constValue() != null) { ! tree.type = cfolder.fold1(bool_not, tree.arg.type); } // If translated left hand side is an Apply, we are // seeing an access method invocation. In this case, return // that access method invocation as result. --- 3098,3108 ---- } tree.arg = boxIfNeeded(translate(tree.arg, tree), tree.type); if (tree.hasTag(NOT) && tree.arg.type.constValue() != null) { ! tree.type = cfolder.fold1(tree.operator, tree.arg.type); } // If translated left hand side is an Apply, we are // seeing an access method invocation. In this case, return // that access method invocation as result.
< prev index next >