diff options
author | 2019-09-24 14:36:27 -0700 | |
---|---|---|
committer | 2019-09-27 17:08:33 +0000 | |
commit | c18eba327c4e207ff7b38817f097ee2220b44b39 (patch) | |
tree | 1978e64abd3e9fd3df99179f4a2110a724a9565f /runtime/runtime_callbacks.cc | |
parent | 371390f775c90b8b3df11a9890585598a2a39da9 (diff) |
Consolidate updating of reflective Field/Method references
Previously we used several different visitors to update Field &
Method references for structural redefinition. We also did not visit
or update JVMTI based references.
This consolidates all the visitors to a single
Runtime::VisitReflectiveTargets function with a single
ReflectiveTargetVisitor type. This simplifies the code around
structural redefinition and ensures that the reflective value holders
are in charge of the actual replacement.
Support was also added for walking internal openjdkjvmti references
for things like field-read/modification events.
Test: ./test.py --host
Bug: 134162467
Change-Id: Ic5fc1db7db0a30f947a1a67259dc024e149ebd57
Diffstat (limited to 'runtime/runtime_callbacks.cc')
-rw-r--r-- | runtime/runtime_callbacks.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/runtime/runtime_callbacks.cc b/runtime/runtime_callbacks.cc index 40976c23ae..ac73364ff0 100644 --- a/runtime/runtime_callbacks.cc +++ b/runtime/runtime_callbacks.cc @@ -319,4 +319,20 @@ void RuntimeCallbacks::RegisterNativeMethod(ArtMethod* method, } } +void RuntimeCallbacks::AddReflectiveValueVisitCallback(ReflectiveValueVisitCallback *cb) { + WriterMutexLock mu(Thread::Current(), *callback_lock_); + reflective_value_visit_callbacks_.push_back(cb); +} + +void RuntimeCallbacks::RemoveReflectiveValueVisitCallback(ReflectiveValueVisitCallback *cb) { + WriterMutexLock mu(Thread::Current(), *callback_lock_); + Remove(cb, &reflective_value_visit_callbacks_); +} + +void RuntimeCallbacks::VisitReflectiveTargets(ReflectiveValueVisitor *visitor) { + for (ReflectiveValueVisitCallback* cb : COPY(reflective_value_visit_callbacks_)) { + cb->VisitReflectiveTargets(visitor); + } +} + } // namespace art |