From 6069acee75cbcdcedde3a2ff026d67c086f23eee Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Thu, 30 Jul 2026 10:35:39 +1000 Subject: [PATCH 01/15] Portability improvements Author: Jeremie Koenig Also-by: Damien Raude-Morvan (Heavily rebased) --- hotspot/make/defs.make | 6 + .../src/os/linux/vm/attachListener_linux.cpp | 33 +++- hotspot/src/os/linux/vm/jvm_linux.cpp | 2 + hotspot/src/os/linux/vm/jvm_linux.h | 13 ++ hotspot/src/os/linux/vm/os_linux.cpp | 163 ++++++++++++++---- hotspot/src/os/posix/launcher/java_md.c | 25 ++- hotspot/src/os/posix/vm/os_posix.cpp | 2 + .../src/os_cpu/linux_x86/vm/os_linux_x86.cpp | 64 ++++--- hotspot/src/share/vm/memory/allocation.hpp | 2 + hotspot/src/share/vm/oops/generateOopMap.cpp | 2 + 10 files changed, 243 insertions(+), 69 deletions(-) diff --git a/hotspot/make/defs.make b/hotspot/make/defs.make index 3e2e224fc0..6b5f9ff642 100644 --- a/hotspot/make/defs.make +++ b/hotspot/make/defs.make @@ -164,12 +164,18 @@ endif # Windows should have OS predefined ifeq ($(OS),) OS := $(shell uname -s) + ifeq ($(OS), GNU/kFreeBSD) + OS=Linux + endif ifneq ($(findstring BSD,$(OS)),) OS=bsd endif ifeq ($(OS), Darwin) OS=bsd endif + ifeq ($(OS), GNU) + OS=Linux + endif HOST := $(shell uname -n) endif diff --git a/hotspot/src/os/linux/vm/attachListener_linux.cpp b/hotspot/src/os/linux/vm/attachListener_linux.cpp index 59a64d00b7..50c3b16cc9 100644 --- a/hotspot/src/os/linux/vm/attachListener_linux.cpp +++ b/hotspot/src/os/linux/vm/attachListener_linux.cpp @@ -35,6 +35,10 @@ #include #include +#if defined(__FreeBSD_kernel__) +# include +#endif + #ifndef UNIX_PATH_MAX #define UNIX_PATH_MAX sizeof(((struct sockaddr_un *)0)->sun_path) #endif @@ -55,6 +59,27 @@ // obtain the credentials of client. We check that the effective uid // of the client matches this process. +// Linux (SO_PEERCRED) and FreeBSD (LOCAL_PEERCRED) have very similar +// interfaces for this but incompatible names, so we define macros for each +// system which are used in dequeue() below. For systems which don't have +// either, you may want to disable the check (#warning below, but make sure +// file modes are enough to prevent unwanted connections). +#ifdef SO_PEERCRED +# define UCRED_OPTION SO_PEERCRED +# define UCRED_T struct ucred +# define UCRED_UID uid +# define UCRED_GID gid +#elif defined(LOCAL_PEERCRED) +# define UCRED_OPTION LOCAL_PEERCRED +# define UCRED_T struct xucred +# define UCRED_UID cr_uid +# define UCRED_GID cr_gid +#elif defined(__GNU__) +//XXX fails on -Werror # warning SO_PEERCRED not available, authentication will rely on file mode +#else +# error SO_PEERCRED not available, please implement checks for your system +#endif + // forward reference class LinuxAttachOperation; @@ -335,11 +360,12 @@ LinuxAttachOperation* LinuxAttachListener::dequeue() { return NULL; // log a warning? } +#ifdef UCRED_OPTION // (see above) // get the credentials of the peer and check the effective uid/guid // - check with jeff on this. - struct ucred cred_info; + UCRED_T cred_info; socklen_t optlen = sizeof(cred_info); - if (::getsockopt(s, SOL_SOCKET, SO_PEERCRED, (void*)&cred_info, &optlen) == -1) { + if (::getsockopt(s, SOL_SOCKET, UCRED_OPTION, (void*)&cred_info, &optlen) == -1) { int res; RESTARTABLE(::close(s), res); continue; @@ -347,11 +373,12 @@ LinuxAttachOperation* LinuxAttachListener::dequeue() { uid_t euid = geteuid(); gid_t egid = getegid(); - if (cred_info.uid != euid || cred_info.gid != egid) { + if (cred_info.UCRED_UID != euid || cred_info.UCRED_GID != egid) { int res; RESTARTABLE(::close(s), res); continue; } +#endif // peer credential look okay so we read the request LinuxAttachOperation* op = read_request(s); diff --git a/hotspot/src/os/linux/vm/jvm_linux.cpp b/hotspot/src/os/linux/vm/jvm_linux.cpp index ba84788a1b..8c4937a714 100644 --- a/hotspot/src/os/linux/vm/jvm_linux.cpp +++ b/hotspot/src/os/linux/vm/jvm_linux.cpp @@ -169,7 +169,9 @@ struct siglabel siglabels[] = { "WINCH", SIGWINCH, /* Window size change (4.3 BSD, Sun). */ "POLL", SIGPOLL, /* Pollable event occurred (System V). */ "IO", SIGIO, /* I/O now possible (4.2 BSD). */ +#ifdef SIGPWR "PWR", SIGPWR, /* Power failure restart (System V). */ +#endif #ifdef SIGSYS "SYS", SIGSYS /* Bad system call. Only on some Linuxen! */ #endif diff --git a/hotspot/src/os/linux/vm/jvm_linux.h b/hotspot/src/os/linux/vm/jvm_linux.h index dd5e389418..b71415c716 100644 --- a/hotspot/src/os/linux/vm/jvm_linux.h +++ b/hotspot/src/os/linux/vm/jvm_linux.h @@ -46,6 +46,19 @@ #include /* For socklen_t */ #include /* For F_OK, R_OK, W_OK */ +/* MAXPATHLEN and PATH_MAX are optional. */ +#ifndef MAXPATHLEN +# define MAXPATHLEN 4096 +#endif +#ifndef PATH_MAX +# define PATH_MAX MAXPATHLEN +#endif + +/* MAP_NORESERVE is Linux-specific. */ +#ifndef MAP_NORESERVE +# define MAP_NORESERVE 0 +#endif + #define JNI_ONLOAD_SYMBOLS {"JNI_OnLoad"} #define JNI_ONUNLOAD_SYMBOLS {"JNI_OnUnload"} #define JVM_ONLOAD_SYMBOLS {"JVM_OnLoad"} diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp index 19a2f6a1fb..82ace648d8 100644 --- a/hotspot/src/os/linux/vm/os_linux.cpp +++ b/hotspot/src/os/linux/vm/os_linux.cpp @@ -114,8 +114,6 @@ # include # include # include -# include -# include # include # include # include @@ -123,8 +121,18 @@ # include # include # include +#if defined(__linux__) || defined(__GNU__) +# include +# include +#endif +#ifdef __FreeBSD_kernel__ +# include +# include +#endif -#include +#ifndef __GNU__ +# include +#endif #ifndef _GNU_SOURCE #define _GNU_SOURCE @@ -142,6 +150,10 @@ #define MAX_PATH (2 * K) +#ifndef ETIME +# define ETIME ETIMEDOUT +#endif + #define MAX_SECS 100000000 // for timer info max values which include all bits @@ -234,11 +246,27 @@ julong os::available_memory() { } julong os::Linux::available_memory() { +#ifdef __linux__ // values in struct sysinfo are "unsigned long" struct sysinfo si; sysinfo(&si); return (julong)si.freeram * si.mem_unit; +#elif defined(__FreeBSD_kernel__) + int mib[2] = {CTL_HW, HW_USERMEM}, mem; + size_t len; + len = sizeof(mem); + if (sysctl(mib, 2, &mem, &len, NULL, 0) == 0) { + return (julong) mem; + } else { + return 0; + } +#elif defined(_SC_AVPHYS_PAGES) + // all glibc-based systems and more + return (julong) sysconf(_SC_AVPHYS_PAGES) * (julong) sysconf(_SC_PAGESIZE); +#else +# error Please implement os::available_memory() for this system. +#endif } julong os::physical_memory() { @@ -271,22 +299,6 @@ bool os::have_special_privileges() { return privileges; } - -#ifndef SYS_gettid -// i386: 224, ia64: 1105, amd64: 186, sparc 143 -#ifdef __ia64__ -#define SYS_gettid 1105 -#elif __i386__ -#define SYS_gettid 224 -#elif __amd64__ -#define SYS_gettid 186 -#elif __sparc__ -#define SYS_gettid 143 -#else -#error define gettid for the arch -#endif -#endif - // Cpu architecture string #if defined(ZERO) static char cpu_arch[] = ZERO_LIBARCH; @@ -318,6 +330,20 @@ static char cpu_arch[] = "aarch64"; #error Add appropriate cpu_arch setting #endif +#if defined(__linux__) || defined(__GNU__) +# ifndef SYS_gettid +# ifdef __ia64__ +# define SYS_gettid 1105 +# elif __i386__ +# define SYS_gettid 224 +# elif __amd64__ +# define SYS_gettid 186 +# elif __sparc__ +# define SYS_gettid 143 +# else +# error define gettid for the arch +# endif +# endif // pid_t gettid() // @@ -336,7 +362,9 @@ pid_t os::Linux::gettid() { return (pid_t)rslt; } } +#endif //__linux__ +#ifdef __linux__ // Most versions of linux have a bug where the number of processors are // determined by looking at the /proc file system. In a chroot environment, // the system call returns 1. This causes the VM to act as if it is @@ -345,9 +373,11 @@ static bool unsafe_chroot_detected = false; static const char *unstable_chroot_error = "/proc file system not found.\n" "Java may be unstable running multithreaded in a chroot " "environment on Linux when /proc filesystem is not mounted."; +#endif void os::Linux::initialize_system_info() { set_processor_count(sysconf(_SC_NPROCESSORS_CONF)); +#ifdef __linux__ if (processor_count() == 1) { pid_t pid = os::Linux::gettid(); char fname[32]; @@ -359,6 +389,7 @@ void os::Linux::initialize_system_info() { fclose(fp); } } +#endif _physical_memory = (julong)sysconf(_SC_PHYS_PAGES) * (julong)sysconf(_SC_PAGESIZE); assert(processor_count() > 0, "linux error"); } @@ -1372,8 +1403,13 @@ void os::Linux::capture_initial_stack(size_t max_size) { // thread stack grows on demand, its real bottom is high - RLIMIT_STACK.) stack_top = (uintptr_t)high; } else { +// NB: we need to inhibit the warning on Hurd, because not having +// /proc/self/maps is expected, and the message breaks the build +// (it finds its way into template-expanded .java files) +#ifndef __GNU__ // failed, likely because /proc/self/maps does not exist warning("Can't detect initial thread stack location - find_vma failed"); +#endif // best effort: stack_start is normally within a few pages below the real // stack top, use it as stack top, and reduce stack size so we won't put // guard page outside stack. @@ -1485,7 +1521,7 @@ void os::Linux::clock_init() { #ifndef SYS_clock_getres -#if defined(IA32) || defined(AMD64) || defined(AARCH64) +#if (defined(__linux__) || defined(__GNU__)) && defined(IA32) || defined(AMD64) || defined(AARCH64) #ifdef BUILTIN_SIM #define SYS_clock_getres 229 #else @@ -2268,11 +2304,13 @@ void os::print_os_info(outputStream* st) { os::Posix::print_uname_info(st); +#ifdef __linux__ // Print warning if unsafe chroot environment detected if (unsafe_chroot_detected) { st->print("WARNING!! "); st->print_cr("%s", unstable_chroot_error); } +#endif os::Linux::print_libversion_info(st); @@ -2325,19 +2363,22 @@ void os::print_memory_info(outputStream* st) { st->print("Memory:"); st->print(" %dk page", os::vm_page_size()>>10); + st->print(", physical " UINT64_FORMAT "k", + os::physical_memory() >> 10); + st->print("(" UINT64_FORMAT "k free)", + os::available_memory() >> 10); +#ifdef __linux__ // values in struct sysinfo are "unsigned long" struct sysinfo si; sysinfo(&si); - st->print(", physical " UINT64_FORMAT "k", - os::physical_memory() >> 10); - st->print("(" UINT64_FORMAT "k free)", - os::available_memory() >> 10); st->print(", swap " UINT64_FORMAT "k", ((jlong)si.totalswap * si.mem_unit) >> 10); st->print("(" UINT64_FORMAT "k free)", ((jlong)si.freeswap * si.mem_unit) >> 10); +#endif + st->cr(); } @@ -4078,13 +4119,19 @@ static int prio_init() { } OSReturn os::set_native_priority(Thread* thread, int newpri) { +#if defined(__linux__) || defined(__GNU__) if ( !UseThreadPriorities || ThreadPriorityPolicy == 0 ) return OS_OK; int ret = setpriority(PRIO_PROCESS, thread->osthread()->thread_id(), newpri); return (ret == 0) ? OS_OK : OS_ERR; +#else +# warning os::set_native_priority has been stubbed + return OS_OK; +#endif } OSReturn os::get_native_priority(const Thread* const thread, int *priority_ptr) { +#if defined(__linux__) || defined(__GNU__) if ( !UseThreadPriorities || ThreadPriorityPolicy == 0 ) { *priority_ptr = java_to_os_priority[NormPriority]; return OS_OK; @@ -4093,6 +4140,11 @@ OSReturn os::get_native_priority(const Thread* const thread, int *priority_ptr) errno = 0; *priority_ptr = getpriority(PRIO_PROCESS, thread->osthread()->thread_id()); return (*priority_ptr != -1 || errno == 0 ? OS_OK : OS_ERR); +#else +# warning os::get_native_priority has been stubbed + *priority_ptr = java_to_os_priority[NormPriority]; + return OS_OK; +#endif } // Hint to the underlying OS that a task switch would not be good. @@ -4829,17 +4881,25 @@ extern void report_error(char* file_name, int line_no, char* title, char* format extern bool signal_name(int signo, char* buf, size_t len); const char* os::exception_name(int exception_code, char* buf, size_t size) { - if (0 < exception_code && exception_code <= SIGRTMAX) { - // signal - if (!signal_name(exception_code, buf, size)) { - jio_snprintf(buf, size, "SIG%d", exception_code); - } - return buf; - } else { +#ifdef _NSIG + if (exception_code <= 0 || exception_code >= _NSIG) { + return NULL; + } +#elif defined(SIGRTMAX) + if (exception_code <= 0 || exception_code > SIGRTMAX) { return NULL; } +#else +# error Cannot figure out the number of signals. +#endif + if (!signal_name(exception_code, buf, size)) { + jio_snprintf(buf, size, "SIG%d", exception_code); + } + return buf; } +#ifndef __GNU__ + /* Per task speculation control */ #ifndef PR_GET_SPECULATION_CTRL # define PR_GET_SPECULATION_CTRL 52 @@ -4882,6 +4942,8 @@ static void set_speculation() { prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_STORE_BYPASS, PR_SPEC_DISABLE, 0, 0); } +#endif // !__GNU__ + // this is called _before_ the most of global arguments have been parsed void os::init(void) { char dummy; /* used to get a guess on initial stack address */ @@ -5244,9 +5306,8 @@ ExtendedPC os::get_thread_pc(Thread* thread) { int os::Linux::safe_cond_timedwait(pthread_cond_t *_cond, pthread_mutex_t *_mutex, const struct timespec *_abstime) { - if (is_NPTL()) { - return pthread_cond_timedwait(_cond, _mutex, _abstime); - } else { +#ifdef __linux__ + if (!is_NPTL()) { // 6292965: LinuxThreads pthread_cond_timedwait() resets FPU control // word back to default 64bit precision if condvar is signaled. Java // wants 53bit precision. Save and restore current value. @@ -5255,6 +5316,8 @@ int os::Linux::safe_cond_timedwait(pthread_cond_t *_cond, pthread_mutex_t *_mute set_fpu_control_word(fpu); return status; } +#endif + return pthread_cond_timedwait(_cond, _mutex, _abstime); } //////////////////////////////////////////////////////////////////////////////// @@ -5384,8 +5447,13 @@ bool os::dir_is_empty(const char* path) { // This code originates from JDK's sysOpen and open64_w // from src/solaris/hpi/src/system_md.c +/* Other definition in jdk/src/solaris/javavm/export/jvm_md.h */ #ifndef O_DELETE -#define O_DELETE 0x10000 +# ifdef __GNU__ +# define O_DELETE 0x40000000 /* 0x10000 is O_TRUNC on Hurd. */ +# else +# define O_DELETE 0x10000 +# endif #endif // Open a file. Unlink the file immediately after open returns @@ -5394,6 +5462,12 @@ bool os::dir_is_empty(const char* path) { int os::open(const char *path, int oflag, int mode) { +#ifndef __linux__ + // Some of the code using this assumes that O_RDONLY == 0, + // which is true on Linux but not everywhere. + if (oflag == 0) oflag = O_RDONLY; +#endif + if (strlen(path) > MAX_PATH - 1) { errno = ENAMETOOLONG; return -1; @@ -5639,6 +5713,7 @@ jlong os::thread_cpu_time(Thread *thread, bool user_sys_cpu_time) { // -1 on error. // +#if defined(__linux__) || defined(__GNU__) static jlong slow_thread_cpu_time(Thread *thread, bool user_sys_cpu_time) { static bool proc_pid_cpu_avail = true; static bool proc_task_unchecked = true; @@ -5724,6 +5799,12 @@ static jlong slow_thread_cpu_time(Thread *thread, bool user_sys_cpu_time) { return (jlong)user_time * (1000000000 / clock_tics_per_sec); } } +#else +// Portable "implementation" +static jlong slow_thread_cpu_time(Thread *thread, bool user_sys_cpu_time) { + return -1; +} +#endif void os::current_thread_cpu_time_info(jvmtiTimerInfo *info_ptr) { info_ptr->max_value = ALL_64_BITS; // will not wrap in less than 64 bits @@ -6292,14 +6373,15 @@ int os::fork_and_exec(char* cmd) { int is_child; pid_t pid; +#ifdef __linux__ // fork() in LinuxThreads/NPTL is not async-safe. It needs to run // pthread_atfork handlers and reset pthread library. All we need is a // separate process to execve. Make a direct syscall to fork process. // On IA64 there's no fork syscall, we have to use fork() and hope for // the best... -#if defined(SPARC) +# if defined(SPARC) sparc_fork(__NR_fork, &pid, &is_child); -#else +# else pid = NOT_IA64(syscall(__NR_fork);) IA64_ONLY(fork();) @@ -6309,6 +6391,9 @@ int os::fork_and_exec(char* cmd) { } else { is_child = 0; } +# endif +#else + pid = fork(); #endif if (pid < 0) { @@ -6318,6 +6403,7 @@ int os::fork_and_exec(char* cmd) { } else if (is_child) { // child process +#ifdef __linux__ // execve() in LinuxThreads will call pthread_kill_other_threads_np() // first to kill every thread on the thread list. Because this list is // not reset by fork() (see notes above), execve() will instead kill @@ -6327,6 +6413,9 @@ int os::fork_and_exec(char* cmd) { // above. NOT_IA64(syscall(__NR_execve, "/bin/sh", argv, environ);) IA64_ONLY(execve("/bin/sh", (char* const*)argv, environ);) +#else + execve("/bin/sh", (char* const*)argv, environ); +#endif // execve failed _exit(-1); diff --git a/hotspot/src/os/posix/launcher/java_md.c b/hotspot/src/os/posix/launcher/java_md.c index 6ba07698a9..25a1a226bc 100644 --- a/hotspot/src/os/posix/launcher/java_md.c +++ b/hotspot/src/os/posix/launcher/java_md.c @@ -41,12 +41,19 @@ #include "version_comp.h" #endif -#if defined(__linux__) || defined(_ALLBSD_SOURCE) +#if defined(__linux__) || defined(__GNU__) || defined(_ALLBSD_SOURCE) #include #else #include #endif +#ifndef MAXPATHLEN +# define MAXPATHLEN 4096 +#endif +#ifndef PATH_MAX +# define PATH_MAX MAXPATHLEN +#endif + // We use our own dladdr() implementation on AIX since there is no dladdr. #ifdef AIX #include "porting_aix.hpp" @@ -444,7 +451,7 @@ CreateExecutionEnvironment(int *_argcp, runpath = getenv(LD_LIBRARY_PATH); #endif /* __sun */ -#if defined(__linux__) +#if defined(__linux__) || defined(__GLIBC__) /* * On linux, if a binary is running as sgid or suid, glibc sets * LD_LIBRARY_PATH to the empty string for security purposes. (In @@ -834,7 +841,7 @@ LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn) jboolean GetApplicationHome(char *buf, jint bufsize) { -#if defined(__linux__) || defined(_ALLBSD_SOURCE) +#if defined(__linux__) || defined(__GLIBC__) || defined(__GNU__) || defined(_ALLBSD_SOURCE) char *execname = GetExecname(); if (execname) { strncpy(buf, execname, bufsize-1); @@ -1003,7 +1010,7 @@ SetExecname(char **argv) } } } -#elif defined(__linux__) +#elif defined(__linux__) || defined(__GNU__) || defined(__FreeBSD_kernel__) { const char* self = "/proc/self/exe"; char buf[PATH_MAX+1]; @@ -1217,7 +1224,7 @@ get_cpuid(uint32_t arg, #endif /* __sun && i586 */ -#if (defined(__linux__) || defined(_ALLBSD_SOURCE)) && defined(i586) +#if (defined(__linux__) || defined(__GNU__) || defined(_ALLBSD_SOURCE)) && defined(i586) /* * A utility method for asking the CPU about itself. @@ -1461,7 +1468,7 @@ solaris_i586_ServerClassMachine(void) { #endif /* __sun && i586 */ -#if defined(__linux__) && defined(i586) +#if (defined(__linux__) || defined(__GNU__)) && defined(i586) /* The definition of a server-class machine for linux-i586 */ jboolean @@ -1539,7 +1546,7 @@ ServerClassMachine(void) { result = solaris_sparc_ServerClassMachine(); #elif defined(__sun) && defined(i586) result = solaris_i586_ServerClassMachine(); -#elif defined(__linux__) && defined(i586) +#elif (defined(__linux__) || defined(__GNU__)) && defined(i586) result = linux_i586_ServerClassMachine(); #elif defined(_ALLBSD_SOURCE) && defined(i586) result = bsd_i586_ServerClassMachine(); @@ -1893,7 +1900,7 @@ void SplashFreeLibrary() { int ContinueInNewThread(int (JNICALL *continuation)(void *), jlong stack_size, void * args) { int rslt; -#if defined(__linux__) || defined(AIX) || defined(_ALLBSD_SOURCE) +#if defined(__linux__) || defined(__GNU__) || defined(AIX) || defined(_ALLBSD_SOURCE) pthread_t tid; pthread_attr_t attr; pthread_attr_init(&attr); @@ -1938,7 +1945,7 @@ ContinueInNewThread(int (JNICALL *continuation)(void *), jlong stack_size, void void SetJavaLauncherPlatformProps() { /* Linux only */ -#ifdef __linux__ +#if defined(__linux__) || defined(__GNU__) const char *substr = "-Dsun.java.launcher.pid="; char *pid_prop_str = (char *)JLI_MemAlloc(strlen(substr) + MAX_PID_STR_SZ + 1); sprintf(pid_prop_str, "%s%d", substr, getpid()); diff --git a/hotspot/src/os/posix/vm/os_posix.cpp b/hotspot/src/os/posix/vm/os_posix.cpp index e6932417dd..78244a2c62 100644 --- a/hotspot/src/os/posix/vm/os_posix.cpp +++ b/hotspot/src/os/posix/vm/os_posix.cpp @@ -535,7 +535,9 @@ const char* os::Posix::describe_sa_flags(int flags, char* buffer, size_t size) { { SA_RESETHAND, "SA_RESETHAND" }, { SA_RESTART, "SA_RESTART" }, { SA_SIGINFO, "SA_SIGINFO" }, +#ifndef __GNU__ { SA_NOCLDWAIT, "SA_NOCLDWAIT" }, +#endif { SA_NODEFER, "SA_NODEFER" }, #ifdef AIX { SA_ONSTACK, "SA_ONSTACK" }, diff --git a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp index ef71dc5d24..cabf195798 100644 --- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp +++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp @@ -75,19 +75,41 @@ # include # include +#if defined(__linux__) || defined(__GNU__) +# define context_trapno uc_mcontext.gregs[REG_TRAPNO] +# ifdef AMD64 +# define context_sp uc_mcontext.gregs[REG_RSP] +# define context_pc uc_mcontext.gregs[REG_RIP] +# define context_fp uc_mcontext.gregs[REG_RBP] +# define context_fl uc_mcontext.gregs[REG_RFL] +# else +# define context_sp uc_mcontext.gregs[REG_UESP] +# define context_pc uc_mcontext.gregs[REG_EIP] +# define context_fp uc_mcontext.gregs[REG_EBP] +# define context_fl uc_mcontext.gregs[REG_EFL] +# endif +#elif defined(__FreeBSD_kernel__) +# define context_trapno uc_mcontext.mc_trapno +# ifdef AMD64 +# define context_pc uc_mcontext.mc_rip +# define context_sp uc_mcontext.mc_rsp +# define context_fp uc_mcontext.mc_rbp +# else +# define context_pc uc_mcontext.mc_eip +# define context_sp uc_mcontext.mc_esp +# define context_fp uc_mcontext.mc_ebp +# endif +#else +# error The layout of ucontext_t is unknown for this system +#endif + #ifdef AMD64 -#define REG_SP REG_RSP -#define REG_PC REG_RIP -#define REG_FP REG_RBP -#define SPELL_REG_SP "rsp" -#define SPELL_REG_FP "rbp" +# define SPELL_REG_SP "rsp" +# define SPELL_REG_FP "rbp" #else -#define REG_SP REG_UESP -#define REG_PC REG_EIP -#define REG_FP REG_EBP -#define SPELL_REG_SP "esp" -#define SPELL_REG_FP "ebp" -#endif // AMD64 +# define SPELL_REG_SP "esp" +# define SPELL_REG_FP "ebp" +#endif address os::current_stack_pointer() { #ifdef SPARC_WORKS @@ -113,15 +135,15 @@ void os::initialize_thread(Thread* thr) { } address os::Linux::ucontext_get_pc(ucontext_t * uc) { - return (address)uc->uc_mcontext.gregs[REG_PC]; + return (address)uc->context_pc; } intptr_t* os::Linux::ucontext_get_sp(ucontext_t * uc) { - return (intptr_t*)uc->uc_mcontext.gregs[REG_SP]; + return (intptr_t*)uc->context_sp; } intptr_t* os::Linux::ucontext_get_fp(ucontext_t * uc) { - return (intptr_t*)uc->uc_mcontext.gregs[REG_FP]; + return (intptr_t*)uc->context_fp; } // For Forte Analyzer AsyncGetCallTrace profiling support - thread @@ -277,12 +299,12 @@ JVM_handle_linux_signal(int sig, pc = (address) os::Linux::ucontext_get_pc(uc); if (pc == (address) Fetch32PFI) { - uc->uc_mcontext.gregs[REG_PC] = intptr_t(Fetch32Resume) ; + uc->context_pc = intptr_t(Fetch32Resume) ; return 1 ; } #ifdef AMD64 if (pc == (address) FetchNPFI) { - uc->uc_mcontext.gregs[REG_PC] = intptr_t (FetchNResume) ; + uc->context_pc = intptr_t (FetchNResume) ; return 1 ; } #endif // AMD64 @@ -433,7 +455,7 @@ JVM_handle_linux_signal(int sig, // Furthermore, a false-positive should be harmless. if (UnguardOnExecutionViolation > 0 && (sig == SIGSEGV || sig == SIGBUS) && - uc->uc_mcontext.gregs[REG_TRAPNO] == trap_page_fault) { + uc->context_trapno == trap_page_fault) { int page_size = os::vm_page_size(); address addr = (address) info->si_addr; address pc = os::Linux::ucontext_get_pc(uc); @@ -503,7 +525,7 @@ JVM_handle_linux_signal(int sig, // save all thread context in case we need to restore it if (thread != NULL) thread->set_saved_exception_pc(pc); - uc->uc_mcontext.gregs[REG_PC] = (greg_t)stub; + uc->context_pc = (greg_t)stub; return true; } @@ -778,8 +800,8 @@ void os::print_context(outputStream *st, void *context) { st->print(", R15=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R15]); st->cr(); st->print( "RIP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RIP]); - st->print(", EFLAGS=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EFL]); - st->print(", CSGSFS=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_CSGSFS]); + st->print(", RFLAGS=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RFL]); + st->print(", CS=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_CS]); st->print(", ERR=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_ERR]); st->cr(); st->print(" TRAPNO=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_TRAPNO]); @@ -796,7 +818,9 @@ void os::print_context(outputStream *st, void *context) { st->cr(); st->print( "EIP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EIP]); st->print(", EFLAGS=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EFL]); +# ifdef __linux__ st->print(", CR2=" INTPTR_FORMAT, uc->uc_mcontext.cr2); +# endif #endif // AMD64 st->cr(); st->cr(); diff --git a/hotspot/src/share/vm/memory/allocation.hpp b/hotspot/src/share/vm/memory/allocation.hpp index e5c1bbdc9e..7119cc0da2 100644 --- a/hotspot/src/share/vm/memory/allocation.hpp +++ b/hotspot/src/share/vm/memory/allocation.hpp @@ -303,12 +303,14 @@ class Arena : public CHeapObj { bool check_for_overflow(size_t request, const char* whence, AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM) const { +#ifndef __FreeBSD_kernel__ //FIXME if (UINTPTR_MAX - request < (uintptr_t)_hwm) { if (alloc_failmode == AllocFailStrategy::RETURN_NULL) { return false; } signal_out_of_memory(request, whence); } +#endif return true; } diff --git a/hotspot/src/share/vm/oops/generateOopMap.cpp b/hotspot/src/share/vm/oops/generateOopMap.cpp index 7639cbdcd8..a84433b864 100644 --- a/hotspot/src/share/vm/oops/generateOopMap.cpp +++ b/hotspot/src/share/vm/oops/generateOopMap.cpp @@ -978,11 +978,13 @@ void GenerateOopMap::init_basic_blocks() { // The product of bbNo and _state_len can get large if there are lots of // basic blocks and stack/locals/monitors. Need to check to make sure // we don't overflow the capacity of a pointer. +#ifndef __FreeBSD_kernel__ // FIXME if ((unsigned)bbNo > UINTPTR_MAX / sizeof(CellTypeState) / _state_len) { report_error("The amount of memory required to analyze this method " "exceeds addressable range"); return; } +#endif CellTypeState *basicBlockState; ALLOC_RESOURCE_ARRAY(basicBlockState, CellTypeState, bbNo * _state_len); From c7cfcfad66dfaa47d08e207c4161d2ea5d3c789c Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Mon, 26 Jan 2026 11:52:08 +1100 Subject: [PATCH 02/15] Allow setting SKIP_FREETYPE_CHECK for broken freetype check The current freetypecheck compares the version string: a.b.c using strcmp which fails for version numbers. Let's just skip the check for now. --- jdk/make/common/shared/Sanity.gmk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jdk/make/common/shared/Sanity.gmk b/jdk/make/common/shared/Sanity.gmk index 644c4e10db..ffd12a3570 100644 --- a/jdk/make/common/shared/Sanity.gmk +++ b/jdk/make/common/shared/Sanity.gmk @@ -815,6 +815,7 @@ sane-cacerts: ifdef OPENJDK ifndef CROSS_COMPILE_ARCH + ifndef SKIP_FREETYPE_CHECK # The freetypecheck Makefile prints out "Failed" if not good enough $(TEMPDIR)/freetypeinfo: FRC @$(prep-target) @@ -827,6 +828,9 @@ ifdef OPENJDK " or higher is required. \n" \ "`$(CAT) $<` \n" >> $(ERROR_FILE) ; \ fi + else + sane-freetype: + endif else #do nothing (cross-compiling) sane-freetype: From c3a859dbb3dd7278751cd1c60fafc672c9d2d7a3 Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Thu, 30 Jul 2026 13:52:23 +1000 Subject: [PATCH 03/15] Reduce REQUIRED_BOOT_VER to 1.5 Since we can obtain a javac 1.6 jar that runs on 1.5, we should be able to bootstrap jdk7 using this developer bootstrap toolchain compiled from jdk6. Setting this value lower allows us to compile the 1.7 langtools targeted at 1.5 jvm so that we can run enough of the tools using the existing 1.5 jvm to bootstrap jdk7. --- jdk/make/common/shared/Defs-versions.gmk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/make/common/shared/Defs-versions.gmk b/jdk/make/common/shared/Defs-versions.gmk index 7cdebb2779..b835c72818 100644 --- a/jdk/make/common/shared/Defs-versions.gmk +++ b/jdk/make/common/shared/Defs-versions.gmk @@ -212,7 +212,7 @@ endif # Generic REQUIRED_ANT_VER = 1.7.1 -REQUIRED_BOOT_VER = 1.6 +REQUIRED_BOOT_VER = 1.5 REQUIRED_FREETYPE_VERSION = 2.2.1 REQUIRED_MAKE_VER = 3.81 REQUIRED_UNZIP_VER = 5.12 From d49c7ca32e9d02dbfa9207ef929cff2cf5238a7f Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Tue, 27 Jan 2026 17:55:43 +1100 Subject: [PATCH 04/15] javac: Remove super invocation for non-existant class --- .../share/classes/com/sun/tools/javac/file/ZipFileIndex.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java b/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java index 1ca860e95d..ff9c8db0ae 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java +++ b/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java @@ -1165,9 +1165,5 @@ static final class ZipFormatException extends IOException { protected ZipFormatException(String message) { super(message); } - - protected ZipFormatException(String message, Throwable cause) { - super(message, cause); - } } } From 773ce141a4f2809527f22553f89d45126bcc2da4 Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Thu, 30 Jul 2026 22:31:44 +1000 Subject: [PATCH 05/15] langtools doclets: Simplify charset lookup so it works --- .../com/sun/tools/doclets/formats/html/markup/HtmlTree.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java index 7f14ee0144..c2a3fc8b13 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java @@ -146,7 +146,7 @@ public void addContent(String stringContent) { } protected static String encodeURL(String url) { - byte[] urlBytes = url.getBytes(Charset.forName("UTF-8")); + byte[] urlBytes = url.getBytes(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < urlBytes.length; i++) { int c = urlBytes[i]; From acdea64b395bc1aa2207496dfc2c65c970e74fb4 Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Sat, 1 Aug 2026 13:08:06 +1000 Subject: [PATCH 06/15] langtools: Fix genstubs for java 1.5 using javac 1.6 --- langtools/make/build.properties | 84 +++++++++++++++++++++++++++++++++ langtools/make/build.xml | 30 +++++++----- 2 files changed, 102 insertions(+), 12 deletions(-) diff --git a/langtools/make/build.properties b/langtools/make/build.properties index e59aed5e1e..82233de4f2 100644 --- a/langtools/make/build.properties +++ b/langtools/make/build.properties @@ -194,6 +194,90 @@ import.jdk.stub.files = \ java/nio/channels/CompletionHandler.java \ java/nio/channels/SeekableByteChannel.java +# These are the same as above, but rewritten as valid class names +import.jdk.stub.classes = \ + java.io.File \ + java.nio.file.AccessDeniedException \ + java.nio.file.AccessMode \ + java.nio.file.AtomicMoveNotSupportedException \ + java.nio.file.ClosedDirectoryStreamException \ + java.nio.file.ClosedFileSystemException \ + java.nio.file.ClosedWatchServiceException \ + java.nio.file.CopyMoveHelper \ + java.nio.file.CopyOption \ + java.nio.file.DirectoryIteratorException \ + java.nio.file.DirectoryNotEmptyException \ + java.nio.file.DirectoryStream \ + java.nio.file.FileAlreadyExistsException \ + java.nio.file.Files \ + java.nio.file.FileStore \ + java.nio.file.FileSystemAlreadyExistsException \ + java.nio.file.FileSystemException \ + java.nio.file.FileSystem \ + java.nio.file.FileSystemLoopException \ + java.nio.file.FileSystemNotFoundException \ + java.nio.file.FileSystems \ + java.nio.file.FileTreeWalker \ + java.nio.file.FileVisitOption \ + java.nio.file.FileVisitor \ + java.nio.file.FileVisitResult \ + java.nio.file.InvalidPathException \ + java.nio.file.LinkOption \ + java.nio.file.LinkPermission \ + java.nio.file.NoSuchFileException \ + java.nio.file.NotDirectoryException \ + java.nio.file.NotLinkException \ + java.nio.file.OpenOption \ + java.nio.file.package-info \ + java.nio.file.Path \ + java.nio.file.PathMatcher \ + java.nio.file.Paths \ + java.nio.file.ProviderMismatchException \ + java.nio.file.ProviderNotFoundException \ + java.nio.file.ReadOnlyFileSystemException \ + java.nio.file.SecureDirectoryStream \ + java.nio.file.SimpleFileVisitor \ + java.nio.file.StandardCopyOption \ + java.nio.file.StandardOpenOption \ + java.nio.file.StandardWatchEventKinds \ + java.nio.file.TempFileHelper \ + java.nio.file.Watchable \ + java.nio.file.WatchEvent \ + java.nio.file.WatchKey \ + java.nio.file.WatchService \ + java.nio.file.attribute.AclEntryFlag \ + java.nio.file.attribute.AclEntry \ + java.nio.file.attribute.AclEntryPermission \ + java.nio.file.attribute.AclEntryType \ + java.nio.file.attribute.AclFileAttributeView \ + java.nio.file.attribute.AttributeView \ + java.nio.file.attribute.BasicFileAttributes \ + java.nio.file.attribute.BasicFileAttributeView \ + java.nio.file.attribute.DosFileAttributes \ + java.nio.file.attribute.DosFileAttributeView \ + java.nio.file.attribute.FileAttribute \ + java.nio.file.attribute.FileAttributeView \ + java.nio.file.attribute.FileOwnerAttributeView \ + java.nio.file.attribute.FileStoreAttributeView \ + java.nio.file.attribute.FileTime \ + java.nio.file.attribute.GroupPrincipal \ + java.nio.file.attribute.package-info \ + java.nio.file.attribute.PosixFileAttributes \ + java.nio.file.attribute.PosixFileAttributeView \ + java.nio.file.attribute.PosixFilePermission \ + java.nio.file.attribute.PosixFilePermissions \ + java.nio.file.attribute.UserDefinedFileAttributeView \ + java.nio.file.attribute.UserPrincipal \ + java.nio.file.attribute.UserPrincipalLookupService \ + java.nio.file.attribute.UserPrincipalNotFoundException \ + java.nio.file.spi.FileSystemProvider \ + java.nio.file.spi.FileTypeDetector \ + java.nio.file.spi.package-info \ + java.nio.channels.AsynchronousChannel \ + java.nio.channels.AsynchronousFileChannel \ + java.nio.channels.CompletionHandler \ + java.nio.channels.SeekableByteChannel + # The following value is used by the main jtreg target. # An empty value means all tests # Override as desired to run a specific set of tests diff --git a/langtools/make/build.xml b/langtools/make/build.xml index 6fbc7f94ec..289f56994b 100644 --- a/langtools/make/build.xml +++ b/langtools/make/build.xml @@ -658,11 +658,7 @@ - + @@ -851,8 +847,8 @@ - + + + + + + + + + + + From bf3f82c14df03eccddbc2ea428134c912abb4015 Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Fri, 31 Jul 2026 18:10:08 +1000 Subject: [PATCH 07/15] BOOT_JAVA_CMD needs bootclasspath to include rt.jar This enables bootstrapping of 1.6 -> 1.7 from a 1.5 gcj that has compiled the rt.jar for 1.6 --- jdk/make/common/shared/Defs-java.gmk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/make/common/shared/Defs-java.gmk b/jdk/make/common/shared/Defs-java.gmk index 5bb383c977..e1b4e8c8b3 100644 --- a/jdk/make/common/shared/Defs-java.gmk +++ b/jdk/make/common/shared/Defs-java.gmk @@ -244,7 +244,7 @@ BOOT_JAVACFLAGS += $(NO_PROPRIETARY_API_WARNINGS) BOOT_LIB = $(BOOTDIR)/jre/lib/rt.jar BOOT_JAVACFLAGS += -bootclasspath $(BOOT_LIB) -BOOT_JAVA_CMD = $(BOOTDIR)/bin/java $(JAVA_TOOLS_FLAGS) +BOOT_JAVA_CMD = $(BOOTDIR)/bin/java $(JAVA_TOOLS_FLAGS) $(BOOT_JAVACFLAGS) BOOT_JAVAC_CMD = $(BOOTDIR)/bin/javac $(JAVAC_JVM_FLAGS) $(BOOT_JAVACFLAGS) ifdef ALT_JAR_CMD BOOT_JAR_CMD = $(ALT_JAR_CMD) From 2bf3e5aec72b916228f328fc2d5fa2a94a28bf25 Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Sun, 2 Aug 2026 11:33:13 +1000 Subject: [PATCH 08/15] trace: Fix xml code generation --- hotspot/make/aix/makefiles/trace.make | 2 +- hotspot/make/bsd/makefiles/trace.make | 2 +- hotspot/make/linux/makefiles/trace.make | 2 +- hotspot/make/solaris/makefiles/trace.make | 2 +- hotspot/make/windows/makefiles/trace.make | 2 +- hotspot/src/share/vm/trace/trace.dtd | 2 +- hotspot/src/share/vm/trace/trace.xml | 334 ++++++++++++++++ .../src/share/vm/trace/traceEventClasses.xsl | 7 +- hotspot/src/share/vm/trace/tracetypes.xml | 356 ------------------ 9 files changed, 343 insertions(+), 366 deletions(-) delete mode 100644 hotspot/src/share/vm/trace/tracetypes.xml diff --git a/hotspot/make/aix/makefiles/trace.make b/hotspot/make/aix/makefiles/trace.make index 781ad9de2b..7da3017278 100644 --- a/hotspot/make/aix/makefiles/trace.make +++ b/hotspot/make/aix/makefiles/trace.make @@ -69,7 +69,7 @@ TraceGeneratedFiles = $(TraceGeneratedNames:%=$(TraceOutDir)/%) XSLT = $(REMOTE) $(RUN.JAVA) -classpath $(JvmtiOutDir) jvmtiGen -XML_DEPS = $(TraceSrcDir)/trace.xml $(TraceSrcDir)/tracetypes.xml \ +XML_DEPS = $(TraceSrcDir)/trace.xml \ $(TraceSrcDir)/trace.dtd $(TraceSrcDir)/xinclude.mod ifeq ($(HAS_ALT_SRC), true) XML_DEPS += $(TraceAltSrcDir)/traceevents.xml diff --git a/hotspot/make/bsd/makefiles/trace.make b/hotspot/make/bsd/makefiles/trace.make index 0bedaad0ea..e2a0e02f86 100644 --- a/hotspot/make/bsd/makefiles/trace.make +++ b/hotspot/make/bsd/makefiles/trace.make @@ -69,7 +69,7 @@ TraceGeneratedFiles = $(TraceGeneratedNames:%=$(TraceOutDir)/%) XSLT = $(REMOTE) $(RUN.JAVA) -classpath $(JvmtiOutDir) jvmtiGen -XML_DEPS = $(TraceSrcDir)/trace.xml $(TraceSrcDir)/tracetypes.xml \ +XML_DEPS = $(TraceSrcDir)/trace.xml \ $(TraceSrcDir)/trace.dtd $(TraceSrcDir)/xinclude.mod ifeq ($(HAS_ALT_SRC), true) XML_DEPS += $(TraceAltSrcDir)/traceevents.xml diff --git a/hotspot/make/linux/makefiles/trace.make b/hotspot/make/linux/makefiles/trace.make index a4027cdb79..111639f254 100644 --- a/hotspot/make/linux/makefiles/trace.make +++ b/hotspot/make/linux/makefiles/trace.make @@ -68,7 +68,7 @@ TraceGeneratedFiles = $(TraceGeneratedNames:%=$(TraceOutDir)/%) XSLT = $(REMOTE) $(RUN.JAVA) -classpath $(JvmtiOutDir) jvmtiGen -XML_DEPS = $(TraceSrcDir)/trace.xml $(TraceSrcDir)/tracetypes.xml \ +XML_DEPS = $(TraceSrcDir)/trace.xml \ $(TraceSrcDir)/trace.dtd $(TraceSrcDir)/xinclude.mod ifeq ($(HAS_ALT_SRC), true) XML_DEPS += $(TraceAltSrcDir)/traceevents.xml diff --git a/hotspot/make/solaris/makefiles/trace.make b/hotspot/make/solaris/makefiles/trace.make index dbb32fdb3b..b3d773e7db 100644 --- a/hotspot/make/solaris/makefiles/trace.make +++ b/hotspot/make/solaris/makefiles/trace.make @@ -68,7 +68,7 @@ TraceGeneratedFiles = $(TraceGeneratedNames:%=$(TraceOutDir)/%) XSLT = $(REMOTE) $(RUN.JAVA) -classpath $(JvmtiOutDir) jvmtiGen -XML_DEPS = $(TraceSrcDir)/trace.xml $(TraceSrcDir)/tracetypes.xml \ +XML_DEPS = $(TraceSrcDir)/trace.xml \ $(TraceSrcDir)/trace.dtd $(TraceSrcDir)/xinclude.mod ifeq ($(HAS_ALT_SRC), true) XML_DEPS += $(TraceAltSrcDir)/traceevents.xml diff --git a/hotspot/make/windows/makefiles/trace.make b/hotspot/make/windows/makefiles/trace.make index ccdad95a39..f4d6a90b59 100644 --- a/hotspot/make/windows/makefiles/trace.make +++ b/hotspot/make/windows/makefiles/trace.make @@ -64,7 +64,7 @@ TraceGeneratedFiles = $(TraceGeneratedFiles) \ XSLT = $(QUIETLY) $(REMOTE) $(RUN_JAVA) -classpath $(JvmtiOutDir) jvmtiGen -XML_DEPS = $(TraceSrcDir)/trace.xml $(TraceSrcDir)/tracetypes.xml \ +XML_DEPS = $(TraceSrcDir)/trace.xml \ $(TraceSrcDir)/trace.dtd $(TraceSrcDir)/xinclude.mod !if EXISTS($(TraceAltSrcDir)) diff --git a/hotspot/src/share/vm/trace/trace.dtd b/hotspot/src/share/vm/trace/trace.dtd index ad066de073..43507d26bd 100644 --- a/hotspot/src/share/vm/trace/trace.dtd +++ b/hotspot/src/share/vm/trace/trace.dtd @@ -23,7 +23,7 @@ --> - + diff --git a/hotspot/src/share/vm/trace/trace.xml b/hotspot/src/share/vm/trace/trace.xml index 43f5dcff65..cd5c8892f8 100644 --- a/hotspot/src/share/vm/trace/trace.xml +++ b/hotspot/src/share/vm/trace/trace.xml @@ -30,7 +30,341 @@ ]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hotspot/src/share/vm/trace/traceEventClasses.xsl b/hotspot/src/share/vm/trace/traceEventClasses.xsl index fc08380f1a..4634459a93 100644 --- a/hotspot/src/share/vm/trace/traceEventClasses.xsl +++ b/hotspot/src/share/vm/trace/traceEventClasses.xsl @@ -155,7 +155,7 @@ public: - + @@ -192,7 +192,7 @@ public: - + @@ -209,7 +209,7 @@ public: - + @@ -228,7 +228,6 @@ public: - diff --git a/hotspot/src/share/vm/trace/tracetypes.xml b/hotspot/src/share/vm/trace/tracetypes.xml deleted file mode 100644 index f41be785ec..0000000000 --- a/hotspot/src/share/vm/trace/tracetypes.xml +++ /dev/null @@ -1,356 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From a09846d3acdf063ed1c7bea7bdc21d18a2877ef2 Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Sat, 1 Aug 2026 21:21:18 +1000 Subject: [PATCH 09/15] basic makefile tweaks --- hotspot/make/linux/makefiles/defs.make | 3 +++ hotspot/make/linux/makefiles/rules.make | 4 ++-- jdk/make/jdk_generic_profile.sh | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hotspot/make/linux/makefiles/defs.make b/hotspot/make/linux/makefiles/defs.make index e0d32e4be8..e77c5f9e17 100644 --- a/hotspot/make/linux/makefiles/defs.make +++ b/hotspot/make/linux/makefiles/defs.make @@ -348,6 +348,9 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) endif endif endif +# XXX Disable for now +ADD_SA_BINARIES/x86 = + ADD_SA_BINARIES/ppc = ADD_SA_BINARIES/ppc64 = ADD_SA_BINARIES/ia64 = diff --git a/hotspot/make/linux/makefiles/rules.make b/hotspot/make/linux/makefiles/rules.make index 7440636ef9..a42971107f 100644 --- a/hotspot/make/linux/makefiles/rules.make +++ b/hotspot/make/linux/makefiles/rules.make @@ -129,8 +129,8 @@ QUIETLY$(MAKE_VERBOSE) = @ RUN.JAR$(MAKE_VERBOSE) += >/dev/null # Settings for javac -BOOT_SOURCE_LANGUAGE_VERSION = 6 -BOOT_TARGET_CLASS_VERSION = 6 +BOOT_SOURCE_LANGUAGE_VERSION = 5 +BOOT_TARGET_CLASS_VERSION = 5 JAVAC_FLAGS = -g -encoding ascii BOOTSTRAP_JAVAC_FLAGS = $(JAVAC_FLAGS) -source $(BOOT_SOURCE_LANGUAGE_VERSION) -target $(BOOT_TARGET_CLASS_VERSION) diff --git a/jdk/make/jdk_generic_profile.sh b/jdk/make/jdk_generic_profile.sh index 80a8089eb0..9a93ed4cd0 100644 --- a/jdk/make/jdk_generic_profile.sh +++ b/jdk/make/jdk_generic_profile.sh @@ -140,7 +140,7 @@ if [ "${osname}" = SunOS ] ; then umask 002 -elif [ "${osname}" = Linux ] ; then +elif [ "${osname}" = Linux ] || [ "${osname}" = GNU ]; then # System place where JDK installed images are stored? jdk_instances=/opt/java From bd85c0fde66bba131c4c75104a2604951bb85952 Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Sun, 2 Aug 2026 18:18:04 +1000 Subject: [PATCH 10/15] hotspot: Fix dependencies.cpp asserts for debug build --- hotspot/src/share/vm/code/dependencies.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hotspot/src/share/vm/code/dependencies.cpp b/hotspot/src/share/vm/code/dependencies.cpp index 7783421f22..29ed4f48f5 100644 --- a/hotspot/src/share/vm/code/dependencies.cpp +++ b/hotspot/src/share/vm/code/dependencies.cpp @@ -1407,7 +1407,7 @@ bool Dependencies::is_concrete_root_method(methodOop uniqm, klassOop ctxk) { ctxk = implementor; } klassOop holder = uniqm->method_holder(); - assert(!holder->is_interface(), "no default methods allowed"); + assert(!holder->klass_part()->is_interface(), "no default methods allowed"); assert(ctxk->klass_part()->is_subclass_of(holder) || holder->klass_part()->is_subclass_of(ctxk), "not related"); return ctxk->klass_part()->is_subclass_of(holder); } @@ -1508,7 +1508,7 @@ methodOop Dependencies::find_unique_concrete_method(klassOop ctxk, methodOop m) // Found method doesn't override abstract root method. return NULL; } - assert(Dependencies::is_concrete_root_method(fm, ctxk) == Dependencies::is_concrete_method(m, ctxk), "mismatch"); + assert(Dependencies::is_concrete_root_method(fm, ctxk) == Dependencies::is_concrete_method(m), "mismatch"); #ifndef PRODUCT // Make sure the dependency mechanism will pass this discovery: if (VerifyDependencies && fm != NULL) { From a8a67cf046708bbfb17e72ce030dafcd5a6a7412 Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Thu, 30 Jul 2026 13:38:15 +1000 Subject: [PATCH 11/15] XXX: Fix assert checking potential pointer for signed cmp Not 100% sure this is correct but fixes the compile error. --- hotspot/src/share/vm/opto/loopPredicate.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/opto/loopPredicate.cpp b/hotspot/src/share/vm/opto/loopPredicate.cpp index a05f5c0f12..05f2be007c 100644 --- a/hotspot/src/share/vm/opto/loopPredicate.cpp +++ b/hotspot/src/share/vm/opto/loopPredicate.cpp @@ -863,7 +863,7 @@ bool PhaseIdealLoop::loop_predication_impl(IdealLoopTree *loop) { Node* idx = cmp->in(1); assert(!invar.is_invariant(idx), "index is variant"); Node* rng = cmp->in(2); - assert(rng->Opcode() == Op_LoadRange || _igvn.type(rng)->is_int()->_lo >= 0, "must be"); + assert(rng->Opcode() == Op_LoadRange || (intptr_t)_igvn.type(rng)->is_int()->_lo >= 0, "must be"); assert(invar.is_invariant(rng), "range must be invariant"); int scale = 1; Node* offset = zero; From d3526efce7aae2ecaa6e87353935e9c6001c5cdf Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Mon, 26 Jan 2026 11:22:22 +1100 Subject: [PATCH 12/15] XXX: Disable jvmti trace because libjvm.so won't link There are duplicate symbols with jvmtiEnter.o and jvmtiEnterTrace.o --- hotspot/make/linux/makefiles/jvmti.make | 2 +- hotspot/src/share/vm/prims/jvmtiTrace.hpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/hotspot/make/linux/makefiles/jvmti.make b/hotspot/make/linux/makefiles/jvmti.make index 43cdb9d878..20211e3e09 100644 --- a/hotspot/make/linux/makefiles/jvmti.make +++ b/hotspot/make/linux/makefiles/jvmti.make @@ -45,10 +45,10 @@ VPATH += $(Src_Dirs_V:%=%:) JvmtiGeneratedNames = \ jvmtiEnv.hpp \ jvmtiEnter.cpp \ - jvmtiEnterTrace.cpp \ jvmtiEnvRecommended.cpp \ bytecodeInterpreterWithChecks.cpp \ jvmti.h \ + #XXX fails link jvmtiEnterTrace.cpp \ JvmtiEnvFillSource = $(JvmtiSrcDir)/jvmtiEnvFill.java JvmtiEnvFillClass = $(JvmtiOutDir)/jvmtiEnvFill.class diff --git a/hotspot/src/share/vm/prims/jvmtiTrace.hpp b/hotspot/src/share/vm/prims/jvmtiTrace.hpp index b6d4224977..44bbd2a61c 100644 --- a/hotspot/src/share/vm/prims/jvmtiTrace.hpp +++ b/hotspot/src/share/vm/prims/jvmtiTrace.hpp @@ -50,6 +50,8 @@ #endif #endif +#undef JVMTI_TRACE + #ifdef JVMTI_TRACE class JvmtiTrace : AllStatic { From 826c687dfb2bab3b565dfc7e0445a72b3fc6fba2 Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Sun, 2 Aug 2026 15:19:19 +1000 Subject: [PATCH 13/15] XXX: Don't export jvmti.html as it is broken --- hotspot/make/linux/makefiles/defs.make | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hotspot/make/linux/makefiles/defs.make b/hotspot/make/linux/makefiles/defs.make index e77c5f9e17..f081837fd6 100644 --- a/hotspot/make/linux/makefiles/defs.make +++ b/hotspot/make/linux/makefiles/defs.make @@ -279,7 +279,8 @@ LIBRARY_SUFFIX=so # FIXUP: The subdirectory for a debug build is NOT the same on all platforms VM_DEBUG=jvmg -EXPORT_LIST += $(EXPORT_DOCS_DIR)/platform/jvmti/jvmti.html +# XXX Does not work +#EXPORT_LIST += $(EXPORT_DOCS_DIR)/platform/jvmti/jvmti.html # client and server subdirectories have symbolic links to ../libjsig.so EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX) From 47caec0ee6939e9c376e8a38e377528b15da8b7b Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Sun, 2 Aug 2026 18:44:39 +1000 Subject: [PATCH 14/15] NOTFORMERGE: need to make this a variable --- langtools/make/build.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/langtools/make/build.xml b/langtools/make/build.xml index 289f56994b..4b8c91d22c 100644 --- a/langtools/make/build.xml +++ b/langtools/make/build.xml @@ -247,7 +247,8 @@ /> - + From bf87a9783df4846a7dac5642c4c3f31df53b8800 Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Mon, 26 Jan 2026 20:13:55 +1100 Subject: [PATCH 15/15] hurd: Add simple bootstrap build script that invokes make --- buildhurd.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 buildhurd.sh diff --git a/buildhurd.sh b/buildhurd.sh new file mode 100644 index 0000000000..8f35b99320 --- /dev/null +++ b/buildhurd.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +if [ -d hotspot/agent ]; then + mv hotspot/agent hotspot/agent.disabled +fi + +if [ ! -d apache-ant-1.7.1 ]; then + wget -c https://archive.apache.org/dist/ant/binaries/apache-ant-1.7.1-bin.tar.gz + tar -xf apache-ant-1.7.1-bin.tar.gz +fi + +unset JAVA_HOME +export LANG=C + +JDK_TO_BUILD_WITH=$(realpath ../jdk6/build/linux-x86/langtools/dist/bootstrap) +export ALT_BOOTDIR=${JDK_TO_BUILD_WITH} +export ALT_JDK_IMPORT_PATH=${JDK_TO_BUILD_WITH} + +source ./jdk/make/jdk_generic_profile.sh + +make ANT_HOME=$(realpath apache-ant-1.7.1) GENERATE_DOCS=false BUILD_JAXWS=false BUILD_JAXP=false BUILD_CORBA=false BUILD_JDK=true BUILD_LANGTOOLS=true ALSA_CHECK=newer SKIP_FREETYPE_CHECK=true EXTRA_CXXFLAGS="-fpermissive" EXTRA_CFLAGS="-fpermissive" USE_PRECOMPILED_HEADER=0 INCLUDE_TRACE=0 COMPILER_WARNINGS_FATAL=false ALT_SDT_H=/nowhere ARCH=x86 ARCH_DATA_MODEL=64 LP64=1 LIBARCH=amd64 PLATFORM=linux BOOT_VER=1.5.0 FT2_CFLAGS="$(pkg-config --cflags freetype2)" FT2_LIBS="$(pkg-config --libs freetype2)" STATIC_CXX=false NO_DOCS=true DEBUG_CLASSFILES=true DEBUG_BINARIES=true STRIP_POLICY=no_strip FULL_DEBUG_SYMBOLS=1 debug_build