Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

Commit

Permalink
Don't use GC_malloc_atomic (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
anuraaga authored Oct 23, 2023
1 parent 55805ff commit 0363fb1
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,6 @@ func alloc(size uintptr, layoutPtr unsafe.Pointer) unsafe.Pointer {

func allocSmall(allocSz uintptr, layoutSz uintptr, layoutBm uintptr) unsafe.Pointer {
desc := gcDescr(layoutBm)
if desc == 0 {
return C.GC_malloc_atomic(C.uint(allocSz))
}

return allocTyped(allocSz, layoutSz, desc)
}

Expand All @@ -141,7 +137,7 @@ func allocLarge(allocSz uintptr, layoutPtr unsafe.Pointer) unsafe.Pointer {

func allocTyped(allocSz uintptr, layoutSz uintptr, desc uintptr) unsafe.Pointer {
itemSz := layoutSz * unsafe.Sizeof(uintptr(0))
if itemSz == allocSz {
if desc == 0 || itemSz == allocSz {
return C.GC_malloc_explicitly_typed(C.uint(allocSz), C.uint(desc))
}
numItems := allocSz / itemSz
Expand Down

0 comments on commit 0363fb1

Please sign in to comment.