diff options
| -rw-r--r-- | compiler/common_compiler_test.cc | 1 | ||||
| -rw-r--r-- | compiler/driver/compiled_method_storage_test.cc | 1 | ||||
| -rw-r--r-- | compiler/driver/compiler_driver.cc | 9 | ||||
| -rw-r--r-- | compiler/driver/compiler_driver.h | 2 | ||||
| -rw-r--r-- | compiler/jit/jit_compiler.cc | 3 | ||||
| -rw-r--r-- | compiler/jni/jni_compiler_test.cc | 6 | ||||
| -rw-r--r-- | compiler/linker/relative_patcher_test.h | 1 | ||||
| -rw-r--r-- | compiler/oat_test.cc | 1 | ||||
| -rw-r--r-- | dex2oat/dex2oat.cc | 1 | ||||
| -rw-r--r-- | runtime/class_linker.cc | 5 | ||||
| -rw-r--r-- | runtime/interpreter/mterp/out/mterp_x86.S | 1 | ||||
| -rw-r--r-- | runtime/interpreter/mterp/out/mterp_x86_64.S | 1 | ||||
| -rw-r--r-- | runtime/interpreter/mterp/x86/footer.S | 1 | ||||
| -rw-r--r-- | runtime/interpreter/mterp/x86_64/footer.S | 1 | ||||
| -rw-r--r-- | runtime/runtime.cc | 5 | ||||
| -rw-r--r-- | test/141-class-unload/src/Main.java | 15 | ||||
| -rw-r--r-- | test/803-no-super/expected.txt | 2 | ||||
| -rw-r--r-- | test/803-no-super/info.txt | 3 | ||||
| -rw-r--r-- | test/803-no-super/smali/nosuper1.smali | 3 | ||||
| -rw-r--r-- | test/803-no-super/src/Main.java | 29 | ||||
| -rw-r--r-- | tools/public.libraries.buildbot.txt | 5 |
21 files changed, 79 insertions, 17 deletions
diff --git a/compiler/common_compiler_test.cc b/compiler/common_compiler_test.cc index f75a252df2..bf29e1c31d 100644 --- a/compiler/common_compiler_test.cc +++ b/compiler/common_compiler_test.cc @@ -180,6 +180,7 @@ void CommonCompilerTest::CreateCompilerDriver(Compiler::Kind kind, isa, instruction_set_features_.get(), /* boot_image */ true, + /* app_image */ false, GetImageClasses(), GetCompiledClasses(), GetCompiledMethods(), diff --git a/compiler/driver/compiled_method_storage_test.cc b/compiler/driver/compiled_method_storage_test.cc index 9e0c22c68c..6863f42d11 100644 --- a/compiler/driver/compiled_method_storage_test.cc +++ b/compiler/driver/compiled_method_storage_test.cc @@ -36,6 +36,7 @@ TEST(CompiledMethodStorage, Deduplicate) { /* instruction_set_ */ kNone, /* instruction_set_features */ nullptr, /* boot_image */ false, + /* app_image */ false, /* image_classes */ nullptr, /* compiled_classes */ nullptr, /* compiled_methods */ nullptr, diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index e84faff941..c4cd7b9e7c 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -341,6 +341,7 @@ CompilerDriver::CompilerDriver( InstructionSet instruction_set, const InstructionSetFeatures* instruction_set_features, bool boot_image, + bool app_image, std::unordered_set<std::string>* image_classes, std::unordered_set<std::string>* compiled_classes, std::unordered_set<std::string>* compiled_methods, @@ -363,6 +364,7 @@ CompilerDriver::CompilerDriver( compiled_methods_(MethodTable::key_compare()), non_relative_linker_patch_count_(0u), boot_image_(boot_image), + app_image_(app_image), image_classes_(image_classes), classes_to_compile_(compiled_classes), methods_to_compile_(compiled_methods), @@ -2443,6 +2445,9 @@ void CompilerDriver::InitializeClasses(jobject jni_class_loader, class InitializeArrayClassesAndCreateConflictTablesVisitor : public ClassVisitor { public: virtual bool operator()(mirror::Class* klass) OVERRIDE SHARED_REQUIRES(Locks::mutator_lock_) { + if (Runtime::Current()->GetHeap()->ObjectIsInBootImageSpace(klass)) { + return true; + } if (klass->IsArrayClass()) { StackHandleScope<1> hs(Thread::Current()); Runtime::Current()->GetClassLinker()->EnsureInitialized(hs.Self(), @@ -2451,7 +2456,7 @@ class InitializeArrayClassesAndCreateConflictTablesVisitor : public ClassVisitor true); } // Create the conflict tables. - if (klass->ShouldHaveEmbeddedImtAndVTable()) { + if (!klass->IsTemp() && klass->ShouldHaveEmbeddedImtAndVTable()) { Runtime::Current()->GetClassLinker()->FillIMTAndConflictTables(klass); } return true; @@ -2466,7 +2471,7 @@ void CompilerDriver::InitializeClasses(jobject class_loader, CHECK(dex_file != nullptr); InitializeClasses(class_loader, *dex_file, dex_files, timings); } - if (image_classes_ != nullptr) { + if (boot_image_ || app_image_) { // Make sure that we call EnsureIntiailized on all the array classes to call // SetVerificationAttempted so that the access flags are set. If we do not do this they get // changed at runtime resulting in more dirty image pages. diff --git a/compiler/driver/compiler_driver.h b/compiler/driver/compiler_driver.h index d63dffa49a..19a1ecc494 100644 --- a/compiler/driver/compiler_driver.h +++ b/compiler/driver/compiler_driver.h @@ -92,6 +92,7 @@ class CompilerDriver { InstructionSet instruction_set, const InstructionSetFeatures* instruction_set_features, bool boot_image, + bool app_image, std::unordered_set<std::string>* image_classes, std::unordered_set<std::string>* compiled_classes, std::unordered_set<std::string>* compiled_methods, @@ -652,6 +653,7 @@ class CompilerDriver { size_t non_relative_linker_patch_count_ GUARDED_BY(compiled_methods_lock_); const bool boot_image_; + const bool app_image_; // If image_ is true, specifies the classes that will be included in the image. // Note if image_classes_ is null, all classes are included in the image. diff --git a/compiler/jit/jit_compiler.cc b/compiler/jit/jit_compiler.cc index 5de9842d90..c2d7ff7795 100644 --- a/compiler/jit/jit_compiler.cc +++ b/compiler/jit/jit_compiler.cc @@ -155,7 +155,8 @@ JitCompiler::JitCompiler() { Compiler::kOptimizing, instruction_set, instruction_set_features_.get(), - /* image */ false, + /* boot_image */ false, + /* app_image */ false, /* image_classes */ nullptr, /* compiled_classes */ nullptr, /* compiled_methods */ nullptr, diff --git a/compiler/jni/jni_compiler_test.cc b/compiler/jni/jni_compiler_test.cc index cf836a9c9f..5b7574a36c 100644 --- a/compiler/jni/jni_compiler_test.cc +++ b/compiler/jni/jni_compiler_test.cc @@ -227,7 +227,8 @@ void JniCompilerTest::CompileAndRunIntMethodThroughStubImpl() { EXPECT_EQ(25, result); } -JNI_TEST(CompileAndRunIntMethodThroughStub) +// Disabled due to NativeLoader b/28449304. +// JNI_TEST(CompileAndRunIntMethodThroughStub) void JniCompilerTest::CompileAndRunStaticIntMethodThroughStubImpl() { SetUpForTest(true, "sbar", "(I)I", nullptr); @@ -242,7 +243,8 @@ void JniCompilerTest::CompileAndRunStaticIntMethodThroughStubImpl() { EXPECT_EQ(43, result); } -JNI_TEST(CompileAndRunStaticIntMethodThroughStub) +// Disabled due to NativeLoader b/28449304. +// JNI_TEST(CompileAndRunStaticIntMethodThroughStub) int gJava_MyClassNatives_fooI_calls = 0; jint Java_MyClassNatives_fooI(JNIEnv* env, jobject thisObj, jint x) { diff --git a/compiler/linker/relative_patcher_test.h b/compiler/linker/relative_patcher_test.h index c07de79984..ec69107d8f 100644 --- a/compiler/linker/relative_patcher_test.h +++ b/compiler/linker/relative_patcher_test.h @@ -51,6 +51,7 @@ class RelativePatcherTest : public testing::Test { instruction_set, /* instruction_set_features*/ nullptr, /* boot_image */ false, + /* app_image */ false, /* image_classes */ nullptr, /* compiled_classes */ nullptr, /* compiled_methods */ nullptr, diff --git a/compiler/oat_test.cc b/compiler/oat_test.cc index 73b16d5b46..5b192846ba 100644 --- a/compiler/oat_test.cc +++ b/compiler/oat_test.cc @@ -112,6 +112,7 @@ class OatTest : public CommonCompilerTest { insn_set, insn_features_.get(), /* boot_image */ false, + /* app_image */ false, /* image_classes */ nullptr, /* compiled_classes */ nullptr, /* compiled_methods */ nullptr, diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc index 370583e3ba..be38336f03 100644 --- a/dex2oat/dex2oat.cc +++ b/dex2oat/dex2oat.cc @@ -1526,6 +1526,7 @@ class Dex2Oat FINAL { instruction_set_, instruction_set_features_.get(), IsBootImage(), + IsAppImage(), image_classes_.release(), compiled_classes_.release(), /* compiled_methods */ nullptr, diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index 774c543acf..f91860651b 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -6026,7 +6026,8 @@ void ClassLinker::SetIMTRef(ArtMethod* unimplemented_method, } void ClassLinker::FillIMTAndConflictTables(mirror::Class* klass) { - DCHECK(klass->ShouldHaveEmbeddedImtAndVTable()); + DCHECK(klass->ShouldHaveEmbeddedImtAndVTable()) << PrettyClass(klass); + DCHECK(!klass->IsTemp()) << PrettyClass(klass); ArtMethod* imt[mirror::Class::kImtSize]; Runtime* const runtime = Runtime::Current(); ArtMethod* const unimplemented_method = runtime->GetImtUnimplementedMethod(); @@ -6158,7 +6159,7 @@ void ClassLinker::FillIMTFromIfTable(mirror::IfTable* if_table, if (!imt[imt_index]->IsRuntimeMethod() || imt[imt_index] == unimplemented_method || imt[imt_index] == imt_conflict_method) { - continue; // Only care about the conflicts. + continue; } ImtConflictTable* table = imt[imt_index]->GetImtConflictTable(image_pointer_size_); const size_t num_entries = table->NumEntries(image_pointer_size_); diff --git a/runtime/interpreter/mterp/out/mterp_x86.S b/runtime/interpreter/mterp/out/mterp_x86.S index e46f9cde94..f78e1bc416 100644 --- a/runtime/interpreter/mterp/out/mterp_x86.S +++ b/runtime/interpreter/mterp/out/mterp_x86.S @@ -12985,6 +12985,7 @@ MterpCommonTakenBranch: * not-taken path. All Dalvik not-taken conditional branch offsets are 2. */ .L_check_not_taken_osr: + EXPORT_PC movl rSELF, %eax movl %eax, OUT_ARG0(%esp) leal OFF_FP_SHADOWFRAME(rFP), %ecx diff --git a/runtime/interpreter/mterp/out/mterp_x86_64.S b/runtime/interpreter/mterp/out/mterp_x86_64.S index 62dce6e777..031cec8233 100644 --- a/runtime/interpreter/mterp/out/mterp_x86_64.S +++ b/runtime/interpreter/mterp/out/mterp_x86_64.S @@ -11961,6 +11961,7 @@ MterpCommonTakenBranch: * not-taken path. All Dalvik not-taken conditional branch offsets are 2. */ .L_check_not_taken_osr: + EXPORT_PC movq rSELF, OUT_ARG0 leaq OFF_FP_SHADOWFRAME(rFP), OUT_ARG1 movl $2, OUT_32_ARG2 diff --git a/runtime/interpreter/mterp/x86/footer.S b/runtime/interpreter/mterp/x86/footer.S index fa03e78fe3..e8c8ca8d79 100644 --- a/runtime/interpreter/mterp/x86/footer.S +++ b/runtime/interpreter/mterp/x86/footer.S @@ -234,6 +234,7 @@ MterpCommonTakenBranch: * not-taken path. All Dalvik not-taken conditional branch offsets are 2. */ .L_check_not_taken_osr: + EXPORT_PC movl rSELF, %eax movl %eax, OUT_ARG0(%esp) leal OFF_FP_SHADOWFRAME(rFP), %ecx diff --git a/runtime/interpreter/mterp/x86_64/footer.S b/runtime/interpreter/mterp/x86_64/footer.S index 54d0cb1ce4..f78f163576 100644 --- a/runtime/interpreter/mterp/x86_64/footer.S +++ b/runtime/interpreter/mterp/x86_64/footer.S @@ -213,6 +213,7 @@ MterpCommonTakenBranch: * not-taken path. All Dalvik not-taken conditional branch offsets are 2. */ .L_check_not_taken_osr: + EXPORT_PC movq rSELF, OUT_ARG0 leaq OFF_FP_SHADOWFRAME(rFP), OUT_ARG1 movl $$2, OUT_32_ARG2 diff --git a/runtime/runtime.cc b/runtime/runtime.cc index 95995fb7b4..929bb5bbc8 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -1947,13 +1947,12 @@ void Runtime::SetImtUnimplementedMethod(ArtMethod* method) { void Runtime::FixupConflictTables() { // We can only do this after the class linker is created. const size_t pointer_size = GetClassLinker()->GetImagePointerSize(); - // Ones in image wont have correct tables. TODO: Fix. - if (imt_unimplemented_method_->GetImtConflictTable(pointer_size) == nullptr || (true)) { + if (imt_unimplemented_method_->GetImtConflictTable(pointer_size) == nullptr) { imt_unimplemented_method_->SetImtConflictTable( ClassLinker::CreateImtConflictTable(/*count*/0u, GetLinearAlloc(), pointer_size), pointer_size); } - if (imt_conflict_method_->GetImtConflictTable(pointer_size) == nullptr || (true)) { + if (imt_conflict_method_->GetImtConflictTable(pointer_size) == nullptr) { imt_conflict_method_->SetImtConflictTable( ClassLinker::CreateImtConflictTable(/*count*/0u, GetLinearAlloc(), pointer_size), pointer_size); diff --git a/test/141-class-unload/src/Main.java b/test/141-class-unload/src/Main.java index 15683b0b1e..17a6049dbf 100644 --- a/test/141-class-unload/src/Main.java +++ b/test/141-class-unload/src/Main.java @@ -23,6 +23,7 @@ import java.lang.reflect.Method; public class Main { static final String DEX_FILE = System.getenv("DEX_LOCATION") + "/141-class-unload-ex.jar"; + static final String LIBRARY_SEARCH_PATH = System.getProperty("java.library.path"); static String nativeLibraryName; public static void main(String[] args) throws Exception { @@ -32,7 +33,7 @@ public class Main { throw new AssertionError("Couldn't find path class loader class"); } Constructor constructor = - pathClassLoader.getDeclaredConstructor(String.class, ClassLoader.class); + pathClassLoader.getDeclaredConstructor(String.class, String.class, ClassLoader.class); try { testUnloadClass(constructor); testUnloadLoader(constructor); @@ -49,7 +50,7 @@ public class Main { // Test that the oat files are unloaded. testOatFilesUnloaded(getPid()); } catch (Exception e) { - System.out.println(e); + e.printStackTrace(); } } @@ -118,7 +119,7 @@ public class Main { private static void testNoUnloadInvoke(Constructor constructor) throws Exception { WeakReference<ClassLoader> loader = new WeakReference((ClassLoader) constructor.newInstance( - DEX_FILE, ClassLoader.getSystemClassLoader())); + DEX_FILE, LIBRARY_SEARCH_PATH, ClassLoader.getSystemClassLoader())); WeakReference<Class> intHolder = new WeakReference(loader.get().loadClass("IntHolder")); intHolder.get().getDeclaredMethod("runGC").invoke(intHolder.get()); boolean isNull = loader.get() == null; @@ -128,7 +129,7 @@ public class Main { private static void testNoUnloadInstance(Constructor constructor) throws Exception { WeakReference<ClassLoader> loader = new WeakReference((ClassLoader) constructor.newInstance( - DEX_FILE, ClassLoader.getSystemClassLoader())); + DEX_FILE, LIBRARY_SEARCH_PATH, ClassLoader.getSystemClassLoader())); WeakReference<Class> intHolder = new WeakReference(loader.get().loadClass("IntHolder")); Object o = intHolder.get().newInstance(); Runtime.getRuntime().gc(); @@ -138,7 +139,7 @@ public class Main { private static WeakReference<Class> setUpUnloadClass(Constructor constructor) throws Exception { ClassLoader loader = (ClassLoader) constructor.newInstance( - DEX_FILE, ClassLoader.getSystemClassLoader()); + DEX_FILE, LIBRARY_SEARCH_PATH, ClassLoader.getSystemClassLoader()); Class intHolder = loader.loadClass("IntHolder"); Method getValue = intHolder.getDeclaredMethod("getValue"); Method setValue = intHolder.getDeclaredMethod("setValue", Integer.TYPE); @@ -155,7 +156,7 @@ public class Main { boolean waitForCompilation) throws Exception { ClassLoader loader = (ClassLoader) constructor.newInstance( - DEX_FILE, ClassLoader.getSystemClassLoader()); + DEX_FILE, LIBRARY_SEARCH_PATH, ClassLoader.getSystemClassLoader()); Class intHolder = loader.loadClass("IntHolder"); Method setValue = intHolder.getDeclaredMethod("setValue", Integer.TYPE); setValue.invoke(intHolder, 2); @@ -177,7 +178,7 @@ public class Main { private static WeakReference<ClassLoader> setUpLoadLibrary(Constructor constructor) throws Exception { ClassLoader loader = (ClassLoader) constructor.newInstance( - DEX_FILE, ClassLoader.getSystemClassLoader()); + DEX_FILE, LIBRARY_SEARCH_PATH, ClassLoader.getSystemClassLoader()); Class intHolder = loader.loadClass("IntHolder"); Method loadLibrary = intHolder.getDeclaredMethod("loadLibrary", String.class); loadLibrary.invoke(intHolder, nativeLibraryName); diff --git a/test/803-no-super/expected.txt b/test/803-no-super/expected.txt new file mode 100644 index 0000000000..5036991397 --- /dev/null +++ b/test/803-no-super/expected.txt @@ -0,0 +1,2 @@ +java.lang.ClassNotFoundException: NoSuper1 +Done! diff --git a/test/803-no-super/info.txt b/test/803-no-super/info.txt new file mode 100644 index 0000000000..0178a446e1 --- /dev/null +++ b/test/803-no-super/info.txt @@ -0,0 +1,3 @@ +Regression test that temp (erroneous) classes don't get conflict tables created. + +Obviously needs to run under Dalvik or ART. diff --git a/test/803-no-super/smali/nosuper1.smali b/test/803-no-super/smali/nosuper1.smali new file mode 100644 index 0000000000..df2eaa5ca8 --- /dev/null +++ b/test/803-no-super/smali/nosuper1.smali @@ -0,0 +1,3 @@ +.class public LNoSuper1; + +.super LNoClass; diff --git a/test/803-no-super/src/Main.java b/test/803-no-super/src/Main.java new file mode 100644 index 0000000000..a07e042c32 --- /dev/null +++ b/test/803-no-super/src/Main.java @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2016 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. + */ + +/** + * Attempt to load class with no superclass. + */ +public class Main { + public static void main(String[] args) throws Exception { + try { + Class<?> c = Class.forName("NoSuper1"); + } catch (Exception e) { + System.out.println(e); + } + System.out.println("Done!"); + } +} diff --git a/tools/public.libraries.buildbot.txt b/tools/public.libraries.buildbot.txt index 6251da3ad2..4b01796a0a 100644 --- a/tools/public.libraries.buildbot.txt +++ b/tools/public.libraries.buildbot.txt @@ -1,3 +1,8 @@ +libart.so +libartd.so +libbacktrace.so libc.so +libc++.so libdl.so libm.so +libnativehelper.so |