fixes for a number of ZAM optimization bugs

This commit is contained in:
Vern Paxson 2023-11-05 16:26:38 -08:00 committed by Arne Welzel
parent 9bfe18473d
commit 1dc74eaa9c
11 changed files with 44 additions and 28 deletions

View file

@ -194,8 +194,12 @@ void ZBody::SetInsts(vector<ZInstI*>& instsI) {
for ( auto i = 0U; i < end_pc; ++i ) {
auto& iI = *instsI[i];
insts_copy[i] = iI;
if ( iI.stmt )
insts_copy[i].loc = iI.stmt->Original()->GetLocationInfo();
if ( iI.stmt ) {
auto l = iI.stmt->Original()->GetLocationInfo();
if ( l != &no_location )
insts_copy[i].loc = std::make_shared<Location>(util::copy_string(l->filename), l->first_line,
l->last_line, l->first_column, l->last_column);
}
}
insts = insts_copy;
@ -358,7 +362,8 @@ void ZBody::ProfileExecution() const {
}
}
bool ZBody::CheckAnyType(const TypePtr& any_type, const TypePtr& expected_type, const Location* loc) const {
bool ZBody::CheckAnyType(const TypePtr& any_type, const TypePtr& expected_type,
const std::shared_ptr<Location>& loc) const {
if ( IsAny(expected_type) )
return true;
@ -377,7 +382,7 @@ bool ZBody::CheckAnyType(const TypePtr& any_type, const TypePtr& expected_type,
char buf[8192];
snprintf(buf, sizeof buf, "run-time type clash (%s/%s)", type_name(at), type_name(et));
reporter->RuntimeError(loc, "%s", buf);
reporter->RuntimeError(loc.get(), "%s", buf);
return false;
}