forked from facebook/hhvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalignment.h
More file actions
88 lines (74 loc) · 2.44 KB
/
alignment.h
File metadata and controls
88 lines (74 loc) · 2.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
+----------------------------------------------------------------------+
| HipHop for PHP |
+----------------------------------------------------------------------+
| Copyright (c) 2010-2016 Facebook, Inc. (http://www.facebook.com) |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
*/
#ifndef incl_HPHP_JIT_ALIGNMENT_H_
#define incl_HPHP_JIT_ALIGNMENT_H_
#include <cstdint>
#include <string>
namespace HPHP { namespace jit {
///////////////////////////////////////////////////////////////////////////////
/*
* Whether we're aligning at a live or a dead code point.
*
* Live alignments must use nop gaps; alignment requests in dead contexts are
* allowed to use various trap instructions.
*/
enum class AlignContext : uint32_t { Live, Dead };
/*
* What to align to.
*
* Not all of these will actually require alignment on all targets.
*/
enum class Alignment : uint32_t {
/*
* Align to the start of the next cache line unconditionally (unless we are
* already aligned to one).
*/
CacheLine = 0,
/*
* If we are in the second half of a cache line, align to the next one.
*/
CacheLineRoundUp,
/*
* Align to the nearest valid jmp target.
*/
JmpTarget,
/*
* Alignments needed by smashable instructions.
*/
SmashMovq,
SmashCmpq,
SmashCall,
SmashJmp,
SmashJcc,
};
constexpr auto kNumAlignments =
static_cast<size_t>(Alignment::SmashJcc) + 1;
/*
* Under most architectures, the Alignments can be expressed by stipulating
* that the code region given by
*
* [frontier + offset, nbytes)
*
* fits into the nearest `align'-aligned and -sized line.
*/
struct AlignInfo {
size_t align;
size_t nbytes;
size_t offset;
};
///////////////////////////////////////////////////////////////////////////////
}}
#endif