Fix bug in protected field access.
Change-Id: I38b094e54025d26950c0d8c8bb79d2de81d28428
diff --git a/src/oat/runtime/support_dexcache.cc b/src/oat/runtime/support_dexcache.cc
index e5f2f82..49e038d 100644
--- a/src/oat/runtime/support_dexcache.cc
+++ b/src/oat/runtime/support_dexcache.cc
@@ -21,13 +21,16 @@
extern "C" Class* artInitializeStaticStorageFromCode(uint32_t type_idx, const Method* referrer,
Thread* self, Method** sp) {
+ // Called to ensure static storage base is initialized for direct static field reads and writes.
+ // A class may be accessing another class' fields when it doesn't have access, as access has been
+ // given by inheritance.
FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
- return ResolveVerifyAndClinit(type_idx, referrer, self, true, true);
+ return ResolveVerifyAndClinit(type_idx, referrer, self, true, false);
}
extern "C" Class* artInitializeTypeFromCode(uint32_t type_idx, const Method* referrer, Thread* self,
Method** sp) {
- // Called when method->dex_cache_resolved_types_[] misses
+ // Called when method->dex_cache_resolved_types_[] misses.
FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
return ResolveVerifyAndClinit(type_idx, referrer, self, false, false);
}
@@ -36,7 +39,7 @@
const Method* referrer, Thread* self,
Method** sp) {
// Called when caller isn't guaranteed to have access to a type and the dex cache may be
- // unpopulated
+ // unpopulated.
FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly);
return ResolveVerifyAndClinit(type_idx, referrer, self, false, true);
}