diff options
Diffstat (limited to 'pkg/refs')
-rw-r--r-- | pkg/refs/weak_ref_list.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/pkg/refs/weak_ref_list.go b/pkg/refs/weak_ref_list.go index 31460bfc3..920e89eb3 100644 --- a/pkg/refs/weak_ref_list.go +++ b/pkg/refs/weak_ref_list.go @@ -38,16 +38,22 @@ func (l *weakRefList) Reset() { } // Empty returns true iff the list is empty. +// +//go:nosplit func (l *weakRefList) Empty() bool { return l.head == nil } // Front returns the first element of list l or nil. +// +//go:nosplit func (l *weakRefList) Front() *WeakRef { return l.head } // Back returns the last element of list l or nil. +// +//go:nosplit func (l *weakRefList) Back() *WeakRef { return l.tail } @@ -55,6 +61,8 @@ func (l *weakRefList) Back() *WeakRef { // Len returns the number of elements in the list. // // NOTE: This is an O(n) operation. +// +//go:nosplit func (l *weakRefList) Len() (count int) { for e := l.Front(); e != nil; e = (weakRefElementMapper{}.linkerFor(e)).Next() { count++ @@ -63,6 +71,8 @@ func (l *weakRefList) Len() (count int) { } // PushFront inserts the element e at the front of list l. +// +//go:nosplit func (l *weakRefList) PushFront(e *WeakRef) { linker := weakRefElementMapper{}.linkerFor(e) linker.SetNext(l.head) @@ -77,6 +87,8 @@ func (l *weakRefList) PushFront(e *WeakRef) { } // PushBack inserts the element e at the back of list l. +// +//go:nosplit func (l *weakRefList) PushBack(e *WeakRef) { linker := weakRefElementMapper{}.linkerFor(e) linker.SetNext(nil) @@ -91,6 +103,8 @@ func (l *weakRefList) PushBack(e *WeakRef) { } // PushBackList inserts list m at the end of list l, emptying m. +// +//go:nosplit func (l *weakRefList) PushBackList(m *weakRefList) { if l.head == nil { l.head = m.head @@ -106,6 +120,8 @@ func (l *weakRefList) PushBackList(m *weakRefList) { } // InsertAfter inserts e after b. +// +//go:nosplit func (l *weakRefList) InsertAfter(b, e *WeakRef) { bLinker := weakRefElementMapper{}.linkerFor(b) eLinker := weakRefElementMapper{}.linkerFor(e) @@ -124,6 +140,8 @@ func (l *weakRefList) InsertAfter(b, e *WeakRef) { } // InsertBefore inserts e before a. +// +//go:nosplit func (l *weakRefList) InsertBefore(a, e *WeakRef) { aLinker := weakRefElementMapper{}.linkerFor(a) eLinker := weakRefElementMapper{}.linkerFor(e) @@ -141,6 +159,8 @@ func (l *weakRefList) InsertBefore(a, e *WeakRef) { } // Remove removes e from l. +// +//go:nosplit func (l *weakRefList) Remove(e *WeakRef) { linker := weakRefElementMapper{}.linkerFor(e) prev := linker.Prev() @@ -173,21 +193,29 @@ type weakRefEntry struct { } // Next returns the entry that follows e in the list. +// +//go:nosplit func (e *weakRefEntry) Next() *WeakRef { return e.next } // Prev returns the entry that precedes e in the list. +// +//go:nosplit func (e *weakRefEntry) Prev() *WeakRef { return e.prev } // SetNext assigns 'entry' as the entry that follows e in the list. +// +//go:nosplit func (e *weakRefEntry) SetNext(elem *WeakRef) { e.next = elem } // SetPrev assigns 'entry' as the entry that precedes e in the list. +// +//go:nosplit func (e *weakRefEntry) SetPrev(elem *WeakRef) { e.prev = elem } |