JDK 10 RFR(S): 8173465: Introduce NearLabel for branches known to be short.

Vladimir Kozlov vladimir.kozlov at oracle.com
Wed Feb 15 20:18:27 UTC 2017

Okay, than it makes sense. One comment about changes I have is to use bool field instead of bit field for _is_near.


On 2/14/17 1:38 AM, Lindenmaier, Goetz wrote:
> Hi Vladimir,
> For forward branches the branch instruction is decided on before
> the Label is fixed.
> Sometimes the decision which branch instruction to use must
> be taken far down a call chain. You would have to pass down a
> boolean flag 'useShortBranch' all the call chain.
> See emit_typecheck_helper in c1_LIRAssembler_s390.cpp http://hg.openjdk.java.net/jdk10/hs/hotspot/file/df8746afee77/src/cpu/s390/vm/c1_LIRAssembler_s390.cpp
> It gets a label from emit_opTypeCheck which can point to a stub entry.
> This label is in some cases passed down
> to check_class_subtype_fast_path.  In other cases, a local label is
> passed to this functions. We know for the local label the short
> branch will suffice, not so for the label coming from extern.
> So we use NearLable for the local one.
> Check_class_subtype_fast_path passes the label on to a
> s390 optimized branch emitter compare64_and_branch, which
> then sees whether it's a NearLabel and uses the short branch.
> Best regards,
>   Goetz.
>> -----Original Message-----
>> From: Vladimir Kozlov [mailto:vladimir.kozlov at oracle.com]
>> Sent: Dienstag, 14. Februar 2017 00:21
>> To: Lindenmaier, Goetz <goetz.lindenmaier at sap.com>; 'hotspot-compiler-
>> dev at openjdk.java.net' <hotspot-compiler-dev at openjdk.java.net>
>> Subject: Re: JDK 10 RFR(S): 8173465: Introduce NearLabel for branches known
>> to be short.
>> I assume you are talking about hand written assembler code snippets (stubs,
>> etc.)
>> Usually we use appropriate short branch instructions for short forward
>> distance (and there is assert which check that it is correct). For back branches
>> we do it automatically depending on distance.
>> So why you need special NearLabel for s390? Can you just have general short
>> branch macroassembler method for this?
>> Thanks,
>> Vladimir
>> On 1/30/17 2:57 AM, Lindenmaier, Goetz wrote:
>>> Hi
>>> please review this small optimization of Labels.
>>> This so far targets s390, but could be used on other platforms as well.
>>> I please need a sponsor.
>>> http://cr.openjdk.java.net/~goetz/wr17/8173465-
>> NearLbl/webrev.01/index.html
>>> Some branches issued to assembly code are obviously of short distance.
>> Due to separation into shared and platform code this not always is known
>> when the branch instruction is selected.
>>> NearLabels indicate that a branch with short reach can be used.
>>> Best regards,
>>>   Goetz

More information about the hotspot-compiler-dev mailing list