fixes & enhancements to location information associated w/ AST nodes & ZAM optimization

This commit is contained in:
Vern Paxson 2024-01-25 13:11:56 -08:00 committed by Arne Welzel
parent 7a283afe00
commit e5bb63c662
14 changed files with 299 additions and 259 deletions

View file

@ -144,17 +144,6 @@ public:
// hook body.
virtual bool CouldReturn(bool ignore_break) const { return false; }
// Access to the original statement from which this one is derived,
// or this one if we don't have an original. Returns a bare pointer
// rather than a StmtPtr to emphasize that the access is read-only.
const Stmt* Original() const { return original ? original->Original() : this; }
// Designate the given Stmt node as the original for this one.
void SetOriginal(StmtPtr _orig) {
if ( ! original )
original = std::move(_orig);
}
// A convenience function for taking a newly-created Stmt,
// making it point to us as the successor, and returning it.
//
@ -163,17 +152,10 @@ public:
// call, as a convenient side effect, transforms that bare pointer
// into a StmtPtr.
virtual StmtPtr SetSucc(Stmt* succ) {
succ->SetOriginal(ThisPtr());
succ->SetLocationInfo(GetLocationInfo());
return {AdoptRef{}, succ};
}
const detail::Location* GetLocationInfo() const override {
if ( original )
return original->GetLocationInfo();
else
return Obj::GetLocationInfo();
}
// Access script optimization information associated with
// this statement.
StmtOptInfo* GetOptInfo() const { return opt_info; }
@ -202,11 +184,6 @@ protected:
mutable double last_access; // time of last execution
mutable uint32_t access_count; // number of executions
// The original statement from which this statement was
// derived, if any. Used as an aid for generating meaningful
// and correctly-localized error messages.
StmtPtr original = nullptr;
// Information associated with the Stmt for purposes of
// script optimization.
StmtOptInfo* opt_info;