jdk15 from update5 sources
Arne H. Juul
arnej at pvv.ntnu.no
Thu May 4 12:52:23 UTC 2006
For those of us who can't use the diablo binary release for one reason or
the other, it's a problem that the BSD patches from eyesbeyond.com use the
SCSL sources, since there are many problems in those that are fixed in the
various update 1 to 6 releases.
Sun has released sources on tiger.dev.java.net for update 3, 4, and 5 (but
not update 6, at least not yet). These are under the JIUL license which
seems to be more permissive than SCSL (too much legalese for me to say for
sure).
So I've downloaded the update 5 sources and applied the
bsd-jdk15-patches-3.tar.bz2 (with some rejects). Then I've fixed the
issues with rejected patches and done some changes based on the changes
between SCSL sources and update 5 sources (see attached patch).
The result works pretty well for me when compiled on FreeBSD 4.x for
running standalone java applications; I have no idea if it works for
webstart, or browser plugins, or as a basis for java frameworks. But maybe
somebody else may find it useful to go this route; I still get the
occasional crash deep inside the garbage collection parts of the VM but at
least this is much more stable than the version I get from compiling
ports/jdk the usual way.
- Arne H. J.
-------------- next part --------------
diff -ruN jdk-1_5_0-05.bsd-p3/control/make/common/Defs.gmk jdk-1_5_0-05.bsd-p3-x4/control/make/common/Defs.gmk
--- jdk-1_5_0-05.bsd-p3/control/make/common/Defs.gmk Thu May 4 05:08:21 2006
+++ jdk-1_5_0-05.bsd-p3-x4/control/make/common/Defs.gmk Thu May 4 05:30:47 2006
@@ -108,12 +108,12 @@
endif
ifndef MILESTONE
- MILESTONE = internal
+ MILESTONE = u5p3
endif
ifndef BUILD_NUMBER
# use ':=' to keep this value from changing as time marches on...
- BUILD_NUMBER := $(shell $(ECHO) $(USER)_`$(DATE) '+%d_%b_%Y_%H_%M' | $(TR) "A-Z" "a-z"`)
+ BUILD_NUMBER := $(shell $(ECHO) $(USER)_`LC_ALL=C $(DATE) '+%d_%b_%Y_%H_%M' | $(TR) "A-Z" "a-z"`)
JDK_BUILD_NUMBER = b00
else
JDK_BUILD_NUMBER = $(BUILD_NUMBER)
diff -ruN jdk-1_5_0-05.bsd-p3/deploy/make/common/Sanity.gmk jdk-1_5_0-05.bsd-p3-x4/deploy/make/common/Sanity.gmk
--- jdk-1_5_0-05.bsd-p3/deploy/make/common/Sanity.gmk Thu May 4 05:08:21 2006
+++ jdk-1_5_0-05.bsd-p3-x4/deploy/make/common/Sanity.gmk Thu May 4 05:30:47 2006
@@ -147,7 +147,6 @@
# MOZILLA_HEADERS_PATH must be valid
######################################################
mozilla:
-ifeq ($(ARCH_DATA_MODEL), 32)
ifdef ALT_MOZILLA_HEADERS_PATH
@if [ `$(ECHO) $(subst \,/,$(ALT_MOZILLA_HEADERS_PATH)) | $(EGREP) -ci '^([a-z]:)?/'` -ne 1 ]; then \
$(ECHO) "ERROR: ALT_MOZILLA_HEADERS_PATH must be an Absolute Path Name, \n" \
diff -ruN jdk-1_5_0-05.bsd-p3/deploy/src/javaws/solaris/native/system_md.c jdk-1_5_0-05.bsd-p3-x4/deploy/src/javaws/solaris/native/system_md.c
--- jdk-1_5_0-05.bsd-p3/deploy/src/javaws/solaris/native/system_md.c Thu May 4 05:08:21 2006
+++ jdk-1_5_0-05.bsd-p3-x4/deploy/src/javaws/solaris/native/system_md.c Thu May 4 05:30:47 2006
@@ -8,7 +8,9 @@
/* Implementation of solaris/linux specific OS layer */
#include <locale.h>
#include <wchar.h>
+#if !defined(_ALLBSD_SOURCE)
#include <malloc.h>
+#endif
#include <langinfo.h>
#include <iconv.h>
#include <sys/types.h>
diff -ruN jdk-1_5_0-05.bsd-p3/hotspot/src/os/bsd/vm/globals_bsd.hpp jdk-1_5_0-05.bsd-p3-x4/hotspot/src/os/bsd/vm/globals_bsd.hpp
--- jdk-1_5_0-05.bsd-p3/hotspot/src/os/bsd/vm/globals_bsd.hpp Wed Dec 31 16:00:00 1969
+++ jdk-1_5_0-05.bsd-p3-x4/hotspot/src/os/bsd/vm/globals_bsd.hpp Thu May 4 05:30:47 2006
@@ -0,0 +1,16 @@
+/*
+ * $Id: $
+ */
+
+//
+// Defines BSD specific flags (none).
+//
+#define RUNTIME_OS_FLAGS(develop, develop_pd, product, product_pd, diagnostic) \
+
+
+//
+// Defines BSD-specific default values. The flags are available on all
+// platforms, but they may have different default values on other platforms.
+//
+define_pd_global(bool, UseMembar, false);
+define_pd_global(bool, UseLargePages, false);
diff -ruN jdk-1_5_0-05.bsd-p3/hotspot/src/os/bsd/vm/os_bsd.cpp jdk-1_5_0-05.bsd-p3-x4/hotspot/src/os/bsd/vm/os_bsd.cpp
--- jdk-1_5_0-05.bsd-p3/hotspot/src/os/bsd/vm/os_bsd.cpp Thu May 4 05:08:21 2006
+++ jdk-1_5_0-05.bsd-p3-x4/hotspot/src/os/bsd/vm/os_bsd.cpp Thu May 4 05:30:47 2006
@@ -1917,16 +1917,16 @@
return mprotect(addr, bytes, PROT_READ|PROT_WRITE|PROT_EXEC) == 0;
}
-// XXXBSD: remove (or check if UseMPSS is true, then bail out)
-void os::Bsd::mpss_sanity_check() {
- UseMPSS = false;
-}
-
char* os::reserve_memory_special(size_t bytes) {
ShouldNotReachHere();
return NULL;
}
+jint os::release_memory_special(char*, size_t) {
+ ShouldNotReachHere();
+ return 0;
+}
+
// BSDXXX: cap nanosleep to 100 million to avoid overflow of
// tv_sec. Both FreeBSD and OpenBSD use a signed value for tv_sec
// and add the time of day to tv_sec.
@@ -2698,9 +2698,25 @@
#endif
}
- // Check to make sure we can use MPSS on this version of OS
+ if (!UseMembar) {
+ address mem_serialize_page = (address) ::mmap(NULL, page_size,
+ PROT_READ | PROT_WRITE,
+ MAP_PRIVATE|MAP_ANON,
+ -1, 0);
+ guarantee( mem_serialize_page != NULL,
+ "mmap Failed for memory serialize page");
+ os::set_memory_serialize_page( mem_serialize_page );
+ }
+
+#if 0
if (UseMPSS) {
- Bsd::mpss_sanity_check();
+ tty->print_cr("\nCannot use MPSS on this OS.\n");
+ exit(1);
+ }
+#endif
+ if (UseLargePages) {
+ tty->print_cr("\nLarge pages not supported on this OS.\n");
+ exit(1);
}
// Check minimum allowable stack size for thread creation and to initialize
@@ -3099,4 +3115,62 @@
#endif
+// We do not support anonymous mmap with large page memory.
+bool os::can_commit_large_page_memory() {
+ return false;
+}
+
+static void print_signal_handler(outputStream* st, int sig,
+ char* buf, int buflen) {
+ struct sigaction sa;
+
+ sigaction(sig, NULL, &sa);
+
+ st->print("%s: ", os::exception_name(sig, buf, buflen));
+
+ address handler = (sa.sa_flags & SA_SIGINFO)
+ ? CAST_FROM_FN_PTR(address, sa.sa_sigaction)
+ : CAST_FROM_FN_PTR(address, sa.sa_handler);
+
+ if (handler == CAST_FROM_FN_PTR(address, SIG_DFL)) {
+ st->print("SIG_DFL");
+ } else if (handler == CAST_FROM_FN_PTR(address, SIG_IGN)) {
+ st->print("SIG_IGN");
+ } else {
+ int offset;
+ bool found = os::dll_address_to_library_name(handler, buf, buflen, &offset);
+ if (found) {
+ // skip directory names
+ const char *p1, *p2;
+ p1 = buf;
+ size_t len = strlen(os::file_separator());
+ while ((p2 = strstr(p1, os::file_separator())) != NULL) p1 = p2 + len;
+ st->print("[%s+0x%x]", p1, offset);
+ } else {
+ st->print(PTR_FORMAT, handler);
+ }
+ }
+ st->print (", sa_mask[0]=" PTR32_FORMAT, *(uint32_t*)&sa.sa_mask);
+ st->print_cr(", sa_flags=" PTR32_FORMAT, sa.sa_flags);
+}
+
+void os::print_signal_handlers(outputStream* st, char* buf, int buflen) {
+ st->print_cr("Signal Handlers:");
+ print_signal_handler(st, SIGSEGV, buf, buflen);
+ print_signal_handler(st, SIGBUS , buf, buflen);
+ print_signal_handler(st, SIGFPE , buf, buflen);
+ print_signal_handler(st, SIGPIPE, buf, buflen);
+ print_signal_handler(st, SIGILL , buf, buflen);
+ print_signal_handler(st, SIGUSR1, buf, buflen);
+ print_signal_handler(st, SIGUSR2, buf, buflen);
+ print_signal_handler(st, SIGHUP , buf, buflen);
+ print_signal_handler(st, SIGINT , buf, buflen);
+ print_signal_handler(st, SIGQUIT, buf, buflen);
+ print_signal_handler(st, SIGTERM, buf, buflen);
+}
+
+size_t os::large_page_size() {
+ ShouldNotReachHere();
+ return 0;
+}
diff -ruN jdk-1_5_0-05.bsd-p3/hotspot/src/os_cpu/bsd_i486/vm/bsd_i486.ad jdk-1_5_0-05.bsd-p3-x4/hotspot/src/os_cpu/bsd_i486/vm/bsd_i486.ad
--- jdk-1_5_0-05.bsd-p3/hotspot/src/os_cpu/bsd_i486/vm/bsd_i486.ad Thu May 4 05:08:21 2006
+++ jdk-1_5_0-05.bsd-p3-x4/hotspot/src/os_cpu/bsd_i486/vm/bsd_i486.ad Thu May 4 05:30:47 2006
@@ -121,7 +121,7 @@
opcode(0xE8); /* E8 cd */
// Use FFREEs to clear entries in float stack
ins_encode( pre_call_FPU, FFree_Float_Stack_All, Java_To_Native( meth ),
- call_epilog, post_call_FPU, post_call_restore_mxcsr );
+ call_epilog, post_call_FPU, post_call_verify_mxcsr );
ins_pipe( pipe_slow );
ins_pc_relative(1);
%}
diff -ruN jdk-1_5_0-05.bsd-p3/hotspot/src/os_cpu/bsd_i486/vm/os_bsd_i486.cpp jdk-1_5_0-05.bsd-p3-x4/hotspot/src/os_cpu/bsd_i486/vm/os_bsd_i486.cpp
--- jdk-1_5_0-05.bsd-p3/hotspot/src/os_cpu/bsd_i486/vm/os_bsd_i486.cpp Thu May 4 05:08:21 2006
+++ jdk-1_5_0-05.bsd-p3-x4/hotspot/src/os_cpu/bsd_i486/vm/os_bsd_i486.cpp Thu May 4 05:30:47 2006
@@ -723,6 +723,16 @@
}
}
+ // Check to see if we caught the safepoint code in the
+ // process of write protecting the memory serialization page.
+ // It write enables the page immediately after protecting it
+ // so we can just return to retry the write.
+ if (sig == SIGSEGV || sig == SIGBUS) {
+ if (os::is_memory_serialize_page(thread, (address) info->si_addr)) {
+ return true;
+ }
+ }
+
// signal-chaining
if (UseSignalChaining) {
bool chained = false;
diff -ruN jdk-1_5_0-05.bsd-p3/j2se/make/common/Defs-bsd.gmk jdk-1_5_0-05.bsd-p3-x4/j2se/make/common/Defs-bsd.gmk
--- jdk-1_5_0-05.bsd-p3/j2se/make/common/Defs-bsd.gmk Thu May 4 05:08:21 2006
+++ jdk-1_5_0-05.bsd-p3-x4/j2se/make/common/Defs-bsd.gmk Thu May 4 05:30:47 2006
@@ -127,6 +127,8 @@
OS_VERSION = $(shell $(UNAME) -r)
OS_NAME = bsd
+BINDIR = $(OUTPUTDIR)/bin
+
#
# FreeBSD builds may be 32-bit or 64-bit data model. Select
# the default based on the build platform architecture.
diff -ruN jdk-1_5_0-05.bsd-p3/j2se/src/share/classes/sun/awt/FontConfiguration.java jdk-1_5_0-05.bsd-p3-x4/j2se/src/share/classes/sun/awt/FontConfiguration.java
--- jdk-1_5_0-05.bsd-p3/j2se/src/share/classes/sun/awt/FontConfiguration.java Thu May 4 05:08:22 2006
+++ jdk-1_5_0-05.bsd-p3-x4/j2se/src/share/classes/sun/awt/FontConfiguration.java Thu May 4 05:30:47 2006
@@ -1052,7 +1052,7 @@
*/
HashMap<String, Boolean> existsMap;
public boolean needToSearchForFile(String fileName) {
- if (!environment.isLinux) {
+ if (!environment.isLinuxOrBSD) {
return false;
} else if (existsMap == null) {
existsMap = new HashMap<String, Boolean>();
diff -ruN jdk-1_5_0-05.bsd-p3/j2se/src/solaris/hpi/native_threads/include/threads_md.h jdk-1_5_0-05.bsd-p3-x4/j2se/src/solaris/hpi/native_threads/include/threads_md.h
--- jdk-1_5_0-05.bsd-p3/j2se/src/solaris/hpi/native_threads/include/threads_md.h Thu May 4 05:08:23 2006
+++ jdk-1_5_0-05.bsd-p3-x4/j2se/src/solaris/hpi/native_threads/include/threads_md.h Thu May 4 05:30:47 2006
@@ -18,6 +18,10 @@
#define N_TRACED_REGS 12
#elif i386
#define N_TRACED_REGS 7
+#elif i486
+#define N_TRACED_REGS 7
+#elif i586
+#define N_TRACED_REGS 7
#elif amd64
#define N_TRACED_REGS 15
#elif ppc
diff -ruN jdk-1_5_0-05.bsd-p3/j2se/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c jdk-1_5_0-05.bsd-p3-x4/j2se/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c
--- jdk-1_5_0-05.bsd-p3/j2se/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c Thu May 4 05:08:23 2006
+++ jdk-1_5_0-05.bsd-p3-x4/j2se/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c Thu May 4 05:30:47 2006
@@ -21,7 +21,9 @@
#endif
#include <sys/resource.h>
#include <sys/times.h>
+#if !defined(_ALLBSD_SOURCE)
#include <sys/sysinfo.h>
+#endif
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
@@ -116,7 +118,7 @@
free(strtab);
return available ? ((jlong)avail * page_size) :
((jlong)total * page_size);
-#else /* __linux__ */
+#elif defined(__linux__)
int ret;
FILE *fp;
jlong total = 0, avail = 0;
@@ -130,6 +132,13 @@
avail = (jlong)si.freeswap * si.mem_unit;
return available ? avail : total;
+#else /* _ALLBSD_SOURCE */
+ /*
+ * XXXBSD: there's no way available to get swap info in
+ * FreeBSD. Usage of libkvm is not an option here
+ */
+ // throw_internal_error(env, "Unimplemented in FreeBSD");
+ return (0);
#endif
}
diff -ruN jdk-1_5_0-05.bsd-p3/j2se/src/solaris/native/java/nio/MappedByteBuffer.c jdk-1_5_0-05.bsd-p3-x4/j2se/src/solaris/native/java/nio/MappedByteBuffer.c
--- jdk-1_5_0-05.bsd-p3/j2se/src/solaris/native/java/nio/MappedByteBuffer.c Thu May 4 05:08:23 2006
+++ jdk-1_5_0-05.bsd-p3-x4/j2se/src/solaris/native/java/nio/MappedByteBuffer.c Thu May 4 05:30:47 2006
@@ -78,7 +78,11 @@
Java_java_nio_MappedByteBuffer_force0(JNIEnv *env, jobject obj, jlong address,
jlong len)
{
+#if defined(_ALLBSD_SOURCE)
+ jlong pageSize = getpagesize();
+#else
jlong pageSize = sysconf(_SC_PAGESIZE);
+#endif
unsigned long lAddress = address;
jlong offset = lAddress % pageSize;
More information about the freebsd-java
mailing list