diff options
Diffstat (limited to 'runtime/jdwp/jdwp_event.cc')
-rw-r--r-- | runtime/jdwp/jdwp_event.cc | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/runtime/jdwp/jdwp_event.cc b/runtime/jdwp/jdwp_event.cc index 427350e..9b3ea2e 100644 --- a/runtime/jdwp/jdwp_event.cc +++ b/runtime/jdwp/jdwp_event.cc @@ -163,11 +163,12 @@ JdwpError JdwpState::RegisterEvent(JdwpEvent* pEvent) { * If one or more "break"-type mods are used, register them with * the interpreter. */ + DeoptimizationRequest req; for (int i = 0; i < pEvent->modCount; i++) { const JdwpEventMod* pMod = &pEvent->mods[i]; if (pMod->modKind == MK_LOCATION_ONLY) { /* should only be for Breakpoint, Step, and Exception */ - Dbg::WatchLocation(&pMod->locationOnly.loc); + Dbg::WatchLocation(&pMod->locationOnly.loc, &req); } else if (pMod->modKind == MK_STEP) { /* should only be for EK_SINGLE_STEP; should only be one */ JdwpStepSize size = static_cast<JdwpStepSize>(pMod->step.size); @@ -181,6 +182,11 @@ JdwpError JdwpState::RegisterEvent(JdwpEvent* pEvent) { dumpEvent(pEvent); /* TODO - need for field watches */ } } + if (NeedsFullDeoptimization(pEvent->eventKind)) { + CHECK_EQ(req.kind, DeoptimizationRequest::kNothing); + CHECK(req.method == nullptr); + req.kind = DeoptimizationRequest::kFullDeoptimization; + } { /* @@ -193,19 +199,11 @@ JdwpError JdwpState::RegisterEvent(JdwpEvent* pEvent) { } event_list_ = pEvent; ++event_list_size_; - - /** - * Do we need to enable full deoptimization ? - */ - if (NeedsFullDeoptimization(pEvent->eventKind)) { - if (full_deoptimization_requests_ == 0) { - // This is the first event that needs full deoptimization: enable it. - Dbg::EnableFullDeoptimization(); - } - ++full_deoptimization_requests_; - } } + // TODO we can do better job here since we should process only one request: the one we just + // created. + Dbg::RequestDeoptimization(req); Dbg::ManageDeoptimization(); return ERR_NONE; @@ -238,31 +236,28 @@ void JdwpState::UnregisterEvent(JdwpEvent* pEvent) { /* * Unhook us from the interpreter, if necessary. */ + DeoptimizationRequest req; for (int i = 0; i < pEvent->modCount; i++) { JdwpEventMod* pMod = &pEvent->mods[i]; if (pMod->modKind == MK_LOCATION_ONLY) { /* should only be for Breakpoint, Step, and Exception */ - Dbg::UnwatchLocation(&pMod->locationOnly.loc); + Dbg::UnwatchLocation(&pMod->locationOnly.loc, &req); } if (pMod->modKind == MK_STEP) { /* should only be for EK_SINGLE_STEP; should only be one */ Dbg::UnconfigureStep(pMod->step.threadId); } } + if (NeedsFullDeoptimization(pEvent->eventKind)) { + CHECK_EQ(req.kind, DeoptimizationRequest::kNothing); + CHECK(req.method == nullptr); + req.kind = DeoptimizationRequest::kFullUndeoptimization; + } --event_list_size_; CHECK(event_list_size_ != 0 || event_list_ == NULL); - /** - * Can we disable full deoptimization ? - */ - if (NeedsFullDeoptimization(pEvent->eventKind)) { - --full_deoptimization_requests_; - if (full_deoptimization_requests_ == 0) { - // We no longer need full deoptimization. - Dbg::DisableFullDeoptimization(); - } - } + Dbg::RequestDeoptimization(req); } /* |