Home | History | Annotate | Download | only in smali
      1 # Copyright (C) 2014 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 LTypePropagation;
     16 
     17 .super Ljava/lang/Object;
     18 
     19 .method public static method([I)V
     20    .registers 3
     21    const/4 v0, 0
     22    aget v1, v2, v0
     23    add-int v2, v1, v0
     24    if-eq v1, v0, :end
     25    # Putting a float in v1 will lead to the creation of a phi with one
     26    # float input and one integer input. Since the SSA builder trusts
     27    # the verifier, it assumes that the integer input must be converted
     28    # to float. However, since v0 is not used afterwards, the verifier
     29    # hasn't ensured that. Therefore, the compiler must remove
     30    # the phi prior to doing type propagation.
     31    int-to-float v1, v0
     32    :end
     33    # Do a call to create an environment that will capture all Dex registers.
     34    # This environment is the reason why a phi is created at the join block
     35    # of the if.
     36    invoke-static {}, LTypePropagation;->emptyMethod()V
     37    return-void
     38 .end method
     39 
     40 .method public static emptyMethod()V
     41    .registers 0
     42    return-void
     43 .end method
     44