summaryrefslogtreecommitdiff
path: root/src/compiler_llvm/compiler_llvm.cc
diff options
context:
space:
mode:
author buzbee <buzbee@google.com> 2012-02-04 08:50:53 -0800
committer buzbee <buzbee@google.com> 2012-02-07 18:19:52 -0800
commit44b412bb795fa6999129b2bc16f5eec1ea97e8f8 (patch)
treebf2a45463f46c506130f319b1a176b49db4d5252 /src/compiler_llvm/compiler_llvm.cc
parent959f8ed11ef9493a89b90a1f9a82a811dbc7ae0e (diff)
Codegen support for debugger
Add the ability to generate code with support for debugging. This involves generating a callout to an equivalent of the old "updateDebugger()" before each Dalvik opcode, method entry and method exit. The added code is fairly compact - 8 bytes per Dalvik opcode, plus 4 additional bytes per safe point. I dislike the idea of always making this call, so I'm reusing the dedicated register rSUSPEND to hold the address of the callout. rSUSPEND is normally used to reduce the frequency of full suspend checks, but when debugging this isn't necessary - allowing us to resuse this register to hold the address of the callout. If it is non-null we make the callout, otherwise we continue. I refresh this register from a slot in the Thread structure on method entry and also following the return of taken suspend checks. In this way, the debugger has the ability to control updates on a per-thread basis, and the performance penalty is greatly reduced for threads that don't have any pending debugger requests. Once the debugger attaches, it would suspend all threads, walk through the thread list, set thread->pUpdateDebuggerFromCode to art_update_debugger and then turn everything loose. One thing I'm not doing, though, is debugger updates before and after calls to native methods. This is something that will have to be done by the stubs, because I don't know which invokes are native. Oh, and there will also need to be an artUpdateDebugger call on the exception path. I'm passing the DalvikPC to the stub, and am using special codes (-1 and -2) to denote method entry and exit. The stub recovers the current Method* and Thread* and passes them on to artUpdateDebugger(). When we're compiling in this special mode, all optimizations which might result in code motion or suppressed load/store of a Dalvik register are turned off. No register promotion is done, so everything will be in its home location. Change-Id: Iaf66f4d0d094a1699269d0a1ad1ed33e7613aef8
Diffstat (limited to 'src/compiler_llvm/compiler_llvm.cc')
0 files changed, 0 insertions, 0 deletions