1 /* src/threads/atomic.hpp - atomic instructions
4 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
6 This file is part of CACAO.
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2, or (at
11 your option) any later version.
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
38 static uint32_t generic_compare_and_swap(volatile uint32_t *p, uint32_t oldval, uint32_t newval);
39 static uint64_t generic_compare_and_swap(volatile uint64_t *p, uint64_t oldval, uint64_t newval);
40 static void* generic_compare_and_swap(volatile void** p, void* oldval, void* newval);
41 static void generic_memory_barrier(void);
43 // Machine dependent functions.
44 static uint32_t compare_and_swap(volatile uint32_t *p, uint32_t oldval, uint32_t newval);
45 static uint64_t compare_and_swap(volatile uint64_t *p, uint64_t oldval, uint64_t newval);
46 static void* compare_and_swap(volatile void** p, void* oldval, void* newval);
47 static void memory_barrier(void);
48 static void write_memory_barrier(void);
49 static void instruction_barrier(void);
52 // Include machine dependent implementation.
53 #include "md-atomic.hpp"
57 // Legacy C interface.
59 uint32_t Atomic_compare_and_swap_32(volatile uint32_t *p, uint32_t oldval, uint32_t newval);
60 uint64_t Atomic_compare_and_swap_64(volatile uint64_t *p, uint64_t oldval, uint64_t newval);
61 void* Atomic_compare_and_swap_ptr(volatile void** p, void* oldval, void* newval);
62 void Atomic_memory_barrier(void);
63 void Atomic_write_memory_barrier(void);
64 void Atomic_instruction_barrier(void);
72 * These are local overrides for various environment variables in Emacs.
73 * Please do not remove this and leave it at the end of the file, where
74 * Emacs will automagically detect them.
75 * ---------------------------------------------------------------------
82 * vim:noexpandtab:sw=4:ts=4: