Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
use MEM_RESERVE_EXECUTABLE on HOST_UNIX
  • Loading branch information
VSadov committed Dec 22, 2022
commit 3910401baec3a692f44f400be28be4c045f8f24e
5 changes: 4 additions & 1 deletion src/coreclr/vm/peimagelayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,10 @@ void* FlatImageLayout::LoadImageByCopyingParts(SIZE_T* m_imageParts) const
#endif // FEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION

DWORD allocationType = MEM_RESERVE | MEM_COMMIT;
#if defined(__APPLE__) && defined(HOST_ARM64)
#ifdef HOST_UNIX
// Tell PAL to use the executable memory allocator to satisfy this request for virtual memory.
// This is required on MacOS and otherwise will allow us to place native R2R code close to the
// coreclr library and thus improve performance by avoiding jump stubs in managed code.
allocationType |= MEM_RESERVE_EXECUTABLE;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would do this for HOST_UNIX in general like we do in the ExecutableAllocator::Reserve.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would cause that memory to be taken from the pre-reserved block in PAL that is close to the libcoreclr.so.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will it help R2R code in the same way as JITed code (making it closer to coreclr and avoiding stubs) ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not see you've answered this already.

#endif

Expand Down