changeset 479:06d2c3204df4

Merge
author blacklion
date Fri, 12 Dec 2008 10:19:39 -0800
parents a7fac4381b50 (diff) 7b75310e57e2 (current diff)
children ffe19141e312
files
diffstat 9 files changed, 22 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/src/os/linux/vm/os_linux.cpp	Thu Dec 11 17:20:10 2008 -0800
+++ b/src/os/linux/vm/os_linux.cpp	Fri Dec 12 10:19:39 2008 -0800
@@ -2500,7 +2500,7 @@
 }
 
 bool os::unguard_memory(char* addr, size_t size) {
-  return linux_mprotect(addr, size, PROT_READ|PROT_WRITE|PROT_EXEC);
+  return linux_mprotect(addr, size, PROT_READ|PROT_WRITE);
 }
 
 // Large page support
--- a/src/os/solaris/vm/os_solaris.cpp	Thu Dec 11 17:20:10 2008 -0800
+++ b/src/os/solaris/vm/os_solaris.cpp	Fri Dec 12 10:19:39 2008 -0800
@@ -3026,6 +3026,8 @@
 
 // Protect memory (Used to pass readonly pages through
 // JNI GetArray<type>Elements with empty arrays.)
+// Also, used for serialization page and for compressed oops null pointer
+// checking.
 bool os::protect_memory(char* addr, size_t bytes, ProtType prot,
                         bool is_committed) {
   unsigned int p = 0;
@@ -3049,7 +3051,7 @@
 }
 
 bool os::unguard_memory(char* addr, size_t bytes) {
-  return solaris_mprotect(addr, bytes, PROT_READ|PROT_WRITE|PROT_EXEC);
+  return solaris_mprotect(addr, bytes, PROT_READ|PROT_WRITE);
 }
 
 // Large page support
--- a/src/os/windows/vm/os_windows.cpp	Thu Dec 11 17:20:10 2008 -0800
+++ b/src/os/windows/vm/os_windows.cpp	Fri Dec 12 10:19:39 2008 -0800
@@ -2020,10 +2020,11 @@
         if (UnguardOnExecutionViolation > 0 && addr != last_addr &&
             (UnguardOnExecutionViolation > 1 || os::address_is_in_vm(addr))) {
 
-          // Unguard and retry
+          // Set memory to RWX and retry
           address page_start =
             (address) align_size_down((intptr_t) addr, (intptr_t) page_size);
-          bool res = os::unguard_memory((char*) page_start, page_size);
+          bool res = os::protect_memory((char*) page_start, page_size,
+                                        os::MEM_PROT_RWX);
 
           if (PrintMiscellaneous && Verbose) {
             char buf[256];
@@ -2755,12 +2756,12 @@
 
 bool os::guard_memory(char* addr, size_t bytes) {
   DWORD old_status;
-  return VirtualProtect(addr, bytes, PAGE_EXECUTE_READWRITE | PAGE_GUARD, &old_status) != 0;
+  return VirtualProtect(addr, bytes, PAGE_READWRITE | PAGE_GUARD, &old_status) != 0;
 }
 
 bool os::unguard_memory(char* addr, size_t bytes) {
   DWORD old_status;
-  return VirtualProtect(addr, bytes, PAGE_EXECUTE_READWRITE, &old_status) != 0;
+  return VirtualProtect(addr, bytes, PAGE_READWRITE, &old_status) != 0;
 }
 
 void os::realign_memory(char *addr, size_t bytes, size_t alignment_hint) { }
--- a/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Thu Dec 11 17:20:10 2008 -0800
+++ b/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Fri Dec 12 10:19:39 2008 -0800
@@ -422,10 +422,11 @@
       if (addr != last_addr &&
           (UnguardOnExecutionViolation > 1 || os::address_is_in_vm(addr))) {
 
-        // Unguard and retry
+        // Set memory to RWX and retry
         address page_start =
           (address) align_size_down((intptr_t) addr, (intptr_t) page_size);
-        bool res = os::unguard_memory((char*) page_start, page_size);
+        bool res = os::protect_memory((char*) page_start, page_size,
+                                      os::MEM_PROT_RWX);
 
         if (PrintMiscellaneous && Verbose) {
           char buf[256];
--- a/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp	Thu Dec 11 17:20:10 2008 -0800
+++ b/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp	Fri Dec 12 10:19:39 2008 -0800
@@ -576,10 +576,11 @@
       if (addr != last_addr &&
           (UnguardOnExecutionViolation > 1 || os::address_is_in_vm(addr))) {
 
-        // Unguard and retry
+        // Make memory rwx and retry
         address page_start =
           (address) align_size_down((intptr_t) addr, (intptr_t) page_size);
-        bool res = os::unguard_memory((char*) page_start, page_size);
+        bool res = os::protect_memory((char*) page_start, page_size,
+                                      os::MEM_PROT_RWX);
 
         if (PrintMiscellaneous && Verbose) {
           char buf[256];
--- a/src/share/vm/prims/jni.cpp	Thu Dec 11 17:20:10 2008 -0800
+++ b/src/share/vm/prims/jni.cpp	Fri Dec 12 10:19:39 2008 -0800
@@ -2173,7 +2173,8 @@
     size_t size = os::vm_allocation_granularity();
     bad_address = os::reserve_memory(size);
     if (bad_address != NULL) {
-      os::protect_memory(bad_address, size, os::MEM_PROT_READ);
+      os::protect_memory(bad_address, size, os::MEM_PROT_READ,
+                         /*is_committed*/false);
     }
   }
   return bad_address;
--- a/src/share/vm/runtime/os.cpp	Thu Dec 11 17:20:10 2008 -0800
+++ b/src/share/vm/runtime/os.cpp	Fri Dec 12 10:19:39 2008 -0800
@@ -932,8 +932,9 @@
   // the mutator thread if such case is encountered. See bug 6546278 for details.
   Thread::muxAcquire(&SerializePageLock, "serialize_thread_states");
   os::protect_memory((char *)os::get_memory_serialize_page(),
-                     os::vm_page_size(), MEM_PROT_READ, /*is_committed*/true );
-  os::unguard_memory((char *)os::get_memory_serialize_page(), os::vm_page_size());
+                     os::vm_page_size(), MEM_PROT_READ);
+  os::protect_memory((char *)os::get_memory_serialize_page(),
+                     os::vm_page_size(), MEM_PROT_RW);
   Thread::muxRelease(&SerializePageLock);
 }
 
--- a/src/share/vm/runtime/os.hpp	Thu Dec 11 17:20:10 2008 -0800
+++ b/src/share/vm/runtime/os.hpp	Fri Dec 12 10:19:39 2008 -0800
@@ -208,7 +208,7 @@
 
   enum ProtType { MEM_PROT_NONE, MEM_PROT_READ, MEM_PROT_RW, MEM_PROT_RWX };
   static bool   protect_memory(char* addr, size_t bytes, ProtType prot,
-                               bool is_committed = false);
+                               bool is_committed = true);
 
   static bool   guard_memory(char* addr, size_t bytes);
   static bool   unguard_memory(char* addr, size_t bytes);
--- a/src/share/vm/runtime/synchronizer.cpp	Thu Dec 11 17:20:10 2008 -0800
+++ b/src/share/vm/runtime/synchronizer.cpp	Fri Dec 12 10:19:39 2008 -0800
@@ -3363,13 +3363,13 @@
    //   If the wakee is cold then transiently setting it's affinity
    //   to the current CPU is a good idea.
    //   See http://j2se.east/~dice/PERSIST/050624-PullAffinity.txt
+   DTRACE_MONITOR_PROBE(contended__exit, this, object(), Self);
    Trigger->unpark() ;
 
    // Maintain stats and report events to JVMTI
    if (ObjectSynchronizer::_sync_Parks != NULL) {
       ObjectSynchronizer::_sync_Parks->inc() ;
    }
-   DTRACE_MONITOR_PROBE(contended__exit, this, object(), Self);
 }