1 /* 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 17 package p1; 18 19 public class InP1 { $inline$AllocateOtherInP1(int i)20 public static Object $inline$AllocateOtherInP1(int i) { 21 // Let this method execute a while to make sure the JIT sees it hot. 22 if (i <= 10000) { 23 return null; 24 } 25 // Set the flag that we have entered InP1 code to get OtherInP1 loaded. 26 PlaceHolder.entered = true; 27 return new OtherInP1(); 28 } 29 $inline$AllocateArrayOtherInP1(int i)30 public static Object $inline$AllocateArrayOtherInP1(int i) { 31 if (i <= 10000) { 32 return null; 33 } 34 return new OtherInP1[10]; 35 } 36 $inline$UseStaticFieldOtherInP1(int i)37 public static Object $inline$UseStaticFieldOtherInP1(int i) { 38 if (i <= 10000) { 39 return null; 40 } 41 return OtherInP1.staticField; 42 } 43 $inline$SetStaticFieldOtherInP1(int i)44 public static void $inline$SetStaticFieldOtherInP1(int i) { 45 if (i <= 10000) { 46 return; 47 } 48 OtherInP1.staticField = new Object(); 49 } 50 $inline$UseInstanceFieldOtherInP1(int i)51 public static Object $inline$UseInstanceFieldOtherInP1(int i) { 52 if (i <= 10000) { 53 return null; 54 } 55 return $noinline$AllocateOtherInP1().instanceField; 56 } 57 $inline$SetInstanceFieldOtherInP1(int i)58 public static void $inline$SetInstanceFieldOtherInP1(int i) { 59 if (i <= 10000) { 60 return; 61 } 62 $noinline$AllocateOtherInP1().instanceField = new Object(); 63 } 64 $noinline$AllocateOtherInP1()65 public static OtherInP1 $noinline$AllocateOtherInP1() { 66 try { 67 return new OtherInP1(); 68 } catch (Exception e) { 69 throw new Error(e); 70 } 71 } 72 $inline$LoadOtherInP1(int i)73 public static Object $inline$LoadOtherInP1(int i) { 74 if (i <= 10000) { 75 return null; 76 } 77 return OtherInP1.class; 78 } 79 $inline$StaticCallOtherInP1(int i)80 public static Object $inline$StaticCallOtherInP1(int i) { 81 if (i <= 10000) { 82 return null; 83 } 84 return OtherInP1.doTheStaticCall(); 85 } 86 $inline$InstanceCallOtherInP1(int i)87 public static Object $inline$InstanceCallOtherInP1(int i) { 88 if (i <= 10000) { 89 return null; 90 } 91 return $noinline$AllocateOtherInP1().doTheInstanceCall(); 92 } 93 } 94