langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
changeset 27122 c14f94b48e30
parent 27120 8ed4ea81b048
child 27123 10171e97e021
equal deleted inserted replaced
27121:36889255488f 27122:c14f94b48e30
  1223             // instruction. The difference in computation cost is
  1223             // instruction. The difference in computation cost is
  1224             // proportional to log(#cases), which is negligable, so we only
  1224             // proportional to log(#cases), which is negligable, so we only
  1225             // consider the size of the bytecode.
  1225             // consider the size of the bytecode.
  1226             // A discussion of the metric can be found here:
  1226             // A discussion of the metric can be found here:
  1227             // http://mail.openjdk.java.net/pipermail/compiler-dev/2014-September/008987.html
  1227             // http://mail.openjdk.java.net/pipermail/compiler-dev/2014-September/008987.html
  1228             int table_cost = 4 + (hi - lo + 1); // words
  1228             long table_cost = 4 + ((long)hi - lo + 1); // words
  1229             int lookup_cost = 3 + 2 * nlabels;
  1229             long lookup_cost = 3 + 2 * (long)nlabels;
  1230             int opcode = table_cost <= lookup_cost ? tableswitch : lookupswitch;
  1230             int opcode = table_cost <= lookup_cost ? tableswitch : lookupswitch;
  1231 
  1231 
  1232             int startpc = code.curCP();    // the position of the selector operation
  1232             int startpc = code.curCP();    // the position of the selector operation
  1233             code.emitop0(opcode);
  1233             code.emitop0(opcode);
  1234             code.align(4);
  1234             code.align(4);