Our HashTable does not support zero-based keys (e.g., NULL pointer as a
key). So as a hack, switch to use a small, arbitrary, non-zero location
instead of NULL (0).
*/
#define VALUE_NONE 0xdeadbeef
+/**
+ * @brief The "location" at which a fence occurs
+ *
+ * We need a non-zero memory location to associate with fences, since our hash
+ * tables don't handle NULL-pointer keys. HACK: Hopefully this doesn't collide
+ * with any legitimate memory locations.
+ */
+#define FENCE_LOCATION ((void *)0x7)
+
/** @brief Represents an action type, identifying one of several types of
* ModelAction */
typedef enum action_type {
/** Issues a fence operation. */
void model_fence_action(memory_order ord) {
- model->switch_to_master(new ModelAction(ATOMIC_FENCE, ord, NULL));
+ model->switch_to_master(new ModelAction(ATOMIC_FENCE, ord, FENCE_LOCATION));
}
*/
ModelAction * ModelExecution::get_last_seq_cst_fence(thread_id_t tid, const ModelAction *before_fence) const
{
- /* All fences should have NULL location */
- action_list_t *list = get_safe_ptr_action(obj_map, NULL);
+ /* All fences should have location FENCE_LOCATION */
+ action_list_t *list = get_safe_ptr_action(obj_map, FENCE_LOCATION);
action_list_t::reverse_iterator rit = list->rbegin();
if (before_fence) {