7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "runtime/sharedRuntime.hpp"
27 #include "utilities/copy.hpp"
28
29
30 // Copy bytes; larger units are filled atomically if everything is aligned.
31 void Copy::conjoint_memory_atomic(void* from, void* to, size_t size) {
32 address src = (address) from;
33 address dst = (address) to;
34 uintptr_t bits = (uintptr_t) src | (uintptr_t) dst | (uintptr_t) size;
35
36 // (Note: We could improve performance by ignoring the low bits of size,
37 // and putting a short cleanup loop after each bulk copy loop.
38 // There are plenty of other ways to make this faster also,
39 // and it's a slippery slope. For now, let's keep this code simple
40 // since the simplicity helps clarify the atomicity semantics of
41 // this operation. There are also CPU-specific assembly versions
42 // which may or may not want to include such optimizations.)
43
44 if (bits % sizeof(jlong) == 0) {
45 Copy::conjoint_jlongs_atomic((jlong*) src, (jlong*) dst, size / sizeof(jlong));
46 } else if (bits % sizeof(jint) == 0) {
|
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "runtime/sharedRuntime.hpp"
27 #include "utilities/align.hpp"
28 #include "utilities/copy.hpp"
29
30
31 // Copy bytes; larger units are filled atomically if everything is aligned.
32 void Copy::conjoint_memory_atomic(void* from, void* to, size_t size) {
33 address src = (address) from;
34 address dst = (address) to;
35 uintptr_t bits = (uintptr_t) src | (uintptr_t) dst | (uintptr_t) size;
36
37 // (Note: We could improve performance by ignoring the low bits of size,
38 // and putting a short cleanup loop after each bulk copy loop.
39 // There are plenty of other ways to make this faster also,
40 // and it's a slippery slope. For now, let's keep this code simple
41 // since the simplicity helps clarify the atomicity semantics of
42 // this operation. There are also CPU-specific assembly versions
43 // which may or may not want to include such optimizations.)
44
45 if (bits % sizeof(jlong) == 0) {
46 Copy::conjoint_jlongs_atomic((jlong*) src, (jlong*) dst, size / sizeof(jlong));
47 } else if (bits % sizeof(jint) == 0) {
|