1 2method A.<init>():void 3{ 4............................. begin block 1 ............................. 5 .src "tryCatch.java" 6 .line 2 7 .prologue_end 8 .line 2 9 0| move-object v0, v2 10 .local v0, "this", A 11 1| move-object v1, v0 12 2| invoke-direct {v1}, java.lang.Throwable.<init>():void 13.............................. end block 1 .............................. 14............................. begin block 2 ............................. 15 5| return-void 16.............................. end block 2 .............................. 17} 18 19method B.<init>():void 20{ 21............................. begin block 1 ............................. 22 .src "tryCatch.java" 23 .line 6 24 .prologue_end 25 .line 6 26 0| move-object v0, v2 27 .local v0, "this", B 28 1| move-object v1, v0 29 2| invoke-direct {v1}, java.lang.Throwable.<init>():void 30.............................. end block 1 .............................. 31............................. begin block 2 ............................. 32 5| return-void 33.............................. end block 2 .............................. 34} 35 36method TryCatch.<init>():void 37{ 38............................. begin block 1 ............................. 39 .src "tryCatch.java" 40 .line 10 41 .prologue_end 42 .line 10 43 0| move-object v0, v2 44 .local v0, "this", TryCatch 45 1| move-object v1, v0 46 2| invoke-direct {v1}, java.lang.Object.<init>():void 47.............................. end block 1 .............................. 48............................. begin block 2 ............................. 49 5| return-void 50.............................. end block 2 .............................. 51} 52 53method TryCatch.foo(int):int 54{ 55............................. begin block 1 ............................. 56 .params "?" 57 .src "tryCatch.java" 58 .line 27 59 .prologue_end 60 .line 27 61 0| move v0, v4 62 .local v0, "x", int 63 1| move v1, v0 64 2| if-lez v1, Label_4 65.............................. end block 1 .............................. 66............................. begin block 2 ............................. 67 .line 28 68 4| move v1, v0 69 5| packed-switch v1, Label_5 70.............................. end block 2 .............................. 71............................. begin block 3 ............................. 72 .line 31 73 8| const/4 v1, #+1 (0x00000001 | 1.40130e-45) 74 9| move v0, v1 75.............................. end block 3 .............................. 76............................. begin block 4 ............................. 77Label_1: 78 .line 34 79 .end_local v0 80 10| return v0 81.............................. end block 4 .............................. 82............................. begin block 5 ............................. 83Label_2: 84 .line 29 85 .restart_local v0 86 11| new-instance v1, A 87.............................. end block 5 .............................. 88............................. begin block 6 ............................. 89 13| move-object v3, v1 90 14| move-object v1, v3 91 15| move-object v2, v3 92 16| invoke-direct {v2}, A.<init>():void 93.............................. end block 6 .............................. 94............................. begin block 7 ............................. 95 19| throw v1 96.............................. end block 7 .............................. 97............................. begin block 8 ............................. 98Label_3: 99 .line 30 100 20| new-instance v1, B 101.............................. end block 8 .............................. 102............................. begin block 9 ............................. 103 22| move-object v3, v1 104 23| move-object v1, v3 105 24| move-object v2, v3 106 25| invoke-direct {v2}, B.<init>():void 107.............................. end block 9 .............................. 108............................. begin block 10 ............................. 109 28| throw v1 110.............................. end block 10 .............................. 111............................. begin block 11 ............................. 112Label_4: 113 .line 34 114 29| const/4 v1, #+0 (0x00000000 | 0.00000) 115 30| move v0, v1 116 31| goto Label_1 117.............................. end block 11 .............................. 118Label_5: <aligned> 119 .line 28 120 32| packed-switch-payload 121 1: Label_2 122 2: Label_3 123} 124 125method TryCatch.main(java.lang.String[]):void 126{ 127............................. begin block 1 ............................. 128 .params "?" 129 .src "tryCatch.java" 130 .line 15 131 .prologue_end 132 .line 15 133 0| move-object v0, v6 134 .local v0, "args", java.lang.String[] 135 1| const/4 v3, #+0 (0x00000000 | 0.00000) 136.............................. end block 1 .............................. 137 .try_begin_1 138............................. begin block 2 ............................. 139 2| invoke-static {v3}, TryCatch.foo(int):int 140.............................. end block 2 .............................. 141 .try_end_1 142 catch(B) : Label_3 143 catch(A) : Label_4 144 catch(...) : Label_5 145............................. begin block 3 ............................. 146 5| move-result v3 147.............................. end block 3 .............................. 148............................. begin block 4 ............................. 149Label_1: 150 .line 18 151 .line 22 152 6| sget-object v3, java.lang.System.out 153.............................. end block 4 .............................. 154............................. begin block 5 ............................. 155 8| const-string v4, "finally\n" 156.............................. end block 5 .............................. 157............................. begin block 6 ............................. 158 10| const/4 v5, #+0 (0x00000000 | 0.00000) 159 11| new-array v5, v5, java.lang.Object[] 160.............................. end block 6 .............................. 161............................. begin block 7 ............................. 162 13| invoke-virtual {v3,v4,v5}, java.io.PrintStream.printf(java.lang.String, java.lang.Object[]):java.io.PrintStream 163.............................. end block 7 .............................. 164............................. begin block 8 ............................. 165 16| move-result-object v3 166.............................. end block 8 .............................. 167............................. begin block 9 ............................. 168Label_2: 169 .line 23 170 .line 24 171 17| return-void 172.............................. end block 9 .............................. 173............................. begin block 10 ............................. 174Label_3: 175 .line 16 176 18| move-exception v3 177 19| move-object v1, v3 178.............................. end block 10 .............................. 179 .try_begin_2 180............................. begin block 11 ............................. 181 .line 17 182 .local v1, "ex", B 183 20| sget-object v3, java.lang.System.out 184.............................. end block 11 .............................. 185............................. begin block 12 ............................. 186 22| const-string v4, "catch: B\n" 187.............................. end block 12 .............................. 188............................. begin block 13 ............................. 189 24| const/4 v5, #+0 (0x00000000 | 0.00000) 190 25| new-array v5, v5, java.lang.Object[] 191.............................. end block 13 .............................. 192............................. begin block 14 ............................. 193 27| invoke-virtual {v3,v4,v5}, java.io.PrintStream.printf(java.lang.String, java.lang.Object[]):java.io.PrintStream 194.............................. end block 14 .............................. 195 .try_end_2 196 catch(A) : Label_4 197 catch(...) : Label_5 198............................. begin block 15 ............................. 199 30| move-result-object v3 200 31| goto Label_1 201.............................. end block 15 .............................. 202............................. begin block 16 ............................. 203Label_4: 204 .line 19 205 .end_local v1 206 32| move-exception v3 207 33| move-object v1, v3 208.............................. end block 16 .............................. 209 .try_begin_3 210............................. begin block 17 ............................. 211 .line 20 212 .local v1, "ex", A 213 34| sget-object v3, java.lang.System.out 214.............................. end block 17 .............................. 215............................. begin block 18 ............................. 216 36| const-string v4, "catch: A\n" 217.............................. end block 18 .............................. 218............................. begin block 19 ............................. 219 38| const/4 v5, #+0 (0x00000000 | 0.00000) 220 39| new-array v5, v5, java.lang.Object[] 221.............................. end block 19 .............................. 222............................. begin block 20 ............................. 223 41| invoke-virtual {v3,v4,v5}, java.io.PrintStream.printf(java.lang.String, java.lang.Object[]):java.io.PrintStream 224.............................. end block 20 .............................. 225 .try_end_3 226 catch(...) : Label_5 227............................. begin block 21 ............................. 228 44| move-result-object v3 229 .line 22 230 45| sget-object v3, java.lang.System.out 231.............................. end block 21 .............................. 232............................. begin block 22 ............................. 233 47| const-string v4, "finally\n" 234.............................. end block 22 .............................. 235............................. begin block 23 ............................. 236 49| const/4 v5, #+0 (0x00000000 | 0.00000) 237 50| new-array v5, v5, java.lang.Object[] 238.............................. end block 23 .............................. 239............................. begin block 24 ............................. 240 52| invoke-virtual {v3,v4,v5}, java.io.PrintStream.printf(java.lang.String, java.lang.Object[]):java.io.PrintStream 241.............................. end block 24 .............................. 242............................. begin block 25 ............................. 243 55| move-result-object v3 244 .line 23 245 56| goto Label_2 246.............................. end block 25 .............................. 247............................. begin block 26 ............................. 248Label_5: 249 .line 22 250 .end_local v1 251 57| move-exception v3 252 58| move-object v2, v3 253 59| sget-object v3, java.lang.System.out 254.............................. end block 26 .............................. 255............................. begin block 27 ............................. 256 61| const-string v4, "finally\n" 257.............................. end block 27 .............................. 258............................. begin block 28 ............................. 259 63| const/4 v5, #+0 (0x00000000 | 0.00000) 260 64| new-array v5, v5, java.lang.Object[] 261.............................. end block 28 .............................. 262............................. begin block 29 ............................. 263 66| invoke-virtual {v3,v4,v5}, java.io.PrintStream.printf(java.lang.String, java.lang.Object[]):java.io.PrintStream 264.............................. end block 29 .............................. 265............................. begin block 30 ............................. 266 69| move-result-object v3 267 70| move-object v3, v2 268 71| throw v3 269.............................. end block 30 .............................. 270} 271