Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(641)

Side by Side Diff: pkg/kernel/binary.md

Issue 2539063002: Update kernel/binary.md. (Closed)
Patch Set: Fix typo in comment. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 24 matching lines...) Expand all
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 MagicWord = big endian 32-bit unsigned integer
44 44
45 type String {
46 UInt num_bytes;
47 Byte[num_bytes] utf8_bytes;
48 }
49
50 type StringTable {
51 UInt num_strings;
52 String[num_strings] strings;
53 }
54
55 type StringReference {
56 UInt index; // Index into the StringTable.
57 }
58
59 type LineStarts {
60 UInt lineCount;
61 // Delta encoded, e.g. 0, 10, 15, 7, 10 means 0, 10, 25, 32, 42.
62 UInt[lineCount] lineStarts;
63 }
64
65 type UriLineStarts {
66 StringTable uris;
67 LineStarts[uris.num_strings] lineStarts;
68 }
69
70 type UriReference {
71 UInt index; // Index into the URIs StringTable.
72 }
73
74 type FileOffset {
75 // Saved as number+1 to accommodate literal "-1".
76 UInt fileOffset;
77 }
78
79 type List<T> { 45 type List<T> {
80 UInt length; 46 UInt length;
81 T[length] items; 47 T[length] items;
82 } 48 }
83 49
50 type String {
51 List<Byte> utf8Bytes;
52 }
53
54 type StringTable {
55 List<String> strings;
56 }
57
58 type StringReference {
59 UInt index; // Index into the StringTable strings.
60 }
61
62 type LineStarts {
63 // Line starts are delta-encoded (they are encoded as line lengths). The list
64 // [0, 10, 25, 32, 42] is encoded as [0, 10, 15, 7, 10].
65 List<Uint> lineStarts;
66 }
67
68 type UriLineStarts {
69 List<String> uris;
70 LineStarts[uris.length] lineStarts;
71 }
72
73 type UriReference {
74 UInt index; // Index into the UriLineStarts uris.
75 }
76
77 type FileOffset {
78 // Encoded as offset + 1 to accommodate -1 indicating no offset.
79 UInt fileOffset;
80 }
81
84 type Option<T> { 82 type Option<T> {
85 Byte tag; 83 Byte tag;
86 } 84 }
87 type Nothing extends Option<T> { 85 type Nothing extends Option<T> {
88 Byte tag = 0; 86 Byte tag = 0;
89 } 87 }
90 type Something<T> extends Option<T> { 88 type Something<T> extends Option<T> {
91 Byte tag = 1; 89 Byte tag = 1;
92 T value; 90 T value;
93 } 91 }
94 92
95 type ProgramFile { 93 type ProgramFile {
96 MagicWord magic = 0x90ABCDEF; 94 MagicWord magic = 0x90ABCDEF;
97 StringTable strings; 95 StringTable strings;
98 UriLineStarts lineStartsMap; 96 UriLineStarts lineStartsMap;
99 List<Library> library; 97 List<Library> libraries;
100 LibraryProcedureReference mainMethod; 98 LibraryProcedureReference mainMethod;
101 } 99 }
102 100
103 type LibraryReference { 101 type LibraryReference {
104 // For library files, this is an index into the import table. 102 // Index into the ProgramFile libraries.
105 // For program files, this is an index into the list of libaries.
106 UInt index; 103 UInt index;
107 } 104 }
108 105
109 abstract type ClassReference {} 106 abstract type ClassReference {}
110 107
111 type NormalClassReference extends ClassReference { 108 type NormalClassReference extends ClassReference {
112 Byte tag = 100; 109 Byte tag = 100;
113 LibraryReference library; 110 LibraryReference library;
114 UInt classIndex; 111 UInt classIndex;
115 } 112 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 type Name { 159 type Name {
163 StringReference name; 160 StringReference name;
164 if name begins with '_' { 161 if name begins with '_' {
165 LibraryReference library; 162 LibraryReference library;
166 } 163 }
167 } 164 }
168 165
169 type Library { 166 type Library {
170 Byte flags (isExternal); 167 Byte flags (isExternal);
171 StringReference name; 168 StringReference name;
172 // A URI with the dart, package, or file scheme. For file URIs, the path 169 // A URI from which the library was created. The URI has the dart, package,
173 // is an absolute path to the .dart file from which the library was created. 170 // file, or app scheme. For file URIs, the path is an absolute path to the
171 // .dart file from which the library was created. For app URIs, the path is
172 // relative to an application root that was specified when the binary was
173 // generated.
174 StringReference importUri; 174 StringReference importUri;
175 // An absolute path URI to the .dart file from which the library was created. 175 // An absolute path URI to the .dart file from which the library was created.
176 UriReference fileUri; 176 UriReference fileUri;
177 List<Class> classes; 177 List<Class> classes;
178 List<Field> fields; 178 List<Field> fields;
179 List<Procedure> procedures; 179 List<Procedure> procedures;
180 } 180 }
181 181
182 abstract type Node { 182 abstract type Node {
183 Byte tag; 183 Byte tag;
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 895
896 /* enum BaseClassKind { None, Exact, Subclass, Subtype, } */ 896 /* enum BaseClassKind { None, Exact, Subclass, Subtype, } */
897 897
898 type InferredValue { 898 type InferredValue {
899 ClassReference baseClass; // May be NullReference if kind = None. 899 ClassReference baseClass; // May be NullReference if kind = None.
900 Byte kind; // Index into BaseClassKind. 900 Byte kind; // Index into BaseClassKind.
901 Byte valueBits; // See lib/type_propagation/type_propagation.dart 901 Byte valueBits; // See lib/type_propagation/type_propagation.dart
902 } 902 }
903 903
904 ``` 904 ```
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698