This is an archive of the discontinued LLVM Phabricator instance.

[Orc][JITLink] JITLinkMemoryManager implementation using MemoryMapper
ClosedPublic

Authored by argentite on Jul 11 2022, 8:51 AM.

Details

Summary

MapperJITLinkMemoryManager supports executor memory management using any
implementation of MemoryMapper to do the transfer such as in process or
shared memory based.

Diff Detail

Event Timeline

argentite created this revision.Jul 11 2022, 8:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 11 2022, 8:51 AM
argentite requested review of this revision.Jul 11 2022, 8:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 11 2022, 8:51 AM
lhames added a subscriber: lhames.Jul 15 2022, 5:21 PM

Otherwise LGTM. Nice work!

llvm/include/llvm/ExecutionEngine/Orc/MemoryMapper.h
46

SharedMemoryMapper will need a definition of this now too.

llvm/lib/ExecutionEngine/Orc/MemoryMapper.cpp
31

getPageSize can fail -- this needs to return an error. The usual idiom is a named constructor:

class InProcessMemoryMapper ... {
public:
  Expected<InProcessMemoryMapper> Create() {
    if (auto PageSize = sys::Process::getPageSize())
      return InProcessMemoryMapper(*PageSize);
    else
      return PageSize.takeError();
  }

  InProcessMemoryMapper(size_t PageSize) : PageSize(PageSize) {}

  ...
}
argentite updated this revision to Diff 446258.Jul 20 2022, 1:54 PM

Added support for new SharedMemoryMapper

Improved error handling with create() methods

lhames accepted this revision.Jul 20 2022, 4:53 PM

Otherwise LGTM.

llvm/include/llvm/ExecutionEngine/Orc/MemoryMapper.h
85

Create methods _usually_ buck the method naming convention and use an uppercase 'C' to emphasize that they're named constructors (though honestly there's plenty of instances of both styles in the codebase). Since ORC more consistently uses upper-case 'C', we should stick with that for now.

This revision is now accepted and ready to land.Jul 20 2022, 4:53 PM
This revision was landed with ongoing or failed builds.Jul 20 2022, 5:53 PM
This revision was automatically updated to reflect the committed changes.