From d28b0b0861af105bb15a5ed60488469a0dcbeb67 Mon Sep 17 00:00:00 2001 From: Torvald Riegel Date: Mon, 5 Mar 2012 16:34:12 +0000 Subject: [PATCH] libitm: Don't execute memtransfer/memset if size isn't larger than zero. libitm/ * dispatch.h (CREATE_DISPATCH_METHODS_MEM): Don't execute memtransfer/memset if size isn't larger than zero. From-SVN: r184941 --- libitm/ChangeLog | 5 +++++ libitm/dispatch.h | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libitm/ChangeLog b/libitm/ChangeLog index 1be02b525b4..9a3e484fc8a 100644 --- a/libitm/ChangeLog +++ b/libitm/ChangeLog @@ -1,3 +1,8 @@ +2012-03-05 Torvald Riegel + + * dispatch.h (CREATE_DISPATCH_METHODS_MEM): Don't execute + memtransfer/memset if size isn't larger than zero. + 2012-03-02 Torvald Riegel * libitm.texi: Link to specification and add a usage example. diff --git a/libitm/dispatch.h b/libitm/dispatch.h index d059c493507..6a9e62ef6c0 100644 --- a/libitm/dispatch.h +++ b/libitm/dispatch.h @@ -102,11 +102,13 @@ virtual void memtransfer(void *dst, const void* src, size_t size, \ bool may_overlap, ls_modifier dst_mod, ls_modifier src_mod) \ { \ - memtransfer_static(dst, src, size, may_overlap, dst_mod, src_mod); \ + if (size > 0) \ + memtransfer_static(dst, src, size, may_overlap, dst_mod, src_mod); \ } \ virtual void memset(void *dst, int c, size_t size, ls_modifier mod) \ { \ - memset_static(dst, c, size, mod); \ + if (size > 0) \ + memset_static(dst, c, size, mod); \ } #define CREATE_DISPATCH_METHODS_MEM_PV() \