• Home
  • Raw
  • Download

Lines Matching full:pointer

46 // A field identifies a field in a struct, accessible from a pointer.
58 // zeroField is a noop when calling pointer.offset.
66 // The pointer type below is for the new table-driven encoder/decoder.
67 // The implementation here uses unsafe.Pointer to create a generic pointer.
70 type pointer struct { struct
71 p unsafe.Pointer
74 // size of pointer
77 // toPointer converts an interface of pointer type to a pointer
79 func toPointer(i *Message) pointer {
80 // Super-tricky - read pointer out of data word of interface value.
83 return pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]}
86 // toAddrPointer converts an interface to a pointer that points to
88 func toAddrPointer(i *interface{}, isptr, deref bool) (p pointer) {
91 // The interface is of pointer type, thus it is a direct interface.
92 // The data word is the pointer data itself. We take its address.
93 p = pointer{p: unsafe.Pointer(uintptr(unsafe.Pointer(i)) + ptrSize)}
95 // The interface is not of pointer type. The data word is the pointer
97 p = pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]}
100 p.p = *(*unsafe.Pointer)(p.p)
105 // valToPointer converts v to a pointer. v must be of pointer type.
106 func valToPointer(v reflect.Value) pointer {
107 return pointer{p: unsafe.Pointer(v.Pointer())}
110 // offset converts from a pointer to a structure to a pointer to
112 func (p pointer) offset(f field) pointer { argument
120 return pointer{p: unsafe.Pointer(uintptr(p.p) + uintptr(f))}
123 func (p pointer) isNil() bool { argument
127 func (p pointer) toInt64() *int64 { argument
130 func (p pointer) toInt64Ptr() **int64 { argument
133 func (p pointer) toInt64Slice() *[]int64 { argument
136 func (p pointer) toInt32() *int32 { argument
142 func (p pointer) toInt32Ptr() **int32 {
145 func (p pointer) toInt32Slice() *[]int32 {
149 func (p pointer) getInt32Ptr() *int32 { argument
152 func (p pointer) setInt32Ptr(v int32) { argument
159 func (p pointer) getInt32Slice() []int32 { argument
166 func (p pointer) setInt32Slice(v []int32) { argument
171 func (p pointer) appendInt32Slice(v int32) { argument
176 func (p pointer) toUint64() *uint64 { argument
179 func (p pointer) toUint64Ptr() **uint64 { argument
182 func (p pointer) toUint64Slice() *[]uint64 { argument
185 func (p pointer) toUint32() *uint32 { argument
188 func (p pointer) toUint32Ptr() **uint32 { argument
191 func (p pointer) toUint32Slice() *[]uint32 { argument
194 func (p pointer) toBool() *bool { argument
197 func (p pointer) toBoolPtr() **bool { argument
200 func (p pointer) toBoolSlice() *[]bool { argument
203 func (p pointer) toFloat64() *float64 { argument
206 func (p pointer) toFloat64Ptr() **float64 { argument
209 func (p pointer) toFloat64Slice() *[]float64 { argument
212 func (p pointer) toFloat32() *float32 { argument
215 func (p pointer) toFloat32Ptr() **float32 { argument
218 func (p pointer) toFloat32Slice() *[]float32 { argument
221 func (p pointer) toString() *string { argument
224 func (p pointer) toStringPtr() **string { argument
227 func (p pointer) toStringSlice() *[]string { argument
230 func (p pointer) toBytes() *[]byte { argument
233 func (p pointer) toBytesSlice() *[][]byte { argument
236 func (p pointer) toExtensions() *XXX_InternalExtensions { argument
239 func (p pointer) toOldExtensions() *map[int32]Extension { argument
243 // getPointerSlice loads []*T from p as a []pointer.
246 func (p pointer) getPointerSlice() []pointer { argument
248 // message type. We load it as []pointer.
249 return *(*[]pointer)(p.p)
252 // setPointerSlice stores []pointer into p as a []*T.
255 func (p pointer) setPointerSlice(v []pointer) { argument
257 // message type. We store it as []pointer.
258 *(*[]pointer)(p.p) = v
261 // getPointer loads the pointer at p and returns it.
262 func (p pointer) getPointer() pointer { argument
263 return pointer{p: *(*unsafe.Pointer)(p.p)}
266 // setPointer stores the pointer q at p.
267 func (p pointer) setPointer(q pointer) { argument
268 *(*unsafe.Pointer)(p.p) = q.p
272 func (p pointer) appendPointer(q pointer) { argument
273 s := (*[]unsafe.Pointer)(p.p)
277 // getInterfacePointer returns a pointer that points to the
279 func (p pointer) getInterfacePointer() pointer { argument
280 // Super-tricky - read pointer out of data word of interface value.
281 return pointer{p: (*(*[2]unsafe.Pointer)(p.p))[1]}
284 // asPointerTo returns a reflect.Value that is a pointer to an
286 func (p pointer) asPointerTo(t reflect.Type) reflect.Value { argument
291 return (*unmarshalInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p))))
294 atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v))
297 return (*marshalInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p))))
300 atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v))
303 return (*mergeInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p))))
306 atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v))
309 return (*discardInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p))))
312 atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v))