Home | History | Annotate | Download | only in smali
      1 .class public LCatchHandlerOnEntry;
      2 
      3 .super Ljava/lang/Object;
      4 
      5 # Test we can execute a method starting with a catch handler (without
      6 # move-exception instruction). This method must be called with parameter
      7 # initialized to 0.
      8 #
      9 # We execute the catch handler (Label1) for the first time with p0 == 0.
     10 # We save its value in v0, increment p0 to 1 and execute the div-int
     11 # instruction (Label2) which throws an ArithmeticException (division by zero).
     12 # That exception is caught by the catch handler so we execute it a second time.
     13 # Now p0 == 1. When we we execute the div-int instruction, it succeeds and we
     14 # return its result: this is the initial value of v1 because "v1 = v1 / 1".
     15 .method public static catchHandlerOnEntry(I)I
     16 .registers 4
     17 :Label1
     18        const v1, 100
     19        move v0, p0
     20        add-int/lit8 p0, p0, 1
     21 
     22 :Label2
     23        invoke-static {v0}, LCatchHandlerOnEntryHelper;->throwExceptionDuringDeopt(I)V
     24 
     25 :Label3
     26        return v1
     27 
     28 .catchall {:Label2 .. :Label3} :Label1
     29 .end method
     30