diff --git a/src/compiler/propagation/type_primitive_encoding.cc b/src/compiler/propagation/type_primitive_encoding.cc index f68b10a08..69fed52af 100644 --- a/src/compiler/propagation/type_primitive_encoding.cc +++ b/src/compiler/propagation/type_primitive_encoding.cc @@ -22,8 +22,13 @@ MODULE_TYPES(encoding, MODULE_ENCODING) TYPE_PRIMITIVE_ANY(base64_encode) TYPE_PRIMITIVE_ANY(base64_decode) -TYPE_PRIMITIVE_ANY(tison_encode) TYPE_PRIMITIVE_ANY(tison_decode) +TYPE_PRIMITIVE(tison_encode) { + result.add_byte_array(program); + failure.add_string(program); + failure.add_array(program); +} + } // namespace toit::compiler } // namespace toit diff --git a/src/compiler/propagation/type_primitive_programs_registry.cc b/src/compiler/propagation/type_primitive_programs_registry.cc index 895f6f66c..f2415adff 100644 --- a/src/compiler/propagation/type_primitive_programs_registry.cc +++ b/src/compiler/propagation/type_primitive_programs_registry.cc @@ -21,12 +21,18 @@ namespace compiler { MODULE_TYPES(programs_registry, MODULE_PROGRAMS_REGISTRY) TYPE_PRIMITIVE_ANY(next_group_id) -TYPE_PRIMITIVE_ANY(spawn) TYPE_PRIMITIVE_ANY(is_running) TYPE_PRIMITIVE_ANY(kill) TYPE_PRIMITIVE_ANY(bundled_images) TYPE_PRIMITIVE_ANY(assets) TYPE_PRIMITIVE_ANY(config) +TYPE_PRIMITIVE(spawn) { + result.add_smi(program); + failure.add_string(program); + failure.add_array(program); +} + + } // namespace toit::compiler } // namespace toit diff --git a/src/compiler/propagation/type_propagator.cc b/src/compiler/propagation/type_propagator.cc index 511e5476c..bd15000b7 100644 --- a/src/compiler/propagation/type_propagator.cc +++ b/src/compiler/propagation/type_propagator.cc @@ -1324,7 +1324,8 @@ static TypeScope* process(TypeScope* scope, uint8* bcp, std::vector& // difference encoded in the bytecode. TypeScope* target_scope = scope->copy_lazy(outer); TypeStack* target_top = target_scope->top(); - for (int i = 0; i < height_diff; i++) target_top->pop(); + int target_sp = target_top->sp() - height_diff; + while (target_top->sp() != target_sp) target_top->pop(); // Add the copied scope to the correct outer worklist. If we // already have a scope registered for the branch target, we // will merge into it and end up with a superfluous scope. @@ -1332,6 +1333,10 @@ static TypeScope* process(TypeScope* scope, uint8* bcp, std::vector& TypeScope* superfluous = worklists[target_level]->add(target_bcp, target_scope, false); delete superfluous; + + // TODO(kasper): Capture target_level, target_bcp, target_sp if we're + // inside a try-scope. + // We're done. Return the scope, so we can deallocate it. return scope; OPCODE_END(); @@ -1361,6 +1366,10 @@ static TypeScope* process(TypeScope* scope, uint8* bcp, std::vector& OPCODE_END(); OPCODE_BEGIN(UNWIND); + // Here we continue unwinding if an exception was thrown, so + // we must make this as a potential throw site to make sure + // any modifications to outer locals are merged back. + scope->throw_maybe(); // If the try-block is guaranteed to cause unwinding, // we avoid analyzing the bytecodes following this one. TypeSet target = stack->local(1); @@ -1369,6 +1378,10 @@ static TypeScope* process(TypeScope* scope, uint8* bcp, std::vector& stack->pop(); stack->pop(); stack->pop(); + + // TODO(kasper): How do we find the right set of non-local + // breaks that we may have to merge to for this unwind? + OPCODE_END(); OPCODE_BEGIN(HALT); @@ -1463,14 +1476,40 @@ void MethodTemplate::propagate() { Program* program = propagator_->program(); if (method_.selector_offset() == program->invoke_bytecode_offset(INVOKE_EQ)) { ConcreteType null_type = ConcreteType(Smi::value(program->null_class_id())); + ASSERT(!argument(0).is_any()); // Receiver is always a single type. bool receiver_is_null = argument(0).matches(null_type); bool argument_is_null = argument(1).matches(null_type); - if (receiver_is_null || argument_is_null) { - stack->push_bool_specific(program, receiver_is_null && argument_is_null); + bool argument_is_any = argument(1).is_any(); + if (receiver_is_null) { + // If we know the receiver is null, then we can always compute an + // answer. If the argument is any, we don't know if the result is + // true or false. Otherwise, the result is true if the argument + // is null and false if the argument is non-null. + if (argument_is_any) { + stack->push_bool(program); + } else { + stack->push_bool_specific(program, argument_is_null); + } ret(propagator_, stack); delete scope; return; } + + if (argument_is_null) { + // The receiver isn't null, so if the argument is null we + // know that the result is false. + stack->push_bool_specific(program, false); + ret(propagator_, stack); + delete scope; + return; + } else if (argument_is_any) { + // The receiver isn't null, so unless we know the argument + // cannot be null, we must add both true and false to the + // result but continue analyzing the method. + stack->push_bool(program); + ret(propagator_, stack); + } + for (int i = 0; i < arity(); i++) { TypeSet argument = stack->get(i); argument.remove_null(program); diff --git a/src/compiler/propagation/type_set.cc b/src/compiler/propagation/type_set.cc index 6ac098401..3009a6362 100644 --- a/src/compiler/propagation/type_set.cc +++ b/src/compiler/propagation/type_set.cc @@ -97,7 +97,7 @@ bool TypeSet::can_be_truthy(Program* program) const { Iterator it(*this, TypeSet::words_per_type(program)); while (it.has_next()) { unsigned id = it.next(); - if (id != null_id || id != false_id) return true; + if (id != null_id && id != false_id) return true; } return false; } diff --git a/tests/finally-params-test.toit b/tests/finally-params-test.toit index b3fb71b0b..43446c84d 100644 --- a/tests/finally-params-test.toit +++ b/tests/finally-params-test.toit @@ -13,7 +13,7 @@ test0: expect-null exception test1: - // With local. (shifting the try/finally locals. + // With local (shifting the try/finally locals). was-in-finally := false try: null diff --git a/tests/type_propagation/default-arguments-test.toit b/tests/type_propagation/default-arguments-test.toit new file mode 100644 index 000000000..4af39ec1e --- /dev/null +++ b/tests/type_propagation/default-arguments-test.toit @@ -0,0 +1,41 @@ +// Copyright (C) 2023 Toitware ApS. +// Use of this source code is governed by a Zero-Clause BSD license that can +// be found in the tests/LICENSE file. + +main: + test-default-true --x + test-default-true --x=false + test-default-true --x=true + test-default-true --no-x + test-default-true --x=null + + test-default-false --x + test-default-false --x=false + test-default-false --x=true + test-default-false --no-x + test-default-false --x=null + + test-non-default --x + test-non-default --x=true + test-non-default --no-x + test-non-default --x=false + + test-non-default-non-literal --x + test-non-default-non-literal --x=true + test-non-default-non-literal --no-x + test-non-default-non-literal --x=false + +test-default-true --x/bool=true: + return x + +test-default-false --x/bool=false: + return x + +test-non-default --x/bool=true: + return x + +test-non-default-non-literal --x/bool=gettrue: + return x + +gettrue: + return true diff --git a/tests/type_propagation/finally-test.toit b/tests/type_propagation/finally-test.toit index c3ba4185b..8aa62619d 100644 --- a/tests/type_propagation/finally-test.toit +++ b/tests/type_propagation/finally-test.toit @@ -7,6 +7,13 @@ main: test-exception test-catchy test-nlb-out-of-try + test-throw-update-in-finally + test-break-update-in-finally + test-break-update-in-finally-block0 + test-break-update-in-finally-block1 + test-break-update-in-finally-block2 + test-break-update-in-finally-block3 + test-break-update-in-finally-nested test-is-exception: return-is-exception @@ -58,6 +65,86 @@ test-nlb-out-of-try: finally: id x +test-throw-update-in-finally: + x := false + invoke-catch: + try: + throw "ugh" + finally: + x = true + id x + +test-break-update-in-finally: + x := false + while true: + try: + break + finally: + x = true + id x + +test-break-update-in-finally-block0: + x := false + while true: + invoke: + try: + break + finally: + x = true + id x + +test-break-update-in-finally-block1: + x := false + while true: + block := (: break) + try: + block.call + finally: + x = true + id x + +test-break-update-in-finally-block2: + x/any := null + while true: + block := (: break) + try: + block.call + finally: + x = true + try: + block.call + finally: + x = false + id x + +test-break-update-in-finally-block3: + x := false + y := null + while true: + block := (: break) + while true: + try: + if pick: block.call + else: break + finally: + x = true + y = x + id x + id y + +test-break-update-in-finally-nested: + x/any := null + while true: + try: + try: + x = 0 + break + finally: + x = true + finally: + x = "horse" + id x + id x: return x @@ -66,3 +153,9 @@ pick: invoke [block]: block.call + +invoke-catch [block]: + try: + block.call + finally: + return diff --git a/tests/type_propagation/gold/default-arguments-test.gold b/tests/type_propagation/gold/default-arguments-test.gold new file mode 100644 index 000000000..d63406323 --- /dev/null +++ b/tests/type_propagation/gold/default-arguments-test.gold @@ -0,0 +1,107 @@ +main tests/type_propagation/default-arguments-test.toit + 0[020] - load literal true + 2[053] - invoke static test-default-true tests/type_propagation/default-arguments-test.toit // [{True_}] -> {True_} + 5[041] - pop 1 + 6[020] - load literal false + 8[053] - invoke static test-default-true tests/type_propagation/default-arguments-test.toit // [{False_}] -> {True_|False_} + 11[041] - pop 1 + 12[020] - load literal true + 14[053] - invoke static test-default-true tests/type_propagation/default-arguments-test.toit // [{True_}] -> {True_} + 17[041] - pop 1 + 18[020] - load literal false + 20[053] - invoke static test-default-true tests/type_propagation/default-arguments-test.toit // [{False_}] -> {True_|False_} + 23[041] - pop 1 + 24[022] - load null + 25[053] - invoke static test-default-true tests/type_propagation/default-arguments-test.toit // [{Null_}] -> {True_} + 28[041] - pop 1 + 29[020] - load literal true + 31[053] - invoke static test-default-false tests/type_propagation/default-arguments-test.toit // [{True_}] -> {True_|False_} + 34[041] - pop 1 + 35[020] - load literal false + 37[053] - invoke static test-default-false tests/type_propagation/default-arguments-test.toit // [{False_}] -> {False_} + 40[041] - pop 1 + 41[020] - load literal true + 43[053] - invoke static test-default-false tests/type_propagation/default-arguments-test.toit // [{True_}] -> {True_|False_} + 46[041] - pop 1 + 47[020] - load literal false + 49[053] - invoke static test-default-false tests/type_propagation/default-arguments-test.toit // [{False_}] -> {False_} + 52[041] - pop 1 + 53[022] - load null + 54[053] - invoke static test-default-false tests/type_propagation/default-arguments-test.toit // [{Null_}] -> {False_} + 57[041] - pop 1 + 58[020] - load literal true + 60[053] - invoke static test-non-default tests/type_propagation/default-arguments-test.toit // [{True_}] -> {True_} + 63[041] - pop 1 + 64[020] - load literal true + 66[053] - invoke static test-non-default tests/type_propagation/default-arguments-test.toit // [{True_}] -> {True_} + 69[041] - pop 1 + 70[020] - load literal false + 72[053] - invoke static test-non-default tests/type_propagation/default-arguments-test.toit // [{False_}] -> {True_|False_} + 75[041] - pop 1 + 76[020] - load literal false + 78[053] - invoke static test-non-default tests/type_propagation/default-arguments-test.toit // [{False_}] -> {True_|False_} + 81[041] - pop 1 + 82[020] - load literal true + 84[053] - invoke static test-non-default-non-literal tests/type_propagation/default-arguments-test.toit // [{True_}] -> {True_} + 87[041] - pop 1 + 88[020] - load literal true + 90[053] - invoke static test-non-default-non-literal tests/type_propagation/default-arguments-test.toit // [{True_}] -> {True_} + 93[041] - pop 1 + 94[020] - load literal false + 96[053] - invoke static test-non-default-non-literal tests/type_propagation/default-arguments-test.toit // [{False_}] -> {True_|False_} + 99[041] - pop 1 +100[020] - load literal false +102[053] - invoke static test-non-default-non-literal tests/type_propagation/default-arguments-test.toit // [{False_}] -> {True_|False_} +105[089] - return null S1 0 + +test-default-true tests/type_propagation/default-arguments-test.toit + - argument 0: {Null_|True_|False_} + 0[016] - load local 2 + 1[022] - load null + 2[093] - identical + 3[082] - branch if false T10 + 6[020] - load literal true + 8[004] - store local, pop S3 + 10[052] - load local, as class, pop 2 - True_(18 - 20) // {True_|False_} + 12[016] - load local 2 + 13[088] - return S1 1 + +test-default-false tests/type_propagation/default-arguments-test.toit + - argument 0: {Null_|True_|False_} + 0[016] - load local 2 + 1[022] - load null + 2[093] - identical + 3[082] - branch if false T10 + 6[020] - load literal false + 8[004] - store local, pop S3 + 10[052] - load local, as class, pop 2 - True_(18 - 20) // {True_|False_} + 12[016] - load local 2 + 13[088] - return S1 1 + +test-non-default tests/type_propagation/default-arguments-test.toit + - argument 0: {True_|False_} + 0[016] - load local 2 + 1[022] - load null + 2[093] - identical + 3[082] - branch if false T10 + 6[020] - load literal true + 8[004] - store local, pop S3 + 10[052] - load local, as class, pop 2 - True_(18 - 20) // {True_} + 12[016] - load local 2 + 13[088] - return S1 1 + +test-non-default-non-literal tests/type_propagation/default-arguments-test.toit + - argument 0: {True_|False_} + 0[016] - load local 2 + 1[022] - load null + 2[093] - identical + 3[082] - branch if false T11 + 6[053] - invoke static gettrue tests/type_propagation/default-arguments-test.toit // {True_} + 9[004] - store local, pop S3 + 11[052] - load local, as class, pop 2 - True_(18 - 20) // {True_} + 13[016] - load local 2 + 14[088] - return S1 1 + +gettrue tests/type_propagation/default-arguments-test.toit + 0[020] - load literal true + 2[088] - return S1 0 diff --git a/tests/type_propagation/gold/default-arguments-test.gold-O2 b/tests/type_propagation/gold/default-arguments-test.gold-O2 new file mode 100644 index 000000000..48debb84f --- /dev/null +++ b/tests/type_propagation/gold/default-arguments-test.gold-O2 @@ -0,0 +1,105 @@ +main tests/type_propagation/default-arguments-test.toit + 0[020] - load literal true + 2[053] - invoke static test-default-true tests/type_propagation/default-arguments-test.toit // [{True_}] -> {True_} + 5[041] - pop 1 + 6[020] - load literal false + 8[053] - invoke static test-default-true tests/type_propagation/default-arguments-test.toit // [{False_}] -> {True_|False_} + 11[041] - pop 1 + 12[020] - load literal true + 14[053] - invoke static test-default-true tests/type_propagation/default-arguments-test.toit // [{True_}] -> {True_} + 17[041] - pop 1 + 18[020] - load literal false + 20[053] - invoke static test-default-true tests/type_propagation/default-arguments-test.toit // [{False_}] -> {True_|False_} + 23[041] - pop 1 + 24[022] - load null + 25[053] - invoke static test-default-true tests/type_propagation/default-arguments-test.toit // [{Null_}] -> {True_} + 28[041] - pop 1 + 29[020] - load literal true + 31[053] - invoke static test-default-false tests/type_propagation/default-arguments-test.toit // [{True_}] -> {True_|False_} + 34[041] - pop 1 + 35[020] - load literal false + 37[053] - invoke static test-default-false tests/type_propagation/default-arguments-test.toit // [{False_}] -> {False_} + 40[041] - pop 1 + 41[020] - load literal true + 43[053] - invoke static test-default-false tests/type_propagation/default-arguments-test.toit // [{True_}] -> {True_|False_} + 46[041] - pop 1 + 47[020] - load literal false + 49[053] - invoke static test-default-false tests/type_propagation/default-arguments-test.toit // [{False_}] -> {False_} + 52[041] - pop 1 + 53[022] - load null + 54[053] - invoke static test-default-false tests/type_propagation/default-arguments-test.toit // [{Null_}] -> {False_} + 57[041] - pop 1 + 58[020] - load literal true + 60[053] - invoke static test-non-default tests/type_propagation/default-arguments-test.toit // [{True_}] -> {True_} + 63[041] - pop 1 + 64[020] - load literal true + 66[053] - invoke static test-non-default tests/type_propagation/default-arguments-test.toit // [{True_}] -> {True_} + 69[041] - pop 1 + 70[020] - load literal false + 72[053] - invoke static test-non-default tests/type_propagation/default-arguments-test.toit // [{False_}] -> {True_|False_} + 75[041] - pop 1 + 76[020] - load literal false + 78[053] - invoke static test-non-default tests/type_propagation/default-arguments-test.toit // [{False_}] -> {True_|False_} + 81[041] - pop 1 + 82[020] - load literal true + 84[053] - invoke static test-non-default-non-literal tests/type_propagation/default-arguments-test.toit // [{True_}] -> {True_} + 87[041] - pop 1 + 88[020] - load literal true + 90[053] - invoke static test-non-default-non-literal tests/type_propagation/default-arguments-test.toit // [{True_}] -> {True_} + 93[041] - pop 1 + 94[020] - load literal false + 96[053] - invoke static test-non-default-non-literal tests/type_propagation/default-arguments-test.toit // [{False_}] -> {True_|False_} + 99[041] - pop 1 +100[020] - load literal false +102[053] - invoke static test-non-default-non-literal tests/type_propagation/default-arguments-test.toit // [{False_}] -> {True_|False_} +105[089] - return null S1 0 + +test-default-true tests/type_propagation/default-arguments-test.toit + - argument 0: {Null_|True_|False_} + 0[016] - load local 2 + 1[022] - load null + 2[093] - identical + 3[082] - branch if false T10 + 6[020] - load literal true + 8[004] - store local, pop S3 + 10[052] - load local, as class, pop 2 - True_(15 - 17) // {True_|False_} + 12[016] - load local 2 + 13[088] - return S1 1 + +test-default-false tests/type_propagation/default-arguments-test.toit + - argument 0: {Null_|True_|False_} + 0[016] - load local 2 + 1[022] - load null + 2[093] - identical + 3[082] - branch if false T10 + 6[020] - load literal false + 8[004] - store local, pop S3 + 10[052] - load local, as class, pop 2 - True_(15 - 17) // {True_|False_} + 12[016] - load local 2 + 13[088] - return S1 1 + +test-non-default tests/type_propagation/default-arguments-test.toit + - argument 0: {True_|False_} + 0[016] - load local 2 + 1[022] - load null + 2[093] - identical + 3[082] - branch if false T10 + 6[020] - load literal true + 8[004] - store local, pop S3 + 10[016] - load local 2 + 11[088] - return S1 1 + +test-non-default-non-literal tests/type_propagation/default-arguments-test.toit + - argument 0: {True_|False_} + 0[016] - load local 2 + 1[022] - load null + 2[093] - identical + 3[082] - branch if false T11 + 6[053] - invoke static gettrue tests/type_propagation/default-arguments-test.toit // {True_} + 9[004] - store local, pop S3 + 11[016] - load local 2 + 12[088] - return S1 1 + +gettrue tests/type_propagation/default-arguments-test.toit + 0[020] - load literal true + 2[088] - return S1 0 diff --git a/tests/type_propagation/gold/deltablue-test.gold b/tests/type_propagation/gold/deltablue-test.gold index e735aad56..7cc5c7359 100644 --- a/tests/type_propagation/gold/deltablue-test.gold +++ b/tests/type_propagation/gold/deltablue-test.gold @@ -772,10 +772,10 @@ ScaleConstraint.recalculate tests/type_propagation/deltablue-test.toit EqualityConstraint tests/type_propagation/deltablue-test.toit - argument 0: {EqualityConstraint} - argument 1: {Strength} - - argument 2: {Null_|Variable} + - argument 2: {Variable} - argument 3: {Variable} 0[052] - load local, as class, pop 4 - Strength(47 - 48) // {True_} - 2[052] - load local, as class, pop 3 - Variable(42 - 43) // {True_|False_} + 2[052] - load local, as class, pop 3 - Variable(42 - 43) // {True_} 4[052] - load local, as class, pop 2 - Variable(42 - 43) // {True_} 6[019] - load local 5 7[019] - load local 5 @@ -1282,7 +1282,7 @@ chain-test tests/type_propagation/deltablue-test.toit 43[032] - load global var lazy G0 // {Strength} 45[000] - load local S6 47[017] - load local 3 - 48[053] - invoke static EqualityConstraint tests/type_propagation/deltablue-test.toit // [{EqualityConstraint}, {Strength}, {Null_|Variable}, {Variable}] -> {EqualityConstraint} + 48[053] - invoke static EqualityConstraint tests/type_propagation/deltablue-test.toit // [{EqualityConstraint}, {Strength}, {Variable}, {Variable}] -> {EqualityConstraint} 51[041] - pop 1 52[015] - load local 1 53[023] - load smi 0 diff --git a/tests/type_propagation/gold/deltablue-test.gold-O2 b/tests/type_propagation/gold/deltablue-test.gold-O2 index 3cb158bd3..6727328ea 100644 --- a/tests/type_propagation/gold/deltablue-test.gold-O2 +++ b/tests/type_propagation/gold/deltablue-test.gold-O2 @@ -719,16 +719,15 @@ ScaleConstraint.recalculate tests/type_propagation/deltablue-test.toit EqualityConstraint tests/type_propagation/deltablue-test.toit - argument 0: {EqualityConstraint} - argument 1: {Strength} - - argument 2: {Null_|Variable} + - argument 2: {Variable} - argument 3: {Variable} - 0[052] - load local, as class, pop 3 - Variable(37 - 38) // {True_|False_} + 0[019] - load local 5 + 1[019] - load local 5 2[019] - load local 5 3[019] - load local 5 - 4[019] - load local 5 - 5[019] - load local 5 - 6[053] - invoke static BinaryConstraint tests/type_propagation/deltablue-test.toit // [{EqualityConstraint}, {Strength}, {Variable}, {Variable}] -> {EqualityConstraint} - 9[002] - pop, load local S5 - 11[088] - return S1 4 + 4[053] - invoke static BinaryConstraint tests/type_propagation/deltablue-test.toit // [{EqualityConstraint}, {Strength}, {Variable}, {Variable}] -> {EqualityConstraint} + 7[002] - pop, load local S5 + 9[088] - return S1 4 EqualityConstraint.execute tests/type_propagation/deltablue-test.toit - argument 0: {EqualityConstraint} @@ -1211,7 +1210,7 @@ chain-test tests/type_propagation/deltablue-test.toit 39[032] - load global var lazy G0 // {Strength} 41[000] - load local S6 43[017] - load local 3 - 44[053] - invoke static EqualityConstraint tests/type_propagation/deltablue-test.toit // [{EqualityConstraint}, {Strength}, {Null_|Variable}, {Variable}] -> {EqualityConstraint} + 44[053] - invoke static EqualityConstraint tests/type_propagation/deltablue-test.toit // [{EqualityConstraint}, {Strength}, {Variable}, {Variable}] -> {EqualityConstraint} 47[041] - pop 1 48[015] - load local 1 49[023] - load smi 0 diff --git a/tests/type_propagation/gold/finally-test.gold b/tests/type_propagation/gold/finally-test.gold index 916c45f40..a7a310016 100644 --- a/tests/type_propagation/gold/finally-test.gold +++ b/tests/type_propagation/gold/finally-test.gold @@ -6,7 +6,21 @@ main tests/type_propagation/finally-test.toit 8[053] - invoke static test-catchy tests/type_propagation/finally-test.toit // {Null_} 11[041] - pop 1 12[053] - invoke static test-nlb-out-of-try tests/type_propagation/finally-test.toit // {Null_} - 15[089] - return null S1 0 + 15[041] - pop 1 + 16[053] - invoke static test-throw-update-in-finally tests/type_propagation/finally-test.toit // {Null_} + 19[041] - pop 1 + 20[053] - invoke static test-break-update-in-finally tests/type_propagation/finally-test.toit // {Null_} + 23[041] - pop 1 + 24[053] - invoke static test-break-update-in-finally-block0 tests/type_propagation/finally-test.toit // {Null_} + 27[041] - pop 1 + 28[053] - invoke static test-break-update-in-finally-block1 tests/type_propagation/finally-test.toit // {Null_} + 31[041] - pop 1 + 32[053] - invoke static test-break-update-in-finally-block2 tests/type_propagation/finally-test.toit // {Null_} + 35[041] - pop 1 + 36[053] - invoke static test-break-update-in-finally-block3 tests/type_propagation/finally-test.toit // {Null_} + 39[041] - pop 1 + 40[053] - invoke static test-break-update-in-finally-nested tests/type_propagation/finally-test.toit // {Null_} + 43[089] - return null S1 0 test-is-exception tests/type_propagation/finally-test.toit 0[053] - invoke static return-is-exception tests/type_propagation/finally-test.toit // {True_|False_} @@ -196,6 +210,264 @@ test-nlb-out-of-try tests/type_propagation/finally-test.toit 4[090] - non-local return 16 6[088] - return S1 1 +test-throw-update-in-finally tests/type_propagation/finally-test.toit + 0[020] - load literal false + 2[029] - load method [block] in test-throw-update-in-finally tests/type_propagation/finally-test.toit + 7[038] - load block 0 + 9[053] - invoke static invoke-catch tests/type_propagation/finally-test.toit // [[block]] -> {Null_} + 12[041] - pop 1 + 13[002] - pop, load local S0 + 15[053] - invoke static id tests/type_propagation/finally-test.toit // [{True_|False_}] -> {True_|False_} + 18[089] - return null S2 0 + +[block] in test-throw-update-in-finally tests/type_propagation/finally-test.toit + - argument 0: [block] + 0[029] - load method [block] in [block] in test-throw-update-in-finally tests/type_propagation/finally-test.toit + 5[094] - link try 0 + 7[038] - load block 4 + 9[055] - invoke block S1 // [[block]] -> {} + 11[041] - pop 1 + 12[095] - unlink try 0 + 14[000] - load local S6 + 16[020] - load literal true + 18[006] - store outer S1 + 20[041] - pop 1 + 21[096] - unwind + 22[041] - pop 1 + 23[022] - load null + 24[088] - return S1 1 + +[block] in [block] in test-throw-update-in-finally tests/type_propagation/finally-test.toit + - argument 0: [block] + 0[020] - load literal ugh + 2[053] - invoke static throw /core/exceptions.toit // [{String_}] -> {} + 5[088] - return S1 1 + +test-break-update-in-finally tests/type_propagation/finally-test.toit + 0[020] - load literal false + 2[029] - load method [block] in test-break-update-in-finally tests/type_propagation/finally-test.toit + 7[094] - link try 0 + 9[038] - load block 4 + 11[055] - invoke block S1 // [[block]] -> {} + 13[041] - pop 1 + 14[095] - unlink try 0 + 16[020] - load literal true + 18[004] - store local, pop S5 + 20[096] - unwind + 21[041] - pop 1 + 22[083] - branch back T2 + 27[014] - load local 0 + 28[053] - invoke static id tests/type_propagation/finally-test.toit // [{False_}] -> {False_} + 31[089] - return null S2 0 + +[block] in test-break-update-in-finally tests/type_propagation/finally-test.toit + - argument 0: [block] + 0[016] - load local 2 + 1[092] - non-local branch {test-break-update-in-finally:27} + 7[088] - return S1 1 + +test-break-update-in-finally-block0 tests/type_propagation/finally-test.toit + 0[020] - load literal false + 2[029] - load method [block] in test-break-update-in-finally-block0 tests/type_propagation/finally-test.toit + 7[038] - load block 0 + 9[053] - invoke static invoke tests/type_propagation/finally-test.toit // [[block]] -> {} + 12[040] - pop 2 + 14[083] - branch back T2 + 19[014] - load local 0 + 20[053] - invoke static id tests/type_propagation/finally-test.toit // [{False_}] -> {False_} + 23[089] - return null S2 0 + +[block] in test-break-update-in-finally-block0 tests/type_propagation/finally-test.toit + - argument 0: [block] + 0[029] - load method [block] in [block] in test-break-update-in-finally-block0 tests/type_propagation/finally-test.toit + 5[094] - link try 0 + 7[038] - load block 4 + 9[055] - invoke block S1 // [[block]] -> {} + 11[041] - pop 1 + 12[095] - unlink try 0 + 14[000] - load local S6 + 16[020] - load literal true + 18[006] - store outer S1 + 20[041] - pop 1 + 21[096] - unwind + 22[041] - pop 1 + 23[022] - load null + 24[088] - return S1 1 + +[block] in [block] in test-break-update-in-finally-block0 tests/type_propagation/finally-test.toit + - argument 0: [block] + 0[016] - load local 2 + 1[005] - load outer S3 // [block] + 3[092] - non-local branch {test-break-update-in-finally-block0:19} + 9[088] - return S1 1 + +test-break-update-in-finally-block1 tests/type_propagation/finally-test.toit + 0[020] - load literal false + 2[029] - load method [block] in test-break-update-in-finally-block1 tests/type_propagation/finally-test.toit + 7[029] - load method [block] in test-break-update-in-finally-block1 tests/type_propagation/finally-test.toit + 12[094] - link try 0 + 14[038] - load block 4 + 16[055] - invoke block S1 // [[block]] -> {} + 18[041] - pop 1 + 19[095] - unlink try 0 + 21[020] - load literal true + 23[004] - store local, pop S6 + 25[096] - unwind + 26[040] - pop 2 + 28[083] - branch back T2 + 33[014] - load local 0 + 34[053] - invoke static id tests/type_propagation/finally-test.toit // [{False_}] -> {False_} + 37[089] - return null S2 0 + +[block] in test-break-update-in-finally-block1 tests/type_propagation/finally-test.toit + - argument 0: [block] + 0[016] - load local 2 + 1[092] - non-local branch {test-break-update-in-finally-block1:33} + 7[088] - return S1 1 + +[block] in test-break-update-in-finally-block1 tests/type_propagation/finally-test.toit + - argument 0: [block] + 0[016] - load local 2 + 1[039] - load outer block 1 // [block] + 3[055] - invoke block S1 // [[block]] -> {} + 5[088] - return S1 1 + +test-break-update-in-finally-block2 tests/type_propagation/finally-test.toit + 0[022] - load null + 1[029] - load method [block] in test-break-update-in-finally-block2 tests/type_propagation/finally-test.toit + 6[029] - load method [block] in test-break-update-in-finally-block2 tests/type_propagation/finally-test.toit + 11[094] - link try 0 + 13[038] - load block 4 + 15[055] - invoke block S1 // [[block]] -> {} + 17[041] - pop 1 + 18[095] - unlink try 0 + 20[020] - load literal true + 22[004] - store local, pop S6 + 24[029] - load method [block] in test-break-update-in-finally-block2 tests/type_propagation/finally-test.toit + 29[094] - link try 0 + 31[038] - load block 4 + 33[055] - invoke block S1 // [[block]] -> {} + 35[041] - pop 1 + 36[095] - unlink try 0 + 38[020] - load literal false + 40[004] - store local, pop S10 + 42[096] - unwind + 43[041] - pop 1 + 44[096] - unwind + 45[040] - pop 2 + 47[083] - branch back T1 + 52[014] - load local 0 + 53[053] - invoke static id tests/type_propagation/finally-test.toit // [{Null_}] -> {Null_} + 56[089] - return null S2 0 + +[block] in test-break-update-in-finally-block2 tests/type_propagation/finally-test.toit + - argument 0: [block] + 0[016] - load local 2 + 1[092] - non-local branch {test-break-update-in-finally-block2:52} + 7[088] - return S1 1 + +[block] in test-break-update-in-finally-block2 tests/type_propagation/finally-test.toit + - argument 0: [block] + 0[016] - load local 2 + 1[039] - load outer block 1 // [block] + 3[055] - invoke block S1 // [[block]] -> {} + 5[088] - return S1 1 + +[block] in test-break-update-in-finally-block2 tests/type_propagation/finally-test.toit + - argument 0: [block] + 0[016] - load local 2 + 1[039] - load outer block 5 // [block] + 3[055] - invoke block S1 // [[block]] -> {} + 5[088] - return S1 1 + +test-break-update-in-finally-block3 tests/type_propagation/finally-test.toit + 0[020] - load literal false + 2[022] - load null + 3[029] - load method [block] in test-break-update-in-finally-block3 tests/type_propagation/finally-test.toit + 8[029] - load method [block] in test-break-update-in-finally-block3 tests/type_propagation/finally-test.toit + 13[094] - link try 0 + 15[038] - load block 4 + 17[055] - invoke block S1 // [[block]] -> {} + 19[041] - pop 1 + 20[095] - unlink try 0 + 22[020] - load literal true + 24[004] - store local, pop S7 + 26[096] - unwind + 27[041] - pop 1 + 28[083] - branch back T8 + 33[016] - load local 2 + 34[004] - store local, pop S2 + 36[041] - pop 1 + 37[083] - branch back T3 + 42[015] - load local 1 + 43[053] - invoke static id tests/type_propagation/finally-test.toit // [{False_}] -> {False_} + 46[002] - pop, load local S0 + 48[053] - invoke static id tests/type_propagation/finally-test.toit // [{Null_|False_}] -> {Null_|False_} + 51[089] - return null S3 0 + +[block] in test-break-update-in-finally-block3 tests/type_propagation/finally-test.toit + - argument 0: [block] + 0[016] - load local 2 + 1[092] - non-local branch {test-break-update-in-finally-block3:42} + 7[088] - return S1 1 + +[block] in test-break-update-in-finally-block3 tests/type_propagation/finally-test.toit + - argument 0: [block] + 0[053] - invoke static pick tests/type_propagation/finally-test.toit // {True_|False_} + 3[082] - branch if false T14 + 6[016] - load local 2 + 7[039] - load outer block 1 // [block] + 9[055] - invoke block S1 // [[block]] -> {} + 11[080] - branch T21 + 14[016] - load local 2 + 15[092] - non-local branch {test-break-update-in-finally-block3:33} + 21[088] - return S1 1 + +test-break-update-in-finally-nested tests/type_propagation/finally-test.toit + 0[022] - load null + 1[029] - load method [block] in test-break-update-in-finally-nested tests/type_propagation/finally-test.toit + 6[094] - link try 0 + 8[038] - load block 4 + 10[055] - invoke block S1 // [[block]] -> {} + 12[041] - pop 1 + 13[095] - unlink try 0 + 15[020] - load literal horse + 17[004] - store local, pop S5 + 19[096] - unwind + 20[041] - pop 1 + 21[083] - branch back T1 + 26[014] - load local 0 + 27[053] - invoke static id tests/type_propagation/finally-test.toit // [{SmallInteger_}] -> {SmallInteger_} + 30[089] - return null S2 0 + +[block] in test-break-update-in-finally-nested tests/type_propagation/finally-test.toit + - argument 0: [block] + 0[029] - load method [block] in [block] in test-break-update-in-finally-nested tests/type_propagation/finally-test.toit + 5[094] - link try 0 + 7[038] - load block 4 + 9[055] - invoke block S1 // [[block]] -> {} + 11[041] - pop 1 + 12[095] - unlink try 0 + 14[000] - load local S6 + 16[020] - load literal true + 18[006] - store outer S1 + 20[041] - pop 1 + 21[096] - unwind + 22[041] - pop 1 + 23[022] - load null + 24[088] - return S1 1 + +[block] in [block] in test-break-update-in-finally-nested tests/type_propagation/finally-test.toit + - argument 0: [block] + 0[016] - load local 2 + 1[005] - load outer S3 // [block] + 3[023] - load smi 0 + 4[006] - store outer S1 + 6[002] - pop, load local S2 + 8[005] - load outer S3 // [block] + 10[092] - non-local branch {test-break-update-in-finally-nested:26} + 16[088] - return S1 1 + id tests/type_propagation/finally-test.toit - argument 0: {String_|Null_|True_|False_|SmallInteger_|Exception_} 0[016] - load local 2 @@ -213,3 +485,22 @@ invoke tests/type_propagation/finally-test.toit 0[016] - load local 2 1[055] - invoke block S1 // [[block]] -> {} 3[089] - return null S1 1 + +invoke-catch tests/type_propagation/finally-test.toit + - argument 0: [block] + 0[029] - load method [block] in invoke-catch tests/type_propagation/finally-test.toit + 5[094] - link try 0 + 7[038] - load block 4 + 9[055] - invoke block S1 // [[block]] -> {} + 11[041] - pop 1 + 12[095] - unlink try 0 + 14[089] - return null S4 1 + 17[096] - unwind + 18[041] - pop 1 + +[block] in invoke-catch tests/type_propagation/finally-test.toit + - argument 0: [block] + 0[016] - load local 2 + 1[005] - load outer S3 // [block] + 3[055] - invoke block S1 // [[block]] -> {} + 5[088] - return S1 1 diff --git a/tests/type_propagation/gold/finally-test.gold-O2 b/tests/type_propagation/gold/finally-test.gold-O2 index fe4d71e6b..7c7507b35 100644 --- a/tests/type_propagation/gold/finally-test.gold-O2 +++ b/tests/type_propagation/gold/finally-test.gold-O2 @@ -6,7 +6,21 @@ main tests/type_propagation/finally-test.toit 8[053] - invoke static test-catchy tests/type_propagation/finally-test.toit // {Null_} 11[041] - pop 1 12[053] - invoke static test-nlb-out-of-try tests/type_propagation/finally-test.toit // {Null_} - 15[089] - return null S1 0 + 15[041] - pop 1 + 16[053] - invoke static test-throw-update-in-finally tests/type_propagation/finally-test.toit // {Null_} + 19[041] - pop 1 + 20[053] - invoke static test-break-update-in-finally tests/type_propagation/finally-test.toit // {Null_} + 23[041] - pop 1 + 24[053] - invoke static test-break-update-in-finally-block0 tests/type_propagation/finally-test.toit // {Null_} + 27[041] - pop 1 + 28[053] - invoke static test-break-update-in-finally-block1 tests/type_propagation/finally-test.toit // {Null_} + 31[041] - pop 1 + 32[053] - invoke static test-break-update-in-finally-block2 tests/type_propagation/finally-test.toit // {Null_} + 35[041] - pop 1 + 36[053] - invoke static test-break-update-in-finally-block3 tests/type_propagation/finally-test.toit // {Null_} + 39[041] - pop 1 + 40[053] - invoke static test-break-update-in-finally-nested tests/type_propagation/finally-test.toit // {Null_} + 43[089] - return null S1 0 test-is-exception tests/type_propagation/finally-test.toit 0[053] - invoke static return-is-exception tests/type_propagation/finally-test.toit // {True_|False_} @@ -196,6 +210,264 @@ test-nlb-out-of-try tests/type_propagation/finally-test.toit 4[090] - non-local return 16 6[088] - return S1 1 +test-throw-update-in-finally tests/type_propagation/finally-test.toit + 0[020] - load literal false + 2[029] - load method [block] in test-throw-update-in-finally tests/type_propagation/finally-test.toit + 7[038] - load block 0 + 9[053] - invoke static invoke-catch tests/type_propagation/finally-test.toit // [[block]] -> {Null_} + 12[041] - pop 1 + 13[002] - pop, load local S0 + 15[053] - invoke static id tests/type_propagation/finally-test.toit // [{True_|False_}] -> {True_|False_} + 18[089] - return null S2 0 + +[block] in test-throw-update-in-finally tests/type_propagation/finally-test.toit + - argument 0: [block] + 0[029] - load method [block] in [block] in test-throw-update-in-finally tests/type_propagation/finally-test.toit + 5[094] - link try 0 + 7[038] - load block 4 + 9[055] - invoke block S1 // [[block]] -> {} + 11[041] - pop 1 + 12[095] - unlink try 0 + 14[000] - load local S6 + 16[020] - load literal true + 18[006] - store outer S1 + 20[041] - pop 1 + 21[096] - unwind + 22[041] - pop 1 + 23[022] - load null + 24[088] - return S1 1 + +[block] in [block] in test-throw-update-in-finally tests/type_propagation/finally-test.toit + - argument 0: [block] + 0[020] - load literal ugh + 2[053] - invoke static throw /core/exceptions.toit // [{String_}] -> {} + 5[088] - return S1 1 + +test-break-update-in-finally tests/type_propagation/finally-test.toit + 0[020] - load literal false + 2[029] - load method [block] in test-break-update-in-finally tests/type_propagation/finally-test.toit + 7[094] - link try 0 + 9[038] - load block 4 + 11[055] - invoke block S1 // [[block]] -> {} + 13[041] - pop 1 + 14[095] - unlink try 0 + 16[020] - load literal true + 18[004] - store local, pop S5 + 20[096] - unwind + 21[041] - pop 1 + 22[083] - branch back T2 + 27[014] - load local 0 + 28[053] - invoke static id tests/type_propagation/finally-test.toit // [{False_}] -> {False_} + 31[089] - return null S2 0 + +[block] in test-break-update-in-finally tests/type_propagation/finally-test.toit + - argument 0: [block] + 0[016] - load local 2 + 1[092] - non-local branch {test-break-update-in-finally:27} + 7[088] - return S1 1 + +test-break-update-in-finally-block0 tests/type_propagation/finally-test.toit + 0[020] - load literal false + 2[029] - load method [block] in test-break-update-in-finally-block0 tests/type_propagation/finally-test.toit + 7[038] - load block 0 + 9[053] - invoke static invoke tests/type_propagation/finally-test.toit // [[block]] -> {} + 12[040] - pop 2 + 14[083] - branch back T2 + 19[014] - load local 0 + 20[053] - invoke static id tests/type_propagation/finally-test.toit // [{False_}] -> {False_} + 23[089] - return null S2 0 + +[block] in test-break-update-in-finally-block0 tests/type_propagation/finally-test.toit + - argument 0: [block] + 0[029] - load method [block] in [block] in test-break-update-in-finally-block0 tests/type_propagation/finally-test.toit + 5[094] - link try 0 + 7[038] - load block 4 + 9[055] - invoke block S1 // [[block]] -> {} + 11[041] - pop 1 + 12[095] - unlink try 0 + 14[000] - load local S6 + 16[020] - load literal true + 18[006] - store outer S1 + 20[041] - pop 1 + 21[096] - unwind + 22[041] - pop 1 + 23[022] - load null + 24[088] - return S1 1 + +[block] in [block] in test-break-update-in-finally-block0 tests/type_propagation/finally-test.toit + - argument 0: [block] + 0[016] - load local 2 + 1[005] - load outer S3 // [block] + 3[092] - non-local branch {test-break-update-in-finally-block0:19} + 9[088] - return S1 1 + +test-break-update-in-finally-block1 tests/type_propagation/finally-test.toit + 0[020] - load literal false + 2[029] - load method [block] in test-break-update-in-finally-block1 tests/type_propagation/finally-test.toit + 7[029] - load method [block] in test-break-update-in-finally-block1 tests/type_propagation/finally-test.toit + 12[094] - link try 0 + 14[038] - load block 4 + 16[055] - invoke block S1 // [[block]] -> {} + 18[041] - pop 1 + 19[095] - unlink try 0 + 21[020] - load literal true + 23[004] - store local, pop S6 + 25[096] - unwind + 26[040] - pop 2 + 28[083] - branch back T2 + 33[014] - load local 0 + 34[053] - invoke static id tests/type_propagation/finally-test.toit // [{False_}] -> {False_} + 37[089] - return null S2 0 + +[block] in test-break-update-in-finally-block1 tests/type_propagation/finally-test.toit + - argument 0: [block] + 0[016] - load local 2 + 1[092] - non-local branch {test-break-update-in-finally-block1:33} + 7[088] - return S1 1 + +[block] in test-break-update-in-finally-block1 tests/type_propagation/finally-test.toit + - argument 0: [block] + 0[016] - load local 2 + 1[039] - load outer block 1 // [block] + 3[055] - invoke block S1 // [[block]] -> {} + 5[088] - return S1 1 + +test-break-update-in-finally-block2 tests/type_propagation/finally-test.toit + 0[022] - load null + 1[029] - load method [block] in test-break-update-in-finally-block2 tests/type_propagation/finally-test.toit + 6[029] - load method [block] in test-break-update-in-finally-block2 tests/type_propagation/finally-test.toit + 11[094] - link try 0 + 13[038] - load block 4 + 15[055] - invoke block S1 // [[block]] -> {} + 17[041] - pop 1 + 18[095] - unlink try 0 + 20[020] - load literal true + 22[004] - store local, pop S6 + 24[029] - load method [block] in test-break-update-in-finally-block2 tests/type_propagation/finally-test.toit + 29[094] - link try 0 + 31[038] - load block 4 + 33[055] - invoke block S1 // [[block]] -> {} + 35[041] - pop 1 + 36[095] - unlink try 0 + 38[020] - load literal false + 40[004] - store local, pop S10 + 42[096] - unwind + 43[041] - pop 1 + 44[096] - unwind + 45[040] - pop 2 + 47[083] - branch back T1 + 52[014] - load local 0 + 53[053] - invoke static id tests/type_propagation/finally-test.toit // [{Null_}] -> {Null_} + 56[089] - return null S2 0 + +[block] in test-break-update-in-finally-block2 tests/type_propagation/finally-test.toit + - argument 0: [block] + 0[016] - load local 2 + 1[092] - non-local branch {test-break-update-in-finally-block2:52} + 7[088] - return S1 1 + +[block] in test-break-update-in-finally-block2 tests/type_propagation/finally-test.toit + - argument 0: [block] + 0[016] - load local 2 + 1[039] - load outer block 1 // [block] + 3[055] - invoke block S1 // [[block]] -> {} + 5[088] - return S1 1 + +[block] in test-break-update-in-finally-block2 tests/type_propagation/finally-test.toit + - argument 0: [block] + 0[016] - load local 2 + 1[039] - load outer block 5 // [block] + 3[055] - invoke block S1 // [[block]] -> {} + 5[088] - return S1 1 + +test-break-update-in-finally-block3 tests/type_propagation/finally-test.toit + 0[020] - load literal false + 2[022] - load null + 3[029] - load method [block] in test-break-update-in-finally-block3 tests/type_propagation/finally-test.toit + 8[029] - load method [block] in test-break-update-in-finally-block3 tests/type_propagation/finally-test.toit + 13[094] - link try 0 + 15[038] - load block 4 + 17[055] - invoke block S1 // [[block]] -> {} + 19[041] - pop 1 + 20[095] - unlink try 0 + 22[020] - load literal true + 24[004] - store local, pop S7 + 26[096] - unwind + 27[041] - pop 1 + 28[083] - branch back T8 + 33[016] - load local 2 + 34[004] - store local, pop S2 + 36[041] - pop 1 + 37[083] - branch back T3 + 42[015] - load local 1 + 43[053] - invoke static id tests/type_propagation/finally-test.toit // [{False_}] -> {False_} + 46[002] - pop, load local S0 + 48[053] - invoke static id tests/type_propagation/finally-test.toit // [{Null_|False_}] -> {Null_|False_} + 51[089] - return null S3 0 + +[block] in test-break-update-in-finally-block3 tests/type_propagation/finally-test.toit + - argument 0: [block] + 0[016] - load local 2 + 1[092] - non-local branch {test-break-update-in-finally-block3:42} + 7[088] - return S1 1 + +[block] in test-break-update-in-finally-block3 tests/type_propagation/finally-test.toit + - argument 0: [block] + 0[053] - invoke static pick tests/type_propagation/finally-test.toit // {True_|False_} + 3[082] - branch if false T14 + 6[016] - load local 2 + 7[039] - load outer block 1 // [block] + 9[055] - invoke block S1 // [[block]] -> {} + 11[080] - branch T21 + 14[016] - load local 2 + 15[092] - non-local branch {test-break-update-in-finally-block3:33} + 21[088] - return S1 1 + +test-break-update-in-finally-nested tests/type_propagation/finally-test.toit + 0[022] - load null + 1[029] - load method [block] in test-break-update-in-finally-nested tests/type_propagation/finally-test.toit + 6[094] - link try 0 + 8[038] - load block 4 + 10[055] - invoke block S1 // [[block]] -> {} + 12[041] - pop 1 + 13[095] - unlink try 0 + 15[020] - load literal horse + 17[004] - store local, pop S5 + 19[096] - unwind + 20[041] - pop 1 + 21[083] - branch back T1 + 26[014] - load local 0 + 27[053] - invoke static id tests/type_propagation/finally-test.toit // [{SmallInteger_}] -> {SmallInteger_} + 30[089] - return null S2 0 + +[block] in test-break-update-in-finally-nested tests/type_propagation/finally-test.toit + - argument 0: [block] + 0[029] - load method [block] in [block] in test-break-update-in-finally-nested tests/type_propagation/finally-test.toit + 5[094] - link try 0 + 7[038] - load block 4 + 9[055] - invoke block S1 // [[block]] -> {} + 11[041] - pop 1 + 12[095] - unlink try 0 + 14[000] - load local S6 + 16[020] - load literal true + 18[006] - store outer S1 + 20[041] - pop 1 + 21[096] - unwind + 22[041] - pop 1 + 23[022] - load null + 24[088] - return S1 1 + +[block] in [block] in test-break-update-in-finally-nested tests/type_propagation/finally-test.toit + - argument 0: [block] + 0[016] - load local 2 + 1[005] - load outer S3 // [block] + 3[023] - load smi 0 + 4[006] - store outer S1 + 6[002] - pop, load local S2 + 8[005] - load outer S3 // [block] + 10[092] - non-local branch {test-break-update-in-finally-nested:26} + 16[088] - return S1 1 + id tests/type_propagation/finally-test.toit - argument 0: {String_|Null_|True_|False_|SmallInteger_|Exception_} 0[016] - load local 2 @@ -213,3 +485,22 @@ invoke tests/type_propagation/finally-test.toit 0[016] - load local 2 1[055] - invoke block S1 // [[block]] -> {} 3[041] - pop 1 + +invoke-catch tests/type_propagation/finally-test.toit + - argument 0: [block] + 0[029] - load method [block] in invoke-catch tests/type_propagation/finally-test.toit + 5[094] - link try 0 + 7[038] - load block 4 + 9[055] - invoke block S1 // [[block]] -> {} + 11[041] - pop 1 + 12[095] - unlink try 0 + 14[089] - return null S4 1 + 17[096] - unwind + 18[041] - pop 1 + +[block] in invoke-catch tests/type_propagation/finally-test.toit + - argument 0: [block] + 0[016] - load local 2 + 1[005] - load outer S3 // [block] + 3[055] - invoke block S1 // [[block]] -> {} + 5[088] - return S1 1 diff --git a/tests/type_propagation/gold/richards-test.gold b/tests/type_propagation/gold/richards-test.gold index 649dceb35..7f184246d 100644 --- a/tests/type_propagation/gold/richards-test.gold +++ b/tests/type_propagation/gold/richards-test.gold @@ -688,7 +688,7 @@ WorkerTask.run tests/type_propagation/richards-test.toit 28[013] - store field, pop 1 30[016] - load local 2 31[009] - load field local 20 // [{WorkerTask}] -> {Null_|SmallInteger_} - 33[061] - invoke virtual set id // [{Null_|Packet}, {Null_|SmallInteger_}] -> {SmallInteger_} + 33[061] - invoke virtual set id // [{Packet}, {Null_|SmallInteger_}] -> {SmallInteger_} 36[002] - pop, load local S2 38[023] - load smi 0 39[061] - invoke virtual set a1 // [{Packet}, {SmallInteger_}] -> {SmallInteger_} @@ -745,7 +745,7 @@ HandlerTask.run tests/type_propagation/richards-test.toit 0[016] - load local 2 1[082] - branch if false T36 4[016] - load local 2 - 5[060] - invoke virtual get kind // [{Null_|Packet}] -> {Null_|SmallInteger_} + 5[060] - invoke virtual get kind // [{Packet}] -> {Null_|SmallInteger_} 8[025] - load smi 1 9[062] - invoke eq // [{Null_|SmallInteger_}, {SmallInteger_}] -> {True_|False_} 10[082] - branch if false T26 diff --git a/tests/type_propagation/gold/richards-test.gold-O2 b/tests/type_propagation/gold/richards-test.gold-O2 index 2ca33c386..d02222c03 100644 --- a/tests/type_propagation/gold/richards-test.gold-O2 +++ b/tests/type_propagation/gold/richards-test.gold-O2 @@ -639,7 +639,7 @@ WorkerTask.run tests/type_propagation/richards-test.toit 26[013] - store field, pop 1 28[016] - load local 2 29[009] - load field local 20 // [{WorkerTask}] -> {Null_|SmallInteger_} - 31[061] - invoke virtual set id // [{Null_|Packet}, {Null_|SmallInteger_}] -> {SmallInteger_} + 31[061] - invoke virtual set id // [{Packet}, {Null_|SmallInteger_}] -> {SmallInteger_} 34[002] - pop, load local S2 36[023] - load smi 0 37[061] - invoke virtual set a1 // [{Packet}, {SmallInteger_}] -> {SmallInteger_} @@ -693,7 +693,7 @@ HandlerTask.run tests/type_propagation/richards-test.toit 0[016] - load local 2 1[082] - branch if false T36 4[016] - load local 2 - 5[060] - invoke virtual get kind // [{Null_|Packet}] -> {Null_|SmallInteger_} + 5[060] - invoke virtual get kind // [{Packet}] -> {Null_|SmallInteger_} 8[025] - load smi 1 9[062] - invoke eq // [{Null_|SmallInteger_}, {SmallInteger_}] -> {True_|False_} 10[082] - branch if false T26