comparison 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
comparison
equal deleted inserted replaced
4009:e5928e7dab26 4010:16f9fa2bf76c
1 /* 1 /*
2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
83 static void pd_conjoint_bytes_atomic(void* from, void* to, size_t count) { 83 static void pd_conjoint_bytes_atomic(void* from, void* to, size_t count) {
84 pd_conjoint_bytes(from, to, count); 84 pd_conjoint_bytes(from, to, count);
85 } 85 }
86 86
87 static void pd_conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count) { 87 static void pd_conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count) {
88 // FIXME 88 if (from > to) {
89 (void)memmove(to, from, count << LogBytesPerShort); 89 while (count-- > 0) {
90 // Copy forwards
91 *to++ = *from++;
92 }
93 } else {
94 from += count - 1;
95 to += count - 1;
96 while (count-- > 0) {
97 // Copy backwards
98 *to-- = *from--;
99 }
100 }
90 } 101 }
91 102
92 static void pd_conjoint_jints_atomic(jint* from, jint* to, size_t count) { 103 static void pd_conjoint_jints_atomic(jint* from, jint* to, size_t count) {
93 // FIXME 104 if (from > to) {
94 (void)memmove(to, from, count << LogBytesPerInt); 105 while (count-- > 0) {
106 // Copy forwards
107 *to++ = *from++;
108 }
109 } else {
110 from += count - 1;
111 to += count - 1;
112 while (count-- > 0) {
113 // Copy backwards
114 *to-- = *from--;
115 }
116 }
95 } 117 }
96 118
97 static void pd_conjoint_jlongs_atomic(jlong* from, jlong* to, size_t count) { 119 static void pd_conjoint_jlongs_atomic(jlong* from, jlong* to, size_t count) {
98 #ifdef AMD64 120 #ifdef AMD64
99 assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size"); 121 assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size");