Class CommonSerDesSequential


  • public class CommonSerDesSequential
    extends java.lang.Object
    Common de/serialization for plain binary and compressed binary form 4 which both used to walk the cas using the sequential, incrementing id approach Lifecycle: There is 0/1 instance per CAS, representing the FSs at some point in time in that CAS. Creation: serialization (for delta serialization, the csds made when deserialization was done is reused, if available Updates cannot add to the reachables). non-delta deserialization delta deserialization uses previous one Reset: CAS Reset API call (for optimization - used after all delta deserializations into a particular CAS are complete. Logical constraints: - delta de/serialization must use an existing version of this, -- set during a previous non-delta de/serialization -- or created just in time via a scan of the cas
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) Int2ObjHashMap<TOP,​TOP> addr2fs
      a map from the modelled (v2 style) FS addr to the V3 FS created when serializing (non-delta), deserializing (non-delta) augmented when deserializing(delta) used when deserializing (delta and non-delta) retained after deserializing (in case of subsequent delta (multiple) deserializations being combined) For delta, the addr is the modeled addr for the full CAS including both above and below the line.
      private CASImpl baseCas
      The associated CAS
      (package private) Obj2IntIdentityHashMap<TOP> fs2addr
      a map from a fs to its addr in the modeled heap, == v2 style addr created during serialization and deserialization used during serialization to create addr info for index info serialization For delta, the addr is the modeled addr for the full CAS including both above and below the line.
      private int heapEnd
      The first free (available) simulated heap addr, also the last addr + length of that
      private java.util.List<TOP> pending  
      private java.util.List<TOP> sortedFSs
      The FSs in this list are not necessarily sequential, but is in ascending (simulated heap) order, needed for V2 compatibility of serialized forms.
      static boolean TRACE_SETUP  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) void addFS​(TOP fs, int addr)
      Must call in fs sorted order
      (package private) void addFS1​(TOP fs, int addr)  
      (package private) void addFSunordered​(TOP fs, int addr)
      For out of order calls
      (package private) void clear()  
      (package private) int getHeapEnd()  
      (package private) java.util.List<TOP> getSortedFSs()  
      boolean isEmpty()  
      private void merge()  
      (package private) void setHeapEnd​(int heapEnd)  
      (package private) java.util.List<TOP> setup​(MarkerImpl mark, int fromAddr)
      Scan all indexed + reachable FSs, sorted, and - create two maps from those to/from the int offsets in the simulated main heap - add all the (filtered - above the mark) FSs to the sortedFSs - set the heapEnd
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • fs2addr

        final Obj2IntIdentityHashMap<TOP> fs2addr
        a map from a fs to its addr in the modeled heap, == v2 style addr created during serialization and deserialization used during serialization to create addr info for index info serialization For delta, the addr is the modeled addr for the full CAS including both above and below the line.
      • addr2fs

        final Int2ObjHashMap<TOP,​TOP> addr2fs
        a map from the modelled (v2 style) FS addr to the V3 FS created when serializing (non-delta), deserializing (non-delta) augmented when deserializing(delta) used when deserializing (delta and non-delta) retained after deserializing (in case of subsequent delta (multiple) deserializations being combined) For delta, the addr is the modeled addr for the full CAS including both above and below the line.
      • sortedFSs

        private final java.util.List<TOP> sortedFSs
        The FSs in this list are not necessarily sequential, but is in ascending (simulated heap) order, needed for V2 compatibility of serialized forms. This is populated either during deserialization, or for serialization, from indexed + reachable. Before accessing this, any pending items must be merged (sorting done lazily)
      • pending

        private final java.util.List<TOP> pending
      • baseCas

        private final CASImpl baseCas
        The associated CAS
      • heapEnd

        private int heapEnd
        The first free (available) simulated heap addr, also the last addr + length of that
    • Constructor Detail

      • CommonSerDesSequential

        public CommonSerDesSequential​(CASImpl cas)
    • Method Detail

      • isEmpty

        public boolean isEmpty()
      • addFS

        void addFS​(TOP fs,
                   int addr)
        Must call in fs sorted order
        Parameters:
        fs -
      • addFS1

        void addFS1​(TOP fs,
                    int addr)
      • addFSunordered

        void addFSunordered​(TOP fs,
                            int addr)
        For out of order calls
        Parameters:
        fs -
      • clear

        void clear()
      • setup

        java.util.List<TOP> setup​(MarkerImpl mark,
                                  int fromAddr)
        Scan all indexed + reachable FSs, sorted, and - create two maps from those to/from the int offsets in the simulated main heap - add all the (filtered - above the mark) FSs to the sortedFSs - set the heapEnd
        Parameters:
        mark - null or the mark
        fromAddr - often 1 but sometimes the mark next fsid
        Returns:
        all (not filtered) FSs sorted
      • getSortedFSs

        java.util.List<TOP> getSortedFSs()
        Returns:
        sorted FSs above mark if mark set, otherwise all, sorted
      • getHeapEnd

        int getHeapEnd()
      • setHeapEnd

        void setHeapEnd​(int heapEnd)
      • merge

        private void merge()