OLD | NEW |
1 This file describes the binary format of Dart Kernel. | 1 This file describes the binary format of Dart Kernel. |
2 | 2 |
3 Notation | 3 Notation |
4 -------- | 4 -------- |
5 Bitmasks are described with the syntax: | 5 Bitmasks are described with the syntax: |
6 ```scala | 6 ```scala |
7 Byte flags (flag1, flag2, ..., flagN) | 7 Byte flags (flag1, flag2, ..., flagN) |
8 ``` | 8 ``` |
9 where 'flag<N>' is the N-th least significant bit, | 9 where 'flag<N>' is the N-th least significant bit, |
10 (so flag1 is the least significant bit). | 10 (so flag1 is the least significant bit). |
(...skipping 22 matching lines...) Expand all Loading... |
33 Byte byte2(xxxxxxxx); // least signficant byte | 33 Byte byte2(xxxxxxxx); // least signficant byte |
34 } | 34 } |
35 | 35 |
36 type UInt30 extends UInt { | 36 type UInt30 extends UInt { |
37 Byte byte1(11xxxxxx); // most significant byte, discard the two high bits. | 37 Byte byte1(11xxxxxx); // most significant byte, discard the two high bits. |
38 Byte byte2(xxxxxxxx); | 38 Byte byte2(xxxxxxxx); |
39 Byte byte3(xxxxxxxx); | 39 Byte byte3(xxxxxxxx); |
40 Byte byte4(xxxxxxxx); // least significant byte | 40 Byte byte4(xxxxxxxx); // least significant byte |
41 } | 41 } |
42 | 42 |
43 type MagicWord = big endian 32-bit unsigned integer | 43 type UInt32 = big endian 32-bit unsigned integer |
44 | 44 |
45 type List<T> { | 45 type List<T> { |
46 UInt length; | 46 UInt length; |
47 T[length] items; | 47 T[length] items; |
48 } | 48 } |
49 | 49 |
50 // Untagged pairs. | 50 // Untagged pairs. |
51 type Pair<T0, T1> { | 51 type Pair<T0, T1> { |
52 T0 first; | 52 T0 first; |
53 T1 second; | 53 T1 second; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 type CanonicalNameReference { | 108 type CanonicalNameReference { |
109 UInt biasedIndex; // 0 if null, otherwise N+1 where N is index of parent | 109 UInt biasedIndex; // 0 if null, otherwise N+1 where N is index of parent |
110 } | 110 } |
111 | 111 |
112 type CanonicalName { | 112 type CanonicalName { |
113 CanonicalNameReference parent; | 113 CanonicalNameReference parent; |
114 StringReference name; | 114 StringReference name; |
115 } | 115 } |
116 | 116 |
117 type ProgramFile { | 117 type ProgramFile { |
118 MagicWord magic = 0x90ABCDEF; | 118 UInt32 magic = 0x90ABCDEF; |
119 StringTable strings; | 119 StringTable strings; |
120 UriSource sourceMap; | 120 UriSource sourceMap; |
121 List<CanonicalName> canonicalNames; | 121 List<CanonicalName> canonicalNames; |
122 List<Library> libraries; | 122 List<Library> libraries; |
123 ProcedureReference mainMethod; | 123 ProcedureReference mainMethod; |
| 124 ProgramIndex programIndex; |
| 125 } |
| 126 |
| 127 // Program index with all fixed-size-32-bit integers. |
| 128 // This gives "semi-random-access" to certain parts of the binary. |
| 129 // By reading the last 4 bytes one knows the number of libaries, |
| 130 // which allows to skip to any other field in this program index, |
| 131 // which again allows to skip to what it points to. |
| 132 type ProgramIndex { |
| 133 UInt32 binaryOffsetForSourceTable; |
| 134 UInt32 binaryOffsetForCanonicalNames; |
| 135 UInt32 mainMethodReference; // This is a ProcedureReference with a fixed-size
integer. |
| 136 UInt32[libraryCount] libraryOffsets; |
| 137 UInt32 libraryCount; |
124 } | 138 } |
125 | 139 |
126 type LibraryReference { | 140 type LibraryReference { |
127 // Must be populated by a library (possibly later in the file). | 141 // Must be populated by a library (possibly later in the file). |
128 CanonicalNameReference canonicalName; | 142 CanonicalNameReference canonicalName; |
129 } | 143 } |
130 | 144 |
131 type ClassReference { | 145 type ClassReference { |
132 // Must be populated by a class (possibly later in the file). | 146 // Must be populated by a class (possibly later in the file). |
133 CanonicalNameReference canonicalName; | 147 CanonicalNameReference canonicalName; |
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
999 Option<DartType> bound; | 1013 Option<DartType> bound; |
1000 } | 1014 } |
1001 | 1015 |
1002 type TypeParameter { | 1016 type TypeParameter { |
1003 // Note: there is no tag on TypeParameter | 1017 // Note: there is no tag on TypeParameter |
1004 StringReference name; // Cosmetic, may be empty, not unique. | 1018 StringReference name; // Cosmetic, may be empty, not unique. |
1005 DartType bound; // 'dynamic' if no explicit bound was given. | 1019 DartType bound; // 'dynamic' if no explicit bound was given. |
1006 } | 1020 } |
1007 | 1021 |
1008 ``` | 1022 ``` |
OLD | NEW |