summaryrefslogtreecommitdiff
path: root/runtime/class_linker.h
diff options
context:
space:
mode:
author Alex Light <allight@google.com> 2019-11-26 18:52:06 +0000
committer Treehugger Robot <treehugger-gerrit@google.com> 2019-12-02 18:34:20 +0000
commitf1b809ce611e943f926fff97cefe0930226ffcc2 (patch)
treef75675383cf8018f9f333e608df35edbacf1c913 /runtime/class_linker.h
parent20b7a9b8aeaf76fc8f3248f211489fd00af73170 (diff)
Revert^2 "Allow structural redefinition on non-final classes."
We were incorrectly racing with the rest of the runtime in a couple of places. First we would return an ObjPtr of a newly defined class after holding it over a suspend point. This could lead to DefineClass returning an obsolete class in some cases. We also failed to ensure the class-status was synchronized between the old and new classes during structural redefinition. This could lead to a class appearing to go backwards in status. This reverts commit 88b1c83080afcb2bfb6f781ded1c90fe8f9eab4d. Reason for revert: Fixed issues causing test failures. Test: ./test.py --host Bug: 134162467 Bug: 144168550 Change-Id: I4d0f7718490532f0ef14a9561b8e7000ef292b12
Diffstat (limited to 'runtime/class_linker.h')
-rw-r--r--runtime/class_linker.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/runtime/class_linker.h b/runtime/class_linker.h
index 877b9647aa..2687b9a2cf 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -1441,6 +1441,10 @@ class ClassLoadCallback {
public:
virtual ~ClassLoadCallback() {}
+ // Called immediately before beginning class-definition and immediately before returning from it.
+ virtual void BeginDefineClass() REQUIRES_SHARED(Locks::mutator_lock_) {}
+ virtual void EndDefineClass() REQUIRES_SHARED(Locks::mutator_lock_) {}
+
// If set we will replace initial_class_def & initial_dex_file with the final versions. The
// callback author is responsible for ensuring these are allocated in such a way they can be
// cleaned up if another transformation occurs. Note that both must be set or null/unchanged on