Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8251093: Improve C1 register allocator logging and debugging support
Various printing and debug improvements to better analyze C1 register allocator problems.

Reviewed-by: kvn, thartmann
  • Loading branch information
chhagedorn committed Aug 26, 2020
1 parent f7737da commit 33f1d05b13397bc75c1851e873af32bce1b195b2
Show file tree
Hide file tree
Showing 8 changed files with 199 additions and 82 deletions.
@@ -78,7 +78,7 @@ inline void LinearScan::pd_add_temps(LIR_Op* op) {
// assume that slow paths are uncommon but it's not clear that
// would be a good idea.
if (UseSSE > 0) {
#ifndef PRODUCT
#ifdef ASSERT
if (TraceLinearScanLevel >= 2) {
tty->print_cr("killing XMMs for trig");
}
@@ -297,8 +297,6 @@ void CFGPrinterOutput::print_block(BlockBegin* block) {
print_end("block");
}



void CFGPrinterOutput::print_cfg(BlockList* blocks, const char* name) {
print_begin("cfg");
print("name \"%s\"", name);
@@ -321,22 +319,18 @@ void CFGPrinterOutput::print_cfg(IR* blocks, const char* name) {
output()->flush();
}




void CFGPrinterOutput::print_intervals(IntervalList* intervals, const char* name) {
print_begin("intervals");
print("name \"%s\"", name);

for (int i = 0; i < intervals->length(); i++) {
if (intervals->at(i) != NULL) {
intervals->at(i)->print(output());
intervals->at(i)->print_on(output());
}
}

print_end("intervals");
output()->flush();
}


#endif
#endif // NOT PRODUCT
@@ -700,7 +700,6 @@ void Compilation::compile_only_this_method() {
compile_only_this_scope(&stream, hir()->top_scope());
}


void Compilation::compile_only_this_scope(outputStream* st, IRScope* scope) {
st->print("CompileOnly=");
scope->method()->holder()->name()->print_symbol_on(st);
@@ -709,7 +708,6 @@ void Compilation::compile_only_this_scope(outputStream* st, IRScope* scope) {
st->cr();
}


void Compilation::exclude_this_method() {
fileStream stream(fopen(".hotspot_compiler", "at"));
stream.print("exclude ");
@@ -719,4 +717,10 @@ void Compilation::exclude_this_method() {
stream.cr();
stream.cr();
}
#endif

// Called from debugger to get the interval with 'reg_num' during register allocation.
Interval* find_interval(int reg_num) {
return Compilation::current()->allocator()->find_interval_at(reg_num);
}

#endif // NOT PRODUCT
@@ -109,7 +109,6 @@ class Compilation: public StackObj {
ExceptionInfoList* exception_info_list() const { return _exception_info_list; }
ExceptionHandlerTable* exception_handler_table() { return &_exception_handler_table; }

LinearScan* allocator() { return _allocator; }
void set_allocator(LinearScan* allocator) { _allocator = allocator; }

Instruction* _current_instruction; // the instruction currently being processed
@@ -150,6 +149,7 @@ class Compilation: public StackObj {
Arena* arena() { return _arena; }
bool has_access_indexed() { return _has_access_indexed; }
bool should_install_code() { return _install_code && InstallMethods; }
LinearScan* allocator() { return _allocator; }

// Instruction ids
int get_next_id() { return _next_id++; }
@@ -440,7 +440,7 @@ class UseCountComputer: public ValueVisitor, BlockClosure {


// helper macro for short definition of trace-output inside code
#ifndef PRODUCT
#ifdef ASSERT
#define TRACE_LINEAR_SCAN(level, code) \
if (TraceLinearScanLevel >= level) { \
code; \
@@ -509,7 +509,7 @@ class ComputeLinearScanOrder : public StackObj {
void compute_dominators();

// debug functions
NOT_PRODUCT(void print_blocks();)
DEBUG_ONLY(void print_blocks();)
DEBUG_ONLY(void verify();)

Compilation* compilation() const { return _compilation; }
@@ -559,7 +559,7 @@ ComputeLinearScanOrder::ComputeLinearScanOrder(Compilation* c, BlockBegin* start
compute_order(start_block);
compute_dominators();

NOT_PRODUCT(print_blocks());
DEBUG_ONLY(print_blocks());
DEBUG_ONLY(verify());
}

@@ -1047,7 +1047,7 @@ void ComputeLinearScanOrder::compute_dominators() {
}


#ifndef PRODUCT
#ifdef ASSERT
void ComputeLinearScanOrder::print_blocks() {
if (TraceLinearScanLevel >= 2) {
tty->print_cr("----- loop information:");
@@ -1104,9 +1104,7 @@ void ComputeLinearScanOrder::print_blocks() {
}
}
}
#endif

#ifdef ASSERT
void ComputeLinearScanOrder::verify() {
assert(_linear_scan_order->length() == _num_blocks, "wrong number of blocks in list");

@@ -1182,7 +1180,7 @@ void ComputeLinearScanOrder::verify() {
}
}
}
#endif
#endif // ASSERT


void IR::compute_code() {

0 comments on commit 33f1d05

Please sign in to comment.