8249165: Remove unneeded nops introduced by 8234160 changes

Check for branch instruction at the end of code block

Reviewed-by: vlivanov
This commit is contained in:
Vladimir Kozlov 2020-07-13 16:41:01 -07:00
parent 7436ef236e
commit c4f835b3a7
3 changed files with 5 additions and 8 deletions

View File

@ -45,11 +45,11 @@ bool IntelJccErratum::is_crossing_or_ending_at_32_byte_boundary(uintptr_t start_
return boundary(start_pc) != boundary(end_pc);
}
bool IntelJccErratum::is_jcc_erratum_branch(const Block* block, const MachNode* node, uint node_index) {
bool IntelJccErratum::is_jcc_erratum_branch(const MachNode* node) {
if (node->is_MachCall() && !node->is_MachCallJava()) {
return true;
}
return node_index == (block->number_of_nodes() - 1);
return node->is_MachBranch();
}
int IntelJccErratum::jcc_erratum_taint_node(MachNode* node, PhaseRegAlloc* regalloc) {
@ -70,7 +70,7 @@ int IntelJccErratum::tag_affected_machnodes(Compile* C, PhaseCFG* cfg, PhaseRegA
continue;
}
MachNode* m = node->as_Mach();
if (is_jcc_erratum_branch(block, m, j)) {
if (is_jcc_erratum_branch(m)) {
// Found a root jcc erratum branch, flag it as problematic
nop_size += jcc_erratum_taint_node(m, regalloc);

View File

@ -43,7 +43,7 @@ private:
public:
static bool is_crossing_or_ending_at_32_byte_boundary(uintptr_t start_pc, uintptr_t end_pc);
static bool is_jcc_erratum_branch(const Block* block, const MachNode* node, uint node_index);
static bool is_jcc_erratum_branch(const MachNode* node);
// Analyze JCC erratum branches. Affected nodes get tagged with Flag_intel_jcc_erratum.
// The function returns a conservative estimate of all required nops on all mach nodes.
static int tag_affected_machnodes(Compile* C, PhaseCFG* cfg, PhaseRegAlloc* regalloc);

View File

@ -1188,10 +1188,7 @@ void PhaseOutput::pd_perform_mach_node_analysis() {
}
int MachNode::pd_alignment_required() const {
PhaseOutput* output = Compile::current()->output();
Block* block = output->block();
int index = output->index();
if (VM_Version::has_intel_jcc_erratum() && IntelJccErratum::is_jcc_erratum_branch(block, this, index)) {
if (VM_Version::has_intel_jcc_erratum() && IntelJccErratum::is_jcc_erratum_branch(this)) {
// Conservatively add worst case padding. We assume that relocInfo::addr_unit() is 1 on x86.
return IntelJccErratum::largest_jcc_size() + 1;
} else {