diff options
-rw-r--r-- | runtime/interpreter/interpreter.cc | 2 | ||||
-rw-r--r-- | runtime/quick_exception_handler.cc | 3 | ||||
-rw-r--r-- | runtime/stack.h | 10 | ||||
-rw-r--r-- | runtime/trace.h | 2 |
4 files changed, 12 insertions, 5 deletions
diff --git a/runtime/interpreter/interpreter.cc b/runtime/interpreter/interpreter.cc index 423b9520c9..a37aee5f9b 100644 --- a/runtime/interpreter/interpreter.cc +++ b/runtime/interpreter/interpreter.cc @@ -423,7 +423,7 @@ void EnterInterpreterFromDeoptimize(Thread* self, ShadowFrame* shadow_frame, JVa } ShadowFrame* old_frame = shadow_frame; shadow_frame = shadow_frame->GetLink(); - delete old_frame; + ShadowFrame::DeleteDeoptimizedFrame(old_frame); } ret_val->SetJ(value.GetJ()); } diff --git a/runtime/quick_exception_handler.cc b/runtime/quick_exception_handler.cc index 243260345e..a80eed6073 100644 --- a/runtime/quick_exception_handler.cc +++ b/runtime/quick_exception_handler.cc @@ -202,7 +202,8 @@ class DeoptimizeStackVisitor FINAL : public StackVisitor { h_method, m->GetAccessFlags(), true, true, true, true); bool verifier_success = verifier.Verify(); CHECK(verifier_success) << PrettyMethod(h_method.Get()); - ShadowFrame* new_frame = ShadowFrame::Create(num_regs, nullptr, h_method.Get(), dex_pc); + ShadowFrame* new_frame = ShadowFrame::CreateDeoptimizedFrame( + num_regs, nullptr, h_method.Get(), dex_pc); self_->SetShadowFrameUnderConstruction(new_frame); const std::vector<int32_t> kinds(verifier.DescribeVRegs(dex_pc)); diff --git a/runtime/stack.h b/runtime/stack.h index e2af5eefd2..3f1bff8b9c 100644 --- a/runtime/stack.h +++ b/runtime/stack.h @@ -74,12 +74,18 @@ class ShadowFrame { } // Create ShadowFrame in heap for deoptimization. - static ShadowFrame* Create(uint32_t num_vregs, ShadowFrame* link, - mirror::ArtMethod* method, uint32_t dex_pc) { + static ShadowFrame* CreateDeoptimizedFrame(uint32_t num_vregs, ShadowFrame* link, + mirror::ArtMethod* method, uint32_t dex_pc) { uint8_t* memory = new uint8_t[ComputeSize(num_vregs)]; return Create(num_vregs, link, method, dex_pc, memory); } + // Delete a ShadowFrame allocated on the heap for deoptimization. + static void DeleteDeoptimizedFrame(ShadowFrame* sf) { + uint8_t* memory = reinterpret_cast<uint8_t*>(sf); + delete[] memory; + } + // Create ShadowFrame for interpreter using provided memory. static ShadowFrame* Create(uint32_t num_vregs, ShadowFrame* link, mirror::ArtMethod* method, uint32_t dex_pc, void* memory) { diff --git a/runtime/trace.h b/runtime/trace.h index 06824b8be8..df6d5e7b71 100644 --- a/runtime/trace.h +++ b/runtime/trace.h @@ -189,7 +189,7 @@ class Trace FINAL : public instrumentation::InstrumentationListener { std::unique_ptr<File> trace_file_; // Buffer to store trace data. - std::unique_ptr<uint8_t> buf_; + std::unique_ptr<uint8_t[]> buf_; // Flags enabling extra tracing of things such as alloc counts. const int flags_; |