17d7296a42
Type arguments should not be reused if type parameter has a nullability other than non-nullable or undertermined, as instantiating such type parameter may alter the type. Also, this change adds printing of nullability when dumping bytecode and updates expectations accordingly. Fixes language/nnbd/is_type_test/null_is_type_in_legacy_lib_test in bytecode mode. Change-Id: I4378a4e42fa0bf014840b9b1ef09a633c1825e20 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155560 Reviewed-by: Régis Crelier <regis@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com>
430 lines
12 KiB
Plaintext
430 lines
12 KiB
Plaintext
main = #lib::main;
|
|
[@vm.bytecode=
|
|
BytecodeMetadata {
|
|
Bytecode (version: stable)
|
|
Main library: #lib
|
|
Library '#lib'
|
|
name '#lib'
|
|
script '#lib'
|
|
|
|
Class '', script = '#lib'
|
|
|
|
|
|
Function 'test_for', static, reflectable, debuggable
|
|
parameters [dart:core::List < dart:core::int* >* 'list'] (required: 1)
|
|
return-type dart:core::int*
|
|
|
|
Bytecode {
|
|
Entry 2
|
|
CheckStack 0
|
|
PushInt 0
|
|
PopLocal r0
|
|
PushInt 0
|
|
PopLocal r1
|
|
L2:
|
|
CheckStack 1
|
|
Push r1
|
|
Push FP[-5]
|
|
InterfaceCall CP#0, 1
|
|
InterfaceCall CP#2, 2
|
|
AssertBoolean 0
|
|
JumpIfFalse L1
|
|
Push r0
|
|
Push FP[-5]
|
|
Push r1
|
|
InterfaceCall CP#4, 2
|
|
AddInt
|
|
PopLocal r0
|
|
Push r1
|
|
PushInt 1
|
|
AddInt
|
|
StoreLocal r1
|
|
Drop1
|
|
Jump L2
|
|
L1:
|
|
Push r0
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
[0] = InterfaceCall 'dart:core::List::get:length', ArgDesc num-args 1, num-type-args 0, names []
|
|
[1] = Reserved
|
|
[2] = InterfaceCall 'dart:core::num::<', ArgDesc num-args 2, num-type-args 0, names []
|
|
[3] = Reserved
|
|
[4] = InterfaceCall 'dart:core::List::[]', ArgDesc num-args 2, num-type-args 0, names []
|
|
[5] = Reserved
|
|
}
|
|
|
|
|
|
Function 'test_for_break', static, reflectable, debuggable
|
|
parameters [dart:core::List < dart:core::int* >* 'list'] (required: 1)
|
|
return-type dart:core::int*
|
|
|
|
Bytecode {
|
|
Entry 2
|
|
CheckStack 0
|
|
PushInt 0
|
|
PopLocal r0
|
|
PushInt 0
|
|
PopLocal r1
|
|
L3:
|
|
CheckStack 1
|
|
Push r1
|
|
PushInt 0
|
|
CompareIntGe
|
|
JumpIfFalse L1
|
|
Push r1
|
|
Push FP[-5]
|
|
InterfaceCall CP#0, 1
|
|
InterfaceCall CP#2, 2
|
|
AssertBoolean 0
|
|
JumpIfFalse L2
|
|
Jump L1
|
|
L2:
|
|
Push r0
|
|
Push FP[-5]
|
|
Push r1
|
|
InterfaceCall CP#4, 2
|
|
AddInt
|
|
PopLocal r0
|
|
Push r1
|
|
PushInt 1
|
|
AddInt
|
|
StoreLocal r1
|
|
Drop1
|
|
Jump L3
|
|
L1:
|
|
Push r0
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
[0] = InterfaceCall 'dart:core::List::get:length', ArgDesc num-args 1, num-type-args 0, names []
|
|
[1] = Reserved
|
|
[2] = InterfaceCall 'dart:core::num::>=', ArgDesc num-args 2, num-type-args 0, names []
|
|
[3] = Reserved
|
|
[4] = InterfaceCall 'dart:core::List::[]', ArgDesc num-args 2, num-type-args 0, names []
|
|
[5] = Reserved
|
|
}
|
|
|
|
|
|
Function 'test_for_continue', static, reflectable, debuggable
|
|
parameters [dart:core::List < dart:core::int* >* 'list'] (required: 1)
|
|
return-type dart:core::int*
|
|
|
|
Bytecode {
|
|
Entry 2
|
|
CheckStack 0
|
|
PushInt 0
|
|
PopLocal r0
|
|
PushInt 100
|
|
NegateInt
|
|
PopLocal r1
|
|
L4:
|
|
CheckStack 1
|
|
Push r1
|
|
Push FP[-5]
|
|
InterfaceCall CP#0, 1
|
|
InterfaceCall CP#2, 2
|
|
AssertBoolean 0
|
|
JumpIfFalse L1
|
|
Push r1
|
|
PushInt 0
|
|
CompareIntLt
|
|
JumpIfFalse L2
|
|
Jump L3
|
|
L2:
|
|
Push r0
|
|
Push FP[-5]
|
|
Push r1
|
|
InterfaceCall CP#4, 2
|
|
AddInt
|
|
PopLocal r0
|
|
L3:
|
|
Push r1
|
|
PushInt 1
|
|
AddInt
|
|
StoreLocal r1
|
|
Drop1
|
|
Jump L4
|
|
L1:
|
|
Push r0
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
[0] = InterfaceCall 'dart:core::List::get:length', ArgDesc num-args 1, num-type-args 0, names []
|
|
[1] = Reserved
|
|
[2] = InterfaceCall 'dart:core::num::<', ArgDesc num-args 2, num-type-args 0, names []
|
|
[3] = Reserved
|
|
[4] = InterfaceCall 'dart:core::List::[]', ArgDesc num-args 2, num-type-args 0, names []
|
|
[5] = Reserved
|
|
}
|
|
|
|
|
|
Function 'test_while', static, reflectable, debuggable
|
|
parameters [dart:core::List < dart:core::int* >* 'list'] (required: 1)
|
|
return-type dart:core::int*
|
|
|
|
Bytecode {
|
|
Entry 4
|
|
CheckStack 0
|
|
PushInt 0
|
|
PopLocal r0
|
|
PushInt 0
|
|
PopLocal r1
|
|
L2:
|
|
CheckStack 1
|
|
Push r1
|
|
Push FP[-5]
|
|
InterfaceCall CP#0, 1
|
|
InterfaceCall CP#2, 2
|
|
AssertBoolean 0
|
|
JumpIfFalse L1
|
|
Push r0
|
|
Push FP[-5]
|
|
Push r1
|
|
PopLocal r2
|
|
Push r2
|
|
PushInt 1
|
|
AddInt
|
|
StoreLocal r1
|
|
PopLocal r3
|
|
Push r2
|
|
InterfaceCall CP#4, 2
|
|
AddInt
|
|
PopLocal r0
|
|
Jump L2
|
|
L1:
|
|
Push r0
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
[0] = InterfaceCall 'dart:core::List::get:length', ArgDesc num-args 1, num-type-args 0, names []
|
|
[1] = Reserved
|
|
[2] = InterfaceCall 'dart:core::num::<', ArgDesc num-args 2, num-type-args 0, names []
|
|
[3] = Reserved
|
|
[4] = InterfaceCall 'dart:core::List::[]', ArgDesc num-args 2, num-type-args 0, names []
|
|
[5] = Reserved
|
|
}
|
|
|
|
|
|
Function 'test_do_while', static, reflectable, debuggable
|
|
parameters [dart:core::List < dart:core::int* >* 'list'] (required: 1)
|
|
return-type dart:core::int*
|
|
|
|
Bytecode {
|
|
Entry 2
|
|
CheckStack 0
|
|
PushInt 0
|
|
PopLocal r0
|
|
PushInt 0
|
|
PopLocal r1
|
|
L1:
|
|
CheckStack 1
|
|
Push r0
|
|
Push FP[-5]
|
|
Push r1
|
|
InterfaceCall CP#0, 2
|
|
AddInt
|
|
PopLocal r0
|
|
Push r1
|
|
PushInt 1
|
|
AddInt
|
|
PopLocal r1
|
|
Push r1
|
|
Push FP[-5]
|
|
InterfaceCall CP#2, 1
|
|
InterfaceCall CP#4, 2
|
|
AssertBoolean 0
|
|
JumpIfTrue L1
|
|
Push r0
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
[0] = InterfaceCall 'dart:core::List::[]', ArgDesc num-args 2, num-type-args 0, names []
|
|
[1] = Reserved
|
|
[2] = InterfaceCall 'dart:core::List::get:length', ArgDesc num-args 1, num-type-args 0, names []
|
|
[3] = Reserved
|
|
[4] = InterfaceCall 'dart:core::num::<', ArgDesc num-args 2, num-type-args 0, names []
|
|
[5] = Reserved
|
|
}
|
|
|
|
|
|
Function 'test_for_in', static, reflectable, debuggable
|
|
parameters [dart:core::List < dart:core::int* >* 'list'] (required: 1)
|
|
return-type dart:core::int*
|
|
|
|
Bytecode {
|
|
Entry 3
|
|
CheckStack 0
|
|
PushInt 0
|
|
PopLocal r0
|
|
Push FP[-5]
|
|
InterfaceCall CP#0, 1
|
|
PopLocal r1
|
|
L2:
|
|
CheckStack 1
|
|
Push r1
|
|
InterfaceCall CP#2, 1
|
|
AssertBoolean 0
|
|
JumpIfFalse L1
|
|
Push r1
|
|
InterfaceCall CP#4, 1
|
|
PopLocal r2
|
|
Push r0
|
|
Push r2
|
|
AddInt
|
|
PopLocal r0
|
|
Jump L2
|
|
L1:
|
|
Push r0
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
[0] = InterfaceCall 'dart:core::Iterable::get:iterator', ArgDesc num-args 1, num-type-args 0, names []
|
|
[1] = Reserved
|
|
[2] = InterfaceCall 'dart:core::Iterator::moveNext', ArgDesc num-args 1, num-type-args 0, names []
|
|
[3] = Reserved
|
|
[4] = InterfaceCall 'dart:core::Iterator::get:current', ArgDesc num-args 1, num-type-args 0, names []
|
|
[5] = Reserved
|
|
}
|
|
|
|
|
|
Function 'test_for_in_with_outer_var', static, reflectable, debuggable
|
|
parameters [dart:core::List < dart:core::int* >* 'list'] (required: 1)
|
|
return-type dart:core::int*
|
|
|
|
Bytecode {
|
|
Entry 4
|
|
CheckStack 0
|
|
PushInt 0
|
|
PopLocal r0
|
|
PushInt 42
|
|
PopLocal r1
|
|
Push FP[-5]
|
|
InterfaceCall CP#0, 1
|
|
PopLocal r2
|
|
L2:
|
|
CheckStack 1
|
|
Push r2
|
|
InterfaceCall CP#2, 1
|
|
AssertBoolean 0
|
|
JumpIfFalse L1
|
|
Push r2
|
|
InterfaceCall CP#4, 1
|
|
PopLocal r3
|
|
Push r3
|
|
PopLocal r1
|
|
Push r0
|
|
Push r1
|
|
AddInt
|
|
PopLocal r0
|
|
Jump L2
|
|
L1:
|
|
Push r0
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
[0] = InterfaceCall 'dart:core::Iterable::get:iterator', ArgDesc num-args 1, num-type-args 0, names []
|
|
[1] = Reserved
|
|
[2] = InterfaceCall 'dart:core::Iterator::moveNext', ArgDesc num-args 1, num-type-args 0, names []
|
|
[3] = Reserved
|
|
[4] = InterfaceCall 'dart:core::Iterator::get:current', ArgDesc num-args 1, num-type-args 0, names []
|
|
[5] = Reserved
|
|
}
|
|
|
|
|
|
Function 'main', static, reflectable, debuggable
|
|
parameters [] (required: 0)
|
|
return-type dynamic
|
|
|
|
Bytecode {
|
|
Entry 0
|
|
CheckStack 0
|
|
PushNull
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
}
|
|
|
|
|
|
}
|
|
]library #lib from "#lib" as #lib {
|
|
|
|
static method test_for(dart.core::List<dart.core::int*>* list) → dart.core::int* {
|
|
dart.core::int* sum = 0;
|
|
for (dart.core::int* i = 0; i.{dart.core::num::<}(list.{dart.core::List::length}); i = i.{dart.core::num::+}(1)) {
|
|
sum = sum.{dart.core::num::+}(list.{dart.core::List::[]}(i));
|
|
}
|
|
return sum;
|
|
}
|
|
static method test_for_break(dart.core::List<dart.core::int*>* list) → dart.core::int* {
|
|
dart.core::int* sum = 0;
|
|
#L1:
|
|
for (dart.core::int* i = 0; i.{dart.core::num::>=}(0); i = i.{dart.core::num::+}(1)) {
|
|
if(i.{dart.core::num::>=}(list.{dart.core::List::length})) {
|
|
break #L1;
|
|
}
|
|
sum = sum.{dart.core::num::+}(list.{dart.core::List::[]}(i));
|
|
}
|
|
return sum;
|
|
}
|
|
static method test_for_continue(dart.core::List<dart.core::int*>* list) → dart.core::int* {
|
|
dart.core::int* sum = 0;
|
|
for (dart.core::int* i = 100.{dart.core::int::unary-}(); i.{dart.core::num::<}(list.{dart.core::List::length}); i = i.{dart.core::num::+}(1))
|
|
#L2:
|
|
{
|
|
if(i.{dart.core::num::<}(0)) {
|
|
break #L2;
|
|
}
|
|
sum = sum.{dart.core::num::+}(list.{dart.core::List::[]}(i));
|
|
}
|
|
return sum;
|
|
}
|
|
static method test_while(dart.core::List<dart.core::int*>* list) → dart.core::int* {
|
|
dart.core::int* sum = 0;
|
|
dart.core::int* i = 0;
|
|
while (i.{dart.core::num::<}(list.{dart.core::List::length})) {
|
|
sum = sum.{dart.core::num::+}(list.{dart.core::List::[]}(let final dart.core::int* #t1 = i in let final dart.core::int* #t2 = i = #t1.{dart.core::num::+}(1) in #t1));
|
|
}
|
|
return sum;
|
|
}
|
|
static method test_do_while(dart.core::List<dart.core::int*>* list) → dart.core::int* {
|
|
dart.core::int* sum = 0;
|
|
dart.core::int* i = 0;
|
|
do {
|
|
sum = sum.{dart.core::num::+}(list.{dart.core::List::[]}(i));
|
|
i = i.{dart.core::num::+}(1);
|
|
}
|
|
while (i.{dart.core::num::<}(list.{dart.core::List::length}))
|
|
return sum;
|
|
}
|
|
static method test_for_in(dart.core::List<dart.core::int*>* list) → dart.core::int* {
|
|
dart.core::int* sum = 0;
|
|
{
|
|
dart.core::Iterator<dart.core::int*>* :sync-for-iterator = list.{dart.core::Iterable::iterator};
|
|
for (; :sync-for-iterator.{dart.core::Iterator::moveNext}(); ) {
|
|
dart.core::int* e = :sync-for-iterator.{dart.core::Iterator::current};
|
|
{
|
|
sum = sum.{dart.core::num::+}(e);
|
|
}
|
|
}
|
|
}
|
|
return sum;
|
|
}
|
|
static method test_for_in_with_outer_var(dart.core::List<dart.core::int*>* list) → dart.core::int* {
|
|
dart.core::int* sum = 0;
|
|
dart.core::int* e = 42;
|
|
{
|
|
dart.core::Iterator<dart.core::int*>* :sync-for-iterator = list.{dart.core::Iterable::iterator};
|
|
for (; :sync-for-iterator.{dart.core::Iterator::moveNext}(); ) {
|
|
final dart.core::int* #t3 = :sync-for-iterator.{dart.core::Iterator::current};
|
|
{
|
|
e = #t3;
|
|
sum = sum.{dart.core::num::+}(e);
|
|
}
|
|
}
|
|
}
|
|
return sum;
|
|
}
|
|
static method main() → dynamic {}
|
|
}
|