From f6cef7e2167026dffcf12952cff88a718650767f Mon Sep 17 00:00:00 2001 From: Sam Schweigel Date: Tue, 25 Nov 2025 08:58:26 -0800 Subject: [PATCH 1/2] Disable JLJITLinkMemoryManager on CPUs with non-large CodeModels --- src/cgmemmgr.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cgmemmgr.cpp b/src/cgmemmgr.cpp index d3f0be0ec4cbf..87ad694d05f67 100644 --- a/src/cgmemmgr.cpp +++ b/src/cgmemmgr.cpp @@ -256,7 +256,7 @@ static void *create_shared_map(size_t size, size_t id) JL_NOTSAFEPOINT return addr; } -static intptr_t init_shared_map() JL_NOTSAFEPOINT +[[maybe_unused]] static intptr_t init_shared_map() JL_NOTSAFEPOINT { anon_hdl = get_anon_hdl(); if (anon_hdl == -1) @@ -771,6 +771,7 @@ class SelfMemAllocator : public ROAllocator { std::pair, std::unique_ptr> get_preferred_allocators() JL_NOTSAFEPOINT { +#if !(defined(_CPU_AARCH64_) || defined(_CPU_RISCV64_)) #ifdef _OS_LINUX_ if (get_self_mem_fd() != -1) return {std::make_unique(false), @@ -779,6 +780,7 @@ get_preferred_allocators() JL_NOTSAFEPOINT if (init_shared_map() != -1) return {std::make_unique(false), std::make_unique(true)}; +#endif return {}; } From 06e313a5accf4aa94aab5f766b9e39a1066f382b Mon Sep 17 00:00:00 2001 From: Sam Schweigel Date: Tue, 25 Nov 2025 09:12:29 -0800 Subject: [PATCH 2/2] Remove jl_unreachable() in JLJITLinkMemoryManager to get better errors --- src/cgmemmgr.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cgmemmgr.cpp b/src/cgmemmgr.cpp index 87ad694d05f67..e570834b8500e 100644 --- a/src/cgmemmgr.cpp +++ b/src/cgmemmgr.cpp @@ -961,7 +961,8 @@ class JLJITLinkMemoryManager : public jitlink::JITLinkMemoryManager { void deallocate(std::vector Allocs, OnDeallocatedFunction OnDeallocated) override { - jl_unreachable(); + // This shouldn't be reachable, but we will get a better error message + // from JITLink if we leak this allocation and fail elsewhere. } protected: @@ -999,7 +1000,10 @@ class JLJITLinkMemoryManager::InFlightAlloc public: InFlightAlloc(JLJITLinkMemoryManager &MM, jitlink::LinkGraph &G) : MM(MM), G(G) {} - void abandon(OnAbandonedFunction OnAbandoned) override { jl_unreachable(); } + void abandon(OnAbandonedFunction OnAbandoned) override { + // This shouldn't be reachable, but we will get a better error message + // from JITLink if we leak this allocation and fail elsewhere. + } void finalize(OnFinalizedFunction OnFinalized) override {