MCPcopy
hub / github.com/golang/tools / Sync

Method Sync

internal/pkgbits/encoder.go:229–252  ·  view source on GitHub ↗
(m SyncMarker)

Source from the content-addressed store, hash-verified

227}
228
229func (w *Encoder) Sync(m SyncMarker) {
230 if !w.p.SyncMarkers() {
231 return
232 }
233
234 // Writing out stack frame string references requires working
235 // relocations, but writing out the relocations themselves involves
236 // sync markers. To prevent infinite recursion, we simply trim the
237 // stack frame for sync markers within the relocation header.
238 var frames []string
239 if !w.encodingRelocHeader && w.p.syncFrames > 0 {
240 pcs := make([]uintptr, w.p.syncFrames)
241 n := runtime.Callers(2, pcs)
242 frames = fmtFrames(pcs[:n]...)
243 }
244
245 // TODO(mdempsky): Save space by writing out stack frames as a
246 // linked list so we can share common stack frames.
247 w.rawUvarint(uint64(m))
248 w.rawUvarint(uint64(len(frames)))
249 for _, frame := range frames {
250 w.rawUvarint(uint64(w.rawReloc(RelocString, w.p.StringIdx(frame))))
251 }
252}
253
254// Bool encodes and writes a bool value into the element bitstream,
255// and then returns the bool value.

Callers 9

FlushMethod · 0.95
BoolMethod · 0.95
Int64Method · 0.95
Uint64Method · 0.95
RelocMethod · 0.95
CodeMethod · 0.95
StringRefMethod · 0.95
ValueMethod · 0.95
NewEncoderMethod · 0.45

Calls 5

rawUvarintMethod · 0.95
rawRelocMethod · 0.95
fmtFramesFunction · 0.85
SyncMarkersMethod · 0.45
StringIdxMethod · 0.45

Tested by

no test coverage detected