1# Copyright (C) 2016 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
17.super Ljava/lang/Object;
18
19.field public static staticField:Ljava/lang/String;
20
21## CHECK-START: void TestCase.testNoAlias(int[], java.lang.String) register (after)
22## CHECK:         <<Null:l\d+>>   NullConstant
23## CHECK:                         Deoptimize env:[[<<Null>>,{{.*]]}}
24## CHECK:                         InvokeStaticOrDirect method_name:java.lang.String.<init>
25.method public static testNoAlias([ILjava/lang/String;)V
26    .registers 6
27    const v1, 0
28    const v2, 1
29    new-instance v0, Ljava/lang/String;
30
31    # Will deoptimize.
32    aget v3, p0, v1
33
34    # Check that we're being executed by the interpreter.
35    invoke-static {}, LMain;->assertIsInterpreted()V
36
37    invoke-direct {v0, p1}, Ljava/lang/String;-><init>(Ljava/lang/String;)V
38
39    sput-object v0, LTestCase;->staticField:Ljava/lang/String;
40
41    # Will throw AIOOBE.
42    aget v3, p0, v2
43
44    return-void
45.end method
46
47## CHECK-START: void TestCase.testAlias(int[], java.lang.String) register (after)
48## CHECK:         <<New:l\d+>>    NewInstance
49## CHECK:                         Deoptimize env:[[<<New>>,<<New>>,{{.*]]}}
50## CHECK:                         InvokeStaticOrDirect method_name:java.lang.String.<init>
51.method public static testAlias([ILjava/lang/String;)V
52    .registers 7
53    const v2, 0
54    const v3, 1
55    new-instance v0, Ljava/lang/String;
56    move-object v1, v0
57
58    # Will deoptimize.
59    aget v4, p0, v2
60
61    # Check that we're being executed by the interpreter.
62    invoke-static {}, LMain;->assertIsInterpreted()V
63
64    invoke-direct {v1, p1}, Ljava/lang/String;-><init>(Ljava/lang/String;)V
65
66    sput-object v1, LTestCase;->staticField:Ljava/lang/String;
67
68    # Will throw AIOOBE.
69    aget v4, p0, v3
70
71    return-void
72.end method
73