blob: 5080f142b1bb7e03b5c457a348bc83f941dacd4a [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 Geoffraye5234232015-12-02 09:06:11 +000022 /// CHECK-START: void Main.inlineSharpenInvokeVirtual(Main) builder (after)
23 /// CHECK-DAG: <<Invoke:v\d+>> InvokeVirtual
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)
Nicolas Geoffraye5234232015-12-02 09:06:11 +000027 /// CHECK-NOT: InvokeVirtual
David Brazdila06d66a2015-05-28 11:14:54 +010028 /// CHECK-NOT: InvokeStaticOrDirect
Nicolas Geoffray79041292015-03-26 10:05:54 +000029
30 public static void inlineSharpenInvokeVirtual(Main m) {
31 m.invokeVirtual();
32 }
33
Nicolas Geoffraye5234232015-12-02 09:06:11 +000034 /// CHECK-START: int Main.inlineSharpenStringInvoke() ssa_builder (after)
35 /// CHECK-DAG: <<Invoke:i\d+>> InvokeVirtual
David Brazdila06d66a2015-05-28 11:14:54 +010036 /// CHECK-DAG: Return [<<Invoke>>]
Nicolas Geoffray79041292015-03-26 10:05:54 +000037
David Brazdila06d66a2015-05-28 11:14:54 +010038 /// CHECK-START: int Main.inlineSharpenStringInvoke() inliner (after)
39 /// CHECK-NOT: InvokeStaticOrDirect
Nicolas Geoffraye5234232015-12-02 09:06:11 +000040 /// CHECK-NOT: InvokeVirtual
Nicolas Geoffray79041292015-03-26 10:05:54 +000041
David Brazdila06d66a2015-05-28 11:14:54 +010042 /// CHECK-START: int Main.inlineSharpenStringInvoke() inliner (after)
43 /// CHECK-DAG: <<Field:i\d+>> InstanceFieldGet
44 /// CHECK-DAG: Return [<<Field>>]
Nicolas Geoffray79041292015-03-26 10:05:54 +000045
46 public static int inlineSharpenStringInvoke() {
47 return "Foo".length();
48 }
49
50 public static void main(String[] args) {
51 inlineSharpenInvokeVirtual(new Main());
52 if (inlineSharpenStringInvoke() != 3) {
53 throw new Error("Expected 3");
54 }
55 }
56}