Home | History | Annotate | Download | only in smali
      1 # Copyright (C) 2017 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 LIrreducibleLoop;
     16 
     17 .super Ljava/lang/Object;
     18 
     19 .method public static simpleLoop(I)I
     20    .registers 3
     21    const/16 v0, 42
     22    if-eqz p0, :loop_entry
     23    goto :other_loop_pre_entry
     24 
     25    # The then part: beginning of the irreducible loop.
     26    :loop_entry
     27    if-nez p0, :exit
     28    invoke-static {v0},LIrreducibleLoop;->foo(I)V
     29    :other_loop_entry
     30    goto :loop_entry
     31 
     32    # The else part.
     33    :other_loop_pre_entry
     34    if-eqz p0, :other_loop_entry
     35    invoke-static {v0},LIrreducibleLoop;->foo(I)V
     36    goto :other_loop_entry
     37 
     38    :exit
     39    return v0
     40 .end method
     41 
     42 .method public static foo(I)V
     43    .registers 3
     44    const/16 v0, 0
     45    sget-boolean v1,LIrreducibleLoop;->doThrow:Z
     46    if-eqz v1, :exit
     47    # Inlining a method that throws requires re-computing loop information
     48    # which is unsupported when the caller has an irreducible loop.
     49    throw v0
     50    :exit
     51    return-void
     52 .end method
     53 
     54 .field public static doThrow:Z
     55