Switch-related cleanup
[hiphop-php.git] / hphp / runtime / vm / jit / bc-marker.cpp
blob67125e21652fca32559247db0ce8115b70ac9ce1
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-2014 Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
17 #include "hphp/runtime/vm/jit/bc-marker.h"
19 #include <folly/Format.h>
20 #include <folly/Conv.h>
22 #include "hphp/runtime/base/runtime-option.h"
23 #include "hphp/runtime/vm/jit/ssa-tmp.h"
25 namespace HPHP { namespace jit {
27 //////////////////////////////////////////////////////////////////////
29 std::string BCMarker::show() const {
30 assertx(valid());
31 return folly::format(
32 "--- bc {}{}, fp {}, spOff {} ({}){}",
33 m_sk.offset(),
34 m_sk.resumed() ? "r" : "",
35 m_fp ? folly::to<std::string>(m_fp->id()) : "_",
36 m_spOff.offset,
37 m_sk.func()->fullName()->data(),
38 m_profTransID != kInvalidTransID
39 ? folly::format(" [profTrans={}]", m_profTransID).str()
40 : std::string{}
41 ).str();
44 bool BCMarker::valid() const {
45 if (isDummy()) return true;
46 return
47 m_sk.valid() &&
48 m_sk.offset() >= m_sk.func()->base() &&
49 m_sk.offset() < m_sk.func()->past() &&
50 // When inlining is on, we may modify markers to weird values in
51 // case reentry happens.
52 (RuntimeOption::EvalHHIREnableGenTimeInlining ||
53 m_spOff.offset <= m_sk.func()->numSlotsInFrame() +
54 m_sk.func()->maxStackCells());
57 //////////////////////////////////////////////////////////////////////