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

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Lindenmaier, Goetz
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
Reply | Threaded
Open this post in threaded view
|

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

Vladimir Kozlov
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
>
Reply | Threaded
Open this post in threaded view
|

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

Lindenmaier, Goetz
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:[hidden email]]
> Sent: Dienstag, 14. Februar 2017 00:21
> To: Lindenmaier, Goetz <[hidden email]>; 'hotspot-compiler-
> [hidden email]' <[hidden email]>
> 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
> >
Reply | Threaded
Open this post in threaded view
|

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

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

Thanks,
Vladimir

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:[hidden email]]
>> Sent: Dienstag, 14. Februar 2017 00:21
>> To: Lindenmaier, Goetz <[hidden email]>; 'hotspot-compiler-
>> [hidden email]' <[hidden email]>
>> 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
>>>
Reply | Threaded
Open this post in threaded view
|

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

Lindenmaier, Goetz
Hi Vladimir,

I changed the field to Boolean.
http://cr.openjdk.java.net/~goetz/wr17/8173465-NearLbl/webrev.02/
Thanks for looking at this!

Best regards,
  Goetz.

> -----Original Message-----
> From: Vladimir Kozlov [mailto:[hidden email]]
> Sent: Mittwoch, 15. Februar 2017 22:18
> To: Lindenmaier, Goetz <[hidden email]>; 'hotspot-compiler-
> [hidden email]' <[hidden email]>
> Subject: Re: JDK 10 RFR(S): 8173465: Introduce NearLabel for branches known
> to be short.
>
> Okay, than it makes sense. One comment about changes I have is to use bool
> field instead of bit field for _is_near.
>
> Thanks,
> Vladimir
>
> 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:[hidden email]]
> >> Sent: Dienstag, 14. Februar 2017 00:21
> >> To: Lindenmaier, Goetz <[hidden email]>; 'hotspot-
> compiler-
> >> [hidden email]' <[hidden email]>
> >> 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
> >>>