DescriptionMake functions that appear to be unreachable throw.
Functions are unreachable if their parameters have an empty type. We would generate bogus code for the function due to the empty type so we might as well generate a throw. This can prevent spurious inclusion of more code referenced only in the unreachable code.
It is usually a bug if we generate unreachable methods but it can happen for legitimate reasons. One is that type inference is sometimes more precise than type propagation in the optimizer. Another is that we call a function that has an uninstantiated parameter type. This usually happens due the infeasibility of the path being hidden by a correlation between the type and some variable's value.
There is a tail of bugs that need to be flushed out before we can enable this by default.
Enable with:
DART_VM_OPTIONS=-Dunreachable-throw=true <compile>
language/cyclic_default_values_test fails, with foo and foo2 falsely unreachable:
DART_VM_OPTIONS=-Dunreachable-throw=true tools/test.py -mrelease -cdart2js -rd8 language/cyclic_default_values_test
I have added a test for the cause - a type inference bug with default argument values.
DART_VM_OPTIONS=-Dunreachable-throw=true tools/test.py -mrelease dart2js/simple_inferrer_const_closure_default_test
R=sigmund@google.com
Committed: https://github.com/dart-lang/sdk/commit/cbaae993a156a04c07a45db2be51295d3a753a58
Patch Set 1 : #
Total comments: 6
Patch Set 2 : #
Messages
Total messages: 13 (6 generated)
|