Ejemplo n.º 1
0
 public RawClassSpec readSpec(Transaction trans, ByteArrayBuffer reader) {
   byte[] nameBytes = readName(trans, reader);
   String className = trans.container().stringIO().read(nameBytes);
   readMetaClassID(reader); // skip
   int ancestorID = reader.readInt();
   reader.incrementOffset(Const4.INT_LENGTH); // index ID
   int numFields = reader.readInt();
   return new RawClassSpec(className, ancestorID, numFields);
 }
Ejemplo n.º 2
0
  public void read(ByteArrayBuffer reader) {
    indexAddress = reader.readInt();
    indexEntries = reader.readInt();
    indexLength = reader.readInt();

    // no longer used apparently
    /*patchAddress = */ reader.readInt();
    /*patchEntries = */ reader.readInt();
    /*patchLength = */ reader.readInt();
  }
Ejemplo n.º 3
0
 public Object read(ByteArrayBuffer buffer) {
   int size = buffer.readInt();
   int address = buffer.readInt();
   if (size > sizeLimit) {
     FreeSlotNode node = new FreeSlotNode(size);
     node.createPeer(address);
     if (Deploy.debug && Debug.xbytes) {
       debugCheckBuffer(buffer, node);
     }
     return node;
   }
   return null;
 }
Ejemplo n.º 4
0
  public final void read(ObjectContainerBase stream, ClassMetadata clazz, ByteArrayBuffer reader) {
    clazz.setAncestor(stream.classMetadataForId(reader.readInt()));

    if (clazz.callConstructor()) {
      // The logic further down checks the ancestor YapClass, whether
      // or not it is allowed, not to call constructors. The ancestor
      // YapClass may possibly have not been loaded yet.
      clazz.createConstructor(stream, clazz.classReflector(), clazz.getName(), true);
    }

    clazz.checkType();

    readIndex(stream, clazz, reader);

    clazz._aspects = createFields(clazz, reader.readInt());
    readFields(stream, reader, clazz._aspects);
  }
Ejemplo n.º 5
0
 private byte[] readName(LatinStringIO sio, ByteArrayBuffer reader) {
   if (Deploy.debug) {
     reader.readBegin(Const4.YAPCLASS);
   }
   int len = reader.readInt();
   len = len * sio.bytesPerChar();
   byte[] nameBytes = new byte[len];
   System.arraycopy(reader._buffer, reader._offset, nameBytes, 0, len);
   nameBytes = Platform4.updateClassName(nameBytes);
   reader.incrementOffset(len);
   return nameBytes;
 }
 private boolean lockFileSignalsInterruptedTransaction() {
   openLockFile();
   ByteArrayBuffer buffer = newLockFileBuffer();
   read(_lockFile, buffer);
   for (int i = 0; i < 2; i++) {
     int checkInt = buffer.readInt();
     if (checkInt != LOCK_INT) {
       closeLockFile();
       return false;
     }
   }
   closeLockFile();
   return true;
 }
Ejemplo n.º 7
0
 protected void readIndex(
     ObjectContainerBase stream, ClassMetadata clazz, ByteArrayBuffer reader) {
   int indexID = reader.readInt();
   if (!stream.maintainsIndices() || !(stream instanceof LocalObjectContainer)) {
     return;
   }
   if (btree(clazz) != null) {
     return;
   }
   clazz.index().read(stream, validIndexId(indexID));
   if (isOldClassIndex(indexID)) {
     new ClassIndexesToBTrees_5_5().convert((LocalObjectContainer) stream, indexID, btree(clazz));
     stream.setDirtyInSystemTransaction(clazz);
   }
 }
 public void completeInterruptedTransaction(int transactionId1, int transactionId2) {
   if (!File4.exists(lockFileName(_fileName))) {
     return;
   }
   if (!lockFileSignalsInterruptedTransaction()) {
     return;
   }
   ByteArrayBuffer buffer = new ByteArrayBuffer(Const4.INT_LENGTH);
   openLogFile();
   read(_logFile, buffer);
   int length = buffer.readInt();
   if (length > 0) {
     buffer = new ByteArrayBuffer(length);
     read(_logFile, buffer);
     buffer.incrementOffset(Const4.INT_LENGTH);
     readWriteSlotChanges(buffer);
   }
   deleteLockFile();
   closeLogFile();
   deleteLogFile();
 }
Ejemplo n.º 9
0
 public Object read(ByteArrayBuffer reader) {
   SlotChange change = new SlotChange(reader.readInt());
   Slot newSlot = new Slot(reader.readInt(), reader.readInt());
   change.newSlot(newSlot);
   return change;
 }
Ejemplo n.º 10
0
 public final int readMetaClassID(ByteArrayBuffer reader) {
   return reader.readInt();
 }