From 0d1abc535b2fce1e48349be0f69fa6d72b7c66ff Mon Sep 17 00:00:00 2001 From: Alexander Markov Date: Mon, 13 Aug 2018 22:46:59 +0000 Subject: [PATCH] [vm/kernel/bytecode] Initialize _Closure._delayed_type_arguments to Object::empty_type_arguments() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As TypeArguments == null means 'vector of all dynamic', VM uses special object (Object::empty_type_arguments()) to indicate absence of _Closure._delayed_type_arguments. This CL corrects bytecode to use Object::empty_type_arguments() (via new constant pool entry EmptyTypeArguments) to initialize _Closure._delayed_type_arguments when allocating a closure. Change-Id: I9b00bc0606de85c02350c8eef08d8952c3e224ee Reviewed-on: https://dart-review.googlesource.com/69840 Reviewed-by: Régis Crelier Commit-Queue: Alexander Markov --- pkg/vm/lib/bytecode/constant_pool.dart | 30 +- pkg/vm/lib/bytecode/gen_bytecode.dart | 6 +- pkg/vm/testcases/bytecode/async.dart.expect | 266 ++++++++++------- .../testcases/bytecode/closures.dart.expect | 277 +++++++++++------- .../testcases/bytecode/try_blocks.dart.expect | 195 ++++++------ .../vm/compiler/frontend/bytecode_reader.cc | 4 + 6 files changed, 468 insertions(+), 310 deletions(-) diff --git a/pkg/vm/lib/bytecode/constant_pool.dart b/pkg/vm/lib/bytecode/constant_pool.dart index e09d313e9e5..7aa3fc3403c 100644 --- a/pkg/vm/lib/bytecode/constant_pool.dart +++ b/pkg/vm/lib/bytecode/constant_pool.dart @@ -162,6 +162,10 @@ type ConstantPartialTearOffInstantiation extends ConstantPoolEntry { ConstantIndex typeArguments; } +type ConstantEmptyTypeArguments extends ConstantPoolEntry { + Byte tag = 25; +} + */ enum ConstantTag { @@ -189,7 +193,8 @@ enum ConstantTag { kEndClosureFunctionScope, kNativeEntry, kSubtypeTestCache, - kPartialTearOffInstantiation + kPartialTearOffInstantiation, + kEmptyTypeArguments, } abstract class ConstantPoolEntry { @@ -262,6 +267,8 @@ abstract class ConstantPoolEntry { return new ConstantSubtypeTestCache.readFromBinary(source); case ConstantTag.kPartialTearOffInstantiation: return new ConstantPartialTearOffInstantiation.readFromBinary(source); + case ConstantTag.kEmptyTypeArguments: + return new ConstantEmptyTypeArguments.readFromBinary(source); } throw 'Unexpected constant tag $tag'; } @@ -1094,6 +1101,27 @@ class ConstantPartialTearOffInstantiation extends ConstantPoolEntry { this.typeArgumentsConstantIndex == other.typeArgumentsConstantIndex; } +class ConstantEmptyTypeArguments extends ConstantPoolEntry { + const ConstantEmptyTypeArguments(); + + @override + ConstantTag get tag => ConstantTag.kEmptyTypeArguments; + + @override + void writeValueToBinary(BinarySink sink) {} + + ConstantEmptyTypeArguments.readFromBinary(BinarySource source); + + @override + String toString() => 'EmptyTypeArguments'; + + @override + int get hashCode => 997; + + @override + bool operator ==(other) => other is ConstantEmptyTypeArguments; +} + /// Reserved constant pool entry. class _ReservedConstantPoolEntry extends ConstantPoolEntry { const _ReservedConstantPoolEntry(); diff --git a/pkg/vm/lib/bytecode/gen_bytecode.dart b/pkg/vm/lib/bytecode/gen_bytecode.dart index 0892e676c7b..d103a854245 100644 --- a/pkg/vm/lib/bytecode/gen_bytecode.dart +++ b/pkg/vm/lib/bytecode/gen_bytecode.dart @@ -965,8 +965,10 @@ class BytecodeGenerator extends RecursiveVisitor { asm.emitStoreFieldTOS( cp.add(new ConstantInstanceField(closureFunctionTypeArguments))); - // TODO(alexmarkov): How to put Object::empty_type_arguments() - // to _delayed_type_arguments? + asm.emitPush(temp); + asm.emitPushConstant(cp.add(const ConstantEmptyTypeArguments())); + asm.emitStoreFieldTOS( + cp.add(new ConstantInstanceField(closureDelayedTypeArguments))); asm.emitPush(temp); asm.emitPushConstant(closureFunctionIndex); diff --git a/pkg/vm/testcases/bytecode/async.dart.expect b/pkg/vm/testcases/bytecode/async.dart.expect index 26fbf21201d..b08838dcd63 100644 --- a/pkg/vm/testcases/bytecode/async.dart.expect +++ b/pkg/vm/testcases/bytecode/async.dart.expect @@ -16,8 +16,11 @@ Bytecode { PushConstant CP#3 StoreFieldTOS CP#24 Push r2 + PushConstant CP#26 + StoreFieldTOS CP#27 + Push r2 PushConstant CP#0 - StoreFieldTOS CP#26 + StoreFieldTOS CP#29 Push r2 Push r0 StoreFieldTOS CP#1 @@ -50,15 +53,18 @@ ConstantPool { [23] = Reserved [24] = InstanceField dart.core::_Closure::_function_type_arguments [25] = Reserved - [26] = InstanceField dart.core::_Closure::_function - [27] = Reserved - [28] = StaticICData target 'dart.async::_asyncStackTraceHelper', arg-desc CP#8 - [29] = StaticICData target 'dart.async::_asyncThenWrapperHelper', arg-desc CP#8 - [30] = StaticICData target 'dart.async::_asyncErrorWrapperHelper', arg-desc CP#8 - [31] = TypeArgumentsForInstanceAllocation dart.async::Future [dynamic] - [32] = StaticICData target 'dart.async::Future::microtask', arg-desc CP#15 - [33] = ICData get target-name 'future', arg-desc CP#8 - [34] = EndClosureFunctionScope + [26] = EmptyTypeArguments + [27] = InstanceField dart.core::_Closure::_delayed_type_arguments + [28] = Reserved + [29] = InstanceField dart.core::_Closure::_function + [30] = Reserved + [31] = StaticICData target 'dart.async::_asyncStackTraceHelper', arg-desc CP#8 + [32] = StaticICData target 'dart.async::_asyncThenWrapperHelper', arg-desc CP#8 + [33] = StaticICData target 'dart.async::_asyncErrorWrapperHelper', arg-desc CP#8 + [34] = TypeArgumentsForInstanceAllocation dart.async::Future [dynamic] + [35] = StaticICData target 'dart.async::Future::microtask', arg-desc CP#15 + [36] = ICData get target-name 'future', arg-desc CP#8 + [37] = EndClosureFunctionScope } Closure CP#11 { EntryOptional 1, 3, 0 @@ -214,38 +220,41 @@ Closure CP#0 { PushConstant CP#3 StoreFieldTOS CP#24 Push r3 + PushConstant CP#26 + StoreFieldTOS CP#27 + Push r3 PushConstant CP#11 - StoreFieldTOS CP#26 + StoreFieldTOS CP#29 Push r3 Push r0 StoreFieldTOS CP#1 StoreContextVar 5 Push r0 LoadContextVar 5 - PushConstant CP#28 + PushConstant CP#31 IndirectStaticCall 1, CP#8 PopLocal r2 Push r0 Push r0 LoadContextVar 5 - PushConstant CP#29 + PushConstant CP#32 IndirectStaticCall 1, CP#8 StoreContextVar 3 Push r0 Push r0 LoadContextVar 5 - PushConstant CP#30 + PushConstant CP#33 IndirectStaticCall 1, CP#8 StoreContextVar 4 - PushConstant CP#31 + PushConstant CP#34 Push r0 LoadContextVar 5 - PushConstant CP#32 + PushConstant CP#35 IndirectStaticCall 2, CP#15 Drop1 Push r0 LoadContextVar 6 - InstanceCall 1, CP#33 + InstanceCall 1, CP#36 ReturnTOS Push r0 LoadContextParent @@ -321,32 +330,35 @@ Bytecode { PushConstant CP#3 StoreFieldTOS CP#18 Push r6 + PushConstant CP#20 + StoreFieldTOS CP#21 + Push r6 PushConstant CP#5 - StoreFieldTOS CP#20 + StoreFieldTOS CP#23 Push r6 Push r0 StoreFieldTOS CP#6 PopLocal r5 Push r5 - PushConstant CP#22 + PushConstant CP#25 IndirectStaticCall 1, CP#1 PopLocal r2 Push r5 - PushConstant CP#23 + PushConstant CP#26 IndirectStaticCall 1, CP#1 PopLocal r3 Push r5 - PushConstant CP#24 + PushConstant CP#27 IndirectStaticCall 1, CP#1 PopLocal r4 - PushConstant CP#25 + PushConstant CP#28 Push r5 - PushConstant CP#26 + PushConstant CP#29 IndirectStaticCall 2, CP#9 Drop1 Push r0 LoadContextVar 3 - InstanceCall 1, CP#27 + InstanceCall 1, CP#30 ReturnTOS Push r0 LoadContextParent @@ -375,14 +387,17 @@ ConstantPool { [17] = Reserved [18] = InstanceField dart.core::_Closure::_function_type_arguments [19] = Reserved - [20] = InstanceField dart.core::_Closure::_function - [21] = Reserved - [22] = StaticICData target 'dart.async::_asyncStackTraceHelper', arg-desc CP#1 - [23] = StaticICData target 'dart.async::_asyncThenWrapperHelper', arg-desc CP#1 - [24] = StaticICData target 'dart.async::_asyncErrorWrapperHelper', arg-desc CP#1 - [25] = TypeArgumentsForInstanceAllocation dart.async::Future [dynamic] - [26] = StaticICData target 'dart.async::Future::microtask', arg-desc CP#9 - [27] = ICData get target-name 'future', arg-desc CP#1 + [20] = EmptyTypeArguments + [21] = InstanceField dart.core::_Closure::_delayed_type_arguments + [22] = Reserved + [23] = InstanceField dart.core::_Closure::_function + [24] = Reserved + [25] = StaticICData target 'dart.async::_asyncStackTraceHelper', arg-desc CP#1 + [26] = StaticICData target 'dart.async::_asyncThenWrapperHelper', arg-desc CP#1 + [27] = StaticICData target 'dart.async::_asyncErrorWrapperHelper', arg-desc CP#1 + [28] = TypeArgumentsForInstanceAllocation dart.async::Future [dynamic] + [29] = StaticICData target 'dart.async::Future::microtask', arg-desc CP#9 + [30] = ICData get target-name 'future', arg-desc CP#1 } Closure CP#5 { EntryOptional 1, 3, 0 @@ -525,38 +540,41 @@ Bytecode { PushConstant CP#3 StoreFieldTOS CP#23 Push r3 + PushConstant CP#25 + StoreFieldTOS CP#26 + Push r3 PushConstant CP#5 - StoreFieldTOS CP#25 + StoreFieldTOS CP#28 Push r3 Push r0 StoreFieldTOS CP#6 StoreContextVar 5 Push r0 LoadContextVar 5 - PushConstant CP#27 + PushConstant CP#30 IndirectStaticCall 1, CP#1 PopLocal r2 Push r0 Push r0 LoadContextVar 5 - PushConstant CP#28 + PushConstant CP#31 IndirectStaticCall 1, CP#1 StoreContextVar 3 Push r0 Push r0 LoadContextVar 5 - PushConstant CP#29 + PushConstant CP#32 IndirectStaticCall 1, CP#1 StoreContextVar 4 - PushConstant CP#30 + PushConstant CP#33 Push r0 LoadContextVar 5 - PushConstant CP#31 + PushConstant CP#34 IndirectStaticCall 2, CP#13 Drop1 Push r0 LoadContextVar 8 - InstanceCall 1, CP#32 + InstanceCall 1, CP#35 ReturnTOS Push r0 LoadContextParent @@ -590,14 +608,17 @@ ConstantPool { [22] = Reserved [23] = InstanceField dart.core::_Closure::_function_type_arguments [24] = Reserved - [25] = InstanceField dart.core::_Closure::_function - [26] = Reserved - [27] = StaticICData target 'dart.async::_asyncStackTraceHelper', arg-desc CP#1 - [28] = StaticICData target 'dart.async::_asyncThenWrapperHelper', arg-desc CP#1 - [29] = StaticICData target 'dart.async::_asyncErrorWrapperHelper', arg-desc CP#1 - [30] = TypeArgumentsForInstanceAllocation dart.async::Future [dynamic] - [31] = StaticICData target 'dart.async::Future::microtask', arg-desc CP#13 - [32] = ICData get target-name 'future', arg-desc CP#1 + [25] = EmptyTypeArguments + [26] = InstanceField dart.core::_Closure::_delayed_type_arguments + [27] = Reserved + [28] = InstanceField dart.core::_Closure::_function + [29] = Reserved + [30] = StaticICData target 'dart.async::_asyncStackTraceHelper', arg-desc CP#1 + [31] = StaticICData target 'dart.async::_asyncThenWrapperHelper', arg-desc CP#1 + [32] = StaticICData target 'dart.async::_asyncErrorWrapperHelper', arg-desc CP#1 + [33] = TypeArgumentsForInstanceAllocation dart.async::Future [dynamic] + [34] = StaticICData target 'dart.async::Future::microtask', arg-desc CP#13 + [35] = ICData get target-name 'future', arg-desc CP#1 } Closure CP#5 { EntryOptional 1, 3, 0 @@ -817,38 +838,41 @@ Bytecode { PushConstant CP#3 StoreFieldTOS CP#35 Push r3 + PushConstant CP#37 + StoreFieldTOS CP#38 + Push r3 PushConstant CP#5 - StoreFieldTOS CP#37 + StoreFieldTOS CP#40 Push r3 Push r0 StoreFieldTOS CP#6 StoreContextVar 7 Push r0 LoadContextVar 7 - PushConstant CP#39 + PushConstant CP#42 IndirectStaticCall 1, CP#1 PopLocal r2 Push r0 Push r0 LoadContextVar 7 - PushConstant CP#40 + PushConstant CP#43 IndirectStaticCall 1, CP#1 StoreContextVar 5 Push r0 Push r0 LoadContextVar 7 - PushConstant CP#41 + PushConstant CP#44 IndirectStaticCall 1, CP#1 StoreContextVar 6 - PushConstant CP#42 + PushConstant CP#45 Push r0 LoadContextVar 7 - PushConstant CP#43 + PushConstant CP#46 IndirectStaticCall 2, CP#9 Drop1 Push r0 LoadContextVar 9 - InstanceCall 1, CP#44 + InstanceCall 1, CP#47 ReturnTOS Push r0 LoadContextParent @@ -894,14 +918,17 @@ ConstantPool { [34] = Reserved [35] = InstanceField dart.core::_Closure::_function_type_arguments [36] = Reserved - [37] = InstanceField dart.core::_Closure::_function - [38] = Reserved - [39] = StaticICData target 'dart.async::_asyncStackTraceHelper', arg-desc CP#1 - [40] = StaticICData target 'dart.async::_asyncThenWrapperHelper', arg-desc CP#1 - [41] = StaticICData target 'dart.async::_asyncErrorWrapperHelper', arg-desc CP#1 - [42] = TypeArgumentsForInstanceAllocation dart.async::Future [dynamic] - [43] = StaticICData target 'dart.async::Future::microtask', arg-desc CP#9 - [44] = ICData get target-name 'future', arg-desc CP#1 + [37] = EmptyTypeArguments + [38] = InstanceField dart.core::_Closure::_delayed_type_arguments + [39] = Reserved + [40] = InstanceField dart.core::_Closure::_function + [41] = Reserved + [42] = StaticICData target 'dart.async::_asyncStackTraceHelper', arg-desc CP#1 + [43] = StaticICData target 'dart.async::_asyncThenWrapperHelper', arg-desc CP#1 + [44] = StaticICData target 'dart.async::_asyncErrorWrapperHelper', arg-desc CP#1 + [45] = TypeArgumentsForInstanceAllocation dart.async::Future [dynamic] + [46] = StaticICData target 'dart.async::Future::microtask', arg-desc CP#9 + [47] = ICData get target-name 'future', arg-desc CP#1 } Closure CP#5 { EntryOptional 1, 3, 0 @@ -1293,38 +1320,41 @@ Bytecode { PushConstant CP#3 StoreFieldTOS CP#41 Push r3 + PushConstant CP#43 + StoreFieldTOS CP#44 + Push r3 PushConstant CP#5 - StoreFieldTOS CP#43 + StoreFieldTOS CP#46 Push r3 Push r0 StoreFieldTOS CP#6 StoreContextVar 8 Push r0 LoadContextVar 8 - PushConstant CP#45 + PushConstant CP#48 IndirectStaticCall 1, CP#1 PopLocal r2 Push r0 Push r0 LoadContextVar 8 - PushConstant CP#46 + PushConstant CP#49 IndirectStaticCall 1, CP#1 StoreContextVar 6 Push r0 Push r0 LoadContextVar 8 - PushConstant CP#47 + PushConstant CP#50 IndirectStaticCall 1, CP#1 StoreContextVar 7 - PushConstant CP#48 + PushConstant CP#51 Push r0 LoadContextVar 8 - PushConstant CP#49 + PushConstant CP#52 IndirectStaticCall 2, CP#11 Drop1 Push r0 LoadContextVar 12 - InstanceCall 1, CP#50 + InstanceCall 1, CP#53 ReturnTOS Push r0 LoadContextParent @@ -1376,14 +1406,17 @@ ConstantPool { [40] = Reserved [41] = InstanceField dart.core::_Closure::_function_type_arguments [42] = Reserved - [43] = InstanceField dart.core::_Closure::_function - [44] = Reserved - [45] = StaticICData target 'dart.async::_asyncStackTraceHelper', arg-desc CP#1 - [46] = StaticICData target 'dart.async::_asyncThenWrapperHelper', arg-desc CP#1 - [47] = StaticICData target 'dart.async::_asyncErrorWrapperHelper', arg-desc CP#1 - [48] = TypeArgumentsForInstanceAllocation dart.async::Future [dynamic] - [49] = StaticICData target 'dart.async::Future::microtask', arg-desc CP#11 - [50] = ICData get target-name 'future', arg-desc CP#1 + [43] = EmptyTypeArguments + [44] = InstanceField dart.core::_Closure::_delayed_type_arguments + [45] = Reserved + [46] = InstanceField dart.core::_Closure::_function + [47] = Reserved + [48] = StaticICData target 'dart.async::_asyncStackTraceHelper', arg-desc CP#1 + [49] = StaticICData target 'dart.async::_asyncThenWrapperHelper', arg-desc CP#1 + [50] = StaticICData target 'dart.async::_asyncErrorWrapperHelper', arg-desc CP#1 + [51] = TypeArgumentsForInstanceAllocation dart.async::Future [dynamic] + [52] = StaticICData target 'dart.async::Future::microtask', arg-desc CP#11 + [53] = ICData get target-name 'future', arg-desc CP#1 } Closure CP#5 { EntryOptional 1, 3, 0 @@ -1946,8 +1979,11 @@ Bytecode { PushConstant CP#7 StoreFieldTOS CP#29 Push r3 + PushConstant CP#31 + StoreFieldTOS CP#32 + Push r3 PushConstant CP#1 - StoreFieldTOS CP#31 + StoreFieldTOS CP#34 Push r3 Push r0 StoreFieldTOS CP#2 @@ -1992,15 +2028,18 @@ ConstantPool { [28] = Reserved [29] = InstanceField dart.core::_Closure::_function_type_arguments [30] = Reserved - [31] = InstanceField dart.core::_Closure::_function - [32] = Reserved - [33] = StaticICData target 'dart.async::_asyncStackTraceHelper', arg-desc CP#5 - [34] = StaticICData target 'dart.async::_asyncThenWrapperHelper', arg-desc CP#5 - [35] = StaticICData target 'dart.async::_asyncErrorWrapperHelper', arg-desc CP#5 - [36] = TypeArgumentsForInstanceAllocation dart.async::Future [dynamic] - [37] = StaticICData target 'dart.async::Future::microtask', arg-desc CP#15 - [38] = ICData get target-name 'future', arg-desc CP#5 - [39] = EndClosureFunctionScope + [31] = EmptyTypeArguments + [32] = InstanceField dart.core::_Closure::_delayed_type_arguments + [33] = Reserved + [34] = InstanceField dart.core::_Closure::_function + [35] = Reserved + [36] = StaticICData target 'dart.async::_asyncStackTraceHelper', arg-desc CP#5 + [37] = StaticICData target 'dart.async::_asyncThenWrapperHelper', arg-desc CP#5 + [38] = StaticICData target 'dart.async::_asyncErrorWrapperHelper', arg-desc CP#5 + [39] = TypeArgumentsForInstanceAllocation dart.async::Future [dynamic] + [40] = StaticICData target 'dart.async::Future::microtask', arg-desc CP#15 + [41] = ICData get target-name 'future', arg-desc CP#5 + [42] = EndClosureFunctionScope } Closure CP#9 { EntryOptional 1, 3, 0 @@ -2229,38 +2268,41 @@ Closure CP#1 { PushConstant CP#7 StoreFieldTOS CP#29 Push r3 + PushConstant CP#31 + StoreFieldTOS CP#32 + Push r3 PushConstant CP#9 - StoreFieldTOS CP#31 + StoreFieldTOS CP#34 Push r3 Push r0 StoreFieldTOS CP#2 StoreContextVar 6 Push r0 LoadContextVar 6 - PushConstant CP#33 + PushConstant CP#36 IndirectStaticCall 1, CP#5 PopLocal r2 Push r0 Push r0 LoadContextVar 6 - PushConstant CP#34 + PushConstant CP#37 IndirectStaticCall 1, CP#5 StoreContextVar 4 Push r0 Push r0 LoadContextVar 6 - PushConstant CP#35 + PushConstant CP#38 IndirectStaticCall 1, CP#5 StoreContextVar 5 - PushConstant CP#36 + PushConstant CP#39 Push r0 LoadContextVar 6 - PushConstant CP#37 + PushConstant CP#40 IndirectStaticCall 2, CP#15 Drop1 Push r0 LoadContextVar 8 - InstanceCall 1, CP#38 + InstanceCall 1, CP#41 ReturnTOS Push r0 LoadContextParent @@ -2361,38 +2403,41 @@ Bytecode { PushConstant CP#3 StoreFieldTOS CP#25 Push r3 + PushConstant CP#27 + StoreFieldTOS CP#28 + Push r3 PushConstant CP#5 - StoreFieldTOS CP#27 + StoreFieldTOS CP#30 Push r3 Push r0 StoreFieldTOS CP#6 StoreContextVar 5 Push r0 LoadContextVar 5 - PushConstant CP#29 + PushConstant CP#32 IndirectStaticCall 1, CP#1 PopLocal r2 Push r0 Push r0 LoadContextVar 5 - PushConstant CP#30 + PushConstant CP#33 IndirectStaticCall 1, CP#1 StoreContextVar 3 Push r0 Push r0 LoadContextVar 5 - PushConstant CP#31 + PushConstant CP#34 IndirectStaticCall 1, CP#1 StoreContextVar 4 - PushConstant CP#32 + PushConstant CP#35 Push r0 LoadContextVar 5 - PushConstant CP#33 + PushConstant CP#36 IndirectStaticCall 2, CP#12 Drop1 Push r0 LoadContextVar 7 - InstanceCall 1, CP#34 + InstanceCall 1, CP#37 ReturnTOS Push r0 LoadContextParent @@ -2428,14 +2473,17 @@ ConstantPool { [24] = Reserved [25] = InstanceField dart.core::_Closure::_function_type_arguments [26] = Reserved - [27] = InstanceField dart.core::_Closure::_function - [28] = Reserved - [29] = StaticICData target 'dart.async::_asyncStackTraceHelper', arg-desc CP#1 - [30] = StaticICData target 'dart.async::_asyncThenWrapperHelper', arg-desc CP#1 - [31] = StaticICData target 'dart.async::_asyncErrorWrapperHelper', arg-desc CP#1 - [32] = TypeArgumentsForInstanceAllocation dart.async::Future [dynamic] - [33] = StaticICData target 'dart.async::Future::microtask', arg-desc CP#12 - [34] = ICData get target-name 'future', arg-desc CP#1 + [27] = EmptyTypeArguments + [28] = InstanceField dart.core::_Closure::_delayed_type_arguments + [29] = Reserved + [30] = InstanceField dart.core::_Closure::_function + [31] = Reserved + [32] = StaticICData target 'dart.async::_asyncStackTraceHelper', arg-desc CP#1 + [33] = StaticICData target 'dart.async::_asyncThenWrapperHelper', arg-desc CP#1 + [34] = StaticICData target 'dart.async::_asyncErrorWrapperHelper', arg-desc CP#1 + [35] = TypeArgumentsForInstanceAllocation dart.async::Future [dynamic] + [36] = StaticICData target 'dart.async::Future::microtask', arg-desc CP#12 + [37] = ICData get target-name 'future', arg-desc CP#1 } Closure CP#5 { EntryOptional 1, 3, 0 diff --git a/pkg/vm/testcases/bytecode/closures.dart.expect b/pkg/vm/testcases/bytecode/closures.dart.expect index c3eba73836c..9fe49260117 100644 --- a/pkg/vm/testcases/bytecode/closures.dart.expect +++ b/pkg/vm/testcases/bytecode/closures.dart.expect @@ -212,19 +212,22 @@ Bytecode { Push r0 StoreFieldTOS CP#3 Push r4 + PushConstant CP#41 + StoreFieldTOS CP#42 + Push r4 PushConstant CP#0 - StoreFieldTOS CP#41 + StoreFieldTOS CP#44 Push r4 Push r1 StoreFieldTOS CP#1 PopLocal r3 - PushConstant CP#51 + PushConstant CP#54 Push r3 - InstanceCall 2, CP#52 + InstanceCall 2, CP#55 Drop1 - PushConstant CP#53 + PushConstant CP#56 Push r3 - InstanceCall 2, CP#54 + InstanceCall 2, CP#57 Drop1 PushConstant CP#18 ReturnTOS @@ -271,20 +274,23 @@ ConstantPool { [38] = Class dart.core::_Closure [39] = InstanceField dart.core::_Closure::_instantiator_type_arguments [40] = Reserved - [41] = InstanceField dart.core::_Closure::_function - [42] = Reserved - [43] = ICData target-name 'call', arg-desc CP#32 - [44] = EndClosureFunctionScope - [45] = TypeArgs [#lib::C7, #lib::C8] - [46] = ArgDesc num-args 1, num-type-args 2, names [] - [47] = ICData target-name 'call', arg-desc CP#46 - [48] = TypeArgs [dart.core::List<#lib::C7>, dart.core::List<#lib::C8>] - [49] = ICData target-name 'call', arg-desc CP#46 - [50] = EndClosureFunctionScope - [51] = TypeArgs [#lib::C5, #lib::C6] - [52] = ICData target-name 'call', arg-desc CP#46 - [53] = TypeArgs [dart.core::List<#lib::C5>, dart.core::List<#lib::C6>] - [54] = ICData target-name 'call', arg-desc CP#46 + [41] = EmptyTypeArguments + [42] = InstanceField dart.core::_Closure::_delayed_type_arguments + [43] = Reserved + [44] = InstanceField dart.core::_Closure::_function + [45] = Reserved + [46] = ICData target-name 'call', arg-desc CP#32 + [47] = EndClosureFunctionScope + [48] = TypeArgs [#lib::C7, #lib::C8] + [49] = ArgDesc num-args 1, num-type-args 2, names [] + [50] = ICData target-name 'call', arg-desc CP#49 + [51] = TypeArgs [dart.core::List<#lib::C7>, dart.core::List<#lib::C8>] + [52] = ICData target-name 'call', arg-desc CP#49 + [53] = EndClosureFunctionScope + [54] = TypeArgs [#lib::C5, #lib::C6] + [55] = ICData target-name 'call', arg-desc CP#49 + [56] = TypeArgs [dart.core::List<#lib::C5>, dart.core::List<#lib::C6>] + [57] = ICData target-name 'call', arg-desc CP#49 } Closure CP#12 { Entry 4 @@ -397,14 +403,17 @@ Closure CP#9 { Push r0 StoreFieldTOS CP#3 Push r4 + PushConstant CP#41 + StoreFieldTOS CP#42 + Push r4 PushConstant CP#12 - StoreFieldTOS CP#41 + StoreFieldTOS CP#44 Push r4 Push r1 StoreFieldTOS CP#1 PopLocal r3 Push r3 - InstanceCall 1, CP#43 + InstanceCall 1, CP#46 Drop1 PushConstant CP#18 ReturnTOS @@ -437,19 +446,22 @@ Closure CP#0 { Push r0 StoreFieldTOS CP#3 Push r4 + PushConstant CP#41 + StoreFieldTOS CP#42 + Push r4 PushConstant CP#9 - StoreFieldTOS CP#41 + StoreFieldTOS CP#44 Push r4 Push r1 StoreFieldTOS CP#1 PopLocal r3 - PushConstant CP#45 - Push r3 - InstanceCall 2, CP#47 - Drop1 PushConstant CP#48 Push r3 - InstanceCall 2, CP#49 + InstanceCall 2, CP#50 + Drop1 + PushConstant CP#51 + Push r3 + InstanceCall 2, CP#52 Drop1 PushConstant CP#18 ReturnTOS @@ -530,27 +542,30 @@ Bytecode { PushConstant CP#6 StoreFieldTOS CP#25 Push r4 + PushConstant CP#27 + StoreFieldTOS CP#28 + Push r4 PushConstant CP#3 - StoreFieldTOS CP#27 + StoreFieldTOS CP#30 Push r4 Push r0 StoreFieldTOS CP#4 PopLocal r3 Push r3 - PushConstant CP#32 - InstanceCall 2, CP#33 + PushConstant CP#35 + InstanceCall 2, CP#36 Drop1 Push r3 - PushConstant CP#34 - InstanceCall 2, CP#35 + PushConstant CP#37 + InstanceCall 2, CP#38 Drop1 Push r2 - PushConstant CP#36 + PushConstant CP#39 IndirectStaticCall 1, CP#18 Drop1 Push r0 LoadContextVar 0 - PushConstant CP#37 + PushConstant CP#40 IndirectStaticCall 1, CP#18 Drop1 Push r0 @@ -558,7 +573,7 @@ Bytecode { PopLocal r0 Push r0 LoadContextVar 0 - PushConstant CP#38 + PushConstant CP#41 IndirectStaticCall 1, CP#18 Drop1 Push r0 @@ -571,7 +586,7 @@ Bytecode { StoreContextParent PopLocal r0 Push r0 - PushConstant CP#39 + PushConstant CP#42 StoreContextVar 0 Allocate CP#22 StoreLocal r3 @@ -582,14 +597,17 @@ Bytecode { PushConstant CP#6 StoreFieldTOS CP#25 Push r3 - PushConstant CP#40 - StoreFieldTOS CP#27 + PushConstant CP#27 + StoreFieldTOS CP#28 + Push r3 + PushConstant CP#43 + StoreFieldTOS CP#30 Push r3 Push r0 StoreFieldTOS CP#4 PopLocal r2 Push r2 - InstanceCall 1, CP#43 + InstanceCall 1, CP#46 Drop1 Push r0 LoadContextParent @@ -625,23 +643,26 @@ ConstantPool { [24] = Reserved [25] = InstanceField dart.core::_Closure::_function_type_arguments [26] = Reserved - [27] = InstanceField dart.core::_Closure::_function - [28] = Reserved - [29] = ICData target-name 'call', arg-desc CP#18 - [30] = StaticICData target 'dart.core::print', arg-desc CP#18 - [31] = EndClosureFunctionScope - [32] = Int 10 - [33] = ICData target-name 'call', arg-desc CP#10 - [34] = Int 11 - [35] = ICData target-name 'call', arg-desc CP#10 - [36] = StaticICData target 'dart.core::print', arg-desc CP#18 - [37] = StaticICData target 'dart.core::print', arg-desc CP#18 - [38] = StaticICData target 'dart.core::print', arg-desc CP#18 - [39] = Int 42 - [40] = ClosureFunction () → dart.core::Null; - [41] = ICData set target-name 'foo', arg-desc CP#10 - [42] = EndClosureFunctionScope - [43] = ICData target-name 'call', arg-desc CP#18 + [27] = EmptyTypeArguments + [28] = InstanceField dart.core::_Closure::_delayed_type_arguments + [29] = Reserved + [30] = InstanceField dart.core::_Closure::_function + [31] = Reserved + [32] = ICData target-name 'call', arg-desc CP#18 + [33] = StaticICData target 'dart.core::print', arg-desc CP#18 + [34] = EndClosureFunctionScope + [35] = Int 10 + [36] = ICData target-name 'call', arg-desc CP#10 + [37] = Int 11 + [38] = ICData target-name 'call', arg-desc CP#10 + [39] = StaticICData target 'dart.core::print', arg-desc CP#18 + [40] = StaticICData target 'dart.core::print', arg-desc CP#18 + [41] = StaticICData target 'dart.core::print', arg-desc CP#18 + [42] = Int 42 + [43] = ClosureFunction () → dart.core::Null; + [44] = ICData set target-name 'foo', arg-desc CP#10 + [45] = EndClosureFunctionScope + [46] = ICData target-name 'call', arg-desc CP#18 } Closure CP#16 { Entry 3 @@ -742,18 +763,21 @@ Closure CP#3 { PushConstant CP#6 StoreFieldTOS CP#25 Push r2 + PushConstant CP#27 + StoreFieldTOS CP#28 + Push r2 PushConstant CP#16 - StoreFieldTOS CP#27 + StoreFieldTOS CP#30 Push r2 Push r0 StoreFieldTOS CP#4 PopLocal r3 Push r3 - InstanceCall 1, CP#29 + InstanceCall 1, CP#32 Drop1 Push r0 LoadContextVar 0 - PushConstant CP#30 + PushConstant CP#33 IndirectStaticCall 1, CP#18 Drop1 Push r0 @@ -765,7 +789,7 @@ L1: } -Closure CP#40 { +Closure CP#43 { Entry 3 CheckStack Push FP[-5] @@ -776,7 +800,7 @@ Closure CP#40 { LoadContextVar 0 Push r0 LoadContextVar 0 - InstanceCall 2, CP#41 + InstanceCall 2, CP#44 Drop1 PushConstant CP#6 ReturnTOS @@ -896,12 +920,15 @@ L2: PushConstant CP#12 StoreFieldTOS CP#17 Push r3 + PushConstant CP#19 + StoreFieldTOS CP#20 + Push r3 PushConstant CP#8 - StoreFieldTOS CP#19 + StoreFieldTOS CP#22 Push r3 Push r0 StoreFieldTOS CP#9 - InstanceCall 2, CP#21 + InstanceCall 2, CP#24 Drop1 Push r4 Allocate CP#14 @@ -913,12 +940,15 @@ L2: PushConstant CP#12 StoreFieldTOS CP#17 Push r3 - PushConstant CP#22 - StoreFieldTOS CP#19 + PushConstant CP#19 + StoreFieldTOS CP#20 + Push r3 + PushConstant CP#25 + StoreFieldTOS CP#22 Push r3 Push r0 StoreFieldTOS CP#9 - InstanceCall 2, CP#28 + InstanceCall 2, CP#31 Drop1 Push r0 CloneContext @@ -926,8 +956,8 @@ L2: Push r0 Push r0 LoadContextVar 0 - PushConstant CP#29 - InstanceCall 2, CP#30 + PushConstant CP#32 + InstanceCall 2, CP#33 StoreLocal r3 StoreContextVar 0 Push r3 @@ -963,18 +993,21 @@ ConstantPool { [16] = Reserved [17] = InstanceField dart.core::_Closure::_function_type_arguments [18] = Reserved - [19] = InstanceField dart.core::_Closure::_function - [20] = Reserved - [21] = ICData target-name 'add', arg-desc CP#2 - [22] = ClosureFunction (dart.core::int ii) → dart.core::Null; - [23] = Type dart.core::int - [24] = String 'ii' - [25] = SubtypeTestCache - [26] = ICData target-name '+', arg-desc CP#2 - [27] = EndClosureFunctionScope - [28] = ICData target-name 'add', arg-desc CP#2 - [29] = Int 1 - [30] = ICData target-name '+', arg-desc CP#2 + [19] = EmptyTypeArguments + [20] = InstanceField dart.core::_Closure::_delayed_type_arguments + [21] = Reserved + [22] = InstanceField dart.core::_Closure::_function + [23] = Reserved + [24] = ICData target-name 'add', arg-desc CP#2 + [25] = ClosureFunction (dart.core::int ii) → dart.core::Null; + [26] = Type dart.core::int + [27] = String 'ii' + [28] = SubtypeTestCache + [29] = ICData target-name '+', arg-desc CP#2 + [30] = EndClosureFunctionScope + [31] = ICData target-name 'add', arg-desc CP#2 + [32] = Int 1 + [33] = ICData target-name '+', arg-desc CP#2 } Closure CP#8 { Entry 2 @@ -994,7 +1027,7 @@ Closure CP#8 { } -Closure CP#22 { +Closure CP#25 { Entry 3 CheckStack Push FP[-6] @@ -1003,16 +1036,16 @@ Closure CP#22 { Push FP[-5] PushConstant CP#12 PushConstant CP#12 - PushConstant CP#23 - PushConstant CP#24 - AssertAssignable 1, CP#25 + PushConstant CP#26 + PushConstant CP#27 + AssertAssignable 1, CP#28 Drop1 Push r0 Push FP[-5] Push r0 LoadContextParent LoadContextVar 0 - InstanceCall 2, CP#26 + InstanceCall 2, CP#29 StoreContextVar 0 PushConstant CP#12 ReturnTOS @@ -1069,18 +1102,21 @@ L2: PushConstant CP#0 StoreFieldTOS CP#19 Push r4 + PushConstant CP#21 + StoreFieldTOS CP#22 + Push r4 PushConstant CP#9 - StoreFieldTOS CP#21 + StoreFieldTOS CP#24 Push r4 Push r0 StoreFieldTOS CP#10 PopLocal r3 Push r3 - InstanceCall 1, CP#23 + InstanceCall 1, CP#26 Drop1 Push r0 LoadContextVar 0 - PushConstant CP#24 + PushConstant CP#27 IndirectStaticCall 1, CP#4 Drop1 Push r0 @@ -1113,10 +1149,13 @@ ConstantPool { [18] = Reserved [19] = InstanceField dart.core::_Closure::_function_type_arguments [20] = Reserved - [21] = InstanceField dart.core::_Closure::_function - [22] = Reserved - [23] = ICData target-name 'call', arg-desc CP#4 - [24] = StaticICData target 'dart.core::print', arg-desc CP#4 + [21] = EmptyTypeArguments + [22] = InstanceField dart.core::_Closure::_delayed_type_arguments + [23] = Reserved + [24] = InstanceField dart.core::_Closure::_function + [25] = Reserved + [26] = ICData target-name 'call', arg-desc CP#4 + [27] = StaticICData target 'dart.core::print', arg-desc CP#4 } Closure CP#9 { Entry 3 @@ -1191,8 +1230,11 @@ Bytecode { PushConstant CP#1 StoreFieldTOS CP#12 Push r2 + PushConstant CP#14 + StoreFieldTOS CP#15 + Push r2 PushConstant CP#5 - StoreFieldTOS CP#14 + StoreFieldTOS CP#17 Push r2 Push r0 StoreFieldTOS CP#6 @@ -1215,8 +1257,11 @@ ConstantPool { [11] = Reserved [12] = InstanceField dart.core::_Closure::_function_type_arguments [13] = Reserved - [14] = InstanceField dart.core::_Closure::_function - [15] = Reserved + [14] = EmptyTypeArguments + [15] = InstanceField dart.core::_Closure::_delayed_type_arguments + [16] = Reserved + [17] = InstanceField dart.core::_Closure::_function + [18] = Reserved } Closure CP#5 { Entry 2 @@ -1257,15 +1302,18 @@ Bytecode { PushConstant CP#4 StoreFieldTOS CP#14 Push r3 + PushConstant CP#16 + StoreFieldTOS CP#17 + Push r3 PushConstant CP#1 - StoreFieldTOS CP#16 + StoreFieldTOS CP#19 Push r3 Push r0 StoreFieldTOS CP#2 PopLocal r2 Push r2 - PushConstant CP#18 - InstanceCall 2, CP#19 + PushConstant CP#21 + InstanceCall 2, CP#22 Drop1 Push r0 LoadContextVar 0 @@ -1293,10 +1341,13 @@ ConstantPool { [13] = Reserved [14] = InstanceField dart.core::_Closure::_function_type_arguments [15] = Reserved - [16] = InstanceField dart.core::_Closure::_function - [17] = Reserved - [18] = Int 3 - [19] = ICData target-name 'call', arg-desc CP#8 + [16] = EmptyTypeArguments + [17] = InstanceField dart.core::_Closure::_delayed_type_arguments + [18] = Reserved + [19] = InstanceField dart.core::_Closure::_function + [20] = Reserved + [21] = Int 3 + [22] = ICData target-name 'call', arg-desc CP#8 } Closure CP#1 { Entry 3 @@ -1498,8 +1549,11 @@ Bytecode { PushConstant CP#9 StoreFieldTOS CP#3 Push r3 + PushConstant CP#17 + StoreFieldTOS CP#18 + Push r3 PushConstant CP#0 - StoreFieldTOS CP#17 + StoreFieldTOS CP#20 Push r3 Push r0 StoreFieldTOS CP#1 @@ -1508,8 +1562,8 @@ Bytecode { PopLocal r3 Allocate CP#14 StoreLocal r5 - PushConstant CP#19 - StoreFieldTOS CP#20 + PushConstant CP#22 + StoreFieldTOS CP#18 Push r5 Push r3 LoadFieldTOS CP#15 @@ -1520,8 +1574,8 @@ Bytecode { StoreFieldTOS CP#3 Push r5 Push r3 - LoadFieldTOS CP#17 - StoreFieldTOS CP#17 + LoadFieldTOS CP#20 + StoreFieldTOS CP#20 Push r5 Push r3 LoadFieldTOS CP#1 @@ -1551,11 +1605,12 @@ ConstantPool { [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] = InstanceField dart.core::_Closure::_delayed_type_arguments + [17] = EmptyTypeArguments + [18] = InstanceField dart.core::_Closure::_delayed_type_arguments + [19] = Reserved + [20] = InstanceField dart.core::_Closure::_function [21] = Reserved + [22] = TypeArgs [dart.core::int] } Closure CP#0 { Entry 3 diff --git a/pkg/vm/testcases/bytecode/try_blocks.dart.expect b/pkg/vm/testcases/bytecode/try_blocks.dart.expect index 8690f11a1bd..58275a3cc5c 100644 --- a/pkg/vm/testcases/bytecode/try_blocks.dart.expect +++ b/pkg/vm/testcases/bytecode/try_blocks.dart.expect @@ -280,18 +280,21 @@ Try #0 start: PushConstant CP#11 StoreFieldTOS CP#16 Push r5 + PushConstant CP#18 + StoreFieldTOS CP#19 + Push r5 PushConstant CP#2 - StoreFieldTOS CP#18 + StoreFieldTOS CP#21 Push r5 Push r0 StoreFieldTOS CP#3 PopLocal r4 Push r4 - InstanceCall 1, CP#20 + InstanceCall 1, CP#23 Drop1 Push r0 LoadContextVar 0 - PushConstant CP#21 + PushConstant CP#24 IndirectStaticCall 1, CP#6 Drop1 Push r0 @@ -316,12 +319,12 @@ Try #0 handler: Push r3 StoreContextVar 0 PushConstant CP#11 - PushConstant CP#22 + PushConstant CP#25 CreateArrayTOS StoreLocal r5 Push r5 - PushConstant CP#23 - PushConstant CP#24 + PushConstant CP#26 + PushConstant CP#27 StoreIndexedTOS Push r5 PushConstant CP#0 @@ -329,16 +332,16 @@ Try #0 handler: StoreIndexedTOS Push r5 PushConstant CP#1 - PushConstant CP#25 + PushConstant CP#28 StoreIndexedTOS Push r5 PushConstant CP#10 Push r0 LoadContextVar 0 StoreIndexedTOS - PushConstant CP#26 + PushConstant CP#29 IndirectStaticCall 1, CP#6 - PushConstant CP#27 + PushConstant CP#30 IndirectStaticCall 1, CP#6 Drop1 Allocate CP#13 @@ -350,8 +353,11 @@ Try #0 handler: PushConstant CP#11 StoreFieldTOS CP#16 Push r5 - PushConstant CP#28 - StoreFieldTOS CP#18 + PushConstant CP#18 + StoreFieldTOS CP#19 + Push r5 + PushConstant CP#31 + StoreFieldTOS CP#21 Push r5 Push r0 StoreFieldTOS CP#3 @@ -370,7 +376,7 @@ L1: ReturnTOS } ExceptionsTable { - try-index 0, outer -1, start 13, end 49, handler 49, needs-stack-trace, types [CP#8] + try-index 0, outer -1, start 13, end 52, handler 52, needs-stack-trace, types [CP#8] } ConstantPool { [0] = Int 1 @@ -391,28 +397,31 @@ ConstantPool { [15] = Reserved [16] = InstanceField dart.core::_Closure::_function_type_arguments [17] = Reserved - [18] = InstanceField dart.core::_Closure::_function - [19] = Reserved - [20] = ICData target-name 'call', arg-desc CP#6 - [21] = StaticICData target 'dart.core::print', arg-desc CP#6 - [22] = Int 4 - [23] = Int 0 - [24] = String 'caught ' - [25] = String ' ' - [26] = StaticICData target 'dart.core::_StringBase::_interpolate', arg-desc CP#6 - [27] = StaticICData target 'dart.core::print', arg-desc CP#6 - [28] = ClosureFunction bar () → void; - [29] = String 'danger bar' + [18] = EmptyTypeArguments + [19] = InstanceField dart.core::_Closure::_delayed_type_arguments + [20] = Reserved + [21] = InstanceField dart.core::_Closure::_function + [22] = Reserved + [23] = ICData target-name 'call', arg-desc CP#6 + [24] = StaticICData target 'dart.core::print', arg-desc CP#6 + [25] = Int 4 + [26] = Int 0 + [27] = String 'caught ' + [28] = String ' ' + [29] = StaticICData target 'dart.core::_StringBase::_interpolate', arg-desc CP#6 [30] = StaticICData target 'dart.core::print', arg-desc CP#6 - [31] = Type dart.core::Error - [32] = ArgDesc num-args 4, num-type-args 0, names [] - [33] = ICData target-name 'dart.core::_instanceOf', arg-desc CP#32 - [34] = Bool true - [35] = String 'error ' - [36] = String ', captured stack trace: ' - [37] = StaticICData target 'dart.core::_StringBase::_interpolate', arg-desc CP#6 - [38] = StaticICData target 'dart.core::print', arg-desc CP#6 - [39] = EndClosureFunctionScope + [31] = ClosureFunction bar () → void; + [32] = String 'danger bar' + [33] = StaticICData target 'dart.core::print', arg-desc CP#6 + [34] = Type dart.core::Error + [35] = ArgDesc num-args 4, num-type-args 0, names [] + [36] = ICData target-name 'dart.core::_instanceOf', arg-desc CP#35 + [37] = Bool true + [38] = String 'error ' + [39] = String ', captured stack trace: ' + [40] = StaticICData target 'dart.core::_StringBase::_interpolate', arg-desc CP#6 + [41] = StaticICData target 'dart.core::print', arg-desc CP#6 + [42] = EndClosureFunctionScope } Closure CP#2 { Entry 6 @@ -452,7 +461,7 @@ L1: } -Closure CP#28 { +Closure CP#31 { Entry 6 CheckStack Push FP[-5] @@ -461,8 +470,8 @@ Closure CP#28 { Push r0 PopLocal r2 Try #0 start: - PushConstant CP#29 - PushConstant CP#30 + PushConstant CP#32 + PushConstant CP#33 IndirectStaticCall 1, CP#6 Drop1 Jump L1 @@ -475,20 +484,20 @@ Try #0 handler: Push r2 PushConstant CP#11 PushConstant CP#11 - PushConstant CP#31 - InstanceCall 4, CP#33 PushConstant CP#34 + InstanceCall 4, CP#36 + PushConstant CP#37 IfNeStrictTOS Jump L2 Push r2 PopLocal r4 PushConstant CP#11 - PushConstant CP#22 + PushConstant CP#25 CreateArrayTOS StoreLocal r5 Push r5 - PushConstant CP#23 - PushConstant CP#35 + PushConstant CP#26 + PushConstant CP#38 StoreIndexedTOS Push r5 PushConstant CP#0 @@ -496,16 +505,16 @@ Try #0 handler: StoreIndexedTOS Push r5 PushConstant CP#1 - PushConstant CP#36 + PushConstant CP#39 StoreIndexedTOS Push r5 PushConstant CP#10 Push r0 LoadContextVar 0 StoreIndexedTOS - PushConstant CP#37 + PushConstant CP#40 IndirectStaticCall 1, CP#6 - PushConstant CP#38 + PushConstant CP#41 IndirectStaticCall 1, CP#6 Drop1 Jump L1 @@ -807,14 +816,17 @@ Try #1 start: PushConstant CP#17 StoreFieldTOS CP#22 Push r8 + PushConstant CP#24 + StoreFieldTOS CP#25 + Push r8 PushConstant CP#12 - StoreFieldTOS CP#24 + StoreFieldTOS CP#27 Push r8 Push r0 StoreFieldTOS CP#13 PopLocal r7 Push r7 - InstanceCall 1, CP#26 + InstanceCall 1, CP#29 Drop1 Jump L4 Jump L5 @@ -824,8 +836,8 @@ Try #1 handler: PopLocal r0 MoveSpecial r5, exception MoveSpecial r6, stackTrace - PushConstant CP#28 - PushConstant CP#29 + PushConstant CP#31 + PushConstant CP#32 IndirectStaticCall 1, CP#7 Drop1 Push r5 @@ -834,20 +846,20 @@ Try #1 handler: L4: Push r5 PopLocal r0 - PushConstant CP#28 - PushConstant CP#30 + PushConstant CP#31 + PushConstant CP#33 IndirectStaticCall 1, CP#7 Drop1 Jump L6 L5: Push r5 PopLocal r0 - PushConstant CP#28 PushConstant CP#31 + PushConstant CP#34 IndirectStaticCall 1, CP#7 Drop1 - PushConstant CP#32 - PushConstant CP#33 + PushConstant CP#35 + PushConstant CP#36 IndirectStaticCall 1, CP#7 Drop1 Push r0 @@ -860,8 +872,8 @@ Try #0 handler: PopLocal r0 MoveSpecial r3, exception MoveSpecial r4, stackTrace - PushConstant CP#34 - PushConstant CP#35 + PushConstant CP#37 + PushConstant CP#38 IndirectStaticCall 1, CP#7 Drop1 Push r3 @@ -870,22 +882,22 @@ Try #0 handler: L6: Push r3 PopLocal r0 - PushConstant CP#34 - PushConstant CP#36 + PushConstant CP#37 + PushConstant CP#39 IndirectStaticCall 1, CP#7 Drop1 Jump L2 L7: Push r3 PopLocal r0 - PushConstant CP#34 PushConstant CP#37 + PushConstant CP#40 IndirectStaticCall 1, CP#7 Drop1 Jump L3 L2: - PushConstant CP#38 - PushConstant CP#39 + PushConstant CP#41 + PushConstant CP#42 IndirectStaticCall 1, CP#7 Drop1 Jump L3 @@ -894,8 +906,8 @@ L3: ReturnTOS } ExceptionsTable { - try-index 0, outer -1, start 25, end 96, handler 96, needs-stack-trace, types [CP#27] - try-index 1, outer 0, start 40, end 64, handler 64, needs-stack-trace, types [CP#27] + try-index 0, outer -1, start 25, end 99, handler 99, needs-stack-trace, types [CP#30] + try-index 1, outer 0, start 40, end 67, handler 67, needs-stack-trace, types [CP#30] } ConstantPool { [0] = ArgDesc num-args 2, num-type-args 0, names [] @@ -922,22 +934,25 @@ ConstantPool { [21] = Reserved [22] = InstanceField dart.core::_Closure::_function_type_arguments [23] = Reserved - [24] = InstanceField dart.core::_Closure::_function - [25] = Reserved - [26] = ICData target-name 'call', arg-desc CP#7 - [27] = Type dynamic - [28] = String 'finally 1' - [29] = StaticICData target 'dart.core::print', arg-desc CP#7 - [30] = StaticICData target 'dart.core::print', arg-desc CP#7 - [31] = StaticICData target 'dart.core::print', arg-desc CP#7 - [32] = String 'after try 1' + [24] = EmptyTypeArguments + [25] = InstanceField dart.core::_Closure::_delayed_type_arguments + [26] = Reserved + [27] = InstanceField dart.core::_Closure::_function + [28] = Reserved + [29] = ICData target-name 'call', arg-desc CP#7 + [30] = Type dynamic + [31] = String 'finally 1' + [32] = StaticICData target 'dart.core::print', arg-desc CP#7 [33] = StaticICData target 'dart.core::print', arg-desc CP#7 - [34] = String 'finally 2' - [35] = StaticICData target 'dart.core::print', arg-desc CP#7 + [34] = StaticICData target 'dart.core::print', arg-desc CP#7 + [35] = String 'after try 1' [36] = StaticICData target 'dart.core::print', arg-desc CP#7 - [37] = StaticICData target 'dart.core::print', arg-desc CP#7 - [38] = String 'case 2' + [37] = String 'finally 2' + [38] = StaticICData target 'dart.core::print', arg-desc CP#7 [39] = StaticICData target 'dart.core::print', arg-desc CP#7 + [40] = StaticICData target 'dart.core::print', arg-desc CP#7 + [41] = String 'case 2' + [42] = StaticICData target 'dart.core::print', arg-desc CP#7 } Closure CP#12 { Entry 2 @@ -1023,8 +1038,11 @@ Try #0 start: PushConstant CP#1 StoreFieldTOS CP#29 Push r5 + PushConstant CP#31 + StoreFieldTOS CP#32 + Push r5 PushConstant CP#2 - StoreFieldTOS CP#31 + StoreFieldTOS CP#34 Push r5 Push r0 StoreFieldTOS CP#3 @@ -1038,11 +1056,11 @@ Try #0 handler: MoveSpecial r4, stackTrace Push r0 LoadContextVar 0 - PushConstant CP#33 + PushConstant CP#36 IndirectStaticCall 1, CP#5 Drop1 Push r2 - InstanceCall 1, CP#34 + InstanceCall 1, CP#37 Drop1 Push r3 Push r4 @@ -1052,11 +1070,11 @@ L1: PopLocal r0 Push r0 LoadContextVar 0 - PushConstant CP#35 + PushConstant CP#38 IndirectStaticCall 1, CP#5 Drop1 Push r2 - InstanceCall 1, CP#36 + InstanceCall 1, CP#39 Drop1 Push r0 LoadContextParent @@ -1065,7 +1083,7 @@ L1: ReturnTOS } ExceptionsTable { - try-index 0, outer -1, start 15, end 31, handler 31, needs-stack-trace, types [CP#10] + try-index 0, outer -1, start 15, end 34, handler 34, needs-stack-trace, types [CP#10] } ConstantPool { [0] = Int 11 @@ -1099,12 +1117,15 @@ ConstantPool { [28] = Reserved [29] = InstanceField dart.core::_Closure::_function_type_arguments [30] = Reserved - [31] = InstanceField dart.core::_Closure::_function - [32] = Reserved - [33] = StaticICData target 'dart.core::print', arg-desc CP#5 - [34] = ICData target-name 'call', arg-desc CP#5 - [35] = StaticICData target 'dart.core::print', arg-desc CP#5 - [36] = ICData target-name 'call', arg-desc CP#5 + [31] = EmptyTypeArguments + [32] = InstanceField dart.core::_Closure::_delayed_type_arguments + [33] = Reserved + [34] = InstanceField dart.core::_Closure::_function + [35] = Reserved + [36] = StaticICData target 'dart.core::print', arg-desc CP#5 + [37] = ICData target-name 'call', arg-desc CP#5 + [38] = StaticICData target 'dart.core::print', arg-desc CP#5 + [39] = ICData target-name 'call', arg-desc CP#5 } Closure CP#2 { Entry 6 diff --git a/runtime/vm/compiler/frontend/bytecode_reader.cc b/runtime/vm/compiler/frontend/bytecode_reader.cc index 5c978e9095f..3c46f830db2 100644 --- a/runtime/vm/compiler/frontend/bytecode_reader.cc +++ b/runtime/vm/compiler/frontend/bytecode_reader.cc @@ -124,6 +124,7 @@ intptr_t BytecodeMetadataHelper::ReadPoolEntries(const Function& function, kNativeEntry, kSubtypeTestCache, kPartialTearOffInstantiation, + kEmptyTypeArguments, }; enum InvocationKind { @@ -497,6 +498,9 @@ intptr_t BytecodeMetadataHelper::ReadPoolEntries(const Function& function, Context::Handle(helper_->zone_, old_closure.context()), Heap::kOld); obj = H.Canonicalize(Instance::Cast(obj)); } break; + case ConstantPoolTag::kEmptyTypeArguments: + obj = Object::empty_type_arguments().raw(); + break; default: UNREACHABLE(); }