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