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