summaryrefslogtreecommitdiff
path: root/runtime/interpreter/interpreter_switch_impl.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 /runtime/interpreter/interpreter_switch_impl.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 'runtime/interpreter/interpreter_switch_impl.cc')
-rw-r--r--runtime/interpreter/interpreter_switch_impl.cc30
1 files changed, 15 insertions, 15 deletions
diff --git a/runtime/interpreter/interpreter_switch_impl.cc b/runtime/interpreter/interpreter_switch_impl.cc
index 094f08664e..81c1e1deeb 100644
--- a/runtime/interpreter/interpreter_switch_impl.cc
+++ b/runtime/interpreter/interpreter_switch_impl.cc
@@ -67,7 +67,7 @@ namespace interpreter {
{ \
if (UNLIKELY(instrumentation->HasDexPcListeners()) && \
UNLIKELY(!DoDexPcMoveEvent(self, \
- code_item, \
+ accessor, \
shadow_frame, \
dex_pc, \
instrumentation, \
@@ -125,7 +125,7 @@ namespace interpreter {
// jvmti-agents while handling breakpoint or single step events. We had to move this into its own
// function because it was making ExecuteSwitchImpl have too large a stack.
NO_INLINE static bool DoDexPcMoveEvent(Thread* self,
- const DexFile::CodeItem* code_item,
+ const CodeItemDataAccessor& accessor,
const ShadowFrame& shadow_frame,
uint32_t dex_pc,
const instrumentation::Instrumentation* instrumentation,
@@ -139,7 +139,7 @@ NO_INLINE static bool DoDexPcMoveEvent(Thread* self,
hs.NewHandleWrapper(LIKELY(save_ref == nullptr) ? &null_obj : save_ref->GetGCRoot()));
self->ClearException();
instrumentation->DexPcMovedEvent(self,
- shadow_frame.GetThisObject(code_item->ins_size_),
+ shadow_frame.GetThisObject(accessor.InsSize()),
shadow_frame.GetMethod(),
dex_pc);
if (UNLIKELY(self->IsExceptionPending())) {
@@ -188,7 +188,7 @@ NO_INLINE static bool SendMethodExitEvents(Thread* self,
}
template<bool do_access_check, bool transaction_active>
-JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item,
+JValue ExecuteSwitchImpl(Thread* self, const CodeItemDataAccessor& accessor,
ShadowFrame& shadow_frame, JValue result_register,
bool interpret_one_instruction) {
constexpr bool do_assignability_check = do_access_check;
@@ -200,10 +200,10 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item,
uint32_t dex_pc = shadow_frame.GetDexPC();
const auto* const instrumentation = Runtime::Current()->GetInstrumentation();
- const uint16_t* const insns = code_item->insns_;
+ ArtMethod* method = shadow_frame.GetMethod();
+ const uint16_t* const insns = accessor.Insns();
const Instruction* inst = Instruction::At(insns + dex_pc);
uint16_t inst_data;
- ArtMethod* method = shadow_frame.GetMethod();
jit::Jit* jit = Runtime::Current()->GetJit();
do {
@@ -303,7 +303,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item,
!SendMethodExitEvents(self,
instrumentation,
shadow_frame,
- shadow_frame.GetThisObject(code_item->ins_size_),
+ shadow_frame.GetThisObject(accessor.InsSize()),
shadow_frame.GetMethod(),
inst->GetDexPc(insns),
result))) {
@@ -325,7 +325,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item,
!SendMethodExitEvents(self,
instrumentation,
shadow_frame,
- shadow_frame.GetThisObject(code_item->ins_size_),
+ shadow_frame.GetThisObject(accessor.InsSize()),
shadow_frame.GetMethod(),
inst->GetDexPc(insns),
result))) {
@@ -348,7 +348,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item,
!SendMethodExitEvents(self,
instrumentation,
shadow_frame,
- shadow_frame.GetThisObject(code_item->ins_size_),
+ shadow_frame.GetThisObject(accessor.InsSize()),
shadow_frame.GetMethod(),
inst->GetDexPc(insns),
result))) {
@@ -370,7 +370,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item,
!SendMethodExitEvents(self,
instrumentation,
shadow_frame,
- shadow_frame.GetThisObject(code_item->ins_size_),
+ shadow_frame.GetThisObject(accessor.InsSize()),
shadow_frame.GetMethod(),
inst->GetDexPc(insns),
result))) {
@@ -412,7 +412,7 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item,
!SendMethodExitEvents(self,
instrumentation,
shadow_frame,
- shadow_frame.GetThisObject(code_item->ins_size_),
+ shadow_frame.GetThisObject(accessor.InsSize()),
shadow_frame.GetMethod(),
inst->GetDexPc(insns),
result))) {
@@ -2484,19 +2484,19 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item,
// Explicit definitions of ExecuteSwitchImpl.
template HOT_ATTR
-JValue ExecuteSwitchImpl<true, false>(Thread* self, const DexFile::CodeItem* code_item,
+JValue ExecuteSwitchImpl<true, false>(Thread* self, const CodeItemDataAccessor& accessor,
ShadowFrame& shadow_frame, JValue result_register,
bool interpret_one_instruction);
template HOT_ATTR
-JValue ExecuteSwitchImpl<false, false>(Thread* self, const DexFile::CodeItem* code_item,
+JValue ExecuteSwitchImpl<false, false>(Thread* self, const CodeItemDataAccessor& accessor,
ShadowFrame& shadow_frame, JValue result_register,
bool interpret_one_instruction);
template
-JValue ExecuteSwitchImpl<true, true>(Thread* self, const DexFile::CodeItem* code_item,
+JValue ExecuteSwitchImpl<true, true>(Thread* self, const CodeItemDataAccessor& accessor,
ShadowFrame& shadow_frame, JValue result_register,
bool interpret_one_instruction);
template
-JValue ExecuteSwitchImpl<false, true>(Thread* self, const DexFile::CodeItem* code_item,
+JValue ExecuteSwitchImpl<false, true>(Thread* self, const CodeItemDataAccessor& accessor,
ShadowFrame& shadow_frame, JValue result_register,
bool interpret_one_instruction);