edits
authorbdemsky <bdemsky@uci.edu>
Sat, 3 Aug 2019 07:05:28 +0000 (00:05 -0700)
committerbdemsky <bdemsky@uci.edu>
Sat, 3 Aug 2019 07:05:28 +0000 (00:05 -0700)
jpf.properties
src/main/gov/nasa/jpf/vm/serialize/CFSerializer.java
src/main/gov/nasa/jpf/vm/serialize/FilteringSerializer.java
src/main/gov/nasa/jpf/vm/serialize/SmartThingsConfig.java

index 57b7670b2b000341c2d8612628bd0ba49419f74d..0dd4cae31ba9e1b9c3f49b2ef7443c7526d87fb7 100644 (file)
@@ -253,7 +253,7 @@ vm.finalize = false
 
 # this is a preemption boundary specifying the max number of instructions after which we
 # break the current transition if there are other runnable threads
-vm.max_transition_length = 50000
+vm.max_transition_length = 2000000000
 
 # are thread ids of terminated threads with recycled thread objects reused when creating new
 # threads. This is required for programs that sequentially create many short living threads
index bdd63554cba8f675ada4bf645298072f5622900d..da14d02e45710d0c97db6a11db9d35377a350ed7 100644 (file)
@@ -21,6 +21,10 @@ package gov.nasa.jpf.vm.serialize;
 import java.util.Iterator;
 
 import gov.nasa.jpf.vm.ElementInfo;
+import gov.nasa.jpf.vm.StaticElementInfo;
+import gov.nasa.jpf.vm.Fields;
+import gov.nasa.jpf.util.FinalBitSet;
+import gov.nasa.jpf.vm.ClassInfo;
 import gov.nasa.jpf.vm.Instruction;
 import gov.nasa.jpf.vm.MJIEnv;
 import gov.nasa.jpf.vm.StackFrame;
@@ -79,6 +83,14 @@ public class CFSerializer extends FilteringSerializer {
       buf.add(MJIEnv.NULL);
     } else {
       ElementInfo ei = heap.get(objref);
+      ClassInfo ci = ei.getClassInfo();
+
+      if (SmartThingsConfig.instance.ignoreClass(ci)) {
+        ei.setSid(0);
+        buf.add(0);
+        return;
+      }
+      
       int sid = ei.getSid();
 
       if (positiveSid){ // count sid upwards from 1
@@ -102,29 +114,54 @@ public class CFSerializer extends FilteringSerializer {
   }
 
 
-  boolean istop;
   @Override
   protected void serializeStackFrames() {
     ThreadList tl = ks.getThreadList();
-    istop = true;
     for (Iterator<ThreadInfo> it = tl.canonicalLiveIterator(); it.hasNext(); ) {
       serializeStackFrames(it.next());
-      istop = false;
     }
   }
+
+  //Don't think we actually have static fields...so this should be safe
+  @Override
+  protected void serializeClassLoaders(){
+  }
+
+  protected void serializeClass (StaticElementInfo sei){
+    // buf.add(sei.getStatus());
+    
+    Fields fields = sei.getFields();
+    ClassInfo ci = sei.getClassInfo();
+    FinalBitSet filtered = getStaticFilterMask(ci);
+    FinalBitSet refs = getStaticRefMask(ci);
+    int max = ci.getStaticDataSize();
+    if (SmartThingsConfig.instance.staticClass(ci))
+      return;
+    for (int i = 0; i < max; i++) {
+      if (!filtered.get(i)) {
+        int v = fields.getIntValue(i);
+        if (refs.get(i)) {
+          processReference(v);
+        } else {
+          buf.add(v);
+        }
+      }
+    }
+  }
+
   
   @Override
   protected void serializeFrame(StackFrame frame){
     FramePolicy fp = getFramePolicy(frame.getMethodInfo());
     Instruction pc = frame.getPC();
     int len = frame.getTopPos()+1;
-    
-    if (fp == null || fp.includePC || istop) {
+
+    if (fp == null || fp.includePC) {
       buf.add(frame.getMethodInfo().getGlobalId());
       buf.add( pc != null ? pc.getInstructionIndex() : -1);
     }
 
-    if (fp == null || fp.includeLocals || istop) {
+    if (fp == null || fp.includeLocals) {
       buf.add(len);
       
       // unfortunately we can't do this as a block operation because that
index 2a90765f3eba8a85c1ec9f9923e95907eda52340..236a9b0d8f7b5077ac7c1d3bc5f1e6c5730e61ec 100644 (file)
@@ -448,7 +448,7 @@ public class FilteringSerializer extends AbstractSerializer implements Reference
 
   @Override
   protected int[] computeStoringData() {
-
+    
     buf.clear();
     heap = ks.getHeap();
     initReferenceQueue();
@@ -481,4 +481,4 @@ public class FilteringSerializer extends AbstractSerializer implements Reference
     }
     System.out.println(']');
   }
-}
\ No newline at end of file
+}
index 70d8589b826cb5fee26157ea580baa7812bc2baa..94fc0f3aabd1cbadfda4026a009af4735caa5fc5 100644 (file)
@@ -31,7 +31,35 @@ import gov.nasa.jpf.vm.serialize.AmmendableFilterConfiguration.FrameAmmendment;
 public class SmartThingsConfig
   implements FieldAmmendment, FrameAmmendment {
 
-  boolean ignoreClass(ClassInfo ci) {
+  public boolean staticClass(ClassInfo ci) {
+    String pName = ci.getName();
+    if (pName.startsWith("java."))
+      return true;
+
+    if (pName.startsWith("sun."))
+      return true;
+
+    if (pName.startsWith("com.sun"))
+      return true;
+
+    if (pName.startsWith("org."))
+      return true;
+
+    if (pName.startsWith("groovy."))
+      return true;
+
+    if (pName.startsWith("groovyjarjarasm."))
+      return true;
+
+    if (pName.startsWith("gov."))
+      return true;
+
+    if (pName.startsWith("["))
+      return true;
+
+    return false;
+  }
+  public boolean ignoreClass(ClassInfo ci) {
     String pName = ci.getName();
     if (pName.startsWith("org")) {
       if (pName.startsWith("org.codehaus.groovy")) {
@@ -53,11 +81,10 @@ public class SmartThingsConfig
         if (pName.startsWith("java.lang.ClassLoader")) {
           return true;
         }
-        if (pName.startsWith("java.lang.Thread$State")) {
-          return true;
-        }
         if (pName.startsWith("java.lang.Class"))
           return true;
+        if (pName.startsWith("java.lang.Thread"))
+          return true;
         if (pName.startsWith("java.lang.Package"))
           return true;
       } else {
@@ -104,7 +131,8 @@ public class SmartThingsConfig
       return true;
     if (pName.startsWith("sun.net.www"))
       return true;
-    
+    if (pName.startsWith("gov.nasa"))
+      return true;
     return false;
   }