Files
sdk/pkg/vm/testcases/bytecode/field_initializers.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

201 lines
5.0 KiB
Plaintext

library #lib;
import self as self;
import "dart:core" as core;
class A extends core::Object {
field core::int foo1;
field core::int foo2 = null;
field core::int foo3 = 42;
field core::int foo4;
field core::int foo5 = 43;
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack
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]
PushConstant CP#7
IndirectStaticCall 1, CP#6
Drop1
PushNull
ReturnTOS
}
Nullable fields: [#lib::A::foo1, #lib::A::foo2]
ConstantPool {
[0] = InstanceField #lib::A::foo3
[1] = Reserved
[2] = InstanceField #lib::A::foo5
[3] = Reserved
[4] = InstanceField #lib::A::foo4
[5] = Reserved
[6] = ArgDesc num-args 1, num-type-args 0, names []
[7] = StaticICData target 'dart.core::Object::', arg-desc CP#6
}
] constructor •(core::int foo4) → void
: self::A::foo1 = null, self::A::foo4 = foo4, self::A::foo5 = 44, super core::Object::•()
;
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack
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
InstanceCall 2, CP#7
StoreFieldTOS CP#2
Push FP[-7]
PushConstant CP#9
IndirectStaticCall 1, CP#8
Drop1
PushNull
ReturnTOS
}
Nullable fields: [#lib::A::foo2, #lib::A::foo4]
ConstantPool {
[0] = InstanceField #lib::A::foo3
[1] = Reserved
[2] = InstanceField #lib::A::foo5
[3] = Reserved
[4] = InstanceField #lib::A::foo1
[5] = Reserved
[6] = ArgDesc num-args 2, num-type-args 0, names []
[7] = ICData target-name '+', arg-desc CP#6
[8] = ArgDesc num-args 1, num-type-args 0, names []
[9] = StaticICData target 'dart.core::Object::', arg-desc CP#8
}
] constructor constr2(core::int x, core::int y) → void
: self::A::foo4 = null, self::A::foo1 = x, self::A::foo5 = y.{core::num::+}(1), super core::Object::•()
;
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack
Push FP[-5]
PushInt 45
PushConstant CP#1
IndirectStaticCall 2, CP#0
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = ArgDesc num-args 2, num-type-args 0, names []
[1] = StaticICData target '#lib::A::', arg-desc CP#0
}
] constructor redirecting1() → void
: this self::A::•(45)
;
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack
Push FP[-8]
Push FP[-7]
Push FP[-6]
Push FP[-5]
InstanceCall 2, CP#1
PushConstant CP#3
IndirectStaticCall 3, CP#2
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = ArgDesc num-args 2, num-type-args 0, names []
[1] = ICData target-name '*', arg-desc CP#0
[2] = ArgDesc num-args 3, num-type-args 0, names []
[3] = StaticICData target '#lib::A::constr2', arg-desc CP#2
}
] constructor redirecting2(core::int a, core::int b, core::int c) → void
: this self::A::constr2(a, b.{core::num::*}(c))
;
}
class B extends self::A {
field core::int foo6 = 46;
static field core::int foo7 = 47;
static const field core::int foo8 = 48;
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack
Push FP[-5]
PushInt 46
StoreFieldTOS CP#0
Push FP[-5]
PushInt 49
PushConstant CP#3
IndirectStaticCall 2, CP#2
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = InstanceField #lib::B::foo6
[1] = Reserved
[2] = ArgDesc num-args 2, num-type-args 0, names []
[3] = StaticICData target '#lib::A::', arg-desc CP#2
}
] constructor •() → void
: super self::A::•(49)
;
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack
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
PushConstant CP#3
IndirectStaticCall 4, CP#2
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = InstanceField #lib::B::foo6
[1] = Reserved
[2] = ArgDesc num-args 4, num-type-args 0, names []
[3] = StaticICData target '#lib::A::redirecting2', arg-desc CP#2
}
] constructor c2(core::int i, core::int j) → void
: self::B::foo6 = 50, super self::A::redirecting2(i, j, 51)
;
}
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack
PushNull
ReturnTOS
}
ConstantPool {
}
]static method main() → dynamic {}