1 /* 2 * Copyright (C) 2017 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 public class Main { main(String[] args)18 public static void main(String[] args) { 19 Main m = new Main(); 20 Nested n = new Nested(); 21 n.$noinline$setPrivateIntField(m, 42); 22 System.out.println(n.$noinline$getPrivateIntField(m)); 23 } 24 25 private int privateIntField; 26 27 private static class Nested { 28 /// CHECK-START: void Main$Nested.$noinline$setPrivateIntField(Main, int) inliner (before) 29 /// CHECK: InvokeStaticOrDirect 30 31 /// CHECK-START: void Main$Nested.$noinline$setPrivateIntField(Main, int) inliner (before) 32 /// CHECK-NOT: InstanceFieldSet 33 34 /// CHECK-START: void Main$Nested.$noinline$setPrivateIntField(Main, int) inliner (after) 35 /// CHECK-NOT: InvokeStaticOrDirect 36 37 /// CHECK-START: void Main$Nested.$noinline$setPrivateIntField(Main, int) inliner (after) 38 /// CHECK: InstanceFieldSet 39 $noinline$setPrivateIntField(Main m, int value)40 public void $noinline$setPrivateIntField(Main m, int value) { 41 m.privateIntField = value; 42 } 43 44 /// CHECK-START: int Main$Nested.$noinline$getPrivateIntField(Main) inliner (before) 45 /// CHECK: InvokeStaticOrDirect 46 47 /// CHECK-START: int Main$Nested.$noinline$getPrivateIntField(Main) inliner (before) 48 /// CHECK-NOT: InstanceFieldGet 49 50 /// CHECK-START: int Main$Nested.$noinline$getPrivateIntField(Main) inliner (after) 51 /// CHECK-NOT: InvokeStaticOrDirect 52 53 /// CHECK-START: int Main$Nested.$noinline$getPrivateIntField(Main) inliner (after) 54 /// CHECK: InstanceFieldGet 55 $noinline$getPrivateIntField(Main m)56 public int $noinline$getPrivateIntField(Main m) { 57 return m.privateIntField; 58 } 59 } 60 } 61