summaryrefslogtreecommitdiffhomepage
path: root/pkg/state/addr_set.go
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-06-24 06:37:35 +0000
committergVisor bot <gvisor-bot@google.com>2020-06-24 06:37:35 +0000
commit9183888b520beeee8609170819a28bea89202909 (patch)
tree3cdcfa4de9ced4c539ab7c57e4cf58ffea980f6c /pkg/state/addr_set.go
parentcab13958a54419262aba2a0cd7f1075ed02c8ee0 (diff)
parent364ac92baf83f2352f78b718090472639bd92a76 (diff)
Merge release-20200608.0-119-g364ac92ba (automated)
Diffstat (limited to 'pkg/state/addr_set.go')
-rw-r--r--pkg/state/addr_set.go28
1 files changed, 12 insertions, 16 deletions
diff --git a/pkg/state/addr_set.go b/pkg/state/addr_set.go
index f8eaf0cd1..3cc0161b5 100644
--- a/pkg/state/addr_set.go
+++ b/pkg/state/addr_set.go
@@ -1,10 +1,6 @@
package state
import (
- __generics_imported0 "reflect"
-)
-
-import (
"bytes"
"fmt"
)
@@ -236,7 +232,7 @@ func (s *addrSet) UpperBoundGap(max uintptr) addrGapIterator {
// segment can be merged with adjacent segments, Add will do so. If the new
// segment would overlap an existing segment, Add returns false. If Add
// succeeds, all existing iterators are invalidated.
-func (s *addrSet) Add(r addrRange, val __generics_imported0.Value) bool {
+func (s *addrSet) Add(r addrRange, val *objectEncodeState) bool {
if r.Length() <= 0 {
panic(fmt.Sprintf("invalid segment range %v", r))
}
@@ -255,7 +251,7 @@ func (s *addrSet) Add(r addrRange, val __generics_imported0.Value) bool {
// If it would overlap an existing segment, AddWithoutMerging does nothing and
// returns false. If AddWithoutMerging succeeds, all existing iterators are
// invalidated.
-func (s *addrSet) AddWithoutMerging(r addrRange, val __generics_imported0.Value) bool {
+func (s *addrSet) AddWithoutMerging(r addrRange, val *objectEncodeState) bool {
if r.Length() <= 0 {
panic(fmt.Sprintf("invalid segment range %v", r))
}
@@ -282,7 +278,7 @@ func (s *addrSet) AddWithoutMerging(r addrRange, val __generics_imported0.Value)
// Merge, but may be more efficient. Note that there is no unchecked variant of
// Insert since Insert must retrieve and inspect gap's predecessor and
// successor segments regardless.
-func (s *addrSet) Insert(gap addrGapIterator, r addrRange, val __generics_imported0.Value) addrIterator {
+func (s *addrSet) Insert(gap addrGapIterator, r addrRange, val *objectEncodeState) addrIterator {
if r.Length() <= 0 {
panic(fmt.Sprintf("invalid segment range %v", r))
}
@@ -333,7 +329,7 @@ func (s *addrSet) Insert(gap addrGapIterator, r addrRange, val __generics_import
//
// If the gap cannot accommodate the segment, or if r is invalid,
// InsertWithoutMerging panics.
-func (s *addrSet) InsertWithoutMerging(gap addrGapIterator, r addrRange, val __generics_imported0.Value) addrIterator {
+func (s *addrSet) InsertWithoutMerging(gap addrGapIterator, r addrRange, val *objectEncodeState) addrIterator {
if r.Length() <= 0 {
panic(fmt.Sprintf("invalid segment range %v", r))
}
@@ -348,7 +344,7 @@ func (s *addrSet) InsertWithoutMerging(gap addrGapIterator, r addrRange, val __g
// (including gap, but not including the returned iterator) are invalidated.
//
// Preconditions: r.Start >= gap.Start(); r.End <= gap.End().
-func (s *addrSet) InsertWithoutMergingUnchecked(gap addrGapIterator, r addrRange, val __generics_imported0.Value) addrIterator {
+func (s *addrSet) InsertWithoutMergingUnchecked(gap addrGapIterator, r addrRange, val *objectEncodeState) addrIterator {
gap = gap.node.rebalanceBeforeInsert(gap)
splitMaxGap := addrtrackGaps != 0 && (gap.node.nrSegments == 0 || gap.Range().Length() == gap.node.maxGap.Get())
copy(gap.node.keys[gap.index+1:], gap.node.keys[gap.index:gap.node.nrSegments])
@@ -621,7 +617,7 @@ type addrnode struct {
// Nodes store keys and values in separate arrays to maximize locality in
// the common case (scanning keys for lookup).
keys [addrmaxDegree - 1]addrRange
- values [addrmaxDegree - 1]__generics_imported0.Value
+ values [addrmaxDegree - 1]*objectEncodeState
children [addrmaxDegree]*addrnode
}
@@ -1175,20 +1171,20 @@ func (seg addrIterator) SetEnd(end uintptr) {
}
// Value returns a copy of the iterated segment's value.
-func (seg addrIterator) Value() __generics_imported0.Value {
+func (seg addrIterator) Value() *objectEncodeState {
return seg.node.values[seg.index]
}
// ValuePtr returns a pointer to the iterated segment's value. The pointer is
// invalidated if the iterator is invalidated. This operation does not
// invalidate any iterators.
-func (seg addrIterator) ValuePtr() *__generics_imported0.Value {
+func (seg addrIterator) ValuePtr() **objectEncodeState {
return &seg.node.values[seg.index]
}
// SetValue mutates the iterated segment's value. This operation does not
// invalidate any iterators.
-func (seg addrIterator) SetValue(val __generics_imported0.Value) {
+func (seg addrIterator) SetValue(val *objectEncodeState) {
seg.node.values[seg.index] = val
}
@@ -1492,7 +1488,7 @@ func addrsegmentAfterPosition(n *addrnode, i int) addrIterator {
return addrIterator{n, i}
}
-func addrzeroValueSlice(slice []__generics_imported0.Value) {
+func addrzeroValueSlice(slice []*objectEncodeState) {
for i := range slice {
addrSetFunctions{}.ClearValue(&slice[i])
@@ -1555,7 +1551,7 @@ func (n *addrnode) writeDebugString(buf *bytes.Buffer, prefix string) {
type addrSegmentDataSlices struct {
Start []uintptr
End []uintptr
- Values []__generics_imported0.Value
+ Values []*objectEncodeState
}
// ExportSortedSlice returns a copy of all segments in the given set, in ascending
@@ -1599,7 +1595,7 @@ func (s *addrSet) ImportSortedSlices(sds *addrSegmentDataSlices) error {
//
// This should be used only for testing, and has been added to this package for
// templating convenience.
-func (s *addrSet) segmentTestCheck(expectedSegments int, segFunc func(int, addrRange, __generics_imported0.Value) error) error {
+func (s *addrSet) segmentTestCheck(expectedSegments int, segFunc func(int, addrRange, *objectEncodeState) error) error {
havePrev := false
prev := uintptr(0)
nrSegments := 0