336969538c
* Type arguments are moved to global object table (and de-duplicated). * Finalize non-recursive generic types at bytecode generation time. * Constants are moved to global object table (and de-duplicated). * ICData creation is avoided for direct calls. * Interface calls reference target member instead of selector name. Size of a dilp files: 17868K => 15896K (-11%). Change-Id: I0c9bf338137a0fae6ed90ab6b125ed2b24a1a8ad Reviewed-on: https://dart-review.googlesource.com/c/91108 Commit-Queue: Alexander Markov <alexmarkov@google.com> Reviewed-by: Zach Anderson <zra@google.com> Reviewed-by: Régis Crelier <regis@google.com>
257 lines
6.4 KiB
Plaintext
257 lines
6.4 KiB
Plaintext
library #lib;
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
|
|
[@vm.bytecode=
|
|
Bytecode {
|
|
EntryOptional 1, 2, 0
|
|
LoadConstant r1, CP#0
|
|
LoadConstant r2, CP#1
|
|
Frame 1
|
|
CheckStack 0
|
|
PushNull
|
|
PushInt 2
|
|
CreateArrayTOS
|
|
StoreLocal r3
|
|
Push r3
|
|
PushInt 0
|
|
PushConstant CP#2
|
|
StoreIndexedTOS
|
|
Push r3
|
|
PushInt 1
|
|
Push r0
|
|
StoreIndexedTOS
|
|
DirectCall 1, CP#3
|
|
DirectCall 1, CP#5
|
|
Drop1
|
|
PushNull
|
|
PushInt 2
|
|
CreateArrayTOS
|
|
StoreLocal r3
|
|
Push r3
|
|
PushInt 0
|
|
PushConstant CP#7
|
|
StoreIndexedTOS
|
|
Push r3
|
|
PushInt 1
|
|
Push r1
|
|
StoreIndexedTOS
|
|
DirectCall 1, CP#3
|
|
DirectCall 1, CP#5
|
|
Drop1
|
|
PushNull
|
|
PushInt 2
|
|
CreateArrayTOS
|
|
StoreLocal r3
|
|
Push r3
|
|
PushInt 0
|
|
PushConstant CP#8
|
|
StoreIndexedTOS
|
|
Push r3
|
|
PushInt 1
|
|
Push r2
|
|
StoreIndexedTOS
|
|
DirectCall 1, CP#3
|
|
DirectCall 1, CP#5
|
|
Drop1
|
|
PushNull
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
[0] = ObjectRef 'default_a'
|
|
[1] = ObjectRef 'default_b'
|
|
[2] = ObjectRef 'x = '
|
|
[3] = DirectCall 'dart:core::_StringBase::_interpolate', ArgDesc num-args 1, num-type-args 0, names []
|
|
[4] = Reserved
|
|
[5] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
|
|
[6] = Reserved
|
|
[7] = ObjectRef 'a = '
|
|
[8] = ObjectRef 'b = '
|
|
}
|
|
]static method foo1(dynamic x, [dynamic a = "default_a", dynamic b = "default_b"]) → void {
|
|
core::print("x = ${x}");
|
|
core::print("a = ${a}");
|
|
core::print("b = ${b}");
|
|
}
|
|
[@vm.bytecode=
|
|
Bytecode {
|
|
EntryOptional 2, 0, 3
|
|
LoadConstant r2, CP#0
|
|
LoadConstant r2, CP#1
|
|
LoadConstant r3, CP#2
|
|
LoadConstant r3, CP#3
|
|
LoadConstant r4, CP#4
|
|
LoadConstant r4, CP#5
|
|
Frame 1
|
|
CheckStack 0
|
|
PushNull
|
|
PushInt 2
|
|
CreateArrayTOS
|
|
StoreLocal r5
|
|
Push r5
|
|
PushInt 0
|
|
PushConstant CP#6
|
|
StoreIndexedTOS
|
|
Push r5
|
|
PushInt 1
|
|
Push r0
|
|
StoreIndexedTOS
|
|
DirectCall 1, CP#7
|
|
DirectCall 1, CP#9
|
|
Drop1
|
|
PushNull
|
|
PushInt 2
|
|
CreateArrayTOS
|
|
StoreLocal r5
|
|
Push r5
|
|
PushInt 0
|
|
PushConstant CP#11
|
|
StoreIndexedTOS
|
|
Push r5
|
|
PushInt 1
|
|
Push r1
|
|
StoreIndexedTOS
|
|
DirectCall 1, CP#7
|
|
DirectCall 1, CP#9
|
|
Drop1
|
|
PushNull
|
|
PushInt 2
|
|
CreateArrayTOS
|
|
StoreLocal r5
|
|
Push r5
|
|
PushInt 0
|
|
PushConstant CP#12
|
|
StoreIndexedTOS
|
|
Push r5
|
|
PushInt 1
|
|
Push r2
|
|
StoreIndexedTOS
|
|
DirectCall 1, CP#7
|
|
DirectCall 1, CP#9
|
|
Drop1
|
|
PushNull
|
|
PushInt 2
|
|
CreateArrayTOS
|
|
StoreLocal r5
|
|
Push r5
|
|
PushInt 0
|
|
PushConstant CP#13
|
|
StoreIndexedTOS
|
|
Push r5
|
|
PushInt 1
|
|
Push r3
|
|
StoreIndexedTOS
|
|
DirectCall 1, CP#7
|
|
DirectCall 1, CP#9
|
|
Drop1
|
|
PushNull
|
|
PushInt 2
|
|
CreateArrayTOS
|
|
StoreLocal r5
|
|
Push r5
|
|
PushInt 0
|
|
PushConstant CP#14
|
|
StoreIndexedTOS
|
|
Push r5
|
|
PushInt 1
|
|
Push r4
|
|
StoreIndexedTOS
|
|
DirectCall 1, CP#7
|
|
DirectCall 1, CP#9
|
|
Drop1
|
|
PushNull
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
[0] = ObjectRef 'a'
|
|
[1] = ObjectRef const 42
|
|
[2] = ObjectRef 'b'
|
|
[3] = ObjectRef const <dart:core::String> ['default_b']
|
|
[4] = ObjectRef 'c'
|
|
[5] = ObjectRef 'default_c'
|
|
[6] = ObjectRef 'y = '
|
|
[7] = DirectCall 'dart:core::_StringBase::_interpolate', ArgDesc num-args 1, num-type-args 0, names []
|
|
[8] = Reserved
|
|
[9] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
|
|
[10] = Reserved
|
|
[11] = ObjectRef 'z = '
|
|
[12] = ObjectRef 'a = '
|
|
[13] = ObjectRef 'b = '
|
|
[14] = ObjectRef 'c = '
|
|
}
|
|
]static method foo2(dynamic y, dynamic z, {dynamic c = "default_c", dynamic a = 42, dynamic b = const <core::String>["default_b"]}) → void {
|
|
core::print("y = ${y}");
|
|
core::print("z = ${z}");
|
|
core::print("a = ${a}");
|
|
core::print("b = ${b}");
|
|
core::print("c = ${c}");
|
|
}
|
|
[@vm.bytecode=
|
|
Bytecode {
|
|
EntryOptional 2, 0, 2
|
|
LoadConstant r2, CP#0
|
|
LoadConstant r2, CP#1
|
|
LoadConstant r3, CP#2
|
|
LoadConstant r3, CP#3
|
|
Frame 1
|
|
CheckStack 0
|
|
CheckFunctionTypeArgs 2, r4
|
|
PushNull
|
|
Push r4
|
|
InstantiateType CP#4
|
|
DirectCall 1, CP#5
|
|
Drop1
|
|
Push r1
|
|
DirectCall 1, CP#5
|
|
Drop1
|
|
Push r3
|
|
DirectCall 1, CP#5
|
|
Drop1
|
|
PushNull
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
[0] = ObjectRef 'a'
|
|
[1] = ObjectRef const false
|
|
[2] = ObjectRef 'b'
|
|
[3] = ObjectRef null
|
|
[4] = Type #lib::foo3::TypeParam/0
|
|
[5] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
|
|
[6] = Reserved
|
|
}
|
|
]static method foo3<P extends core::Object = dynamic, Q extends core::Object = dynamic>(dynamic z, dynamic y, {core::bool a = false, core::Map<self::foo3::P, self::foo3::Q> b = null}) → void {
|
|
core::print(self::foo3::P);
|
|
core::print(y);
|
|
core::print(b);
|
|
}
|
|
[@vm.bytecode=
|
|
Bytecode {
|
|
Entry 0
|
|
CheckStack 0
|
|
PushConstant CP#0
|
|
PushConstant CP#1
|
|
DirectCall 2, CP#2
|
|
Drop1
|
|
PushConstant CP#4
|
|
PushConstant CP#5
|
|
PushConstant CP#1
|
|
DirectCall 3, CP#6
|
|
Drop1
|
|
PushNull
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
[0] = ObjectRef 'fixed_x'
|
|
[1] = ObjectRef 'concrete_a'
|
|
[2] = DirectCall '#lib::foo1', ArgDesc num-args 2, num-type-args 0, names []
|
|
[3] = Reserved
|
|
[4] = ObjectRef 'fixed_y'
|
|
[5] = ObjectRef 'fixed_z'
|
|
[6] = DirectCall '#lib::foo2', ArgDesc num-args 3, num-type-args 0, names ['a']
|
|
[7] = Reserved
|
|
}
|
|
]static method main() → dynamic {
|
|
self::foo1("fixed_x", "concrete_a");
|
|
self::foo2("fixed_y", "fixed_z", a: "concrete_a");
|
|
}
|