You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Apply trapping nullcheck to the uncompressed target for compressed pointer.
Trapping nullcheck might generate two uncompress instructions for the
same compressed oop in Graal. One is inserted by the backend when it
emits nullcheck. If the pointer is a compressed object, it should be
uncompressed before the nullcheck is emitted. And another one is
generated by the normal uncompressing operation. These two instructions
are duplicated with each other.
The generated codes on AArch64 like:
ldr w0, [x0,oracle#112]
lsl x2, x0, oracle#3 ; uncompressing (first)
ldr xzr, [x2] ; implicit exception: deoptimizes
...... ; fixed operations
lsl x0, x0, oracle#3 ; uncompressing (second)
str w1, [x0,oracle#12]
A simple way to avoid this is to apply the nullcheck to the uncompressed
result if it exists instead of to the compressed pointer when generating
the trapping nullcheck.
With the modification, the codes above could be optimized to:
ldr w0, [x0,oracle#112]
lsl x0, x0, oracle#3 ; uncompressing
ldr xzr, [x0] ; implicit exception: deoptimizes
...... ; fixed operations
str w1, [x0,oracle#12]
Change-Id: Iabfe47bbf984ed11c42555f84bdd0ccf2a5bdddb
Copy file name to clipboardExpand all lines: compiler/src/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/UseTrappingNullChecksPhase.java
+26-3Lines changed: 26 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
/*
2
-
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
2
+
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
@@ -264,8 +264,13 @@ private static void replaceWithTrappingNullCheck(AbstractDeoptimizeNode deopt, I
0 commit comments