-
Enhancement
-
Resolution: Unresolved
-
P4
-
21
-XX:+PrintInterpreter is useful when debugging the interpreter inside gdb. However, it prints over 5000 lines to stdout. If you are running inside gdb, it's difficult to scroll back to the exact part you want to look at.
Also, it's not easy to save the stdout into a file when you're running in gdb. You can use https://man7.org/linux/man-pages/man1/script.1.html, but the log file can get out of hand when you restart the jvm several times inside gdb.
If we print the interpreter using UL, we can set the output file a file, which can be easily searched in a text editor.
java -Xlog:disasm+interpreter:file=interp.log:none:filesize=0
(The "none" is to disable the logging decorations. "filesize=0" it to prevent UL from splitting the log into multiple files).
================================
For compatibility, if -XX:+PrintInterpreter is specified, but -Xlog:disasm+interpreter is not specified, we can programmatically enable this:
-Xlog:disasm+interpreter::none
Some of the existing function unconditionally print to tty. These function need to be changed to take an outputStream* parameter.
https://github.com/openjdk/jdk/blob/f1194dc07ec347f4f9d785e7647983da61441c0e/src/hotspot/share/interpreter/abstractInterpreter.cpp#L63-L80
================================
There are other flags like PrintAdapterHandlers, PrintStubCode, etc, that can be converted similarly as -Xlog:disasm+adapter, -Xlog:disasm+stub, etc.
Also, it's not easy to save the stdout into a file when you're running in gdb. You can use https://man7.org/linux/man-pages/man1/script.1.html, but the log file can get out of hand when you restart the jvm several times inside gdb.
If we print the interpreter using UL, we can set the output file a file, which can be easily searched in a text editor.
java -Xlog:disasm+interpreter:file=interp.log:none:filesize=0
(The "none" is to disable the logging decorations. "filesize=0" it to prevent UL from splitting the log into multiple files).
================================
For compatibility, if -XX:+PrintInterpreter is specified, but -Xlog:disasm+interpreter is not specified, we can programmatically enable this:
-Xlog:disasm+interpreter::none
Some of the existing function unconditionally print to tty. These function need to be changed to take an outputStream* parameter.
https://github.com/openjdk/jdk/blob/f1194dc07ec347f4f9d785e7647983da61441c0e/src/hotspot/share/interpreter/abstractInterpreter.cpp#L63-L80
================================
There are other flags like PrintAdapterHandlers, PrintStubCode, etc, that can be converted similarly as -Xlog:disasm+adapter, -Xlog:disasm+stub, etc.