On Wed, 23 Oct 2024 06:15:27 GMT, David Holmes <dhol...@openjdk.org> wrote:
> Why do we need to cache it? Is it the implicit barriers related to accessing > the threadObj oop each time? We cache threadObj.thread_id in JavaThread::_lock_id so that the fast path c2_MacroAssembler code has one less load and code to find the offset of java.lang.Thread.threadId in the code. Also, yes, we were worried about performance of the barrier in this path. ------------- PR Comment: https://git.openjdk.org/jdk/pull/21565#issuecomment-2433252605