Bug 18943 – core.internal.hash remove outdated special case for DMD unaligned reads

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2018-06-05T05:12:11Z
Last change time
2018-06-10T18:10:31Z
Assigned to
No Owner
Creator
Nathan S.

Comments

Comment #0 by n8sh.secondary — 2018-06-05T05:12:11Z
core.internal.hash has lines dating back to its initial commit on November 16, 2013 that disable unaligned reads when using DMD comment that a DMD bug would prevent inlining. That is not true in the present day so the comment and alternative code branch have no purpose except to confuse. With optimization enabled DMD produces the same code for `return *cast(uint*)x;` and `return ((cast(uint) x[3]) << 24) | ((cast(uint) x[2]) << 16) | ((cast(uint) x[1]) << 8) | (cast(uint) x[0]);` when `x` is `ubyte*`, so this patch is not expected to improve performance except for non-optimized builds.
Comment #1 by n8sh.secondary — 2018-06-05T05:23:02Z
Comment #2 by github-bugzilla — 2018-06-10T18:10:30Z
Commits pushed to master at https://github.com/dlang/druntime https://github.com/dlang/druntime/commit/552f9e20c26e3451113eed32f21cbd6012c00800 Fix Issue 18943 - core.internal.hash remove outdated special case for DMD unaligned reads https://github.com/dlang/druntime/commit/2aac1d568ddb3fec0172afb2a180dad70354ed31 Merge pull request #2210 from n8sh/core-hash-18943 Fix Issue 18943 - core.internal.hash remove outdated special case for DMD unaligned reads merged-on-behalf-of: David Nadlinger <[email protected]>