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

changeset 1109
3cdfa97e1be9
parent 1076
02b8381781ab
child 1127
ca49d50318dc
equal deleted inserted replaced
1108:b5d0b8effc85 1109:3cdfa97e1be9
957 // Clean up 957 // Clean up
958 if(stackMap == StackMapFormat.JSR202) { 958 if(stackMap == StackMapFormat.JSR202) {
959 code.lastFrame = null; 959 code.lastFrame = null;
960 code.frameBeforeLast = null; 960 code.frameBeforeLast = null;
961 } 961 }
962
963 //compress exception table
964 code.compressCatchTable();
962 } 965 }
963 } 966 }
964 967
965 private int initCode(JCMethodDecl tree, Env<GenContext> env, boolean fatcode) { 968 private int initCode(JCMethodDecl tree, Env<GenContext> env, boolean fatcode) {
966 MethodSymbol meth = tree.sym; 969 MethodSymbol meth = tree.sym;
1435 // Return. 1438 // Return.
1436 code.emitop1w(ret, retVar.reg); 1439 code.emitop1w(ret, retVar.reg);
1437 code.markDead(); 1440 code.markDead();
1438 } 1441 }
1439 } 1442 }
1440
1441 // Resolve all breaks. 1443 // Resolve all breaks.
1442 code.resolve(exitChain); 1444 code.resolve(exitChain);
1443 1445
1444 code.endScopes(limit); 1446 code.endScopes(limit);
1445 } 1447 }
1494 /** Register a catch clause in the "Exceptions" code-attribute. 1496 /** Register a catch clause in the "Exceptions" code-attribute.
1495 */ 1497 */
1496 void registerCatch(DiagnosticPosition pos, 1498 void registerCatch(DiagnosticPosition pos,
1497 int startpc, int endpc, 1499 int startpc, int endpc,
1498 int handler_pc, int catch_type) { 1500 int handler_pc, int catch_type) {
1499 if (startpc != endpc) { 1501 char startpc1 = (char)startpc;
1500 char startpc1 = (char)startpc; 1502 char endpc1 = (char)endpc;
1501 char endpc1 = (char)endpc; 1503 char handler_pc1 = (char)handler_pc;
1502 char handler_pc1 = (char)handler_pc; 1504 if (startpc1 == startpc &&
1503 if (startpc1 == startpc && 1505 endpc1 == endpc &&
1504 endpc1 == endpc && 1506 handler_pc1 == handler_pc) {
1505 handler_pc1 == handler_pc) { 1507 code.addCatch(startpc1, endpc1, handler_pc1,
1506 code.addCatch(startpc1, endpc1, handler_pc1, 1508 (char)catch_type);
1507 (char)catch_type); 1509 } else {
1510 if (!useJsrLocally && !target.generateStackMapTable()) {
1511 useJsrLocally = true;
1512 throw new CodeSizeOverflow();
1508 } else { 1513 } else {
1509 if (!useJsrLocally && !target.generateStackMapTable()) { 1514 log.error(pos, "limit.code.too.large.for.try.stmt");
1510 useJsrLocally = true; 1515 nerrs++;
1511 throw new CodeSizeOverflow();
1512 } else {
1513 log.error(pos, "limit.code.too.large.for.try.stmt");
1514 nerrs++;
1515 }
1516 } 1516 }
1517 } 1517 }
1518 } 1518 }
1519 1519
1520 /** Very roughly estimate the number of instructions needed for 1520 /** Very roughly estimate the number of instructions needed for

mercurial