mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-03 11:38:44 +00:00
8298736: Revisit usages of log10 in compiler code
Reviewed-by: thartmann, chagedorn, epeter
This commit is contained in:
parent
16225630ec
commit
ec95991470
@ -6193,7 +6193,7 @@ void PhaseIdealLoop::get_idoms(Node* n, const uint count, Unique_Node_List& idom
|
||||
void PhaseIdealLoop::dump_idoms_in_reverse(const Node* n, const Node_List& idom_list) const {
|
||||
Node* next;
|
||||
uint padding = 3;
|
||||
uint node_index_padding_width = static_cast<int>(log10(C->unique())) + 1;
|
||||
uint node_index_padding_width = static_cast<int>(log10(static_cast<double>(C->unique()))) + 1;
|
||||
for (int i = idom_list.size() - 1; i >= 0; i--) {
|
||||
if (i == 9 || i == 99) {
|
||||
padding++;
|
||||
|
||||
@ -2392,17 +2392,6 @@ void Node::dump_bfs(const int max_distance) const {
|
||||
dump_bfs(max_distance, nullptr, nullptr);
|
||||
}
|
||||
|
||||
// log10 rounded down
|
||||
uint log10(const uint i) {
|
||||
uint v = 10;
|
||||
uint e = 0;
|
||||
while(v <= i) {
|
||||
v *= 10;
|
||||
e++;
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
// -----------------------------dump_idx---------------------------------------
|
||||
void Node::dump_idx(bool align, outputStream* st, DumpConfig* dc) const {
|
||||
if (dc != nullptr) {
|
||||
@ -2412,9 +2401,9 @@ void Node::dump_idx(bool align, outputStream* st, DumpConfig* dc) const {
|
||||
bool is_new = C->node_arena()->contains(this);
|
||||
if (align) { // print prefix empty spaces$
|
||||
// +1 for leading digit, +1 for "o"
|
||||
uint max_width = log10(C->unique()) + 2;
|
||||
uint max_width = static_cast<uint>(log10(static_cast<double>(C->unique()))) + 2;
|
||||
// +1 for leading digit, maybe +1 for "o"
|
||||
uint width = log10(_idx) + 1 + (is_new ? 0 : 1);
|
||||
uint width = static_cast<uint>(log10(static_cast<double>(_idx))) + 1 + (is_new ? 0 : 1);
|
||||
while (max_width > width) {
|
||||
st->print(" ");
|
||||
width++;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user