From 9714a6e8a2a2c09a1a7954bdd640b5730de411b2 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Tue, 23 Jun 2015 12:09:55 +0100 Subject: [PATCH] Fix 496 test. Make sure the class requested by LoadedByMyClassLoader.bar is not loaded yet ('Main' is already loaded), in order to do a proper class loader lookup and not use a dex cache version. Change-Id: I77215ae489e6d2c50b90684951bccd0bbf8c1a53 --- .../expected.txt | 2 +- .../src/FirstSeenByMyClassLoader.java | 26 ++++++++++++++++++++++ .../src/Main.java | 17 ++++---------- 3 files changed, 31 insertions(+), 14 deletions(-) create mode 100644 test/496-checker-inlining-and-class-loader/src/FirstSeenByMyClassLoader.java diff --git a/test/496-checker-inlining-and-class-loader/expected.txt b/test/496-checker-inlining-and-class-loader/expected.txt index c6fcb51ec..312c28f8b 100644 --- a/test/496-checker-inlining-and-class-loader/expected.txt +++ b/test/496-checker-inlining-and-class-loader/expected.txt @@ -1,4 +1,4 @@ Request for LoadedByMyClassLoader -Request for Main +Request for FirstSeenByMyClassLoader In between the two calls. In $noinline$bar diff --git a/test/496-checker-inlining-and-class-loader/src/FirstSeenByMyClassLoader.java b/test/496-checker-inlining-and-class-loader/src/FirstSeenByMyClassLoader.java new file mode 100644 index 000000000..e97b4e339 --- /dev/null +++ b/test/496-checker-inlining-and-class-loader/src/FirstSeenByMyClassLoader.java @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +public class FirstSeenByMyClassLoader { + public static void $inline$bar() { + } + + public static void $noinline$bar() { + try { + System.out.println("In $noinline$bar"); + } catch (Throwable t) { /* Ignore */ } + } +} diff --git a/test/496-checker-inlining-and-class-loader/src/Main.java b/test/496-checker-inlining-and-class-loader/src/Main.java index 4f23eec4a..39c031a6b 100644 --- a/test/496-checker-inlining-and-class-loader/src/Main.java +++ b/test/496-checker-inlining-and-class-loader/src/Main.java @@ -82,7 +82,7 @@ class LoadedByMyClassLoader { /// CHECK-START: void LoadedByMyClassLoader.bar() inliner (after) /// CHECK: LoadClass /// CHECK-NEXT: ClinitCheck - /* We inlined Main.$inline$bar */ + /* We inlined FirstSeenByMyClassLoader.$inline$bar */ /// CHECK-NEXT: LoadClass /// CHECK-NEXT: ClinitCheck /// CHECK-NEXT: StaticFieldGet @@ -91,7 +91,7 @@ class LoadedByMyClassLoader { /// CHECK-NEXT: InvokeVirtual /// CHECK-START: void LoadedByMyClassLoader.bar() register (before) - /* Load and initialize Main */ + /* Load and initialize FirstSeenByMyClassLoader */ /// CHECK: LoadClass gen_clinit_check:true /* Load and initialize System */ /// CHECK-NEXT: LoadClass gen_clinit_check:true @@ -100,9 +100,9 @@ class LoadedByMyClassLoader { /// CHECK-NEXT: NullCheck /// CHECK-NEXT: InvokeVirtual public static void bar() { - Main.$inline$bar(); + FirstSeenByMyClassLoader.$inline$bar(); System.out.println("In between the two calls."); - Main.$noinline$bar(); + FirstSeenByMyClassLoader.$noinline$bar(); } } @@ -113,13 +113,4 @@ public class Main { Method m = foo.getDeclaredMethod("bar"); m.invoke(null); } - - public static void $inline$bar() { - } - - public static void $noinline$bar() { - try { - System.out.println("In $noinline$bar"); - } catch (Throwable t) { /* Ignore */ } - } } -- 2.11.0