What are these weird booleans used for in JMH?

拟墨画扇 提交于 2020-02-23 06:58:06

问题


I wrote a JMH test about the cost of new instruction, and checked the class files it generates. Except the usual classes, there're tons of derived classes in generated folder:

This really shocked me, for just few annotations will lead to so many class bounded together through inheritance. I am curious about what things are in those class, so I use a decompile tool (BTW I learned this tool from one talk on KotlinConf 2019) called procyon to decompile these generated class, most of them are control related, like measure time (they are explicitly specified can't be inlined) and collect metrics. But there're tons of weird boolean in those class:

there're many booleans in other generted class files as well. I googled this, and seems they're somewhat derived from JMH sourse code. So I want to ask what is these booleans used for? I will assume they are closely related to the working principle underlying the JMH... seems no comments about the booleans in JMH source code.

Also, any suggestions about improving the JMH test I mentioned from the very beginning...? I know testing such thing can be very tricky and vulnerable, so I don't know if they are accurate, or reliable enough.

Many thanks.


回答1:


Just guessing.

As you can see, the booleans are private and unused in the source file. They might be used somewhere via reflection, but I'd bet they aren't. So the only thing left is ensuring that markerBegin and the other field belong to a different cache in order to prevent false sharing.



来源:https://stackoverflow.com/questions/59846710/what-are-these-weird-booleans-used-for-in-jmh

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!