Skip to content
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

minor improvements to ExceptionalUnitGraph and ThrowableSet #1667

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

tim-hoffman
Copy link
Member

No description provided.

@@ -322,8 +325,8 @@ protected void initialize(ThrowAnalysis throwAnalysis, boolean omitExceptingUnit
* @return a <code>Map</code> which whose contents are equivalent to the input <code>map</code>, plus the information that
* <code>u</code> throws <code>caught</code> to <code>t</code>.
*/
private Map<Unit, Collection<ExceptionDest>> addDestToMap(Map<Unit, Collection<ExceptionDest>> map, Unit u, Trap t,
ThrowableSet caught) {
protected Map<Unit, Collection<ExceptionDest>> addDestToMap(Map<Unit, Collection<ExceptionDest>> map, Unit u,
Copy link
Member Author

Choose a reason for hiding this comment

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

Make it protected to allow a subclass to use and/or override it.

@@ -667,8 +670,6 @@ private void buildHeadsAndTails(Set<Unit> additionalHeads) {
Collection<ExceptionDest> result = unitToExceptionDests.get(u);
if (result == null) {
ExceptionDest e = new ExceptionDest(null, null) {
private ThrowableSet throwables;
Copy link
Member Author

Choose a reason for hiding this comment

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

ExceptionDest already defines this field, it was just private so it was not accessible. So I removed the private from that field and remove this field so there would be no duplication.

@@ -255,47 +255,50 @@ protected void initialize(ThrowAnalysis throwAnalysis, boolean omitExceptingUnit
* extending <code>ExceptionalUnitGraph</code>. If a <code>Unit</code> throws one or more exceptions which are
* caught within the method, it will be mapped to a <code>Collection</code> of <code>ExceptionDest</code>s
* describing the sets of exceptions that the <code>Unit</code> might throw to each {@link Trap}. But if all of a
* <code>Unit</code>'s exceptions escape the method, it will be mapped to <code>null</code, rather than to a
* <code>Unit</code>'s exceptions escape the method, it will be mapped to <code>null</code>, rather than to a
* <code>Collection</code> containing a single <code>ExceptionDest</code> with a <code>null</code> trap. (The
* special case for <code>Unit</code>s with no caught exceptions allows <code>buildExceptionDests()</code> to
* ignore completely <code>Unit</code>s which are outside the scope of all <code>Trap</code>s.)
* </p>
*/
protected Map<Unit, Collection<ExceptionDest>> buildExceptionDests(ThrowAnalysis throwAnalysis) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Restructured this method a bit to avoid unnecessary work when body.getTraps() is empty and to avoid obtaining ThrowableSet.Manager.v().EMPTY repeatedly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant