Exemplo n.º 1
0
 /* This method returns the hash code of this value. */
 public final int hashCode() {
   long fp = this.fingerPrint(FP64.New());
   int high = (int) (fp >> 32);
   int low = (int) fp;
   return high ^ low;
 }
Exemplo n.º 2
0
  /** The processing method */
  public void process() {
    ToolIO.cleanToolObjects(TLCGlobals.ToolId);
    // UniqueString.initialize();

    // a JMX wrapper that exposes runtime statistics
    TLCStandardMBean modelCheckerMXWrapper = TLCStandardMBean.getNullTLCStandardMBean();

    // SZ Feb 20, 2009: extracted this method to separate the
    // parameter handling from the actual processing
    try {
      // Initialize:
      if (fromChkpt != null) {
        // We must recover the intern var table as early as possible
        UniqueString.internTbl.recover(fromChkpt);
      }
      if (cleanup && fromChkpt == null) {
        // clean up the states directory only when not recovering
        FileUtil.deleteDir(TLCGlobals.metaRoot, true);
      }
      FP64.Init(fpIndex);

      // Start checking:
      if (isSimulate) {
        // random simulation
        RandomGenerator rng = new RandomGenerator();
        if (noSeed) {
          seed = rng.nextLong();
          rng.setSeed(seed);
        } else {
          rng.setSeed(seed, aril);
        }
        MP.printMessage(EC.TLC_MODE_SIMU, String.valueOf(seed));
        Simulator simulator =
            new Simulator(
                mainFile,
                configFile,
                null,
                deadlock,
                traceDepth,
                Long.MAX_VALUE,
                rng,
                seed,
                true,
                resolver,
                specObj);
        // The following statement moved to Spec.processSpec by LL on 10 March 2011
        //                MP.printMessage(EC.TLC_STARTING);
        instance = simulator;
        simulator.simulate();
      } else {
        // model checking
        MP.printMessage(EC.TLC_MODE_MC);

        AbstractChecker mc = null;
        if (TLCGlobals.DFIDMax == -1) {
          mc =
              new ModelChecker(
                  mainFile,
                  configFile,
                  dumpFile,
                  deadlock,
                  fromChkpt,
                  resolver,
                  specObj,
                  (long) fpMemSize,
                  fpBits);
          TLCGlobals.mainChecker = (ModelChecker) mc;
          modelCheckerMXWrapper = new ModelCheckerMXWrapper((ModelChecker) mc);
        } else {
          mc =
              new DFIDModelChecker(
                  mainFile, configFile, dumpFile, deadlock, fromChkpt, true, resolver, specObj);
        }
        // The following statement moved to Spec.processSpec by LL on 10 March 2011
        //                MP.printMessage(EC.TLC_STARTING);
        instance = mc;
        mc.modelCheck();
      }
    } catch (Throwable e) {
      if (e instanceof StackOverflowError) {
        System.gc();
        MP.printError(EC.SYSTEM_STACK_OVERFLOW, e);
      } else if (e instanceof OutOfMemoryError) {
        System.gc();
        MP.printError(EC.SYSTEM_OUT_OF_MEMORY, e);
      } else if (e instanceof RuntimeException) {
        // SZ 29.07.2009
        // printing the stack trace of the runtime exceptions
        MP.printError(EC.GENERAL, e);
        // e.printStackTrace();
      } else {
        MP.printError(EC.GENERAL, e);
      }
    } finally {
      modelCheckerMXWrapper.unregister();
      MP.printMessage(EC.TLC_FINISHED);
      MP.flush();
    }
  }