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# Inliner used to assign exact type to the artificial multiple-return phi if the
19# class type was final which does not hold for arrays.
20
21# The type information is only used by recursive calls to the inliner and is
22# overwritten by the next pass of reference type propagation. Since we do not
23# inline any methods from array classes, this bug cannot be triggered and we
24# verify it using Checker.
25
26## CHECK-START: void TestCase.testInliner() inliner (after)
27## CHECK-DAG:             CheckCast [<<Phi:l\d+>>,{{l\d+}}]
28## CHECK-DAG:    <<Phi>>  Phi klass:java.lang.Object[] exact:false
29
30.method public static testInliner()V
31  .registers 3
32
33  invoke-static {}, Ljava/lang/System;->nanoTime()J
34  move-result-wide v0
35  long-to-int v0, v0
36
37  invoke-static {v0}, LTestCase;->$inline$getArray(I)[Ljava/lang/Object;
38  move-result-object v0
39
40  check-cast v0, [LMain$MyClassA;
41  return-void
42
43.end method
44
45.method public static $inline$getArray(I)[Ljava/lang/Object;
46  .registers 2
47  if-eqz p0, :else
48
49  :then
50  const/4 v0, 2
51  new-array v0, v0, [LMain$MyClassA;
52  return-object v0
53
54  :else
55  const/4 v0, 3
56  new-array v0, v0, [LMain$MyClassB;
57  return-object v0
58
59.end method
60