Skip to content

Commit 674853f

Browse files
committed
Remove heap coverage code in favor of external tooling
1 parent acc877b commit 674853f

File tree

3 files changed

+5
-121
lines changed

3 files changed

+5
-121
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
./odin check examples/all -vet -strict-style -disallow-do -target:netbsd_arm64
3535
./odin check vendor/sdl3 -vet -strict-style -disallow-do -target:netbsd_amd64 -no-entry-point
3636
./odin check vendor/sdl3 -vet -strict-style -disallow-do -target:netbsd_arm64 -no-entry-point
37-
./odin run tests/heap_allocator -vet -strict-style -disallow-do -define:ODIN_DEBUG_HEAP=true -- -allocator=feoramalloc -vmem-tests -serial-tests -parallel-tests
37+
./odin run tests/heap_allocator -vet -strict-style -disallow-do -debug -- -allocator=feoramalloc -vmem-tests -serial-tests -parallel-tests
3838
./odin test tests/core/normal.odin -file -all-packages -vet -strict-style -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true
3939
./odin test tests/core/speed.odin -file -all-packages -vet -strict-style -disallow-do -o:speed -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true
4040
./odin test tests/vendor -all-packages -vet -strict-style -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true
@@ -66,7 +66,7 @@ jobs:
6666
gmake -C vendor/miniaudio/src
6767
./odin check examples/all -vet -strict-style -disallow-do -target:freebsd_amd64
6868
./odin check vendor/sdl3 -vet -strict-style -disallow-do -target:freebsd_amd64 -no-entry-point
69-
./odin run tests/heap_allocator -vet -strict-style -disallow-do -define:ODIN_DEBUG_HEAP=true -- -allocator=feoramalloc -vmem-tests -serial-tests -parallel-tests
69+
./odin run tests/heap_allocator -vet -strict-style -disallow-do -debug -- -allocator=feoramalloc -vmem-tests -serial-tests -parallel-tests
7070
./odin test tests/core/normal.odin -file -all-packages -vet -strict-style -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true
7171
./odin test tests/core/speed.odin -file -all-packages -vet -strict-style -disallow-do -o:speed -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true
7272
./odin test tests/vendor -all-packages -vet -strict-style -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true
@@ -126,7 +126,7 @@ jobs:
126126
- name: Odin check vendor/sdl3
127127
run: ./odin check vendor/sdl3 -strict-style -vet -disallow-do -no-entry-point
128128
- name: Odin heap allocator tests
129-
run: ./odin run tests/heap_allocator -vet -strict-style -disallow-do -define:ODIN_DEBUG_HEAP=true -sanitize:thread -- -allocator=feoramalloc -vmem-tests -serial-tests -parallel-tests
129+
run: ./odin run tests/heap_allocator -vet -strict-style -disallow-do -debug -sanitize:thread -- -allocator=feoramalloc -vmem-tests -serial-tests -parallel-tests
130130
- name: Normal Core library tests
131131
run: ./odin test tests/core/normal.odin -file -all-packages -vet -strict-style -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true
132132
- name: Optimized Core library tests
@@ -219,7 +219,7 @@ jobs:
219219
shell: cmd
220220
run: |
221221
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
222-
odin run tests/heap_allocator -vet -strict-style -disallow-do -define:ODIN_DEBUG_HEAP=true -- -allocator=feoramalloc -vmem-tests -serial-tests -parallel-tests
222+
odin run tests/heap_allocator -vet -strict-style -disallow-do -debug -- -allocator=feoramalloc -vmem-tests -serial-tests -parallel-tests
223223
- name: Core library tests
224224
shell: cmd
225225
run: |
@@ -315,7 +315,7 @@ jobs:
315315
run: ./odin run examples/demo -debug -vet -strict-style -disallow-do -target:linux_riscv64 -extra-linker-flags:"-fuse-ld=/usr/bin/riscv64-linux-gnu-gcc-12 -static -Wl,-static" -no-rpath
316316

317317
- name: Odin heap allocator tests
318-
run: ./odin run tests/heap_allocator -vet -strict-style -disallow-do -target:linux_riscv64 -extra-linker-flags:"-fuse-ld=/usr/bin/riscv64-linux-gnu-gcc-12 -static -Wl,-static" -no-rpath -define:ODIN_DEBUG_HEAP=true -- -allocator=feoramalloc -vmem-tests -serial-tests -parallel-tests
318+
run: ./odin run tests/heap_allocator -vet -strict-style -disallow-do -target:linux_riscv64 -extra-linker-flags:"-fuse-ld=/usr/bin/riscv64-linux-gnu-gcc-12 -static -Wl,-static" -no-rpath -debug -- -allocator=feoramalloc -vmem-tests -serial-tests -parallel-tests
319319

320320
- name: Normal Core library tests
321321
run: ./odin test tests/core/normal.odin -file -all-packages -vet -strict-style -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true -target:linux_riscv64 -extra-linker-flags:"-fuse-ld=/usr/bin/riscv64-linux-gnu-gcc-12 -static -Wl,-static" -no-rpath

base/runtime/heap_allocator_debugging.odin

Lines changed: 0 additions & 96 deletions
This file was deleted.

tests/heap_allocator/test_bench.odin

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ import "core:mem"
1717

1818
import libc_allocator "libc"
1919

20-
ODIN_DEBUG_HEAP :: runtime.ODIN_DEBUG_HEAP
21-
2220
// The tests are specific to feoramalloc, but the benchmarks are general-purpose.
2321

2422
//
@@ -851,7 +849,6 @@ main :: proc() {
851849
compact: bool `usage:"Compact the heap at the end."`,
852850
info: bool `usage:"Show heap info at the end."`,
853851
trap: bool `usage:"Trigger a debug trap at the end."`,
854-
coverage: bool `usage:"Check code coverage."`,
855852
}
856853

857854
opt: Options
@@ -970,9 +967,6 @@ main :: proc() {
970967
expect(err2 == nil)
971968
_, err3 := allocator.procedure(allocator.data, .Free, 0, 0, raw_data(o2), 0)
972969
expect(err3 == nil)
973-
when ODIN_DEBUG_HEAP {
974-
expect(intrinsics.atomic_load(&runtime.heap_global_code_coverage[.Resize_Wide_Slab_Expanded_In_Place]) == 1)
975-
}
976970
}
977971

978972
// Inter-bin tests.
@@ -1173,20 +1167,6 @@ main :: proc() {
11731167
log.info("The main thread's heap has been compacted.")
11741168
}
11751169

1176-
if opt.coverage {
1177-
when runtime.ODIN_DEBUG_HEAP {
1178-
log.info("--- Code coverage report ---")
1179-
for key in runtime.Heap_Code_Coverage_Type {
1180-
value := intrinsics.atomic_load_explicit(&runtime.heap_global_code_coverage[key], .Acquire)
1181-
log.infof("%s%v: %v", ">>> " if value == 0 else "", key, value)
1182-
}
1183-
1184-
log.infof("Full code coverage: %v", runtime._check_heap_code_coverage())
1185-
} else {
1186-
log.error("ODIN_DEBUG_HEAP is not enabled, thus coverage cannot be calculated.")
1187-
}
1188-
}
1189-
11901170
// for ptr, entry in tracker.allocation_map {
11911171
// log.infof("%p -- %v", ptr, entry)
11921172
// }

0 commit comments

Comments
 (0)