Skip to content

Commit

Permalink
Use memset in new_heap_segment; remove home-made zero_dnodes
Browse files Browse the repository at this point in the history
It turns out that memset is faster.
  • Loading branch information
xrme committed Jul 12, 2024
1 parent f7ac284 commit 678d152
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 65 deletions.
21 changes: 0 additions & 21 deletions lisp-kernel/arm-asmutils.s
Original file line number Diff line number Diff line change
Expand Up @@ -252,27 +252,6 @@ _exportfn(call_handler_on_main_stack)
__(bx ip)
_endfn

/* zero N (r1) dnodes, starting at the dnode-aligned address in r0 */
_exportfn(C(zero_dnodes))
__(adr r2,9f)
__(fldmiad r2,{d0-d7})
__(ands r2,r1,#7)
__(sub r1,r1,r2)
__(b 1f)
0: __(subs r2,r2,#1)
__(fstd d0,[r0])
__(add r0,r0,#dnode_size)
1: __(bne 0b)
__(cmp r1,#0)
__(b 3f)
2: __(subs r1,r1,#8)
__(fstmiad r0!,{d0-d7})
3: __(bne 2b)
__(bx lr)
.align 3
9: .long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
_endfn

_exportfn(C(dmb))
__(dmb)
__(bx lr)
Expand Down
4 changes: 2 additions & 2 deletions lisp-kernel/gc-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -2033,9 +2033,9 @@ new_heap_segment(ExceptionInformation *xp, natural need, Boolean extend, TCR *tc
platform_new_heap_segment(xp, tcr, (BytePtr)oldlimit, (BytePtr)newlimit);
if ((BytePtr)oldlimit < heap_dirty_limit) {
if ((BytePtr)newlimit < heap_dirty_limit) {
zero_dnodes((void *)oldlimit,area_dnode(newlimit,oldlimit));
memset((void *)oldlimit, 0, newlimit - oldlimit);
} else {
zero_dnodes((void *)oldlimit,area_dnode(heap_dirty_limit,oldlimit));
memset((void *)oldlimit, 0, (size_t)heap_dirty_limit - oldlimit);
}
}
if ((BytePtr)newlimit > heap_dirty_limit) {
Expand Down
2 changes: 0 additions & 2 deletions lisp-kernel/gc.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,5 @@ extern Boolean
did_gc_notification_since_last_full_gc;

extern BytePtr heap_dirty_limit;
extern void zero_dnodes(void *,natural);


#endif /* __GC_H__ */
15 changes: 0 additions & 15 deletions lisp-kernel/ppc-asmutils.s
Original file line number Diff line number Diff line change
Expand Up @@ -426,19 +426,4 @@ _exportfn(C(get_vector_registers))
__(lvx v0,r3,r4)
__(blr)
_endfn

/* zero N (r4) dnodes, starting at the dnode-aligned address in r3 */
_exportfn(C(zero_dnodes))
__(cmpri(r4,0))
__(li r5,0)
__(li r6,0)
__(b 1f)
0: __(subi r4,r4,1)
__(str(r5,0(r3)))
__(cmpri(r4,0))
__(str(r6,node_size(r3)))
__(la r3,dnode_size(r3))
1: __(bne 0b)
__(blr)
_endfn
_endfile
14 changes: 0 additions & 14 deletions lisp-kernel/x86-asmutils32.s
Original file line number Diff line number Diff line change
Expand Up @@ -279,19 +279,5 @@ _exportfn(C(ensure_safe_for_string_operations))
_endfn
__endif

/* zero arg1 dnodes,starting at the dnode-aligned address in arg0 */
_exportfn(C(zero_dnodes))
__(xorl %eax,%eax)
__(mov 4(%esp),%edx)
__(mov 8(%esp),%ecx)
__(testl %ecx,%ecx)
__(jmp 1f)
0: __(mov %eax,0(%edx))
__(mov %eax,4(%edx))
__(lea dnode_size(%edx),%edx)
__(subl $1,%ecx)
1: __(jne 0b)
__(ret)
_endfn
_endfile

11 changes: 0 additions & 11 deletions lisp-kernel/x86-asmutils64.s
Original file line number Diff line number Diff line change
Expand Up @@ -279,15 +279,4 @@ _endfn

__endif

/* zero N (%carg1) dnodes, starting at the dnode-aligned address in %carg0 */
_exportfn(C(zero_dnodes))
__(pxor %xmm0,%xmm0)
__(cmpq $0,%carg1)
__(jmp 1f)
0: __(movdqa %xmm0,(%carg0))
__(lea 16(%carg0),%carg0)
__(subq $1,%carg1)
1: __(jne 0b)
__(ret)
_endfn
_endfile

0 comments on commit 678d152

Please sign in to comment.