Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1037)

Issue 1320673004: dart2js: Make functions that appear to be unreachable throw. (Closed)

Created:
5 years, 3 months ago by sra1
Modified:
5 years, 3 months ago
CC:
reviews_dartlang.org
Base URL:
https://github.com/dart-lang/sdk.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Make 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 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+116 lines, -3 lines) Patch
M pkg/compiler/lib/src/ssa/builder.dart View 1 chunk +16 lines, -0 lines 0 comments Download
M sdk/lib/_internal/js_runtime/lib/js_helper.dart View 1 chunk +6 lines, -2 lines 0 comments Download
M tests/compiler/dart2js/dart2js.status View 1 1 chunk +6 lines, -0 lines 0 comments Download
M tests/compiler/dart2js/mock_libraries.dart View 1 1 chunk +4 lines, -1 line 0 comments Download
A tests/compiler/dart2js/simple_inferrer_const_closure_default_test.dart View 1 1 chunk +84 lines, -0 lines 0 comments Download

Messages

Total messages: 13 (6 generated)
sra1
Stephan - IIRC you fixed a bug like this (type inference of default values). Do ...
5 years, 3 months ago (2015-09-04 04:05:38 UTC) #7
Siggi Cherem (dart-lang)
https://codereview.chromium.org/1320673004/diff/80001/sdk/lib/_internal/js_runtime/lib/js_helper.dart File sdk/lib/_internal/js_runtime/lib/js_helper.dart (right): https://codereview.chromium.org/1320673004/diff/80001/sdk/lib/_internal/js_runtime/lib/js_helper.dart#newcode2398 sdk/lib/_internal/js_runtime/lib/js_helper.dart:2398: JS_EFFECT(() { When we declare JS_EFFECT, does it mean ...
5 years, 3 months ago (2015-09-04 17:46:23 UTC) #8
sra1
PTAL. Added test suppressions and traccking issue. https://codereview.chromium.org/1320673004/diff/80001/sdk/lib/_internal/js_runtime/lib/js_helper.dart File sdk/lib/_internal/js_runtime/lib/js_helper.dart (right): https://codereview.chromium.org/1320673004/diff/80001/sdk/lib/_internal/js_runtime/lib/js_helper.dart#newcode2398 sdk/lib/_internal/js_runtime/lib/js_helper.dart:2398: JS_EFFECT(() { ...
5 years, 3 months ago (2015-09-04 21:01:53 UTC) #9
Siggi Cherem (dart-lang)
lgtm https://codereview.chromium.org/1320673004/diff/80001/sdk/lib/_internal/js_runtime/lib/js_helper.dart File sdk/lib/_internal/js_runtime/lib/js_helper.dart (right): https://codereview.chromium.org/1320673004/diff/80001/sdk/lib/_internal/js_runtime/lib/js_helper.dart#newcode2402 sdk/lib/_internal/js_runtime/lib/js_helper.dart:2402: BoundClosure.receiverOf(JS('BoundClosure', '0')); On 2015/09/04 21:01:52, sra1 wrote: > ...
5 years, 3 months ago (2015-09-04 21:04:30 UTC) #10
sra1
Committed patchset #2 (id:100001) manually as cbaae993a156a04c07a45db2be51295d3a753a58 (presubmit successful).
5 years, 3 months ago (2015-09-04 22:11:22 UTC) #11
herhut
On 2015/09/04 04:05:38, sra1 wrote: > Stephan - IIRC you fixed a bug like this ...
5 years, 3 months ago (2015-09-08 19:54:34 UTC) #12
sra1
5 years, 3 months ago (2015-09-08 22:35:50 UTC) #13
Message was sent while issue was closed.
On 2015/09/08 19:54:34, herhut wrote:
> On 2015/09/04 04:05:38, sra1 wrote:
> > Stephan - IIRC you fixed a bug like this (type inference of default values).
> Do
> > you have any ideas where the problem lies?
> 
> I took a look and have a half baked patch but am off for a week of vacation.
The
> issue is that type inference uses normal inference rules for closures that
have
> been successfully traces but are passed to Function.apply. It should in that
> case just assume dynamic as currently Function.apply is not understood by
> inference.
> 
> The second issue is that closures that are passed as default arguments to
other
> closures should bail out in tracing. This works for closures that are passed
> directly as arguments but it seems default values have been missed in the
> original design.
> 
> If this can wait a little, I will finish the patch and fix it after I return.

That would be great. I will assign you #24297 as a reminder.

Powered by Google App Engine
This is Rietveld 408576698