Skip to content

Commit

Permalink
Add a reason field to BlackholeNode to show in IGV why it's needed
Browse files Browse the repository at this point in the history
  • Loading branch information
zakkak committed Jan 23, 2023
1 parent cb727c4 commit 83d596a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -46,15 +46,24 @@
* {@link ReachabilityFenceNode} (but keep in mind that {@link ReachabilityFenceNode} currently does
* not keep primitive values alive).
*/
@NodeInfo(cycles = CYCLES_IGNORED, size = SIZE_IGNORED)
@NodeInfo(cycles = CYCLES_IGNORED, size = SIZE_IGNORED, nameTemplate = "Blackhole {p#reason}")
public final class BlackholeNode extends FixedWithNextNode implements LIRLowerable, NodeWithIdentity {

public static final NodeClass<BlackholeNode> TYPE = NodeClass.create(BlackholeNode.class);
@Input ValueNode value;
/** Indicates the reason why we need the blackhole, to be seen in IGV. */
String reason;

public BlackholeNode(ValueNode value) {
super(TYPE, StampFactory.forVoid());
this.value = value;
this.reason = "";
}

public BlackholeNode(ValueNode value, String reason) {
this(value);
assert reason != null;
this.reason = reason;
}

public ValueNode getValue() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2297,7 +2297,7 @@ private static void registerThreadPlugin(InvocationPlugins plugins, Replacements
InvocationPlugin threadPlugin = new InvocationPlugin("ensureMaterializedForStackWalk", Object.class) {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode object) {
b.add(new BlackholeNode(object));
b.add(new BlackholeNode(object, "ensureMaterializedForStackWalk"));
return true;
}
};
Expand Down

0 comments on commit 83d596a

Please sign in to comment.