Skip to content

Commit

Permalink
Use memcpy in cloneArray
Browse files Browse the repository at this point in the history
While looking at #13615 I noticed that there was this strange open-coded
memcpy in the definition of the cloneArray macro. I don't see why this
should be preferable to memcpy.

Test Plan: Validate, particularly focusing on array operations

Reviewers: simonmar, tibbe, austin, alexbiehl

Reviewed By: tibbe, alexbiehl

Subscribers: alexbiehl, rwbarton, thomie

Differential Revision: https://phabricator.haskell.org/D3504
  • Loading branch information
bgamari committed Apr 28, 2017
1 parent b2c38d6 commit 228d467
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions includes/Cmm.h
Expand Up @@ -849,14 +849,7 @@
\
dst_p = dst + SIZEOF_StgMutArrPtrs; \
src_p = src + SIZEOF_StgMutArrPtrs + WDS(offset); \
while: \
if (n != 0) { \
n = n - 1; \
W_[dst_p] = W_[src_p]; \
dst_p = dst_p + WDS(1); \
src_p = src_p + WDS(1); \
goto while; \
} \
prim %memcpy(dst_p, src_p, n * SIZEOF_W, SIZEOF_W); \
\
return (dst);

Expand Down Expand Up @@ -931,13 +924,6 @@
\
dst_p = dst + SIZEOF_StgSmallMutArrPtrs; \
src_p = src + SIZEOF_StgSmallMutArrPtrs + WDS(offset); \
while: \
if (n != 0) { \
n = n - 1; \
W_[dst_p] = W_[src_p]; \
dst_p = dst_p + WDS(1); \
src_p = src_p + WDS(1); \
goto while; \
} \
prim %memcpy(dst_p, src_p, n * SIZEOF_W, SIZEOF_W); \
\
return (dst);

0 comments on commit 228d467

Please sign in to comment.