xref: /aosp_15_r20/art/test/503-dead-instructions/smali/DeadInstructions.smali (revision 795d594fd825385562da6b089ea9b2033f3abf5a)
1*795d594fSAndroid Build Coastguard Worker# Copyright (C) 2015 The Android Open Source Project
2*795d594fSAndroid Build Coastguard Worker#
3*795d594fSAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License");
4*795d594fSAndroid Build Coastguard Worker# you may not use this file except in compliance with the License.
5*795d594fSAndroid Build Coastguard Worker# You may obtain a copy of the License at
6*795d594fSAndroid Build Coastguard Worker#
7*795d594fSAndroid Build Coastguard Worker#      http://www.apache.org/licenses/LICENSE-2.0
8*795d594fSAndroid Build Coastguard Worker#
9*795d594fSAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software
10*795d594fSAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS,
11*795d594fSAndroid Build Coastguard Worker# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*795d594fSAndroid Build Coastguard Worker# See the License for the specific language governing permissions and
13*795d594fSAndroid Build Coastguard Worker# limitations under the License.
14*795d594fSAndroid Build Coastguard Worker
15*795d594fSAndroid Build Coastguard Worker.class public LDeadInstructions;
16*795d594fSAndroid Build Coastguard Worker
17*795d594fSAndroid Build Coastguard Worker.super Ljava/lang/Object;
18*795d594fSAndroid Build Coastguard Worker
19*795d594fSAndroid Build Coastguard Worker.method public static method1()V
20*795d594fSAndroid Build Coastguard Worker   .registers 2
21*795d594fSAndroid Build Coastguard Worker   return-void
22*795d594fSAndroid Build Coastguard Worker   # Create a label and a branch to that label to trick the
23*795d594fSAndroid Build Coastguard Worker   # optimizing compiler into thinking the invoke is live.
24*795d594fSAndroid Build Coastguard Worker   :start
25*795d594fSAndroid Build Coastguard Worker   const/4 v0, 0
26*795d594fSAndroid Build Coastguard Worker   const/4 v1, 0
27*795d594fSAndroid Build Coastguard Worker   # Provide more arguments than we should. Because this is dead
28*795d594fSAndroid Build Coastguard Worker   # code, the verifier will not check the argument count. So
29*795d594fSAndroid Build Coastguard Worker   # the compilers must do the same.
30*795d594fSAndroid Build Coastguard Worker   invoke-static {v0, v1}, LDeadInstructions;->method1()V
31*795d594fSAndroid Build Coastguard Worker   goto :start
32*795d594fSAndroid Build Coastguard Worker.end method
33*795d594fSAndroid Build Coastguard Worker
34*795d594fSAndroid Build Coastguard Worker.method public static method2(J)V
35*795d594fSAndroid Build Coastguard Worker   .registers 3
36*795d594fSAndroid Build Coastguard Worker   return-void
37*795d594fSAndroid Build Coastguard Worker   :start
38*795d594fSAndroid Build Coastguard Worker   const/4 v0, 0
39*795d594fSAndroid Build Coastguard Worker   const/4 v1, 0
40*795d594fSAndroid Build Coastguard Worker   const/4 v2, 0
41*795d594fSAndroid Build Coastguard Worker   # Give a non-sequential pair for the long argument.
42*795d594fSAndroid Build Coastguard Worker   invoke-static {v0, v2}, LDeadInstructions;->method2(J)V
43*795d594fSAndroid Build Coastguard Worker   goto :start
44*795d594fSAndroid Build Coastguard Worker.end method
45*795d594fSAndroid Build Coastguard Worker
46*795d594fSAndroid Build Coastguard Worker.method public static method3()V
47*795d594fSAndroid Build Coastguard Worker   .registers 1
48*795d594fSAndroid Build Coastguard Worker   return-void
49*795d594fSAndroid Build Coastguard Worker   :start
50*795d594fSAndroid Build Coastguard Worker   const/4 v0, 0
51*795d594fSAndroid Build Coastguard Worker   # Give one half of a pair.
52*795d594fSAndroid Build Coastguard Worker   invoke-static {v0}, LDeadInstructions;->method2(J)V
53*795d594fSAndroid Build Coastguard Worker   goto :start
54*795d594fSAndroid Build Coastguard Worker.end method
55*795d594fSAndroid Build Coastguard Worker
56*795d594fSAndroid Build Coastguard Worker.method public static method4()V
57*795d594fSAndroid Build Coastguard Worker   .registers 2
58*795d594fSAndroid Build Coastguard Worker   return-void
59*795d594fSAndroid Build Coastguard Worker   :start
60*795d594fSAndroid Build Coastguard Worker   # Provide less arguments than we should.
61*795d594fSAndroid Build Coastguard Worker   invoke-static {}, LDeadInstructions;->method3(J)V
62*795d594fSAndroid Build Coastguard Worker   goto :start
63*795d594fSAndroid Build Coastguard Worker.end method
64