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

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

Issue 2626613002: More offsets in kernel (Closed)
Patch Set: Fixed FileOffset storage for classes in binary.md Created 3 years, 11 months 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 | pkg/kernel/lib/binary/ast_from_binary.dart » ('j') | 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 // If the enclosing library is external, a class is either at type or 189 // If the enclosing library is external, a class is either at type or
190 // hierarchy level, depending on its isTypeLevel flag. 190 // hierarchy level, depending on its isTypeLevel flag.
191 // If the enclosing library is not external, a class is always at body level. 191 // If the enclosing library is not external, a class is always at body level.
192 // 192 //
193 // See ClassLevel in ast.dart for the details of each loading level. 193 // See ClassLevel in ast.dart for the details of each loading level.
194 194
195 abstract type Class extends Node {} 195 abstract type Class extends Node {}
196 196
197 type NormalClass extends Class { 197 type NormalClass extends Class {
198 Byte tag = 2; 198 Byte tag = 2;
199 FileOffset fileOffset;
199 Byte flags (isAbstract, isTypeLevel); 200 Byte flags (isAbstract, isTypeLevel);
200 StringReference name; 201 StringReference name;
201 // An absolute path URI to the .dart file from which the class was created. 202 // An absolute path URI to the .dart file from which the class was created.
202 UriReference fileUri; 203 UriReference fileUri;
203 List<Expression> annotations; 204 List<Expression> annotations;
204 List<TypeParameter> typeParameters; 205 List<TypeParameter> typeParameters;
205 Option<InterfaceType> superClass; 206 Option<InterfaceType> superClass;
206 List<InterfaceType> implementedClasses; 207 List<InterfaceType> implementedClasses;
207 List<Field> fields; 208 List<Field> fields;
208 List<Constructor> constructors; 209 List<Constructor> constructors;
209 List<Procedure> procedures; 210 List<Procedure> procedures;
210 } 211 }
211 212
212 type MixinClass extends Class { 213 type MixinClass extends Class {
213 Byte tag = 3; 214 Byte tag = 3;
215 FileOffset fileOffset;
214 Byte flags (isAbstract, isTypeLevel); 216 Byte flags (isAbstract, isTypeLevel);
215 StringReference name; 217 StringReference name;
216 // An absolute path URI to the .dart file from which the class was created. 218 // An absolute path URI to the .dart file from which the class was created.
217 UriReference fileUri; 219 UriReference fileUri;
218 List<Expression> annotations; 220 List<Expression> annotations;
219 List<TypeParameter> typeParameters; 221 List<TypeParameter> typeParameters;
220 InterfaceType firstSuperClass; 222 InterfaceType firstSuperClass;
221 InterfaceType secondSuperClass; 223 InterfaceType secondSuperClass;
222 List<InterfaceType> implementedClasses; 224 List<InterfaceType> implementedClasses;
223 List<Constructor> constructors; 225 List<Constructor> constructors;
224 } 226 }
225 227
226 abstract type Member extends Node {} 228 abstract type Member extends Node {}
227 229
228 type Field extends Member { 230 type Field extends Member {
229 Byte tag = 4; 231 Byte tag = 4;
230 FileOffset fileOffset; 232 FileOffset fileOffset;
233 FileOffset fileEndOffset;
231 Byte flags (isFinal, isConst, isStatic); 234 Byte flags (isFinal, isConst, isStatic);
232 Name name; 235 Name name;
233 // An absolute path URI to the .dart file from which the field was created. 236 // An absolute path URI to the .dart file from which the field was created.
234 UriReference fileUri; 237 UriReference fileUri;
235 List<Expression> annotations; 238 List<Expression> annotations;
236 DartType type; 239 DartType type;
237 Option<InferredValue> inferredValue; 240 Option<InferredValue> inferredValue;
238 Option<Expression> initializer; 241 Option<Expression> initializer;
239 } 242 }
240 243
241 type Constructor extends Member { 244 type Constructor extends Member {
242 Byte tag = 5; 245 Byte tag = 5;
246 FileOffset fileOffset;
247 FileOffset fileEndOffset;
243 Byte flags (isConst, isExternal); 248 Byte flags (isConst, isExternal);
244 Name name; 249 Name name;
245 List<Expression> annotations; 250 List<Expression> annotations;
246 FunctionNode function; 251 FunctionNode function;
247 List<Initializer> initializers; 252 List<Initializer> initializers;
248 } 253 }
249 254
250 /* 255 /*
251 enum ProcedureKind { 256 enum ProcedureKind {
252 Method, 257 Method,
253 Getter, 258 Getter,
254 Setter, 259 Setter,
255 Operator, 260 Operator,
256 Factory, 261 Factory,
257 } 262 }
258 */ 263 */
259 264
260 type Procedure extends Member { 265 type Procedure extends Member {
261 Byte tag = 6; 266 Byte tag = 6;
267 FileOffset fileOffset;
268 FileOffset fileEndOffset;
262 Byte kind; // Index into the ProcedureKind enum above. 269 Byte kind; // Index into the ProcedureKind enum above.
263 Byte flags (isStatic, isAbstract, isExternal, isConst); 270 Byte flags (isStatic, isAbstract, isExternal, isConst);
264 Name name; 271 Name name;
265 // An absolute path URI to the .dart file from which the class was created. 272 // An absolute path URI to the .dart file from which the class was created.
266 UriReference fileUri; 273 UriReference fileUri;
267 List<Expression> annotations; 274 List<Expression> annotations;
268 // Can only be absent if abstract, but tag is there anyway. 275 // Can only be absent if abstract, but tag is there anyway.
269 Option<FunctionNode> function; 276 Option<FunctionNode> function;
270 } 277 }
271 278
(...skipping 30 matching lines...) Expand all
302 enum AsyncMarker { 309 enum AsyncMarker {
303 Sync, 310 Sync,
304 SyncStar, 311 SyncStar,
305 Async, 312 Async,
306 AsyncStar 313 AsyncStar
307 } 314 }
308 */ 315 */
309 316
310 type FunctionNode { 317 type FunctionNode {
311 // Note: there is no tag on FunctionNode. 318 // Note: there is no tag on FunctionNode.
319 FileOffset fileOffset;
320 FileOffset fileEndOffset;
312 Byte asyncMarker; // Index into AsyncMarker above. 321 Byte asyncMarker; // Index into AsyncMarker above.
322 Byte debuggable; // 1 for yes, 0 for no
313 List<TypeParameter> typeParameters; 323 List<TypeParameter> typeParameters;
314 UInt requiredParameterCount; 324 UInt requiredParameterCount;
315 List<VariableDeclaration> positionalParameters; 325 List<VariableDeclaration> positionalParameters;
316 List<VariableDeclaration> namedParameters; 326 List<VariableDeclaration> namedParameters;
317 DartType returnType; 327 DartType returnType;
318 Option<InferredValue> inferredReturnValue; 328 Option<InferredValue> inferredReturnValue;
319 Option<Statement> body; 329 Option<Statement> body;
320 } 330 }
321 331
322 type VariableReference { 332 type VariableReference {
(...skipping 20 matching lines...) Expand all
343 } 353 }
344 354
345 abstract type Expression extends Node {} 355 abstract type Expression extends Node {}
346 356
347 type InvalidExpression extends Expression { 357 type InvalidExpression extends Expression {
348 Byte tag = 19; 358 Byte tag = 19;
349 } 359 }
350 360
351 type VariableGet extends Expression { 361 type VariableGet extends Expression {
352 Byte tag = 20; 362 Byte tag = 20;
363 FileOffset fileOffset;
353 VariableReference variable; 364 VariableReference variable;
354 } 365 }
355 366
356 type SpecializedVariableGet extends Expression { 367 type SpecializedVariableGet extends Expression {
357 Byte tag = 128 + N; // Where 0 <= N < 8. 368 Byte tag = 128 + N; // Where 0 <= N < 8.
358 // Equivalent to a VariableGet with index N. 369 // Equivalent to a VariableGet with index N.
370 FileOffset fileOffset;
359 } 371 }
360 372
361 type VariableSet extends Expression { 373 type VariableSet extends Expression {
362 Byte tag = 21; 374 Byte tag = 21;
375 FileOffset fileOffset;
363 VariableReference variable; 376 VariableReference variable;
364 Expression value; 377 Expression value;
365 } 378 }
366 379
367 type SpecializedVariableSet extends Expression { 380 type SpecializedVariableSet extends Expression {
368 Byte tag = 136 + N; // Where 0 <= N < 8. 381 Byte tag = 136 + N; // Where 0 <= N < 8.
382 FileOffset fileOffset;
369 Expression value; 383 Expression value;
370 // Equivalent to VariableSet with index N. 384 // Equivalent to VariableSet with index N.
371 } 385 }
372 386
373 type PropertyGet extends Expression { 387 type PropertyGet extends Expression {
374 Byte tag = 22; 388 Byte tag = 22;
375 FileOffset fileOffset; 389 FileOffset fileOffset;
376 Expression receiver; 390 Expression receiver;
377 Name name; 391 Name name;
378 MemberReference interfaceTarget; // May be NullReference. 392 MemberReference interfaceTarget; // May be NullReference.
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 type ConditionalExpression extends Expression { 525 type ConditionalExpression extends Expression {
512 Byte tag = 35; 526 Byte tag = 35;
513 Expression condition; 527 Expression condition;
514 Expression then; 528 Expression then;
515 Expression otherwise; 529 Expression otherwise;
516 Option<DartType> staticType; 530 Option<DartType> staticType;
517 } 531 }
518 532
519 type StringConcatenation extends Expression { 533 type StringConcatenation extends Expression {
520 Byte tag = 36; 534 Byte tag = 36;
535 FileOffset fileOffset;
521 List<Expression> expressions; 536 List<Expression> expressions;
522 } 537 }
523 538
524 type IsExpression extends Expression { 539 type IsExpression extends Expression {
525 Byte tag = 37; 540 Byte tag = 37;
541 FileOffset fileOffset;
526 Expression operand; 542 Expression operand;
527 DartType type; 543 DartType type;
528 } 544 }
529 545
530 type AsExpression extends Expression { 546 type AsExpression extends Expression {
531 Byte tag = 38; 547 Byte tag = 38;
532 Expression operand; 548 Expression operand;
533 DartType type; 549 DartType type;
534 } 550 }
535 551
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 } 622 }
607 623
608 type ConstListLiteral extends Expression { 624 type ConstListLiteral extends Expression {
609 Byte tag = 58; // Note: tag is out of order. 625 Byte tag = 58; // Note: tag is out of order.
610 DartType typeArgument; 626 DartType typeArgument;
611 List<Expression> values; 627 List<Expression> values;
612 } 628 }
613 629
614 type MapLiteral extends Expression { 630 type MapLiteral extends Expression {
615 Byte tag = 50; 631 Byte tag = 50;
632 FileOffset fileOffset;
616 DartType keyType; 633 DartType keyType;
617 DartType valueType; 634 DartType valueType;
618 List<MapEntry> entries; 635 List<MapEntry> entries;
619 } 636 }
620 637
621 type ConstMapLiteral extends Expression { 638 type ConstMapLiteral extends Expression {
622 Byte tag = 59; // Note: tag is out of order. 639 Byte tag = 59; // Note: tag is out of order.
623 DartType keyType; 640 DartType keyType;
624 DartType valueType; 641 DartType valueType;
625 List<MapEntry> entries; 642 List<MapEntry> entries;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 769
753 type IfStatement extends Statement { 770 type IfStatement extends Statement {
754 Byte tag = 73; 771 Byte tag = 73;
755 Expression condition; 772 Expression condition;
756 Statement then; 773 Statement then;
757 Statement otherwise; // Empty statement if there was no else part. 774 Statement otherwise; // Empty statement if there was no else part.
758 } 775 }
759 776
760 type ReturnStatement extends Statement { 777 type ReturnStatement extends Statement {
761 Byte tag = 74; 778 Byte tag = 74;
779 FileOffset fileOffset;
762 Option<Expression> expression; 780 Option<Expression> expression;
763 } 781 }
764 782
765 type TryCatch extends Statement { 783 type TryCatch extends Statement {
766 Byte tag = 75; 784 Byte tag = 75;
767 Statement body; 785 Statement body;
768 List<Catch> catches; 786 List<Catch> catches;
769 } 787 }
770 788
771 type Catch { 789 type Catch {
772 DartType guard; 790 DartType guard;
773 Option<VariableDeclaration> exception; 791 Option<VariableDeclaration> exception;
774 Option<VariableDeclaration> stackTrace; 792 Option<VariableDeclaration> stackTrace;
775 Statement body; 793 Statement body;
776 } 794 }
777 795
778 type TryFinally extends Statement { 796 type TryFinally extends Statement {
779 Byte tag = 76; 797 Byte tag = 76;
780 Statement body; 798 Statement body;
781 Statement finalizer; 799 Statement finalizer;
782 } 800 }
783 801
784 type YieldStatement extends Statement { 802 type YieldStatement extends Statement {
785 Byte tag = 77; 803 Byte tag = 77;
804 FileOffset fileOffset;
786 Byte flags (isYieldStar); 805 Byte flags (isYieldStar);
787 Expression expression; 806 Expression expression;
788 } 807 }
789 808
790 type VariableDeclarationStatement extends Statement { 809 type VariableDeclarationStatement extends Statement {
791 Byte tag = 78; 810 Byte tag = 78;
792 VariableDeclaration variable; 811 VariableDeclaration variable;
793 } 812 }
794 813
795 type VariableDeclaration { 814 type VariableDeclaration {
815 FileOffset fileOffset;
796 Byte flags (isFinal, isConst); 816 Byte flags (isFinal, isConst);
797 // For named parameters, this is the parameter name. 817 // For named parameters, this is the parameter name.
798 // For other variables, the name is cosmetic, may be empty, 818 // For other variables, the name is cosmetic, may be empty,
799 // and is not necessarily unique. 819 // and is not necessarily unique.
800 StringReference name; 820 StringReference name;
801 DartType type; 821 DartType type;
802 Option<InferredValue> inferredValue; 822 Option<InferredValue> inferredValue;
803 823
804 // For statements and for-loops, this is the initial value. 824 // For statements and for-loops, this is the initial value.
805 // For optional parameters, this is the default value (if given). 825 // For optional parameters, this is the default value (if given).
806 // In all other contexts, it must be Nothing. 826 // In all other contexts, it must be Nothing.
807 Option<Expression> initializer; 827 Option<Expression> initializer;
808 } 828 }
809 829
810 type FunctionDeclaration extends Statement { 830 type FunctionDeclaration extends Statement {
811 Byte tag = 79; 831 Byte tag = 79;
832 FileOffset fileOffset;
812 // The variable binding the function. The variable is in scope 833 // The variable binding the function. The variable is in scope
813 // within the function for use as a self-reference. 834 // within the function for use as a self-reference.
814 // Some of the fields in the variable are redundant, but its presence here 835 // Some of the fields in the variable are redundant, but its presence here
815 // simplifies the rule for variable indexing. 836 // simplifies the rule for variable indexing.
816 VariableDeclaration variable; 837 VariableDeclaration variable;
817 FunctionNode function; 838 FunctionNode function;
818 } 839 }
819 840
820 abstract type DartType extends Node {} 841 abstract type DartType extends Node {}
821 842
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 917
897 /* enum BaseClassKind { None, Exact, Subclass, Subtype, } */ 918 /* enum BaseClassKind { None, Exact, Subclass, Subtype, } */
898 919
899 type InferredValue { 920 type InferredValue {
900 ClassReference baseClass; // May be NullReference if kind = None. 921 ClassReference baseClass; // May be NullReference if kind = None.
901 Byte kind; // Index into BaseClassKind. 922 Byte kind; // Index into BaseClassKind.
902 Byte valueBits; // See lib/type_propagation/type_propagation.dart 923 Byte valueBits; // See lib/type_propagation/type_propagation.dart
903 } 924 }
904 925
905 ``` 926 ```
OLDNEW
« no previous file with comments | « no previous file | pkg/kernel/lib/binary/ast_from_binary.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698