Merge
This commit is contained in:
commit
abe5e3a903
@ -169,7 +169,35 @@ sigset_t SR_sigset;
|
||||
/* Used to protect dlsym() calls */
|
||||
static pthread_mutex_t dl_mutex;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifdef JAVASE_EMBEDDED
|
||||
class MemNotifyThread: public Thread {
|
||||
friend class VMStructs;
|
||||
public:
|
||||
virtual void run();
|
||||
|
||||
private:
|
||||
static MemNotifyThread* _memnotify_thread;
|
||||
int _fd;
|
||||
|
||||
public:
|
||||
|
||||
// Constructor
|
||||
MemNotifyThread(int fd);
|
||||
|
||||
// Tester
|
||||
bool is_memnotify_thread() const { return true; }
|
||||
|
||||
// Printing
|
||||
char* name() const { return (char*)"Linux MemNotify Thread"; }
|
||||
|
||||
// Returns the single instance of the MemNotifyThread
|
||||
static MemNotifyThread* memnotify_thread() { return _memnotify_thread; }
|
||||
|
||||
// Create and start the single instance of MemNotifyThread
|
||||
static void start();
|
||||
};
|
||||
#endif // JAVASE_EMBEDDED
|
||||
|
||||
// utility functions
|
||||
|
||||
static int SR_initialize();
|
||||
@ -2085,6 +2113,14 @@ void os::print_os_info(outputStream* st) {
|
||||
st->cr();
|
||||
}
|
||||
|
||||
void os::pd_print_cpu_info(outputStream* st) {
|
||||
st->print("\n/proc/cpuinfo:\n");
|
||||
if (!_print_ascii_file("/proc/cpuinfo", st)) {
|
||||
st->print(" <Not Available>");
|
||||
}
|
||||
st->cr();
|
||||
}
|
||||
|
||||
void os::print_memory_info(outputStream* st) {
|
||||
|
||||
st->print("Memory:");
|
||||
@ -4237,7 +4273,16 @@ jint os::init_2(void)
|
||||
}
|
||||
|
||||
// this is called at the end of vm_initialization
|
||||
void os::init_3(void) { }
|
||||
void os::init_3(void)
|
||||
{
|
||||
#ifdef JAVASE_EMBEDDED
|
||||
// Start the MemNotifyThread
|
||||
if (LowMemoryProtection) {
|
||||
MemNotifyThread::start();
|
||||
}
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Mark the polling page as unreadable
|
||||
void os::make_polling_page_unreadable(void) {
|
||||
@ -5360,3 +5405,78 @@ bool os::is_headless_jre() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
#ifdef JAVASE_EMBEDDED
|
||||
//
|
||||
// A thread to watch the '/dev/mem_notify' device, which will tell us when the OS is running low on memory.
|
||||
//
|
||||
MemNotifyThread* MemNotifyThread::_memnotify_thread = NULL;
|
||||
|
||||
// ctor
|
||||
//
|
||||
MemNotifyThread::MemNotifyThread(int fd): Thread() {
|
||||
assert(memnotify_thread() == NULL, "we can only allocate one MemNotifyThread");
|
||||
_fd = fd;
|
||||
|
||||
if (os::create_thread(this, os::os_thread)) {
|
||||
_memnotify_thread = this;
|
||||
os::set_priority(this, NearMaxPriority);
|
||||
os::start_thread(this);
|
||||
}
|
||||
}
|
||||
|
||||
// Where all the work gets done
|
||||
//
|
||||
void MemNotifyThread::run() {
|
||||
assert(this == memnotify_thread(), "expected the singleton MemNotifyThread");
|
||||
|
||||
// Set up the select arguments
|
||||
fd_set rfds;
|
||||
if (_fd != -1) {
|
||||
FD_ZERO(&rfds);
|
||||
FD_SET(_fd, &rfds);
|
||||
}
|
||||
|
||||
// Now wait for the mem_notify device to wake up
|
||||
while (1) {
|
||||
// Wait for the mem_notify device to signal us..
|
||||
int rc = select(_fd+1, _fd != -1 ? &rfds : NULL, NULL, NULL, NULL);
|
||||
if (rc == -1) {
|
||||
perror("select!\n");
|
||||
break;
|
||||
} else if (rc) {
|
||||
//ssize_t free_before = os::available_memory();
|
||||
//tty->print ("Notified: Free: %dK \n",os::available_memory()/1024);
|
||||
|
||||
// The kernel is telling us there is not much memory left...
|
||||
// try to do something about that
|
||||
|
||||
// If we are not already in a GC, try one.
|
||||
if (!Universe::heap()->is_gc_active()) {
|
||||
Universe::heap()->collect(GCCause::_allocation_failure);
|
||||
|
||||
//ssize_t free_after = os::available_memory();
|
||||
//tty->print ("Post-Notify: Free: %dK\n",free_after/1024);
|
||||
//tty->print ("GC freed: %dK\n", (free_after - free_before)/1024);
|
||||
}
|
||||
// We might want to do something like the following if we find the GC's are not helping...
|
||||
// Universe::heap()->size_policy()->set_gc_time_limit_exceeded(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// See if the /dev/mem_notify device exists, and if so, start a thread to monitor it.
|
||||
//
|
||||
void MemNotifyThread::start() {
|
||||
int fd;
|
||||
fd = open ("/dev/mem_notify", O_RDONLY, 0);
|
||||
if (fd < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (memnotify_thread() == NULL) {
|
||||
new MemNotifyThread(fd);
|
||||
}
|
||||
}
|
||||
#endif // JAVASE_EMBEDDED
|
||||
|
@ -2317,6 +2317,10 @@ static bool check_addr0(outputStream* st) {
|
||||
return status;
|
||||
}
|
||||
|
||||
void os::pd_print_cpu_info(outputStream* st) {
|
||||
// Nothing to do for now.
|
||||
}
|
||||
|
||||
void os::print_memory_info(outputStream* st) {
|
||||
st->print("Memory:");
|
||||
st->print(" %dk page", os::vm_page_size()>>10);
|
||||
|
@ -1720,6 +1720,10 @@ void os::print_os_info(outputStream* st) {
|
||||
st->cr();
|
||||
}
|
||||
|
||||
void os::pd_print_cpu_info(outputStream* st) {
|
||||
// Nothing to do for now.
|
||||
}
|
||||
|
||||
void os::print_memory_info(outputStream* st) {
|
||||
st->print("Memory:");
|
||||
st->print(" %dk page", os::vm_page_size()>>10);
|
||||
|
@ -33,6 +33,28 @@ void MacroAssembler::int3() {
|
||||
call(RuntimeAddress(CAST_FROM_FN_PTR(address, os::breakpoint)));
|
||||
}
|
||||
|
||||
#ifdef MINIMIZE_RAM_USAGE
|
||||
|
||||
void MacroAssembler::get_thread(Register thread) {
|
||||
// call pthread_getspecific
|
||||
// void * pthread_getspecific(pthread_key_t key);
|
||||
if (thread != rax) push(rax);
|
||||
push(rcx);
|
||||
push(rdx);
|
||||
|
||||
push(ThreadLocalStorage::thread_index());
|
||||
call(RuntimeAddress(CAST_FROM_FN_PTR(address, pthread_getspecific)));
|
||||
increment(rsp, wordSize);
|
||||
|
||||
pop(rdx);
|
||||
pop(rcx);
|
||||
if (thread != rax) {
|
||||
mov(thread, rax);
|
||||
pop(rax);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
void MacroAssembler::get_thread(Register thread) {
|
||||
movl(thread, rsp);
|
||||
shrl(thread, PAGE_SHIFT);
|
||||
@ -43,6 +65,7 @@ void MacroAssembler::get_thread(Register thread) {
|
||||
|
||||
movptr(thread, tls);
|
||||
}
|
||||
#endif // MINIMIZE_RAM_USAGE
|
||||
#else
|
||||
void MacroAssembler::int3() {
|
||||
call(RuntimeAddress(CAST_FROM_FN_PTR(address, os::breakpoint)));
|
||||
|
@ -52,25 +52,20 @@
|
||||
// MADV_DONTNEED on Linux keeps the virtual memory mapping, but zaps the
|
||||
// physical memory page (i.e. similar to MADV_FREE on Solaris).
|
||||
|
||||
#ifndef AMD64
|
||||
#if !defined(AMD64) && !defined(MINIMIZE_RAM_USAGE)
|
||||
Thread* ThreadLocalStorage::_sp_map[1UL << (SP_BITLENGTH - PAGE_SHIFT)];
|
||||
#endif // !AMD64
|
||||
|
||||
void ThreadLocalStorage::generate_code_for_get_thread() {
|
||||
// nothing we can do here for user-level thread
|
||||
}
|
||||
|
||||
void ThreadLocalStorage::pd_init() {
|
||||
#ifndef AMD64
|
||||
assert(align_size_down(os::vm_page_size(), PAGE_SIZE) == os::vm_page_size(),
|
||||
"page size must be multiple of PAGE_SIZE");
|
||||
#endif // !AMD64
|
||||
}
|
||||
|
||||
void ThreadLocalStorage::pd_set_thread(Thread* thread) {
|
||||
os::thread_local_storage_at_put(ThreadLocalStorage::thread_index(), thread);
|
||||
|
||||
#ifndef AMD64
|
||||
address stack_top = os::current_stack_base();
|
||||
size_t stack_size = os::current_stack_size();
|
||||
|
||||
@ -88,5 +83,17 @@ void ThreadLocalStorage::pd_set_thread(Thread* thread) {
|
||||
"thread exited without detaching from VM??");
|
||||
_sp_map[(uintptr_t)p >> PAGE_SHIFT] = thread;
|
||||
}
|
||||
#endif // !AMD64
|
||||
}
|
||||
#else
|
||||
|
||||
void ThreadLocalStorage::generate_code_for_get_thread() {
|
||||
// nothing we can do here for user-level thread
|
||||
}
|
||||
|
||||
void ThreadLocalStorage::pd_init() {
|
||||
}
|
||||
|
||||
void ThreadLocalStorage::pd_set_thread(Thread* thread) {
|
||||
os::thread_local_storage_at_put(ThreadLocalStorage::thread_index(), thread);
|
||||
}
|
||||
#endif // !AMD64 && !MINIMIZE_RAM_USAGE
|
||||
|
@ -27,28 +27,32 @@
|
||||
|
||||
// Processor dependent parts of ThreadLocalStorage
|
||||
|
||||
#ifndef AMD64
|
||||
#if !defined(AMD64) && !defined(MINIMIZE_RAM_USAGE)
|
||||
|
||||
// map stack pointer to thread pointer - see notes in threadLS_linux_x86.cpp
|
||||
#define SP_BITLENGTH 32
|
||||
#define PAGE_SHIFT 12
|
||||
#define PAGE_SIZE (1UL << PAGE_SHIFT)
|
||||
static Thread* _sp_map[1UL << (SP_BITLENGTH - PAGE_SHIFT)];
|
||||
#endif // !AMD64
|
||||
|
||||
public:
|
||||
|
||||
#ifndef AMD64
|
||||
static Thread** sp_map_addr() { return _sp_map; }
|
||||
#endif // !AMD64
|
||||
|
||||
static Thread* thread() {
|
||||
#ifdef AMD64
|
||||
return (Thread*) os::thread_local_storage_at(thread_index());
|
||||
#else
|
||||
uintptr_t sp;
|
||||
__asm__ volatile ("movl %%esp, %0" : "=r" (sp));
|
||||
return _sp_map[sp >> PAGE_SHIFT];
|
||||
#endif // AMD64
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
public:
|
||||
|
||||
static Thread* thread() {
|
||||
return (Thread*) os::thread_local_storage_at(thread_index());
|
||||
}
|
||||
|
||||
#endif // AMD64 || MINIMIZE_RAM_USAGE
|
||||
|
||||
#endif // OS_CPU_LINUX_X86_VM_THREADLS_LINUX_X86_HPP
|
||||
|
@ -2716,6 +2716,10 @@ void CMSCollector::gc_epilogue(bool full) {
|
||||
bitMapLock()->unlock();
|
||||
releaseFreelistLocks();
|
||||
|
||||
if (!CleanChunkPoolAsync) {
|
||||
Chunk::clean_chunk_pool();
|
||||
}
|
||||
|
||||
_between_prologue_and_epilogue = false; // ready for next cycle
|
||||
}
|
||||
|
||||
|
@ -905,6 +905,10 @@ void DefNewGeneration::gc_epilogue(bool full) {
|
||||
to()->check_mangled_unused_area_complete();
|
||||
}
|
||||
|
||||
if (!CleanChunkPoolAsync) {
|
||||
Chunk::clean_chunk_pool();
|
||||
}
|
||||
|
||||
// update the generation and space performance counters
|
||||
update_counters();
|
||||
gch->collector_policy()->counters()->update_counters();
|
||||
|
@ -1384,6 +1384,10 @@ void GenCollectedHeap::gc_epilogue(bool full) {
|
||||
generation_iterate(&blk, false); // not old-to-young.
|
||||
perm_gen()->gc_epilogue(full);
|
||||
|
||||
if (!CleanChunkPoolAsync) {
|
||||
Chunk::clean_chunk_pool();
|
||||
}
|
||||
|
||||
always_do_update_barrier = UseConcMarkSweepGC;
|
||||
};
|
||||
|
||||
|
@ -45,6 +45,9 @@
|
||||
#ifdef TARGET_ARCH_MODEL_arm
|
||||
# include "adfiles/ad_arm.hpp"
|
||||
#endif
|
||||
#ifdef TARGET_ARCH_MODEL_ppc
|
||||
# include "adfiles/ad_ppc.hpp"
|
||||
#endif
|
||||
|
||||
// Optimization - Graph Style
|
||||
|
||||
|
@ -52,6 +52,9 @@
|
||||
#ifdef TARGET_ARCH_MODEL_arm
|
||||
# include "adfiles/ad_arm.hpp"
|
||||
#endif
|
||||
#ifdef TARGET_ARCH_MODEL_ppc
|
||||
# include "adfiles/ad_ppc.hpp"
|
||||
#endif
|
||||
|
||||
OptoReg::Name OptoReg::c_frame_pointer;
|
||||
|
||||
|
@ -70,15 +70,6 @@
|
||||
#include "utilities/dtrace.hpp"
|
||||
#include "utilities/events.hpp"
|
||||
#include "utilities/histogram.hpp"
|
||||
#ifdef TARGET_ARCH_x86
|
||||
# include "jniTypes_x86.hpp"
|
||||
#endif
|
||||
#ifdef TARGET_ARCH_sparc
|
||||
# include "jniTypes_sparc.hpp"
|
||||
#endif
|
||||
#ifdef TARGET_ARCH_zero
|
||||
# include "jniTypes_zero.hpp"
|
||||
#endif
|
||||
#ifdef TARGET_OS_FAMILY_linux
|
||||
# include "os_linux.inline.hpp"
|
||||
# include "thread_linux.inline.hpp"
|
||||
|
@ -37,15 +37,6 @@
|
||||
#include "services/management.hpp"
|
||||
#include "utilities/defaultStream.hpp"
|
||||
#include "utilities/taskqueue.hpp"
|
||||
#ifdef TARGET_ARCH_x86
|
||||
# include "vm_version_x86.hpp"
|
||||
#endif
|
||||
#ifdef TARGET_ARCH_sparc
|
||||
# include "vm_version_sparc.hpp"
|
||||
#endif
|
||||
#ifdef TARGET_ARCH_zero
|
||||
# include "vm_version_zero.hpp"
|
||||
#endif
|
||||
#ifdef TARGET_OS_FAMILY_linux
|
||||
# include "os_linux.inline.hpp"
|
||||
#endif
|
||||
@ -251,6 +242,11 @@ static ObsoleteFlag obsolete_jvm_flags[] = {
|
||||
{ "UseParallelOldGCDensePrefix",
|
||||
JDK_Version::jdk_update(6,27), JDK_Version::jdk(8) },
|
||||
{ "AllowTransitionalJSR292", JDK_Version::jdk(7), JDK_Version::jdk(8) },
|
||||
{ "UseCompressedStrings", JDK_Version::jdk(7), JDK_Version::jdk(8) },
|
||||
#ifdef PRODUCT
|
||||
{ "DesiredMethodLimit",
|
||||
JDK_Version::jdk_update(7, 2), JDK_Version::jdk(8) },
|
||||
#endif // PRODUCT
|
||||
{ NULL, JDK_Version(0), JDK_Version(0) }
|
||||
};
|
||||
|
||||
@ -2912,6 +2908,18 @@ void Arguments::set_shared_spaces_flags() {
|
||||
}
|
||||
}
|
||||
|
||||
// Disable options not supported in this release, with a warning if they
|
||||
// were explicitly requested on the command-line
|
||||
#define UNSUPPORTED_OPTION(opt, description) \
|
||||
do { \
|
||||
if (opt) { \
|
||||
if (FLAG_IS_CMDLINE(opt)) { \
|
||||
warning(description " is disabled in this release."); \
|
||||
} \
|
||||
FLAG_SET_DEFAULT(opt, false); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
// Parse entry point called from JNI_CreateJavaVM
|
||||
|
||||
jint Arguments::parse(const JavaVMInitArgs* args) {
|
||||
@ -3009,6 +3017,13 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef JAVASE_EMBEDDED
|
||||
#ifdef PPC
|
||||
UNSUPPORTED_OPTION(EnableInvokeDynamic, "Invoke dynamic");
|
||||
#endif
|
||||
UNSUPPORTED_OPTION(UseG1GC, "G1 GC");
|
||||
#endif
|
||||
|
||||
#ifndef PRODUCT
|
||||
if (TraceBytecodesAt != 0) {
|
||||
TraceBytecodes = true;
|
||||
|
@ -51,6 +51,12 @@
|
||||
#ifdef TARGET_OS_ARCH_windows_x86
|
||||
# include "atomic_windows_x86.inline.hpp"
|
||||
#endif
|
||||
#ifdef TARGET_OS_ARCH_linux_arm
|
||||
# include "atomic_linux_arm.inline.hpp"
|
||||
#endif
|
||||
#ifdef TARGET_OS_ARCH_linux_ppc
|
||||
# include "atomic_linux_ppc.inline.hpp"
|
||||
#endif
|
||||
|
||||
jbyte Atomic::cmpxchg(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) {
|
||||
assert(sizeof(jbyte) == 1, "assumption.");
|
||||
|
@ -343,6 +343,12 @@ class CommandLineFlags {
|
||||
#define falseInTiered true
|
||||
#endif
|
||||
|
||||
#ifdef JAVASE_EMBEDDED
|
||||
#define falseInEmbedded false
|
||||
#else
|
||||
#define falseInEmbedded true
|
||||
#endif
|
||||
|
||||
// develop flags are settable / visible only during development and are constant in the PRODUCT version
|
||||
// product flags are always settable / visible
|
||||
// notproduct flags are settable / visible only during development and are not declared in the PRODUCT version
|
||||
@ -438,6 +444,9 @@ class CommandLineFlags {
|
||||
product(bool, UsePPCLWSYNC, true, \
|
||||
"Use lwsync instruction if true, else use slower sync") \
|
||||
\
|
||||
develop(bool, CleanChunkPoolAsync, falseInEmbedded, \
|
||||
"Whether to clean the chunk pool asynchronously") \
|
||||
\
|
||||
/* Temporary: See 6948537 */ \
|
||||
experimental(bool, UseMemSetInBOT, true, \
|
||||
"(Unstable) uses memset in BOT updates in GC code") \
|
||||
@ -3611,13 +3620,9 @@ class CommandLineFlags {
|
||||
\
|
||||
/* flags for performance data collection */ \
|
||||
\
|
||||
NOT_EMBEDDED(product(bool, UsePerfData, true, \
|
||||
product(bool, UsePerfData, falseInEmbedded, \
|
||||
"Flag to disable jvmstat instrumentation for performance testing" \
|
||||
"and problem isolation purposes.")) \
|
||||
\
|
||||
EMBEDDED_ONLY(product(bool, UsePerfData, false, \
|
||||
"Flag to disable jvmstat instrumentation for performance testing" \
|
||||
"and problem isolation purposes.")) \
|
||||
"and problem isolation purposes.") \
|
||||
\
|
||||
product(bool, PerfDataSaveToFile, false, \
|
||||
"Save PerfData memory to hsperfdata_<pid> file on exit") \
|
||||
|
@ -761,6 +761,7 @@ void os::print_cpu_info(outputStream* st) {
|
||||
// st->print("(active %d)", os::active_processor_count());
|
||||
st->print(" %s", VM_Version::cpu_features());
|
||||
st->cr();
|
||||
pd_print_cpu_info(st);
|
||||
}
|
||||
|
||||
void os::print_date_and_time(outputStream *st) {
|
||||
|
@ -480,6 +480,7 @@ class os: AllStatic {
|
||||
// Output format may be different on different platforms.
|
||||
static void print_os_info(outputStream* st);
|
||||
static void print_cpu_info(outputStream* st);
|
||||
static void pd_print_cpu_info(outputStream* st);
|
||||
static void print_memory_info(outputStream* st);
|
||||
static void print_dll_info(outputStream* st);
|
||||
static void print_environment_variables(outputStream* st, const char** env_list, char* buffer, int len);
|
||||
|
@ -3347,7 +3347,9 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
|
||||
// Notify JVMTI agents that VM initialization is complete - nop if no agents.
|
||||
JvmtiExport::post_vm_initialized();
|
||||
|
||||
Chunk::start_chunk_pool_cleaner_task();
|
||||
if (CleanChunkPoolAsync) {
|
||||
Chunk::start_chunk_pool_cleaner_task();
|
||||
}
|
||||
|
||||
// initialize compiler(s)
|
||||
CompileBroker::compilation_init();
|
||||
|
Loading…
Reference in New Issue
Block a user