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 { getA()18 public String getA() { 19 return "A"; 20 } getB()21 public String getB() { 22 return "B"; 23 } getC()24 public String getC() { 25 return "C"; 26 } 27 } 28 29 class TestInline { inlineMonomorphic(Super s)30 public int inlineMonomorphic(Super s) { 31 return s.getValue(); 32 } 33 inlinePolymorphic(Super s)34 public int inlinePolymorphic(Super s) { 35 return s.getValue(); 36 } 37 inlineMegamorphic(Super s)38 public int inlineMegamorphic(Super s) { 39 return s.getValue(); 40 } 41 inlineMissingTypes(Super s)42 public int inlineMissingTypes(Super s) { 43 return s.getValue(); 44 } 45 noInlineCache(Super s)46 public int noInlineCache(Super s) { 47 return s.getValue(); 48 } 49 } 50 51 abstract class Super { getValue()52 abstract int getValue(); 53 } 54 55 class SubA extends Super { getValue()56 int getValue() { return 42; } 57 } 58 59 class SubB extends Super { getValue()60 int getValue() { return 38; }; 61 } 62 63 class SubD extends Super { getValue()64 int getValue() { return 20; }; 65 } 66 67 class SubE extends Super { getValue()68 int getValue() { return 16; }; 69 } 70