--- a/hotspot/make/defs.make Wed Jul 05 16:37:51 2017 +0200
+++ b/hotspot/make/defs.make Thu Jun 19 06:02:20 2008 -0700
@@ -261,3 +261,21 @@
EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jni.h
EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/$(JDK_INCLUDE_SUBDIR)/jni_md.h
EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jmm.h
+
+# A list of object files built without the platform specific PIC flags, e.g.
+# -fPIC on linux. Performance measurements show that by compiling GC related
+# code, we could significantly reduce the GC pause time on 32 bit Linux/Unix
+# platforms. See 6454213 for more details.
+include $(GAMMADIR)/make/scm.make
+
+ifneq ($(OSNAME), windows)
+ ifndef LP64
+ NONPIC_DIRS = memory oops gc_implementation gc_interface
+ NONPIC_DIRS := $(foreach dir,$(NONPIC_DIRS), $(GAMMADIR)/src/share/vm/$(dir))
+ # Look for source files under NONPIC_DIRS
+ NONPIC_FILES := $(foreach dir,$(NONPIC_DIRS),\
+ $(shell find $(dir) \( $(SCM_DIRS) \) -prune -o \
+ -name '*.cpp' -print))
+ NONPIC_OBJ_FILES := $(notdir $(subst .cpp,.o,$(NONPIC_FILES)))
+ endif
+endif
--- a/hotspot/make/linux/makefiles/gcc.make Wed Jul 05 16:37:51 2017 +0200
+++ b/hotspot/make/linux/makefiles/gcc.make Thu Jun 19 06:02:20 2008 -0700
@@ -50,14 +50,7 @@
VM_PICFLAG/LIBJVM = $(PICFLAG)
VM_PICFLAG/AOUT =
-
-ifneq ($(BUILDARCH), i486)
VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO))
-else
-# PIC has significant overhead on x86, build nonpic VM for now.
-# Link JVM at a "good" base location to avoid unnecessary .text patching.
-JVM_BASE_ADDR = 0x06000000
-endif
CFLAGS += $(VM_PICFLAG)
CFLAGS += -fno-rtti
--- a/hotspot/make/linux/makefiles/rules.make Wed Jul 05 16:37:51 2017 +0200
+++ b/hotspot/make/linux/makefiles/rules.make Thu Jun 19 06:02:20 2008 -0700
@@ -133,10 +133,22 @@
COMPILE_DONE = && { echo Done with $<; }
endif
+include $(GAMMADIR)/make/defs.make
+
+# The non-PIC object files are only generated for 32 bit platforms.
+ifdef LP64
%.o: %.cpp
@echo Compiling $<
$(QUIETLY) $(REMOVE_TARGET)
$(QUIETLY) $(COMPILE.CC) -o $@ $< $(COMPILE_DONE)
+else
+%.o: %.cpp
+ @echo Compiling $<
+ $(QUIETLY) $(REMOVE_TARGET)
+ $(QUIETLY) $(if $(findstring $@, $(NONPIC_OBJ_FILES)), \
+ $(subst $(VM_PICFLAG), ,$(COMPILE.CC)) -o $@ $< $(COMPILE_DONE), \
+ $(COMPILE.CC) -o $@ $< $(COMPILE_DONE))
+endif
%.o: %.s
@echo Assembling $<
--- a/hotspot/make/solaris/makefiles/rules.make Wed Jul 05 16:37:51 2017 +0200
+++ b/hotspot/make/solaris/makefiles/rules.make Thu Jun 19 06:02:20 2008 -0700
@@ -133,19 +133,7 @@
COMPILE_DONE = && { echo Done with $<; }
endif
-# A list of directories under which all source code are built without -KPIC/-Kpic
-# flag. Performance measurements show that compiling GC related code will
-# dramatically reduce the gc pause time. See bug 6454213 for more details.
-
-include $(GAMMADIR)/make/scm.make
-
-NONPIC_DIRS = memory oops gc_implementation gc_interface
-NONPIC_DIRS := $(foreach dir,$(NONPIC_DIRS), $(GAMMADIR)/src/share/vm/$(dir))
-# Look for source code under NONPIC_DIRS
-NONPIC_FILES := $(foreach dir,$(NONPIC_DIRS),\
- $(shell find $(dir) \( $(SCM_DIRS) \) -prune -o \
- -name '*.cpp' -print))
-NONPIC_OBJ_FILES := $(notdir $(subst .cpp,.o,$(NONPIC_FILES)))
+include $(GAMMADIR)/make/defs.make
# Sun compiler for 64 bit Solaris does not support building non-PIC object files.
ifdef LP64
--- a/hotspot/src/os/linux/vm/jvm_linux.cpp Wed Jul 05 16:37:51 2017 +0200
+++ b/hotspot/src/os/linux/vm/jvm_linux.cpp Thu Jun 19 06:02:20 2008 -0700
@@ -132,7 +132,7 @@
*/
struct siglabel {
- char *name;
+ const char *name;
int number;
};
--- a/hotspot/src/os/linux/vm/os_linux.cpp Wed Jul 05 16:37:51 2017 +0200
+++ b/hotspot/src/os/linux/vm/os_linux.cpp Thu Jun 19 06:02:20 2008 -0700
@@ -75,8 +75,8 @@
bool os::Linux::_is_floating_stack = false;
bool os::Linux::_is_NPTL = false;
bool os::Linux::_supports_fast_thread_cpu_time = false;
-char * os::Linux::_glibc_version = NULL;
-char * os::Linux::_libpthread_version = NULL;
+const char * os::Linux::_glibc_version = NULL;
+const char * os::Linux::_libpthread_version = NULL;
static jlong initial_time_count=0;
@@ -213,9 +213,9 @@
// the system call returns 1. This causes the VM to act as if it is
// a single processor and elide locking (see is_MP() call).
static bool unsafe_chroot_detected = false;
-static 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.";
+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.";
void os::Linux::initialize_system_info() {
_processor_count = sysconf(_SC_NPROCESSORS_CONF);
@@ -544,26 +544,23 @@
if (n > 0) {
char *str = (char *)malloc(n);
confstr(_CS_GNU_LIBPTHREAD_VERSION, str, n);
-
// Vanilla RH-9 (glibc 2.3.2) has a bug that confstr() always tells
// us "NPTL-0.29" even we are running with LinuxThreads. Check if this
- // is the case:
+ // is the case. LinuxThreads has a hard limit on max number of threads.
+ // So sysconf(_SC_THREAD_THREADS_MAX) will return a positive value.
+ // On the other hand, NPTL does not have such a limit, sysconf()
+ // will return -1 and errno is not changed. Check if it is really NPTL.
if (strcmp(os::Linux::glibc_version(), "glibc 2.3.2") == 0 &&
- strstr(str, "NPTL")) {
- // LinuxThreads has a hard limit on max number of threads. So
- // sysconf(_SC_THREAD_THREADS_MAX) will return a positive value.
- // On the other hand, NPTL does not have such a limit, sysconf()
- // will return -1 and errno is not changed. Check if it is really
- // NPTL:
- if (sysconf(_SC_THREAD_THREADS_MAX) > 0) {
- free(str);
- str = "linuxthreads";
- }
+ strstr(str, "NPTL") &&
+ sysconf(_SC_THREAD_THREADS_MAX) > 0) {
+ free(str);
+ os::Linux::set_libpthread_version("linuxthreads");
+ } else {
+ os::Linux::set_libpthread_version(str);
}
- os::Linux::set_libpthread_version(str);
} else {
- // glibc before 2.3.2 only has LinuxThreads.
- os::Linux::set_libpthread_version("linuxthreads");
+ // glibc before 2.3.2 only has LinuxThreads.
+ os::Linux::set_libpthread_version("linuxthreads");
}
if (strstr(libpthread_version(), "NPTL")) {
@@ -4632,11 +4629,7 @@
// Unlike system(), this function can be called from signal handler. It
// doesn't block SIGINT et al.
int os::fork_and_exec(char* cmd) {
- char * argv[4];
- argv[0] = "sh";
- argv[1] = "-c";
- argv[2] = cmd;
- argv[3] = NULL;
+ const char * argv[4] = {"sh", "-c", cmd, NULL};
// fork() in LinuxThreads/NPTL is not async-safe. It needs to run
// pthread_atfork handlers and reset pthread library. All we need is a
@@ -4661,7 +4654,7 @@
// IA64 should use normal execve() from glibc to match the glibc fork()
// above.
NOT_IA64(syscall(__NR_execve, "/bin/sh", argv, environ);)
- IA64_ONLY(execve("/bin/sh", argv, environ);)
+ IA64_ONLY(execve("/bin/sh", (char* const*)argv, environ);)
// execve failed
_exit(-1);
--- a/hotspot/src/os/linux/vm/os_linux.hpp Wed Jul 05 16:37:51 2017 +0200
+++ b/hotspot/src/os/linux/vm/os_linux.hpp Thu Jun 19 06:02:20 2008 -0700
@@ -52,8 +52,8 @@
static address _initial_thread_stack_bottom;
static uintptr_t _initial_thread_stack_size;
- static char *_glibc_version;
- static char *_libpthread_version;
+ static const char *_glibc_version;
+ static const char *_libpthread_version;
static bool _is_floating_stack;
static bool _is_NPTL;
@@ -72,8 +72,8 @@
static julong physical_memory() { return _physical_memory; }
static void initialize_system_info();
- static void set_glibc_version(char *s) { _glibc_version = s; }
- static void set_libpthread_version(char *s) { _libpthread_version = s; }
+ static void set_glibc_version(const char *s) { _glibc_version = s; }
+ static void set_libpthread_version(const char *s) { _libpthread_version = s; }
static bool supports_variable_stack_size();
@@ -134,8 +134,8 @@
static bool chained_handler(int sig, siginfo_t* siginfo, void* context);
// GNU libc and libpthread version strings
- static char *glibc_version() { return _glibc_version; }
- static char *libpthread_version() { return _libpthread_version; }
+ static const char *glibc_version() { return _glibc_version; }
+ static const char *libpthread_version() { return _libpthread_version; }
// NPTL or LinuxThreads?
static bool is_LinuxThreads() { return !_is_NPTL; }