RFR(L): 8029015: PPC64 (part 216): opto: trap based null and range checks

Vladimir Kozlov vladimir.kozlov at oracle.com
Fri Nov 22 17:17:31 PST 2013


Hi Goetz,

First general question. Why you did not create specialized Mach node 
like MachNullCheckNode to handle such cases and using existing code in 
lcm.cpp? Or it would be more complicated changes?

To avoid changes in closed sources can you put TrapBasedNullChecks and 
TrapBasedRangeChecks into opto/c2_globals.hpp (thay are used only by C2) 
and set them to 'true' if FLAG_IS_DEFAULT() in 
src/cpu/ppc/vm/vm_version_ppc.cpp ?

output_h.cpp: since you touching the code can you add explicit != 0 for 
all checks (ins_cost and ins_short_branch)?

block.cpp: Could you rename local 'bra' in no_flip_branch() and in new 
code in fixup_flow()? It is not good name :) Use full name 'branch'.

+    // Don't flip if bra has an implicit check.
+    if (bra->is_TrapBasedCheckNode()) return true;

And, please, move new code in PhaseCFG::fixup_flow() into separate method.

You moved _allowed_reasons code to Compile::Init() which is called for 
stubs too. But you removed if (C->is_method_compilation()) check. Why?

matcher.cpp: we usually use C variable name for Compile object:

Compile *Co = Compile::current();

Where branches_to_uncommon_trap() is used?

output.cpp: can you replace next node to move is_TrapBasedCheckNode() to 
MachNode class?:

if (n->is_TrapBasedCheckNode()) {

replace with

if (n->is_Mach() && n->as_Mach()->is_TrapBasedCheckNode()) {

Thanks,
Vladimir

On 11/22/13 6:41 AM, Lindenmaier, Goetz wrote:
> Hi,
>
> I prepared a webrev for the trap based checks feature used on PPC:
> http://cr.openjdk.java.net/~goetz/webrevs/8029015-0-trch/
>
> PPC has the tdi instruction that does a compare and raises SIGTRAP
> if the compare is successful.
> With this instruction conditional branches leading to uncommon
> traps can be implemented very efficiently.
> This is especially needed on AIX, where there are almost no
> possibilities for ImplicitNullChecks as the zero page is not
> protected.
>
> On linux, this accounts for about 2% jvm2008 performance.
>
> Possibilities for trap based range checks and trap based null checks
> are recognized during matching. To support this, we added a method
> branches_to_uncommon_trap() to be used in the predicate during
> matching.
> The computation of the final block layout must know about this,
> as it must place the fallthrough properly and adapt the condition
> in the tdi instruction.
> We added a method is_TrapBasedCheckNode so these nodes
> can be recogized in a platform independent way.
>
> Please review and test this change.
>
> Best regards,
>    Goetz
>


More information about the hotspot-dev mailing list