Change names to conform to Java standards:
- rec_insert -> recInsert
- rec_insertif -> recInsertIf
- rec_lookup -> recLookup
- rec_remove -> recRemove
Change-Id: Ic11da9ac2ae96d8029d0bb08464033bfe027ee0b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
*
* @return true if successful, false otherwise
*/
*
* @return true if successful, false otherwise
*/
- boolean rec_insert(final K key, final V value, final int hc, final int lev, final INode<K, V> parent,
+ boolean recInsert(final K key, final V value, final int hc, final int lev, final INode<K, V> parent,
final TrieMap<K, V> ct) {
final TrieMap<K, V> ct) {
- return rec_insert(key, value, hc, lev, parent, gen, ct);
+ return recInsert(key, value, hc, lev, parent, gen, ct);
- private boolean rec_insert(final K k, final V v, final int hc, final int lev, final INode<K, V> parent,
+ private boolean recInsert(final K k, final V v, final int hc, final int lev, final INode<K, V> parent,
final Gen startgen, final TrieMap<K, V> ct) {
while (true) {
final MainNode<K, V> m = GCAS_READ(ct);
final Gen startgen, final TrieMap<K, V> ct) {
while (true) {
final MainNode<K, V> m = GCAS_READ(ct);
if (cnAtPos instanceof INode) {
final INode<K, V> in = (INode<K, V>) cnAtPos;
if (startgen == in.gen) {
if (cnAtPos instanceof INode) {
final INode<K, V> in = (INode<K, V>) cnAtPos;
if (startgen == in.gen) {
- return in.rec_insert(k, v, hc, lev + LEVEL_BITS, this, startgen, ct);
+ return in.recInsert(k, v, hc, lev + LEVEL_BITS, this, startgen, ct);
}
if (GCAS(cn, cn.renewed(startgen, ct), ct)) {
// Tail recursion: return rec_insert(k, v, hc, lev, parent, startgen, ct);
}
if (GCAS(cn, cn.renewed(startgen, ct), ct)) {
// Tail recursion: return rec_insert(k, v, hc, lev, parent, startgen, ct);
* @return null if unsuccessful, Option[V] otherwise (indicating
* previous value bound to the key)
*/
* @return null if unsuccessful, Option[V] otherwise (indicating
* previous value bound to the key)
*/
- Optional<V> rec_insertif(final K k, final V v, final int hc, final Object cond, final int lev,
+ Optional<V> recInsertIf(final K k, final V v, final int hc, final Object cond, final int lev,
final INode<K, V> parent, final TrieMap<K, V> ct) {
final INode<K, V> parent, final TrieMap<K, V> ct) {
- return rec_insertif(k, v, hc, cond, lev, parent, gen, ct);
+ return recInsertIf(k, v, hc, cond, lev, parent, gen, ct);
}
@SuppressFBWarnings(value = "NP_OPTIONAL_RETURN_NULL",
justification = "Returning null Optional indicates the need to restart.")
}
@SuppressFBWarnings(value = "NP_OPTIONAL_RETURN_NULL",
justification = "Returning null Optional indicates the need to restart.")
- private Optional<V> rec_insertif(final K k, final V v, final int hc, final Object cond, final int lev,
+ private Optional<V> recInsertIf(final K k, final V v, final int hc, final Object cond, final int lev,
final INode<K, V> parent, final Gen startgen, final TrieMap<K, V> ct) {
while (true) {
final MainNode<K, V> m = GCAS_READ(ct);
final INode<K, V> parent, final Gen startgen, final TrieMap<K, V> ct) {
while (true) {
final MainNode<K, V> m = GCAS_READ(ct);
if (cnAtPos instanceof INode) {
final INode<K, V> in = (INode<K, V>) cnAtPos;
if (startgen == in.gen) {
if (cnAtPos instanceof INode) {
final INode<K, V> in = (INode<K, V>) cnAtPos;
if (startgen == in.gen) {
- return in.rec_insertif(k, v, hc, cond, lev + LEVEL_BITS, this, startgen, ct);
+ return in.recInsertIf(k, v, hc, cond, lev + LEVEL_BITS, this, startgen, ct);
}
if (GCAS(cn, cn.renewed(startgen, ct), ct)) {
}
if (GCAS(cn, cn.renewed(startgen, ct), ct)) {
* @return null if no value has been found, RESTART if the operation
* wasn't successful, or any other value otherwise
*/
* @return null if no value has been found, RESTART if the operation
* wasn't successful, or any other value otherwise
*/
- Object rec_lookup(final K k, final int hc, final int lev, final INode<K, V> parent, final TrieMap<K, V> ct) {
- return rec_lookup(k, hc, lev, parent, gen, ct);
+ Object recLookup(final K k, final int hc, final int lev, final INode<K, V> parent, final TrieMap<K, V> ct) {
+ return recLookup(k, hc, lev, parent, gen, ct);
- private Object rec_lookup(final K k, final int hc, final int lev, final INode<K, V> parent, final Gen startgen,
+ private Object recLookup(final K k, final int hc, final int lev, final INode<K, V> parent, final Gen startgen,
final TrieMap<K, V> ct) {
while (true) {
final MainNode<K, V> m = GCAS_READ(ct);
final TrieMap<K, V> ct) {
while (true) {
final MainNode<K, V> m = GCAS_READ(ct);
if (sub instanceof INode) {
final INode<K, V> in = (INode<K, V>) sub;
if (ct.isReadOnly() || (startgen == in.gen)) {
if (sub instanceof INode) {
final INode<K, V> in = (INode<K, V>) sub;
if (ct.isReadOnly() || (startgen == in.gen)) {
- return in.rec_lookup(k, hc, lev + LEVEL_BITS, this, startgen, ct);
+ return in.recLookup(k, hc, lev + LEVEL_BITS, this, startgen, ct);
}
if (GCAS(cn, cn.renewed(startgen, ct), ct)) {
}
if (GCAS(cn, cn.renewed(startgen, ct), ct)) {
* @return null if not successful, an Optional indicating the previous
* value otherwise
*/
* @return null if not successful, an Optional indicating the previous
* value otherwise
*/
- Optional<V> rec_remove(final K k, final Object cond, final int hc, final int lev, final INode<K, V> parent,
+ Optional<V> recRemove(final K k, final Object cond, final int hc, final int lev, final INode<K, V> parent,
final TrieMap<K, V> ct) {
final TrieMap<K, V> ct) {
- return rec_remove(k, cond, hc, lev, parent, gen, ct);
+ return recRemove(k, cond, hc, lev, parent, gen, ct);
}
@SuppressFBWarnings(value = "NP_OPTIONAL_RETURN_NULL",
justification = "Returning null Optional indicates the need to restart.")
}
@SuppressFBWarnings(value = "NP_OPTIONAL_RETURN_NULL",
justification = "Returning null Optional indicates the need to restart.")
- private Optional<V> rec_remove(final K k, final Object cond, final int hc, final int lev, final INode<K, V> parent,
+ private Optional<V> recRemove(final K k, final Object cond, final int hc, final int lev, final INode<K, V> parent,
final Gen startgen, final TrieMap<K, V> ct) {
final MainNode<K, V> m = GCAS_READ(ct);
final Gen startgen, final TrieMap<K, V> ct) {
final MainNode<K, V> m = GCAS_READ(ct);
if (sub instanceof INode) {
final INode<K, V> in = (INode<K, V>) sub;
if (startgen == in.gen) {
if (sub instanceof INode) {
final INode<K, V> in = (INode<K, V>) sub;
if (startgen == in.gen) {
- res = in.rec_remove(k, cond, hc, lev + LEVEL_BITS, this, startgen, ct);
+ res = in.recRemove(k, cond, hc, lev + LEVEL_BITS, this, startgen, ct);
} else {
if (GCAS(cn, cn.renewed(startgen, ct), ct)) {
} else {
if (GCAS(cn, cn.renewed(startgen, ct), ct)) {
- res = rec_remove(k, cond, hc, lev, parent, startgen, ct);
+ res = recRemove(k, cond, hc, lev, parent, startgen, ct);
private void inserthc(final K key, final int hc, final V value) {
// TODO: this is called from serialization only, which means we should not be observing any races,
// hence we should not need to pass down the entire tree, just equality (I think).
private void inserthc(final K key, final int hc, final V value) {
// TODO: this is called from serialization only, which means we should not be observing any races,
// hence we should not need to pass down the entire tree, just equality (I think).
- final boolean success = RDCSS_READ_ROOT().rec_insert(key, value, hc, 0, null, this);
+ final boolean success = RDCSS_READ_ROOT().recInsert(key, value, hc, 0, null, this);
Verify.verify(success, "Concurrent modification during serialization of map %s", this);
}
Verify.verify(success, "Concurrent modification during serialization of map %s", this);
}
Optional<V> res;
do {
// Keep looping as long as we do not get a reply
Optional<V> res;
do {
// Keep looping as long as we do not get a reply
- res = RDCSS_READ_ROOT().rec_insertif(key, value, hc, cond, 0, null, this);
+ res = RDCSS_READ_ROOT().recInsertIf(key, value, hc, cond, 0, null, this);
} while (res == null);
return res;
} while (res == null);
return res;
Optional<V> res;
do {
// Keep looping as long as we do not get a reply
Optional<V> res;
do {
// Keep looping as long as we do not get a reply
- res = RDCSS_READ_ROOT().rec_remove(key, cond, hc, 0, null, this);
+ res = RDCSS_READ_ROOT().recRemove(key, cond, hc, 0, null, this);
} while (res == null);
return res;
} while (res == null);
return res;
Object res;
do {
// Keep looping as long as RESTART is being indicated
Object res;
do {
// Keep looping as long as RESTART is being indicated
- res = RDCSS_READ_ROOT().rec_lookup(key, hc, 0, null, this);
+ res = RDCSS_READ_ROOT().recLookup(key, hc, 0, null, this);
} while (res == RESTART);
return (V) res;
} while (res == RESTART);
return (V) res;