Implement can_generate_native_method_bind capability
This capability lets one observe and even replace the implementations
of native methods when they are bound.
Test: ./test.py --host -j40
Bug: 37432636
Change-Id: I2432a8e4da1a677e8011ce495296f4ab9f42eb3e
diff --git a/runtime/runtime_callbacks.h b/runtime/runtime_callbacks.h
index d321254..e8f1824 100644
--- a/runtime/runtime_callbacks.h
+++ b/runtime/runtime_callbacks.h
@@ -31,8 +31,10 @@
class ClassLoader;
} // namespace mirror
+class ArtMethod;
class ClassLoadCallback;
class Thread;
+class MethodCallback;
class ThreadLifecycleCallback;
// Note: RuntimeCallbacks uses the mutator lock to synchronize the callback lists. A thread must
@@ -110,6 +112,14 @@
/*out*/DexFile::ClassDef const** final_class_def)
REQUIRES_SHARED(Locks::mutator_lock_);
+ void AddMethodCallback(MethodCallback* cb) REQUIRES(Locks::mutator_lock_);
+ void RemoveMethodCallback(MethodCallback* cb) REQUIRES(Locks::mutator_lock_);
+
+ void RegisterNativeMethod(ArtMethod* method,
+ const void* original_implementation,
+ /*out*/void** new_implementation)
+ REQUIRES_SHARED(Locks::mutator_lock_);
+
private:
std::vector<ThreadLifecycleCallback*> thread_callbacks_
GUARDED_BY(Locks::mutator_lock_);
@@ -118,7 +128,9 @@
std::vector<RuntimeSigQuitCallback*> sigquit_callbacks_
GUARDED_BY(Locks::mutator_lock_);
std::vector<RuntimePhaseCallback*> phase_callbacks_
- GUARDED_BY(Locks::mutator_lock_);
+ GUARDED_BY(Locks::mutator_lock_);
+ std::vector<MethodCallback*> method_callbacks_
+ GUARDED_BY(Locks::mutator_lock_);
};
} // namespace art