Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcf40898

Browse files
authored
JLJITLinkMemoryManager: Disable when CodeModel != Large (#60245)
Under normal circumstances we never deallocate JITted code, and JITLinkwill never abandon in-flight allocations. Unfortunately, on platformswhere we use a code model that require relocations to not be too large,the linker can bail out if an allocation gets placed somewhere unlucky.[1]This change forces the use of MapperJITLinkMemoryManager on theplatforms where we use a non-large code model so that this can't happen,and removes the jl_unreachable() calls so that the JITLink error getsreported nicely instead of failing in our code.Since every JITLink platform currently uses a non-large code model, weshould no longer use JLJITLinkMemoryManager by default anywhere (exceptwhen it has been enabled on a RTDyLD platform, like when sanitizers areenabled). It is still necessary to have this change for#60031 to goforward, else the previously RTDyLD platforms run out of memory.Thanks to@IanButterworth and@giordano again.[1]https://buildkite.com/julialang/julia-master/builds/52316/steps/canvas?sid=019aba85-6699-45e3-b173-55f1420063ca#019aba85-66c0-40f1-80ba-8c5b4da56dba/934-1268
1 parentf36882f commitcf40898

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

‎src/cgmemmgr.cpp‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ static void *create_shared_map(size_t size, size_t id) JL_NOTSAFEPOINT
256256
return addr;
257257
}
258258

259-
staticintptr_tinit_shared_map() JL_NOTSAFEPOINT
259+
[[maybe_unused]]staticintptr_tinit_shared_map() JL_NOTSAFEPOINT
260260
{
261261
anon_hdl =get_anon_hdl();
262262
if (anon_hdl == -1)
@@ -771,6 +771,7 @@ class SelfMemAllocator : public ROAllocator {
771771
std::pair<std::unique_ptr<ROAllocator>, std::unique_ptr<ROAllocator>>
772772
get_preferred_allocators() JL_NOTSAFEPOINT
773773
{
774+
#if !(defined(_CPU_AARCH64_) || defined(_CPU_RISCV64_))
774775
#ifdef _OS_LINUX_
775776
if (get_self_mem_fd() != -1)
776777
return {std::make_unique<SelfMemAllocator>(false),
@@ -779,6 +780,7 @@ get_preferred_allocators() JL_NOTSAFEPOINT
779780
if (init_shared_map() != -1)
780781
return {std::make_unique<DualMapAllocator>(false),
781782
std::make_unique<DualMapAllocator>(true)};
783+
#endif
782784
return {};
783785
}
784786

@@ -959,7 +961,8 @@ class JLJITLinkMemoryManager : public jitlink::JITLinkMemoryManager {
959961
voiddeallocate(std::vector<FinalizedAlloc> Allocs,
960962
OnDeallocatedFunction OnDeallocated)override
961963
{
962-
jl_unreachable();
964+
// This shouldn't be reachable, but we will get a better error message
965+
// from JITLink if we leak this allocation and fail elsewhere.
963966
}
964967

965968
protected:
@@ -997,7 +1000,10 @@ class JLJITLinkMemoryManager::InFlightAlloc
9971000
public:
9981001
InFlightAlloc(JLJITLinkMemoryManager &MM, jitlink::LinkGraph &G) : MM(MM), G(G) {}
9991002

1000-
voidabandon(OnAbandonedFunction OnAbandoned)override {jl_unreachable(); }
1003+
voidabandon(OnAbandonedFunction OnAbandoned)override {
1004+
// This shouldn't be reachable, but we will get a better error message
1005+
// from JITLink if we leak this allocation and fail elsewhere.
1006+
}
10011007

10021008
voidfinalize(OnFinalizedFunction OnFinalized)override
10031009
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp