RFR: 8261731: shallow copy the internal buffer of a scalar-replaced java.lang.String object

Xin Liu xliu at openjdk.java.net
Wed Mar 3 18:33:46 UTC 2021


On Wed, 3 Mar 2021 11:54:08 GMT, Volker Simonis <simonis at openjdk.org> wrote:

> Hi Xin,
> when building a fastdebug build of your latest changes I got a crash because of an assertion in your new code.
> I've attached the hs_err and replay file. After restarting the build it succeeded so there must have been a special situation. Hopefully the replay file can help you to reproduce the error.
> 
> Best regards,
> Volker
> 
> [hs_err_pid18140.log](https://github.com/openjdk/jdk/files/6075724/hs_err_pid18140.log)
> [replay_pid18140.log](https://github.com/openjdk/jdk/files/6075725/replay_pid18140.log)

hi, Volker, 
thank you for using this patch. 
Yes, indeed, it's a bug. I introduced yesterday, I got a silly typo for the AddP nodes.  I need to use else if instead of else. 
in your replay file, optimization met a special node StrEquals. I have handled it above. 
diff --git a/src/hotspot/share/opto/macro.cpp b/src/hotspot/share/opto/macro.cpp
index 56dab5c6449..76e97087fd9 100644
--- a/src/hotspot/share/opto/macro.cpp
+++ b/src/hotspot/share/opto/macro.cpp
@@ -1372,7 +1372,7 @@ void PhaseMacroExpand::process_users_of_string_allocation(AllocateArrayNode* all
             if (n->in(3) == use) { // str2
               _igvn.replace_input_of(n, 3, dst_adr);
             }
-          } if (n->is_AddP()) {
+          } else if (n->is_AddP()) {
             // Skip second AddP. This node must be handled by the upper level.
           } else {
             assert(n->Opcode() == Op_LoadUB || n->Opcode() == Op_LoadB, "unknow code shape");
I will fix soon.

-------------

PR: https://git.openjdk.java.net/jdk/pull/2570


More information about the hotspot-compiler-dev mailing list