summaryrefslogtreecommitdiff
path: root/openjdkjvmti/deopt_manager.cc
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2019-03-12 14:25:32 +0000
committer Nicolas Geoffray <ngeoffray@google.com> 2019-03-12 14:25:54 +0000
commita55e8b5c9827cc4dc4e7f7c7ee07ef1fdafc35e0 (patch)
tree48120329529bfa5e3e20c1726a513488f97c354e /openjdkjvmti/deopt_manager.cc
parent403aafa9f286e13ee2a64748514d33af39b55ab0 (diff)
Revert "Revert^2 "Add extension and agent for dumping internal jvmti plugin data.""
This reverts commit 2d8b8119228bbe4202490b1d5fed6191989d5d83. Reason for revert: Fails jdwp tests. Change-Id: I0577fd82df161183ccd73eaf61cbe6bf871ef410
Diffstat (limited to 'openjdkjvmti/deopt_manager.cc')
-rw-r--r--openjdkjvmti/deopt_manager.cc52
1 files changed, 2 insertions, 50 deletions
diff --git a/openjdkjvmti/deopt_manager.cc b/openjdkjvmti/deopt_manager.cc
index ec29f2cdda..ee77b7bb77 100644
--- a/openjdkjvmti/deopt_manager.cc
+++ b/openjdkjvmti/deopt_manager.cc
@@ -30,8 +30,6 @@
*/
#include <functional>
-#include <iosfwd>
-#include <mutex>
#include "deopt_manager.h"
@@ -111,53 +109,6 @@ void DeoptManager::Shutdown() {
callbacks->RemoveMethodInspectionCallback(&inspection_callback_);
}
-void DeoptManager::DumpDeoptInfo(art::Thread* self, std::ostream& stream) {
- art::ScopedObjectAccess soa(self);
- art::MutexLock mutll(self, *art::Locks::thread_list_lock_);
- art::MutexLock mudsl(self, deoptimization_status_lock_);
- art::MutexLock mubsl(self, breakpoint_status_lock_);
- stream << "Deoptimizer count: " << deopter_count_ << "\n";
- stream << "Global deopt count: " << global_deopt_count_ << "\n";
- stream << "Can perform OSR: " << !set_local_variable_called_.load() << "\n";
- for (const auto& [bp, loc] : this->breakpoint_status_) {
- stream << "Breakpoint: " << bp->PrettyMethod() << " @ 0x" << std::hex << loc << "\n";
- }
- struct DumpThreadDeoptCount : public art::Closure {
- public:
- DumpThreadDeoptCount(std::ostream& stream, std::mutex& mu)
- : cnt_(0), stream_(stream), mu_(mu) {}
- void Run(art::Thread* self) override {
- {
- std::lock_guard<std::mutex> lg(mu_);
- std::string name;
- self->GetThreadName(name);
- stream_ << "Thread " << name << " (id: " << std::dec << self->GetThreadId()
- << ") force interpreter count " << self->ForceInterpreterCount() << "\n";
- }
- // Increment this after unlocking the mutex so we won't race its destructor.
- cnt_++;
- }
-
- void WaitForCount(size_t threads) {
- while (cnt_.load() != threads) {
- sched_yield();
- }
- }
-
- private:
- std::atomic<size_t> cnt_;
- std::ostream& stream_;
- std::mutex& mu_;
- };
-
- std::mutex mu;
- DumpThreadDeoptCount dtdc(stream, mu);
- auto func = [](art::Thread* thread, void* ctx) {
- reinterpret_cast<DumpThreadDeoptCount*>(ctx)->Run(thread);
- };
- art::Runtime::Current()->GetThreadList()->ForEach(func, &dtdc);
-}
-
void DeoptManager::FinishSetup() {
art::Thread* self = art::Thread::Current();
art::MutexLock mu(self, deoptimization_status_lock_);
@@ -415,7 +366,8 @@ jvmtiError DeoptManager::AddDeoptimizeThreadMethods(art::ScopedObjectAccessUnche
return err;
}
// We don't need additional locking here because we hold the Thread_list_lock_.
- if (target->IncrementForceInterpreterCount() == 1) {
+ target->SetForceInterpreterCount(target->ForceInterpreterCount() + 1);
+ if (target->ForceInterpreterCount() == 1) {
struct DeoptClosure : public art::Closure {
public:
explicit DeoptClosure(DeoptManager* man) : man_(man) {}