summaryrefslogtreecommitdiff
path: root/compiler/compiler.cc
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2017-12-15 11:19:33 -0800
committer Mathieu Chartier <mathieuc@google.com> 2017-12-22 09:41:17 -0800
commit808c7a57bb913b13c22884f57cdacd59bf1fdb3f (patch)
treed7f0d7cabaac5a7646c25bae584a82a9aa279cc0 /compiler/compiler.cc
parent64bae9fb677aa0e2406d13ea9f8ebaa92e16f978 (diff)
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
Diffstat (limited to 'compiler/compiler.cc')
-rw-r--r--compiler/compiler.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/compiler.cc b/compiler/compiler.cc
index bb614ae7b2..47f44ff3bc 100644
--- a/compiler/compiler.cc
+++ b/compiler/compiler.cc
@@ -19,6 +19,7 @@
#include <android-base/logging.h>
#include "base/macros.h"
+#include "code_item_accessors-inl.h"
#include "driver/compiler_driver.h"
#include "optimizing/optimizing_compiler.h"
#include "utils.h"
@@ -46,15 +47,16 @@ bool Compiler::IsPathologicalCase(const DexFile::CodeItem& code_item,
* Dalvik uses 16-bit uints for instruction and register counts. We'll limit to a quarter
* of that, which also guarantees we cannot overflow our 16-bit internal Quick SSA name space.
*/
- if (code_item.insns_size_in_code_units_ >= UINT16_MAX / 4) {
+ CodeItemDataAccessor accessor(&dex_file, &code_item);
+ if (accessor.InsnsSizeInCodeUnits() >= UINT16_MAX / 4) {
LOG(INFO) << "Method exceeds compiler instruction limit: "
- << code_item.insns_size_in_code_units_
+ << accessor.InsnsSizeInCodeUnits()
<< " in " << dex_file.PrettyMethod(method_idx);
return true;
}
- if (code_item.registers_size_ >= UINT16_MAX / 4) {
+ if (accessor.RegistersSize() >= UINT16_MAX / 4) {
LOG(INFO) << "Method exceeds compiler virtual register limit: "
- << code_item.registers_size_ << " in " << dex_file.PrettyMethod(method_idx);
+ << accessor.RegistersSize() << " in " << dex_file.PrettyMethod(method_idx);
return true;
}
return false;