private static long readMessage(Bytes<?> bytes) { Jvm.safepoint(); long start = bytes.readLong(); if (true) { long rp = bytes.readPosition(); long rl = bytes.readLimit(); long addr = bytes.addressForRead(rp); long addrEnd = bytes.addressForRead(rl); Memory memory = OS.memory(); for (addr += 8; addr + 7 < addrEnd; addr += 8) memory.readLong(addr); } else { while (bytes.readRemaining() > 7) bytes.readLong(); } Jvm.safepoint(); return start; }
@NotNull @Override public final ExcerptTailer toStart() { assert direction != BACKWARD; final int firstCycle = queue.firstCycle(); if (firstCycle == Integer.MAX_VALUE) { state = UNINITIALISED; return this; } if (firstCycle != this.cycle) { // moves to the expected cycle boolean found = cycle(firstCycle); assert found || store == null; if (found) state = FOUND_CYCLE; } index(queue.rollCycle().toIndex(cycle, 0)); state = FOUND_CYCLE; if (wire() != null) { wire().bytes().readPosition(0); address = wire().bytes().addressForRead(0); } return this; }
context.setStart(bytes.readPosition() - 4); readingDocumentFound = true; address = bytes.addressForRead(bytes.readPosition(), 4); Jvm.optionalSafepoint(); return context; } else { Bytes<?> bytes = context.wire().bytes(); address = bytes.addressForRead(bytes.readPosition(), 4);
public void alignReadPosition(Bytes entry) { long positionAddr = entry.addressForRead(entry.readPosition()); long skip = alignAddr(positionAddr, alignment) - positionAddr; if (skip > 0) entry.readSkip(skip); }
private static long readMessage(Bytes<?> bytes) { Jvm.safepoint(); long start = bytes.readLong(); long rp = bytes.readPosition(); long rl = bytes.readLimit(); long addr = bytes.addressForRead(rp); long addrEnd = bytes.addressForRead(rl); Memory memory = OS.memory(); for (addr += 8; addr + 7 < addrEnd; addr += 8) memory.readLong(addr); Jvm.safepoint(); return start; }
void initValueSize(long valueSize) { this.valueSize = valueSize; Bytes segmentBytes = s.segmentBytesForWrite(); segmentBytes.writePosition(valueSizeOffset); mh.m().valueSizeMarshaller.writeSize(segmentBytes, valueSize); long currentPosition = segmentBytes.writePosition(); long currentAddr = segmentBytes.addressForRead(currentPosition); long skip = alignAddr(currentAddr, mh.m().alignment) - currentAddr; if (skip > 0) segmentBytes.writeSkip(skip); valueOffset = segmentBytes.writePosition(); }
@NotNull @Override public final ExcerptTailer toStart() { assert direction != BACKWARD; final int firstCycle = queue.firstCycle(); if (firstCycle == Integer.MAX_VALUE) { state = UNINITIALISED; return this; } if (firstCycle != this.cycle) { // moves to the expected cycle boolean found = cycle(firstCycle); assert found || store == null; if (found) state = FOUND_CYCLE; } index(queue.rollCycle().toIndex(cycle, 0)); state = FOUND_CYCLE; if (wire() != null) { wire().bytes().readPosition(0); address = wire().bytes().addressForRead(0); } return this; }
void initValueSize(long valueSize) { boolean wasValueSizeInit = this.valueSizeInit(); this.valueSize = valueSize; Bytes segmentBytes = this.segmentBytesForWriteGuarded(); segmentBytes.writePosition(valueSizeOffset()); this.m().valueSizeMarshaller.writeSize(segmentBytes, valueSize); long currentPosition = segmentBytes.writePosition(); long currentAddr = segmentBytes.addressForRead(currentPosition); long skip = (VanillaChronicleMap.alignAddr(currentAddr, this.m().alignment)) - currentAddr; if (skip > 0) segmentBytes.writeSkip(skip); valueOffset = segmentBytes.writePosition(); if (wasValueSizeInit) this.closeValueSizeDependants(); }
void initValueSize(long valueSize) { boolean wasValueSizeInit = this.valueSizeInit(); this.valueSize = valueSize; Bytes segmentBytes = this.segmentBytesForWriteGuarded(); segmentBytes.writePosition(valueSizeOffset()); this.m().valueSizeMarshaller.writeSize(segmentBytes, valueSize); long currentPosition = segmentBytes.writePosition(); long currentAddr = segmentBytes.addressForRead(currentPosition); long skip = (VanillaChronicleMap.alignAddr(currentAddr, this.m().alignment)) - currentAddr; if (skip > 0) segmentBytes.writeSkip(skip); valueOffset = segmentBytes.writePosition(); if (wasValueSizeInit) this.closeValueSizeDependants(); }
void initValueSize(long valueSize) { boolean wasValueSizeInit = this.valueSizeInit(); this.valueSize = valueSize; Bytes segmentBytes = this.segmentBytesForWriteGuarded(); segmentBytes.writePosition(valueSizeOffset()); this.m().valueSizeMarshaller.writeSize(segmentBytes, valueSize); long currentPosition = segmentBytes.writePosition(); long currentAddr = segmentBytes.addressForRead(currentPosition); long skip = (VanillaChronicleMap.alignAddr(currentAddr, this.m().alignment)) - currentAddr; if (skip > 0) segmentBytes.writeSkip(skip); valueOffset = segmentBytes.writePosition(); if (wasValueSizeInit) this.closeValueSizeDependants(); }
void initValueSize(long valueSize) { boolean wasValueSizeInit = this.valueSizeInit(); this.valueSize = valueSize; Bytes segmentBytes = this.segmentBytesForWriteGuarded(); segmentBytes.writePosition(valueSizeOffset()); this.m().valueSizeMarshaller.writeSize(segmentBytes, valueSize); long currentPosition = segmentBytes.writePosition(); long currentAddr = segmentBytes.addressForRead(currentPosition); long skip = (VanillaChronicleMap.alignAddr(currentAddr, this.m().alignment)) - currentAddr; if (skip > 0) segmentBytes.writeSkip(skip); valueOffset = segmentBytes.writePosition(); if (wasValueSizeInit) this.closeValueSizeDependants(); }
context.setStart(bytes.readPosition() - 4); readingDocumentFound = true; address = bytes.addressForRead(bytes.readPosition(), 4); Jvm.optionalSafepoint(); return context; } else { Bytes<?> bytes = context.wire().bytes(); address = bytes.addressForRead(bytes.readPosition(), 4);