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

EnC - Update CustomAttributes table instead of just always adding to it #53507

Merged
merged 37 commits into from
Jun 16, 2021
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
1b7c02a
Whitespace
davidwengier May 19, 2021
8442d49
Keep track of custom attribute targets for later processing
davidwengier May 19, 2021
0df291e
Update existing custom attribute rows before adding new ones
davidwengier May 19, 2021
eb39b09
Output updated custom attribute rows to the enc map
davidwengier May 19, 2021
9c8e374
Add tests
davidwengier May 19, 2021
29029c3
Update existing tests with new magic numbers
davidwengier May 19, 2021
40bcc4e
Add another generation to the test
davidwengier May 20, 2021
849b6c9
Improve the test
davidwengier May 20, 2021
79c9be7
Keep track of added custom attribute rows across generations
davidwengier May 21, 2021
855870d
Include added custom attributes in the custom attribute map
davidwengier May 21, 2021
1e0c226
Update tests
davidwengier May 21, 2021
c6b6409
Wording
davidwengier May 21, 2021
555a63d
Doc
davidwengier May 27, 2021
4c5a7df
Rename
davidwengier May 27, 2021
fc4e2fb
Handle out of order enumeration
davidwengier May 27, 2021
416ee79
Be explicit about using the baseline
davidwengier May 27, 2021
a39ecaa
Move custom attribute targets to the delta writer
davidwengier May 27, 2021
b0b0d89
PR feedback
davidwengier May 27, 2021
37685b5
PR feedback
davidwengier May 27, 2021
15352ac
Only create the attribute map for the rows we will use from it
davidwengier Jun 1, 2021
7397cc4
Split processing into two phases so we don't allocate more queues tha…
davidwengier Jun 2, 2021
aed0de7
Fix test
davidwengier Jun 2, 2021
bd5f94e
Renames as per PR feedback
davidwengier Jun 2, 2021
9c80fd2
Switch to using two separate lists rather than mutating one
davidwengier Jun 3, 2021
54e869c
Add failing test for adding multiple new attributes in between existi…
davidwengier Jun 3, 2021
a72f158
Fix the algorithm to handle gaps in emitted attributes
davidwengier Jun 3, 2021
2ddbd33
Update src/Compilers/Core/Portable/Emit/EditAndContinue/DeltaMetadata…
davidwengier Jun 3, 2021
6060786
PR feedback
davidwengier Jun 4, 2021
08f59a7
Add failing tests for delete
davidwengier Jun 7, 2021
1ea463f
Support deletes from the original metadata
davidwengier Jun 9, 2021
14114cc
Delete attributes that were emitted in deltas
davidwengier Jun 9, 2021
231671c
Fix final bugs and update tests
davidwengier Jun 10, 2021
7a2263e
FIx whitespace
davidwengier Jun 11, 2021
49336c0
Use a binary search to emit enc log records
davidwengier Jun 11, 2021
7f91b60
Fix VB tests
davidwengier Jun 11, 2021
7732f5f
PR feedback
davidwengier Jun 14, 2021
867866c
Merge remote-tracking branch 'upstream/main' into EnCCustomAttributes
davidwengier Jun 15, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ void F()
CheckEncLogDefinitions(reader1,
Row(1, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(3, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(5, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
Row(4, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
}

[Fact]
Expand Down Expand Up @@ -362,7 +362,7 @@ void F()
CheckEncLogDefinitions(reader1,
Row(1, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(3, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(5, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
Row(4, TableIndex.CustomAttribute, EditAndContinueOperation.Default));

var testData0 = new CompilationTestData();
var bytes0 = compilation0.EmitToArray(testData: testData0);
Expand Down Expand Up @@ -477,7 +477,7 @@ void F<T>()
Row(2, TableIndex.StandAloneSig, EditAndContinueOperation.Default),
Row(1, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(3, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(5, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
Row(4, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
}

[Fact]
Expand Down Expand Up @@ -532,7 +532,7 @@ int F(int a)
Row(2, TableIndex.StandAloneSig, EditAndContinueOperation.Default),
Row(1, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(3, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(5, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
Row(4, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
}

[Fact]
Expand Down Expand Up @@ -586,7 +586,7 @@ int F(int a)
Row(2, TableIndex.StandAloneSig, EditAndContinueOperation.Default),
Row(1, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(3, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(5, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
Row(4, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
}

[Fact]
Expand Down Expand Up @@ -786,7 +786,7 @@ int F(int a)
Row(2, TableIndex.StandAloneSig, EditAndContinueOperation.Default),
Row(1, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(3, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(6, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
Row(4, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
}

[Fact]
Expand Down Expand Up @@ -1076,8 +1076,8 @@ void F()
Row(18, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(19, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(20, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(17, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(18, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
Row(15, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(16, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
}

[Fact]
Expand Down Expand Up @@ -1153,7 +1153,7 @@ void F()
Row(10, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(12, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(15, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(15, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
Row(14, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
}

[Fact]
Expand Down Expand Up @@ -1240,9 +1240,9 @@ public void F()
Row(8, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(10, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(12, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(10, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(11, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(12, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
Row(5, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(7, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(9, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
}

[Fact]
Expand Down Expand Up @@ -1322,7 +1322,7 @@ public void F()
Row(6, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(9, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(10, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(7, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
Row(5, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
}

[Fact]
Expand Down Expand Up @@ -1399,7 +1399,7 @@ public void F()
Row(4, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(6, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(9, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(7, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
Row(5, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
}

[Fact]
Expand Down Expand Up @@ -4002,7 +4002,7 @@ .maxstack 2
Row(2, TableIndex.StandAloneSig, EditAndContinueOperation.Default),
Row(1, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(3, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(7, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
Row(4, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
}

[Fact]
Expand Down Expand Up @@ -4087,7 +4087,7 @@ .maxstack 2
Row(2, TableIndex.StandAloneSig, EditAndContinueOperation.Default),
Row(1, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(3, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(6, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
Row(4, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
}

[Fact]
Expand Down Expand Up @@ -4160,7 +4160,7 @@ .maxstack 2
CheckEncLogDefinitions(reader1,
Row(1, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(3, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(5, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
Row(4, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -672,12 +672,12 @@ static async Task<int> F(int a)
Row(6, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(9, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(12, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(16, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(17, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(18, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(19, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(20, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(21, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
Row(1, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(2, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(6, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(7, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(8, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(9, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
}
}
}
Expand Down Expand Up @@ -736,8 +736,8 @@ static IEnumerable<int> F()
Row(1, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(4, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(5, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(13, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(14, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
Row(1, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(7, TableIndex.CustomAttribute, EditAndContinueOperation.Default));

diff1.VerifyIL("C.<F>d__0.System.Collections.IEnumerator.MoveNext", @"
{
Expand Down Expand Up @@ -871,8 +871,8 @@ static async Task<int> F()
Row(4, TableIndex.StandAloneSig, EditAndContinueOperation.Default),
Row(1, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(4, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(8, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(9, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
Row(1, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(2, TableIndex.CustomAttribute, EditAndContinueOperation.Default));

diff1.VerifyIL("C.<F>d__0.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext", @"
{
Expand Down Expand Up @@ -1142,8 +1142,8 @@ static IEnumerable<int> F(int p)
Row(1, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(4, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(5, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(13, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(14, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
Row(1, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(7, TableIndex.CustomAttribute, EditAndContinueOperation.Default));

diff1.VerifyIL("C.<F>d__0.System.Collections.IEnumerator.MoveNext", @"
{
Expand Down Expand Up @@ -1246,8 +1246,8 @@ static IEnumerable<int> F(int p)
Row(1, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(4, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(5, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(13, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(14, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
Row(1, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(7, TableIndex.CustomAttribute, EditAndContinueOperation.Default));

diff1.VerifyIL("C.<F>d__0.System.Collections.IEnumerator.MoveNext", @"
{
Expand Down Expand Up @@ -1357,8 +1357,8 @@ static IEnumerable<int> F(int p)
Row(1, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(4, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(5, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(13, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(14, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
Row(1, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(7, TableIndex.CustomAttribute, EditAndContinueOperation.Default));

diff1.VerifyIL("C.<F>d__0.System.Collections.IEnumerator.MoveNext", @"
{
Expand Down Expand Up @@ -1465,8 +1465,8 @@ static IEnumerable<int> F()
Row(1, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(4, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(5, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(13, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(14, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
Row(1, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(7, TableIndex.CustomAttribute, EditAndContinueOperation.Default));

diff1.VerifyIL("C.<F>d__0.System.Collections.IEnumerator.MoveNext", @"
{
Expand Down Expand Up @@ -1582,8 +1582,8 @@ static IEnumerable<int> F()
Row(1, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(4, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(5, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(13, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(14, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
Row(1, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(7, TableIndex.CustomAttribute, EditAndContinueOperation.Default));

diff1.VerifyIL("C.<F>d__0.System.Collections.IEnumerator.MoveNext", @"
{
Expand Down Expand Up @@ -1875,10 +1875,10 @@ static async Task<int> H() // updated
Row(2, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(6, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(9, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(16, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(17, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(18, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(19, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
Row(1, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(2, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(6, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(7, TableIndex.CustomAttribute, EditAndContinueOperation.Default));

diff1.VerifyIL("C.<F>d__0.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext", @"
{
Expand Down Expand Up @@ -1986,8 +1986,8 @@ .locals init (int V_0,
Row(18, TableIndex.Field, EditAndContinueOperation.Default),
Row(1, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(6, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(20, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(21, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
Row(1, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(2, TableIndex.CustomAttribute, EditAndContinueOperation.Default));

diff2.VerifyIL("C.<F>d__0.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext", @"
{
Expand Down Expand Up @@ -2099,10 +2099,10 @@ .locals init (int V_0,
Row(3, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(9, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(12, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(22, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(23, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(24, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(25, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
Row(6, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(7, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(8, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(9, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
}

[Fact]
Expand Down Expand Up @@ -2622,10 +2622,10 @@ static async Task<int> H() // updated
Row(5, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(9, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(12, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(16, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(17, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(18, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(19, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
Row(5, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(6, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(8, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(9, TableIndex.CustomAttribute, EditAndContinueOperation.Default));

// Note that the new awaiter is allocated slot <>u__3 since <>u__1 and <>u__2 are taken.
diff1.VerifyIL("C.<F>d__3.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext", @"
Expand Down Expand Up @@ -2762,8 +2762,8 @@ .locals init (int V_0,
Row(12, TableIndex.Field, EditAndContinueOperation.Default),
Row(4, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(9, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(20, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(21, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
Row(5, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(6, TableIndex.CustomAttribute, EditAndContinueOperation.Default));

// Note that the new awaiters are allocated slots <>u__4, <>u__5.
diff2.VerifyIL("C.<F>d__3.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext", @"
Expand Down Expand Up @@ -2906,10 +2906,10 @@ .locals init (int V_0,
Row(6, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(12, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(15, TableIndex.MethodDef, EditAndContinueOperation.Default),
Row(22, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(23, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(24, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(25, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
Row(8, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(9, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(11, TableIndex.CustomAttribute, EditAndContinueOperation.Default),
Row(12, TableIndex.CustomAttribute, EditAndContinueOperation.Default));
}

[Fact]
Expand Down
Loading