1.class public Lmain;
2
3.super Ljava/lang/Object;
4
5.method public static main([Ljava/lang/String;)V
6    .registers 3
7
8    :here4
9    const v0, 0
10
11    :here3
12
13    new-instance v2, Lsuperclass;
14    invoke-direct {v2}, Lsuperclass;-><init>()V
15
16    if-eqz v0, :here
17
18
19    #this is the unresolvable instruction. v0 is always null,
20    #and this will always throw an exception. It should be
21    #replaced with throw v0.
22    invoke-virtual {v0}, Lrandomclass;->getSuperclass()Lsuperclass;
23    move-result-object v1
24
25
26    if-eqz v0, :here
27
28    #this would normally be deodexable, except that it follows
29    #the above un-deodexeable instruction, which prevents the
30    #propagation of any register information. It can never be
31    #reached, and should be replaced with throw v2
32    invoke-virtual {v2}, Lsuperclass;->somemethod()V
33
34    #another odexed instruction that uses the result of the
35    #first unresolveable odex instruction. This should
36    #be replaced with throw v1
37    invoke-virtual {v1}, Lsuperclass;->somemethod()V
38
39    :here
40
41    #and we're back to the non-dead code
42    invoke-virtual {v2}, Lsuperclass;->somemethod()V
43
44    if-nez v0, :here3
45
46    return-void
47.end method
48
49.method public static FirstInstructionTest(Lrandomclass;)V
50    .registers 1
51
52    :try_start
53        invoke-virtual/range {p0}, Lrandomclass;->getSuperclass()Lsuperclass;
54        return-void
55    :try_end
56    .catch Ljava/lang/Exception; {:try_start .. :try_end} :handler
57    :handler
58        :inner_try_start
59            #this tests that the parameter register types are correctly propagated to the exception handlers, in the
60            #case that the first instruction of the method can throw an exception and is in a try black
61            invoke-virtual/range {p0}, Lrandomclass;->getSuperclass()Lsuperclass;
62            return-void
63        :inner_try_end
64        .catch Ljava/lang/Exception; {:inner_try_start .. :inner_try_end} :inner_handler
65        :inner_handler
66            #this additionally tests that the register types are propagated recursively, in the case that the first
67            #instruction in the exception handler can also throw an exception, and is covered by a try block
68            invoke-virtual/range {p0}, Lrandomclass;->getSuperclass()Lsuperclass;
69            return-void
70.end method