Example #1
0
  @Override
  public void choiceGeneratorSet(VM vm, ChoiceGenerator<?> newCG) {
    ChoiceGenerator<?> cg = VM.getVM().getChoiceGenerator();
    if (cg instanceof ThreadChoiceGenerator) {
      threadCGs++;

      Instruction insn = cg.getInsn();
      if (insn instanceof JVMFieldInstruction) {
        sharedAccessCGs++;
      } else if (insn instanceof LockInstruction || insn instanceof JVMInvokeInstruction) {
        monitorCGs++;
      } else if (insn instanceof EXECUTENATIVE) {
        MethodInfo mi = insn.getMethodInfo();
        if (mi != null) {
          ClassInfo ci = mi.getClassInfo();
          if (ci != null) {
            if (ci.isObjectClassInfo()) {
              // its got to be either a wait or a notify since we know the java.lang.Object methods
              signalCGs++;
            } else if (ci.isThreadClassInfo()) {
              threadApiCGs++;
            }
          } else {
            // Hmm - a CG from a synthetic method?
          }
        } else {
          // even more Hmmm - a GC from a synthesized instruction
        }
      } else {
        breakTransitionCGs++; // e.g. max_transition_length or idleLoop breakers
      }
    } else {
      dataCGs++;
    }
  }