59e626e5c9
Previously MoveSpecial bytecode instruction used unsigned 8-bit A field to encode target local variable index. This is too restrictive as we allow signed 16-bit local variable indices. After this change MoveSpecial has A_X encoding, with A field used for special index (0 or 1), and signed 16-bit X field used for target local. Change-Id: Ib87992e192b2923a39a9968913c39476947d3ea5 Reviewed-on: https://dart-review.googlesource.com/c/81440 Commit-Queue: Alexander Markov <alexmarkov@google.com> Commit-Queue: Régis Crelier <regis@google.com> Reviewed-by: Régis Crelier <regis@google.com> Auto-Submit: Alexander Markov <alexmarkov@google.com>
291 lines
7.9 KiB
Plaintext
291 lines
7.9 KiB
Plaintext
library #lib;
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
|
|
[@vm.bytecode=
|
|
Bytecode (version: stable) {
|
|
EntryOptional 1, 2, 0
|
|
LoadConstant r1, CP#0
|
|
LoadConstant r2, CP#1
|
|
Frame 1
|
|
CheckStack
|
|
PushNull
|
|
PushInt 2
|
|
CreateArrayTOS
|
|
StoreLocal r3
|
|
Push r3
|
|
PushInt 0
|
|
PushConstant CP#2
|
|
StoreIndexedTOS
|
|
Push r3
|
|
PushInt 1
|
|
Push r0
|
|
StoreIndexedTOS
|
|
PushConstant CP#4
|
|
IndirectStaticCall 1, CP#3
|
|
PushConstant CP#5
|
|
IndirectStaticCall 1, CP#3
|
|
Drop1
|
|
PushNull
|
|
PushInt 2
|
|
CreateArrayTOS
|
|
StoreLocal r3
|
|
Push r3
|
|
PushInt 0
|
|
PushConstant CP#6
|
|
StoreIndexedTOS
|
|
Push r3
|
|
PushInt 1
|
|
Push r1
|
|
StoreIndexedTOS
|
|
PushConstant CP#7
|
|
IndirectStaticCall 1, CP#3
|
|
PushConstant CP#8
|
|
IndirectStaticCall 1, CP#3
|
|
Drop1
|
|
PushNull
|
|
PushInt 2
|
|
CreateArrayTOS
|
|
StoreLocal r3
|
|
Push r3
|
|
PushInt 0
|
|
PushConstant CP#9
|
|
StoreIndexedTOS
|
|
Push r3
|
|
PushInt 1
|
|
Push r2
|
|
StoreIndexedTOS
|
|
PushConstant CP#10
|
|
IndirectStaticCall 1, CP#3
|
|
PushConstant CP#11
|
|
IndirectStaticCall 1, CP#3
|
|
Drop1
|
|
PushNull
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
[0] = String 'default_a'
|
|
[1] = String 'default_b'
|
|
[2] = String 'x = '
|
|
[3] = ArgDesc num-args 1, num-type-args 0, names []
|
|
[4] = StaticICData target 'dart.core::_StringBase::_interpolate', arg-desc CP#3
|
|
[5] = StaticICData target 'dart.core::print', arg-desc CP#3
|
|
[6] = String 'a = '
|
|
[7] = StaticICData target 'dart.core::_StringBase::_interpolate', arg-desc CP#3
|
|
[8] = StaticICData target 'dart.core::print', arg-desc CP#3
|
|
[9] = String 'b = '
|
|
[10] = StaticICData target 'dart.core::_StringBase::_interpolate', arg-desc CP#3
|
|
[11] = StaticICData target 'dart.core::print', arg-desc CP#3
|
|
}
|
|
]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 (version: stable) {
|
|
EntryOptional 2, 0, 3
|
|
LoadConstant r2, CP#0
|
|
LoadConstant r2, CP#1
|
|
LoadConstant r3, CP#2
|
|
LoadConstant r3, CP#4
|
|
LoadConstant r4, CP#5
|
|
LoadConstant r4, CP#6
|
|
Frame 1
|
|
CheckStack
|
|
PushNull
|
|
PushInt 2
|
|
CreateArrayTOS
|
|
StoreLocal r5
|
|
Push r5
|
|
PushInt 0
|
|
PushConstant CP#7
|
|
StoreIndexedTOS
|
|
Push r5
|
|
PushInt 1
|
|
Push r0
|
|
StoreIndexedTOS
|
|
PushConstant CP#9
|
|
IndirectStaticCall 1, CP#8
|
|
PushConstant CP#10
|
|
IndirectStaticCall 1, CP#8
|
|
Drop1
|
|
PushNull
|
|
PushInt 2
|
|
CreateArrayTOS
|
|
StoreLocal r5
|
|
Push r5
|
|
PushInt 0
|
|
PushConstant CP#11
|
|
StoreIndexedTOS
|
|
Push r5
|
|
PushInt 1
|
|
Push r1
|
|
StoreIndexedTOS
|
|
PushConstant CP#12
|
|
IndirectStaticCall 1, CP#8
|
|
PushConstant CP#13
|
|
IndirectStaticCall 1, CP#8
|
|
Drop1
|
|
PushNull
|
|
PushInt 2
|
|
CreateArrayTOS
|
|
StoreLocal r5
|
|
Push r5
|
|
PushInt 0
|
|
PushConstant CP#14
|
|
StoreIndexedTOS
|
|
Push r5
|
|
PushInt 1
|
|
Push r2
|
|
StoreIndexedTOS
|
|
PushConstant CP#15
|
|
IndirectStaticCall 1, CP#8
|
|
PushConstant CP#16
|
|
IndirectStaticCall 1, CP#8
|
|
Drop1
|
|
PushNull
|
|
PushInt 2
|
|
CreateArrayTOS
|
|
StoreLocal r5
|
|
Push r5
|
|
PushInt 0
|
|
PushConstant CP#17
|
|
StoreIndexedTOS
|
|
Push r5
|
|
PushInt 1
|
|
Push r3
|
|
StoreIndexedTOS
|
|
PushConstant CP#18
|
|
IndirectStaticCall 1, CP#8
|
|
PushConstant CP#19
|
|
IndirectStaticCall 1, CP#8
|
|
Drop1
|
|
PushNull
|
|
PushInt 2
|
|
CreateArrayTOS
|
|
StoreLocal r5
|
|
Push r5
|
|
PushInt 0
|
|
PushConstant CP#20
|
|
StoreIndexedTOS
|
|
Push r5
|
|
PushInt 1
|
|
Push r4
|
|
StoreIndexedTOS
|
|
PushConstant CP#21
|
|
IndirectStaticCall 1, CP#8
|
|
PushConstant CP#22
|
|
IndirectStaticCall 1, CP#8
|
|
Drop1
|
|
PushNull
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
[0] = String 'a'
|
|
[1] = Int 42
|
|
[2] = String 'b'
|
|
[3] = String 'default_b'
|
|
[4] = List type-arg dart.core::String, entries CP# [3]
|
|
[5] = String 'c'
|
|
[6] = String 'default_c'
|
|
[7] = String 'y = '
|
|
[8] = ArgDesc num-args 1, num-type-args 0, names []
|
|
[9] = StaticICData target 'dart.core::_StringBase::_interpolate', arg-desc CP#8
|
|
[10] = StaticICData target 'dart.core::print', arg-desc CP#8
|
|
[11] = String 'z = '
|
|
[12] = StaticICData target 'dart.core::_StringBase::_interpolate', arg-desc CP#8
|
|
[13] = StaticICData target 'dart.core::print', arg-desc CP#8
|
|
[14] = String 'a = '
|
|
[15] = StaticICData target 'dart.core::_StringBase::_interpolate', arg-desc CP#8
|
|
[16] = StaticICData target 'dart.core::print', arg-desc CP#8
|
|
[17] = String 'b = '
|
|
[18] = StaticICData target 'dart.core::_StringBase::_interpolate', arg-desc CP#8
|
|
[19] = StaticICData target 'dart.core::print', arg-desc CP#8
|
|
[20] = String 'c = '
|
|
[21] = StaticICData target 'dart.core::_StringBase::_interpolate', arg-desc CP#8
|
|
[22] = StaticICData target 'dart.core::print', arg-desc CP#8
|
|
}
|
|
]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 (version: stable) {
|
|
EntryOptional 2, 0, 2
|
|
LoadConstant r2, CP#0
|
|
LoadConstant r2, CP#1
|
|
LoadConstant r3, CP#2
|
|
LoadConstant r3, CP#3
|
|
Frame 1
|
|
CheckStack
|
|
CheckFunctionTypeArgs 2, r4
|
|
PushNull
|
|
Push r4
|
|
InstantiateType CP#4
|
|
PushConstant CP#6
|
|
IndirectStaticCall 1, CP#5
|
|
Drop1
|
|
Push r1
|
|
PushConstant CP#7
|
|
IndirectStaticCall 1, CP#5
|
|
Drop1
|
|
Push r3
|
|
PushConstant CP#8
|
|
IndirectStaticCall 1, CP#5
|
|
Drop1
|
|
PushNull
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
[0] = String 'a'
|
|
[1] = Bool false
|
|
[2] = String 'b'
|
|
[3] = Null
|
|
[4] = Type #lib::foo3::P
|
|
[5] = ArgDesc num-args 1, num-type-args 0, names []
|
|
[6] = StaticICData target 'dart.core::print', arg-desc CP#5
|
|
[7] = StaticICData target 'dart.core::print', arg-desc CP#5
|
|
[8] = StaticICData target 'dart.core::print', arg-desc CP#5
|
|
}
|
|
]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 (version: stable) {
|
|
Entry 0
|
|
CheckStack
|
|
PushConstant CP#0
|
|
PushConstant CP#1
|
|
PushConstant CP#3
|
|
IndirectStaticCall 2, CP#2
|
|
Drop1
|
|
PushConstant CP#4
|
|
PushConstant CP#5
|
|
PushConstant CP#1
|
|
PushConstant CP#7
|
|
IndirectStaticCall 3, CP#6
|
|
Drop1
|
|
PushNull
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
[0] = String 'fixed_x'
|
|
[1] = String 'concrete_a'
|
|
[2] = ArgDesc num-args 2, num-type-args 0, names []
|
|
[3] = StaticICData target '#lib::foo1', arg-desc CP#2
|
|
[4] = String 'fixed_y'
|
|
[5] = String 'fixed_z'
|
|
[6] = ArgDesc num-args 3, num-type-args 0, names [a]
|
|
[7] = StaticICData target '#lib::foo2', arg-desc CP#6
|
|
}
|
|
]static method main() → dynamic {
|
|
self::foo1("fixed_x", "concrete_a");
|
|
self::foo2("fixed_y", "fixed_z", a: "concrete_a");
|
|
}
|