summaryrefslogtreecommitdiffstats
path: root/runtime/dex_instruction-inl.h
diff options
context:
space:
mode:
authorSebastien Hertz <shertz@google.com>2013-09-10 11:44:19 +0200
committerSebastien Hertz <shertz@google.com>2013-09-30 08:57:33 +0200
commitc61124bdeaae94f977ffc36ac69535e792c226f2 (patch)
tree41ba8619a6dea88a8c607836db21531b05a3787a /runtime/dex_instruction-inl.h
parent7541c745e00b49983f277d6b6b18bc4c174c7e39 (diff)
downloadandroid_art-c61124bdeaae94f977ffc36ac69535e792c226f2.tar.gz
android_art-c61124bdeaae94f977ffc36ac69535e792c226f2.tar.bz2
android_art-c61124bdeaae94f977ffc36ac69535e792c226f2.zip
Cleanup invoke in interpreter.
Some cleanup in invocation stuff: - Get the number of invoke arguments from instruction (vA) rather than get it from its code item. This benefits to native invoke since we no longer need to parse the method's shorty. Also pass the low 16 bits of instructions to avoid fetching it twice when reading vA. - Remove "is_static" tests by taking advantage of invoke type template argument rather than testing method's access flags. - Ensure Instruction::GetArgs is inlined. - Check exception when initializing method's class when transitioning from interpreter to compiled code (artInterpreterToCompiledCodeBridge). - Move UnstartedRuntimeInvoke function to interpreter_common.cc and make it static as it's only used by DoInvoke and DoInvokeVirtualQuick functions. - Avoid duplicating code in ShadowFrame::Create. Performance remains the same according to benchmarks. Hopefully, this should be addressed in next CLs, especially by improving new shadow frame initialization. Bug: 10668955 Change-Id: I514b8f098d0ef3e35921ceb770383aac1a9c7902
Diffstat (limited to 'runtime/dex_instruction-inl.h')
-rw-r--r--runtime/dex_instruction-inl.h13
1 files changed, 6 insertions, 7 deletions
diff --git a/runtime/dex_instruction-inl.h b/runtime/dex_instruction-inl.h
index 4d39024013..207b0b6795 100644
--- a/runtime/dex_instruction-inl.h
+++ b/runtime/dex_instruction-inl.h
@@ -281,7 +281,7 @@ inline uint16_t Instruction::VRegC_3rc() const {
return Fetch16(2);
}
-inline void Instruction::GetArgs(uint32_t arg[5]) const {
+inline void Instruction::GetArgs(uint32_t arg[5], uint16_t inst_data) const {
DCHECK_EQ(FormatOf(Opcode()), k35c);
/*
@@ -295,7 +295,8 @@ inline void Instruction::GetArgs(uint32_t arg[5]) const {
* method constant (or equivalent) is always in vB.
*/
uint16_t regList = Fetch16(2);
- uint4_t count = InstB(); // This is labeled A in the spec.
+ uint4_t count = InstB(inst_data); // This is labeled A in the spec.
+ DCHECK_LE(count, 5U) << "Invalid arg count in 35c (" << count << ")";
/*
* Copy the argument registers into the arg[] array, and
@@ -305,15 +306,13 @@ inline void Instruction::GetArgs(uint32_t arg[5]) const {
* copies of those.) Note that cases 5..2 fall through.
*/
switch (count) {
- case 5: arg[4] = InstA();
+ case 5: arg[4] = InstA(inst_data);
case 4: arg[3] = (regList >> 12) & 0x0f;
case 3: arg[2] = (regList >> 8) & 0x0f;
case 2: arg[1] = (regList >> 4) & 0x0f;
case 1: arg[0] = regList & 0x0f; break;
- case 0: break; // Valid, but no need to do anything.
- default:
- LOG(ERROR) << "Invalid arg count in 35c (" << count << ")";
- return;
+ default: // case 0
+ break; // Valid, but no need to do anything.
}
}