Sat, 14 Sep 2013 19:04:47 +0100
7047734: javac, the LVT is not generated correctly in several scenarios
Reviewed-by: jjg, mcimadamore
aoqi@0 | 1 | /* /nodynamiccopyright/ */ |
aoqi@0 | 2 | |
aoqi@0 | 3 | public class TestCaseSwitch { |
aoqi@0 | 4 | |
aoqi@0 | 5 | @AliveRange(varName="o", bytecodeStart=31, bytecodeLength=16) |
aoqi@0 | 6 | @AliveRange(varName="o", bytecodeStart=50, bytecodeLength=15) |
aoqi@0 | 7 | @AliveRange(varName="o", bytecodeStart=68, bytecodeLength=1) |
aoqi@0 | 8 | @AliveRange(varName="oo", bytecodeStart=39, bytecodeLength=26) |
aoqi@0 | 9 | @AliveRange(varName="uu", bytecodeStart=59, bytecodeLength=6) |
aoqi@0 | 10 | void m1(String[] args) { |
aoqi@0 | 11 | Object o; |
aoqi@0 | 12 | switch (args.length) { |
aoqi@0 | 13 | case 0: |
aoqi@0 | 14 | o = "0"; |
aoqi@0 | 15 | o.hashCode(); |
aoqi@0 | 16 | Object oo = "oo"; |
aoqi@0 | 17 | oo.hashCode(); |
aoqi@0 | 18 | break; |
aoqi@0 | 19 | case 1: |
aoqi@0 | 20 | o = "1"; |
aoqi@0 | 21 | o.hashCode(); |
aoqi@0 | 22 | Object uu = "uu"; |
aoqi@0 | 23 | uu.hashCode(); |
aoqi@0 | 24 | break; |
aoqi@0 | 25 | } |
aoqi@0 | 26 | o = "return"; |
aoqi@0 | 27 | } |
aoqi@0 | 28 | |
aoqi@0 | 29 | @AliveRange(varName="o", bytecodeStart=95, bytecodeLength=18) |
aoqi@0 | 30 | @AliveRange(varName="o", bytecodeStart=116, bytecodeLength=15) |
aoqi@0 | 31 | @AliveRange(varName="o", bytecodeStart=134, bytecodeLength=1) |
aoqi@0 | 32 | @AliveRange(varName="oo", bytecodeStart=104, bytecodeLength=27) |
aoqi@0 | 33 | @AliveRange(varName="uu", bytecodeStart=125, bytecodeLength=6) |
aoqi@0 | 34 | void m2(String[] args) { |
aoqi@0 | 35 | Object o; |
aoqi@0 | 36 | switch (args[0]) { |
aoqi@0 | 37 | case "string0": |
aoqi@0 | 38 | o = "0"; |
aoqi@0 | 39 | o.hashCode(); |
aoqi@0 | 40 | Object oo = "oo"; |
aoqi@0 | 41 | oo.hashCode(); |
aoqi@0 | 42 | break; |
aoqi@0 | 43 | case "string1": |
aoqi@0 | 44 | o = "1"; |
aoqi@0 | 45 | o.hashCode(); |
aoqi@0 | 46 | Object uu = "uu"; |
aoqi@0 | 47 | uu.hashCode(); |
aoqi@0 | 48 | break; |
aoqi@0 | 49 | } |
aoqi@0 | 50 | o = "return"; |
aoqi@0 | 51 | } |
aoqi@0 | 52 | |
aoqi@0 | 53 | @AliveRange(varName="o", bytecodeStart=31, bytecodeLength=8) |
aoqi@0 | 54 | @AliveRange(varName="o", bytecodeStart=42, bytecodeLength=8) |
aoqi@0 | 55 | @AliveRange(varName="o", bytecodeStart=53, bytecodeLength=9) |
aoqi@0 | 56 | void m3(String[] args) { |
aoqi@0 | 57 | Object o; |
aoqi@0 | 58 | switch (args.length) { |
aoqi@0 | 59 | case 0: |
aoqi@0 | 60 | o = "0"; |
aoqi@0 | 61 | o.hashCode(); |
aoqi@0 | 62 | break; |
aoqi@0 | 63 | case 1: |
aoqi@0 | 64 | o = "1"; |
aoqi@0 | 65 | o.hashCode(); |
aoqi@0 | 66 | break; |
aoqi@0 | 67 | default: |
aoqi@0 | 68 | o = "default"; |
aoqi@0 | 69 | o.hashCode(); |
aoqi@0 | 70 | } |
aoqi@0 | 71 | o = "finish"; |
aoqi@0 | 72 | } |
aoqi@0 | 73 | } |