summaryrefslogtreecommitdiffstats
path: root/runtime/dex_instruction.h
Commit message (Collapse)AuthorAgeFilesLines
* Remove -Wno-unused-parameter and -Wno-sign-promo from base cflags.Ian Rogers2014-11-031-5/+2
| | | | | | | | | | | Fix associated errors about unused paramenters and implict sign conversions. For sign conversion this was largely in the area of enums, so add ostream operators for the effected enums and fix tools/generate-operator-out.py. Tidy arena allocation code and arena allocated data types, rather than fixing new and delete operators. Remove dead code. Change-Id: I5b433e722d2f75baacfacae4d32aef4a828bfe1b
* Add math routines with defined wrapping behavior for the interpreter.Ian Rogers2014-10-301-0/+1
| | | | | | | Add a RSUB_INT_LIT16 instruction alias to make instruction opcode switch statements easier to read. Change-Id: I3bac07c9518665abf0b05b5c3105a90be22f780a
* Compile time performance improvements focusing on interpret-only.Ian Rogers2014-09-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reduce virtual method dispatch in the method verifier and make more code inline-able. Add a StringPiece with const char* equality operator to avoid redundant StringPieces and strlens. Remove back link from register line to verifier and pass as argument to reduce size of RegisterLine. Remove instruction length from instruction flags and compute from the instruction, again to reduce size. Add suspend checks to resolve and verify to allow for more easy monitor inflation and reduce contention on Locks::thread_list_suspend_thread_lock_. Change ThrowEarlierClassFailure to throw pre-allocated exception. Avoid calls to Thread::Current() by passing self. Template specialize IsValidClassName. Make ANR reporting with SIGQUIT run using checkpoints rather than suspending all threads. This makes the stack/lock analysis less lock error prone. Extra Barrier assertions and condition variable time out is now returned as a boolean both from Barrier and ConditionVariable::Wait. 2 threaded host x86-64 interpret-only numbers from 341 samples: Before change: Avg 176.137ms 99% CI 3.468ms to 1060.770ms After change: Avg 139.163% 99% CI 3.027ms to 838.257ms Reduction in average compile time after change is 20.9%. Slow-down without change is 26.5%. Bug: 17471626 - Fix bug where RegTypeCache::JavaLangObject/String/Class/Throwable could return unresolved type when class loading is disabled. Bug: 17398101 Change-Id: Id59ce3cc520701c6ecf612f7152498107bc40684
* ART: Method verifier must check invoke-virtuals for non-zero argsAndreas Gampe2014-06-201-23/+26
| | | | | | | | Compiler checks rely on all instructions, not just reachable ones, so add two new verifier flags. Bug: 15755602 Change-Id: Ia9c2146cf82d94ce4d69fb6f7be6450137bb84bd
* Don't verify runtime only opcodes in the data-flow phase of verification.Ian Rogers2014-06-131-25/+31
| | | | | Bug: 15570344 Change-Id: I0304e8742a1d0318783ba72862e684ab91f63d0e
* ART: API to dex instructionsJean Christophe Beyler2014-05-221-7/+24
| | | | | | | | | | | | | | | | | | | | - Added the GetConstant function call in DecodedInstruction. - Added a few rewriter helper functions for later higher level rewriting. - Added Setter/Getter data and query functions. - Added Clobber memory/Const/Call/Cast data and query functions. - Added expression information (add, multiply, ...). - Added a IsLinear function for additions and subtractions. - Added an empty constructor for the DecodedInstruction: - Useful for the creation of a MIR constructor too. - Added the IsConditionalBranch utility function. Signed-off-by: Jean Christophe Beyler <jean.christophe.beyler@intel.com> Signed-off-by: Razvan A Lupusoru <razvan.a.lupusoru@intel.com> Signed-off-by: Yixin Shou <yixin.shou@intel.com> Signed-off-by: Chao-ying Fu <chao-ying.fu@intel.com> Signed-off-by: Udayan Banerji <udayan.banerji@intel.com> Change-Id: Ie21f2a7779b38c1b383334f04126c2d792cae462
* Move DecodedInstruction into MIR.Ian Rogers2014-05-021-22/+8
| | | | Change-Id: I188dc7fef4f4033361c78daf2015b869242191c6
* Workaround for range ops spanning vreg gapbuzbee2014-02-271-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Dalvik runtime model includes two stacks: an interpreted stack holding the Dalvik virtual registers, and a native stack used by the runtime system itself. The interpreted stack closely follows the Dalvik byte-code frame layout and invoke model, in which a callee's incoming argument are physically located in the out region of the caller's frame. Further, the non-argument vregs of a method are contiguous with its in argument region. The Art runtime model retains the notion of a callee's incoming arguments being physically located in the out region of a caller's frame. However, because Art uses a single-stack model, a method's incoming argument region is not contiguous with its non-argument virtual register storage. There is a gap between them that is used to store the native return PC of the caller, as well as the callee save register spill region. The Dalvik's bytecode instruction set includes several "range" format instructions (invoke-static-range, fill-array-data-range, etc.). These instructions define a contiguous range of virtual registers as arguments. Given the current Dalvik bytecode definition, there is no rule preventing an operand range from spanning the incoming argument and normal vregs. In Dalvik, this would not have been an issue. In Art, it adds complexity to correctly copy a range of arguments with a potential gap somewhere in the middle. We don't believe this is a common situation. This workaround CL ensures correct behavior by detecting the spanning case and falling back to the interpreter. If it turns out this is a more common case than expected, compiler support can be added. More likely, though, is that we will disallow spanning ranges in a future revision of the bytecode (going forward, existing range-spanning bytecode will continue to be supported). Fix for internal tracking bug 13216301 Fix for external bug https://code.google.com/p/android/issues/detail?id=66371 Change-Id: I9562aa5ab0aae8ebf333c8b72caac8a1be33ab3c
* Cleanup invoke in interpreter.Sebastien Hertz2013-09-301-1/+4
| | | | | | | | | | | | | | | | | | | | | | 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
* Optimize instruction data fetch in interpreter.Sebastien Hertz2013-09-181-34/+144
| | | | | | | | | | | | | | | | | The computed goto implementation prevents the compiler from detecting we are loading the first 16 bits of instruction twice: first one to get the opcode and second one to fetch first instruction's operand(s) like vA and vB. We now load the 16 bits into a local variable and decode opcode and operands from this variable. And do the same in the switch-based implementation for consistency. The performance improvement is 5% in average on benchmark applications suite. Also remove unused "Thread* self" parameter from DoIGetQuick and DoIPutQuick. Bug: 10703860 Change-Id: I83026ed6e78f642ac3dcdc6edbb6056fe012005f
* resolved conflicts for merge of 7934ac28 to dalvik-devBrian Carlstrom2013-07-261-2/+2
|\ | | | | | | Change-Id: I8798a6f154463d3f92f6aca62f14130aec82d273
| * Fix cpplint whitespace/comments issuesBrian Carlstrom2013-07-261-2/+2
| | | | | | | | Change-Id: Iae286862c85fb8fd8901eae1204cd6d271d69496
* | Merge "Avoid fetching instruction's first 16 bits twice." into dalvik-devSebastien Hertz2013-07-261-3/+1
|\ \ | |/ |/|
| * Avoid fetching instruction's first 16 bits twice.Sebastien Hertz2013-07-251-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The first instruction's 16 bits share the instruction's opcode and one or two operands (depending on the instruction format). In the main interpreter loop, we first load the first 16 bits of the instruction and keep only the low 8 bits of the opcode. Then we read the high 8 bits containing one 8-bits operand (vAA) or two 4-bits operands (vA and vB). But currently, the GCC compiler does not make the link with the opcode and reload the first 16 bits while a physical register already hold them. This CL updates the Instruction::Opcode to use the Instruction::Fetch method so the compiler makes the link between opcode and operand(s) and avoids loading twice in most of instruction handling sequences. Unfortunately, this does not fix all sequences and a few instructions remain with this redundant 16-bits load. Sounds like we may not have enough control to help the compiler do the right thing everytime. Change-Id: Id2b22747409fc5e9d9735e400ec6e1ab40d2ea68
* | am 02c8cc6d: Fixing cpplint whitespace/blank_line, whitespace/end_of_line, ↵Brian Carlstrom2013-07-191-1/+1
|\ \ | |/ |/| | | | | | | | | whitespace/labels, whitespace/semicolon issues * commit '02c8cc6d1312a2b55533f02f6369dc7c94672f90': Fixing cpplint whitespace/blank_line, whitespace/end_of_line, whitespace/labels, whitespace/semicolon issues
| * Fixing cpplint whitespace/blank_line, whitespace/end_of_line, ↵Brian Carlstrom2013-07-181-1/+1
| | | | | | | | | | | | whitespace/labels, whitespace/semicolon issues Change-Id: Ide4f8ea608338b3fed528de7582cfeb2011997b6
* | am 2ce745c0: Fix cpplint whitespace/braces issuesBrian Carlstrom2013-07-171-1/+1
|\ \ | |/ | | | | | | * commit '2ce745c06271d5223d57dbf08117b20d5b60694a': Fix cpplint whitespace/braces issues
| * Fix cpplint whitespace/braces issuesBrian Carlstrom2013-07-171-1/+1
| | | | | | | | Change-Id: Ide80939faf8e8690d8842dde8133902ac725ed1a
* | am fc0e3219: Fix multiple inclusion guards to match new pathnamesBrian Carlstrom2013-07-171-3/+3
|\ \ | |/ | | | | | | * commit 'fc0e3219edc9a5bf81b166e82fd5db2796eb6a0d': Fix multiple inclusion guards to match new pathnames
| * Fix multiple inclusion guards to match new pathnamesBrian Carlstrom2013-07-171-3/+3
| | | | | | | | Change-Id: Id7735be1d75bc315733b1773fba45c1deb8ace43
* | Support check-cast elision in DEX-to-DEX compiler.Sebastien Hertz2013-07-161-0/+6
| | | | | | | | | | | | | | | | Bug: 9648428 Replaces safe check-cast by 2 consecutive nop instructions. Change-Id: I2cd99c629a6a00a6e0effc853c3439bc92683d6d
* | resolved conflicts for merge of 7940e44f to dalvik-devBrian Carlstrom2013-07-121-0/+3
|/ | | | Change-Id: I6529b2fc27dfaedd2cb87b3697d049ccabed36ee
* Create separate Android.mk for main build targetsBrian Carlstrom2013-07-121-0/+446
The runtime, compiler, dex2oat, and oatdump now are in seperate trees to prevent dependency creep. They can now be individually built without rebuilding the rest of the art projects. dalvikvm and jdwpspy were already this way. Builds in the art directory should behave as before, building everything including tests. Change-Id: Ic6b1151e5ed0f823c3dd301afd2b13eb2d8feb81