Skip to content

Conversation

@mayanje
Copy link
Contributor

@mayanje mayanje commented Aug 11, 2021

What have been done
All Mutli Branch Context information or accessible by an interface IMultiBranchContext from a BasicBlock.

@mayanje mayanje added this to the CobolEditor milestone Aug 11, 2021
@mayanje mayanje self-assigned this Aug 11, 2021
@trafico-bot trafico-bot bot added the 🔍 Ready for Review Pull Request is not reviewed yet label Aug 11, 2021
@fm-117 fm-117 self-requested a review September 1, 2021 13:57
private class CfgAfterIterativePerformProcedureTransformer : ICfgTransform<Node, D>
{
private HashSet<BasicBlockForNodeGroup> _visitedGroups;
private ControlFlowGraphBuilder<D> Builder;
Copy link
Contributor

Choose a reason for hiding this comment

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

naming _builder ?
Edit: not required, see my other remarks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in 96ffab5

Copy link
Contributor

Choose a reason for hiding this comment

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

The new field _cfg is not used (as the graph is already available through the callback arguments). Please remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in 0067e69

Comment on lines 61 to 67
BasicBlock<Node, D> IMultiBranchContext<Node, D>.OriginBlock => this.OriginBlock;

BasicBlock<Node, D> IMultiBranchContext<Node, D>.RootBlock => this.RootBlock;

IList<BasicBlock<Node, D>> IMultiBranchContext<Node, D>.Branches => this.Branches;

IList<int> IMultiBranchContext<Node, D>.BranchIndices => this.BranchIndices;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the explicit interface implementation ? You can publicly implement the getter and keep the setter internal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

MultiBranchContext is an internal class of ControlFlowGraphBuilder, so public members are accesed via a public interface IMultiBranchContext<Node, D>, explicit interface are use to pubish public attribute that are declared with an internal type or an embedded type.

Copy link
Contributor

Choose a reason for hiding this comment

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

But why mix both implementation styles then ? Some of the properties are publicly implemented and those 4 are treated differently. To summarize my view on this:

  • do not create the interface type, it is not relevant
  • make MultiBranchContext public
  • check and change visbility for members: make members that should be accesible from outside public and everything else should be internal

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok as seen together, this is a trick to avoid exposing the BasicBlockForNode class, so we can keep it like that except for the last one which can easily be converted into public implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in 0067e69

/// <param name="branchToNext">True if the CurrentBlock must be linked to the next branch also, false otherwise</param>
/// <param name="nextBlock">The next block for all branches</param>
internal void End(bool branchToNext, BasicBlockForNode nextBlock)
internal void End(ControlFlowGraphBuilder<D> builder, bool branchToNext, BasicBlockForNode nextBlock)
Copy link
Contributor

Choose a reason for hiding this comment

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

In fact, the builder is not required in the successive calls. We need the graph but not the builder. So change the different usages, replacing builder by graph and this also will allow to remove the Builder field in CfgAfterIterativePerformProcedureTransformer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in 96ffab5

Copy link
Contributor

Choose a reason for hiding this comment

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

You kept the builder arg here. I checked the whole class again, it does not need the builder, only the graph.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry done in ed54134

@trafico-bot trafico-bot bot added ⚠️ Changes requested Pull Request needs changes before it can be reviewed again and removed 🔍 Ready for Review Pull Request is not reviewed yet labels Sep 1, 2021
@fm-117 fm-117 requested review from delevoye and fm-117 September 3, 2021 12:28
@trafico-bot trafico-bot bot added 🔍 Ready for Review Pull Request is not reviewed yet and removed ⚠️ Changes requested Pull Request needs changes before it can be reviewed again labels Sep 11, 2021
cfg.SuccessorEdges.Add(iterativeGroup.Group.First.Value);
block.SuccessorEdges.Add(entranceEdge);
System.Diagnostics.Debug.Assert(block.Context == null);
//If the assert above fails (it should not be case), then it will be necessay to exeute the commented code bellow.
Copy link
Contributor

Choose a reason for hiding this comment

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

typos: If the assert above fails (it should not be the case), then it will be necessary to execute the commented code below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in 0067e69

Comment on lines 61 to 67
BasicBlock<Node, D> IMultiBranchContext<Node, D>.OriginBlock => this.OriginBlock;

BasicBlock<Node, D> IMultiBranchContext<Node, D>.RootBlock => this.RootBlock;

IList<BasicBlock<Node, D>> IMultiBranchContext<Node, D>.Branches => this.Branches;

IList<int> IMultiBranchContext<Node, D>.BranchIndices => this.BranchIndices;
Copy link
Contributor

Choose a reason for hiding this comment

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

But why mix both implementation styles then ? Some of the properties are publicly implemented and those 4 are treated differently. To summarize my view on this:

  • do not create the interface type, it is not relevant
  • make MultiBranchContext public
  • check and change visbility for members: make members that should be accesible from outside public and everything else should be internal

@mayanje mayanje requested a review from fm-117 September 22, 2021 11:40
@trafico-bot trafico-bot bot removed the 🔍 Ready for Review Pull Request is not reviewed yet label Sep 24, 2021
@mayanje mayanje merged commit 387663b into develop Sep 24, 2021
@trafico-bot trafico-bot bot added the ✨ Merged Pull Request has been merged successfully label Sep 24, 2021
@mayanje mayanje deleted the 2022_AbstractIntMultiBranchContext branch October 7, 2021 11:50
@mayanje mayanje mentioned this pull request Oct 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DataFlow ✨ Merged Pull Request has been merged successfully

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants