JDK-8364228 : Remove old macos PLATFORM_MONITOR_IMPL_INDIRECT workaround in mutex_posix
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Priority: P4
  • Status: New
  • Resolution: Unresolved
  • Submitted: 2025-07-28
  • Updated: 2025-07-28
Description
We have this code with the comment:

// Workaround for a bug in macOSX kernel's pthread support (fixed in Mojave?).
// Avoid ever allocating a pthread_mutex_t at the same address as one of our
// former pthread_cond_t, by using freelists of mutexes and condvars.
// Conditional to avoid extra indirection and padding loss on other platforms.
#ifdef __APPLE__
#define PLATFORM_MONITOR_IMPL_INDIRECT 1
#else
#define PLATFORM_MONITOR_IMPL_INDIRECT 0
#endif

It is time to remove it.
Comments
Hmm, crashes here: --------------- T H R E A D --------------- Current thread (0x000000012a82ee10): JavaThread "Intro" [_thread_in_Java, id=92171, stack(0x0000000377d6c000,0x0000000377f6f000) (2060K)] Stack: [0x0000000377d6c000,0x0000000377f6f000], sp=0x0000000377f6e660, free space=2057k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) V [libjvm.dylib+0x8478cc] NativeStackPrinter::print_stack(outputStream*, char*, int, unsigned char*&, bool, int)+0x14 (javaThread.cpp:2182) V [libjvm.dylib+0x85715c] VMError::report(outputStream*, bool)+0x1468 V [libjvm.dylib+0x85a024] VMError::report_and_die(int, char const*, char const*, char*, Thread*, unsigned char*, void const*, void const*, char const*, int, unsigned long)+0x530 V [libjvm.dylib+0x850cd4] print_error_for_unit_test(char const*, char const*, char*)+0x0 V [libjvm.dylib+0x5e9b74] JavaThread::create_system_thread_object(char const*, JavaThread*)+0x0 J 1649 c1 java.util.ArrayList.get(I)Ljava/lang/Object; java.base@26-internal (15 bytes) @ 0x000000010f4c0870 [0x000000010f4c0800+0x0000000000000070] j java2d.Intro$Surface.run()V+67 j java.lang.Thread.runWith(Ljava/lang/Object;Ljava/lang/Runnable;)V+5 java.base@26-internal j java.lang.Thread.run()V+19 java.base@26-internal v ~StubRoutines::Stub Generator call_stub_stub 0x000000011683049c V [libjvm.dylib+0x5bd444] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, JavaThread*)+0x390 V [libjvm.dylib+0x5bc394] JavaCalls::call_virtual(JavaValue*, Klass*, Symbol*, Symbol*, JavaCallArguments*, JavaThread*)+0x120 V [libjvm.dylib+0x5bc578] JavaCalls::call_virtual(JavaValue*, Handle, Klass*, Symbol*, Symbol*, JavaThread*)+0x7c V [libjvm.dylib+0x74fd28] thread_entry(JavaThread*, JavaThread*)+0xcc V [libjvm.dylib+0x5e5388] JavaThread::thread_main_inner()+0x100 V [libjvm.dylib+0x5e5018] JavaThread::run()+0x184 V [libjvm.dylib+0x53f7b8] Thread::call_run()+0x100 V [libjvm.dylib+0x37686c] thread_native_entry(Thread*)+0xe0 C [libsystem_pthread.dylib+0x6c0c] _pthread_start+0x88 Lock stack of current Java thread (top to bottom): Looks, like we still need it after all?
28-07-2025