Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/cpu/x86/c2_intelJccErratum_x86.hpp
41145 views
1
/*
2
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*
23
*/
24
25
#ifndef CPU_X86_INTELJCCERRATUM_X86_HPP
26
#define CPU_X86_INTELJCCERRATUM_X86_HPP
27
28
#include "memory/allocation.hpp"
29
#include "utilities/globalDefinitions.hpp"
30
31
class Block;
32
class Compile;
33
class MachNode;
34
class MacroAssembler;
35
class PhaseCFG;
36
class PhaseRegAlloc;
37
38
class IntelJccErratum : public AllStatic {
39
private:
40
// Compute which 32 byte boundary an address corresponds to
41
static uintptr_t boundary(uintptr_t addr);
42
static int jcc_erratum_taint_node(MachNode* node, PhaseRegAlloc* regalloc);
43
44
public:
45
static bool is_crossing_or_ending_at_32_byte_boundary(uintptr_t start_pc, uintptr_t end_pc);
46
static bool is_jcc_erratum_branch(const MachNode* node);
47
// Analyze JCC erratum branches. Affected nodes get tagged with Flag_intel_jcc_erratum.
48
// The function returns a conservative estimate of all required nops on all mach nodes.
49
static int tag_affected_machnodes(Compile* C, PhaseCFG* cfg, PhaseRegAlloc* regalloc);
50
// Computes the exact padding for a mach node
51
static int compute_padding(uintptr_t current_offset, const MachNode* mach, Block* block, uint index_in_block, PhaseRegAlloc* regalloc);
52
static int largest_jcc_size() { return 20; }
53
};
54
55
class IntelJccErratumAlignment {
56
private:
57
MacroAssembler& _masm;
58
uintptr_t _start_pc;
59
60
uintptr_t pc();
61
62
public:
63
IntelJccErratumAlignment(MacroAssembler& masm, int jcc_size);
64
~IntelJccErratumAlignment();
65
};
66
67
#endif // CPU_X86_INTELJCCERRATUM_X86_HPP
68
69
70