mirror of
https://github.com/zeek/zeek.git
synced 2025-10-15 13:08:20 +00:00
fixes for a number of ZAM optimization bugs
This commit is contained in:
parent
9bfe18473d
commit
1dc74eaa9c
11 changed files with 44 additions and 28 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue