How does HotSpot JVM identify hot methods?
Asked Answered
T

1

1

I want to understand how JVM works and I have been reading blog posts and documentation. However, things are quite confusing and frequently outdated. I understand as methods get invoked more and more (10k or 15k invocations threshold depending on compiler), JVM JIT compiles them to native code and maintains a code cache. I am interested in browsing the actual source code where these decisions are being made.

This post explains things well. However, I am using OpenJDK11 and the structure of source code seems to have changed. Tiered compilation makes things more complicated. Is there any detailed documentation for OpenJDK's source code? Or do I have to go through source files one by one?

Tense answered 2/3, 2019 at 13:28 Comment(5)
Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.Wulfe
Opinionated? Spam? I didn't realize the JDK source code had become such a contentions issue that we can no longer talk about it on stack overflow ...Millinery
The reasoning in the standard message doesn't apply directly to this case. However, questions asking for links to documentation are explicitly off-topic. And if such resources do exist on the public internet, then the OP should be able to find them using Google. In this case, the source code is the only public documentation. Learn to use find ... | xargs grep ... | less :-)Gorgerin
I beg to differ: They are off-topic if their quality can not be objectively assessed. We get numerous questions for authoritative references ("where does the language spec say that ..."), and I really see no reason to close such questions. In particular, I am not convinced that we should close all questions answered by "resources on the public internet", which is the case for 99% of the questions on this site ... but let's stop wasting our time with discussions of moderation policy and focus on more interesting matters :-)Millinery
@StephenC thank you for telling me the source code is the only documentation. That's all I wanted to know. Like I clearly asked in question.Tense
M
2

Searching the JDK's mercurial repository reveals that the AdvancedThresholdPolicy was merged into the SimpleThresholdPolicy in commit 5201c9474ee7 as part of 8202711, and may now be found in src/hotspot/share/runtime/simpleThresholdPolicy.cpp.

Millinery answered 2/3, 2019 at 13:45 Comment(1)
Thank you, I came across simpleThresholdPolicy while searching myself. However I wasn't quite clear on the whole compilation strategy JVM takes. I will look through code.Tense

© 2022 - 2024 — McMap. All rights reserved.