Calin Juravle | 877fd96 | 2016-01-05 14:29:29 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 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 | |
| 17 | class Main { |
| 18 | public String getA() { |
| 19 | return "A"; |
| 20 | } |
| 21 | public String getB() { |
| 22 | return "B"; |
| 23 | } |
| 24 | public String getC() { |
| 25 | return "C"; |
| 26 | } |
| 27 | } |
Calin Juravle | e0ac115 | 2017-02-13 19:03:47 -0800 | [diff] [blame] | 28 | |
| 29 | class TestInline { |
| 30 | public int inlineMonomorphic(Super s) { |
| 31 | return s.getValue(); |
| 32 | } |
| 33 | |
| 34 | public int inlinePolymorphic(Super s) { |
| 35 | return s.getValue(); |
| 36 | } |
| 37 | |
| 38 | public int inlineMegamorphic(Super s) { |
| 39 | return s.getValue(); |
| 40 | } |
| 41 | |
Calin Juravle | 589e71e | 2017-03-03 16:05:05 -0800 | [diff] [blame] | 42 | public int inlineMissingTypes(Super s) { |
| 43 | return s.getValue(); |
| 44 | } |
| 45 | |
Calin Juravle | e0ac115 | 2017-02-13 19:03:47 -0800 | [diff] [blame] | 46 | public int noInlineCache(Super s) { |
| 47 | return s.getValue(); |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | abstract class Super { |
| 52 | abstract int getValue(); |
| 53 | } |
| 54 | |
| 55 | class SubA extends Super { |
| 56 | int getValue() { return 42; } |
| 57 | } |
| 58 | |
| 59 | class SubB extends Super { |
| 60 | int getValue() { return 38; }; |
| 61 | } |
| 62 | |
| 63 | class SubD extends Super { |
| 64 | int getValue() { return 20; }; |
| 65 | } |
| 66 | |
| 67 | class SubE extends Super { |
| 68 | int getValue() { return 16; }; |
| 69 | } |