diff --git a/src/jl_exported_funcs.inc b/src/jl_exported_funcs.inc index c475184573faa..eae2ceda63112 100644 --- a/src/jl_exported_funcs.inc +++ b/src/jl_exported_funcs.inc @@ -152,6 +152,7 @@ XX(jl_gc_add_finalizer_th) \ XX(jl_gc_add_ptr_finalizer) \ XX(jl_gc_add_quiescent) \ + XX(jl_gc_alloc) \ XX(jl_gc_allocobj) \ XX(jl_gc_alloc_0w) \ XX(jl_gc_alloc_1w) \ diff --git a/src/llvm-final-gc-lowering.cpp b/src/llvm-final-gc-lowering.cpp index e4e8ff69ee2da..a4f8cbbda1820 100644 --- a/src/llvm-final-gc-lowering.cpp +++ b/src/llvm-final-gc-lowering.cpp @@ -48,7 +48,7 @@ struct FinalLowerGC: private JuliaPassContext { Function *queueRootFunc; Function *poolAllocFunc; Function *bigAllocFunc; - Function *allocTypedFunc; + Function *allocFunc; Instruction *pgcstack; // Lowers a `julia.new_gc_frame` intrinsic. @@ -236,7 +236,7 @@ Value *FinalLowerGC::lowerGCAllocBytes(CallInst *target, Function &F) } else { auto size = builder.CreateZExtOrTrunc(target->getArgOperand(1), getSizeTy(F.getContext())); size = builder.CreateAdd(size, ConstantInt::get(getSizeTy(F.getContext()), sizeof(void*))); - newI = builder.CreateCall(allocTypedFunc, { ptls, size, ConstantPointerNull::get(Type::getInt8PtrTy(F.getContext())) }); + newI = builder.CreateCall(allocFunc, { ptls, size, ConstantPointerNull::get(Type::getInt8PtrTy(F.getContext())) }); derefAttr = Attribute::getWithDereferenceableBytes(F.getContext(), sizeof(void*)); } newI->setAttributes(newI->getCalledFunction()->getAttributes()); @@ -253,9 +253,9 @@ bool FinalLowerGC::doInitialization(Module &M) { queueRootFunc = getOrDeclare(jl_well_known::GCQueueRoot); poolAllocFunc = getOrDeclare(jl_well_known::GCPoolAlloc); bigAllocFunc = getOrDeclare(jl_well_known::GCBigAlloc); - allocTypedFunc = getOrDeclare(jl_well_known::GCAllocTyped); + allocFunc = getOrDeclare(jl_well_known::GCAlloc); - GlobalValue *functionList[] = {queueRootFunc, poolAllocFunc, bigAllocFunc, allocTypedFunc}; + GlobalValue *functionList[] = {queueRootFunc, poolAllocFunc, bigAllocFunc, allocFunc}; unsigned j = 0; for (unsigned i = 0; i < sizeof(functionList) / sizeof(void*); i++) { if (!functionList[i]) @@ -271,8 +271,8 @@ bool FinalLowerGC::doInitialization(Module &M) { bool FinalLowerGC::doFinalization(Module &M) { - GlobalValue *functionList[] = {queueRootFunc, poolAllocFunc, bigAllocFunc, allocTypedFunc}; - queueRootFunc = poolAllocFunc = bigAllocFunc = allocTypedFunc = nullptr; + GlobalValue *functionList[] = {queueRootFunc, poolAllocFunc, bigAllocFunc, allocFunc}; + queueRootFunc = poolAllocFunc = bigAllocFunc = allocFunc = nullptr; auto used = M.getGlobalVariable("llvm.compiler.used"); if (!used) return false; diff --git a/src/llvm-pass-helpers.cpp b/src/llvm-pass-helpers.cpp index e69a7d32bda9b..9c00f70d61b87 100644 --- a/src/llvm-pass-helpers.cpp +++ b/src/llvm-pass-helpers.cpp @@ -229,7 +229,7 @@ namespace jl_well_known { static const char *GC_BIG_ALLOC_NAME = XSTR(jl_gc_big_alloc); static const char *GC_POOL_ALLOC_NAME = XSTR(jl_gc_pool_alloc); static const char *GC_QUEUE_ROOT_NAME = XSTR(jl_gc_queue_root); - static const char *GC_ALLOC_TYPED_NAME = XSTR(jl_gc_alloc_typed); + static const char *GC_ALLOC_NAME = XSTR(jl_gc_alloc); using jl_intrinsics::addGCAllocAttributes; @@ -278,10 +278,10 @@ namespace jl_well_known { return func; }); - const WellKnownFunctionDescription GCAllocTyped( - GC_ALLOC_TYPED_NAME, + const WellKnownFunctionDescription GCAlloc( + GC_ALLOC_NAME, [](const JuliaPassContext &context) { - auto allocTypedFunc = Function::Create( + auto allocFunc = Function::Create( FunctionType::get( context.T_prjlvalue, { Type::getInt8PtrTy(context.getLLVMContext()), @@ -291,8 +291,8 @@ namespace jl_well_known { Type::getInt8PtrTy(context.getLLVMContext()) }, false), Function::ExternalLinkage, - GC_ALLOC_TYPED_NAME); - allocTypedFunc->addFnAttr(Attribute::getWithAllocSizeArgs(context.getLLVMContext(), 1, None)); - return addGCAllocAttributes(allocTypedFunc, context.getLLVMContext()); + GC_ALLOC_NAME); + allocFunc->addFnAttr(Attribute::getWithAllocSizeArgs(context.getLLVMContext(), 1, None)); + return addGCAllocAttributes(allocFunc, context.getLLVMContext()); }); } diff --git a/src/llvm-pass-helpers.h b/src/llvm-pass-helpers.h index 3388e6d485181..bae820ffee2cb 100644 --- a/src/llvm-pass-helpers.h +++ b/src/llvm-pass-helpers.h @@ -150,8 +150,8 @@ namespace jl_well_known { // `jl_gc_queue_root`: queues a GC root. extern const WellKnownFunctionDescription GCQueueRoot; - // `jl_gc_alloc_typed`: allocates bytes. - extern const WellKnownFunctionDescription GCAllocTyped; + // `jl_gc_alloc`: allocates bytes. + extern const WellKnownFunctionDescription GCAlloc; } #endif