Mercurial > hg > graal-jvmci-8
comparison src/os/solaris/vm/os_solaris.cpp @ 237:1fdb98a17101
6716785: implicit null checks not triggering with CompressedOops
Summary: allocate alignment-sized page(s) below java heap so that memory accesses at heap_base+1page give signal and cause an implicit null check
Reviewed-by: kvn, jmasa, phh, jcoomes
author | coleenp |
---|---|
date | Sat, 19 Jul 2008 17:38:22 -0400 |
parents | d1605aabd0a1 |
children | d95b224e9f17 850fdf70db2b |
comparison
equal
deleted
inserted
replaced
235:9c2ecc2ffb12 | 237:1fdb98a17101 |
---|---|
2963 "addr must be page aligned"); | 2963 "addr must be page aligned"); |
2964 int retVal = mprotect(addr, bytes, prot); | 2964 int retVal = mprotect(addr, bytes, prot); |
2965 return retVal == 0; | 2965 return retVal == 0; |
2966 } | 2966 } |
2967 | 2967 |
2968 // Protect memory (make it read-only. (Used to pass readonly pages through | 2968 // Protect memory (Used to pass readonly pages through |
2969 // JNI GetArray<type>Elements with empty arrays.) | 2969 // JNI GetArray<type>Elements with empty arrays.) |
2970 bool os::protect_memory(char* addr, size_t bytes) { | 2970 bool os::protect_memory(char* addr, size_t bytes, ProtType prot, |
2971 return solaris_mprotect(addr, bytes, PROT_READ); | 2971 bool is_committed) { |
2972 unsigned int p = 0; | |
2973 switch (prot) { | |
2974 case MEM_PROT_NONE: p = PROT_NONE; break; | |
2975 case MEM_PROT_READ: p = PROT_READ; break; | |
2976 case MEM_PROT_RW: p = PROT_READ|PROT_WRITE; break; | |
2977 case MEM_PROT_RWX: p = PROT_READ|PROT_WRITE|PROT_EXEC; break; | |
2978 default: | |
2979 ShouldNotReachHere(); | |
2980 } | |
2981 // is_committed is unused. | |
2982 return solaris_mprotect(addr, bytes, p); | |
2972 } | 2983 } |
2973 | 2984 |
2974 // guard_memory and unguard_memory only happens within stack guard pages. | 2985 // guard_memory and unguard_memory only happens within stack guard pages. |
2975 // Since ISM pertains only to the heap, guard and unguard memory should not | 2986 // Since ISM pertains only to the heap, guard and unguard memory should not |
2976 /// happen with an ISM region. | 2987 /// happen with an ISM region. |