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 #include "hphp/runtime/vm/jit/align-arm.h"
19 #include "hphp/runtime/vm/jit/align-internal.h"
20 #include "hphp/runtime/vm/jit/smashable-instr-arm.h"
22 #include "hphp/util/data-block.h"
23 #include "hphp/vixl/a64/macro-assembler-a64.h"
25 #include <folly/Bits.h>
29 namespace HPHP
{ namespace jit
{ namespace arm
{
31 ///////////////////////////////////////////////////////////////////////////////
36 * Targets of jmps on arm must be aligned to instruction size
38 constexpr size_t kJmpTargetAlign
= vixl::kInstructionSize
;
41 static DECLARE_ALIGN_TABLE(s_table
);
43 static void pad(CodeBlock
& cb
, AlignContext context
, size_t bytes
) {
44 vixl::MacroAssembler a
{ cb
};
45 auto const begin
= cb
.frontier();
48 case AlignContext::Live
: {
49 assertx(((bytes
& 3) == 0) && "alignment must be multiple of 4");
50 for (; bytes
> 0; bytes
-= 4) {
56 case AlignContext::Dead
: {
62 if (bytes
> 0) pad(cb
, AlignContext::Live
, bytes
);
70 DEFINE_ALIGN_TABLE(AlignImpl::s_table
);
74 ///////////////////////////////////////////////////////////////////////////////
76 bool is_aligned(TCA frontier
, Alignment alignment
) {
77 return jit::is_aligned
<AlignImpl
>(frontier
, alignment
);
80 void align(CodeBlock
& cb
, CGMeta
* meta
,
81 Alignment alignment
, AlignContext context
) {
82 return jit::align
<AlignImpl
>(cb
, meta
, alignment
, context
);
85 ///////////////////////////////////////////////////////////////////////////////