From 15e9ad1d028d7f12cb598b075453173532a00d91 Mon Sep 17 00:00:00 2001 From: Jeff Hao Date: Tue, 19 May 2015 20:30:23 -0700 Subject: Intercept JNI invocation of String. 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. 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 Change-Id: Ib4db402c178bc37188d5c5faf30b6e4fdc747b17 --- runtime/indirect_reference_table.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'runtime/indirect_reference_table.h') 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(obj); + } private: uint32_t serial_; @@ -293,6 +297,13 @@ class IndirectReferenceTable { return Get(iref); } + /* + * 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. * -- cgit v1.2.3