/** * In this case the object will be instantiated in captured memory, * corresponding to memory allocated inside a transaction that * cannot escape (i.e., is captured by) its allocating transaction. */ protected VBox(AOMMarker x, Transaction owner) { inplace = new InplaceWrite<E>(owner); body = null; }
vbox.inplace = new InplaceWrite<T>(this.orec, (value == null ? (T) NULL_VALUE : value), inplaceWrite); overwrittenAncestorWriteSet = overwrittenAncestorWriteSet.cons(vbox); return; if (inplaceWrite.CASowner(currentOwner, this.orec)) { inplaceWrite.tempValue = (value == null ? (T) NULL_VALUE : value); boxesWrittenInPlace = boxesWrittenInPlace.cons(vbox);
@Override public <T> void setBoxValue(VBox<T> vbox, T value) { InplaceWrite<T> inplaceWrite = vbox.inplace; OwnershipRecord currentOwner = inplaceWrite.orec; if (currentOwner.owner == parent) { // we are already the current writer inplaceWrite.tempValue = (value == null ? (T) NULL_VALUE : value); return; } do { if (currentOwner.version != 0 && currentOwner.version <= this.number) { if (inplaceWrite.CASowner(currentOwner, parentOrec)) { inplaceWrite.tempValue = (value == null ? (T) NULL_VALUE : value); boxesWrittenInPlace = boxesWrittenInPlace.cons(vbox); return; // break } else { // update the current owner and retry currentOwner = inplaceWrite.orec; continue; } } else { synchronized (parent) { if (boxesWritten == EMPTY_MAP) { boxesWritten = new HashMap<VBox, Object>(); } boxesWritten.put(vbox, (value == null ? (T) NULL_VALUE : value)); return; } } } while (true); }
if (currentOwner.version != 0) { if (currentOwner.version <= this.number) { if (inplaceWrite.CASowner(currentOwner, this.orec)) { inplaceWrite.tempValue = (value == null ? (T) NULL_VALUE : value); boxesWrittenInPlace = boxesWrittenInPlace.cons(vbox); } else { if (retrieveAncestorVersion(currentOwner.owner) >= 0) { if (vbox.CASinplace(inplaceWrite, new InplaceWrite<T>(this.orec, (value == null ? (T) NULL_VALUE : value), inplaceWrite))) { return;
if (inplaceWrite.CASowner(currentOwner, this.orec)) {
/** * This is a specific constructor required by the VBoxAom class. * Any transactional class defined in the AOM (Adaptive Object Metadata) * should inherit from VBoxAom, which in turn inherits from VBox, and * should initialize the versioned history with null, corresponding * to the compact layout. */ protected VBox(AOMMarker x) { inplace = new InplaceWrite<E>(); body = null; }
protected VBox(VBoxBody<E> body) { this.inplace = new InplaceWrite<E>(); this.body = body; }
public VBox(E initial) { inplace = new InplaceWrite<E>(); put(initial); }