Files
sdk/pkg/vm/testcases/bytecode/closures.dart.expect
T
Alexander Markov 62d154f6a3 [vm/bytecode] Record null-initialized fields in bytecode
If a field is initialized with null (either explicitly or implicitly),
field store can be omitted in bytecode. In such case, bytecode should
still convey the information about this initialization to VM for
field guards to work correctly.

Change-Id: I1fd45b858c3c521b97fa5dbffe0e15b1ea75d92f
Reviewed-on: https://dart-review.googlesource.com/76060
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-09-24 17:56:35 +00:00

1561 lines
42 KiB
Plaintext

library #lib;
import self as self;
import "dart:core" as core;
typedef IntFunc = (core::int) → dynamic;
class C1 extends core::Object {
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack
Push FP[-5]
PushConstant CP#1
IndirectStaticCall 1, CP#0
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = ArgDesc num-args 1, num-type-args 0, names []
[1] = StaticICData target 'dart.core::Object::', arg-desc CP#0
}
] synthetic constructor •() → void
: super core::Object::•()
;
}
class C2 extends core::Object {
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack
Push FP[-5]
PushConstant CP#1
IndirectStaticCall 1, CP#0
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = ArgDesc num-args 1, num-type-args 0, names []
[1] = StaticICData target 'dart.core::Object::', arg-desc CP#0
}
] synthetic constructor •() → void
: super core::Object::•()
;
}
class C3 extends core::Object {
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack
Push FP[-5]
PushConstant CP#1
IndirectStaticCall 1, CP#0
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = ArgDesc num-args 1, num-type-args 0, names []
[1] = StaticICData target 'dart.core::Object::', arg-desc CP#0
}
] synthetic constructor •() → void
: super core::Object::•()
;
}
class C4 extends core::Object {
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack
Push FP[-5]
PushConstant CP#1
IndirectStaticCall 1, CP#0
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = ArgDesc num-args 1, num-type-args 0, names []
[1] = StaticICData target 'dart.core::Object::', arg-desc CP#0
}
] synthetic constructor •() → void
: super core::Object::•()
;
}
class C5 extends core::Object {
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack
Push FP[-5]
PushConstant CP#1
IndirectStaticCall 1, CP#0
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = ArgDesc num-args 1, num-type-args 0, names []
[1] = StaticICData target 'dart.core::Object::', arg-desc CP#0
}
] synthetic constructor •() → void
: super core::Object::•()
;
}
class C6 extends core::Object {
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack
Push FP[-5]
PushConstant CP#1
IndirectStaticCall 1, CP#0
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = ArgDesc num-args 1, num-type-args 0, names []
[1] = StaticICData target 'dart.core::Object::', arg-desc CP#0
}
] synthetic constructor •() → void
: super core::Object::•()
;
}
class C7 extends core::Object {
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack
Push FP[-5]
PushConstant CP#1
IndirectStaticCall 1, CP#0
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = ArgDesc num-args 1, num-type-args 0, names []
[1] = StaticICData target 'dart.core::Object::', arg-desc CP#0
}
] synthetic constructor •() → void
: super core::Object::•()
;
}
class C8 extends core::Object {
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack
Push FP[-5]
PushConstant CP#1
IndirectStaticCall 1, CP#0
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = ArgDesc num-args 1, num-type-args 0, names []
[1] = StaticICData target 'dart.core::Object::', arg-desc CP#0
}
] synthetic constructor •() → void
: super core::Object::•()
;
}
class A<T1 extends core::Object = dynamic, T2 extends core::Object = dynamic> extends core::Object {
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack
Push FP[-5]
PushConstant CP#1
IndirectStaticCall 1, CP#0
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = ArgDesc num-args 1, num-type-args 0, names []
[1] = StaticICData target 'dart.core::Object::', arg-desc CP#0
}
] synthetic constructor •() → void
: super core::Object::•()
;
[@vm.bytecode=
Bytecode {
Entry 5
CheckStack
CheckFunctionTypeArgs 2, 0
AllocateContext 1
PopLocal r1
Push r1
Push FP[-5]
StoreContextVar 0
Allocate CP#31
StoreLocal r4
Push r4
Push FP[-5]
LoadTypeArgumentsField CP#15
StoreFieldTOS CP#32
Push r4
Push r0
StoreFieldTOS CP#6
Push r4
PushConstant CP#5
StoreFieldTOS CP#3
Push r4
PushConstant CP#0
StoreFieldTOS CP#34
Push r4
Push r1
StoreFieldTOS CP#1
PopLocal r3
PushConstant CP#44
Push r3
InstanceCall 2, CP#45
Drop1
PushConstant CP#46
Push r3
InstanceCall 2, CP#47
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = ClosureFunction nested1 <T5 extends dart.core::Object = dynamic, T6 extends dart.core::Object = dynamic>() → void;
[1] = InstanceField dart.core::_Closure::_context
[2] = Reserved
[3] = InstanceField dart.core::_Closure::_delayed_type_arguments
[4] = Reserved
[5] = EmptyTypeArguments
[6] = InstanceField dart.core::_Closure::_function_type_arguments
[7] = Reserved
[8] = ArgDesc num-args 4, num-type-args 0, names []
[9] = StaticICData target 'dart._internal::_prependTypeArguments', arg-desc CP#8
[10] = ClosureFunction nested2 <T7 extends dart.core::Object = dynamic, T8 extends dart.core::Object = dynamic>() → void;
[11] = StaticICData target 'dart._internal::_prependTypeArguments', arg-desc CP#8
[12] = ClosureFunction <anonymous closure> () → dart.core::Null;
[13] = TypeArgs [dart.core::Type]
[14] = Type #lib::A::T1
[15] = TypeArgumentsField #lib::A
[16] = Type #lib::A::T2
[17] = Type #lib::A::foo::T3
[18] = Type #lib::A::foo::T4
[19] = Type T5
[20] = Type T6
[21] = Type T7
[22] = Type T8
[23] = ArgDesc num-args 2, num-type-args 0, names []
[24] = StaticICData target 'dart.core::List::_fromLiteral', arg-desc CP#23
[25] = ArgDesc num-args 1, num-type-args 0, names []
[26] = StaticICData target 'dart.core::print', arg-desc CP#25
[27] = TypeArgs [#lib::A::T1, #lib::A::T2, #lib::A::foo::T3, #lib::A::foo::T4, T5, T6, T7, T8]
[28] = ArgDesc num-args 0, num-type-args 8, names []
[29] = StaticICData target '#lib::callWithArgs', arg-desc CP#28
[30] = EndClosureFunctionScope
[31] = Class dart.core::_Closure
[32] = InstanceField dart.core::_Closure::_instantiator_type_arguments
[33] = Reserved
[34] = InstanceField dart.core::_Closure::_function
[35] = Reserved
[36] = ICData dynamic target-name 'call', arg-desc CP#25
[37] = EndClosureFunctionScope
[38] = TypeArgs [#lib::C7, #lib::C8]
[39] = ArgDesc num-args 1, num-type-args 2, names []
[40] = ICData dynamic target-name 'call', arg-desc CP#39
[41] = TypeArgs [dart.core::List<#lib::C7>, dart.core::List<#lib::C8>]
[42] = ICData dynamic target-name 'call', arg-desc CP#39
[43] = EndClosureFunctionScope
[44] = TypeArgs [#lib::C5, #lib::C6]
[45] = ICData dynamic target-name 'call', arg-desc CP#39
[46] = TypeArgs [dart.core::List<#lib::C5>, dart.core::List<#lib::C6>]
[47] = ICData dynamic target-name 'call', arg-desc CP#39
}
Closure CP#12 {
EntryFixed 1, 4
CheckStack
Push FP[-5]
LoadFieldTOS CP#1
PopLocal r1
Push FP[-5]
LoadFieldTOS CP#6
PopLocal r0
PushConstant CP#13
StoreLocal r3
Push r3
PushInt 8
CreateArrayTOS
StoreLocal r3
Push r3
PushInt 0
Push r1
LoadContextVar 0
LoadTypeArgumentsField CP#15
PushNull
InstantiateType CP#14
StoreIndexedTOS
Push r3
PushInt 1
Push r1
LoadContextVar 0
LoadTypeArgumentsField CP#15
PushNull
InstantiateType CP#16
StoreIndexedTOS
Push r3
PushInt 2
PushNull
Push r0
InstantiateType CP#17
StoreIndexedTOS
Push r3
PushInt 3
PushNull
Push r0
InstantiateType CP#18
StoreIndexedTOS
Push r3
PushInt 4
PushNull
Push r0
InstantiateType CP#19
StoreIndexedTOS
Push r3
PushInt 5
PushNull
Push r0
InstantiateType CP#20
StoreIndexedTOS
Push r3
PushInt 6
PushNull
Push r0
InstantiateType CP#21
StoreIndexedTOS
Push r3
PushInt 7
PushNull
Push r0
InstantiateType CP#22
StoreIndexedTOS
PushConstant CP#24
IndirectStaticCall 2, CP#23
PushConstant CP#26
IndirectStaticCall 1, CP#25
Drop1
Push r1
LoadContextVar 0
LoadTypeArgumentsField CP#15
Push r0
InstantiateTypeArgumentsTOS 0, CP#27
PushConstant CP#29
IndirectStaticCall 1, CP#28
Drop1
PushNull
ReturnTOS
}
Closure CP#10 {
EntryFixed 1, 5
CheckStack
Push FP[-5]
LoadFieldTOS CP#1
PopLocal r1
Push FP[-5]
LoadFieldTOS CP#3
StoreLocal r0
PushConstant CP#5
IfEqStrictTOS
Jump L1
CheckFunctionTypeArgs 0, 2
Jump L2
L1:
CheckFunctionTypeArgs 2, 0
L2:
Push r0
Push FP[-5]
LoadFieldTOS CP#6
PushInt 4
PushInt 6
PushConstant CP#11
IndirectStaticCall 4, CP#8
PopLocal r0
Allocate CP#31
StoreLocal r4
Push r4
Push r1
LoadContextVar 0
LoadTypeArgumentsField CP#15
StoreFieldTOS CP#32
Push r4
Push r0
StoreFieldTOS CP#6
Push r4
PushConstant CP#5
StoreFieldTOS CP#3
Push r4
PushConstant CP#12
StoreFieldTOS CP#34
Push r4
Push r1
StoreFieldTOS CP#1
PopLocal r3
Push r3
InstanceCall 1, CP#36
Drop1
PushNull
ReturnTOS
}
Closure CP#0 {
EntryFixed 1, 5
CheckStack
Push FP[-5]
LoadFieldTOS CP#1
PopLocal r1
Push FP[-5]
LoadFieldTOS CP#3
StoreLocal r0
PushConstant CP#5
IfEqStrictTOS
Jump L1
CheckFunctionTypeArgs 0, 2
Jump L2
L1:
CheckFunctionTypeArgs 2, 0
L2:
Push r0
Push FP[-5]
LoadFieldTOS CP#6
PushInt 2
PushInt 4
PushConstant CP#9
IndirectStaticCall 4, CP#8
PopLocal r0
Allocate CP#31
StoreLocal r4
Push r4
Push r1
LoadContextVar 0
LoadTypeArgumentsField CP#15
StoreFieldTOS CP#32
Push r4
Push r0
StoreFieldTOS CP#6
Push r4
PushConstant CP#5
StoreFieldTOS CP#3
Push r4
PushConstant CP#10
StoreFieldTOS CP#34
Push r4
Push r1
StoreFieldTOS CP#1
PopLocal r3
PushConstant CP#38
Push r3
InstanceCall 2, CP#40
Drop1
PushConstant CP#41
Push r3
InstanceCall 2, CP#42
Drop1
PushNull
ReturnTOS
}
] method foo<T3 extends core::Object = dynamic, T4 extends core::Object = dynamic>() → void {
function nested1<T5 extends core::Object = dynamic, T6 extends core::Object = dynamic>() → void {
function nested2<T7 extends core::Object = dynamic, T8 extends core::Object = dynamic>() → void {
() → core::Null nested3 = () → core::Null {
core::print(<core::Type>[self::A::T1, self::A::T2, self::A::foo::T3, self::A::foo::T4, T5, T6, T7, T8]);
self::callWithArgs<self::A::T1, self::A::T2, self::A::foo::T3, self::A::foo::T4, T5, T6, T7, T8>();
};
[@vm.call-site-attributes.metadata=receiverType:() → dart.core::Null] nested3.call();
}
[@vm.call-site-attributes.metadata=receiverType:<T7 extends dart.core::Object = dynamic, T8 extends dart.core::Object = dynamic>() → void] nested2.call<self::C7, self::C8>();
[@vm.call-site-attributes.metadata=receiverType:<T7 extends dart.core::Object = dynamic, T8 extends dart.core::Object = dynamic>() → void] nested2.call<core::List<self::C7>, core::List<self::C8>>();
}
[@vm.call-site-attributes.metadata=receiverType:<T5 extends dart.core::Object = dynamic, T6 extends dart.core::Object = dynamic>() → void] nested1.call<self::C5, self::C6>();
[@vm.call-site-attributes.metadata=receiverType:<T5 extends dart.core::Object = dynamic, T6 extends dart.core::Object = dynamic>() → void] nested1.call<core::List<self::C5>, core::List<self::C6>>();
}
}
class B extends core::Object {
field core::int foo = null;
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack
Push FP[-5]
PushConstant CP#1
IndirectStaticCall 1, CP#0
Drop1
PushNull
ReturnTOS
}
Nullable fields: [#lib::B::foo]
ConstantPool {
[0] = ArgDesc num-args 1, num-type-args 0, names []
[1] = StaticICData target 'dart.core::Object::', arg-desc CP#0
}
] synthetic constructor •() → void
: super core::Object::•()
;
[@vm.bytecode=
Bytecode {
Entry 5
CheckStack
AllocateContext 4
PopLocal r0
Push r0
Push FP[-5]
StoreContextVar 0
Push r0
PushInt 1
StoreContextVar 1
PushInt 2
PopLocal r2
Push r0
PushInt 3
StoreContextVar 2
Allocate CP#15
StoreLocal r4
Push r4
PushNull
StoreFieldTOS CP#16
Push r4
PushNull
StoreFieldTOS CP#18
Push r4
PushConstant CP#20
StoreFieldTOS CP#21
Push r4
PushConstant CP#0
StoreFieldTOS CP#23
Push r4
Push r0
StoreFieldTOS CP#1
PopLocal r3
Push r3
PushInt 10
InstanceCall 2, CP#28
Drop1
Push r3
PushInt 11
InstanceCall 2, CP#29
Drop1
Push r2
PushConstant CP#30
IndirectStaticCall 1, CP#11
Drop1
Push r0
LoadContextVar 2
PushConstant CP#31
IndirectStaticCall 1, CP#11
Drop1
Push r0
LoadContextVar 1
PushConstant CP#32
IndirectStaticCall 1, CP#11
Drop1
Push r0
PushInt 42
StoreContextVar 3
Allocate CP#15
StoreLocal r3
Push r3
PushNull
StoreFieldTOS CP#16
Push r3
PushNull
StoreFieldTOS CP#18
Push r3
PushConstant CP#20
StoreFieldTOS CP#21
Push r3
PushConstant CP#33
StoreFieldTOS CP#23
Push r3
Push r0
StoreFieldTOS CP#1
PopLocal r2
Push r2
InstanceCall 1, CP#36
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = ClosureFunction <anonymous closure> (dart.core::int y) → dart.core::Null;
[1] = InstanceField dart.core::_Closure::_context
[2] = Reserved
[3] = Type dart.core::int
[4] = String 'y'
[5] = SubtypeTestCache
[6] = ArgDesc num-args 2, num-type-args 0, names []
[7] = ICData target-name '+', arg-desc CP#6
[8] = ICData target-name '>', arg-desc CP#6
[9] = ClosureFunction closure2 () → void;
[10] = ICData target-name '+', arg-desc CP#6
[11] = ArgDesc num-args 1, num-type-args 0, names []
[12] = ICData get target-name 'foo', arg-desc CP#11
[13] = ICData target-name '+', arg-desc CP#6
[14] = EndClosureFunctionScope
[15] = Class dart.core::_Closure
[16] = InstanceField dart.core::_Closure::_instantiator_type_arguments
[17] = Reserved
[18] = InstanceField dart.core::_Closure::_function_type_arguments
[19] = Reserved
[20] = EmptyTypeArguments
[21] = InstanceField dart.core::_Closure::_delayed_type_arguments
[22] = Reserved
[23] = InstanceField dart.core::_Closure::_function
[24] = Reserved
[25] = ICData dynamic target-name 'call', arg-desc CP#11
[26] = StaticICData target 'dart.core::print', arg-desc CP#11
[27] = EndClosureFunctionScope
[28] = ICData dynamic target-name 'call', arg-desc CP#6
[29] = ICData dynamic target-name 'call', arg-desc CP#6
[30] = StaticICData target 'dart.core::print', arg-desc CP#11
[31] = StaticICData target 'dart.core::print', arg-desc CP#11
[32] = StaticICData target 'dart.core::print', arg-desc CP#11
[33] = ClosureFunction <anonymous closure> () → dart.core::Null;
[34] = ICData set target-name 'foo', arg-desc CP#6
[35] = EndClosureFunctionScope
[36] = ICData dynamic target-name 'call', arg-desc CP#11
}
Closure CP#9 {
EntryFixed 1, 3
CheckStack
Push FP[-5]
LoadFieldTOS CP#1
PopLocal r0
Push r0
LoadContextParent
Push r0
LoadContextParent
LoadContextVar 1
PushInt 2
InstanceCall 2, CP#10
StoreContextVar 2
Push r0
Push r0
LoadContextParent
LoadContextVar 0
InstanceCall 1, CP#12
Push r0
LoadContextVar 0
InstanceCall 2, CP#13
StoreContextVar 1
PushNull
ReturnTOS
}
Closure CP#0 {
EntryFixed 2, 4
CheckStack
Push FP[-6]
LoadFieldTOS CP#1
PopLocal r0
AllocateContext 2
StoreLocal r1
Push r1
Push r0
StoreContextParent
PopLocal r0
Push r0
Push FP[-5]
StoreContextVar 0
Push FP[-5]
PushNull
PushNull
PushConstant CP#3
PushConstant CP#4
AssertAssignable 1, CP#5
Drop1
Push r0
LoadContextParent
Push r0
LoadContextVar 0
PushInt 1
InstanceCall 2, CP#7
StoreContextVar 1
Push r0
LoadContextParent
LoadContextVar 1
PushInt 5
InstanceCall 2, CP#8
AssertBoolean 0
PushTrue
IfNeStrictTOS
Jump L1
Push r0
PushInt 4
StoreContextVar 1
Allocate CP#15
StoreLocal r2
Push r2
PushNull
StoreFieldTOS CP#16
Push r2
PushNull
StoreFieldTOS CP#18
Push r2
PushConstant CP#20
StoreFieldTOS CP#21
Push r2
PushConstant CP#9
StoreFieldTOS CP#23
Push r2
Push r0
StoreFieldTOS CP#1
PopLocal r3
Push r3
InstanceCall 1, CP#25
Drop1
Push r0
LoadContextVar 1
PushConstant CP#26
IndirectStaticCall 1, CP#11
Drop1
L1:
PushNull
ReturnTOS
}
Closure CP#33 {
EntryFixed 1, 3
CheckStack
Push FP[-5]
LoadFieldTOS CP#1
PopLocal r0
Push r0
LoadContextVar 0
Push r0
LoadContextVar 3
InstanceCall 2, CP#34
Drop1
PushNull
ReturnTOS
}
] method topLevel() → void {
{
core::int x = 1;
{
core::int y = 2;
core::int z = 3;
(core::int) → core::Null closure1 = (core::int y) → core::Null {
x = y.{core::num::+}(1);
if(x.{core::num::>}(5)) {
core::int w = 4;
function closure2() → void {
z = x.{core::num::+}(2);
w = this.{self::B::foo}.{core::num::+}(y);
}
[@vm.call-site-attributes.metadata=receiverType:() → void] closure2.call();
core::print(w);
}
};
[@vm.call-site-attributes.metadata=receiverType:(dart.core::int) → dart.core::Null] closure1.call(10);
[@vm.call-site-attributes.metadata=receiverType:(dart.core::int) → dart.core::Null] closure1.call(11);
core::print(y);
core::print(z);
}
core::print(x);
}
{
core::int x = 42;
() → core::Null closure3 = () → core::Null {
this.{self::B::foo} = x;
};
[@vm.call-site-attributes.metadata=receiverType:() → dart.core::Null] closure3.call();
}
}
}
class C extends core::Object {
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack
Push FP[-5]
PushConstant CP#1
IndirectStaticCall 1, CP#0
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = ArgDesc num-args 1, num-type-args 0, names []
[1] = StaticICData target 'dart.core::Object::', arg-desc CP#0
}
] synthetic constructor •() → void
: super core::Object::•()
;
[@vm.bytecode=
Bytecode {
Entry 5
CheckStack
AllocateContext 1
PopLocal r0
Push r0
PushInt 0
StoreContextVar 0
PushConstant CP#0
StoreLocal r3
Push r3
PushInt 0
CreateArrayTOS
StoreLocal r3
PushConstant CP#2
IndirectStaticCall 2, CP#1
PopLocal r2
PushConstant CP#0
StoreLocal r3
Push r3
PushInt 0
CreateArrayTOS
StoreLocal r3
PushConstant CP#3
IndirectStaticCall 2, CP#1
PopLocal r4
AllocateContext 1
StoreLocal r1
Push r1
Push r0
StoreContextParent
PopLocal r0
Push r0
PushInt 0
StoreContextVar 0
L2:
CheckStack
Push r0
LoadContextVar 0
PushInt 10
InstanceCall 2, CP#4
AssertBoolean 0
PushTrue
IfNeStrictTOS
Jump L1
Push r2
Allocate CP#10
StoreLocal r3
Push r3
PushNull
StoreFieldTOS CP#11
Push r3
PushNull
StoreFieldTOS CP#13
Push r3
PushConstant CP#15
StoreFieldTOS CP#16
Push r3
PushConstant CP#5
StoreFieldTOS CP#18
Push r3
Push r0
StoreFieldTOS CP#6
InstanceCall 2, CP#20
Drop1
Push r4
Allocate CP#10
StoreLocal r3
Push r3
PushNull
StoreFieldTOS CP#11
Push r3
PushNull
StoreFieldTOS CP#13
Push r3
PushConstant CP#15
StoreFieldTOS CP#16
Push r3
PushConstant CP#21
StoreFieldTOS CP#18
Push r3
Push r0
StoreFieldTOS CP#6
InstanceCall 2, CP#27
Drop1
Push r0
CloneContext
PopLocal r0
Push r0
Push r0
LoadContextVar 0
PushInt 1
InstanceCall 2, CP#28
StoreLocal r3
StoreContextVar 0
Push r3
Drop1
Jump L2
L1:
Push r0
LoadContextParent
PopLocal r0
Push r0
LoadContextParent
PopLocal r0
PushNull
ReturnTOS
}
ConstantPool {
[0] = TypeArgs [dart.core::Function]
[1] = ArgDesc num-args 2, num-type-args 0, names []
[2] = StaticICData target 'dart.core::List::_fromLiteral', arg-desc CP#1
[3] = StaticICData target 'dart.core::List::_fromLiteral', arg-desc CP#1
[4] = ICData target-name '<', arg-desc CP#1
[5] = ClosureFunction <anonymous closure> () → dart.core::int;
[6] = InstanceField dart.core::_Closure::_context
[7] = Reserved
[8] = ICData target-name '+', arg-desc CP#1
[9] = EndClosureFunctionScope
[10] = Class dart.core::_Closure
[11] = InstanceField dart.core::_Closure::_instantiator_type_arguments
[12] = Reserved
[13] = InstanceField dart.core::_Closure::_function_type_arguments
[14] = Reserved
[15] = EmptyTypeArguments
[16] = InstanceField dart.core::_Closure::_delayed_type_arguments
[17] = Reserved
[18] = InstanceField dart.core::_Closure::_function
[19] = Reserved
[20] = ICData target-name 'add', arg-desc CP#1
[21] = ClosureFunction <anonymous closure> (dart.core::int ii) → dart.core::Null;
[22] = Type dart.core::int
[23] = String 'ii'
[24] = SubtypeTestCache
[25] = ICData target-name '+', arg-desc CP#1
[26] = EndClosureFunctionScope
[27] = ICData target-name 'add', arg-desc CP#1
[28] = ICData target-name '+', arg-desc CP#1
}
Closure CP#5 {
EntryFixed 1, 2
CheckStack
Push FP[-5]
LoadFieldTOS CP#6
PopLocal r0
Push r0
LoadContextVar 0
Push r0
LoadContextParent
LoadContextVar 0
InstanceCall 2, CP#8
ReturnTOS
PushNull
ReturnTOS
}
Closure CP#21 {
EntryFixed 2, 3
CheckStack
Push FP[-6]
LoadFieldTOS CP#6
PopLocal r0
Push FP[-5]
PushNull
PushNull
PushConstant CP#22
PushConstant CP#23
AssertAssignable 1, CP#24
Drop1
Push r0
Push FP[-5]
Push r0
LoadContextParent
LoadContextVar 0
InstanceCall 2, CP#25
StoreContextVar 0
PushNull
ReturnTOS
}
] method testForLoop() → void {
core::int delta = 0;
core::List<core::Function> getI = <core::Function>[];
core::List<core::Function> setI = <core::Function>[];
for (core::int i = 0; i.{core::num::<}(10); i = i.{core::num::+}(1)) {
[@vm.call-site-attributes.metadata=receiverType:dart.core::List<dart.core::Function>] getI.{core::List::add}(() → core::int => i.{core::num::+}(delta));
[@vm.call-site-attributes.metadata=receiverType:dart.core::List<dart.core::Function>] setI.{core::List::add}((core::int ii) → core::Null {
i = ii.{core::num::+}(delta);
});
}
}
[@vm.bytecode=
Bytecode {
Entry 5
CheckStack
Push FP[-5]
InstanceCall 1, CP#1
PopLocal r2
L2:
CheckStack
Push r2
InstanceCall 1, CP#2
PushTrue
IfNeStrictTOS
Jump L1
AllocateContext 1
PopLocal r0
Push r0
Push r2
InstanceCall 1, CP#3
StoreContextVar 0
Allocate CP#10
StoreLocal r4
Push r4
PushNull
StoreFieldTOS CP#11
Push r4
PushNull
StoreFieldTOS CP#13
Push r4
PushConstant CP#15
StoreFieldTOS CP#16
Push r4
PushConstant CP#4
StoreFieldTOS CP#18
Push r4
Push r0
StoreFieldTOS CP#5
PopLocal r3
Push r3
InstanceCall 1, CP#20
Drop1
Push r0
LoadContextVar 0
PushConstant CP#21
IndirectStaticCall 1, CP#0
Drop1
Push r0
LoadContextParent
PopLocal r0
Jump L2
L1:
PushNull
ReturnTOS
}
ConstantPool {
[0] = ArgDesc num-args 1, num-type-args 0, names []
[1] = ICData get target-name 'iterator', arg-desc CP#0
[2] = ICData target-name 'moveNext', arg-desc CP#0
[3] = ICData get target-name 'current', arg-desc CP#0
[4] = ClosureFunction <anonymous closure> () → dart.core::Null;
[5] = InstanceField dart.core::_Closure::_context
[6] = Reserved
[7] = ArgDesc num-args 2, num-type-args 0, names []
[8] = ICData target-name '+', arg-desc CP#7
[9] = EndClosureFunctionScope
[10] = Class dart.core::_Closure
[11] = InstanceField dart.core::_Closure::_instantiator_type_arguments
[12] = Reserved
[13] = InstanceField dart.core::_Closure::_function_type_arguments
[14] = Reserved
[15] = EmptyTypeArguments
[16] = InstanceField dart.core::_Closure::_delayed_type_arguments
[17] = Reserved
[18] = InstanceField dart.core::_Closure::_function
[19] = Reserved
[20] = ICData dynamic target-name 'call', arg-desc CP#0
[21] = StaticICData target 'dart.core::print', arg-desc CP#0
}
Closure CP#4 {
EntryFixed 1, 3
CheckStack
Push FP[-5]
LoadFieldTOS CP#5
PopLocal r0
Push r0
Push r0
LoadContextVar 0
PushInt 1
InstanceCall 2, CP#8
StoreContextVar 0
PushNull
ReturnTOS
}
] method testForInLoop(core::List<core::int> list) → void {
for (core::int i in list) {
() → core::Null inc = () → core::Null {
i = i.{core::num::+}(1);
};
[@vm.call-site-attributes.metadata=receiverType:() → dart.core::Null] inc.call();
core::print(i);
}
}
}
class D<T extends core::Object = dynamic> extends core::Object {
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack
Push FP[-5]
PushConstant CP#1
IndirectStaticCall 1, CP#0
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = ArgDesc num-args 1, num-type-args 0, names []
[1] = StaticICData target 'dart.core::Object::', arg-desc CP#0
}
] synthetic constructor •() → void
: super core::Object::•()
;
[@vm.bytecode=
Bytecode {
Entry 3
CheckStack
AllocateContext 1
PopLocal r0
Push r0
Push FP[-5]
StoreContextVar 0
Push FP[-5]
Push FP[-6]
LoadTypeArgumentsField CP#0
PushNull
PushConstant CP#1
PushConstant CP#2
AssertAssignable 0, CP#3
Drop1
Allocate CP#8
StoreLocal r2
Push r2
Push FP[-6]
LoadTypeArgumentsField CP#0
StoreFieldTOS CP#9
Push r2
PushNull
StoreFieldTOS CP#11
Push r2
PushConstant CP#13
StoreFieldTOS CP#14
Push r2
PushConstant CP#4
StoreFieldTOS CP#16
Push r2
Push r0
StoreFieldTOS CP#5
ReturnTOS
PushNull
ReturnTOS
}
ConstantPool {
[0] = TypeArgumentsField #lib::D
[1] = Type #lib::D::T
[2] = String 't'
[3] = SubtypeTestCache
[4] = ClosureFunction <anonymous closure> () → #lib::D::T;
[5] = InstanceField dart.core::_Closure::_context
[6] = Reserved
[7] = EndClosureFunctionScope
[8] = Class dart.core::_Closure
[9] = InstanceField dart.core::_Closure::_instantiator_type_arguments
[10] = Reserved
[11] = InstanceField dart.core::_Closure::_function_type_arguments
[12] = Reserved
[13] = EmptyTypeArguments
[14] = InstanceField dart.core::_Closure::_delayed_type_arguments
[15] = Reserved
[16] = InstanceField dart.core::_Closure::_function
[17] = Reserved
}
Closure CP#4 {
EntryFixed 1, 2
CheckStack
Push FP[-5]
LoadFieldTOS CP#5
PopLocal r0
Push r0
LoadContextVar 0
ReturnTOS
PushNull
ReturnTOS
}
] method foo(generic-covariant-impl self::D::T t) → dynamic {
return () → self::D::T => t;
}
}
[@vm.bytecode=
Bytecode {
Entry 4
CheckStack
AllocateContext 1
PopLocal r0
Push r0
PushInt 5
StoreContextVar 0
Allocate CP#9
StoreLocal r3
Push r3
PushNull
StoreFieldTOS CP#10
Push r3
PushNull
StoreFieldTOS CP#12
Push r3
PushConstant CP#14
StoreFieldTOS CP#15
Push r3
PushConstant CP#0
StoreFieldTOS CP#17
Push r3
Push r0
StoreFieldTOS CP#1
PopLocal r2
Push r2
PushInt 3
InstanceCall 2, CP#19
Drop1
Push r0
LoadContextVar 0
ReturnTOS
Push r0
LoadContextParent
PopLocal r0
PushNull
ReturnTOS
}
ConstantPool {
[0] = ClosureFunction <anonymous closure> (dart.core::int y) → dart.core::Null;
[1] = InstanceField dart.core::_Closure::_context
[2] = Reserved
[3] = Type dart.core::int
[4] = String 'y'
[5] = SubtypeTestCache
[6] = ArgDesc num-args 2, num-type-args 0, names []
[7] = ICData target-name '+', arg-desc CP#6
[8] = EndClosureFunctionScope
[9] = Class dart.core::_Closure
[10] = InstanceField dart.core::_Closure::_instantiator_type_arguments
[11] = Reserved
[12] = InstanceField dart.core::_Closure::_function_type_arguments
[13] = Reserved
[14] = EmptyTypeArguments
[15] = InstanceField dart.core::_Closure::_delayed_type_arguments
[16] = Reserved
[17] = InstanceField dart.core::_Closure::_function
[18] = Reserved
[19] = ICData dynamic target-name 'call', arg-desc CP#6
}
Closure CP#0 {
EntryFixed 2, 3
CheckStack
Push FP[-6]
LoadFieldTOS CP#1
PopLocal r0
Push FP[-5]
PushNull
PushNull
PushConstant CP#3
PushConstant CP#4
AssertAssignable 1, CP#5
Drop1
Push r0
Push r0
LoadContextVar 0
Push FP[-5]
InstanceCall 2, CP#7
StoreContextVar 0
PushNull
ReturnTOS
}
]static method simpleClosure() → core::int {
core::int x = 5;
(core::int) → core::Null inc = (core::int y) → core::Null {
x = x.{core::num::+}(y);
};
[@vm.call-site-attributes.metadata=receiverType:(dart.core::int) → dart.core::Null] inc.call(3);
return x;
}
[@vm.bytecode=
Bytecode {
Entry 2
CheckStack
CheckFunctionTypeArgs 8, 0
PushConstant CP#0
StoreLocal r1
Push r1
PushInt 8
CreateArrayTOS
StoreLocal r1
Push r1
PushInt 0
PushNull
Push r0
InstantiateType CP#1
StoreIndexedTOS
Push r1
PushInt 1
PushNull
Push r0
InstantiateType CP#2
StoreIndexedTOS
Push r1
PushInt 2
PushNull
Push r0
InstantiateType CP#3
StoreIndexedTOS
Push r1
PushInt 3
PushNull
Push r0
InstantiateType CP#4
StoreIndexedTOS
Push r1
PushInt 4
PushNull
Push r0
InstantiateType CP#5
StoreIndexedTOS
Push r1
PushInt 5
PushNull
Push r0
InstantiateType CP#6
StoreIndexedTOS
Push r1
PushInt 6
PushNull
Push r0
InstantiateType CP#7
StoreIndexedTOS
Push r1
PushInt 7
PushNull
Push r0
InstantiateType CP#8
StoreIndexedTOS
PushConstant CP#10
IndirectStaticCall 2, CP#9
PushConstant CP#12
IndirectStaticCall 1, CP#11
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = TypeArgs [dart.core::Type]
[1] = Type #lib::callWithArgs::T1
[2] = Type #lib::callWithArgs::T2
[3] = Type #lib::callWithArgs::T3
[4] = Type #lib::callWithArgs::T4
[5] = Type #lib::callWithArgs::T5
[6] = Type #lib::callWithArgs::T6
[7] = Type #lib::callWithArgs::T7
[8] = Type #lib::callWithArgs::T8
[9] = ArgDesc num-args 2, num-type-args 0, names []
[10] = StaticICData target 'dart.core::List::_fromLiteral', arg-desc CP#9
[11] = ArgDesc num-args 1, num-type-args 0, names []
[12] = StaticICData target 'dart.core::print', arg-desc CP#11
}
]static method callWithArgs<T1 extends core::Object = dynamic, T2 extends core::Object = dynamic, T3 extends core::Object = dynamic, T4 extends core::Object = dynamic, T5 extends core::Object = dynamic, T6 extends core::Object = dynamic, T7 extends core::Object = dynamic, T8 extends core::Object = dynamic>() → void {
core::print(<core::Type>[self::callWithArgs::T1, self::callWithArgs::T2, self::callWithArgs::T3, self::callWithArgs::T4, self::callWithArgs::T5, self::callWithArgs::T6, self::callWithArgs::T7, self::callWithArgs::T8]);
}
[@vm.bytecode=
Bytecode {
Entry 1
CheckStack
PushConstant CP#0
PushConstant CP#2
PushConstant CP#1
AllocateT
StoreLocal r0
Push r0
PushConstant CP#4
IndirectStaticCall 1, CP#3
Drop1
InstanceCall 2, CP#6
Drop1
PushConstant CP#7
PushConstant CP#2
PushConstant CP#1
AllocateT
StoreLocal r0
Push r0
PushConstant CP#8
IndirectStaticCall 1, CP#3
Drop1
InstanceCall 2, CP#9
Drop1
PushConstant CP#7
PushConstant CP#10
PushConstant CP#1
AllocateT
StoreLocal r0
Push r0
PushConstant CP#11
IndirectStaticCall 1, CP#3
Drop1
InstanceCall 2, CP#12
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = TypeArgs [#lib::C3, #lib::C4]
[1] = Class #lib::A
[2] = TypeArgumentsForInstanceAllocation #lib::A [#lib::C1, #lib::C2]
[3] = ArgDesc num-args 1, num-type-args 0, names []
[4] = StaticICData target '#lib::A::', arg-desc CP#3
[5] = ArgDesc num-args 1, num-type-args 2, names []
[6] = ICData target-name 'foo', arg-desc CP#5
[7] = TypeArgs [dart.core::List<#lib::C3>, dart.core::List<#lib::C4>]
[8] = StaticICData target '#lib::A::', arg-desc CP#3
[9] = ICData target-name 'foo', arg-desc CP#5
[10] = TypeArgumentsForInstanceAllocation #lib::A [dart.core::List<#lib::C1>, dart.core::List<#lib::C2>]
[11] = StaticICData target '#lib::A::', arg-desc CP#3
[12] = ICData target-name 'foo', arg-desc CP#5
}
]static method callA() → void {
new self::A::•<self::C1, self::C2>().{self::A::foo}<self::C3, self::C4>();
new self::A::•<self::C1, self::C2>().{self::A::foo}<core::List<self::C3>, core::List<self::C4>>();
new self::A::•<core::List<self::C1>, core::List<self::C2>>().{self::A::foo}<core::List<self::C3>, core::List<self::C4>>();
}
[@vm.bytecode=
Bytecode {
Entry 7
CheckStack
Allocate CP#14
StoreLocal r3
Push r3
PushNull
StoreFieldTOS CP#15
Push r3
PushNull
StoreFieldTOS CP#6
Push r3
PushConstant CP#5
StoreFieldTOS CP#3
Push r3
PushConstant CP#0
StoreFieldTOS CP#17
Push r3
Push r0
StoreFieldTOS CP#1
PopLocal r2
Push r2
StoreLocal r3
PushConstant CP#19
StoreLocal r6
PushConstant CP#21
IndirectStaticCall 2, CP#20
Drop1
Allocate CP#14
StoreLocal r5
Push r6
StoreFieldTOS CP#3
Push r5
Push r3
LoadFieldTOS CP#15
StoreFieldTOS CP#15
Push r5
Push r3
LoadFieldTOS CP#6
StoreFieldTOS CP#6
Push r5
Push r3
LoadFieldTOS CP#17
StoreFieldTOS CP#17
Push r5
Push r3
LoadFieldTOS CP#1
StoreFieldTOS CP#1
Push r5
PopLocal r4
Push r4
ReturnTOS
PushNull
ReturnTOS
}
ConstantPool {
[0] = ClosureFunction foo <T extends dart.core::Object = dynamic>(T t) → void;
[1] = InstanceField dart.core::_Closure::_context
[2] = Reserved
[3] = InstanceField dart.core::_Closure::_delayed_type_arguments
[4] = Reserved
[5] = EmptyTypeArguments
[6] = InstanceField dart.core::_Closure::_function_type_arguments
[7] = Reserved
[8] = ArgDesc num-args 4, num-type-args 0, names []
[9] = StaticICData target 'dart._internal::_prependTypeArguments', arg-desc CP#8
[10] = Type T
[11] = String 't'
[12] = SubtypeTestCache
[13] = EndClosureFunctionScope
[14] = Class dart.core::_Closure
[15] = InstanceField dart.core::_Closure::_instantiator_type_arguments
[16] = Reserved
[17] = InstanceField dart.core::_Closure::_function
[18] = Reserved
[19] = TypeArgs [dart.core::int]
[20] = ArgDesc num-args 2, num-type-args 0, names []
[21] = StaticICData target 'dart._internal::_boundsCheckForPartialInstantiation', arg-desc CP#20
}
Closure CP#0 {
EntryFixed 2, 3
CheckStack
Push FP[-6]
LoadFieldTOS CP#1
PopLocal r1
Push FP[-6]
LoadFieldTOS CP#3
StoreLocal r0
PushConstant CP#5
IfEqStrictTOS
Jump L1
CheckFunctionTypeArgs 0, 2
Jump L2
L1:
CheckFunctionTypeArgs 1, 0
L2:
Push r0
Push FP[-6]
LoadFieldTOS CP#6
PushInt 0
PushInt 1
PushConstant CP#9
IndirectStaticCall 4, CP#8
PopLocal r0
Push FP[-5]
PushNull
Push r0
PushConstant CP#10
PushConstant CP#11
AssertAssignable 0, CP#12
Drop1
PushNull
ReturnTOS
}
]static method testPartialInstantiation() → (core::int) → dynamic {
function foo<T extends core::Object = dynamic>(T t) → void {}
(core::int) → dynamic intFunc = foo<core::int>;
return intFunc;
}
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack
PushNull
ReturnTOS
}
ConstantPool {
}
]static method main() → dynamic {}