Esempio n. 1
0
File: state.c Progetto: ysm001/slim
/* まっさらなState構造体をmallocして返してもらう */
State *state_make_minimal()
{
  State *new_s = LMN_MALLOC(State);
  new_s->data             = NULL;
  new_s->state_name       = 0x00U;
  new_s->flags            = 0x00U;
  new_s->flags2           = 0x00U;
  new_s->flags3           = 0x00U;
  new_s->local_flags      = 0x00U;
  new_s->hash             = 0;
  new_s->next             = NULL;
  new_s->successors       = NULL;
  new_s->successor_num    = 0;
  new_s->parent           = NULL;
  new_s->state_id         = 0;
  new_s->map              = NULL;
  new_s->expander_id      = LONG_MAX;

  state_expand_lock_init(new_s);
  s_set_fresh(new_s);

#ifdef KWBT_OPT
  if (lmn_env.opt_mode != OPT_NONE) {
    new_s->cost = lmn_env.opt_mode == OPT_MINIMIZE ? ULONG_MAX : 0;
  }
#endif

#ifdef PROFILE
  if (lmn_env.profile_level >= 3) {
    profile_add_space(PROFILE_SPACE__STATE_OBJECT, sizeof(struct State));
  }
#endif
  return new_s;
}
Esempio n. 2
0
memory_pool *memory_pool_new(int s)
{
  memory_pool *res = LMN_MALLOC(memory_pool);

  res->sizeof_element = ALIGNED_SIZE(s);
  res->block_head = 0;
  res->free_head = 0;

  /* fprintf(stderr, "this memory_pool allocate %d, aligned as %d\n", s, res->sizeof_element); */

  return res;
}
Esempio n. 3
0
LmnWorkerGroup *lmn_workergroup_make(AutomataRef a, Vector *psyms, int thread_num)
{
  LmnWorkerGroup *wp;
  BOOL flags;

  wp = LMN_MALLOC(LmnWorkerGroup);

  /* worker pool の構築と初期設定 */
  wp->terminated  = FALSE;
  wp->worker_num  = thread_num;
  wp->stop        = FALSE;

  wp->do_search     = FALSE;
  wp->do_exhaustive = FALSE;
  wp->do_para_algo  = FALSE;
  wp->mc_exit       = FALSE;
  wp->error_exist   = FALSE;

  wp->opt_end_state = NULL;

#ifdef KWBT_OPT
  if (thread_num >= 2 && lmn_env.opt_mode != OPT_NONE) {
    wp->ewlock = ewlock_make(1U, DEFAULT_WLOCK_NUM);
  } else
#endif
    wp->ewlock = NULL;

  flags = workers_flags_init(wp, a);
#ifdef OPT_WORKERS_SYNC
  wp->synchronizer  = thread_num;
#else
  lmn_barrier_init(&wp->synchronizer, workers_entried_num(wp));
#endif
  workers_gen(wp, workers_entried_num(wp), a, psyms, flags);
  workers_ring_alignment(wp);

  return wp;
}
Esempio n. 4
0
/* まっさらなLmnWorkerオブジェクトをmallocして返す */
inline LmnWorker *lmn_worker_make_minimal()
{
  LmnWorker *w = LMN_MALLOC(LmnWorker);

  w->id        = 0;
  w->f_safe    = 0x00U;
  w->f_exec    = 0x00U;
  w->f_end     = FALSE;
  w->f_end2    = FALSE;
  w->wait      = FALSE;
  w->states    = NULL;
  w->next      = NULL;
  w->start     = NULL;
  w->check     = NULL;
  w->invalid_seeds = NULL;
  w->cycles    = NULL;
  w->expand = 0;
  w->red =0;

  lmn_mc_obj_init(&w->generator, w);
  lmn_mc_obj_init(&w->explorer, w);

  return w;
}