public long ll_getLongValue(int offset) { return this.getLongHeap().getHeapValue(offset); }
@Override public void ll_setDoubleValue(int fsRef, int featureCode, double value) { long val = Double.doubleToLongBits(value); final int offset = this.getLongHeap().addLong(val); setFeatureValue(fsRef, featureCode, offset); }
@Override public double ll_getDoubleValue(int fsRef, int featureCode) { final int offset = this.getHeap().heap[fsRef + this.svd.casMetadata.featureOffset[featureCode]]; long val = this.getLongHeap().getHeapValue(offset); return Double.longBitsToDouble(val); }
public double ll_getDoubleValueFeatOffset(int fsRef, int featureOffset) { final int offset = this.getHeap().heap[fsRef + featureOffset]; long val = this.getLongHeap().getHeapValue(offset); return Double.longBitsToDouble(val); }
@Override public long ll_getLongValue(int fsRef, int featureCode) { final int offset = this.getHeap().heap[fsRef + this.svd.casMetadata.featureOffset[featureCode]]; long val = this.getLongHeap().getHeapValue(offset); return (val); }
public long ll_getLongValueFeatOffset(int fsRef, int featureOffset) { final int offset = this.getHeap().heap[fsRef + featureOffset]; long val = this.getLongHeap().getHeapValue(offset); return (val); }
@Override public void ll_setLongValue(int fsRef, int featureCode, long value) { final int offset = this.getLongHeap().addLong(value); setFeatureValue(fsRef, featureCode, offset); }
@Override public double ll_getDoubleArrayValue(int fsRef, int position) { final int pos = this.getHeap().heap[getArrayStartAddress(fsRef)]; long val = this.getLongHeap().getHeapValue(pos + position); return Double.longBitsToDouble(val); }
private boolean compareSlot(int offset) { SlotKind kind = typeInfo.getSlotKind(offset); switch (kind) { case Slot_Int: case Slot_Short: case Slot_Boolean: case Slot_Byte: case Slot_Float: case Slot_HeapRef: return c1heap[iHeap + offset] == c2heap[iHeap + offset]; case Slot_StrRef: return compareStrings(c1.getStringForCode(c1heap[iHeap + offset]), c2.getStringForCode(c2heap[iHeap + offset])); case Slot_LongRef: case Slot_DoubleRef: return c1.getLongHeap().getHeapValue(c1heap[iHeap + offset]) == c2.getLongHeap().getHeapValue(c2heap[iHeap + offset]); default: throw new RuntimeException("internal error"); } }
@Override public int ll_createLongArray(int arrayLength) { final int addr = ll_createAuxArray(TypeSystemImpl.longArrayTypeCode, arrayLength); this.getHeap().heap[addr + arrayContentOffset] = this.getLongHeap().reserve(arrayLength); return addr; }
@Override public long ll_getLongArrayValue(int fsRef, int position) { final int pos = this.getHeap().heap[getArrayStartAddress(fsRef)]; return this.getLongHeap().getHeapValue(pos + position); }
@Override public void ll_setDoubleArrayValue(int fsRef, int position, double d) { final int offset = this.getHeap().heap[getArrayStartAddress(fsRef)]; long value = Double.doubleToLongBits(d); this.getLongHeap().setHeapValue(value, offset + position); if (this.svd.trackingMark != null) { this.logFSUpdate(fsRef, offset+position, ModifiedHeap.LONGHEAP, 1); } }
@Override public int ll_createDoubleArray(int arrayLength) { final int addr = ll_createAuxArray(TypeSystemImpl.doubleArrayTypeCode, arrayLength); this.getHeap().heap[addr + arrayContentOffset] = this.getLongHeap().reserve(arrayLength); return addr; }
@Override public void ll_setLongArrayValue(int fsRef, int position, long value) { final int offset = this.getHeap().heap[getArrayStartAddress(fsRef)]; this.getLongHeap().setHeapValue(value, offset + position); if (this.svd.trackingMark != null) { this.logFSUpdate(fsRef, offset+position, ModifiedHeap.LONGHEAP, 1); } }
private boolean compareSlot(int offsetSrc, int offsetTgt) { SlotKind kind = typeInfo.getSlotKind(offsetSrc); switch (kind) { case Slot_Int: case Slot_Short: case Slot_Boolean: case Slot_Byte: case Slot_Float: return c1heap[c1heapIndex + offsetSrc] == c2heap[c2heapIndex + offsetTgt]; case Slot_HeapRef: { final int c1ref = c1heap[c1heapIndex + offsetSrc]; final int c2ref = c2heap[c2heapIndex + offsetTgt]; return diagnoseMiscompareHeapRef(c1ref, c2ref, offsetSrc); // if (!isInstanceInTgtTs(c1ref)) { // // source ref is for type not in target. Target value should be 0 // return (c2ref == 0); // } // return ((c1ref == 0) && (c2ref == 0)) || // ((c1ref != 0) && (c2ref != 0) && // (addr2seq1.get(c1ref) == addr2seq2.get(c2ref))); } case Slot_StrRef: return compareStrings(c1.getStringForCode(c1heap[c1heapIndex + offsetSrc]), c2.getStringForCode(c2heap[c2heapIndex + offsetTgt])); case Slot_LongRef: case Slot_DoubleRef: return c1.getLongHeap().getHeapValue(c1heap[c1heapIndex + offsetSrc]) == c2.getLongHeap().getHeapValue(c2heap[c2heapIndex + offsetTgt]); default: throw new RuntimeException("internal error"); } }
System.arraycopy(cas.getShortHeap().heap, 0, this.shortHeapArray, 0, shortHeapSize); final int longHeapSize = cas.getLongHeap().getSize(); this.longHeapArray = new long[longHeapSize]; System.arraycopy(cas.getLongHeap().heap, 0, this.longHeapArray, 0, longHeapSize);
private String getTraceRepOfObj( FeatureImpl fi, int v) { TypeImpl range = (TypeImpl) fi.getRange(); int rangeCode = range.getCode(); if (ll_isRefType(rangeCode)) { if (v == 0) return "null"; // FeatureStructureImpl fs = ll_getFSForRef(v); Type type = getTypeSystemImpl().ll_getTypeForCode(getTypeCode(v)); return ((type == null) ? "unknwn" : MiscImpl.elide(type.getShortName(), 5, false)) + ':' + v; } else if (isStringType(rangeCode)){ String s = this.getStringHeap().getStringForCode(v); s = MiscImpl.elide(s, 50, false); return MiscImpl.replaceWhiteSpace(s, "_"); } else if (isFloatType(rangeCode)) { return Float.toString(int2float(v)); } else if (isBooleanType(rangeCode)) { return (v == 1) ? "true" : "false"; } else if (isLongType(rangeCode)) { return Long.toString(this.getLongHeap().getHeapValue(v)); } else if (isDoubleType(rangeCode)) { return Double.toString(long2double(this.getLongHeap().getHeapValue(v))); } else { return Integer.toString(v); } }
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); }
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 ); }
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 ); }