SpecialInstructionPaddingTest.smali revision c64dcce4e3e2d924ced5c646ae93390449c46f2a
1.class public LSpecialInstructionPaddingTest; 2.super Ljava/lang/Object; 3.source "InstructionPaddingTest.smali" 4 5.method public constructor <init>()V 6 .registers 1 7 invoke-direct {p0}, Ljava/lang/Object;-><init>()V 8 return-void 9.end method 10 11.method public test()V 12 .registers 2 13 .annotation runtime Lorg/junit/Test; 14 .end annotation 15 16 const v0, 0 17 invoke-static {}, LSpecialInstructionPaddingTest;->paddingTest()I 18 move-result v0 19 20 21 22 const/16 v1, 12 23 24 #the real test is that dalvik loaded and verified this class. This is 25 #mostly just to make sure that the method was actually called 26 invoke-static {v0, v1}, LAssert;->assertEquals(II)V 27 28 return-void 29.end method 30 31.method public static paddingTest()I 32 .registers 2 33 34 const v0, 12 35 36switch: 37 packed-switch v0, PackedSwitch: 38 39Label10: 40 const v1, 10 41 return v1 42 43Label11: 44 const v1, 11 45 return v1 46 47Label12: 48 const v1, 12 49 return v1 50 51Label13: 52 const v1, 13 53 return v1 54 55 #this nop de-aligns the following packed-switch data 56 #smali should generate another nop before the packed-switch 57 #data to force alignment 58 nop 59 60PackedSwitch: 61 .packed-switch switch: 10 62 Label10: 63 Label11: 64 Label12: 65 Label13: 66 .end packed-switch 67.end method