AdoptOpenJDK/jitwatch

how to set config for openjdk built by source files

liusy58 opened this issue · 11 comments

hi, I build the OpenJDK17 source file and I want to use JITWatch, but I can not set config correctly, any help?

Screenshot from 2021-11-12 11-21-08

the error message is below:

11:10:50.887 [JavaFX Application Thread] WARN  o.a.j.c.CompilationUtil - No Task found in Compilation 11
Exception in thread "Thread-11" java.util.EmptyStackException
        at java.base/java.util.Stack.peek(Stack.java:101)
        at java.base/java.util.Stack.pop(Stack.java:83)
        at org.adoptopenjdk.jitwatch.core.TagProcessor.handleTag(TagProcessor.java:140)
        at org.adoptopenjdk.jitwatch.core.TagProcessor.processLine(TagProcessor.java:57)
        at org.adoptopenjdk.jitwatch.parser.hotspot.HotSpotLogParser.parseLogCompilationLines(HotSpotLogParser.java:148)
        at org.adoptopenjdk.jitwatch.parser.hotspot.HotSpotLogParser.parseLogFile(HotSpotLogParser.java:130)
        at org.adoptopenjdk.jitwatch.parser.AbstractLogParser.processLogFile(AbstractLogParser.java:366)
        at org.adoptopenjdk.jitwatch.parser.ILogParser.processLogFile(ILogParser.java:23)
        at org.adoptopenjdk.jitwatch.ui.main.JITWatchUI$1.run(JITWatchUI.java:246)
        at java.base/java.lang.Thread.run(Thread.java:831)
Exception in thread "Thread-12" java.util.EmptyStackException
        at java.base/java.util.Stack.peek(Stack.java:101)
        at java.base/java.util.Stack.pop(Stack.java:83)
        at org.adoptopenjdk.jitwatch.core.TagProcessor.handleTag(TagProcessor.java:140)
        at org.adoptopenjdk.jitwatch.core.TagProcessor.processLine(TagProcessor.java:57)
        at org.adoptopenjdk.jitwatch.parser.hotspot.HotSpotLogParser.parseLogCompilationLines(HotSpotLogParser.java:148)
        at org.adoptopenjdk.jitwatch.parser.hotspot.HotSpotLogParser.parseLogFile(HotSpotLogParser.java:130)
        at org.adoptopenjdk.jitwatch.parser.AbstractLogParser.processLogFile(AbstractLogParser.java:366)
        at org.adoptopenjdk.jitwatch.parser.ILogParser.processLogFile(ILogParser.java:23)
        at org.adoptopenjdk.jitwatch.ui.main.JITWatchUI$1.run(JITWatchUI.java:246)
        at java.base/java.lang.Thread.run(Thread.java:831)

Hi, please can you share the source/class file and the command line options used to run it?

Thanks,

Chris

Hi, Chris, sorry for my late reply. My command-line option is java -XX:+UnlockDiagnosticVMOptions -XX:+LogCompilation -XX:-TieredCompilation -XX:+PrintAssembly -XX:-UseCompressedOops sumBenchmark.java

The source file is

import java.io.IOException;

import java.nio.file.*;
public class sumBenchmark {
    public int count(int n) {
        int res = 0;
        for(int i=1;i<=n;++i){
            if(i%2 == 1){
                res  += i;
            }else{
                res -= i;
            }
        }
        return res;
    }
    public static void main(String[] args) {
        int res =0;
        sumBenchmark summer = new sumBenchmark();

        for(int i=1;i<=10000;++i){
            res += summer.count(i);
        }
        System.out.println(res);
    }
}

TriView-snapshot-2021 11 13 13 14 30
Hi, OpenJDK17 (Temurin) seems to work for me.
Are you running your code in the JITWatch "Sandbox" or analysing a LogCompilation file your output from an execution outside JITWatch?

If the latter then please can you paste your logcompilation file please?

Also, is the problem repeatable? Sometimes with short programs the JVM exits before completely writing the logcompilation file so you don't get a usable log file.

Cheers,

Chris

Yeah, the latter one, this problem is repeatable. I think I do not correctly understand the JITWatch Configuration, I'll try running my code in the JITWatch "Sandbox". So could you please tell see your settings about source locations and class locations?

Thank you, Chris.

Hi, with the sandbox it automatically finds your source and class locations. Manual configuration is only needed for external log files :)

Okay, I'll try later. Thank you for your patience. By the way, are you familiar with JVM execution engine about JIT? I mean the logic about C1 compiler and C2 compiler, especially the code emit phase, the optimization technology is not what I care, I only care about the phase from lir to native code. The source code really puzzles me, any help?

I know a little but the hotspot-compiler-dev mailing list is the best place to ask about compiler internals :)

Okay, thank you a lot!!! Have a nice day!!!!

Hi, Chris, sorry to disturb you again, I sent emails to hotspot-compiler-dev mailing list, but no response. Any help?

Hi, I'm closing all the issues except for the ones I'm actively working on.