JavaFlow

From BP Wiki
Revision as of 11:35, 16 January 2014 by Assaf (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

BPmc and JavaFlow

BPJ uses the package javaflow to perform backtracking as needed for model checking Depending on the run mode, BPJ instrument the application for javaflow�(user may observe that some objects are instantiated twice – this should OK). Backtracking uses javaflow to (save and) restore the thread’s stack using an object called “Continuation”. The stack of a b-thread contains All non-static fields/variables of the b-thread class and all variables defined in-line in runBThread. The stack does not contain objects. Problem 1: what if a stack variable was a pointer to an object that is not on the stack? - how do we keep them synchronized, or (in other words), what if the state of a b-thread also depends on an object? Answer 1: BPJ serializes the Continuation. Serialization translates each field and each object pointed to from the Continuation into a bitstream. Deserialization turns such bit streams into program objects. Problem 2: When two pointers on the stack point to the same object, after deserialization we have two copies of the object. Answer 2: Do not use “==“ between objects that are part of the state. Instead – use equals() method. A default equals() method based on object ids already exists for events.