Enable thread analysis on template functions.
All template functions using thread analysis must be explicitly instantiated
with the thread analysis attributes to enable thread analysis. We use macros
to do this since there are many variants of a same function depending the
number of template arguments.
Also add documentation of these functions.
Change-Id: I3c79acc2f0a6a8dfb5c42924439145292dd68812
diff --git a/runtime/interpreter/interpreter_common.cc b/runtime/interpreter/interpreter_common.cc
index 6f87a8f..f0f10bb 100644
--- a/runtime/interpreter/interpreter_common.cc
+++ b/runtime/interpreter/interpreter_common.cc
@@ -316,11 +316,12 @@
}
// Explicit DoCall template function declarations.
-#define EXPLICIT_DO_CALL_TEMPLATE_DECL(_is_range, _do_assignability_check) \
-template bool DoCall<_is_range, _do_assignability_check>(ArtMethod* method, Object* receiver, \
- Thread* self, ShadowFrame& shadow_frame, \
- const Instruction* inst, \
- uint16_t inst_data, JValue* result)
+#define EXPLICIT_DO_CALL_TEMPLATE_DECL(_is_range, _do_assignability_check) \
+ template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) \
+ bool DoCall<_is_range, _do_assignability_check>(ArtMethod* method, Object* receiver, \
+ Thread* self, ShadowFrame& shadow_frame, \
+ const Instruction* inst, uint16_t inst_data, \
+ JValue* result)
EXPLICIT_DO_CALL_TEMPLATE_DECL(false, false);
EXPLICIT_DO_CALL_TEMPLATE_DECL(false, true);
EXPLICIT_DO_CALL_TEMPLATE_DECL(true, false);
@@ -329,7 +330,8 @@
// Explicit DoFilledNewArray template function declarations.
#define EXPLICIT_DO_FILLED_NEW_ARRAY_TEMPLATE_DECL(_is_range_, _check) \
- template bool DoFilledNewArray<_is_range_, _check>(const Instruction* inst, \
+ template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) \
+ bool DoFilledNewArray<_is_range_, _check>(const Instruction* inst, \
const ShadowFrame& shadow_frame, \
Thread* self, JValue* result)
EXPLICIT_DO_FILLED_NEW_ARRAY_TEMPLATE_DECL(false, false);