Skip to content

Commit 8ef0c15

Browse files
committed
Updating fastpath allocation to count number of alloced bytes
1 parent df66882 commit 8ef0c15

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/llvm-late-gc-lowering.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2959,12 +2959,12 @@ Value* LateLowerGCFrame::lowerGCAllocBytesLate(CallInst *target, Function &F)
29592959
builder.CreateStore(new_cursor, cursor_ptr);
29602960

29612961
// ptls->gc_num.allocd += osize;
2962-
// auto pool_alloc_pos = ConstantInt::get(Type::getInt64Ty(target->getContext()), offsetof(jl_tls_states_t, gc_num));
2963-
// auto pool_alloc_i8 = builder.CreateGEP(Type::getInt8Ty(target->getContext()), ptls, pool_alloc_pos);
2964-
// auto pool_alloc_tls = builder.CreateBitCast(pool_alloc_i8, PointerType::get(Type::getInt64Ty(target->getContext()), 0), "pool_alloc");
2965-
// auto pool_allocd = builder.CreateLoad(Type::getInt64Ty(target->getContext()), pool_alloc_tls);
2966-
// auto pool_allocd_total = builder.CreateAdd(pool_allocd, pool_osize);
2967-
// builder.CreateStore(pool_allocd_total, pool_alloc_tls);
2962+
auto pool_alloc_pos = ConstantInt::get(Type::getInt64Ty(target->getContext()), offsetof(jl_tls_states_t, gc_tls) + offsetof(jl_gc_tls_states_t, gc_num));
2963+
auto pool_alloc_i8 = builder.CreateGEP(Type::getInt8Ty(target->getContext()), ptls, pool_alloc_pos);
2964+
auto pool_alloc_tls = builder.CreateBitCast(pool_alloc_i8, PointerType::get(Type::getInt64Ty(target->getContext()), 0), "pool_alloc");
2965+
auto pool_allocd = builder.CreateLoad(Type::getInt64Ty(target->getContext()), pool_alloc_tls);
2966+
auto pool_allocd_total = builder.CreateAdd(pool_allocd, pool_osize);
2967+
builder.CreateStore(pool_allocd_total, pool_alloc_tls);
29682968

29692969
auto v_raw = builder.CreateNSWAdd(result, ConstantInt::get(Type::getInt64Ty(target->getContext()), sizeof(jl_taggedvalue_t)));
29702970
auto v_as_ptr = builder.CreateIntToPtr(v_raw, poolAllocFunc->getReturnType());

0 commit comments

Comments
 (0)