const progMaxLiteral … type Writer … // Init initializes w to write a new GC program // by calling writeByte for each byte in the program. func (w *Writer) Init(writeByte func(byte)) { … } // Debug causes the writer to print a debugging trace to out // during future calls to methods like Ptr, Advance, and End. // It also enables debugging checks during the encoding. func (w *Writer) Debug(out io.Writer) { … } // BitIndex returns the number of bits written to the bit stream so far. func (w *Writer) BitIndex() int64 { … } // byte writes the byte x to the output. func (w *Writer) byte(x byte) { … } // End marks the end of the program, writing any remaining bytes. func (w *Writer) End() { … } // Ptr emits a 1 into the bit stream at the given bit index. // that is, it records that the index'th word in the object memory is a pointer. // Any bits between the current index and the new index // are set to zero, meaning the corresponding words are scalars. func (w *Writer) Ptr(index int64) { … } // ShouldRepeat reports whether it would be worthwhile to // use a Repeat to describe c elements of n bits each, // compared to just emitting c copies of the n-bit description. func (w *Writer) ShouldRepeat(n, c int64) bool { … } // Repeat emits an instruction to repeat the description // of the last n words c times (including the initial description, c+1 times in total). func (w *Writer) Repeat(n, c int64) { … } // ZeroUntil adds zeros to the bit stream until reaching the given index; // that is, it records that the words from the most recent pointer until // the index'th word are scalars. // ZeroUntil is usually called in preparation for a call to Repeat, Append, or End. func (w *Writer) ZeroUntil(index int64) { … } // Append emits the given GC program into the current output. // The caller asserts that the program emits n bits (describes n words), // and Append panics if that is not true. func (w *Writer) Append(prog []byte, n int64) { … } // progbits returns the length of the bit stream encoded by the program p. func progbits(p []byte) int64 { … } // readvarint reads a varint from p, returning the value and the remainder of p. func readvarint(p []byte) (int64, []byte) { … } // lit adds a single literal bit to w. func (w *Writer) lit(x byte) { … } // varint emits the varint encoding of x. func (w *Writer) varint(x int64) { … } // flushlit flushes any pending literal bits. func (w *Writer) flushlit() { … }