mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
Use an index instead of pointers into the vector. If the vector resizes, then
the pointer values could be invalid. llvm-svn: 95813
This commit is contained in:
parent
99090c9fe0
commit
b288ec36ae
@ -407,20 +407,22 @@ ComputeActionsTable(const SmallVectorImpl<const LandingPadInfo*> &LandingPads,
|
|||||||
|
|
||||||
if (NumShared < TypeIds.size()) {
|
if (NumShared < TypeIds.size()) {
|
||||||
unsigned SizeAction = 0;
|
unsigned SizeAction = 0;
|
||||||
ActionEntry *PrevAction = 0;
|
unsigned PrevAction = (unsigned)-1;
|
||||||
|
|
||||||
if (NumShared) {
|
if (NumShared) {
|
||||||
const unsigned SizePrevIds = PrevLPI->TypeIds.size();
|
const unsigned SizePrevIds = PrevLPI->TypeIds.size();
|
||||||
assert(Actions.size());
|
assert(Actions.size());
|
||||||
PrevAction = &Actions.back();
|
PrevAction = Actions.size() - 1;
|
||||||
SizeAction = MCAsmInfo::getSLEB128Size(PrevAction->NextAction) +
|
SizeAction =
|
||||||
MCAsmInfo::getSLEB128Size(PrevAction->ValueForTypeID);
|
MCAsmInfo::getSLEB128Size(Actions[PrevAction].NextAction) +
|
||||||
|
MCAsmInfo::getSLEB128Size(Actions[PrevAction].ValueForTypeID);
|
||||||
|
|
||||||
for (unsigned j = NumShared; j != SizePrevIds; ++j) {
|
for (unsigned j = NumShared; j != SizePrevIds; ++j) {
|
||||||
|
assert(PrevAction != (unsigned)-1 && "PrevAction is invalid!");
|
||||||
SizeAction -=
|
SizeAction -=
|
||||||
MCAsmInfo::getSLEB128Size(PrevAction->ValueForTypeID);
|
MCAsmInfo::getSLEB128Size(Actions[PrevAction].ValueForTypeID);
|
||||||
SizeAction += -PrevAction->NextAction;
|
SizeAction += -Actions[PrevAction].NextAction;
|
||||||
PrevAction = PrevAction->Previous;
|
PrevAction = Actions[PrevAction].Previous;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -437,7 +439,7 @@ ComputeActionsTable(const SmallVectorImpl<const LandingPadInfo*> &LandingPads,
|
|||||||
|
|
||||||
ActionEntry Action = { ValueForTypeID, NextAction, PrevAction };
|
ActionEntry Action = { ValueForTypeID, NextAction, PrevAction };
|
||||||
Actions.push_back(Action);
|
Actions.push_back(Action);
|
||||||
PrevAction = &Actions.back();
|
PrevAction = Actions.size() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Record the first action of the landing pad site.
|
// Record the first action of the landing pad site.
|
||||||
@ -447,7 +449,7 @@ ComputeActionsTable(const SmallVectorImpl<const LandingPadInfo*> &LandingPads,
|
|||||||
// Information used when created the call-site table. The action record
|
// Information used when created the call-site table. The action record
|
||||||
// field of the call site record is the offset of the first associated
|
// field of the call site record is the offset of the first associated
|
||||||
// action record, relative to the start of the actions table. This value is
|
// action record, relative to the start of the actions table. This value is
|
||||||
// biased by 1 (1 in dicating the start of the actions table), and 0
|
// biased by 1 (1 indicating the start of the actions table), and 0
|
||||||
// indicates that there are no actions.
|
// indicates that there are no actions.
|
||||||
FirstActions.push_back(FirstAction);
|
FirstActions.push_back(FirstAction);
|
||||||
|
|
||||||
@ -648,8 +650,7 @@ void DwarfException::EmitExceptionTable() {
|
|||||||
// landing pad site.
|
// landing pad site.
|
||||||
SmallVector<ActionEntry, 32> Actions;
|
SmallVector<ActionEntry, 32> Actions;
|
||||||
SmallVector<unsigned, 64> FirstActions;
|
SmallVector<unsigned, 64> FirstActions;
|
||||||
unsigned SizeActions = ComputeActionsTable(LandingPads, Actions,
|
unsigned SizeActions=ComputeActionsTable(LandingPads, Actions, FirstActions);
|
||||||
FirstActions);
|
|
||||||
|
|
||||||
// Invokes and nounwind calls have entries in PadMap (due to being bracketed
|
// Invokes and nounwind calls have entries in PadMap (due to being bracketed
|
||||||
// by try-range labels when lowered). Ordinary calls do not, so appropriate
|
// by try-range labels when lowered). Ordinary calls do not, so appropriate
|
||||||
|
@ -135,7 +135,7 @@ class DwarfException : public DwarfPrinter {
|
|||||||
struct ActionEntry {
|
struct ActionEntry {
|
||||||
int ValueForTypeID; // The value to write - may not be equal to the type id.
|
int ValueForTypeID; // The value to write - may not be equal to the type id.
|
||||||
int NextAction;
|
int NextAction;
|
||||||
struct ActionEntry *Previous;
|
unsigned Previous;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// CallSiteEntry - Structure describing an entry in the call-site table.
|
/// CallSiteEntry - Structure describing an entry in the call-site table.
|
||||||
|
Loading…
Reference in New Issue
Block a user