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

Refactor memory copies in SafeBuffer #105206

Merged
merged 4 commits into from
Oct 15, 2024

Conversation

xtqqczze
Copy link
Contributor

@xtqqczze xtqqczze commented Jul 21, 2024

No diffs expected, except from the changes to sign-extension.

Diffs are an improvement: MihuBot/runtime-utils#548

System.Runtime.InteropServices.SafeBuffer:Read[ubyte](ulong):ubyte:this
 G_M48575_IG03:
-       lea      rsi, [rbp-0x20]
-       mov      rdi, gword ptr [rbp-0x28]
+       lea      rsi, [rbp-0x10]
+       mov      rdi, gword ptr [rbp-0x18]
        mov      rax, 0xD1FFAB1E      ; code for System.Runtime.InteropServices.SafeHandle:DangerousAddRef(byref):this
        call     [rax]System.Runtime.InteropServices.SafeHandle:DangerousAddRef(byref):this
-       mov      edx, r15d
-       lea      rdi, [rbp-0x18]
-       mov      rsi, rbx
-       mov      rax, 0xD1FFAB1E      ; code for System.SpanHelpers:Memmove(byref,byref,ulong)
-       call     [rax]System.SpanHelpers:Memmove(byref,byref,ulong)
-       nop      
-						;; size=43 bbWeight=1 PerfScore 9.25
+       movzx    rbx, byte  ptr [rbx]
+						;; size=23 bbWeight=1 PerfScore 6.75

@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jul 21, 2024
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Jul 21, 2024
@xtqqczze
Copy link
Contributor Author

@MihuBot -arm64

@xtqqczze
Copy link
Contributor Author

@MihuBot -arm64

@xtqqczze
Copy link
Contributor Author

@MihuBot

Copy link
Contributor

Tagging subscribers to this area: @dotnet/interop-contrib
See info in area-owners.md if you want to be subscribed.

@xtqqczze xtqqczze force-pushed the SafeBuffer-Memmove branch from b6797f0 to 3036449 Compare August 8, 2024 15:05
@agocke
Copy link
Member

agocke commented Oct 14, 2024

@tannergooding Do you want to take a look at this?

@jkoritzinsky jkoritzinsky merged commit 7f682ef into dotnet:main Oct 15, 2024
146 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Nov 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Runtime.InteropServices community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants