void growHeapIfNeeded() { if (heap.length >= heapPos) return; short[] new_array = new short[computeNewArraySize(heap.length, heapPos, GROWTH_FACTOR, heapMultLimit)]; System.arraycopy(heap, 0, new_array, 0, heap.length); heap = new_array; }
break; case Slot_ShortRef: sb.append(cas.getShortHeap().getHeapValue(heap[iHeap + 2 + i])); break; case Slot_LongRef: case Slot_DoubleRef: {
int addShort(short val) { int pos = reserve(1); heap[pos] = val; return pos; }
int shortheapsz = cas.getShortHeap().getSize() - mark.nextShortHeapAddr; dos.writeInt(shortheapsz); for (int i = mark.nextShortHeapAddr; i < cas.getShortHeap().getSize(); i++) { dos.writeShort(cas.getShortHeap().heap[i]); int modifiedAddr = shortHeapModifiedAddrs[i]; dos.writeInt(modifiedAddr); shortValues[i] = cas.getShortHeap().getHeapValue(modifiedAddr); dos.writeShort(cas.getShortHeap().getHeapValue(shortHeapModifiedAddrs[i]));
final short v = (short)readDiff(int_dis, vPrevModShort); vPrevModShort = v; shortHeapObj.setHeapValue(v, auxHeapIndex + offset); } else { final long v = readLongOrDouble(kind, vPrevModLong);
void reinit(int[] heapMetadata, int[] heapArray, String[] stringTable, int[] fsIndex, byte[] byteHeapArray, short[] shortHeapArray, long[] longHeapArray) { createStringTableFromArray(stringTable); this.getHeap().reinit(heapMetadata, heapArray); if (byteHeapArray != null) { this.getByteHeap().reinit(byteHeapArray); } if (shortHeapArray != null) { this.getShortHeap().reinit(shortHeapArray); } if (longHeapArray != null) { this.getLongHeap().reinit(longHeapArray); } reinitIndexedFSs(fsIndex); }
this.getShortHeap().reset(); this.getLongHeap().reset();
} else { for (int i = 0; i < heapsz; i++) { this.getShortHeap().addShort(r.readShort());
System.arraycopy(cas.getByteHeap().heap, 0, this.byteHeapArray, 0, byteHeapSize); final int shortHeapSize = cas.getShortHeap().getSize(); this.shortHeapArray = new short[shortHeapSize]; System.arraycopy(cas.getShortHeap().heap, 0, this.shortHeapArray, 0, shortHeapSize);
final short v = (short)readDiff(int_dis, vPrevModShort); vPrevModShort = v; shortHeapObj.setHeapValue(v, auxHeapIndex + offset); } else { final long v = readLong(kind, vPrevModLong);
@Override public short ll_getShortArrayValue(int fsRef, int position) { final int pos = this.getHeap().heap[getArrayStartAddress(fsRef)]; return this.getShortHeap().getHeapValue(pos + position); }
public String printCasInfo(CASImpl cas) { int heapsz= cas.getHeap().getNextId() * 4; StringHeapDeserializationHelper shdh = cas.getStringHeap().serialize(); int charssz = shdh.charHeap.length * 2; int strintsz = cas.getStringHeap().getSize() * 8; int strsz = charssz + strintsz; int fsindexessz = cas.getIndexedFSs().length * 4; int bytessz = cas.getByteHeap().getSize(); int shortsz = cas.getShortHeap().getSize() * 2; int longsz = cas.getLongHeap().getSize() * 8; int total = heapsz + strsz + fsindexessz + bytessz + shortsz + longsz; return String.format("CAS info before compression: totalSize(bytes): %,d%n" + " mainHeap: %,d(%d%%)%n" + " Strings: [%,d(%d%%): %,d chars %,d ints]%n" + " fsIndexes: %,d(%d%%)%n" + " byte/short/long Heaps: [%,d %,d %,d]", total, heapsz, (100L*heapsz)/total, strsz, (100L*strsz)/ total, charssz, strintsz, fsindexessz, (100L*fsindexessz) / total, bytessz, shortsz, longsz ); }
private int readIntoShortArray(int length) throws IOException { final int startPos = shortHeapObj.reserve(length); final short[] h = shortHeapObj.heap; final int endPos = startPos + length; short prev = 0; for (int i = startPos; i < endPos; i++) { h[i] = prev = (short)(readDiff(short_dis, prev)); } return startPos; }
@Override public void ll_setShortArrayValue(int fsRef, int position, short value) { final int offset = this.getHeap().heap[getArrayStartAddress(fsRef)]; this.getShortHeap().setHeapValue(value, offset + position); if (this.svd.trackingMark != null) { this.logFSUpdate(fsRef, offset+position, ModifiedHeap.SHORTHEAP, 1); } }
break; case Slot_ShortRef: sb.append(cas.getShortHeap().getHeapValue(heap[iHeap + 2 + i])); break; case Slot_LongRef: case Slot_DoubleRef: {
String printCasInfo(CASImpl cas) { int heapsz= cas.getHeap().getNextId() * 4; StringHeapDeserializationHelper shdh = cas.getStringHeap().serialize(); int charssz = shdh.charHeap.length * 2; int strintsz = cas.getStringHeap().getSize() * 8; int strsz = charssz + strintsz; int fsindexessz = cas.getIndexedFSs().length * 4; int bytessz = cas.getByteHeap().getSize(); int shortsz = cas.getShortHeap().getSize() * 2; int longsz = cas.getLongHeap().getSize() * 8; int total = heapsz + strsz + fsindexessz + bytessz + shortsz + longsz; return String.format("CAS info before compression: totalSize(bytes): %,d%n" + " mainHeap: %,d(%d%%)%n" + " Strings: [%,d(%d%%): %,d chars %,d ints]%n" + " fsIndexes: %,d(%d%%)%n" + " byte/short/long Heaps: [%,d %,d %,d]", total, heapsz, (100L*heapsz)/total, strsz, (100L*strsz)/ total, charssz, strintsz, fsindexessz, (100L*fsindexessz) / total, bytessz, shortsz, longsz ); }
private int readIntoShortArray(int length, boolean storeIt) throws IOException { if (storeIt) { final int startPos = shortHeapObj.reserve(length); final short[] h = shortHeapObj.heap; final int endPos = startPos + length; short prev = 0; for (int i = startPos; i < endPos; i++) { h[i] = prev = (short)(readDiff(short_dis, prev)); } return startPos; } else { skipBytes(short_dis, length * 2); return 0; } }
writeUnsignedByte(byte_dos, byteHeapObj.getHeapValue(nextModAuxIndex)); } else if (isAuxShort) { final short v = shortHeapObj.getHeapValue(nextModAuxIndex); writeDiff(int_i, v, vPrevModShort); vPrevModShort = v;
System.out.println(printCasInfo(cas)); sm.origAuxBytes = cas.getByteHeap().getSize(); sm.origAuxShorts = cas.getShortHeap().getSize() * 2; sm.origAuxLongs = cas.getLongHeap().getSize() * 8; sm.totalTime = System.currentTimeMillis();