You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2018/01/02 20:30:27 UTC

svn commit: r1819891 - /uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes6.java

Author: schor
Date: Tue Jan  2 20:30:27 2018
New Revision: 1819891

URL: http://svn.apache.org/viewvc?rev=1819891&view=rev
Log:
no Jira mainly comment change

Modified:
    uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes6.java

Modified: uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes6.java
URL: http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes6.java?rev=1819891&r1=1819890&r2=1819891&view=diff
==============================================================================
--- uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes6.java (original)
+++ uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BinaryCasSerDes6.java Tue Jan  2 20:30:27 2018
@@ -439,16 +439,19 @@ public class BinaryCasSerDes6 implements
   final private DataInputStream[] dataInputs = new DataInputStream[NBR_SLOT_KIND_ZIP_STREAMS];
   final private Inflater[] inflaters = new Inflater               [NBR_SLOT_KIND_ZIP_STREAMS];
 
-  /** the "fixups" for relative heap refs */
+  /** the "fixups" for relative heap refs
+   *  actions set slot values 
+   */
   final private List<Runnable> fixupsNeeded = new ArrayList<>();
   final private List<Runnable> uimaSerializableFixups = new ArrayList<>();
 //  /** hold on to FS prior to getting them indexed to prevent them from being GC'd */
 //  final private List<TOP> preventFsGc = new ArrayList<>();
 
   /** 
+   * Deferred actions to set Feature Slots of feature structures.
    * the deferrals needed when deserializing a subtype of AnnotationBase before the sofa is known
    * Also for Sofa creation where some fields are final
-   * */
+   */
   final private List<Runnable> singleFsDefer = new ArrayList<>(); 
   
   /** used for deferred creation */
@@ -1754,7 +1757,7 @@ public class BinaryCasSerDes6 implements
     }
     
 //    stringTableOffset = isReadingDelta ? (stringHeapObj.getSize() - 1) : 0;
-    nextFsId = isReadingDelta ? (cas.getLastUsedFsId() + 1) : 0;
+    nextFsId = isReadingDelta ? cas.peekNextFsId() : 0;
     
 //    if (!isReadingDelta) {
 //      heapObj.reinitSizeOnly(1);
@@ -1793,7 +1796,12 @@ public class BinaryCasSerDes6 implements
      * Read in new FSs being deserialized and add them to heap
      **********************************************************/
     
-    // currentFsId used when debugging, only
+    // currentFsId is ID of next to be deserialized FS
+    //   only incremented when something is "stored", not skipped
+    // nextFsAddr only used for loop  termination , pre v3
+    //   could be gt than fsId, because some FSs are "skipped" in deserialization
+    
+    // currentFsId only used in error message
     for (int currentFsId = nextFsId, nbrFSs = 0, nextFsAddr = 1; 
          this.bcsd.isBeforeV3 
            ? nextFsAddr < totalMappedHeapSize
@@ -1802,6 +1810,7 @@ public class BinaryCasSerDes6 implements
          nextFsAddr += this.bcsd.isBeforeV3 
                          ? tgtType.getFsSpaceReq(lastArrayLength)
                          : 0) {
+     
       final int tgtTypeCode = readVnumber(typeCode_dis); // get type code
 //      final int adjTgtTypeCode = tgtTypeCode + ((this.bcsd.isBeforeV3 && tgtTypeCode > TypeSystemConstants.lastBuiltinV2TypeCode) 
 //          ? TypeSystemConstants.numberOfNewBuiltInsSinceV2
@@ -1921,8 +1930,8 @@ public class BinaryCasSerDes6 implements
               r.run();
             }
           }
-        }
-      }
+        }  // end of handling deferred current fs
+      } // of not-an-array
 //      if (storeIt) {
 //        prevFsByType[srcType.getCode()] = currentFs;  // make this one the "prev" one for subsequent testing
 //        //debug
@@ -1934,9 +1943,10 @@ public class BinaryCasSerDes6 implements
 //                 need to have read skip slots not present in src
 //      targetHeapUsed += incrToNextFs(heap, currentFsId, tgtTypeInfo);  // typeInfo is target type info
       fsStartIndexes.addSrcFsForTgt(currentFs, storeIt);
-      currentFsId += storeIt ? 1 : 0;
-    }
+      currentFsId += storeIt ? cas.lastV2IdIncr() : 0;
+    } // end of for loop over items in main heap
 
+   
     for (Runnable r : fixupsNeeded) {
       r.run();
     }