Skip to content

Comments

WI #2022 Put Block Relocation info in the Context#2042

Closed
mayanje wants to merge 3 commits intodevelopfrom
2022_AbstractIntMultiBranchContext
Closed

WI #2022 Put Block Relocation info in the Context#2042
mayanje wants to merge 3 commits intodevelopfrom
2022_AbstractIntMultiBranchContext

Conversation

@mayanje
Copy link
Contributor

@mayanje mayanje commented Oct 7, 2021

No description provided.

@mayanje mayanje self-assigned this Oct 7, 2021
@trafico-bot trafico-bot bot added the 🔍 Ready for Review Pull Request is not reviewed yet label Oct 7, 2021
@mayanje mayanje added this to the v1.6 milestone Oct 7, 2021
@mayanje mayanje requested a review from fm-117 October 8, 2021 08:42
@smedilol smedilol self-requested a review October 8, 2021 09:07
/// </summary>
public IList<IMultiBranchContext<Node, D>> SubContexts { get; internal set; }
/// <summary>
/// The Iso Cloned RElocated BlockNode Map: Map Original Block Index to their Cloned and relocated Block Index, for instance block of
Copy link
Contributor

Choose a reason for hiding this comment

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

typo: Relocated

/// The Iso Cloned RElocated BlockNode Map: Map Original Block Index to their Cloned and relocated Block Index, for instance block of
/// target Paragraph cloned and relocated for a PERFORM instruction target.
/// </summary>
internal IDictionary<int, int> IsoClonedRelocatedMap { get; set; }
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 word 'Iso' ? The name ClonedBlocksIndexMap used in the builder is clearer.

}

/// <summary>
/// <inheritdoc/>
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not familiar with<inheritdoc/> but it seems it is meant to replace the whole <summary> block. Also it is useful when generating the doc but doesn't help here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines 230 to 240
public int GetRelocatedBlockIndex(int initialIndex)
{
if (this.IsoClonedRelocatedMap != null)
{
if (this.IsoClonedRelocatedMap.TryGetValue(initialIndex, out var duplicateIndex))
{
return duplicateIndex;
}
}
return -1;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Ok so how does the client know that it has to use the relocated index ? The problem is that when using the CFG, the blocks are correct (they already have been replaced by their relocated counterpart) and the client does not have to know about 'bad' blocks vs 'correct' ones. Here, when using the context it is different.
We should try to find a way to hide this notion of relocated blocks from outside of the builder.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The issue here is that as you know, is to allow abstract interpretation to redirect itself to relocated block rather than original block that have been cloned. What we can do is to add a new method GetOriginalRelocateBlockIndexes so the client can query what blocks have been relocated inside this context.

Copy link
Contributor

Choose a reason for hiding this comment

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

After building, does the original block still has a meaning ? In my understanding, original blocks are no longer connected in the graph so they should never be used or exposed after building. We should not put the burden of choosing between original blocks and relocated blocks on the client.

If it is too complex to rewrite the context on-the-fly during the build, is it possible to hide the original-to-relocated map and make the different properties of the context object do the work for the client ?

Copy link
Contributor Author

@mayanje mayanje Oct 8, 2021

Choose a reason for hiding this comment

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

No it is complex to clone a MultiBranchContext for each relocation and it uses space, this is a ready to use method, that I tested and it works for the abstract interpretation purpose, the client just have to know what it is about, this approach it quite simple and it works, no need to find different approach.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The only need her is to make accessible the relocation block information that have been used during relocation, thus there is only one point to take in account is to clone the MultiBanchContextObject for direct attribute not for relocation.

@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 Oct 8, 2021
@mayanje mayanje requested a review from fm-117 October 8, 2021 15:12
Copy link
Contributor

@fm-117 fm-117 left a comment

Choose a reason for hiding this comment

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

See my latest remark

@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 Oct 8, 2021
@mayanje
Copy link
Contributor Author

mayanje commented Oct 11, 2021

So for me it's ok I just need GetRelocatedBlockIndex to do the job without changing how MultiBranchContext has been constructed. MultiBranchContext is used only in the context of abstract interpretation, documenting the purpose of these methods is enough. If the client wants to know relocated block indexes inside this Context he can call GetOriginalRelocatedBlockIndexes.

@mayanje mayanje requested a review from fm-117 October 11, 2021 07:48

if (clonedBlock.Context != null)
{
clonedBlock.Context = (IMultiBranchContext<Node, D>)((MultiBranchContext)clonedBlock.Context).Clone();
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be included in the Clone method of the block ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok it can, done in 8f20df5

@mayanje mayanje closed this Oct 22, 2021
@mayanje
Copy link
Contributor Author

mayanje commented Oct 22, 2021

Replaced by #2045 and #2050

@smedilol smedilol deleted the 2022_AbstractIntMultiBranchContext branch November 21, 2022 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DataFlow 🔍 Ready for Review Pull Request is not reviewed yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants