Mercurial > hg > Members > kono > jpf-core
comparison src/main/gov/nasa/jpf/vm/ChoiceGeneratorBase.java @ 13:9d0c3f9df6e0
replaced ThreadInfo.yield() (which was bypassing SyncPolicy) with SyncPolicy.setsRescheduleCG(). The current use is only for the corner case where the last transition in the last non-daemon triggers a defect in a still runnable daemon, which we want to detect before the daemon is shut down.
Added ChoiceGenerator.set/getStateId(), which is set on the nextCg once we broke a transition and performed state matching. This can be used to determine the states in the current path without having to maintain this as a separate structure that just mirrors the CG path. There is always a 1:1 relationship between the state that caused the CG and the respective CG instance.
author | Peter Mehlitz <Peter.C.Mehlitz@nasa.gov> |
---|---|
date | Fri, 13 Mar 2015 14:07:43 -0700 |
parents | fdc263e5806b |
children |
comparison
equal
deleted
inserted
replaced
12:a51545ab397e | 13:9d0c3f9df6e0 |
---|---|
60 protected ChoiceGenerator<?> prev; | 60 protected ChoiceGenerator<?> prev; |
61 | 61 |
62 // the instruction that created this CG | 62 // the instruction that created this CG |
63 protected Instruction insn; | 63 protected Instruction insn; |
64 | 64 |
65 // the state id of the state in which the CG was created | |
66 protected int stateId; | |
67 | |
65 // and the thread that executed this insn | 68 // and the thread that executed this insn |
66 protected ThreadInfo ti; | 69 protected ThreadInfo ti; |
67 | 70 |
68 // free attributes (set on demand) | 71 // free attributes (set on demand) |
69 protected Object attr; | 72 protected Object attr; |
169 | 172 |
170 @Override | 173 @Override |
171 public void setContext(ThreadInfo tiCreator) { | 174 public void setContext(ThreadInfo tiCreator) { |
172 ti = tiCreator; | 175 ti = tiCreator; |
173 insn = tiCreator.getPC(); | 176 insn = tiCreator.getPC(); |
177 } | |
178 | |
179 @Override | |
180 public void setStateId(int stateId){ | |
181 this.stateId = stateId; | |
182 | |
183 if (isCascaded){ | |
184 getCascadedParent().setStateId(stateId); | |
185 } | |
186 } | |
187 | |
188 @Override | |
189 public int getStateId(){ | |
190 return stateId; | |
174 } | 191 } |
175 | 192 |
176 @Override | 193 @Override |
177 public String getSourceLocation() { | 194 public String getSourceLocation() { |
178 return insn.getSourceLocation(); | 195 return insn.getSourceLocation(); |