blob: 6dce96c9ca53e56592c28c5d4c58d5cf5e6af724 [file] [log] [blame]
Nicolas Geoffray79041292015-03-26 10:05:54 +00001/*
Roland Levillain6a92a032015-07-23 12:15:01 +01002 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Nicolas Geoffray79041292015-03-26 10:05:54 +000016
17public final class Main {
18
19 public void invokeVirtual() {
20 }
21
Nicolas Geoffrayc88ef3a2015-12-01 16:28:10 +000022 /// CHECK-START: void Main.inlineSharpenInvokeVirtual(Main) inliner (before)
23 /// CHECK-DAG: <<Invoke:v\d+>> InvokeStaticOrDirect
David Brazdila06d66a2015-05-28 11:14:54 +010024 /// CHECK-DAG: ReturnVoid
Nicolas Geoffray79041292015-03-26 10:05:54 +000025
David Brazdila06d66a2015-05-28 11:14:54 +010026 /// CHECK-START: void Main.inlineSharpenInvokeVirtual(Main) inliner (after)
27 /// CHECK-NOT: InvokeStaticOrDirect
Nicolas Geoffray79041292015-03-26 10:05:54 +000028
29 public static void inlineSharpenInvokeVirtual(Main m) {
30 m.invokeVirtual();
31 }
32
Nicolas Geoffrayc88ef3a2015-12-01 16:28:10 +000033 /// CHECK-START: int Main.inlineSharpenStringInvoke() inliner (before)
34 /// CHECK-DAG: <<Invoke:i\d+>> InvokeStaticOrDirect
David Brazdila06d66a2015-05-28 11:14:54 +010035 /// CHECK-DAG: Return [<<Invoke>>]
Nicolas Geoffray79041292015-03-26 10:05:54 +000036
David Brazdila06d66a2015-05-28 11:14:54 +010037 /// CHECK-START: int Main.inlineSharpenStringInvoke() inliner (after)
38 /// CHECK-NOT: InvokeStaticOrDirect
Nicolas Geoffray79041292015-03-26 10:05:54 +000039
David Brazdila06d66a2015-05-28 11:14:54 +010040 /// CHECK-START: int Main.inlineSharpenStringInvoke() inliner (after)
41 /// CHECK-DAG: <<Field:i\d+>> InstanceFieldGet
42 /// CHECK-DAG: Return [<<Field>>]
Nicolas Geoffray79041292015-03-26 10:05:54 +000043
44 public static int inlineSharpenStringInvoke() {
45 return "Foo".length();
46 }
47
48 public static void main(String[] args) {
49 inlineSharpenInvokeVirtual(new Main());
50 if (inlineSharpenStringInvoke() != 3) {
51 throw new Error("Expected 3");
52 }
53 }
54}