Skip to content

Commit 60930a3

Browse files
author
Daniel Lundén
committed
8367397: Improve naming and terminology in regmask.hpp and regmask.cpp
Reviewed-by: epeter, rcastanedalo, dlong
1 parent 58c9fbc commit 60930a3

File tree

12 files changed

+135
-120
lines changed

12 files changed

+135
-120
lines changed

src/hotspot/share/adlc/output_h.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ void ArchDesc::buildMachRegisterNumbers(FILE *fp_hpp) {
9898
}
9999

100100
fprintf(fp_hpp, "\n// Size of register-mask in ints\n");
101-
fprintf(fp_hpp, "#define RM_SIZE %d\n", RegisterForm::RegMask_Size());
101+
fprintf(fp_hpp, "#define RM_SIZE_IN_INTS %d\n", RegisterForm::RegMask_Size());
102102
fprintf(fp_hpp, "// Unroll factor for loops over the data in a RegMask\n");
103103
fprintf(fp_hpp, "#define FORALL_BODY ");
104104
int len = RegisterForm::RegMask_Size();

src/hotspot/share/opto/chaitin.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,8 +1577,8 @@ uint PhaseChaitin::Select( ) {
15771577
// Re-insert into the IFG
15781578
_ifg->re_insert(lidx);
15791579
if( !lrg->alive() ) continue;
1580-
// capture allstackedness flag before mask is hacked
1581-
const int is_allstack = lrg->mask().is_AllStack();
1580+
// capture infinitestackedness flag before mask is hacked
1581+
const int is_infinite_stack = lrg->mask().is_infinite_stack();
15821582

15831583
// Yeah, yeah, yeah, I know, I know. I can refactor this
15841584
// to avoid the GOTO, although the refactored code will not
@@ -1629,7 +1629,7 @@ uint PhaseChaitin::Select( ) {
16291629
}
16301630
}
16311631
}
1632-
//assert(is_allstack == lrg->mask().is_AllStack(), "nbrs must not change AllStackedness");
1632+
//assert(is_infinite_stack == lrg->mask().is_infinite_stack(), "nbrs must not change InfiniteStackedness");
16331633
// Aligned pairs need aligned masks
16341634
assert(!lrg->_is_vector || !lrg->_fat_proj, "sanity");
16351635
if (lrg->num_regs() > 1 && !lrg->_fat_proj) {
@@ -1640,9 +1640,9 @@ uint PhaseChaitin::Select( ) {
16401640
OptoReg::Name reg = choose_color( *lrg, chunk );
16411641

16421642
//---------------
1643-
// If we fail to color and the AllStack flag is set, trigger
1643+
// If we fail to color and the infinite flag is set, trigger
16441644
// a chunk-rollover event
1645-
if(!OptoReg::is_valid(OptoReg::add(reg,-chunk)) && is_allstack) {
1645+
if (!OptoReg::is_valid(OptoReg::add(reg, -chunk)) && is_infinite_stack) {
16461646
// Bump register mask up to next stack chunk
16471647
chunk += RegMask::CHUNK_SIZE;
16481648
lrg->Set_All();
@@ -1651,7 +1651,7 @@ uint PhaseChaitin::Select( ) {
16511651

16521652
//---------------
16531653
// Did we get a color?
1654-
else if( OptoReg::is_valid(reg)) {
1654+
else if (OptoReg::is_valid(reg)) {
16551655
#ifndef PRODUCT
16561656
RegMask avail_rm = lrg->mask();
16571657
#endif
@@ -1708,7 +1708,7 @@ uint PhaseChaitin::Select( ) {
17081708
assert( lrg->alive(), "" );
17091709
assert( !lrg->_fat_proj || lrg->is_multidef() ||
17101710
lrg->_def->outcnt() > 0, "fat_proj cannot spill");
1711-
assert( !orig_mask.is_AllStack(), "All Stack does not spill" );
1711+
assert( !orig_mask.is_infinite_stack(), "infinite stack does not spill" );
17121712

17131713
// Assign the special spillreg register
17141714
lrg->set_reg(OptoReg::Name(spill_reg++));

src/hotspot/share/opto/chaitin.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class PhaseChaitin;
4848
// Live-RanGe structure.
4949
class LRG : public ResourceObj {
5050
public:
51-
static const uint AllStack_size = 0xFFFFF; // This mask size is used to tell that the mask of this LRG supports stack positions
51+
static const uint INFINITE_STACK_SIZE = 0xFFFFF; // This mask size is used to tell that the mask of this LRG supports stack positions
5252
enum { SPILL_REG=29999 }; // Register number of a spilled LRG
5353

5454
double _cost; // 2 for loads/1 for stores times block freq
@@ -83,14 +83,14 @@ class LRG : public ResourceObj {
8383
void set_degree( uint degree ) {
8484
_eff_degree = degree;
8585
DEBUG_ONLY(_degree_valid = 1;)
86-
assert(!_mask.is_AllStack() || (_mask.is_AllStack() && lo_degree()), "_eff_degree can't be bigger than AllStack_size - _num_regs if the mask supports stack registers");
86+
assert(!_mask.is_infinite_stack() || (_mask.is_infinite_stack() && lo_degree()), "_eff_degree can't be bigger than INFINITE_STACK_SIZE - _num_regs if the mask supports stack registers");
8787
}
8888
// Made a change that hammered degree
8989
void invalid_degree() { DEBUG_ONLY(_degree_valid=0;) }
9090
// Incrementally modify degree. If it was correct, it should remain correct
9191
void inc_degree( uint mod ) {
9292
_eff_degree += mod;
93-
assert(!_mask.is_AllStack() || (_mask.is_AllStack() && lo_degree()), "_eff_degree can't be bigger than AllStack_size - _num_regs if the mask supports stack registers");
93+
assert(!_mask.is_infinite_stack() || (_mask.is_infinite_stack() && lo_degree()), "_eff_degree can't be bigger than INFINITE_STACK_SIZE - _num_regs if the mask supports stack registers");
9494
}
9595
// Compute the degree between 2 live ranges
9696
int compute_degree( LRG &l ) const;
@@ -105,9 +105,9 @@ class LRG : public ResourceObj {
105105
RegMask _mask; // Allowed registers for this LRG
106106
uint _mask_size; // cache of _mask.Size();
107107
public:
108-
int compute_mask_size() const { return _mask.is_AllStack() ? AllStack_size : _mask.Size(); }
108+
int compute_mask_size() const { return _mask.is_infinite_stack() ? INFINITE_STACK_SIZE : _mask.Size(); }
109109
void set_mask_size( int size ) {
110-
assert((size == (int)AllStack_size) || (size == (int)_mask.Size()), "");
110+
assert((size == (int)INFINITE_STACK_SIZE) || (size == (int)_mask.Size()), "");
111111
_mask_size = size;
112112
#ifdef ASSERT
113113
_msize_valid=1;

src/hotspot/share/opto/coalesce.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ uint PhaseConservativeCoalesce::compute_separating_interferences(Node *dst_copy,
581581
if( _ulr.insert(lidx) ) {
582582
// Infinite-stack neighbors do not alter colorability, as they
583583
// can always color to some other color.
584-
if( !lrgs(lidx).mask().is_AllStack() ) {
584+
if( !lrgs(lidx).mask().is_infinite_stack() ) {
585585
// If this coalesce will make any new neighbor uncolorable,
586586
// do not coalesce.
587587
if( lrgs(lidx).just_lo_degree() )
@@ -698,7 +698,7 @@ bool PhaseConservativeCoalesce::copy_copy(Node *dst_copy, Node *src_copy, Block
698698
// Number of bits free
699699
uint rm_size = rm.Size();
700700

701-
if (UseFPUForSpilling && rm.is_AllStack() ) {
701+
if (UseFPUForSpilling && rm.is_infinite_stack()) {
702702
// Don't coalesce when frequency difference is large
703703
Block *dst_b = _phc._cfg.get_block_for_node(dst_copy);
704704
Block *src_def_b = _phc._cfg.get_block_for_node(src_def);
@@ -707,7 +707,9 @@ bool PhaseConservativeCoalesce::copy_copy(Node *dst_copy, Node *src_copy, Block
707707
}
708708

709709
// If we can use any stack slot, then effective size is infinite
710-
if( rm.is_AllStack() ) rm_size += 1000000;
710+
if (rm.is_infinite_stack()) {
711+
rm_size += 1000000;
712+
}
711713
// Incompatible masks, no way to coalesce
712714
if( rm_size == 0 ) return false;
713715

src/hotspot/share/opto/ifg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ void PhaseChaitin::remove_bound_register_from_interfering_live_ranges(LRG& lrg,
748748
OptoReg::Name r_reg = rm.find_first_elem();
749749
if (interfering_lrg.mask().Member(r_reg)) {
750750
interfering_lrg.Remove(r_reg);
751-
interfering_lrg.set_mask_size(interfering_lrg.mask().is_AllStack() ? LRG::AllStack_size : old_size - 1);
751+
interfering_lrg.set_mask_size(interfering_lrg.mask().is_infinite_stack() ? LRG::INFINITE_STACK_SIZE : old_size - 1);
752752
}
753753
}
754754

src/hotspot/share/opto/indexSet.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ uint IndexSet::lrg_union(uint lr1, uint lr2,
178178
LRG &lrg = ifg->lrgs(element);
179179
if (mask.overlap(lrg.mask())) {
180180
insert(element);
181-
if (!lrg.mask().is_AllStack()) {
181+
if (!lrg.mask().is_infinite_stack()) {
182182
reg_degree += lrg1.compute_degree(lrg);
183183
if (reg_degree >= fail_degree) return reg_degree;
184184
} else {
@@ -198,7 +198,7 @@ uint IndexSet::lrg_union(uint lr1, uint lr2,
198198
LRG &lrg = ifg->lrgs(element);
199199
if (mask.overlap(lrg.mask())) {
200200
if (insert(element)) {
201-
if (!lrg.mask().is_AllStack()) {
201+
if (!lrg.mask().is_infinite_stack()) {
202202
reg_degree += lrg2.compute_degree(lrg);
203203
if (reg_degree >= fail_degree) return reg_degree;
204204
} else {

src/hotspot/share/opto/matcher.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -557,13 +557,13 @@ void Matcher::init_first_stack_mask() {
557557
C->FIRST_STACK_mask().Insert(i);
558558
}
559559
// Finally, set the "infinite stack" bit.
560-
C->FIRST_STACK_mask().set_AllStack();
560+
C->FIRST_STACK_mask().set_infinite_stack();
561561

562562
// Make spill masks. Registers for their class, plus FIRST_STACK_mask.
563563
RegMask aligned_stack_mask = C->FIRST_STACK_mask();
564564
// Keep spill masks aligned.
565565
aligned_stack_mask.clear_to_pairs();
566-
assert(aligned_stack_mask.is_AllStack(), "should be infinite stack");
566+
assert(aligned_stack_mask.is_infinite_stack(), "should be infinite stack");
567567
RegMask scalable_stack_mask = aligned_stack_mask;
568568

569569
*idealreg2spillmask[Op_RegP] = *idealreg2regmask[Op_RegP];
@@ -620,7 +620,7 @@ void Matcher::init_first_stack_mask() {
620620
in = OptoReg::add(in, -1);
621621
}
622622
aligned_stack_mask.clear_to_sets(RegMask::SlotsPerVecX);
623-
assert(aligned_stack_mask.is_AllStack(), "should be infinite stack");
623+
assert(aligned_stack_mask.is_infinite_stack(), "should be infinite stack");
624624
*idealreg2spillmask[Op_VecX] = *idealreg2regmask[Op_VecX];
625625
idealreg2spillmask[Op_VecX]->OR(aligned_stack_mask);
626626
} else {
@@ -635,7 +635,7 @@ void Matcher::init_first_stack_mask() {
635635
in = OptoReg::add(in, -1);
636636
}
637637
aligned_stack_mask.clear_to_sets(RegMask::SlotsPerVecY);
638-
assert(aligned_stack_mask.is_AllStack(), "should be infinite stack");
638+
assert(aligned_stack_mask.is_infinite_stack(), "should be infinite stack");
639639
*idealreg2spillmask[Op_VecY] = *idealreg2regmask[Op_VecY];
640640
idealreg2spillmask[Op_VecY]->OR(aligned_stack_mask);
641641
} else {
@@ -650,7 +650,7 @@ void Matcher::init_first_stack_mask() {
650650
in = OptoReg::add(in, -1);
651651
}
652652
aligned_stack_mask.clear_to_sets(RegMask::SlotsPerVecZ);
653-
assert(aligned_stack_mask.is_AllStack(), "should be infinite stack");
653+
assert(aligned_stack_mask.is_infinite_stack(), "should be infinite stack");
654654
*idealreg2spillmask[Op_VecZ] = *idealreg2regmask[Op_VecZ];
655655
idealreg2spillmask[Op_VecZ]->OR(aligned_stack_mask);
656656
} else {
@@ -670,7 +670,7 @@ void Matcher::init_first_stack_mask() {
670670

671671
// For RegVectMask
672672
scalable_stack_mask.clear_to_sets(scalable_predicate_reg_slots());
673-
assert(scalable_stack_mask.is_AllStack(), "should be infinite stack");
673+
assert(scalable_stack_mask.is_infinite_stack(), "should be infinite stack");
674674
*idealreg2spillmask[Op_RegVectMask] = *idealreg2regmask[Op_RegVectMask];
675675
idealreg2spillmask[Op_RegVectMask]->OR(scalable_stack_mask);
676676
}
@@ -684,7 +684,7 @@ void Matcher::init_first_stack_mask() {
684684

685685
// For VecA
686686
scalable_stack_mask.clear_to_sets(RegMask::SlotsPerVecA);
687-
assert(scalable_stack_mask.is_AllStack(), "should be infinite stack");
687+
assert(scalable_stack_mask.is_infinite_stack(), "should be infinite stack");
688688
*idealreg2spillmask[Op_VecA] = *idealreg2regmask[Op_VecA];
689689
idealreg2spillmask[Op_VecA]->OR(scalable_stack_mask);
690690
} else {
@@ -998,7 +998,7 @@ void Matcher::init_spill_mask( Node *ret ) {
998998
for (i = init; RegMask::can_represent(i); i = OptoReg::add(i,1))
999999
STACK_ONLY_mask.Insert(i);
10001000
// Also set the "infinite stack" bit.
1001-
STACK_ONLY_mask.set_AllStack();
1001+
STACK_ONLY_mask.set_infinite_stack();
10021002

10031003
for (i = OptoReg::Name(0); i < OptoReg::Name(_last_Mach_Reg); i = OptoReg::add(i, 1)) {
10041004
// Copy the register names over into the shared world.

src/hotspot/share/opto/postaloc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ int PhaseChaitin::use_prior_register( Node *n, uint idx, Node *def, Block *curre
173173
const LRG &def_lrg = lrgs(_lrg_map.live_range_id(def));
174174
OptoReg::Name def_reg = def_lrg.reg();
175175
const RegMask &use_mask = n->in_RegMask(idx);
176-
bool can_use = ( RegMask::can_represent(def_reg) ? (use_mask.Member(def_reg) != 0)
177-
: (use_mask.is_AllStack() != 0));
176+
bool can_use = (RegMask::can_represent(def_reg) ? (use_mask.Member(def_reg) != 0)
177+
: (use_mask.is_infinite_stack() != 0));
178178
if (!RegMask::is_vector(def->ideal_reg())) {
179179
// Check for a copy to or from a misaligned pair.
180180
// It is workaround for a sparc with misaligned pairs.

src/hotspot/share/opto/reg_split.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ uint PhaseChaitin::Split(uint maxlrg, ResourceArea* split_arena) {
520520
// Gather info on which LRG's are spilling, and build maps
521521
for (bidx = 1; bidx < maxlrg; bidx++) {
522522
if (lrgs(bidx).alive() && lrgs(bidx).reg() >= LRG::SPILL_REG) {
523-
assert(!lrgs(bidx).mask().is_AllStack(),"AllStack should color");
523+
assert(!lrgs(bidx).mask().is_infinite_stack(), "Infinite stack mask should color");
524524
lrg2reach[bidx] = spill_cnt;
525525
spill_cnt++;
526526
lidxs.append(bidx);
@@ -1037,7 +1037,7 @@ uint PhaseChaitin::Split(uint maxlrg, ResourceArea* split_arena) {
10371037
// Need special logic to handle bound USES. Insert a split at this
10381038
// bound use if we can't rematerialize the def, or if we need the
10391039
// split to form a misaligned pair.
1040-
if( !umask.is_AllStack() &&
1040+
if (!umask.is_infinite_stack() &&
10411041
(int)umask.Size() <= lrgs(useidx).num_regs() &&
10421042
(!def->rematerialize() ||
10431043
(!is_vect && umask.is_misaligned_pair()))) {

0 commit comments

Comments
 (0)