61f0f5bc43
This change replaces kernel AST declarations of fields and functions with bytecode declarations. Size of dilp files is reduced by 11-12%. Startup latency: Time to the first full frame: 1.945s -> 1.687s FinalizeClass: 554ms -> 277ms FinishClassLoading: 296ms -> 156ms There are following regressions in bytecode mode, which will be fixed in future: * dart:mirrors are not supported yet (implementation of mirrors relies on reading kernel AST in certain cases). As the result, lib_2/mirrors/* tests fail. * native extensions are not supported yet (annotations on libraries and classes in AST are cleaned up as they could reference members which are now removed from AST). As the result, standalone_2/entrypoints_verification_test test fails. * language_2/spread_collections/const_error_test/* tests fail due to https://github.com/dart-lang/sdk/issues/36286. Change-Id: I5130f401fd7b84038b136136e7ccc1a6e51b6cea Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97561 Commit-Queue: Alexander Markov <alexmarkov@google.com> Reviewed-by: Ryan Macnak <rmacnak@google.com>
283 lines
6.8 KiB
Plaintext
283 lines
6.8 KiB
Plaintext
main = #lib::main;
|
|
[@vm.bytecode=
|
|
ComponentBytecodeMetadata {
|
|
|
|
Bytecode (version: stable)
|
|
Main library: #lib
|
|
|
|
}
|
|
] [@vm.bytecode=
|
|
MembersBytecodeMetadata {
|
|
|
|
Members {
|
|
|
|
Function 'main', static, reflectable, debuggable
|
|
parameters [] (required: 0)
|
|
return-type dynamic
|
|
|
|
|
|
Bytecode {
|
|
Entry 0
|
|
CheckStack 0
|
|
PushNull
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
]library #lib from "#lib" as #lib {
|
|
|
|
[@vm.bytecode=
|
|
MembersBytecodeMetadata {
|
|
|
|
Members {
|
|
Field 'foo1', type = dart:core::int, getter = 'get:foo1', setter = 'set:foo1', reflectable
|
|
value = null
|
|
|
|
Field 'foo2', type = dart:core::int, getter = 'get:foo2', setter = 'set:foo2', reflectable
|
|
value = null
|
|
|
|
Field 'foo3', type = dart:core::int, getter = 'get:foo3', setter = 'set:foo3', reflectable
|
|
value = const 42
|
|
|
|
Field 'foo4', type = dart:core::int, getter = 'get:foo4', setter = 'set:foo4', reflectable
|
|
value = null
|
|
|
|
Field 'foo5', type = dart:core::int, getter = 'get:foo5', setter = 'set:foo5', reflectable
|
|
value = const 43
|
|
|
|
Function '', constructor, reflectable, debuggable
|
|
parameters [dart:core::int 'foo4'] (required: 1)
|
|
return-type #lib::A
|
|
|
|
|
|
Bytecode {
|
|
Entry 0
|
|
CheckStack 0
|
|
Push FP[-6]
|
|
PushInt 42
|
|
StoreFieldTOS CP#0
|
|
Push FP[-6]
|
|
PushInt 43
|
|
StoreFieldTOS CP#2
|
|
Push FP[-6]
|
|
Push FP[-5]
|
|
StoreFieldTOS CP#4
|
|
Push FP[-6]
|
|
PushInt 44
|
|
StoreFieldTOS CP#2
|
|
Push FP[-6]
|
|
DirectCall 1, CP#6
|
|
Drop1
|
|
PushNull
|
|
ReturnTOS
|
|
}
|
|
Nullable fields: [#lib::A::foo1 (field), #lib::A::foo2 (field)]
|
|
ConstantPool {
|
|
[0] = InstanceField #lib::A::foo3 (field)
|
|
[1] = Reserved
|
|
[2] = InstanceField #lib::A::foo5 (field)
|
|
[3] = Reserved
|
|
[4] = InstanceField #lib::A::foo4 (field)
|
|
[5] = Reserved
|
|
[6] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
|
|
[7] = Reserved
|
|
}
|
|
|
|
|
|
Function 'constr2', constructor, reflectable, debuggable
|
|
parameters [dart:core::int 'x', dart:core::int 'y'] (required: 2)
|
|
return-type #lib::A
|
|
|
|
|
|
Bytecode {
|
|
Entry 0
|
|
CheckStack 0
|
|
Push FP[-7]
|
|
PushInt 42
|
|
StoreFieldTOS CP#0
|
|
Push FP[-7]
|
|
PushInt 43
|
|
StoreFieldTOS CP#2
|
|
Push FP[-7]
|
|
Push FP[-6]
|
|
StoreFieldTOS CP#4
|
|
Push FP[-7]
|
|
Push FP[-5]
|
|
PushInt 1
|
|
AddInt
|
|
StoreFieldTOS CP#2
|
|
Push FP[-7]
|
|
DirectCall 1, CP#6
|
|
Drop1
|
|
PushNull
|
|
ReturnTOS
|
|
}
|
|
Nullable fields: [#lib::A::foo2 (field), #lib::A::foo4 (field)]
|
|
ConstantPool {
|
|
[0] = InstanceField #lib::A::foo3 (field)
|
|
[1] = Reserved
|
|
[2] = InstanceField #lib::A::foo5 (field)
|
|
[3] = Reserved
|
|
[4] = InstanceField #lib::A::foo1 (field)
|
|
[5] = Reserved
|
|
[6] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
|
|
[7] = Reserved
|
|
}
|
|
|
|
|
|
Function 'redirecting1', constructor, reflectable, debuggable
|
|
parameters [] (required: 0)
|
|
return-type #lib::A
|
|
|
|
|
|
Bytecode {
|
|
Entry 0
|
|
CheckStack 0
|
|
Push FP[-5]
|
|
PushInt 45
|
|
DirectCall 2, CP#0
|
|
Drop1
|
|
PushNull
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
[0] = DirectCall '#lib::A:: (constructor)', ArgDesc num-args 2, num-type-args 0, names []
|
|
[1] = Reserved
|
|
}
|
|
|
|
|
|
Function 'redirecting2', constructor, reflectable, debuggable
|
|
parameters [dart:core::int 'a', dart:core::int 'b', dart:core::int 'c'] (required: 3)
|
|
return-type #lib::A
|
|
|
|
|
|
Bytecode {
|
|
Entry 0
|
|
CheckStack 0
|
|
Push FP[-8]
|
|
Push FP[-7]
|
|
Push FP[-6]
|
|
Push FP[-5]
|
|
MulInt
|
|
DirectCall 3, CP#0
|
|
Drop1
|
|
PushNull
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
[0] = DirectCall '#lib::A::constr2 (constructor)', ArgDesc num-args 3, num-type-args 0, names []
|
|
[1] = Reserved
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
] class A extends dart.core::Object {
|
|
field dart.core::int foo1;
|
|
field dart.core::int foo2 = null;
|
|
field dart.core::int foo3 = 42;
|
|
field dart.core::int foo4;
|
|
field dart.core::int foo5 = 43;
|
|
constructor •(dart.core::int foo4) → #lib::A
|
|
: #lib::A::foo1 = null, #lib::A::foo4 = foo4, #lib::A::foo5 = 44, super dart.core::Object::•()
|
|
;
|
|
constructor constr2(dart.core::int x, dart.core::int y) → #lib::A
|
|
: #lib::A::foo4 = null, #lib::A::foo1 = x, #lib::A::foo5 = y.{dart.core::num::+}(1), super dart.core::Object::•()
|
|
;
|
|
constructor redirecting1() → #lib::A
|
|
: this #lib::A::•(45)
|
|
;
|
|
constructor redirecting2(dart.core::int a, dart.core::int b, dart.core::int c) → #lib::A
|
|
: this #lib::A::constr2(a, b.{dart.core::num::*}(c))
|
|
;
|
|
}
|
|
[@vm.bytecode=
|
|
MembersBytecodeMetadata {
|
|
|
|
Members {
|
|
Field 'foo6', type = dart:core::int, getter = 'get:foo6', setter = 'set:foo6', reflectable
|
|
value = const 46
|
|
|
|
Field 'foo7', type = dart:core::int, reflectable, static
|
|
value = const 47
|
|
|
|
Field 'foo8', type = dart:core::int, reflectable, static, const, final
|
|
value = const 48
|
|
|
|
Function '', constructor, reflectable, debuggable
|
|
parameters [] (required: 0)
|
|
return-type #lib::B
|
|
|
|
|
|
Bytecode {
|
|
Entry 0
|
|
CheckStack 0
|
|
Push FP[-5]
|
|
PushInt 46
|
|
StoreFieldTOS CP#0
|
|
Push FP[-5]
|
|
PushInt 49
|
|
DirectCall 2, CP#2
|
|
Drop1
|
|
PushNull
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
[0] = InstanceField #lib::B::foo6 (field)
|
|
[1] = Reserved
|
|
[2] = DirectCall '#lib::A:: (constructor)', ArgDesc num-args 2, num-type-args 0, names []
|
|
[3] = Reserved
|
|
}
|
|
|
|
|
|
Function 'c2', constructor, reflectable, debuggable
|
|
parameters [dart:core::int 'i', dart:core::int 'j'] (required: 2)
|
|
return-type #lib::B
|
|
|
|
|
|
Bytecode {
|
|
Entry 0
|
|
CheckStack 0
|
|
Push FP[-7]
|
|
PushInt 46
|
|
StoreFieldTOS CP#0
|
|
Push FP[-7]
|
|
PushInt 50
|
|
StoreFieldTOS CP#0
|
|
Push FP[-7]
|
|
Push FP[-6]
|
|
Push FP[-5]
|
|
PushInt 51
|
|
DirectCall 4, CP#2
|
|
Drop1
|
|
PushNull
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
[0] = InstanceField #lib::B::foo6 (field)
|
|
[1] = Reserved
|
|
[2] = DirectCall '#lib::A::redirecting2 (constructor)', ArgDesc num-args 4, num-type-args 0, names []
|
|
[3] = Reserved
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
] class B extends #lib::A {
|
|
field dart.core::int foo6 = 46;
|
|
static field dart.core::int foo7 = 47;
|
|
static const field dart.core::int foo8 = 48;
|
|
constructor •() → #lib::B
|
|
: super #lib::A::•(49)
|
|
;
|
|
constructor c2(dart.core::int i, dart.core::int j) → #lib::B
|
|
: #lib::B::foo6 = 50, super #lib::A::redirecting2(i, j, 51)
|
|
;
|
|
}
|
|
static method main() → dynamic {}
|
|
}
|