From 228d4670e98e4fd998c847aac38c11ad85aa35a7 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Fri, 28 Apr 2017 13:24:47 -0400 Subject: [PATCH] Use memcpy in cloneArray 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 --- includes/Cmm.h | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/includes/Cmm.h b/includes/Cmm.h index 779416b6dab1..3c90307a7787 100644 --- a/includes/Cmm.h +++ b/includes/Cmm.h @@ -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); @@ -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);