@Test public void primitives2Metadata() { unsafeClassHeaderSize64BitCompressedOops(new Primitives2()); SerializationMetadata serializationMetadata = extractMetadata(Introspect.fields(Primitives2.class)); assertEquals(OBJECT_HEADER_SIZE, serializationMetadata.start); assertEquals(12, serializationMetadata.length); }
public static SerializationMetadata extractMetadata(List<Field> fields) { if (fields.isEmpty()) return EmptyObjectMetadata; Offsets offsets = minMaxOffsets(fields); long totalSize = OBJECT_HEADER_SIZE + offsets.max - offsets.min + 1; return new SerializationMetadata(offsets.min, padToObjectAlignment(totalSize) - OBJECT_HEADER_SIZE); }
DirectSerializationMetadata { public static SerializationMetadata extractMetadata(List<Field> fields) { if (fields.isEmpty()) return EmptyObjectMetadata; Offsets offsets = minMaxOffsets(fields); long totalSize = OBJECT_HEADER_SIZE + offsets.max - offsets.min + 1; return new SerializationMetadata(offsets.min, padToObjectAlignment(totalSize) - OBJECT_HEADER_SIZE); } }
DirectSerializationMetadata { public static SerializationMetadata extractMetadata(List<Field> fields) { if (fields.isEmpty()) return EmptyObjectMetadata; Offsets offsets = minMaxOffsets(fields); long totalSize = OBJECT_HEADER_SIZE + offsets.max - offsets.min + 1; return new SerializationMetadata(offsets.min, padToObjectAlignment(totalSize) - OBJECT_HEADER_SIZE); }  }
DirectSerializationMetadata { public static SerializationMetadata extractMetadata(List<Field> fields) { if (fields.isEmpty()) return EmptyObjectMetadata; Offsets offsets = minMaxOffsets(fields); long totalSize = OBJECT_HEADER_SIZE + offsets.max - offsets.min + 1; return new SerializationMetadata(offsets.min, padToObjectAlignment(totalSize) - OBJECT_HEADER_SIZE); }  static SerializationMetadata extractMetadata(List<Field> fields); static SerializationMetadata extractMetadataForPartialCopy(List<Field> fields); }
DirectSerializationMetadata { public static SerializationMetadata extractMetadata(List<Field> fields) { if (fields.isEmpty()) return EmptyObjectMetadata; Offsets offsets = minMaxOffsets(fields); long totalSize = OBJECT_HEADER_SIZE + offsets.max - offsets.min + 1; return new SerializationMetadata(offsets.min, padToObjectAlignment(totalSize) - OBJECT_HEADER_SIZE); }  static SerializationMetadata extractMetadata(List<Field> fields); static SerializationMetadata extractMetadataForPartialCopy(List<Field> fields);  }