diff options
-rw-r--r-- | compiler/common_compiler_test.cc | 12 | ||||
-rw-r--r-- | compiler/common_compiler_test.h | 14 | ||||
-rw-r--r-- | compiler/dex/quick/gen_loadstore.cc | 4 | ||||
-rw-r--r-- | compiler/driver/compiler_driver.h | 2 | ||||
-rw-r--r-- | compiler/image_test.cc | 1 | ||||
-rw-r--r-- | dex2oat/dex2oat.cc | 4 | ||||
-rw-r--r-- | runtime/Android.mk | 2 | ||||
-rw-r--r-- | runtime/arch/arm64/quick_entrypoints_arm64.S | 1 | ||||
-rw-r--r-- | runtime/arch/x86/quick_entrypoints_x86.S | 5 | ||||
-rw-r--r-- | runtime/arch/x86_64/quick_entrypoints_x86_64.S | 1 | ||||
-rw-r--r-- | runtime/java_vm_ext.cc | 5 | ||||
-rw-r--r-- | runtime/zip_archive.cc | 2 | ||||
-rw-r--r-- | test/036-finalizer/src/Main.java | 31 | ||||
-rw-r--r-- | test/Android.run-test.mk | 5 | ||||
-rwxr-xr-x | test/run-test | 2 | ||||
-rwxr-xr-x | tools/symbolize.sh | 31 |
16 files changed, 63 insertions, 59 deletions
diff --git a/compiler/common_compiler_test.cc b/compiler/common_compiler_test.cc index 0a1e2e35a6..4b6788429a 100644 --- a/compiler/common_compiler_test.cc +++ b/compiler/common_compiler_test.cc @@ -182,13 +182,11 @@ void CommonCompilerTest::SetUp() { } } - // TODO: make selectable - Compiler::Kind compiler_kind = Compiler::kQuick; timer_.reset(new CumulativeLogger("Compilation times")); compiler_driver_.reset(new CompilerDriver(compiler_options_.get(), verification_results_.get(), method_inliner_map_.get(), - compiler_kind, instruction_set, + compiler_kind_, instruction_set, instruction_set_features_.get(), true, GetImageClasses(), @@ -211,6 +209,14 @@ void CommonCompilerTest::SetUpRuntimeOptions(RuntimeOptions* options) { CompilerCallbacks::CallbackMode::kCompileApp)); } +Compiler::Kind CommonCompilerTest::GetCompilerKind() const { + return compiler_kind_; +} + +void CommonCompilerTest::SetCompilerKind(Compiler::Kind compiler_kind) { + compiler_kind_ = compiler_kind; +} + void CommonCompilerTest::TearDown() { timer_.reset(); compiler_driver_.reset(); diff --git a/compiler/common_compiler_test.h b/compiler/common_compiler_test.h index 769319be40..b828fcf7e1 100644 --- a/compiler/common_compiler_test.h +++ b/compiler/common_compiler_test.h @@ -22,6 +22,7 @@ #include <vector> #include "common_runtime_test.h" +#include "compiler.h" #include "oat_file.h" namespace art { @@ -55,7 +56,10 @@ class CommonCompilerTest : public CommonRuntimeTest { protected: virtual void SetUp(); - virtual void SetUpRuntimeOptions(RuntimeOptions *options); + virtual void SetUpRuntimeOptions(RuntimeOptions* options); + + Compiler::Kind GetCompilerKind() const; + void SetCompilerKind(Compiler::Kind compiler_kind); // Get the set of image classes given to the compiler-driver in SetUp. Note: the compiler // driver assumes ownership of the set, so the test should properly release the set. @@ -88,6 +92,7 @@ class CommonCompilerTest : public CommonRuntimeTest { void UnreserveImageSpace(); + Compiler::Kind compiler_kind_ = kUseOptimizingCompiler ? Compiler::kOptimizing : Compiler::kQuick; std::unique_ptr<CompilerOptions> compiler_options_; std::unique_ptr<VerificationResults> verification_results_; std::unique_ptr<DexFileToMethodInlinerMap> method_inliner_map_; @@ -103,6 +108,13 @@ class CommonCompilerTest : public CommonRuntimeTest { std::list<std::vector<uint8_t>> header_code_and_maps_chunks_; }; +// TODO: When non-PIC works with all compilers in use, get rid of this. +#define TEST_DISABLED_FOR_NON_PIC_COMPILING_WITH_OPTIMIZING() \ + if (GetCompilerKind() == Compiler::kOptimizing) { \ + printf("WARNING: TEST DISABLED FOR NON-PIC COMPILING WITH OPTIMIZING\n"); \ + return; \ + } + } // namespace art #endif // ART_COMPILER_COMMON_COMPILER_TEST_H_ diff --git a/compiler/dex/quick/gen_loadstore.cc b/compiler/dex/quick/gen_loadstore.cc index aa95e77f6d..3f89001772 100644 --- a/compiler/dex/quick/gen_loadstore.cc +++ b/compiler/dex/quick/gen_loadstore.cc @@ -107,7 +107,9 @@ void Mir2Lir::LoadValueDirectWideFixed(RegLocation rl_src, RegStorage r_dest) { } RegLocation Mir2Lir::LoadValue(RegLocation rl_src, RegisterClass op_kind) { - DCHECK(!rl_src.ref || op_kind == kRefReg); + // If op_kind isn't a reference, rl_src should not be marked as a reference either + // unless we've seen type conflicts (i.e. register promotion is disabled). + DCHECK(op_kind == kRefReg || (!rl_src.ref || (cu_->disable_opt & (1u << kPromoteRegs)) != 0u)); rl_src = UpdateLoc(rl_src); if (rl_src.location == kLocPhysReg) { if (!RegClassMatches(op_kind, rl_src.reg)) { diff --git a/compiler/driver/compiler_driver.h b/compiler/driver/compiler_driver.h index f737007308..2d7ceaeea1 100644 --- a/compiler/driver/compiler_driver.h +++ b/compiler/driver/compiler_driver.h @@ -668,7 +668,7 @@ class CompilerDriver { bool dedupe_enabled_; bool dump_stats_; const bool dump_passes_; - const std::string& dump_cfg_file_name_; + const std::string dump_cfg_file_name_; CumulativeLogger* const timings_logger_; diff --git a/compiler/image_test.cc b/compiler/image_test.cc index 772cc80146..7e31a7a08b 100644 --- a/compiler/image_test.cc +++ b/compiler/image_test.cc @@ -45,6 +45,7 @@ class ImageTest : public CommonCompilerTest { }; TEST_F(ImageTest, WriteRead) { + TEST_DISABLED_FOR_NON_PIC_COMPILING_WITH_OPTIMIZING(); // Create a generic location tmp file, to be the base of the .art and .oat temporary files. ScratchFile location; ScratchFile image_location(location, ".art"); diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc index 7a2374681a..74d5c0c0cd 100644 --- a/dex2oat/dex2oat.cc +++ b/dex2oat/dex2oat.cc @@ -1038,6 +1038,10 @@ class Dex2Oat FINAL { bool OpenFile() { bool create_file = !oat_unstripped_.empty(); // as opposed to using open file descriptor if (create_file) { + // We're supposed to create this file. If the file already exists, it may be in use currently. + // We must not change the content of that file, then. So unlink it first. + unlink(oat_unstripped_.c_str()); + oat_file_.reset(OS::CreateEmptyFile(oat_unstripped_.c_str())); if (oat_location_.empty()) { oat_location_ = oat_filename_; diff --git a/runtime/Android.mk b/runtime/Android.mk index 5ed6955185..19079cb928 100644 --- a/runtime/Android.mk +++ b/runtime/Android.mk @@ -478,7 +478,7 @@ $$(ENUM_OPERATOR_OUT_GEN): $$(GENERATED_SRC_DIR)/%_operator_out.cc : $(LOCAL_PAT # For liblog, atrace, properties, ashmem, set_sched_policy and socket_peer_is_trusted. LOCAL_SHARED_LIBRARIES += libcutils else # host - LOCAL_SHARED_LIBRARIES += libziparchive-host + LOCAL_SHARED_LIBRARIES += libziparchive-host libz-host # For ashmem_create_region. LOCAL_SHARED_LIBRARIES += libcutils endif diff --git a/runtime/arch/arm64/quick_entrypoints_arm64.S b/runtime/arch/arm64/quick_entrypoints_arm64.S index f3c111f99f..614936b93f 100644 --- a/runtime/arch/arm64/quick_entrypoints_arm64.S +++ b/runtime/arch/arm64/quick_entrypoints_arm64.S @@ -1206,6 +1206,7 @@ ENTRY art_quick_aput_obj lsr x0, x0, #7 strb w3, [x3, x0] ret + .cfi_adjust_cfa_offset 32 // 4 restores after cbz for unwinding. .Lthrow_array_store_exception: ldp x2, x30, [sp, #16] .cfi_restore x2 diff --git a/runtime/arch/x86/quick_entrypoints_x86.S b/runtime/arch/x86/quick_entrypoints_x86.S index 98d08129cf..c9bc9779dc 100644 --- a/runtime/arch/x86/quick_entrypoints_x86.S +++ b/runtime/arch/x86/quick_entrypoints_x86.S @@ -1185,9 +1185,9 @@ DEFINE_FUNCTION art_quick_aput_obj pushl MIRROR_OBJECT_CLASS_OFFSET(%edx) // pass arg2 - type of the value to be stored #endif CFI_ADJUST_CFA_OFFSET(4) - PUSH ebx // pass arg1 - component type of the array + PUSH ebx // pass arg1 - component type of the array call SYMBOL(artIsAssignableFromCode) // (Class* a, Class* b) - addl LITERAL(16), %esp // pop arguments + addl LITERAL(16), %esp // pop arguments CFI_ADJUST_CFA_OFFSET(-16) testl %eax, %eax jz .Lthrow_array_store_exception @@ -1200,6 +1200,7 @@ DEFINE_FUNCTION art_quick_aput_obj shrl LITERAL(7), %eax movb %dl, (%edx, %eax) ret + CFI_ADJUST_CFA_OFFSET(12) // 3 POP after the jz for unwinding. .Lthrow_array_store_exception: POP edx POP ecx diff --git a/runtime/arch/x86_64/quick_entrypoints_x86_64.S b/runtime/arch/x86_64/quick_entrypoints_x86_64.S index 259cf97407..7d86c3accd 100644 --- a/runtime/arch/x86_64/quick_entrypoints_x86_64.S +++ b/runtime/arch/x86_64/quick_entrypoints_x86_64.S @@ -1256,6 +1256,7 @@ DEFINE_FUNCTION art_quick_aput_obj movb %dl, (%rdx, %rdi) // Note: this assumes that top 32b of %rdi are zero // movb %dl, (%rdx, %rdi) ret + CFI_ADJUST_CFA_OFFSET(32 + 4 * 8) // Reset unwind info so following code unwinds. .Lthrow_array_store_exception: RESTORE_FP_CALLEE_SAVE_FRAME // Restore arguments. diff --git a/runtime/java_vm_ext.cc b/runtime/java_vm_ext.cc index eb9c32d7ad..f1deacf39a 100644 --- a/runtime/java_vm_ext.cc +++ b/runtime/java_vm_ext.cc @@ -132,6 +132,8 @@ class SharedLibrary { } void* FindSymbol(const std::string& symbol_name) { + CHECK(!NeedsNativeBridge()); + return dlsym(handle_, symbol_name.c_str()); } @@ -234,9 +236,6 @@ class Libraries { fn = library->FindSymbol(jni_long_name); } } - if (fn == nullptr) { - fn = library->FindSymbol(jni_long_name); - } if (fn != nullptr) { VLOG(jni) << "[Found native code for " << PrettyMethod(m) << " in \"" << library->GetPath() << "\"]"; diff --git a/runtime/zip_archive.cc b/runtime/zip_archive.cc index 88c1f69bf5..9daaf8e204 100644 --- a/runtime/zip_archive.cc +++ b/runtime/zip_archive.cc @@ -124,7 +124,7 @@ ZipEntry* ZipArchive::Find(const char* name, std::string* error_msg) const { // Resist the urge to delete the space. <: is a bigraph sequence. std::unique_ptr< ::ZipEntry> zip_entry(new ::ZipEntry); - const int32_t error = FindEntry(handle_, ZipEntryName(name), zip_entry.get()); + const int32_t error = FindEntry(handle_, ZipString(name), zip_entry.get()); if (error) { *error_msg = std::string(ErrorCodeString(error)); return nullptr; diff --git a/test/036-finalizer/src/Main.java b/test/036-finalizer/src/Main.java index e3cf4eedbc..8c7c27d79c 100644 --- a/test/036-finalizer/src/Main.java +++ b/test/036-finalizer/src/Main.java @@ -34,31 +34,10 @@ public class Main { } public static WeakReference<FinalizerTest> makeRef() { - /* - * Make ft in another thread, so there is no danger of - * a conservative reference leaking onto the main thread's - * stack. - */ - - final List<WeakReference<FinalizerTest>> wimp = - new ArrayList<WeakReference<FinalizerTest>>(); - Thread t = new Thread() { - public void run() { - FinalizerTest ft = new FinalizerTest("wahoo"); - wimp.add(new WeakReference<FinalizerTest>(ft)); - ft = null; - } - }; - - t.start(); - - try { - t.join(); - } catch (InterruptedException ie) { - throw new RuntimeException(ie); - } - - return wimp.get(0); + FinalizerTest ft = new FinalizerTest("wahoo"); + WeakReference<FinalizerTest> ref = new WeakReference<FinalizerTest>(ft); + ft = null; + return ref; } public static String wimpString(final WeakReference<FinalizerTest> wimp) { @@ -91,10 +70,12 @@ public class Main { public static void main(String[] args) { WeakReference<FinalizerTest> wimp = makeRef(); + FinalizerTest keepLive = wimp.get(); System.out.println("wimp: " + wimpString(wimp)); /* this will try to collect and finalize ft */ + keepLive = null; System.out.println("gc"); Runtime.getRuntime().gc(); diff --git a/test/Android.run-test.mk b/test/Android.run-test.mk index 6c2ce6256a..5b5c368ebb 100644 --- a/test/Android.run-test.mk +++ b/test/Android.run-test.mk @@ -233,7 +233,10 @@ endif TEST_ART_BROKEN_NO_RELOCATE_TESTS := # Tests that are broken with GC stress. -TEST_ART_BROKEN_GCSTRESS_RUN_TESTS := +# 137-cfi needs to unwind a second forked process. We're using a primitive sleep to wait till we +# hope the second process got into the expected state. The slowness of gcstress makes this bad. +TEST_ART_BROKEN_GCSTRESS_RUN_TESTS := \ + 137-cfi ifneq (,$(filter gcstress,$(GC_TYPES))) ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \ diff --git a/test/run-test b/test/run-test index 995d30f545..ffa25eb5ab 100755 --- a/test/run-test +++ b/test/run-test @@ -308,7 +308,7 @@ if [ "$gc_verify" = "true" ]; then run_args="${run_args} --runtime-option -Xgc:preverify_rosalloc --runtime-option -Xgc:postverify_rosalloc" fi if [ "$gc_stress" = "true" ]; then - run_args="${run_args} --runtime-option -Xgc:SS --runtime-option -Xms2m --runtime-option -Xmx2m" + run_args="${run_args} --runtime-option -Xgc:SS,gcstress --runtime-option -Xms2m --runtime-option -Xmx16m" fi if [ "$trace" = "true" ]; then run_args="${run_args} --runtime-option -Xmethod-trace --runtime-option -Xmethod-trace-file-size:2000000" diff --git a/tools/symbolize.sh b/tools/symbolize.sh index 0168e7db2f..7365a9bb3d 100755 --- a/tools/symbolize.sh +++ b/tools/symbolize.sh @@ -37,30 +37,23 @@ function one() { exit 0 fi fi - adb pull /data/dalvik-cache/$1/$2 /tmp || exit 1 - mkdir -p $OUT/symbols/data/dalvik-cache/$1 - oatdump --symbolize=/tmp/$2 --output=$OUT/symbols/data/dalvik-cache/$1/$2 + adb pull $1/$2 /tmp || exit 1 + mkdir -p $OUT/symbols/$1 + oatdump --symbolize=/tmp/$2 --output=$OUT/symbols/$1/$2 } -# adb shell ls seems to output in DOS format (CRLF), which messes up scripting -function adbls() { - adb shell ls $@ | sed 's/\r$//' +# adb shell find seems to output in DOS format (CRLF), which messes up scripting +function adbshellstrip() { + adb shell $@ | sed 's/\r$//' } -# Check for all ISA directories on device. +# Search in all of /data on device. function all() { - DIRS=$(adbls /data/dalvik-cache/) - for DIR in $DIRS ; do - case $DIR in - arm|arm64|mips|mips64|x86|x86_64) - FILES=$(adbls /data/dalvik-cache/$DIR/*.oat /data/dalvik-cache/$DIR/*.dex) - for FILE in $FILES ; do - # Cannot use basename as the file doesn't exist. - NAME=$(echo $FILE | sed -e 's/.*\///') - one $DIR $NAME - done - ;; - esac + FILES=$(adbshellstrip find /data -name "'*.oat'" -o -name "'*.dex'" -o -name "'*.odex'") + for FILE in $FILES ; do + DIR=$(dirname $FILE) + NAME=$(basename $FILE) + one $DIR $NAME done } |