langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
changeset 42828 cce89649f958
parent 41029 869e95ade880
child 43765 f2f8bfe6bcb5
equal deleted inserted replaced
42827:36468b5fa7f4 42828:cce89649f958
   474         if (clinitCode.length() != 0) {
   474         if (clinitCode.length() != 0) {
   475             MethodSymbol clinit = new MethodSymbol(
   475             MethodSymbol clinit = new MethodSymbol(
   476                 STATIC | (c.flags() & STRICTFP),
   476                 STATIC | (c.flags() & STRICTFP),
   477                 names.clinit,
   477                 names.clinit,
   478                 new MethodType(
   478                 new MethodType(
   479                     List.<Type>nil(), syms.voidType,
   479                     List.nil(), syms.voidType,
   480                     List.<Type>nil(), syms.methodClass),
   480                     List.nil(), syms.methodClass),
   481                 c);
   481                 c);
   482             c.members().enter(clinit);
   482             c.members().enter(clinit);
   483             List<JCStatement> clinitStats = clinitCode.toList();
   483             List<JCStatement> clinitStats = clinitCode.toList();
   484             JCBlock block = make.at(clinitStats.head.pos()).Block(0, clinitStats);
   484             JCBlock block = make.at(clinitStats.head.pos()).Block(0, clinitStats);
   485             block.endpos = TreeInfo.endPos(clinitStats.last());
   485             block.endpos = TreeInfo.endPos(clinitStats.last());
  1035             code.pendingStatPos = Position.NOPOS;
  1035             code.pendingStatPos = Position.NOPOS;
  1036         }
  1036         }
  1037     }
  1037     }
  1038 
  1038 
  1039     public void visitDoLoop(JCDoWhileLoop tree) {
  1039     public void visitDoLoop(JCDoWhileLoop tree) {
  1040         genLoop(tree, tree.body, tree.cond, List.<JCExpressionStatement>nil(), false);
  1040         genLoop(tree, tree.body, tree.cond, List.nil(), false);
  1041     }
  1041     }
  1042 
  1042 
  1043     public void visitWhileLoop(JCWhileLoop tree) {
  1043     public void visitWhileLoop(JCWhileLoop tree) {
  1044         genLoop(tree, tree.body, tree.cond, List.<JCExpressionStatement>nil(), true);
  1044         genLoop(tree, tree.body, tree.cond, List.nil(), true);
  1045     }
  1045     }
  1046 
  1046 
  1047     public void visitForLoop(JCForLoop tree) {
  1047     public void visitForLoop(JCForLoop tree) {
  1048         int limit = code.nextreg;
  1048         int limit = code.nextreg;
  1049         genStats(tree.init, env);
  1049         genStats(tree.init, env);
  1319                     code.state.unlock(lockVar.reg);
  1319                     code.state.unlock(lockVar.reg);
  1320                 }
  1320                 }
  1321             }
  1321             }
  1322         };
  1322         };
  1323         syncEnv.info.gaps = new ListBuffer<>();
  1323         syncEnv.info.gaps = new ListBuffer<>();
  1324         genTry(tree.body, List.<JCCatch>nil(), syncEnv);
  1324         genTry(tree.body, List.nil(), syncEnv);
  1325         code.endScopes(limit);
  1325         code.endScopes(limit);
  1326     }
  1326     }
  1327 
  1327 
  1328     public void visitTry(final JCTry tree) {
  1328     public void visitTry(final JCTry tree) {
  1329         // Generate code for a try statement with given body and catch clauses,
  1329         // Generate code for a try statement with given body and catch clauses,
  1901         if (allowBetterNullChecks) {
  1901         if (allowBetterNullChecks) {
  1902             callMethod(pos, syms.objectsType, names.requireNonNull,
  1902             callMethod(pos, syms.objectsType, names.requireNonNull,
  1903                     List.of(syms.objectType), true);
  1903                     List.of(syms.objectType), true);
  1904         } else {
  1904         } else {
  1905             callMethod(pos, syms.objectType, names.getClass,
  1905             callMethod(pos, syms.objectType, names.getClass,
  1906                     List.<Type>nil(), false);
  1906                     List.nil(), false);
  1907         }
  1907         }
  1908         code.emitop0(pop);
  1908         code.emitop0(pop);
  1909     }
  1909     }
  1910 
  1910 
  1911     public void visitBinary(JCBinary tree) {
  1911     public void visitBinary(JCBinary tree) {