mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
8373820: C2: Robust Node::uncast_helper infinite loop check
Reviewed-by: qamai, chagedorn
This commit is contained in:
parent
d8eb1259f4
commit
4f283f188c
@ -999,18 +999,22 @@ bool Node::has_out_with(int opcode1, int opcode2, int opcode3, int opcode4) {
|
|||||||
//---------------------------uncast_helper-------------------------------------
|
//---------------------------uncast_helper-------------------------------------
|
||||||
Node* Node::uncast_helper(const Node* p, bool keep_deps) {
|
Node* Node::uncast_helper(const Node* p, bool keep_deps) {
|
||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
|
// If we end up traversing more nodes than we actually have,
|
||||||
|
// it is definitely an infinite loop.
|
||||||
|
uint max_depth = Compile::current()->unique();
|
||||||
uint depth_count = 0;
|
uint depth_count = 0;
|
||||||
const Node* orig_p = p;
|
const Node* orig_p = p;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
if (depth_count >= K) {
|
if (depth_count++ >= max_depth) {
|
||||||
orig_p->dump(4);
|
orig_p->dump(4);
|
||||||
if (p != orig_p)
|
if (p != orig_p) {
|
||||||
p->dump(1);
|
p->dump(1);
|
||||||
|
}
|
||||||
|
fatal("infinite loop in Node::uncast_helper");
|
||||||
}
|
}
|
||||||
assert(depth_count++ < K, "infinite loop in Node::uncast_helper");
|
|
||||||
#endif
|
#endif
|
||||||
if (p == nullptr || p->req() != 2) {
|
if (p == nullptr || p->req() != 2) {
|
||||||
break;
|
break;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user