diff options
author | Jeff Hao <jeffhao@google.com> | 2015-05-19 20:30:23 -0700 |
---|---|---|
committer | Jeff Hao <jeffhao@google.com> | 2015-05-20 18:40:43 -0700 |
commit | 39b6c24ce68cf05db0f82f454b4401cfb03d675f (patch) | |
tree | 29e15d2597cd05419a1c0faedfe6977af9a7dfa3 /runtime/indirect_reference_table.h | |
parent | 768b19b6bbddaa2262f6532e7fcb96fecbfee981 (diff) | |
download | art-39b6c24ce68cf05db0f82f454b4401cfb03d675f.tar.gz art-39b6c24ce68cf05db0f82f454b4401cfb03d675f.tar.bz2 art-39b6c24ce68cf05db0f82f454b4401cfb03d675f.zip |
Intercept JNI invocation of String.<init> methods.
libmono uses JNI AllocObject and CallNonvirtualVoidMethod to create and
initialize a string instead of using the recommended NewObject. This
change adds an intercept to change the String.<init> call to a
StringFactory call instead. Then, it uses the object id of the original
string object referrer and maps it to the result of the StringFactory.
Bug: 21288130
(cherry picked from commit 15e9ad1d028d7f12cb598b075453173532a00d91)
Change-Id: I3421c43722c07397da4a398c2ca9110e1d40bcfa
Diffstat (limited to 'runtime/indirect_reference_table.h')
-rw-r--r-- | runtime/indirect_reference_table.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/runtime/indirect_reference_table.h b/runtime/indirect_reference_table.h index a0e53af181..dea5dfdf90 100644 --- a/runtime/indirect_reference_table.h +++ b/runtime/indirect_reference_table.h @@ -213,6 +213,10 @@ class IrtEntry { uint32_t GetSerial() const { return serial_; } + void SetReference(mirror::Object* obj) { + DCHECK_LT(serial_, kIRTPrevCount); + references_[serial_] = GcRoot<mirror::Object>(obj); + } private: uint32_t serial_; @@ -294,6 +298,13 @@ class IndirectReferenceTable { } /* + * Update an existing entry. + * + * Updates an existing indirect reference to point to a new object. + */ + void Update(IndirectRef iref, mirror::Object* obj) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + + /* * Remove an existing entry. * * If the entry is not between the current top index and the bottom index |