2 +----------------------------------------------------------------------+
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-present 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 #ifndef incl_HPHP_JIT_ALIGNMENT_H_
18 #define incl_HPHP_JIT_ALIGNMENT_H_
23 namespace HPHP
{ namespace jit
{
25 ///////////////////////////////////////////////////////////////////////////////
28 * Whether we're aligning at a live or a dead code point.
30 * Live alignments must use nop gaps; alignment requests in dead contexts are
31 * allowed to use various trap instructions.
33 enum class AlignContext
: uint32_t { Live
, Dead
};
38 * Not all of these will actually require alignment on all targets.
40 enum class Alignment
: uint32_t {
42 * Align to the start of the next cache line unconditionally (unless we are
43 * already aligned to one).
48 * If we are in the second half of a cache line, align to the next one.
53 * Align to the nearest valid jmp target.
58 * Alignments needed by smashable instructions.
67 constexpr auto kNumAlignments
=
68 static_cast<size_t>(Alignment::SmashJcc
) + 1;
71 * Under most architectures, the Alignments can be expressed by stipulating
72 * that the code region given by
74 * [frontier + offset, nbytes)
76 * fits into the nearest `align'-aligned and -sized line.
84 ///////////////////////////////////////////////////////////////////////////////