-
Notifications
You must be signed in to change notification settings - Fork 214
Merge requiresunsafe-corelib2 into feature/requires-unsafe #3209
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
base: feature/requires-unsafe
Are you sure you want to change the base?
Changes from 4 commits
f831e85
41893f5
73b3389
8aec308
f2e66af
9a8c31b
bc538f8
c0df804
b73ffce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,7 +55,8 @@ public sealed override bool Equals([NotNullWhen(true)] object? obj) | |
| // the types are the same, obj should also be a | ||
| // MulticastDelegate | ||
| Debug.Assert(obj is MulticastDelegate, "Shouldn't have failed here since we already checked the types are the same!"); | ||
| MulticastDelegate d = Unsafe.As<MulticastDelegate>(obj); | ||
| MulticastDelegate d; | ||
| unsafe { d = Unsafe.As<MulticastDelegate>(obj); } | ||
|
|
||
| if (_invocationCount != 0) | ||
| { | ||
|
|
@@ -168,7 +169,11 @@ private static bool TrySetSlot(object?[] a, int index, object o) | |
| private unsafe MulticastDelegate NewMulticastDelegate(object[] invocationList, int invocationCount, bool thisIsMultiCastAlready) | ||
|
||
| { | ||
| // First, allocate a new multicast delegate just like this one, i.e. same type as the this object | ||
| MulticastDelegate result = Unsafe.As<MulticastDelegate>(RuntimeTypeHandle.InternalAllocNoChecks(RuntimeHelpers.GetMethodTable(this))); | ||
| MulticastDelegate result; | ||
| unsafe | ||
| { | ||
| result = Unsafe.As<MulticastDelegate>(RuntimeTypeHandle.InternalAllocNoChecks(RuntimeHelpers.GetMethodTable(this))); | ||
| } | ||
|
|
||
| // Performance optimization - if this already points to a true multicast delegate, | ||
| // copy _methodPtr and _methodPtrAux fields rather than calling into the EE to get them | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,7 +60,10 @@ public override T[] Rent(int minimumLength) | |
| SharedArrayPoolThreadLocalArray[]? tlsBuckets = t_tlsBuckets; | ||
| if (tlsBuckets is not null && (uint)bucketIndex < (uint)tlsBuckets.Length) | ||
| { | ||
| buffer = Unsafe.As<T[]>(tlsBuckets[bucketIndex].Array); | ||
agocke marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| unsafe | ||
| { | ||
| buffer = Unsafe.As<T[]>(tlsBuckets[bucketIndex].Array); | ||
agocke marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| if (buffer is not null) | ||
| { | ||
| tlsBuckets[bucketIndex].Array = null; | ||
|
|
@@ -79,7 +82,10 @@ public override T[] Rent(int minimumLength) | |
| SharedArrayPoolPartitions? b = perCoreBuckets[bucketIndex]; | ||
| if (b is not null) | ||
| { | ||
| buffer = Unsafe.As<T[]>(b.TryPop()); | ||
| unsafe | ||
| { | ||
| buffer = Unsafe.As<T[]>(b.TryPop()); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TryPop must always be a
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in commit c0df804. Made TryPush method unsafe with comment "Array parameter must be a T[]".
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please mark the TryPush method RequiresUnsafe instead.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in commit b73ffce. Changed TryPush method from |
||
| } | ||
| if (buffer is not null) | ||
| { | ||
| if (log.IsEnabled()) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.