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 LTestCase; 16*795d594fSAndroid Build Coastguard Worker.super Ljava/lang/Object; 17*795d594fSAndroid Build Coastguard Worker 18*795d594fSAndroid Build Coastguard Worker# The following test case would crash liveness analysis because the back edge of 19*795d594fSAndroid Build Coastguard Worker# the outer loop would have a smaller liveness position than the two back edges 20*795d594fSAndroid Build Coastguard Worker# of the inner loop. This was caused by a bug which did not split the critical 21*795d594fSAndroid Build Coastguard Worker# edge between TryBoundary and outer loop header (b/25493695). 22*795d594fSAndroid Build Coastguard Worker 23*795d594fSAndroid Build Coastguard Worker.method public static testCase(II)I 24*795d594fSAndroid Build Coastguard Worker .registers 10 25*795d594fSAndroid Build Coastguard Worker 26*795d594fSAndroid Build Coastguard Worker const v0, 0x0 # v0 = result 27*795d594fSAndroid Build Coastguard Worker const v1, 0x1 # v1 = const 1 28*795d594fSAndroid Build Coastguard Worker 29*795d594fSAndroid Build Coastguard Worker move v2, p0 # v2 = outer loop counter 30*795d594fSAndroid Build Coastguard Worker :outer_loop 31*795d594fSAndroid Build Coastguard Worker if-eqz v2, :return 32*795d594fSAndroid Build Coastguard Worker sub-int/2addr v2, v1 33*795d594fSAndroid Build Coastguard Worker 34*795d594fSAndroid Build Coastguard Worker :try_start 35*795d594fSAndroid Build Coastguard Worker 36*795d594fSAndroid Build Coastguard Worker move v3, p1 # v3 = inner loop counter 37*795d594fSAndroid Build Coastguard Worker :inner_loop 38*795d594fSAndroid Build Coastguard Worker invoke-static {}, Ljava/lang/System;->nanoTime()J # throwing instruction 39*795d594fSAndroid Build Coastguard Worker if-eqz v3, :outer_loop # back edge of outer loop 40*795d594fSAndroid Build Coastguard Worker sub-int/2addr v3, v1 41*795d594fSAndroid Build Coastguard Worker 42*795d594fSAndroid Build Coastguard Worker invoke-static {}, Ljava/lang/System;->nanoTime()J # throwing instruction 43*795d594fSAndroid Build Coastguard Worker add-int/2addr v0, v1 44*795d594fSAndroid Build Coastguard Worker goto :inner_loop # back edge of inner loop 45*795d594fSAndroid Build Coastguard Worker 46*795d594fSAndroid Build Coastguard Worker :try_end 47*795d594fSAndroid Build Coastguard Worker .catchall {:try_start .. :try_end} :catch 48*795d594fSAndroid Build Coastguard Worker 49*795d594fSAndroid Build Coastguard Worker :catch 50*795d594fSAndroid Build Coastguard Worker const v4, 0x2 51*795d594fSAndroid Build Coastguard Worker add-int/2addr v0, v4 52*795d594fSAndroid Build Coastguard Worker goto :inner_loop # back edge of inner loop 53*795d594fSAndroid Build Coastguard Worker 54*795d594fSAndroid Build Coastguard Worker :return 55*795d594fSAndroid Build Coastguard Worker return v0 56*795d594fSAndroid Build Coastguard Worker 57*795d594fSAndroid Build Coastguard Worker.end method 58