• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Tests most/all DEX behaviors as of version 37.
2# Disassembled from dexdump test files.
3# Repo: https://android.googlesource.com/platform/art/
4# File: test/dexdump/all.dex
5
6# Compile using smali: https://github.com/JesusFreke/smali
7# java -jar smali.jar assemble all.smali --api 25
8
9.class public LA;
10.super Ljava/lang/Object;
11
12
13# static fields
14.field private static sB:B
15
16.field private static sC:C
17
18.field private static sI:I
19
20.field private static sJ:J
21
22.field private static sO:LA;
23
24.field private static sS:S
25
26.field private static sZ:Z
27
28
29# instance fields
30.field private mB:B
31
32.field private mC:C
33
34.field private mI:I
35
36.field private mJ:J
37
38.field private mO:LA;
39
40.field private mS:S
41
42.field private mZ:Z
43
44
45# direct methods
46.method public constructor <init>()V
47    .registers 1
48
49    invoke-direct {p0}, Ljava/lang/Object;-><init>()V
50
51    return-void
52.end method
53
54.method public static arrays()V
55    .registers 3
56
57    aget v0, v1, v2
58
59    aget-wide v0, v1, v2
60
61    aget-object v0, v1, v2
62
63    aget-boolean v0, v1, v2
64
65    aget-byte v0, v1, v2
66
67    aget-char v0, v1, v2
68
69    aget-short v0, v1, v2
70
71    aput v0, v1, v2
72
73    aput-wide v0, v1, v2
74
75    aput-object v0, v1, v2
76
77    aput-boolean v0, v1, v2
78
79    aput-byte v0, v1, v2
80
81    aput-char v0, v1, v2
82
83    aput-short v0, v1, v2
84
85    return-void
86.end method
87
88.method public static binary_ops()V
89    .registers 3
90
91    add-int v0, v1, v2
92
93    sub-int v0, v1, v2
94
95    mul-int v0, v1, v2
96
97    div-int v0, v1, v2
98
99    rem-int v0, v1, v2
100
101    and-int v0, v1, v2
102
103    or-int v0, v1, v2
104
105    xor-int v0, v1, v2
106
107    shl-int v0, v1, v2
108
109    shr-int v0, v1, v2
110
111    ushr-int v0, v1, v2
112
113    add-long v0, v1, v2
114
115    sub-long v0, v1, v2
116
117    mul-long v0, v1, v2
118
119    div-long v0, v1, v2
120
121    rem-long v0, v1, v2
122
123    and-long v0, v1, v2
124
125    or-long v0, v1, v2
126
127    xor-long v0, v1, v2
128
129    shl-long v0, v1, v2
130
131    shr-long v0, v1, v2
132
133    ushr-long v0, v1, v2
134
135    add-float v0, v1, v2
136
137    sub-float v0, v1, v2
138
139    mul-float v0, v1, v2
140
141    div-float v0, v1, v2
142
143    rem-float v0, v1, v2
144
145    add-double v0, v1, v2
146
147    sub-double v0, v1, v2
148
149    mul-double v0, v1, v2
150
151    div-double v0, v1, v2
152
153    rem-double v0, v1, v2
154
155    return-void
156.end method
157
158.method public static binary_ops_2addr()V
159    .registers 2
160
161    add-int/2addr v0, v1
162
163    sub-int/2addr v0, v1
164
165    mul-int/2addr v0, v1
166
167    div-int/2addr v0, v1
168
169    rem-int/2addr v0, v1
170
171    and-int/2addr v0, v1
172
173    or-int/2addr v0, v1
174
175    xor-int/2addr v0, v1
176
177    shl-int/2addr v0, v1
178
179    shr-int/2addr v0, v1
180
181    ushr-int/2addr v0, v1
182
183    add-long/2addr v0, v1
184
185    sub-long/2addr v0, v1
186
187    mul-long/2addr v0, v1
188
189    div-long/2addr v0, v1
190
191    rem-long/2addr v0, v1
192
193    and-long/2addr v0, v1
194
195    or-long/2addr v0, v1
196
197    xor-long/2addr v0, v1
198
199    shl-long/2addr v0, v1
200
201    shr-long/2addr v0, v1
202
203    ushr-long/2addr v0, v1
204
205    add-float/2addr v0, v1
206
207    sub-float/2addr v0, v1
208
209    mul-float/2addr v0, v1
210
211    div-float/2addr v0, v1
212
213    rem-float/2addr v0, v1
214
215    add-double/2addr v0, v1
216
217    sub-double/2addr v0, v1
218
219    mul-double/2addr v0, v1
220
221    div-double/2addr v0, v1
222
223    rem-double/2addr v0, v1
224
225    return-void
226.end method
227
228.method public static binary_ops_lit16()V
229    .registers 2
230
231    add-int/lit16 v0, v1, 0x1234
232
233    rsub-int v0, v1, 0x1234
234
235    mul-int/lit16 v0, v1, 0x1234
236
237    div-int/lit16 v0, v1, 0x1234
238
239    rem-int/lit16 v0, v1, 0x1234
240
241    and-int/lit16 v0, v1, 0x1234
242
243    or-int/lit16 v0, v1, 0x1234
244
245    xor-int/lit16 v0, v1, 0x1234
246
247    return-void
248.end method
249
250.method public static binary_ops_lit8()V
251    .registers 2
252
253    add-int/lit8 v0, v1, 0x12
254
255    rsub-int/lit8 v0, v1, 0x12
256
257    mul-int/lit8 v0, v1, 0x12
258
259    div-int/lit8 v0, v1, 0x12
260
261    rem-int/lit8 v0, v1, 0x12
262
263    and-int/lit8 v0, v1, 0x12
264
265    or-int/lit8 v0, v1, 0x12
266
267    xor-int/lit8 v0, v1, 0x12
268
269    shl-int/lit8 v0, v1, 0x12
270
271    shr-int/lit8 v0, v1, 0x12
272
273    ushr-int/lit8 v0, v1, 0x12
274
275    return-void
276.end method
277
278.method public static compares()V
279    .registers 3
280
281    cmpl-float v0, v1, v2
282
283    cmpg-float v0, v1, v2
284
285    cmpl-double v0, v1, v2
286
287    cmpg-double v0, v1, v2
288
289    cmp-long v0, v1, v2
290
291    return-void
292.end method
293
294.method public static conditionals()V
295    .registers 2
296
297    if-eq v0, v1, :cond_18
298
299    if-ne v0, v1, :cond_18
300
301    if-lt v0, v1, :cond_18
302
303    if-ge v0, v1, :cond_18
304
305    if-gt v0, v1, :cond_18
306
307    if-le v0, v1, :cond_18
308
309    if-eqz v0, :cond_18
310
311    if-nez v0, :cond_18
312
313    if-ltz v0, :cond_18
314
315    if-gez v0, :cond_18
316
317    if-gtz v0, :cond_18
318
319    if-lez v0, :cond_18
320
321    :cond_18
322    return-void
323.end method
324
325.method public static constants()V
326    .registers 1
327
328    const/4 v0, 0x1
329
330    const/16 v0, 0x1234
331
332    const v0, 0x12345678
333
334    const/high16 v0, 0x12340000
335
336    const-wide/16 v0, 0x1234
337
338    const-wide/32 v0, 0x12345678
339
340    const-wide v0, 0x1234567890abcdefL    # 5.626349108908516E-221
341
342    const-wide/high16 v0, 0x1234000000000000L
343
344    const-string v0, "string"
345
346    const-string/jumbo v0, "string"
347
348    const-class v0, Ljava/lang/Object;
349
350    return-void
351.end method
352
353.method public static misc()V
354    .registers 5
355
356    nop
357
358    monitor-enter v0
359
360    monitor-exit v0
361
362    check-cast v0, Ljava/lang/Object;
363
364    instance-of v0, v1, Ljava/lang/Object;
365
366    array-length v0, v1
367
368    new-instance v0, Ljava/lang/Object;
369
370    new-array v0, v1, Ljava/lang/Object;
371
372    filled-new-array {v0, v1, v2, v3, v4}, [Ljava/lang/Object;
373
374    filled-new-array/range {v0 .. v4}, [Ljava/lang/Object;
375
376    fill-array-data v0, :array_1e
377
378    throw v0
379
380    goto :goto_1c
381
382    goto/16 :goto_1c
383
384    goto/32 :goto_1c
385
386    :goto_1c
387    return-void
388
389    nop
390
391    :array_1e
392    .array-data 4
393        0x1
394        0x2
395        0x3
396        0x4
397        0x5
398        0x6
399        0x7
400        0x8
401        0x9
402        0x0
403    .end array-data
404.end method
405
406.method public static moves()V
407    .registers 2
408
409    move v0, v1
410
411    move/from16 v0, v1
412
413    move/16 v0, v1
414
415    move-wide v0, v1
416
417    move-wide/from16 v0, v1
418
419    move-wide/16 v0, v1
420
421    move-object v0, v1
422
423    move-object/from16 v0, v1
424
425    move-object/16 v0, v1
426
427    move-result v0
428
429    move-result-wide v0
430
431    move-result-object v0
432
433    move-exception v0
434
435    return-void
436.end method
437
438.method public static packed_switch()V
439    .registers 1
440
441    packed-switch v0, :pswitch_data_8
442
443    :goto_3
444    return-void
445
446    goto :goto_3
447
448    :pswitch_5
449    goto :goto_3
450
451    :pswitch_6
452    goto :goto_3
453
454    nop
455
456    :pswitch_data_8
457    .packed-switch 0x7ffffffe
458        :pswitch_5
459        :pswitch_6
460    .end packed-switch
461.end method
462
463.method public static return32()I
464    .registers 1
465
466    return v0
467.end method
468
469.method public static return64()I
470    .registers 2
471
472    return-wide v0
473.end method
474
475.method public static return_object()Ljava/lang/Object;
476    .registers 1
477
478    return-object v0
479.end method
480
481.method public static sparse_switch()V
482    .registers 2
483
484    sparse-switch v0, :sswitch_data_4
485
486    :sswitch_3
487    return-void
488
489    :sswitch_data_4
490    .sparse-switch
491        0x1111 -> :sswitch_3
492        0x2222 -> :sswitch_3
493        0x3333 -> :sswitch_3
494        0x4444 -> :sswitch_3
495    .end sparse-switch
496.end method
497
498.method public static static_fields()V
499    .registers 1
500
501    sget v0, LA;->sI:I
502
503    sget-wide v0, LA;->sJ:J
504
505    sget-object v0, LA;->sO:LA;
506
507    sget-boolean v0, LA;->sZ:Z
508
509    sget-byte v0, LA;->sB:B
510
511    sget-char v0, LA;->sC:C
512
513    sget-short v0, LA;->sS:S
514
515    sput v0, LA;->sI:I
516
517    sput-wide v0, LA;->sJ:J
518
519    sput-object v0, LA;->sO:LA;
520
521    sput-boolean v0, LA;->sZ:Z
522
523    sput-byte v0, LA;->sB:B
524
525    sput-char v0, LA;->sC:C
526
527    sput-short v0, LA;->mS:S
528
529    return-void
530.end method
531
532.method public static unary_ops()V
533    .registers 2
534
535    neg-int v0, v1
536
537    not-int v0, v1
538
539    neg-long v0, v1
540
541    not-long v0, v1
542
543    neg-float v0, v1
544
545    neg-double v0, v1
546
547    int-to-long v0, v1
548
549    int-to-float v0, v1
550
551    int-to-double v0, v1
552
553    long-to-int v0, v1
554
555    long-to-float v0, v1
556
557    long-to-double v0, v1
558
559    float-to-int v0, v1
560
561    float-to-long v0, v1
562
563    float-to-double v0, v1
564
565    double-to-int v0, v1
566
567    double-to-long v0, v1
568
569    double-to-float v0, v1
570
571    int-to-byte v0, v1
572
573    int-to-char v0, v1
574
575    int-to-short v0, v1
576
577    return-void
578.end method
579
580
581# virtual methods
582.method public instance_fields()V
583    .registers 2
584
585    iget v0, p0, LA;->sI:I
586
587    iget-wide v0, p0, LA;->sJ:J
588
589    iget-object v0, p0, LA;->sO:LA;
590
591    iget-boolean v0, p0, LA;->sZ:Z
592
593    iget-byte v0, p0, LA;->sB:B
594
595    iget-char v0, p0, LA;->sC:C
596
597    iget-short v0, p0, LA;->sS:S
598
599    iput v0, p0, LA;->sI:I
600
601    iput-wide v0, p0, LA;->sJ:J
602
603    iput-object v0, p0, LA;->sO:LA;
604
605    iput-boolean v0, p0, LA;->sZ:Z
606
607    iput-byte v0, p0, LA;->sB:B
608
609    iput-char v0, p0, LA;->sC:C
610
611    iput-short v0, p0, LA;->sS:S
612
613    return-void
614.end method
615
616.method public invokes()V
617    .registers 5
618
619    invoke-virtual {v0, v1, v2, v3, p0}, LA;->invokes()V
620
621    invoke-super {v0, v1, v2, v3, p0}, LA;->invokes()V
622
623    invoke-direct {v0, v1, v2, v3, p0}, LA;->invokes()V
624
625    invoke-static {v0, v1, v2, v3, p0}, LA;->invokes()V
626
627    invoke-interface {v0, v1, v2, v3, p0}, LA;->invokes()V
628.end method
629