Path: blob/master/src/hotspot/cpu/x86/c2_intelJccErratum_x86.hpp
41145 views
/*1* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef CPU_X86_INTELJCCERRATUM_X86_HPP25#define CPU_X86_INTELJCCERRATUM_X86_HPP2627#include "memory/allocation.hpp"28#include "utilities/globalDefinitions.hpp"2930class Block;31class Compile;32class MachNode;33class MacroAssembler;34class PhaseCFG;35class PhaseRegAlloc;3637class IntelJccErratum : public AllStatic {38private:39// Compute which 32 byte boundary an address corresponds to40static uintptr_t boundary(uintptr_t addr);41static int jcc_erratum_taint_node(MachNode* node, PhaseRegAlloc* regalloc);4243public:44static bool is_crossing_or_ending_at_32_byte_boundary(uintptr_t start_pc, uintptr_t end_pc);45static bool is_jcc_erratum_branch(const MachNode* node);46// Analyze JCC erratum branches. Affected nodes get tagged with Flag_intel_jcc_erratum.47// The function returns a conservative estimate of all required nops on all mach nodes.48static int tag_affected_machnodes(Compile* C, PhaseCFG* cfg, PhaseRegAlloc* regalloc);49// Computes the exact padding for a mach node50static int compute_padding(uintptr_t current_offset, const MachNode* mach, Block* block, uint index_in_block, PhaseRegAlloc* regalloc);51static int largest_jcc_size() { return 20; }52};5354class IntelJccErratumAlignment {55private:56MacroAssembler& _masm;57uintptr_t _start_pc;5859uintptr_t pc();6061public:62IntelJccErratumAlignment(MacroAssembler& masm, int jcc_size);63~IntelJccErratumAlignment();64};6566#endif // CPU_X86_INTELJCCERRATUM_X86_HPP67686970