-
Enhancement
-
Resolution: Unresolved
-
P4
-
26
For debugging purposes, it would be useful to have a node in C2 IR that takes a string or integer value that is then printed when the compiled code is executed. For example, this would be useful to print intermediate values in registers / on stack or print errors in verification code.
I think this could be implemented as a CallLeafPureNode to a runtime method that just prints the value (see JDK-8347901).
We already have HaltNodes that print something but then fail hard (which we don't want for this kind of debug printing):
instruct ShouldNotReachHere() %{
match(Halt);
format %{ "stop\t# ShouldNotReachHere" %}
ins_encode %{
if (is_reachable()) {
const char* str = __ code_string(_halt_reason);
__ stop(str);
}
%}
ins_pipe(pipe_slow);
%}
Also, they don't allow printing dynamic values.
I think this could be implemented as a CallLeafPureNode to a runtime method that just prints the value (see JDK-8347901).
We already have HaltNodes that print something but then fail hard (which we don't want for this kind of debug printing):
instruct ShouldNotReachHere() %{
match(Halt);
format %{ "stop\t# ShouldNotReachHere" %}
ins_encode %{
if (is_reachable()) {
const char* str = __ code_string(_halt_reason);
__ stop(str);
}
%}
ins_pipe(pipe_slow);
%}
Also, they don't allow printing dynamic values.