Exemplo n.º 1
0
bool in(StatsSS& env, const bc::FCallBuiltin& op) {
  ++env.stats.builtins.totalBuiltins;

  bool reducible = op.arg1 > 0;
  for (auto i = uint32_t{0}; i < op.arg1; ++i) {
    auto t = topT(env, i);
    auto const v = tv(t);
    if (!v || v->m_type == KindOfUninit) {
      reducible = false;
      break;
    }
  }

  default_dispatch(env, op);

  auto builtin = op.str3;
  {
    BuiltinInfo::accessor acc;
    auto inserted = env.stats.builtins.builtinsInfo.insert(acc, builtin);
    if (inserted) {
      auto f = env.index.resolve_func(env.ctx, builtin);
      auto t = env.index.lookup_return_type(env.ctx, f);
      acc->second = std::make_tuple(t, 1, 0);
    } else {
      ++std::get<1>(acc->second);
      if (reducible) ++std::get<2>(acc->second);
    }
  }

  return true;
}
Exemplo n.º 2
0
// {{{ 早さ最適化経路
void bfsFast(void)
{
	int i;
	end = 0;
	top = 0;
	int *dp;
	dp = malloc((n + 1) * sizeof(int));
	for (i = 0; i < n; i++) dp[i] = INF;
	push(startStation, startTime, 0);

	while(top != end) {
		int s = topS();
		int t = topT();
		int c = topC();
		pop();
		for (i = 0; i < nextTransLast[s]; i++) {
			int currentS = nextTrans[s][i];
			int currentC = c;
			int currentT = t;
			if (s != currentS) currentC++;
			if (dp[currentS] > currentT) {
				dp[currentS] = currentT;
				way_copy(currentS, s);
				way_pb(currentS, currentS, currentT);
				if (currentS != goal) push(currentS, currentT, currentC);
			}
			int reachS = nextGo[currentS];
			if (reachS == - 1) continue;
			int reachC = currentC;
			int reachT = findTime(currentS, currentT); //timeArriveをかえす
			if (dp[reachS] > reachT) {
				dp[reachS] = reachT;
				way_copy(reachS, s);
				way_pb(reachS, currentS, currentT);
				way_pb(reachS, reachS, reachT);
				push(reachS, reachT, reachC);
			}
		}
	}
}