From 4a9b40c453ad0fa71a4d9adda44cc7917affe118 Mon Sep 17 00:00:00 2001 From: caheckman <48068198+caheckman@users.noreply.github.com> Date: Mon, 9 Mar 2026 21:34:46 +0000 Subject: [PATCH] GP-6545 Switch to using deque for PcodeCacher::issued --- .../Features/Decompiler/src/decompile/cpp/error.hh | 6 ++++-- .../Features/Decompiler/src/decompile/cpp/sleigh.cc | 12 ++++++------ .../Features/Decompiler/src/decompile/cpp/sleigh.hh | 8 ++++---- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/error.hh b/Ghidra/Features/Decompiler/src/decompile/cpp/error.hh index 02fbc9964c..f61227fef0 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/error.hh +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/error.hh @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -40,6 +41,7 @@ using std::map; using std::set; using std::list; using std::vector; +using std::deque; using std::pair; using std::make_pair; using std::ostream; diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh.cc index 4a6b0090a6..320416f746 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh.cc +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh.cc @@ -55,16 +55,16 @@ VarnodeData *PcodeCacher::expandPool(uint4 size) for(uint4 i=0;i::iterator diter=issued.begin();diter!=issued.end();++diter) { + VarnodeData *outvar = (*diter).outvar; if (outvar != (VarnodeData *)0) { outvar = newpool + (outvar - poolstart); - issued[i].outvar = outvar; + (*diter).outvar = outvar; } - VarnodeData *invar = issued[i].invar; + VarnodeData *invar = (*diter).invar; if (invar != (VarnodeData *)0) { invar = newpool + (invar - poolstart); - issued[i].invar = invar; + (*diter).invar = invar; } } list::iterator iter; @@ -139,7 +139,7 @@ void PcodeCacher::resolveRelatives(void) void PcodeCacher::emit(const Address &addr,PcodeEmit *emt) const { - vector::const_iterator iter; + deque::const_iterator iter; for(iter=issued.begin();iter!=issued.end();++iter) emt->dump(addr,(*iter).opc,(*iter).outvar,(*iter).invar,(*iter).isize); diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh.hh b/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh.hh index 32ef8565ef..5b82741664 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh.hh +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh.hh @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -42,9 +42,9 @@ struct RelativeRecord { /// /// Raw data used by the emitter to produce a single PcodeOp struct PcodeData { - OpCode opc; ///< The op code VarnodeData *outvar; ///< Output Varnode data (or null) VarnodeData *invar; ///< Array of input Varnode data + OpCode opc; ///< The op code int4 isize; ///< Number of input Varnodes }; @@ -59,7 +59,7 @@ class PcodeCacher { VarnodeData *poolstart; ///< Start of the pool of VarnodeData objects VarnodeData *curpool; ///< First unused VarnodeData VarnodeData *endpool; ///< End of the pool of VarnodeData objects - vector issued; ///< P-code ops issued for the current instruction + deque issued; ///< P-code ops issued for the current instruction list label_refs; ///< References to labels vector labels; ///< Locations of labels VarnodeData *expandPool(uint4 size); ///< Expand the memory pool