a9abc64613
This CL adds context ID operand to AllocateContext, CloneContext, LoadContextVar and StoreContextVar bytecode instructions. The context ID will be used to create distinct Slots and disambiguate accesses to context objects corresponding to different scopes. Change-Id: I98850ab763017b71c1dcacfccaffc085bd850e00 Reviewed-on: https://dart-review.googlesource.com/c/84681 Auto-Submit: Alexander Markov <alexmarkov@google.com> Commit-Queue: Régis Crelier <regis@google.com> Reviewed-by: Régis Crelier <regis@google.com>
1212 lines
31 KiB
Plaintext
1212 lines
31 KiB
Plaintext
library #lib;
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
|
|
[@vm.bytecode=
|
|
Bytecode (version: stable) {
|
|
Entry 4
|
|
CheckStack 0
|
|
Try #0 start:
|
|
PushConstant CP#0
|
|
PushConstant CP#2
|
|
IndirectStaticCall 1, CP#1
|
|
Drop1
|
|
Jump L1
|
|
Try #0 end:
|
|
Try #0 handler:
|
|
SetFrame 4
|
|
MoveSpecial exception, r0
|
|
MoveSpecial stackTrace, r1
|
|
Push r0
|
|
PopLocal r2
|
|
PushNull
|
|
PushInt 2
|
|
CreateArrayTOS
|
|
StoreLocal r3
|
|
Push r3
|
|
PushInt 0
|
|
PushConstant CP#4
|
|
StoreIndexedTOS
|
|
Push r3
|
|
PushInt 1
|
|
Push r2
|
|
StoreIndexedTOS
|
|
PushConstant CP#5
|
|
IndirectStaticCall 1, CP#1
|
|
PushConstant CP#6
|
|
IndirectStaticCall 1, CP#1
|
|
Drop1
|
|
Jump L1
|
|
L1:
|
|
PushNull
|
|
ReturnTOS
|
|
}
|
|
ExceptionsTable {
|
|
try-index 0, outer -1, start 2, end 7, handler 7, types [CP#3]
|
|
}
|
|
ConstantPool {
|
|
[0] = String 'danger!'
|
|
[1] = ArgDesc num-args 1, num-type-args 0, names []
|
|
[2] = StaticICData target 'dart.core::print', arg-desc CP#1
|
|
[3] = Type dynamic
|
|
[4] = String 'caught '
|
|
[5] = StaticICData target 'dart.core::_StringBase::_interpolate', arg-desc CP#1
|
|
[6] = StaticICData target 'dart.core::print', arg-desc CP#1
|
|
}
|
|
]static method testTryCatch1() → dynamic {
|
|
try {
|
|
core::print("danger!");
|
|
}
|
|
on dynamic catch(final dynamic e) {
|
|
core::print("caught ${e}");
|
|
}
|
|
}
|
|
[@vm.bytecode=
|
|
Bytecode (version: stable) {
|
|
Entry 5
|
|
CheckStack 0
|
|
Try #0 start:
|
|
PushConstant CP#0
|
|
PushConstant CP#2
|
|
IndirectStaticCall 1, CP#1
|
|
Drop1
|
|
Jump L1
|
|
Try #0 end:
|
|
Try #0 handler:
|
|
SetFrame 5
|
|
MoveSpecial exception, r0
|
|
MoveSpecial stackTrace, r1
|
|
Push r0
|
|
PushConstant CP#3
|
|
InstanceCall 2, CP#5
|
|
JumpIfFalse L2
|
|
PushConstant CP#6
|
|
PushConstant CP#7
|
|
IndirectStaticCall 1, CP#1
|
|
Drop1
|
|
Jump L1
|
|
L2:
|
|
Push r0
|
|
PushConstant CP#8
|
|
InstanceCall 2, CP#9
|
|
JumpIfFalse L3
|
|
Push r0
|
|
PopLocal r2
|
|
PushNull
|
|
PushInt 2
|
|
CreateArrayTOS
|
|
StoreLocal r3
|
|
Push r3
|
|
PushInt 0
|
|
PushConstant CP#10
|
|
StoreIndexedTOS
|
|
Push r3
|
|
PushInt 1
|
|
Push r2
|
|
StoreIndexedTOS
|
|
PushConstant CP#11
|
|
IndirectStaticCall 1, CP#1
|
|
PushConstant CP#12
|
|
IndirectStaticCall 1, CP#1
|
|
Drop1
|
|
Jump L1
|
|
L3:
|
|
Push r0
|
|
PushConstant CP#13
|
|
InstanceCall 2, CP#14
|
|
JumpIfFalse L4
|
|
Push r0
|
|
PopLocal r2
|
|
Push r1
|
|
PopLocal r3
|
|
PushNull
|
|
PushInt 4
|
|
CreateArrayTOS
|
|
StoreLocal r4
|
|
Push r4
|
|
PushInt 0
|
|
PushConstant CP#15
|
|
StoreIndexedTOS
|
|
Push r4
|
|
PushInt 1
|
|
Push r2
|
|
StoreIndexedTOS
|
|
Push r4
|
|
PushInt 2
|
|
PushConstant CP#16
|
|
StoreIndexedTOS
|
|
Push r4
|
|
PushInt 3
|
|
Push r3
|
|
StoreIndexedTOS
|
|
PushConstant CP#17
|
|
IndirectStaticCall 1, CP#1
|
|
PushConstant CP#18
|
|
IndirectStaticCall 1, CP#1
|
|
Drop1
|
|
Jump L1
|
|
L4:
|
|
Push r0
|
|
PopLocal r2
|
|
Push r1
|
|
PopLocal r3
|
|
PushNull
|
|
PushInt 4
|
|
CreateArrayTOS
|
|
StoreLocal r4
|
|
Push r4
|
|
PushInt 0
|
|
PushConstant CP#20
|
|
StoreIndexedTOS
|
|
Push r4
|
|
PushInt 1
|
|
Push r2
|
|
StoreIndexedTOS
|
|
Push r4
|
|
PushInt 2
|
|
PushConstant CP#16
|
|
StoreIndexedTOS
|
|
Push r4
|
|
PushInt 3
|
|
Push r3
|
|
StoreIndexedTOS
|
|
PushConstant CP#21
|
|
IndirectStaticCall 1, CP#1
|
|
PushConstant CP#22
|
|
IndirectStaticCall 1, CP#1
|
|
Drop1
|
|
Jump L1
|
|
L1:
|
|
PushNull
|
|
ReturnTOS
|
|
}
|
|
ExceptionsTable {
|
|
try-index 0, outer -1, start 2, end 7, handler 7, needs-stack-trace, types [CP#3, CP#8, CP#13, CP#19]
|
|
}
|
|
ConstantPool {
|
|
[0] = String 'danger!'
|
|
[1] = ArgDesc num-args 1, num-type-args 0, names []
|
|
[2] = StaticICData target 'dart.core::print', arg-desc CP#1
|
|
[3] = Type dart.core::TypeError
|
|
[4] = ArgDesc num-args 2, num-type-args 0, names []
|
|
[5] = ICData target-name 'dart.core::_simpleInstanceOf', arg-desc CP#4
|
|
[6] = String 'caught type error'
|
|
[7] = StaticICData target 'dart.core::print', arg-desc CP#1
|
|
[8] = Type dart.core::AssertionError
|
|
[9] = ICData target-name 'dart.core::_simpleInstanceOf', arg-desc CP#4
|
|
[10] = String 'caught assertion error '
|
|
[11] = StaticICData target 'dart.core::_StringBase::_interpolate', arg-desc CP#1
|
|
[12] = StaticICData target 'dart.core::print', arg-desc CP#1
|
|
[13] = Type dart.core::Error
|
|
[14] = ICData target-name 'dart.core::_simpleInstanceOf', arg-desc CP#4
|
|
[15] = String 'caught error '
|
|
[16] = String ' '
|
|
[17] = StaticICData target 'dart.core::_StringBase::_interpolate', arg-desc CP#1
|
|
[18] = StaticICData target 'dart.core::print', arg-desc CP#1
|
|
[19] = Type dynamic
|
|
[20] = String 'caught something '
|
|
[21] = StaticICData target 'dart.core::_StringBase::_interpolate', arg-desc CP#1
|
|
[22] = StaticICData target 'dart.core::print', arg-desc CP#1
|
|
}
|
|
]static method testTryCatch2() → dynamic {
|
|
try {
|
|
core::print("danger!");
|
|
}
|
|
on core::TypeError catch(no-exception-var) {
|
|
core::print("caught type error");
|
|
}
|
|
on core::AssertionError catch(final core::AssertionError e) {
|
|
core::print("caught assertion error ${e}");
|
|
}
|
|
on core::Error catch(final core::Error e, final core::StackTrace st) {
|
|
core::print("caught error ${e} ${st}");
|
|
}
|
|
on dynamic catch(final dynamic e, final core::StackTrace st) {
|
|
core::print("caught something ${e} ${st}");
|
|
}
|
|
}
|
|
[@vm.bytecode=
|
|
Bytecode (version: stable) {
|
|
Entry 7
|
|
CheckStack 0
|
|
AllocateContext 0, 3
|
|
PopLocal r0
|
|
Push r0
|
|
PushInt 1
|
|
StoreContextVar 0, 0
|
|
Push r0
|
|
PopLocal r2
|
|
Try #0 start:
|
|
Push r0
|
|
PushInt 2
|
|
StoreContextVar 0, 1
|
|
Allocate CP#9
|
|
StoreLocal r5
|
|
Push r5
|
|
PushNull
|
|
StoreFieldTOS CP#10
|
|
Push r5
|
|
PushNull
|
|
StoreFieldTOS CP#12
|
|
Push r5
|
|
PushConstant CP#14
|
|
StoreFieldTOS CP#15
|
|
Push r5
|
|
PushConstant CP#0
|
|
StoreFieldTOS CP#17
|
|
Push r5
|
|
Push r0
|
|
StoreFieldTOS CP#1
|
|
PopLocal r4
|
|
Push r4
|
|
InstanceCall 1, CP#19
|
|
Drop1
|
|
Push r0
|
|
LoadContextVar 0, 1
|
|
PushConstant CP#20
|
|
IndirectStaticCall 1, CP#4
|
|
Drop1
|
|
Jump L1
|
|
Try #0 end:
|
|
Try #0 handler:
|
|
SetFrame 7
|
|
Push r2
|
|
PopLocal r0
|
|
MoveSpecial exception, r2
|
|
MoveSpecial stackTrace, r3
|
|
Push r2
|
|
PopLocal r4
|
|
Push r0
|
|
Push r3
|
|
StoreContextVar 0, 2
|
|
PushNull
|
|
PushInt 4
|
|
CreateArrayTOS
|
|
StoreLocal r5
|
|
Push r5
|
|
PushInt 0
|
|
PushConstant CP#21
|
|
StoreIndexedTOS
|
|
Push r5
|
|
PushInt 1
|
|
Push r4
|
|
StoreIndexedTOS
|
|
Push r5
|
|
PushInt 2
|
|
PushConstant CP#22
|
|
StoreIndexedTOS
|
|
Push r5
|
|
PushInt 3
|
|
Push r0
|
|
LoadContextVar 0, 2
|
|
StoreIndexedTOS
|
|
PushConstant CP#23
|
|
IndirectStaticCall 1, CP#4
|
|
PushConstant CP#24
|
|
IndirectStaticCall 1, CP#4
|
|
Drop1
|
|
Allocate CP#9
|
|
StoreLocal r5
|
|
Push r5
|
|
PushNull
|
|
StoreFieldTOS CP#10
|
|
Push r5
|
|
PushNull
|
|
StoreFieldTOS CP#12
|
|
Push r5
|
|
PushConstant CP#14
|
|
StoreFieldTOS CP#15
|
|
Push r5
|
|
PushConstant CP#25
|
|
StoreFieldTOS CP#17
|
|
Push r5
|
|
Push r0
|
|
StoreFieldTOS CP#1
|
|
PopLocal r6
|
|
Push r6
|
|
ReturnTOS
|
|
L1:
|
|
Push r0
|
|
LoadContextParent
|
|
PopLocal r0
|
|
PushNull
|
|
ReturnTOS
|
|
}
|
|
ExceptionsTable {
|
|
try-index 0, outer -1, start 9, end 39, handler 39, needs-stack-trace, types [CP#6]
|
|
}
|
|
ConstantPool {
|
|
[0] = ClosureFunction foo () → void;
|
|
[1] = InstanceField dart.core::_Closure::_context
|
|
[2] = Reserved
|
|
[3] = String 'danger foo'
|
|
[4] = ArgDesc num-args 1, num-type-args 0, names []
|
|
[5] = StaticICData target 'dart.core::print', arg-desc CP#4
|
|
[6] = Type dynamic
|
|
[7] = StaticICData target 'dart.core::print', arg-desc CP#4
|
|
[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#4
|
|
[20] = StaticICData target 'dart.core::print', arg-desc CP#4
|
|
[21] = String 'caught '
|
|
[22] = String ' '
|
|
[23] = StaticICData target 'dart.core::_StringBase::_interpolate', arg-desc CP#4
|
|
[24] = StaticICData target 'dart.core::print', arg-desc CP#4
|
|
[25] = ClosureFunction bar () → void;
|
|
[26] = String 'danger bar'
|
|
[27] = StaticICData target 'dart.core::print', arg-desc CP#4
|
|
[28] = Type dart.core::Error
|
|
[29] = ArgDesc num-args 2, num-type-args 0, names []
|
|
[30] = ICData target-name 'dart.core::_simpleInstanceOf', arg-desc CP#29
|
|
[31] = String 'error '
|
|
[32] = String ', captured stack trace: '
|
|
[33] = StaticICData target 'dart.core::_StringBase::_interpolate', arg-desc CP#4
|
|
[34] = StaticICData target 'dart.core::print', arg-desc CP#4
|
|
[35] = EndClosureFunctionScope
|
|
}
|
|
Closure CP#0 {
|
|
EntryFixed 1, 6
|
|
CheckStack 0
|
|
Push FP[-5]
|
|
LoadFieldTOS CP#1
|
|
PopLocal r0
|
|
Push r0
|
|
PopLocal r2
|
|
Try #0 start:
|
|
PushConstant CP#3
|
|
PushConstant CP#5
|
|
IndirectStaticCall 1, CP#4
|
|
Drop1
|
|
Jump L1
|
|
Try #0 end:
|
|
Try #0 handler:
|
|
SetFrame 6
|
|
Push r2
|
|
PopLocal r0
|
|
MoveSpecial exception, r2
|
|
MoveSpecial stackTrace, r3
|
|
Push r2
|
|
PopLocal r4
|
|
Push r0
|
|
LoadContextVar 0, 0
|
|
PushConstant CP#7
|
|
IndirectStaticCall 1, CP#4
|
|
Drop1
|
|
Push r0
|
|
PushInt 3
|
|
StoreContextVar 0, 1
|
|
Jump L1
|
|
L1:
|
|
PushNull
|
|
ReturnTOS
|
|
|
|
}
|
|
|
|
Closure CP#25 {
|
|
EntryFixed 1, 6
|
|
CheckStack 0
|
|
Push FP[-5]
|
|
LoadFieldTOS CP#1
|
|
PopLocal r0
|
|
Push r0
|
|
PopLocal r2
|
|
Try #0 start:
|
|
PushConstant CP#26
|
|
PushConstant CP#27
|
|
IndirectStaticCall 1, CP#4
|
|
Drop1
|
|
Jump L1
|
|
Try #0 end:
|
|
Try #0 handler:
|
|
SetFrame 6
|
|
Push r2
|
|
PopLocal r0
|
|
MoveSpecial exception, r2
|
|
MoveSpecial stackTrace, r3
|
|
Push r2
|
|
PushConstant CP#28
|
|
InstanceCall 2, CP#30
|
|
JumpIfFalse L2
|
|
Push r2
|
|
PopLocal r4
|
|
PushNull
|
|
PushInt 4
|
|
CreateArrayTOS
|
|
StoreLocal r5
|
|
Push r5
|
|
PushInt 0
|
|
PushConstant CP#31
|
|
StoreIndexedTOS
|
|
Push r5
|
|
PushInt 1
|
|
Push r4
|
|
StoreIndexedTOS
|
|
Push r5
|
|
PushInt 2
|
|
PushConstant CP#32
|
|
StoreIndexedTOS
|
|
Push r5
|
|
PushInt 3
|
|
Push r0
|
|
LoadContextVar 0, 2
|
|
StoreIndexedTOS
|
|
PushConstant CP#33
|
|
IndirectStaticCall 1, CP#4
|
|
PushConstant CP#34
|
|
IndirectStaticCall 1, CP#4
|
|
Drop1
|
|
Jump L1
|
|
L2:
|
|
Push r2
|
|
Push r3
|
|
Throw 1
|
|
L1:
|
|
PushNull
|
|
ReturnTOS
|
|
|
|
}
|
|
]static method testTryCatch3() → dynamic {
|
|
core::int x = 1;
|
|
try {
|
|
core::int y = 2;
|
|
function foo() → void {
|
|
try {
|
|
core::print("danger foo");
|
|
}
|
|
on dynamic catch(final dynamic e) {
|
|
core::print(x);
|
|
y = 3;
|
|
}
|
|
}
|
|
[@vm.call-site-attributes.metadata=receiverType:() → void] foo.call();
|
|
core::print(y);
|
|
}
|
|
on dynamic catch(final dynamic e, final core::StackTrace st) {
|
|
core::print("caught ${e} ${st}");
|
|
function bar() → void {
|
|
try {
|
|
core::print("danger bar");
|
|
}
|
|
on core::Error catch(final core::Error e) {
|
|
core::print("error ${e}, captured stack trace: ${st}");
|
|
}
|
|
}
|
|
return bar;
|
|
}
|
|
}
|
|
[@vm.bytecode=
|
|
Bytecode (version: stable) {
|
|
Entry 8
|
|
CheckStack 0
|
|
Try #0 start:
|
|
Try #1 start:
|
|
PushConstant CP#0
|
|
PushConstant CP#2
|
|
IndirectStaticCall 1, CP#1
|
|
Drop1
|
|
Jump L1
|
|
Try #1 end:
|
|
Try #1 handler:
|
|
SetFrame 8
|
|
MoveSpecial exception, r2
|
|
MoveSpecial stackTrace, r3
|
|
Push r2
|
|
PopLocal r4
|
|
Try #2 start:
|
|
PushConstant CP#4
|
|
PushConstant CP#5
|
|
IndirectStaticCall 1, CP#1
|
|
Drop1
|
|
Push FP[-5]
|
|
AssertBoolean 0
|
|
JumpIfFalse L2
|
|
Push r2
|
|
Push r3
|
|
Throw 1
|
|
L2:
|
|
Jump L3
|
|
Try #2 end:
|
|
Try #2 handler:
|
|
SetFrame 8
|
|
MoveSpecial exception, r5
|
|
MoveSpecial stackTrace, r6
|
|
Push r5
|
|
PopLocal r7
|
|
PushConstant CP#6
|
|
PushConstant CP#7
|
|
IndirectStaticCall 1, CP#1
|
|
Drop1
|
|
Jump L3
|
|
L3:
|
|
Jump L1
|
|
L1:
|
|
Jump L4
|
|
Try #0 end:
|
|
Try #0 handler:
|
|
SetFrame 8
|
|
MoveSpecial exception, r0
|
|
MoveSpecial stackTrace, r1
|
|
Push r0
|
|
PopLocal r2
|
|
Push r1
|
|
PopLocal r3
|
|
PushConstant CP#8
|
|
PushConstant CP#9
|
|
IndirectStaticCall 1, CP#1
|
|
Drop1
|
|
Push r3
|
|
PushConstant CP#10
|
|
IndirectStaticCall 1, CP#1
|
|
Drop1
|
|
Jump L4
|
|
L4:
|
|
PushNull
|
|
ReturnTOS
|
|
}
|
|
ExceptionsTable {
|
|
try-index 0, outer -1, start 2, end 35, handler 35, needs-stack-trace, types [CP#3]
|
|
try-index 1, outer 0, start 2, end 7, handler 7, needs-stack-trace, types [CP#3]
|
|
try-index 2, outer 0, start 12, end 23, handler 23, types [CP#3]
|
|
}
|
|
ConstantPool {
|
|
[0] = String 'try 1 > try 2'
|
|
[1] = ArgDesc num-args 1, num-type-args 0, names []
|
|
[2] = StaticICData target 'dart.core::print', arg-desc CP#1
|
|
[3] = Type dynamic
|
|
[4] = String 'try 1 > catch 2 > try 3'
|
|
[5] = StaticICData target 'dart.core::print', arg-desc CP#1
|
|
[6] = String 'try 1 > catch 2 > catch 3'
|
|
[7] = StaticICData target 'dart.core::print', arg-desc CP#1
|
|
[8] = String 'catch 1'
|
|
[9] = StaticICData target 'dart.core::print', arg-desc CP#1
|
|
[10] = StaticICData target 'dart.core::print', arg-desc CP#1
|
|
}
|
|
]static method testRethrow(core::bool cond) → dynamic {
|
|
try {
|
|
try {
|
|
core::print("try 1 > try 2");
|
|
}
|
|
on dynamic catch(final dynamic e) {
|
|
try {
|
|
core::print("try 1 > catch 2 > try 3");
|
|
if(cond) {
|
|
rethrow;
|
|
}
|
|
}
|
|
on dynamic catch(final dynamic e) {
|
|
core::print("try 1 > catch 2 > catch 3");
|
|
}
|
|
}
|
|
}
|
|
on dynamic catch(final dynamic e, final core::StackTrace st) {
|
|
core::print("catch 1");
|
|
core::print(st);
|
|
}
|
|
}
|
|
[@vm.bytecode=
|
|
Bytecode (version: stable) {
|
|
Entry 3
|
|
CheckStack 0
|
|
PushInt 0
|
|
PopLocal r0
|
|
L5:
|
|
CheckStack 1
|
|
Push r0
|
|
PushInt 10
|
|
CompareIntLt
|
|
JumpIfFalse L1
|
|
Try #0 start:
|
|
Push r0
|
|
PushInt 5
|
|
CompareIntGt
|
|
JumpIfFalse L2
|
|
Jump L3
|
|
L2:
|
|
Jump L4
|
|
Try #0 end:
|
|
Try #0 handler:
|
|
SetFrame 3
|
|
MoveSpecial exception, r1
|
|
MoveSpecial stackTrace, r2
|
|
Push r0
|
|
PushConstant CP#2
|
|
IndirectStaticCall 1, CP#1
|
|
Drop1
|
|
Push r1
|
|
Push r2
|
|
Throw 1
|
|
L3:
|
|
Push r0
|
|
PushConstant CP#3
|
|
IndirectStaticCall 1, CP#1
|
|
Drop1
|
|
Jump L1
|
|
L4:
|
|
Push r0
|
|
PushConstant CP#4
|
|
IndirectStaticCall 1, CP#1
|
|
Drop1
|
|
Push r0
|
|
PushInt 1
|
|
AddInt
|
|
StoreLocal r0
|
|
Drop1
|
|
Jump L5
|
|
L1:
|
|
PushNull
|
|
ReturnTOS
|
|
}
|
|
ExceptionsTable {
|
|
try-index 0, outer -1, start 9, end 15, handler 15, needs-stack-trace, types [CP#0]
|
|
}
|
|
ConstantPool {
|
|
[0] = Type dynamic
|
|
[1] = ArgDesc num-args 1, num-type-args 0, names []
|
|
[2] = StaticICData target 'dart.core::print', arg-desc CP#1
|
|
[3] = StaticICData target 'dart.core::print', arg-desc CP#1
|
|
[4] = StaticICData target 'dart.core::print', arg-desc CP#1
|
|
}
|
|
]static method testTryFinally1() → dynamic {
|
|
#L1:
|
|
for (core::int i = 0; i.{core::num::<}(10); i = i.{core::num::+}(1)) {
|
|
try {
|
|
if(i.{core::num::>}(5)) {
|
|
break #L1;
|
|
}
|
|
}
|
|
finally {
|
|
core::print(i);
|
|
}
|
|
}
|
|
}
|
|
[@vm.bytecode=
|
|
Bytecode (version: stable) {
|
|
Entry 9
|
|
CheckStack 0
|
|
AllocateContext 0, 2
|
|
PopLocal r0
|
|
Push r0
|
|
Push FP[-5]
|
|
StoreContextVar 0, 0
|
|
Push r0
|
|
LoadContextVar 0, 0
|
|
PopLocal r2
|
|
Push r2
|
|
PushInt 1
|
|
InstanceCall 2, CP#1
|
|
JumpIfTrue L1
|
|
Push r2
|
|
PushInt 2
|
|
InstanceCall 2, CP#2
|
|
JumpIfTrue L2
|
|
Jump L3
|
|
L1:
|
|
Push r0
|
|
PopLocal r3
|
|
Try #0 start:
|
|
PushConstant CP#3
|
|
PushConstant CP#5
|
|
IndirectStaticCall 1, CP#4
|
|
Drop1
|
|
Push r0
|
|
PushInt 3
|
|
StoreContextVar 0, 1
|
|
Push r0
|
|
PopLocal r5
|
|
Try #1 start:
|
|
PushConstant CP#6
|
|
PushConstant CP#7
|
|
IndirectStaticCall 1, CP#4
|
|
Drop1
|
|
Allocate CP#14
|
|
StoreLocal r8
|
|
Push r8
|
|
PushNull
|
|
StoreFieldTOS CP#15
|
|
Push r8
|
|
PushNull
|
|
StoreFieldTOS CP#17
|
|
Push r8
|
|
PushConstant CP#19
|
|
StoreFieldTOS CP#20
|
|
Push r8
|
|
PushConstant CP#8
|
|
StoreFieldTOS CP#22
|
|
Push r8
|
|
Push r0
|
|
StoreFieldTOS CP#9
|
|
PopLocal r7
|
|
Push r7
|
|
InstanceCall 1, CP#24
|
|
Drop1
|
|
Jump L4
|
|
Try #1 end:
|
|
Try #1 handler:
|
|
SetFrame 9
|
|
Push r5
|
|
PopLocal r0
|
|
MoveSpecial exception, r5
|
|
MoveSpecial stackTrace, r6
|
|
PushConstant CP#26
|
|
PushConstant CP#27
|
|
IndirectStaticCall 1, CP#4
|
|
Drop1
|
|
Push r5
|
|
Push r6
|
|
Throw 1
|
|
L4:
|
|
Push r5
|
|
PopLocal r0
|
|
PushConstant CP#26
|
|
PushConstant CP#28
|
|
IndirectStaticCall 1, CP#4
|
|
Drop1
|
|
Jump L5
|
|
Try #0 end:
|
|
Try #0 handler:
|
|
SetFrame 9
|
|
Push r3
|
|
PopLocal r0
|
|
MoveSpecial exception, r3
|
|
MoveSpecial stackTrace, r4
|
|
PushConstant CP#31
|
|
PushConstant CP#32
|
|
IndirectStaticCall 1, CP#4
|
|
Drop1
|
|
Push r3
|
|
Push r4
|
|
Throw 1
|
|
L5:
|
|
Push r3
|
|
PopLocal r0
|
|
PushConstant CP#31
|
|
PushConstant CP#33
|
|
IndirectStaticCall 1, CP#4
|
|
Drop1
|
|
Jump L2
|
|
L2:
|
|
PushConstant CP#34
|
|
PushConstant CP#35
|
|
IndirectStaticCall 1, CP#4
|
|
Drop1
|
|
Jump L3
|
|
L3:
|
|
PushNull
|
|
ReturnTOS
|
|
}
|
|
ExceptionsTable {
|
|
try-index 0, outer -1, start 21, end 75, handler 75, needs-stack-trace, types [CP#25]
|
|
try-index 1, outer 0, start 30, end 56, handler 56, needs-stack-trace, types [CP#25]
|
|
}
|
|
ConstantPool {
|
|
[0] = ArgDesc num-args 2, num-type-args 0, names []
|
|
[1] = ICData target-name '==', arg-desc CP#0
|
|
[2] = ICData target-name '==', arg-desc CP#0
|
|
[3] = String 'before try 1'
|
|
[4] = ArgDesc num-args 1, num-type-args 0, names []
|
|
[5] = StaticICData target 'dart.core::print', arg-desc CP#4
|
|
[6] = String 'try'
|
|
[7] = StaticICData target 'dart.core::print', arg-desc CP#4
|
|
[8] = ClosureFunction foo () → void;
|
|
[9] = InstanceField dart.core::_Closure::_context
|
|
[10] = Reserved
|
|
[11] = StaticICData target 'dart.core::print', arg-desc CP#4
|
|
[12] = StaticICData target 'dart.core::print', arg-desc CP#4
|
|
[13] = EndClosureFunctionScope
|
|
[14] = Class dart.core::_Closure
|
|
[15] = InstanceField dart.core::_Closure::_instantiator_type_arguments
|
|
[16] = Reserved
|
|
[17] = InstanceField dart.core::_Closure::_function_type_arguments
|
|
[18] = Reserved
|
|
[19] = EmptyTypeArguments
|
|
[20] = InstanceField dart.core::_Closure::_delayed_type_arguments
|
|
[21] = Reserved
|
|
[22] = InstanceField dart.core::_Closure::_function
|
|
[23] = Reserved
|
|
[24] = ICData dynamic target-name 'call', arg-desc CP#4
|
|
[25] = Type dynamic
|
|
[26] = String 'finally 1'
|
|
[27] = StaticICData target 'dart.core::print', arg-desc CP#4
|
|
[28] = StaticICData target 'dart.core::print', arg-desc CP#4
|
|
[29] = String 'after try 1'
|
|
[30] = StaticICData target 'dart.core::print', arg-desc CP#4
|
|
[31] = String 'finally 2'
|
|
[32] = StaticICData target 'dart.core::print', arg-desc CP#4
|
|
[33] = StaticICData target 'dart.core::print', arg-desc CP#4
|
|
[34] = String 'case 2'
|
|
[35] = StaticICData target 'dart.core::print', arg-desc CP#4
|
|
}
|
|
Closure CP#8 {
|
|
EntryFixed 1, 2
|
|
CheckStack 0
|
|
Push FP[-5]
|
|
LoadFieldTOS CP#9
|
|
PopLocal r0
|
|
Push r0
|
|
LoadContextVar 0, 0
|
|
PushConstant CP#11
|
|
IndirectStaticCall 1, CP#4
|
|
Drop1
|
|
Push r0
|
|
LoadContextVar 0, 1
|
|
PushConstant CP#12
|
|
IndirectStaticCall 1, CP#4
|
|
Drop1
|
|
PushNull
|
|
ReturnTOS
|
|
|
|
}
|
|
]static method testTryFinally2(core::int x) → dynamic {
|
|
#L2:
|
|
switch(x) {
|
|
#L3:
|
|
case 1:
|
|
{
|
|
try {
|
|
core::print("before try 1");
|
|
core::int y = 3;
|
|
try {
|
|
core::print("try");
|
|
function foo() → void {
|
|
core::print(x);
|
|
core::print(y);
|
|
}
|
|
[@vm.call-site-attributes.metadata=receiverType:() → void] foo.call();
|
|
continue #L4;
|
|
}
|
|
finally {
|
|
core::print("finally 1");
|
|
}
|
|
core::print("after try 1");
|
|
}
|
|
finally {
|
|
core::print("finally 2");
|
|
}
|
|
break #L2;
|
|
}
|
|
#L4:
|
|
case 2:
|
|
{
|
|
core::print("case 2");
|
|
break #L2;
|
|
}
|
|
}
|
|
}
|
|
[@vm.bytecode=
|
|
Bytecode (version: stable) {
|
|
Entry 6
|
|
CheckStack 0
|
|
AllocateContext 0, 1
|
|
PopLocal r0
|
|
Push r0
|
|
PushInt 11
|
|
StoreContextVar 0, 0
|
|
PushNull
|
|
PopLocal r2
|
|
Push r0
|
|
PopLocal r3
|
|
Try #0 start:
|
|
Allocate CP#16
|
|
StoreLocal r5
|
|
Push r5
|
|
PushNull
|
|
StoreFieldTOS CP#17
|
|
Push r5
|
|
PushNull
|
|
StoreFieldTOS CP#19
|
|
Push r5
|
|
PushConstant CP#21
|
|
StoreFieldTOS CP#22
|
|
Push r5
|
|
PushConstant CP#0
|
|
StoreFieldTOS CP#24
|
|
Push r5
|
|
Push r0
|
|
StoreFieldTOS CP#1
|
|
PopLocal r2
|
|
Jump L1
|
|
Try #0 end:
|
|
Try #0 handler:
|
|
SetFrame 6
|
|
Push r3
|
|
PopLocal r0
|
|
MoveSpecial exception, r3
|
|
MoveSpecial stackTrace, r4
|
|
Push r0
|
|
LoadContextVar 0, 0
|
|
PushConstant CP#26
|
|
IndirectStaticCall 1, CP#3
|
|
Drop1
|
|
Push r2
|
|
InstanceCall 1, CP#27
|
|
Drop1
|
|
Push r3
|
|
Push r4
|
|
Throw 1
|
|
L1:
|
|
Push r3
|
|
PopLocal r0
|
|
Push r0
|
|
LoadContextVar 0, 0
|
|
PushConstant CP#28
|
|
IndirectStaticCall 1, CP#3
|
|
Drop1
|
|
Push r2
|
|
InstanceCall 1, CP#29
|
|
Drop1
|
|
Push r0
|
|
LoadContextParent
|
|
PopLocal r0
|
|
PushNull
|
|
ReturnTOS
|
|
}
|
|
ExceptionsTable {
|
|
try-index 0, outer -1, start 11, end 30, handler 30, needs-stack-trace, types [CP#7]
|
|
}
|
|
ConstantPool {
|
|
[0] = ClosureFunction <anonymous closure> () → dart.core::int;
|
|
[1] = InstanceField dart.core::_Closure::_context
|
|
[2] = Reserved
|
|
[3] = ArgDesc num-args 1, num-type-args 0, names []
|
|
[4] = StaticICData target 'dart.core::print', arg-desc CP#3
|
|
[5] = String 'try 1'
|
|
[6] = StaticICData target 'dart.core::print', arg-desc CP#3
|
|
[7] = Type dynamic
|
|
[8] = String 'try 2'
|
|
[9] = StaticICData target 'dart.core::print', arg-desc CP#3
|
|
[10] = StaticICData target 'dart.core::print', arg-desc CP#3
|
|
[11] = StaticICData target 'dart.core::print', arg-desc CP#3
|
|
[12] = StaticICData target 'dart.core::print', arg-desc CP#3
|
|
[13] = StaticICData target 'dart.core::print', arg-desc CP#3
|
|
[14] = StaticICData target 'dart.core::print', arg-desc CP#3
|
|
[15] = EndClosureFunctionScope
|
|
[16] = Class dart.core::_Closure
|
|
[17] = InstanceField dart.core::_Closure::_instantiator_type_arguments
|
|
[18] = Reserved
|
|
[19] = InstanceField dart.core::_Closure::_function_type_arguments
|
|
[20] = Reserved
|
|
[21] = EmptyTypeArguments
|
|
[22] = InstanceField dart.core::_Closure::_delayed_type_arguments
|
|
[23] = Reserved
|
|
[24] = InstanceField dart.core::_Closure::_function
|
|
[25] = Reserved
|
|
[26] = StaticICData target 'dart.core::print', arg-desc CP#3
|
|
[27] = ICData dynamic target-name 'call', arg-desc CP#3
|
|
[28] = StaticICData target 'dart.core::print', arg-desc CP#3
|
|
[29] = ICData dynamic target-name 'call', arg-desc CP#3
|
|
}
|
|
Closure CP#0 {
|
|
EntryFixed 1, 6
|
|
CheckStack 0
|
|
Push FP[-5]
|
|
LoadFieldTOS CP#1
|
|
PopLocal r0
|
|
Push r0
|
|
LoadContextVar 0, 0
|
|
PushConstant CP#4
|
|
IndirectStaticCall 1, CP#3
|
|
Drop1
|
|
Push r0
|
|
PopLocal r2
|
|
Try #0 start:
|
|
PushConstant CP#5
|
|
PushConstant CP#6
|
|
IndirectStaticCall 1, CP#3
|
|
Drop1
|
|
Jump L1
|
|
Try #0 end:
|
|
Try #0 handler:
|
|
SetFrame 6
|
|
Push r2
|
|
PopLocal r0
|
|
MoveSpecial exception, r2
|
|
MoveSpecial stackTrace, r3
|
|
Push r0
|
|
PopLocal r4
|
|
Try #1 start:
|
|
PushConstant CP#8
|
|
PushConstant CP#9
|
|
IndirectStaticCall 1, CP#3
|
|
Drop1
|
|
Jump L2
|
|
Try #1 end:
|
|
Try #1 handler:
|
|
SetFrame 6
|
|
Push r4
|
|
PopLocal r0
|
|
MoveSpecial exception, r4
|
|
MoveSpecial stackTrace, r5
|
|
Push r0
|
|
LoadContextVar 0, 0
|
|
PushConstant CP#10
|
|
IndirectStaticCall 1, CP#3
|
|
Drop1
|
|
Push r4
|
|
Push r5
|
|
Throw 1
|
|
L2:
|
|
Push r4
|
|
PopLocal r0
|
|
Push r0
|
|
LoadContextVar 0, 0
|
|
PushConstant CP#11
|
|
IndirectStaticCall 1, CP#3
|
|
Drop1
|
|
PushInt 43
|
|
ReturnTOS
|
|
L1:
|
|
Push r2
|
|
PopLocal r0
|
|
Push r0
|
|
PopLocal r4
|
|
Try #2 start:
|
|
PushConstant CP#8
|
|
PushConstant CP#12
|
|
IndirectStaticCall 1, CP#3
|
|
Drop1
|
|
Jump L3
|
|
Try #2 end:
|
|
Try #2 handler:
|
|
SetFrame 6
|
|
Push r4
|
|
PopLocal r0
|
|
MoveSpecial exception, r4
|
|
MoveSpecial stackTrace, r5
|
|
Push r0
|
|
LoadContextVar 0, 0
|
|
PushConstant CP#13
|
|
IndirectStaticCall 1, CP#3
|
|
Drop1
|
|
Push r4
|
|
Push r5
|
|
Throw 1
|
|
L3:
|
|
Push r4
|
|
PopLocal r0
|
|
Push r0
|
|
LoadContextVar 0, 0
|
|
PushConstant CP#14
|
|
IndirectStaticCall 1, CP#3
|
|
Drop1
|
|
PushInt 43
|
|
ReturnTOS
|
|
|
|
}
|
|
]static method testTryFinally3() → dynamic {
|
|
core::int x = 11;
|
|
dynamic y;
|
|
try {
|
|
y = () → core::int {
|
|
core::print(x);
|
|
try {
|
|
core::print("try 1");
|
|
return 42;
|
|
}
|
|
finally {
|
|
try {
|
|
core::print("try 2");
|
|
return 43;
|
|
}
|
|
finally {
|
|
core::print(x);
|
|
}
|
|
}
|
|
};
|
|
}
|
|
finally {
|
|
core::print(x);
|
|
[@vm.call-site-attributes.metadata=receiverType:dynamic] y.call();
|
|
}
|
|
}
|
|
[@vm.bytecode=
|
|
Bytecode (version: stable) {
|
|
Entry 5
|
|
CheckStack 0
|
|
Try #0 start:
|
|
Try #1 start:
|
|
PushConstant CP#0
|
|
PushConstant CP#2
|
|
IndirectStaticCall 1, CP#1
|
|
Drop1
|
|
Jump L1
|
|
Try #1 end:
|
|
Try #1 handler:
|
|
SetFrame 5
|
|
MoveSpecial exception, r2
|
|
MoveSpecial stackTrace, r3
|
|
Push r2
|
|
PopLocal r4
|
|
PushConstant CP#4
|
|
PushConstant CP#5
|
|
IndirectStaticCall 1, CP#1
|
|
Drop1
|
|
Jump L1
|
|
L1:
|
|
Jump L2
|
|
Try #0 end:
|
|
Try #0 handler:
|
|
SetFrame 5
|
|
MoveSpecial exception, r0
|
|
MoveSpecial stackTrace, r1
|
|
PushConstant CP#6
|
|
PushConstant CP#7
|
|
IndirectStaticCall 1, CP#1
|
|
Drop1
|
|
Push r0
|
|
Push r1
|
|
Throw 1
|
|
L2:
|
|
PushConstant CP#6
|
|
PushConstant CP#8
|
|
IndirectStaticCall 1, CP#1
|
|
Drop1
|
|
PushNull
|
|
ReturnTOS
|
|
}
|
|
ExceptionsTable {
|
|
try-index 0, outer -1, start 2, end 18, handler 18, needs-stack-trace, types [CP#3]
|
|
try-index 1, outer 0, start 2, end 7, handler 7, types [CP#3]
|
|
}
|
|
ConstantPool {
|
|
[0] = String 'try'
|
|
[1] = ArgDesc num-args 1, num-type-args 0, names []
|
|
[2] = StaticICData target 'dart.core::print', arg-desc CP#1
|
|
[3] = Type dynamic
|
|
[4] = String 'catch'
|
|
[5] = StaticICData target 'dart.core::print', arg-desc CP#1
|
|
[6] = String 'finally'
|
|
[7] = StaticICData target 'dart.core::print', arg-desc CP#1
|
|
[8] = StaticICData target 'dart.core::print', arg-desc CP#1
|
|
}
|
|
]static method testTryCatchFinally() → dynamic {
|
|
try
|
|
try {
|
|
core::print("try");
|
|
}
|
|
on dynamic catch(final dynamic e) {
|
|
core::print("catch");
|
|
}
|
|
finally {
|
|
core::print("finally");
|
|
}
|
|
}
|
|
[@vm.bytecode=
|
|
Bytecode (version: stable) {
|
|
Entry 0
|
|
CheckStack 0
|
|
PushNull
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
}
|
|
]static method main() → dynamic {}
|