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