Make CodeItem fields private
Make code item fields private and use accessors. Added a hand full of
friend classes to reduce the size of the change.
Changed default to be nullable and removed CreateNullable.
CreateNullable was a bad API since it defaulted to the unsafe, may
add a CreateNonNullable if it's important for performance.
Motivation:
Have a different layout for code items in cdex.
Bug: 63756964
Test: test-art-host-gtest
Test: test/testrunner/testrunner.py --host
Test: art/tools/run-jdwp-tests.sh '--mode=host' '--variant=X32' --debug
Change-Id: I42bc7435e20358682075cb6de52713b595f95bf9
diff --git a/compiler/exception_test.cc b/compiler/exception_test.cc
index 897b50b..4dbef0d 100644
--- a/compiler/exception_test.cc
+++ b/compiler/exception_test.cc
@@ -20,6 +20,7 @@
#include "base/callee_save_type.h"
#include "base/enums.h"
#include "class_linker.h"
+#include "code_item_accessors-inl.h"
#include "common_runtime_test.h"
#include "dex_file-inl.h"
#include "dex_file.h"
@@ -129,11 +130,12 @@
TEST_F(ExceptionTest, FindCatchHandler) {
ScopedObjectAccess soa(Thread::Current());
const DexFile::CodeItem* code_item = dex_->GetCodeItem(method_f_->GetCodeItemOffset());
+ CodeItemDataAccessor accessor(dex_, code_item);
ASSERT_TRUE(code_item != nullptr);
- ASSERT_EQ(2u, code_item->tries_size_);
- ASSERT_NE(0u, code_item->insns_size_in_code_units_);
+ ASSERT_EQ(2u, accessor.TriesSize());
+ ASSERT_NE(0u, accessor.InsnsSizeInCodeUnits());
const DexFile::TryItem *t0, *t1;
t0 = dex_->GetTryItems(*code_item, 0);