Ghidra is a software reverse engineering (SRE) framework
GP-6545 Switch to using deque for PcodeCacher::issued
caheckman4a9b40c453ad
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/error.hh b/Ghidra/Features/Decompiler/src/decompile/cpp/error.hhindex 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 <set>#include <list>#include <vector>+#include <deque>#include <algorithm>#include <cstring>#include <cctype>@@ -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.ccindex 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<cursize;++i)newpool[i] = poolstart[i]; // Copy old data// Update references to the old pool- for(uint4 i=0;i<issued.size();++i) {- VarnodeData *outvar = issued[i].outvar;+ for(deque<PcodeData>::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<RelativeRecord>::iterator iter;@@ -139,7 +139,7 @@ void PcodeCacher::resolveRelatives(void)void PcodeCacher::emit(const Address &addr,PcodeEmit *emt) const{- vector<PcodeData>::const_iterator iter;+ deque<PcodeData>::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.hhindex 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 PcodeOpstruct PcodeData {- OpCode opc; ///< The op codeVarnodeData *outvar; ///< Output Varnode data (or null)VarnodeData *invar; ///< Array of input Varnode data+ OpCode opc; ///< The op codeint4 isize; ///< Number of input Varnodes};@@ -59,7 +59,7 @@ class PcodeCacher {VarnodeData *poolstart; ///< Start of the pool of VarnodeData objectsVarnodeData *curpool; ///< First unused VarnodeDataVarnodeData *endpool; ///< End of the pool of VarnodeData objects- vector<PcodeData> issued; ///< P-code ops issued for the current instruction+ deque<PcodeData> issued; ///< P-code ops issued for the current instructionlist<RelativeRecord> label_refs; ///< References to labelsvector<uintb> labels; ///< Locations of labelsVarnodeData *expandPool(uint4 size); ///< Expand the memory pool