vsync / atomic / atomicptr_stamped.h
C implementation of AtomicstampedReference in Java.
Precondition: Addresses must be 128-byte aligned in order to use vatomicptr_stamped_t.
Extends vatomicptr_t to vatomicptr_stamped_t. The 7 LSBs of the address are used as a stamp.
References:
Macros
| Macro | Description |
|---|---|
| V_ATOMICPTR_STAMPED_IS_ALIGNED | Evaluates to true, if the given pointer _ptr_ is 128-byte-aligned. |
Macro V_ATOMICPTR_STAMPED_IS_ALIGNED
V_ATOMICPTR_STAMPED_IS_ALIGNED(_ptr_)
Evaluates to true, if the given pointer _ptr_ is 128-byte-aligned.
Functions
| Function | Description |
|---|---|
| vatomicptr_stamped_cmpxchg | Compares and exchanges the address and stamp value in a. |
| vatomicptr_stamped_cmpxchg_acq | Compares and exchanges the address and stamp value in a. |
| vatomicptr_stamped_cmpxchg_rel | Compares and exchanges the address and stamp value in a. |
| vatomicptr_stamped_cmpxchg_rlx | Compares and exchanges the address and stamp value in a. |
| vatomicptr_stamped_attempt_stamp | Attemps to update the stamp in a. |
| vatomicptr_stamped_attempt_stamp_acq | Attemps to update the stamp in a. |
| vatomicptr_stamped_attempt_stamp_rel | Attemps to update the stamp in a. |
| vatomicptr_stamped_attempt_stamp_rlx | Attemps to update the stamp in a. |
| vatomicptr_stamped_set | Sets the address and stamp of a to the given v and stamp. |
| vatomicptr_stamped_set_rel | Sets the address and stamp of a to the given v and stamp. |
| vatomicptr_stamped_set_rlx | Sets the address and stamp of a to the given v and stamp. |
| vatomicptr_stamped_get | Returns the address value of a. |
| vatomicptr_stamped_get_acq | Returns the address value of a. |
| vatomicptr_stamped_get_rlx | Returns the address value of a. |
| vatomicptr_stamped_get_pointer | Returns the address value of a. |
| vatomicptr_stamped_get_pointer_acq | Returns the address value of a. |
| vatomicptr_stamped_get_pointer_rlx | Returns the address value of a. |
| vatomicptr_stamped_get_stamp | Returns the stamp value of a. |
| vatomicptr_stamped_get_stamp_acq | Returns the stamp value of a. |
| vatomicptr_stamped_get_stamp_rlx | Returns the stamp value of a. |
Function vatomicptr_stamped_cmpxchg
static vbool_t vatomicptr_stamped_cmpxchg(vatomicptr_stamped_t *a, void *e_v, vuint8_t e_stamp, void *v, vuint8_t stamp)
Compares and exchanges the address and stamp value in a.
Parameters:
a: address of vatomicptr_stamped_t object.e_v: expected address value.e_stamp: expected stamp value.v: new address value to set.stamp: new stamp value to set.
Returns: true address and stamp were set.
Returns: false address and stamp were not updated, because either the current address value in a != e_v, or the current stamp value in a != e_stamp.
Function vatomicptr_stamped_cmpxchg_acq
static vbool_t vatomicptr_stamped_cmpxchg_acq(vatomicptr_stamped_t *a, void *e_v, vuint8_t e_stamp, void *v, vuint8_t stamp)
Compares and exchanges the address and stamp value in a.
Parameters:
a: address of vatomicptr_stamped_t object.e_v: expected address value.e_stamp: expected stamp value.v: new address value to set.stamp: new stamp value to set.
Returns: true address and stamp were set.
Returns: false address and stamp were not updated, because either the current address value in a != e_v, or the current stamp value in a != e_stamp.
Function vatomicptr_stamped_cmpxchg_rel
static vbool_t vatomicptr_stamped_cmpxchg_rel(vatomicptr_stamped_t *a, void *e_v, vuint8_t e_stamp, void *v, vuint8_t stamp)
Compares and exchanges the address and stamp value in a.
Parameters:
a: address of vatomicptr_stamped_t object.e_v: expected address value.e_stamp: expected stamp value.v: new address value to set.stamp: new stamp value to set.
Returns: true address and stamp were set.
Returns: false address and stamp were not updated, because either the current address value in a != e_v, or the current stamp value in a != e_stamp.
Function vatomicptr_stamped_cmpxchg_rlx
static vbool_t vatomicptr_stamped_cmpxchg_rlx(vatomicptr_stamped_t *a, void *e_v, vuint8_t e_stamp, void *v, vuint8_t stamp)
Compares and exchanges the address and stamp value in a.
Parameters:
a: address of vatomicptr_stamped_t object.e_v: expected address value.e_stamp: expected stamp value.v: new address value to set.stamp: new stamp value to set.
Returns: true address and stamp were set.
Returns: false address and stamp were not updated, because either the current address value in a != e_v, or the current stamp value in a != e_stamp.
Function vatomicptr_stamped_attempt_stamp
static vbool_t vatomicptr_stamped_attempt_stamp(vatomicptr_stamped_t *a, void *e_v, vuint8_t stamp)
Attemps to update the stamp in a.
Parameters:
a: address of vatomicptr_stamped_t object.e_v: expected address value.stamp: new stamp value.
Returns: true stamp was set to stamp.
Returns: false stamp is not set, because current address value in a != e_v.
Function vatomicptr_stamped_attempt_stamp_acq
static vbool_t vatomicptr_stamped_attempt_stamp_acq(vatomicptr_stamped_t *a, void *e_v, vuint8_t stamp)
Attemps to update the stamp in a.
Parameters:
a: address of vatomicptr_stamped_t object.e_v: expected address value.stamp: new stamp value.
Returns: true stamp was set to stamp.
Returns: false stamp is not set, because current address value in a != e_v.
Function vatomicptr_stamped_attempt_stamp_rel
static vbool_t vatomicptr_stamped_attempt_stamp_rel(vatomicptr_stamped_t *a, void *e_v, vuint8_t stamp)
Attemps to update the stamp in a.
Parameters:
a: address of vatomicptr_stamped_t object.e_v: expected address value.stamp: new stamp value.
Returns: true stamp was set to stamp.
Returns: false stamp is not set, because current address value in a != e_v.
Function vatomicptr_stamped_attempt_stamp_rlx
static vbool_t vatomicptr_stamped_attempt_stamp_rlx(vatomicptr_stamped_t *a, void *e_v, vuint8_t stamp)
Attemps to update the stamp in a.
Parameters:
a: address of vatomicptr_stamped_t object.e_v: expected address value.stamp: new stamp value.
Returns: true stamp was set to stamp.
Returns: false stamp is not set, because current address value in a != e_v.
Function vatomicptr_stamped_set
static void vatomicptr_stamped_set(vatomicptr_stamped_t *a, void *v, vuint8_t stamp)
Sets the address and stamp of a to the given v and stamp.
Parameters:
a: address of vatomicptr_stamped_t object.v: address value to set.stamp: stamp value to set.
Function vatomicptr_stamped_set_rel
static void vatomicptr_stamped_set_rel(vatomicptr_stamped_t *a, void *v, vuint8_t stamp)
Sets the address and stamp of a to the given v and stamp.
Parameters:
a: address of vatomicptr_stamped_t object.v: address value to set.stamp: stamp value to set.
Function vatomicptr_stamped_set_rlx
static void vatomicptr_stamped_set_rlx(vatomicptr_stamped_t *a, void *v, vuint8_t stamp)
Sets the address and stamp of a to the given v and stamp.
Parameters:
a: address of vatomicptr_stamped_t object.v: address value to set.stamp: stamp value to set.
Function vatomicptr_stamped_get
static void* vatomicptr_stamped_get(vatomicptr_stamped_t *a, vuint8_t *out_stamp)
Returns the address value of a.
Parameters:
a: address of vatomicptr_stamped_t object.out_stamp: output param of type vuint8_t. The stamp value ina.
Returns: void* address value in a.
Function vatomicptr_stamped_get_acq
static void* vatomicptr_stamped_get_acq(vatomicptr_stamped_t *a, vuint8_t *out_stamp)
Returns the address value of a.
Parameters:
a: address of vatomicptr_stamped_t object.out_stamp: output param of type vuint8_t. The stamp value ina.
Returns: void* address value in a.
Function vatomicptr_stamped_get_rlx
static void* vatomicptr_stamped_get_rlx(vatomicptr_stamped_t *a, vuint8_t *out_stamp)
Returns the address value of a.
Parameters:
a: address of vatomicptr_stamped_t object.out_stamp: output param of type vuint8_t. The stamp value ina.
Returns: void* address value in a.
Function vatomicptr_stamped_get_pointer
static void* vatomicptr_stamped_get_pointer(vatomicptr_stamped_t *a)
Returns the address value of a.
Parameters:
a: address of vatomicptr_stamped_t object.
Returns: void* stored address in a.
Function vatomicptr_stamped_get_pointer_acq
static void* vatomicptr_stamped_get_pointer_acq(vatomicptr_stamped_t *a)
Returns the address value of a.
Parameters:
a: address of vatomicptr_stamped_t object.
Returns: void* stored address in a.
Function vatomicptr_stamped_get_pointer_rlx
static void* vatomicptr_stamped_get_pointer_rlx(vatomicptr_stamped_t *a)
Returns the address value of a.
Parameters:
a: address of vatomicptr_stamped_t object.
Returns: void* stored address in a.
Function vatomicptr_stamped_get_stamp
static vuint8_t vatomicptr_stamped_get_stamp(vatomicptr_stamped_t *a)
Returns the stamp value of a.
Parameters:
a: address of vatomicptr_stamped_t object.
Returns: stamp value in a.
Function vatomicptr_stamped_get_stamp_acq
static vuint8_t vatomicptr_stamped_get_stamp_acq(vatomicptr_stamped_t *a)
Returns the stamp value of a.
Parameters:
a: address of vatomicptr_stamped_t object.
Returns: stamp value in a.
Function vatomicptr_stamped_get_stamp_rlx
static vuint8_t vatomicptr_stamped_get_stamp_rlx(vatomicptr_stamped_t *a)
Returns the stamp value of a.
Parameters:
a: address of vatomicptr_stamped_t object.
Returns: stamp value in a.