summaryrefslogtreecommitdiffstats
path: root/runtime/jdwp
diff options
context:
space:
mode:
authorSebastien Hertz <shertz@google.com>2014-09-01 17:07:11 +0200
committerSebastien Hertz <shertz@google.com>2014-09-22 11:29:36 +0200
commit8009f39c6d63181a6cd0e348ce732997dbdf3d20 (patch)
treeff02473e6b0951364234a6038ae19a0875b7bdd7 /runtime/jdwp
parent5cdd0734d2f79eedc530f5f1e876cd2110e29c86 (diff)
downloadart-8009f39c6d63181a6cd0e348ce732997dbdf3d20.tar.gz
art-8009f39c6d63181a6cd0e348ce732997dbdf3d20.tar.bz2
art-8009f39c6d63181a6cd0e348ce732997dbdf3d20.zip
Optimize JDWP stack local values access
The StackFrame.GetValues and StackFrame.SetValues JDWP commands can refer to multiple variables at the same time in a given frame. However we used to walk the stack until getting to the requested frame for each variable. Now, we walk the stack only once until getting to the frame so the context is initialized. Then we read/write value for each variable from this context. Bug: 17343501 Bug: 15680615 Change-Id: I2a4128f29a3c5856b994e280037c0a09eb48c5c8
Diffstat (limited to 'runtime/jdwp')
-rw-r--r--runtime/jdwp/jdwp_handler.cc40
1 files changed, 2 insertions, 38 deletions
diff --git a/runtime/jdwp/jdwp_handler.cc b/runtime/jdwp/jdwp_handler.cc
index e0a83f607b..16a774fdf0 100644
--- a/runtime/jdwp/jdwp_handler.cc
+++ b/runtime/jdwp/jdwp_handler.cc
@@ -1385,26 +1385,7 @@ static JdwpError ER_Clear(JdwpState* state, Request* request, ExpandBuf*)
*/
static JdwpError SF_GetValues(JdwpState*, Request* request, ExpandBuf* pReply)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- ObjectId thread_id = request->ReadThreadId();
- FrameId frame_id = request->ReadFrameId();
- int32_t slot_count = request->ReadSigned32("slot count");
-
- expandBufAdd4BE(pReply, slot_count); /* "int values" */
- for (int32_t i = 0; i < slot_count; ++i) {
- uint32_t slot = request->ReadUnsigned32("slot");
- JDWP::JdwpTag reqSigByte = request->ReadTag();
-
- VLOG(jdwp) << " --> slot " << slot << " " << reqSigByte;
-
- size_t width = Dbg::GetTagWidth(reqSigByte);
- uint8_t* ptr = expandBufAddSpace(pReply, width+1);
- JdwpError error = Dbg::GetLocalValue(thread_id, frame_id, slot, reqSigByte, ptr, width);
- if (error != ERR_NONE) {
- return error;
- }
- }
-
- return ERR_NONE;
+ return Dbg::GetLocalValues(request, pReply);
}
/*
@@ -1412,24 +1393,7 @@ static JdwpError SF_GetValues(JdwpState*, Request* request, ExpandBuf* pReply)
*/
static JdwpError SF_SetValues(JdwpState*, Request* request, ExpandBuf*)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- ObjectId thread_id = request->ReadThreadId();
- FrameId frame_id = request->ReadFrameId();
- int32_t slot_count = request->ReadSigned32("slot count");
-
- for (int32_t i = 0; i < slot_count; ++i) {
- uint32_t slot = request->ReadUnsigned32("slot");
- JDWP::JdwpTag sigByte = request->ReadTag();
- size_t width = Dbg::GetTagWidth(sigByte);
- uint64_t value = request->ReadValue(width);
-
- VLOG(jdwp) << " --> slot " << slot << " " << sigByte << " " << value;
- JdwpError error = Dbg::SetLocalValue(thread_id, frame_id, slot, sigByte, value, width);
- if (error != ERR_NONE) {
- return error;
- }
- }
-
- return ERR_NONE;
+ return Dbg::SetLocalValues(request);
}
static JdwpError SF_ThisObject(JdwpState*, Request* request, ExpandBuf* reply)