Exemplo n.º 1
0
 public void write(ByteArrayBuffer writer) {
   if (slotModified()) {
     writer.writeInt(_key);
     writer.writeInt(_newSlot.address());
     writer.writeInt(_newSlot.length());
   }
 }
Exemplo n.º 2
0
 public void write(Object a_object, ByteArrayBuffer a_bytes) {
   if (Deploy.debug) {
     a_bytes.writeBegin(Const4.YAPBYTE);
   }
   a_bytes.writeByte(((Byte) a_object).byteValue());
   if (Deploy.debug) {
     a_bytes.writeEnd();
   }
 }
 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);
 }
Exemplo n.º 4
0
 Object read1(ByteArrayBuffer a_bytes) {
   if (Deploy.debug) {
     a_bytes.readBegin(Const4.YAPBYTE);
   }
   byte ret = a_bytes.readByte();
   if (Deploy.debug) {
     a_bytes.readEnd();
   }
   return new Byte(ret);
 }
Exemplo n.º 5
0
 static final void writeShort(int a_short, ByteArrayBuffer a_bytes) {
   if (Deploy.debug) {
     a_bytes.writeBegin(Const4.YAPSHORT);
   }
   for (int i = 0; i < Const4.SHORT_BYTES; i++) {
     a_bytes._buffer[a_bytes._offset++] = (byte) (a_short >> ((Const4.SHORT_BYTES - 1 - i) * 8));
   }
   if (Deploy.debug) {
     a_bytes.writeEnd();
   }
 }
Exemplo n.º 6
0
 public Slot debugReadPointerSlot(int id) {
   if (Deploy.debug) {
     readBytes(_pointerIo._buffer, id, Const4.POINTER_LENGTH);
     _pointerIo.seek(0);
     _pointerIo.readBegin(Const4.YAPPOINTER);
     int debugAddress = _pointerIo.readInt();
     int debugLength = _pointerIo.readInt();
     _pointerIo.readEnd();
     return new Slot(debugAddress, debugLength);
   }
   return null;
 }
 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;
 }
Exemplo n.º 8
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;
 }
Exemplo n.º 9
0
  public ByteArrayBuffer readBufferBySlot(Slot slot) {
    if (Slot.isNull(slot)) {
      return null;
    }

    if (DTrace.enabled) {
      DTrace.READ_SLOT.logLength(slot.address(), slot.length());
    }

    ByteArrayBuffer buffer = new ByteArrayBuffer(slot.length());

    buffer.readEncrypt(this, slot.address());
    return buffer;
  }
Exemplo n.º 10
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);
  }
Exemplo n.º 11
0
  public void write(
      final Transaction trans, final ClassMetadata clazz, final ByteArrayBuffer writer) {

    writer.writeShortString(trans, clazz.nameToWrite());

    int intFormerlyKnownAsMetaClassID = 0;
    writer.writeInt(intFormerlyKnownAsMetaClassID);

    writer.writeIDOf(trans, clazz.i_ancestor);

    writeIndex(trans, clazz, writer);

    writer.writeInt(clazz.declaredAspectCount());
    clazz.forEachDeclaredAspect(
        new Procedure4() {
          public void apply(Object arg) {
            _family._field.write(trans, clazz, (ClassAspect) arg, writer);
          }
        });
  }
Exemplo n.º 12
0
 public void writePointer(int id, Slot slot) {
   if (DTrace.enabled) {
     DTrace.WRITE_POINTER.log(id);
     DTrace.WRITE_POINTER.logLength(slot);
   }
   _pointerIo.seek(0);
   if (Deploy.debug) {
     _pointerIo.writeBegin(Const4.YAPPOINTER);
   }
   _pointerIo.writeInt(slot.address());
   _pointerIo.writeInt(slot.length());
   if (Deploy.debug) {
     _pointerIo.writeEnd();
   }
   if (Debug4.xbytes) {
     _pointerIo.checkXBytes(false);
   }
   writeBytes(_pointerIo, id, 0);
 }
Exemplo n.º 13
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;
 }
Exemplo n.º 14
0
 public final void write(ByteArrayBuffer a_writer) {
   // byte order: size, address
   a_writer.writeInt(_key);
   a_writer.writeInt(_peer._key);
 }
Exemplo n.º 15
0
 public final int readMetaClassID(ByteArrayBuffer reader) {
   return reader.readInt();
 }
Exemplo n.º 16
0
 protected void writeIndex(Transaction trans, ClassMetadata clazz, ByteArrayBuffer writer) {
   int indexID = clazz.index().write(trans);
   writer.writeInt(indexIDForWriting(indexID));
 }