Re: please help understanding what's the relationship of hotspot compiler c1 and c2 ？
rednaxelafx at gmail.com
Wed Nov 2 08:54:10 UTC 2016
By "HIR" and "LIR", I specifically mean the "High-level IR" and "Low-level
IR" for C1. In C1, the GraphBuilder is what parses Java bytecodes into HIR,
and then the LIRGenerator is what lowers HIR into LIR, and finally the
LIRAssembler is what encodes LIR into actual machine code.
C1 is the "Client Compiler", and C2 is the "Server Compiler".
In a HotSpot Client VM build (which is by default not available on 64-bit
architectures), it only contains C1.
In a JDK7+ HotSpot Server VM, the VM actually contains both C1 and C2
compilers. They can work together in what's called a "tiered compilation
system", where methods can be interpreted first, then compiled by C1, and
then further compiled by C2.
In JDK7, -XX:+TieredCompilation is off by default, where as in JDK8 it's on
On Wed, Nov 2, 2016 at 1:48 AM, 恶灵骑士 <1072213404 at qq.com> wrote:
> Thank you ，Krystal ！
> i think i need some time to make these things light，
> which part of code link HIR and LIR together in openjdk ？
> c1 matches client mode，
> c2 matches server mode，
> when some code running， just one of them work or both do？
> ------------------ 原始邮件 ------------------
> *发件人:* "Krystal Mok";<rednaxelafx at gmail.com>;
> *发送时间:* 2016年11月2日(星期三) 下午4:28
> *收件人:* "恶灵骑士"<1072213404 at qq.com>;
> *抄送:* "hotspot-dev"<hotspot-dev at openjdk.java.net>;
> *主题:* Re: please help understanding what's the function and diffrence
> between hotspot compiler c1 and c2 ？
> I don't think I understand your question, but I'll take a shot.
> Are you trying to ask what the differences are between C1 and C2, with
> regards to how they handle volatile field accesses?
> For C1, yes, all Java fields accesses (load/store) are represented in the
> HIR with LoadField and StoreField instructions. The ciField in these
> instructions would carry the information about whether the field is
> volatile or not.
> When lowering HIR to LIR, the LIRGenerator::do_LoadField() and
> do_StoreField() functions are called. What is it that you're trying to
> learn about these functions?
> For C2, it's a bit complicated, because volatile semantics involve the
> memory graph portion of C2's Sea-of-nodes IR. You may want to refer to 
> and  for some background information before you dive into the code.
> Hope it helps,
> : https://wiki.openjdk.java.net/display/HotSpot/
> : https://wiki.openjdk.java.net/display/HotSpot/C2+IR+Graph+and+Nodes
> On Wed, Nov 2, 2016 at 1:19 AM, 恶灵骑士 <1072213404 at qq.com> wrote:
>> what's the function and diffrence between hotspot compiler c1 and c2 ？
>> about c1，
>> i have found something about ‘voaltile’ and
>> methods LIRGenerator::do_StoreField(StoreField* x) and
>> LIRGenerator::do_LoadField(LoadField* x) in
>> when operating a variable with a volatile qualifier，will it finally
>> invoke do_StoreField or do_LoadField method？
>> if true， then method do_LoadField or do_StoreField by which method？
More information about the hotspot-dev