Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Add TryGetOwnedMemory #16455

Merged
merged 3 commits into from
Feb 21, 2018
Merged

Add TryGetOwnedMemory #16455

merged 3 commits into from
Feb 21, 2018

Conversation

benaadams
Copy link
Member

@benaadams benaadams commented Feb 20, 2018

where TOwner : OwnedMemory<T>
{
ownedMemory = readOnlyMemory.GetObjectStartLength(out int index, out int length) as TOwner;
return !ReferenceEquals(ownedMemory, null);
Copy link
Member

Choose a reason for hiding this comment

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

Does the JIT'd code end up fetching ownedMemory again? Wondering if there's any value in this being:

TOwner tmp;
ownedMemory = tmp = readOnlyMemory.GetObjectStartLength(out int index, out int length) as TOwner;
return !ReferenceEquals(tmp, null);

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, so its reg rather than ref; good idea

@stephentoub stephentoub merged commit 1d51b71 into dotnet:master Feb 21, 2018
@benaadams benaadams deleted the TryGetOwnedMemory branch February 21, 2018 01:57
dotnet-bot pushed a commit to dotnet/corefx that referenced this pull request Feb 21, 2018
* Add TryGetOwnedMemory

* Feedback

* spelling

Signed-off-by: dotnet-bot-corefx-mirror <dotnet-bot@microsoft.com>
dotnet-bot pushed a commit to dotnet/corert that referenced this pull request Feb 21, 2018
* Add TryGetOwnedMemory

* Feedback

* spelling

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
jkotas pushed a commit to dotnet/corert that referenced this pull request Feb 21, 2018
* Add TryGetOwnedMemory

* Feedback

* spelling

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
jkotas pushed a commit to dotnet/corefx that referenced this pull request Feb 21, 2018
* Add TryGetOwnedMemory

* Feedback

* spelling

Signed-off-by: dotnet-bot-corefx-mirror <dotnet-bot@microsoft.com>
dotnet-bot pushed a commit to dotnet/corefx that referenced this pull request Feb 21, 2018
* Add TryGetOwnedMemory

* Feedback

* spelling

Signed-off-by: dotnet-bot-corefx-mirror <dotnet-bot@microsoft.com>
dotnet-bot pushed a commit to dotnet/corefx that referenced this pull request Feb 21, 2018
* Add TryGetOwnedMemory

* Feedback

* spelling

Signed-off-by: dotnet-bot-corefx-mirror <dotnet-bot@microsoft.com>
JeremyKuhne pushed a commit to JeremyKuhne/corefx that referenced this pull request Feb 21, 2018
* Add TryGetOwnedMemory

* Feedback

* spelling

Signed-off-by: dotnet-bot-corefx-mirror <dotnet-bot@microsoft.com>
kbaladurin pushed a commit to kbaladurin/corert that referenced this pull request Mar 15, 2018
* Add TryGetOwnedMemory

* Feedback

* spelling

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants