Revert "Revert "Basic structural redefinition support""
This reverts commit 5a2301d897294ff4ee6de71f459dc2566dc3fa1a.
Bug: 134162467
Reason for revert: Relanding as unclear if issue is due to topic.
Change-Id: Ib1d1cf2e9132e30c9649b760ae9ae2d8ceacf843
diff --git a/runtime/instrumentation.h b/runtime/instrumentation.h
index a7907c8..82e1a13 100644
--- a/runtime/instrumentation.h
+++ b/runtime/instrumentation.h
@@ -536,6 +536,10 @@
void InstrumentThreadStack(Thread* thread)
REQUIRES_SHARED(Locks::mutator_lock_);
+ // Force all currently running frames to be deoptimized back to interpreter. This should only be
+ // used in cases where basically all compiled code has been invalidated.
+ void DeoptimizeAllThreadFrames() REQUIRES(art::Locks::mutator_lock_);
+
static size_t ComputeFrameId(Thread* self,
size_t frame_depth,
size_t inlined_frames_before_frame)
@@ -643,6 +647,11 @@
return deoptimized_methods_lock_.get();
}
+ // A counter that's incremented every time a DeoptimizeAllFrames. We check each
+ // InstrumentationStackFrames creation id against this number and if they differ we deopt even if
+ // we could otherwise continue running.
+ uint64_t current_force_deopt_id_ GUARDED_BY(Locks::mutator_lock_);
+
// Have we hijacked ArtMethod::code_ so that it calls instrumentation/interpreter code?
bool instrumentation_stubs_installed_;
@@ -746,6 +755,7 @@
friend class InstrumentationTest; // For GetCurrentInstrumentationLevel and ConfigureStubs.
friend class InstrumentationStackPopper; // For popping instrumentation frames.
+ friend void InstrumentationInstallStack(Thread*, void*);
DISALLOW_COPY_AND_ASSIGN(Instrumentation);
};
@@ -758,12 +768,14 @@
ArtMethod* method,
uintptr_t return_pc,
size_t frame_id,
- bool interpreter_entry)
+ bool interpreter_entry,
+ uint64_t force_deopt_id)
: this_object_(this_object),
method_(method),
return_pc_(return_pc),
frame_id_(frame_id),
- interpreter_entry_(interpreter_entry) {
+ interpreter_entry_(interpreter_entry),
+ force_deopt_id_(force_deopt_id) {
}
std::string Dump() const REQUIRES_SHARED(Locks::mutator_lock_);
@@ -773,6 +785,7 @@
uintptr_t return_pc_;
size_t frame_id_;
bool interpreter_entry_;
+ uint64_t force_deopt_id_;
};
} // namespace instrumentation