ASTBinaryFormat class
Constants describing the ApolloVM binary AST container format.
A binary AST file — .avma, for Apollo Virtual Machine
Archive — stores an already-parsed ASTRoot so that a code unit can be
loaded without running a parser. The layout is:
offset size field
0 4 magic \0AVM
4 2 formatVersion uint16 BE — the container revision that wrote this file
6 2 minReaderVersion uint16 BE — oldest reader that can decode it correctly
8 4 flags uint32 BE — see [ASTBinaryFlags]
12 4 sectionsSize uint32 BE — byte length of the section stream
16 .. sections repeated: leb128 id, leb128 size, size bytes
T+0 4 crc32 uint32 BE — over bytes [0, T)
T+4 2 signatureLength uint16 BE — 0 when unsigned
T+6 .. signature signatureLength bytes
.. 4 trailerMagic AVM\0
where T = headerSize + sectionsSize. The total file length is always
headerSize + sectionsSize + minTrailerSize + signatureLength, which lets a
reader detect truncation and trailing garbage structurally, before doing any
integrity arithmetic.
Every fixed-width field is big-endian. Sections are length-prefixed, so a reader skips any section id it does not recognize — that is what lets a file written by a newer ApolloVM keep loading in an older one.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
constantTimeEquals(
List< int> a, List<int> b) → bool -
Compares
aandbwithout an early exit on the first differing byte. -
isASTBinary(
Uint8List bytes) → bool -
Whether
bytesbegins with the binary AST magic.
Constants
- fileExtension → const String
- The conventional file extension, without a leading dot.
- headerSize → const int
- Size of the fixed header, in bytes.
-
magic
→ const List<
int> -
File magic:
\0AVM. The leading NUL marks the file as binary so no tool mistakes it for text, in the spirit of WebAssembly's\0asm. - maxSectionsSize → const int
-
The largest section stream this format can address (
sectionsSizeis a uint32). - maxSignatureLength → const int
-
The largest signature this format can hold (
signatureLengthis a uint16). - minSupportedVersion → const int
- The oldest container revision this build can still read.
- minTrailerSize → const int
- Size of the trailer excluding the signature: crc32 + signatureLength + trailerMagic.
-
trailerMagic
→ const List<
int> -
Trailer magic:
AVM\0(the magic reversed). - version → const int
- The container revision this build writes, and the newest it fully understands.