fence: free and realloc stay on the fast path with the arena on - the arena's range checked inline
With the arena running every free and every realloc took the slow path (a call to check the range, then the fence's own test). Now lp_free checks the arena's range inline and hands anything else to libc unless the fence is tracking; lp_realloc goes slow only for a scratch request, a tracked run or an arena block. Ready for when the final run's medians ask for it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
8c72437ecc
commit
dd20cb2d5d
3 changed files with 48129 additions and 48117 deletions
|
|
@ -184,10 +184,15 @@ function emit_fence_entry() -> void {
|
|||
emith("entry:\n")
|
||||
emith(" %t = load i8, ptr @lp_ft\n")
|
||||
emith(" %w = load i8, ptr @lp_want\n")
|
||||
emith(" %a = load i8, ptr @lp_ar_on\n")
|
||||
emith(" %x = ptrtoint ptr %o to i64\n")
|
||||
emith(" %lo = load i64, ptr @lp_ar_lo\n")
|
||||
emith(" %hi = load i64, ptr @lp_ar_hi\n")
|
||||
emith(" %ge = icmp uge i64 %x, %lo\n")
|
||||
emith(" %lt = icmp ult i64 %x, %hi\n")
|
||||
emith(" %inar = and i1 %ge, %lt\n")
|
||||
emith(" %o1 = or i8 %t, %w\n")
|
||||
emith(" %o2 = or i8 %o1, %a\n")
|
||||
emith(" %on = icmp ne i8 %o2, 0\n")
|
||||
emith(" %some = icmp ne i8 %o1, 0\n")
|
||||
emith(" %on = or i1 %some, %inar\n")
|
||||
emith(" br i1 %on, label %slow, label %fast\n")
|
||||
emith("fast:\n")
|
||||
emith(" %p = tail call ptr @realloc(ptr %o, i64 %n)\n")
|
||||
|
|
@ -239,20 +244,17 @@ function emit_fence_entry() -> void {
|
|||
emith("}\n")
|
||||
emith("define void @lp_free(ptr %o) {\n")
|
||||
emith("entry:\n")
|
||||
emith(" %t = load i8, ptr @lp_ft\n")
|
||||
emith(" %a = load i8, ptr @lp_ar_on\n")
|
||||
emith(" %o1 = or i8 %t, %a\n")
|
||||
emith(" %on = icmp ne i8 %o1, 0\n")
|
||||
emith(" br i1 %on, label %slow, label %fast\n")
|
||||
emith("fast:\n")
|
||||
emith(" tail call void @free(ptr %o)\n")
|
||||
emith(" ret void\n")
|
||||
emith("slow:\n")
|
||||
emith(" %in = call i1 @lp_in_arena(ptr %o)\n")
|
||||
emith(" br i1 %in, label %keep, label %give\n")
|
||||
emith(" %x = ptrtoint ptr %o to i64\n")
|
||||
emith(" %lo = load i64, ptr @lp_ar_lo\n")
|
||||
emith(" %hi = load i64, ptr @lp_ar_hi\n")
|
||||
emith(" %ge = icmp uge i64 %x, %lo\n")
|
||||
emith(" %lt = icmp ult i64 %x, %hi\n")
|
||||
emith(" %in = and i1 %ge, %lt\n")
|
||||
emith(" br i1 %in, label %keep, label %heap\n")
|
||||
emith("keep:\n")
|
||||
emith(" ret void\n")
|
||||
emith("give:\n")
|
||||
emith("heap:\n")
|
||||
emith(" %t = load i8, ptr @lp_ft\n")
|
||||
emith(" %tq = icmp ne i8 %t, 0\n")
|
||||
emith(" br i1 %tq, label %tracked, label %plain\n")
|
||||
emith("plain:\n")
|
||||
|
|
|
|||
48128
selfhost/ludicc.seed.ll
48128
selfhost/ludicc.seed.ll
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue