-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbytecode.go
More file actions
41 lines (26 loc) · 950 Bytes
/
bytecode.go
File metadata and controls
41 lines (26 loc) · 950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
Package pbf implements Protocol Buffers Filter.
Bytecode
Bytecode contains a 4-byte header and two sections:
- Fields
- Instructions and constants
Field section:
- Field count (1 byte)
- Sequence of variable-length field specifications
Field specification formats (NUM is protobuf field number or sequence index as
fixed-width 32-bit integer, and SUBTYPE is protobuf field wire type):
- NUM 0
- NUM ModZigZag
- NUM ModFloat
- NUM ModPacked SUBTYPE ...
- NUM ModMessage ...
- NUM ModRepeated ...
Instruction-and-constant section:
- Sequence of variable-length instructions (opcodes followed by arguments)
- Constant byte sequences are interleaved with the instructions
The boundary between the sections is determined by the field count.
The Skip instruction can be used to skip over constants, or the constants may
simply reside beyond the last Return instruction.
All integers use little-endian encoding.
*/
package pbf