diff options
| -rw-r--r-- | compiler/utils/mips64/assembler_mips64_test.cc | 256 | ||||
| -rw-r--r-- | runtime/openjdkjvmti/events.cc | 2 | ||||
| -rw-r--r-- | runtime/parsed_options.cc | 4 | ||||
| -rw-r--r-- | runtime/runtime.cc | 2 | ||||
| -rw-r--r-- | runtime/runtime_options.cc | 1 | ||||
| -rw-r--r-- | runtime/runtime_options.def | 2 | ||||
| -rw-r--r-- | runtime/thread_list.cc | 16 | ||||
| -rw-r--r-- | runtime/thread_list.h | 13 | ||||
| -rw-r--r-- | test/Android.run-test.mk | 36 | ||||
| -rwxr-xr-x | test/run-test | 9 | ||||
| -rw-r--r-- | test/ti-agent/common_helper.cc | 2 |
11 files changed, 293 insertions, 50 deletions
diff --git a/compiler/utils/mips64/assembler_mips64_test.cc b/compiler/utils/mips64/assembler_mips64_test.cc index f2cbebbfd7..74b8f068c1 100644 --- a/compiler/utils/mips64/assembler_mips64_test.cc +++ b/compiler/utils/mips64/assembler_mips64_test.cc @@ -283,6 +283,38 @@ TEST_F(AssemblerMIPS64Test, Toolchain) { // FP Operations // /////////////////// +TEST_F(AssemblerMIPS64Test, AddS) { + DriverStr(RepeatFFF(&mips64::Mips64Assembler::AddS, "add.s ${reg1}, ${reg2}, ${reg3}"), "add.s"); +} + +TEST_F(AssemblerMIPS64Test, AddD) { + DriverStr(RepeatFFF(&mips64::Mips64Assembler::AddD, "add.d ${reg1}, ${reg2}, ${reg3}"), "add.d"); +} + +TEST_F(AssemblerMIPS64Test, SubS) { + DriverStr(RepeatFFF(&mips64::Mips64Assembler::SubS, "sub.s ${reg1}, ${reg2}, ${reg3}"), "sub.s"); +} + +TEST_F(AssemblerMIPS64Test, SubD) { + DriverStr(RepeatFFF(&mips64::Mips64Assembler::SubD, "sub.d ${reg1}, ${reg2}, ${reg3}"), "sub.d"); +} + +TEST_F(AssemblerMIPS64Test, MulS) { + DriverStr(RepeatFFF(&mips64::Mips64Assembler::MulS, "mul.s ${reg1}, ${reg2}, ${reg3}"), "mul.s"); +} + +TEST_F(AssemblerMIPS64Test, MulD) { + DriverStr(RepeatFFF(&mips64::Mips64Assembler::MulD, "mul.d ${reg1}, ${reg2}, ${reg3}"), "mul.d"); +} + +TEST_F(AssemblerMIPS64Test, DivS) { + DriverStr(RepeatFFF(&mips64::Mips64Assembler::DivS, "div.s ${reg1}, ${reg2}, ${reg3}"), "div.s"); +} + +TEST_F(AssemblerMIPS64Test, DivD) { + DriverStr(RepeatFFF(&mips64::Mips64Assembler::DivD, "div.d ${reg1}, ${reg2}, ${reg3}"), "div.d"); +} + TEST_F(AssemblerMIPS64Test, SqrtS) { DriverStr(RepeatFF(&mips64::Mips64Assembler::SqrtS, "sqrt.s ${reg1}, ${reg2}"), "sqrt.s"); } @@ -567,6 +599,26 @@ TEST_F(AssemblerMIPS64Test, Dmtc1) { DriverStr(RepeatRF(&mips64::Mips64Assembler::Dmtc1, "dmtc1 ${reg1}, ${reg2}"), "Dmtc1"); } +TEST_F(AssemblerMIPS64Test, Lwc1) { + DriverStr(RepeatFRIb(&mips64::Mips64Assembler::Lwc1, -16, "lwc1 ${reg1}, {imm}(${reg2})"), + "lwc1"); +} + +TEST_F(AssemblerMIPS64Test, Ldc1) { + DriverStr(RepeatFRIb(&mips64::Mips64Assembler::Ldc1, -16, "ldc1 ${reg1}, {imm}(${reg2})"), + "ldc1"); +} + +TEST_F(AssemblerMIPS64Test, Swc1) { + DriverStr(RepeatFRIb(&mips64::Mips64Assembler::Swc1, -16, "swc1 ${reg1}, {imm}(${reg2})"), + "swc1"); +} + +TEST_F(AssemblerMIPS64Test, Sdc1) { + DriverStr(RepeatFRIb(&mips64::Mips64Assembler::Sdc1, -16, "sdc1 ${reg1}, {imm}(${reg2})"), + "sdc1"); +} + //////////////// // CALL / JMP // //////////////// @@ -850,6 +902,16 @@ TEST_F(AssemblerMIPS64Test, Ldpc) { DriverStr(RepeatRIb(&mips64::Mips64Assembler::Ldpc, 18, code), "Ldpc"); } +TEST_F(AssemblerMIPS64Test, Auipc) { + DriverStr(RepeatRIb(&mips64::Mips64Assembler::Auipc, 16, "auipc ${reg}, {imm}"), "Auipc"); +} + +TEST_F(AssemblerMIPS64Test, Addiupc) { + // The comment from the Lwpc() test applies to this Addiupc() test as well. + const char* code = ".set imm, {imm}\naddiupc ${reg}, (imm - ((imm & 0x40000) << 1)) << 2"; + DriverStr(RepeatRIb(&mips64::Mips64Assembler::Addiupc, 19, code), "Addiupc"); +} + TEST_F(AssemblerMIPS64Test, LoadFarthestNearLabelAddress) { mips64::Mips64Label label; __ LoadLabelAddress(mips64::V0, &label); @@ -1079,6 +1141,188 @@ TEST_F(AssemblerMIPS64Test, FarLongLiteralAlignmentNop) { EXPECT_EQ(__ GetLabelLocation(literal->GetLabel()), (5 + kAdduCount) * 4); } +TEST_F(AssemblerMIPS64Test, Addu) { + DriverStr(RepeatRRR(&mips64::Mips64Assembler::Addu, "addu ${reg1}, ${reg2}, ${reg3}"), "addu"); +} + +TEST_F(AssemblerMIPS64Test, Addiu) { + DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Addiu, -16, "addiu ${reg1}, ${reg2}, {imm}"), + "addiu"); +} + +TEST_F(AssemblerMIPS64Test, Daddu) { + DriverStr(RepeatRRR(&mips64::Mips64Assembler::Daddu, "daddu ${reg1}, ${reg2}, ${reg3}"), "daddu"); +} + +TEST_F(AssemblerMIPS64Test, Daddiu) { + DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Daddiu, -16, "daddiu ${reg1}, ${reg2}, {imm}"), + "daddiu"); +} + +TEST_F(AssemblerMIPS64Test, Subu) { + DriverStr(RepeatRRR(&mips64::Mips64Assembler::Subu, "subu ${reg1}, ${reg2}, ${reg3}"), "subu"); +} + +TEST_F(AssemblerMIPS64Test, Dsubu) { + DriverStr(RepeatRRR(&mips64::Mips64Assembler::Dsubu, "dsubu ${reg1}, ${reg2}, ${reg3}"), "dsubu"); +} + +TEST_F(AssemblerMIPS64Test, MulR6) { + DriverStr(RepeatRRR(&mips64::Mips64Assembler::MulR6, "mul ${reg1}, ${reg2}, ${reg3}"), "mulR6"); +} + +TEST_F(AssemblerMIPS64Test, DivR6) { + DriverStr(RepeatRRR(&mips64::Mips64Assembler::DivR6, "div ${reg1}, ${reg2}, ${reg3}"), "divR6"); +} + +TEST_F(AssemblerMIPS64Test, ModR6) { + DriverStr(RepeatRRR(&mips64::Mips64Assembler::ModR6, "mod ${reg1}, ${reg2}, ${reg3}"), "modR6"); +} + +TEST_F(AssemblerMIPS64Test, DivuR6) { + DriverStr(RepeatRRR(&mips64::Mips64Assembler::DivuR6, "divu ${reg1}, ${reg2}, ${reg3}"), + "divuR6"); +} + +TEST_F(AssemblerMIPS64Test, ModuR6) { + DriverStr(RepeatRRR(&mips64::Mips64Assembler::ModuR6, "modu ${reg1}, ${reg2}, ${reg3}"), + "moduR6"); +} + +TEST_F(AssemblerMIPS64Test, Dmul) { + DriverStr(RepeatRRR(&mips64::Mips64Assembler::Dmul, "dmul ${reg1}, ${reg2}, ${reg3}"), "dmul"); +} + +TEST_F(AssemblerMIPS64Test, Ddiv) { + DriverStr(RepeatRRR(&mips64::Mips64Assembler::Ddiv, "ddiv ${reg1}, ${reg2}, ${reg3}"), "ddiv"); +} + +TEST_F(AssemblerMIPS64Test, Dmod) { + DriverStr(RepeatRRR(&mips64::Mips64Assembler::Dmod, "dmod ${reg1}, ${reg2}, ${reg3}"), "dmod"); +} + +TEST_F(AssemblerMIPS64Test, Ddivu) { + DriverStr(RepeatRRR(&mips64::Mips64Assembler::Ddivu, "ddivu ${reg1}, ${reg2}, ${reg3}"), "ddivu"); +} + +TEST_F(AssemblerMIPS64Test, Dmodu) { + DriverStr(RepeatRRR(&mips64::Mips64Assembler::Dmodu, "dmodu ${reg1}, ${reg2}, ${reg3}"), "dmodu"); +} + +TEST_F(AssemblerMIPS64Test, And) { + DriverStr(RepeatRRR(&mips64::Mips64Assembler::And, "and ${reg1}, ${reg2}, ${reg3}"), "and"); +} + +TEST_F(AssemblerMIPS64Test, Andi) { + DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Andi, 16, "andi ${reg1}, ${reg2}, {imm}"), "andi"); +} + +TEST_F(AssemblerMIPS64Test, Or) { + DriverStr(RepeatRRR(&mips64::Mips64Assembler::Or, "or ${reg1}, ${reg2}, ${reg3}"), "or"); +} + +TEST_F(AssemblerMIPS64Test, Ori) { + DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Ori, 16, "ori ${reg1}, ${reg2}, {imm}"), "ori"); +} + +TEST_F(AssemblerMIPS64Test, Xor) { + DriverStr(RepeatRRR(&mips64::Mips64Assembler::Xor, "xor ${reg1}, ${reg2}, ${reg3}"), "xor"); +} + +TEST_F(AssemblerMIPS64Test, Xori) { + DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Xori, 16, "xori ${reg1}, ${reg2}, {imm}"), "xori"); +} + +TEST_F(AssemblerMIPS64Test, Nor) { + DriverStr(RepeatRRR(&mips64::Mips64Assembler::Nor, "nor ${reg1}, ${reg2}, ${reg3}"), "nor"); +} + +TEST_F(AssemblerMIPS64Test, Lb) { + DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Lb, -16, "lb ${reg1}, {imm}(${reg2})"), "lb"); +} + +TEST_F(AssemblerMIPS64Test, Lh) { + DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Lh, -16, "lh ${reg1}, {imm}(${reg2})"), "lh"); +} + +TEST_F(AssemblerMIPS64Test, Lw) { + DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Lw, -16, "lw ${reg1}, {imm}(${reg2})"), "lw"); +} + +TEST_F(AssemblerMIPS64Test, Ld) { + DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Ld, -16, "ld ${reg1}, {imm}(${reg2})"), "ld"); +} + +TEST_F(AssemblerMIPS64Test, Lbu) { + DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Lbu, -16, "lbu ${reg1}, {imm}(${reg2})"), "lbu"); +} + +TEST_F(AssemblerMIPS64Test, Lhu) { + DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Lhu, -16, "lhu ${reg1}, {imm}(${reg2})"), "lhu"); +} + +TEST_F(AssemblerMIPS64Test, Lwu) { + DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Lwu, -16, "lwu ${reg1}, {imm}(${reg2})"), "lwu"); +} + +TEST_F(AssemblerMIPS64Test, Lui) { + DriverStr(RepeatRIb(&mips64::Mips64Assembler::Lui, 16, "lui ${reg}, {imm}"), "lui"); +} + +TEST_F(AssemblerMIPS64Test, Dahi) { + DriverStr(RepeatRIb(&mips64::Mips64Assembler::Dahi, 16, "dahi ${reg}, ${reg}, {imm}"), "dahi"); +} + +TEST_F(AssemblerMIPS64Test, Dati) { + DriverStr(RepeatRIb(&mips64::Mips64Assembler::Dati, 16, "dati ${reg}, ${reg}, {imm}"), "dati"); +} + +TEST_F(AssemblerMIPS64Test, Sb) { + DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Sb, -16, "sb ${reg1}, {imm}(${reg2})"), "sb"); +} + +TEST_F(AssemblerMIPS64Test, Sh) { + DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Sh, -16, "sh ${reg1}, {imm}(${reg2})"), "sh"); +} + +TEST_F(AssemblerMIPS64Test, Sw) { + DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Sw, -16, "sw ${reg1}, {imm}(${reg2})"), "sw"); +} + +TEST_F(AssemblerMIPS64Test, Sd) { + DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Sd, -16, "sd ${reg1}, {imm}(${reg2})"), "sd"); +} + +TEST_F(AssemblerMIPS64Test, Slt) { + DriverStr(RepeatRRR(&mips64::Mips64Assembler::Slt, "slt ${reg1}, ${reg2}, ${reg3}"), "slt"); +} + +TEST_F(AssemblerMIPS64Test, Sltu) { + DriverStr(RepeatRRR(&mips64::Mips64Assembler::Sltu, "sltu ${reg1}, ${reg2}, ${reg3}"), "sltu"); +} + +TEST_F(AssemblerMIPS64Test, Slti) { + DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Slti, -16, "slti ${reg1}, ${reg2}, {imm}"), + "slti"); +} + +TEST_F(AssemblerMIPS64Test, Sltiu) { + DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Sltiu, -16, "sltiu ${reg1}, ${reg2}, {imm}"), + "sltiu"); +} + +TEST_F(AssemblerMIPS64Test, Move) { + DriverStr(RepeatRR(&mips64::Mips64Assembler::Move, "or ${reg1}, ${reg2}, $zero"), "move"); +} + +TEST_F(AssemblerMIPS64Test, Clear) { + DriverStr(RepeatR(&mips64::Mips64Assembler::Clear, "or ${reg}, $zero, $zero"), "clear"); +} + +TEST_F(AssemblerMIPS64Test, Not) { + DriverStr(RepeatRR(&mips64::Mips64Assembler::Not, "nor ${reg1}, ${reg2}, $zero"), "not"); +} + TEST_F(AssemblerMIPS64Test, Bitswap) { DriverStr(RepeatRR(&mips64::Mips64Assembler::Bitswap, "bitswap ${reg1}, ${reg2}"), "bitswap"); } @@ -1230,6 +1474,18 @@ TEST_F(AssemblerMIPS64Test, Dsra32) { "dsra32"); } +TEST_F(AssemblerMIPS64Test, Dsllv) { + DriverStr(RepeatRRR(&mips64::Mips64Assembler::Dsllv, "dsllv ${reg1}, ${reg2}, ${reg3}"), "dsllv"); +} + +TEST_F(AssemblerMIPS64Test, Dsrlv) { + DriverStr(RepeatRRR(&mips64::Mips64Assembler::Dsrlv, "dsrlv ${reg1}, ${reg2}, ${reg3}"), "dsrlv"); +} + +TEST_F(AssemblerMIPS64Test, Dsrav) { + DriverStr(RepeatRRR(&mips64::Mips64Assembler::Dsrav, "dsrav ${reg1}, ${reg2}, ${reg3}"), "dsrav"); +} + TEST_F(AssemblerMIPS64Test, Sc) { DriverStr(RepeatRRIb(&mips64::Mips64Assembler::Sc, -9, "sc ${reg1}, {imm}(${reg2})"), "sc"); } diff --git a/runtime/openjdkjvmti/events.cc b/runtime/openjdkjvmti/events.cc index 7182055b7d..d3f8001d69 100644 --- a/runtime/openjdkjvmti/events.cc +++ b/runtime/openjdkjvmti/events.cc @@ -212,7 +212,7 @@ class JvmtiAllocationListener : public art::gc::AllocationListener { thread.get(), object.get(), klass.get(), - byte_count); + static_cast<jlong>(byte_count)); } } diff --git a/runtime/parsed_options.cc b/runtime/parsed_options.cc index a72159bc80..d1ad77c910 100644 --- a/runtime/parsed_options.cc +++ b/runtime/parsed_options.cc @@ -302,6 +302,9 @@ std::unique_ptr<RuntimeParser> ParsedOptions::MakeParser(bool ignore_unrecognize .IntoKey(M::Plugins) .Define("-Xfully-deoptable") .IntoKey(M::FullyDeoptable) + .Define("-XX:ThreadSuspendTimeout=_") // in ms + .WithType<MillisecondsToNanoseconds>() // store as ns + .IntoKey(M::ThreadSuspendTimeout) .Ignore({ "-ea", "-da", "-enableassertions", "-disableassertions", "--runtime-arg", "-esa", "-dsa", "-enablesystemassertions", "-disablesystemassertions", "-Xrs", "-Xint:_", @@ -724,6 +727,7 @@ void ParsedOptions::Usage(const char* fmt, ...) { UsageMessage(stream, " -XX:MaxSpinsBeforeThinLockInflation=integervalue\n"); UsageMessage(stream, " -XX:LongPauseLogThreshold=integervalue\n"); UsageMessage(stream, " -XX:LongGCLogThreshold=integervalue\n"); + UsageMessage(stream, " -XX:ThreadSuspendTimeout=integervalue\n"); UsageMessage(stream, " -XX:DumpGCPerformanceOnShutdown\n"); UsageMessage(stream, " -XX:DumpJITInfoOnShutdown\n"); UsageMessage(stream, " -XX:IgnoreMaxFootprint\n"); diff --git a/runtime/runtime.cc b/runtime/runtime.cc index 4936a2f9a7..4a32abee48 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -1045,7 +1045,7 @@ bool Runtime::Init(RuntimeArgumentMap&& runtime_options_in) { monitor_list_ = new MonitorList; monitor_pool_ = MonitorPool::Create(); - thread_list_ = new ThreadList; + thread_list_ = new ThreadList(runtime_options.GetOrDefault(Opt::ThreadSuspendTimeout)); intern_table_ = new InternTable; verify_ = runtime_options.GetOrDefault(Opt::Verify); diff --git a/runtime/runtime_options.cc b/runtime/runtime_options.cc index e75481c78a..aa147198fc 100644 --- a/runtime/runtime_options.cc +++ b/runtime/runtime_options.cc @@ -21,6 +21,7 @@ #include "gc/heap.h" #include "monitor.h" #include "runtime.h" +#include "thread_list.h" #include "trace.h" #include "utils.h" #include "debugger.h" diff --git a/runtime/runtime_options.def b/runtime/runtime_options.def index ecabf9adc5..749a36e3b3 100644 --- a/runtime/runtime_options.def +++ b/runtime/runtime_options.def @@ -60,6 +60,8 @@ RUNTIME_OPTIONS_KEY (MillisecondsToNanoseconds, \ LongPauseLogThreshold, gc::Heap::kDefaultLongPauseLogThreshold) RUNTIME_OPTIONS_KEY (MillisecondsToNanoseconds, \ LongGCLogThreshold, gc::Heap::kDefaultLongGCLogThreshold) +RUNTIME_OPTIONS_KEY (MillisecondsToNanoseconds, \ + ThreadSuspendTimeout, ThreadList::kDefaultThreadSuspendTimeout) RUNTIME_OPTIONS_KEY (Unit, DumpGCPerformanceOnShutdown) RUNTIME_OPTIONS_KEY (Unit, DumpJITInfoOnShutdown) RUNTIME_OPTIONS_KEY (Unit, IgnoreMaxFootprint) diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc index c5c7e2cc16..01c940e9df 100644 --- a/runtime/thread_list.cc +++ b/runtime/thread_list.cc @@ -57,7 +57,6 @@ namespace art { using android::base::StringPrintf; static constexpr uint64_t kLongThreadSuspendThreshold = MsToNs(5); -static constexpr uint64_t kThreadSuspendTimeoutMs = 30 * 1000; // 30s. // Use 0 since we want to yield to prevent blocking for an unpredictable amount of time. static constexpr useconds_t kThreadSuspendInitialSleepUs = 0; static constexpr useconds_t kThreadSuspendMaxYieldUs = 3000; @@ -68,12 +67,13 @@ static constexpr useconds_t kThreadSuspendMaxSleepUs = 5000; // Turned off again. b/29248079 static constexpr bool kDumpUnattachedThreadNativeStackForSigQuit = false; -ThreadList::ThreadList() +ThreadList::ThreadList(uint64_t thread_suspend_timeout_ns) : suspend_all_count_(0), debug_suspend_all_count_(0), unregistering_count_(0), suspend_all_historam_("suspend all histogram", 16, 64), long_suspend_(false), + thread_suspend_timeout_ns_(thread_suspend_timeout_ns), empty_checkpoint_barrier_(new Barrier(0)) { CHECK(Monitor::IsValidLockWord(LockWord::FromThinLockId(kMaxThreadId, 1, 0U))); } @@ -554,12 +554,14 @@ void ThreadList::SuspendAll(const char* cause, bool long_suspend) { // Make sure this thread grabs exclusive access to the mutator lock and its protected data. #if HAVE_TIMED_RWLOCK while (true) { - if (Locks::mutator_lock_->ExclusiveLockWithTimeout(self, kThreadSuspendTimeoutMs, 0)) { + if (Locks::mutator_lock_->ExclusiveLockWithTimeout(self, + NsToMs(thread_suspend_timeout_ns_), + 0)) { break; } else if (!long_suspend_) { // Reading long_suspend without the mutator lock is slightly racy, in some rare cases, this // could result in a thread suspend timeout. - // Timeout if we wait more than kThreadSuspendTimeoutMs seconds. + // Timeout if we wait more than thread_suspend_timeout_ns_ nanoseconds. UnsafeLogFatalForThreadSuspendAllTimeout(); } } @@ -653,7 +655,7 @@ void ThreadList::SuspendAllInternal(Thread* self, // is done with a timeout so that we can detect problems. #if ART_USE_FUTEXES timespec wait_timeout; - InitTimeSpec(false, CLOCK_MONOTONIC, kIsDebugBuild ? 50000 : 10000, 0, &wait_timeout); + InitTimeSpec(false, CLOCK_MONOTONIC, NsToMs(thread_suspend_timeout_ns_), 0, &wait_timeout); #endif const uint64_t start_time = NanoTime(); while (true) { @@ -863,7 +865,7 @@ Thread* ThreadList::SuspendThreadByPeer(jobject peer, return thread; } const uint64_t total_delay = NanoTime() - start_time; - if (total_delay >= MsToNs(kThreadSuspendTimeoutMs)) { + if (total_delay >= thread_suspend_timeout_ns_) { ThreadSuspendByPeerWarning(self, ::android::base::FATAL, "Thread suspension timed out", @@ -969,7 +971,7 @@ Thread* ThreadList::SuspendThreadByThreadId(uint32_t thread_id, return thread; } const uint64_t total_delay = NanoTime() - start_time; - if (total_delay >= MsToNs(kThreadSuspendTimeoutMs)) { + if (total_delay >= thread_suspend_timeout_ns_) { ThreadSuspendByThreadIdWarning(::android::base::WARNING, "Thread suspension timed out", thread_id); diff --git a/runtime/thread_list.h b/runtime/thread_list.h index 658db00ec3..b60fca1fdc 100644 --- a/runtime/thread_list.h +++ b/runtime/thread_list.h @@ -20,6 +20,7 @@ #include "barrier.h" #include "base/histogram.h" #include "base/mutex.h" +#include "base/time_utils.h" #include "base/value_object.h" #include "gc_root.h" #include "jni.h" @@ -41,11 +42,12 @@ class TimingLogger; class ThreadList { public: - static const uint32_t kMaxThreadId = 0xFFFF; - static const uint32_t kInvalidThreadId = 0; - static const uint32_t kMainThreadId = 1; + static constexpr uint32_t kMaxThreadId = 0xFFFF; + static constexpr uint32_t kInvalidThreadId = 0; + static constexpr uint32_t kMainThreadId = 1; + static constexpr uint64_t kDefaultThreadSuspendTimeout = MsToNs(kIsDebugBuild ? 50000 : 10000); - explicit ThreadList(); + explicit ThreadList(uint64_t thread_suspend_timeout_ns); ~ThreadList(); void DumpForSigQuit(std::ostream& os) @@ -219,6 +221,9 @@ class ThreadList { // Whether or not the current thread suspension is long. bool long_suspend_; + // Thread suspension timeout in nanoseconds. + const uint64_t thread_suspend_timeout_ns_; + std::unique_ptr<Barrier> empty_checkpoint_barrier_; friend class Thread; diff --git a/test/Android.run-test.mk b/test/Android.run-test.mk index 639996ee7f..814f968bc9 100644 --- a/test/Android.run-test.mk +++ b/test/Android.run-test.mk @@ -277,42 +277,6 @@ TEST_ART_BROKEN_TARGET_TESTS := \ 147-stripped-dex-fallback \ 569-checker-pattern-replacement -# These 9** tests are not supported in current form due to linker -# restrictions. See b/31681198 -TEST_ART_BROKEN_TARGET_TESTS += \ - 901-hello-ti-agent \ - 902-hello-transformation \ - 903-hello-tagging \ - 904-object-allocation \ - 905-object-free \ - 906-iterate-heap \ - 907-get-loaded-classes \ - 908-gc-start-finish \ - 909-attach-agent \ - 910-methods \ - 911-get-stack-trace \ - 912-classes \ - 913-heaps \ - 914-hello-obsolescence \ - 915-obsolete-2 \ - 916-obsolete-jit \ - 917-fields-transformation \ - 918-fields \ - 919-obsolete-fields \ - 920-objects \ - 921-hello-failure \ - 922-properties \ - 923-monitors \ - 924-threads \ - 925-threadgroups \ - 926-multi-obsolescence \ - 927-timers \ - 928-jni-table \ - 929-search \ - 930-hello-retransform \ - 931-agent-thread \ - 932-transform-saves \ - ifneq (,$(filter target,$(TARGET_TYPES))) ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,target,$(RUN_TYPES),$(PREBUILD_TYPES), \ $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \ diff --git a/test/run-test b/test/run-test index 9b178021ff..c78fa35e24 100755 --- a/test/run-test +++ b/test/run-test @@ -131,6 +131,7 @@ pic_image_suffix="" multi_image_suffix="" android_root="/system" bisection_search="no" +suspend_timeout="500000" # By default we will use optimizing. image_args="" image_suffix="" @@ -219,6 +220,10 @@ while true; do basic_verify="true" gc_stress="true" shift + elif [ "x$1" = "x--suspend-timeout" ]; then + shift + suspend_timeout="$1" + shift elif [ "x$1" = "x--image" ]; then shift image="$1" @@ -402,6 +407,9 @@ noncanonical_tmp_dir=$tmp_dir tmp_dir="`cd $oldwd ; python -c "import os; print os.path.realpath('$tmp_dir')"`" mkdir -p $tmp_dir +# Add thread suspend timeout flag +run_args="${run_args} --runtime-option -XX:ThreadSuspendTimeout=$suspend_timeout" + if [ "$basic_verify" = "true" ]; then # Set HspaceCompactForOOMMinIntervalMs to zero to run hspace compaction for OOM more frequently in tests. run_args="${run_args} --runtime-option -Xgc:preverify --runtime-option -Xgc:postverify --runtime-option -XX:HspaceCompactForOOMMinIntervalMs=0" @@ -649,6 +657,7 @@ if [ "$usage" = "yes" ]; then echo " --quiet Don't print anything except failure messages" echo " --bisection-search Perform bisection bug search." echo " --vdex Test using vdex as in input to dex2oat. Only works with --prebuild." + echo " --suspend-timeout Change thread suspend timeout ms (default 500000)." ) 1>&2 # Direct to stderr so usage is not printed if --quiet is set. exit 1 fi diff --git a/test/ti-agent/common_helper.cc b/test/ti-agent/common_helper.cc index fd9fc38fb7..80e1797369 100644 --- a/test/ti-agent/common_helper.cc +++ b/test/ti-agent/common_helper.cc @@ -349,7 +349,7 @@ static void BindMethod(jvmtiEnv* jenv, names[1] = m->JniLongName(); } for (const std::string& mangled_name : names) { - void* sym = dlsym(nullptr, mangled_name.c_str()); + void* sym = dlsym(RTLD_DEFAULT, mangled_name.c_str()); if (sym == nullptr) { continue; } |