<div dir="ltr"><div dir="ltr">On Tue, Feb 4, 2025 at 5:26 PM Shaojin Wen <<a href="mailto:swen@openjdk.org">swen@openjdk.org</a>> wrote:</div><div class="gmail_quote gmail_quote_container"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I think you are talking about the problem of PR #23420, which is caused by the use of thread-unsafe StringBuilder in multi-threaded scenarios. This problem is very obscure and I didn't consider it before. I have started to solve this problem and have submitted PR #23427. After it is completed, I will continue to submit PR to redo PR #19626 in a thread-safe way.<br></blockquote><div><br></div><div>Yes - apologies if it sounded like I was trying to single you out. The optimizations you've been doing are looking great. It's just that this example is a good data point in the larger discussion about what the general policy should be, etc.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
The above problem does not affect toString, because it only occurs when StringBuilder is used in a multi-threaded scenario.<br></blockquote><div><br></div><div>Good point, but frankly, an irrelevant one. The key issue here is that if plain, ordinary, non-native-invoking Java bytecode can  corrupt memory and/or crash the JVM, then that's a Big Problem™️. It doesn't matter how contrived the code that makes it happen is.<br></div><div><br></div><div>-Archie<br></div></div><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">Archie L. Cobbs<br></div></div>