Skip to content

Exception edges for live range analysis master #466

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/java_bytecode/java_local_variable_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ struct procedure_local_cfg_baset<

void operator()(const method_with_amapt& args)
{
const auto &method=args.first;
const auto& amap=args.second;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const auto &amap

for(const auto& inst : amap)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const auto &inst

{
Expand All @@ -47,6 +48,29 @@ struct procedure_local_cfg_baset<
}
// Add edges declared in the exception table, which don't figure
// in the address map successors/predecessors as yet.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this comment refer to, as it's at the end of a block?

for(const auto& table_entry : method.exception_table)
{
auto findit=amap.find(table_entry.start_pc);
assert(findit!=amap.end() &&
"Exception table entry doesn't point to an instruction?");
for(; findit->first<table_entry.end_pc; ++findit)
{
// For now just assume any non-branch
// instruction could potentially throw.
auto succit=findit;
++succit;
if(succit==amap.end())
continue;
const auto& thisinst=findit->second;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit picking: "&" goes with "thisinst"

if(thisinst.successors.size()==1 &&
*thisinst.successors.begin()==succit->first)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use thisinst.successors.front() instead of *...begin() ? (But maybe I'm considering the wrong container type.)

{
this->add_edge(
entry_map.at(findit->first),
entry_map.at(table_entry.handler_pc));
}
}
}
}

unsigned get_first_node(const method_with_amapt& args) const
Expand Down