mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-04-25 17:25:17 +02:00
GP-6545 Switch to using deque for PcodeCacher::issued
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<PcodeData> issued; ///< P-code ops issued for the current instruction
|
||||
deque<PcodeData> issued; ///< P-code ops issued for the current instruction
|
||||
list<RelativeRecord> label_refs; ///< References to labels
|
||||
vector<uintb> labels; ///< Locations of labels
|
||||
VarnodeData *expandPool(uint4 size); ///< Expand the memory pool
|
||||
|
||||
Reference in New Issue
Block a user