summaryrefslogtreecommitdiffstats
path: root/src/dex_cache.cc
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2012-09-18 08:57:04 -0700
committerMathieu Chartier <mathieuc@google.com>2012-09-21 17:32:56 -0700
commit66f19258f9728d4ffe026074d8fd429d639802fa (patch)
treefd94009774c6cbbb1528ea096e606133bd35f104 /src/dex_cache.cc
parenta5e1e3d153990845d80cb8d013157210f11a473c (diff)
downloadart-66f19258f9728d4ffe026074d8fd429d639802fa.zip
art-66f19258f9728d4ffe026074d8fd429d639802fa.tar.gz
art-66f19258f9728d4ffe026074d8fd429d639802fa.tar.bz2
Change dex cache to be java object instead of array, add pointer to dex file in dex cache.
Generic clean up to facilitate having GDB macros for Pretty* helper functions. Improved cleanliness of DexCache since having it as an object array was not the best solution. Fixed a bug in InOrderWalk caused by ResolveType sometimes allocating classes. Rename C++ Method to AbstractMethod and add two new classes Constructor, Method which both inherit from AbstractMethod. Rename done to have the C++ code be closer to the java code. Change-Id: I4995b4c5e47a3822192b08afa24a639d3b1f4da9
Diffstat (limited to 'src/dex_cache.cc')
-rw-r--r--src/dex_cache.cc27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/dex_cache.cc b/src/dex_cache.cc
index 02a8a55..adb889b 100644
--- a/src/dex_cache.cc
+++ b/src/dex_cache.cc
@@ -23,29 +23,34 @@
namespace art {
-void DexCache::Init(String* location,
+void DexCache::Init(const DexFile* dex_file,
+ String* location,
ObjectArray<String>* strings,
ObjectArray<Class>* resolved_types,
- ObjectArray<Method>* resolved_methods,
+ ObjectArray<AbstractMethod>* resolved_methods,
ObjectArray<Field>* resolved_fields,
ObjectArray<StaticStorageBase>* initialized_static_storage) {
+ CHECK(dex_file != NULL);
CHECK(location != NULL);
CHECK(strings != NULL);
CHECK(resolved_types != NULL);
CHECK(resolved_methods != NULL);
CHECK(resolved_fields != NULL);
CHECK(initialized_static_storage != NULL);
- Set(kLocation, location);
- Set(kStrings, strings);
- Set(kResolvedTypes, resolved_types);
- Set(kResolvedMethods, resolved_methods);
- Set(kResolvedFields, resolved_fields);
- Set(kInitializedStaticStorage, initialized_static_storage);
+
+ SetFieldPtr(OFFSET_OF_OBJECT_MEMBER(DexCache, dex_file_), dex_file, false);
+ SetFieldObject(OFFSET_OF_OBJECT_MEMBER(DexCache, location_), location, false);
+ SetFieldObject(StringsOffset(), strings, false);
+ SetFieldObject(OFFSET_OF_OBJECT_MEMBER(DexCache, resolved_types_), resolved_types, false);
+ SetFieldObject(ResolvedMethodsOffset(), resolved_methods, false);
+ SetFieldObject(ResolvedFieldsOffset(), resolved_fields, false);
+ SetFieldObject(OFFSET_OF_OBJECT_MEMBER(DexCache, initialized_static_storage_),
+ initialized_static_storage, false);
Runtime* runtime = Runtime::Current();
if (runtime->HasResolutionMethod()) {
// Initialize the resolve methods array to contain trampolines for resolution.
- Method* trampoline = runtime->GetResolutionMethod();
+ AbstractMethod* trampoline = runtime->GetResolutionMethod();
size_t length = resolved_methods->GetLength();
for (size_t i = 0; i < length; i++) {
resolved_methods->SetWithoutChecks(i, trampoline);
@@ -53,10 +58,10 @@ void DexCache::Init(String* location,
}
}
-void DexCache::Fixup(Method* trampoline) {
+void DexCache::Fixup(AbstractMethod* trampoline) {
// Fixup the resolve methods array to contain trampoline for resolution.
CHECK(trampoline != NULL);
- ObjectArray<Method>* resolved_methods = down_cast<ObjectArray<Method>*>(Get(kResolvedMethods));
+ ObjectArray<AbstractMethod>* resolved_methods = GetResolvedMethods();
size_t length = resolved_methods->GetLength();
for (size_t i = 0; i < length; i++) {
if (resolved_methods->GetWithoutChecks(i) == NULL) {