blob: 876496fdc432bebbc86979a68283a00a1db3cefc [file] [log] [blame]
Nicolas Geoffray79041292015-03-26 10:05:54 +00001/*
2* 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*/
16
17public final class Main {
18
19 public void invokeVirtual() {
20 }
21
David Brazdila06d66a2015-05-28 11:14:54 +010022 /// CHECK-START: void Main.inlineSharpenInvokeVirtual(Main) inliner (before)
23 /// CHECK-DAG: <<Invoke:v\d+>> InvokeStaticOrDirect
24 /// 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
David Brazdila06d66a2015-05-28 11:14:54 +010033 /// CHECK-START: int Main.inlineSharpenStringInvoke() inliner (before)
34 /// CHECK-DAG: <<Invoke:i\d+>> InvokeStaticOrDirect
35 /// 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}