JDK-8266566 : Can we just use mprotect in pd_commit_memory?
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 17
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • CPU: x86_64,aarch64
  • Submitted: 2021-05-05
  • Updated: 2023-01-06
  • Resolved: 2023-01-06
Related Reports
Relates :  
Description
Question came up while working on JDK-8262952

We have 4 separate cases in the BSD "pd_commit_memory()" implementation:

#1 __OpenBSD__
#2 __APPLE__ with exec==true
#3 __APPLE__ with exec==false
#4 all other BSD

#1 uses mprotect
#2 uses mprotect
#3 uses mmap
#4 uses mmap

For #2 mprotect must be used, mmap won't work, but for #3 we could use mprotect instead of mmap, so the question is: can't we simplify the code by using only mprotect?
Comments
Runtime Triage: closing due to long period of inactivity on this request
06-01-2023