Skip to content

Commit

Permalink
8306922: IR verification fails because IR dump is chopped up
Browse files Browse the repository at this point in the history
Reviewed-by: chagedorn, thartmann
  • Loading branch information
eme64 committed Jun 26, 2023
1 parent 8242c64 commit 9057b35
Show file tree
Hide file tree
Showing 8 changed files with 167 additions and 147 deletions.
37 changes: 23 additions & 14 deletions src/hotspot/share/opto/compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,28 +551,37 @@ void Compile::print_compile_messages() {

#ifndef PRODUCT
void Compile::print_ideal_ir(const char* phase_name) {
ttyLocker ttyl;
// keep the following output all in one block
// This output goes directly to the tty, not the compiler log.
// To enable tools to match it up with the compilation activity,
// be sure to tag this tty output with the compile ID.
if (xtty != nullptr) {
xtty->head("ideal compile_id='%d'%s compile_phase='%s'",
compile_id(),
is_osr_compilation() ? " compile_kind='osr'" : "",
phase_name);
}

// Node dumping can cause a safepoint, which can break the tty lock.
// Buffer all node dumps, so that all safepoints happen before we lock.
ResourceMark rm;
stringStream ss;

if (_output == nullptr) {
tty->print_cr("AFTER: %s", phase_name);
ss.print_cr("AFTER: %s", phase_name);
// Print out all nodes in ascending order of index.
root()->dump_bfs(MaxNodeLimit, nullptr, "+S$");
root()->dump_bfs(MaxNodeLimit, nullptr, "+S$", &ss);
} else {
// Dump the node blockwise if we have a scheduling
_output->print_scheduling();
_output->print_scheduling(&ss);
}

// Check that the lock is not broken by a safepoint.
NoSafepointVerifier nsv;
ttyLocker ttyl;
if (xtty != nullptr) {
xtty->head("ideal compile_id='%d'%s compile_phase='%s'",
compile_id(),
is_osr_compilation() ? " compile_kind='osr'" : "",
phase_name);
xtty->print("%s", ss.as_string()); // print to tty would use xml escape encoding
xtty->tail("ideal");
} else {
tty->print("%s", ss.as_string());
}
}
#endif
Expand Down Expand Up @@ -4980,8 +4989,8 @@ bool Compile::randomized_select(int count) {
CloneMap& Compile::clone_map() { return _clone_map; }
void Compile::set_clone_map(Dict* d) { _clone_map._dict = d; }

void NodeCloneInfo::dump() const {
tty->print(" {%d:%d} ", idx(), gen());
void NodeCloneInfo::dump_on(outputStream* st) const {
st->print(" {%d:%d} ", idx(), gen());
}

void CloneMap::clone(Node* old, Node* nnn, int gen) {
Expand Down Expand Up @@ -5028,11 +5037,11 @@ int CloneMap::max_gen() const {
return g;
}

void CloneMap::dump(node_idx_t key) const {
void CloneMap::dump(node_idx_t key, outputStream* st) const {
uint64_t val = value(key);
if (val != 0) {
NodeCloneInfo ni(val);
ni.dump();
ni.dump_on(st);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/opto/compile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class NodeCloneInfo {
NodeCloneInfo(uint64_t idx_clone_orig) : _idx_clone_orig(idx_clone_orig) {}
NodeCloneInfo(node_idx_t x, int g) : _idx_clone_orig(0) { set(x, g); }

void dump() const;
void dump_on(outputStream* st) const;
};

class CloneMap {
Expand All @@ -158,7 +158,7 @@ class CloneMap {
int max_gen() const;
void clone(Node* old, Node* nnn, int gen);
void verify_insert_and_clone(Node* old, Node* nnn, int gen);
void dump(node_idx_t key) const;
void dump(node_idx_t key, outputStream* st) const;

int clone_idx() const { return _clone_idx; }
void set_clone_idx(int x) { _clone_idx = x; }
Expand Down

3 comments on commit 9057b35

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GoeLin
Copy link
Member

@GoeLin GoeLin commented on 9057b35 Jan 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk21u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 9057b35 Jan 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GoeLin the backport was successfully created on the branch backport-GoeLin-9057b350 in my personal fork of openjdk/jdk21u-dev. To create a pull request with this backport targeting openjdk/jdk21u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 9057b350 from the openjdk/jdk repository.

The commit being backported was authored by Emanuel Peter on 26 Jun 2023 and was reviewed by Christian Hagedorn and Tobias Hartmann.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk21u-dev:

$ git fetch https://github.com/openjdk-bots/jdk21u-dev.git backport-GoeLin-9057b350:backport-GoeLin-9057b350
$ git checkout backport-GoeLin-9057b350
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk21u-dev.git backport-GoeLin-9057b350

Please sign in to comment.