The next patches where less straightforward. When running java I was getting a ton of messages like:Thread 832744400 has exited with leftover thread-specific data after 4 destructor iterationsAfter doing a lot of digging and debugging on Linux, I found the code path for Linux was identical for Freebsd and the cleanup destructor was being executed 4 times just like Freebsd, the difference being that Freebsd would print out this benign warning while Linux would just ignore it. The problem is that all threads that are created and initialize TLS current thread data, must clean them up by explicitly setting the TLS current thread to null. I’ve come up with two approaches to accomplish this.clean up TLS current thread at end of ::run functions similar to how it's done in openjdk8.
http://brian.timestudybuddy.com/webrev/hotspot__clear_thread_current/webrev/
clear current thread before exiting java_start to avoid warnings from leftover pthread_setspecific data
http://brian.timestudybuddy.com/webrev/hotspot__clear_thread_current_alt/webrev/
With all these patches I’ve accomplished my initial goal of getting Freebsd to build cleanly and compile and run HelloWorld cleanly on FreebsdThanks,Brian Gardner