Mercurial > hg > graal-jvmci-8
diff src/os_cpu/windows_x86/vm/copy_windows_x86.inline.hpp @ 4010:16f9fa2bf76c
7100935: win32: memmove is not atomic but is used for pd_conjoint_*_atomic operations
Summary: replace the call to memmove by a simple copy loop
Reviewed-by: dholmes, kvn, never
Contributed-by: axel.siebenborn@sap.com, volker.simonis@gmail.com
author | kvn |
---|---|
date | Wed, 19 Oct 2011 10:52:30 -0700 |
parents | f95d63e2154a |
children |
line wrap: on
line diff
--- a/src/os_cpu/windows_x86/vm/copy_windows_x86.inline.hpp Mon Oct 17 21:38:29 2011 -0700 +++ b/src/os_cpu/windows_x86/vm/copy_windows_x86.inline.hpp Wed Oct 19 10:52:30 2011 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -85,13 +85,35 @@ } static void pd_conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count) { - // FIXME - (void)memmove(to, from, count << LogBytesPerShort); + if (from > to) { + while (count-- > 0) { + // Copy forwards + *to++ = *from++; + } + } else { + from += count - 1; + to += count - 1; + while (count-- > 0) { + // Copy backwards + *to-- = *from--; + } + } } static void pd_conjoint_jints_atomic(jint* from, jint* to, size_t count) { - // FIXME - (void)memmove(to, from, count << LogBytesPerInt); + if (from > to) { + while (count-- > 0) { + // Copy forwards + *to++ = *from++; + } + } else { + from += count - 1; + to += count - 1; + while (count-- > 0) { + // Copy backwards + *to-- = *from--; + } + } } static void pd_conjoint_jlongs_atomic(jlong* from, jlong* to, size_t count) {