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

Issue 1682333003: Remove only local variables/functions from the cache. (Closed)

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

Description

Remove only local variables/functions from the cache. This is a temporary measure to restore incremental resolution in most cases. In the future we should avoid putting constant variables into cache at all and enforce this on the cache.put() level. R=brianwilkerson@google.com BUG= Committed: https://github.com/dart-lang/sdk/commit/e71080901fa5bd7a43c47a705c22b592a3312f8c

Patch Set 1 #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+10 lines, -4 lines) Patch
M pkg/analyzer/lib/src/generated/incremental_resolver.dart View 2 chunks +10 lines, -4 lines 1 comment Download

Messages

Total messages: 11 (2 generated)
scheglov
4 years, 10 months ago (2016-02-10 20:53:46 UTC) #1
Brian Wilkerson
LGTM
4 years, 10 months ago (2016-02-10 20:56:34 UTC) #2
scheglov
Committed patchset #1 (id:1) manually as e71080901fa5bd7a43c47a705c22b592a3312f8c (presubmit successful).
4 years, 10 months ago (2016-02-10 20:58:35 UTC) #4
skybrian
On 2016/02/10 20:58:35, scheglov wrote: > Committed patchset #1 (id:1) manually as > e71080901fa5bd7a43c47a705c22b592a3312f8c (presubmit ...
4 years, 10 months ago (2016-02-13 07:30:28 UTC) #5
Brian Wilkerson
Brian, > This is a regression. My stress test started failing again ... Obviously we ...
4 years, 10 months ago (2016-02-13 15:58:45 UTC) #6
skybrian
https://codereview.chromium.org/1682333003/diff/1/pkg/analyzer/lib/src/generated/incremental_resolver.dart File pkg/analyzer/lib/src/generated/incremental_resolver.dart (right): https://codereview.chromium.org/1682333003/diff/1/pkg/analyzer/lib/src/generated/incremental_resolver.dart#newcode2070 pkg/analyzer/lib/src/generated/incremental_resolver.dart:2070: if (element is LocalVariableElement || This check is missing ...
4 years, 10 months ago (2016-02-13 18:39:22 UTC) #8
skybrian
On 2016/02/13 15:58:45, Brian Wilkerson wrote: > Brian, > > > This is a regression. ...
4 years, 10 months ago (2016-02-13 18:41:03 UTC) #9
Brian Wilkerson
> If I submitted a change to fix a bug, it seems like I should ...
4 years, 10 months ago (2016-02-13 19:32:28 UTC) #10
skybrian
4 years, 10 months ago (2016-02-13 20:48:17 UTC) #11
Message was sent while issue was closed.
On 2016/02/13 19:32:28, Brian Wilkerson wrote:
> Perhaps. (Though I'm honestly not sure how that would work from a purely
> logistic perspective.)

I agree that it's not practical in general, but we just fixed this bug two weeks
ago, so I still think I should have been cc-ed in this case.

Longer term, I think I need to make the stress test a continuous build. For now,
perhaps I can write up directions on how to run it, so we can do that manually
when changing incremental resolver code.

> 
> But it seems to me that the role of unit tests is to ensure that if the code
is
> changed in a way that breaks a contract the problem will be discovered early.
If
> there had been a unit test to ensure that the contract your changes fixed
wasn't
> re-broken then the test would have failed. In that case you wouldn't have
needed
> to be a reviewer because the test would have filled the same role.

Yes, more tests are better and I'll write them for these two new cases. But I
didn't write them before because I didn't know they existed. From a code
coverage point of view, there was no if statement before so this line was
covered. (In theory, there should now be a test giving an example of when we
shouldn't clear the cache entry for performance reasons, justifying the if
statement. It wouldn't have prevented the bug, though.)

Tests can't enforce this contract. I will revive my patch to do a runtime check
to make sure Elements used as cache keys aren't mutated (which is how I tracked
this down).

I think the idea that unit tests can substitute for code review is a
misunderstanding of what tests are capable of. Tests should be a backup for code
review, where we (informally) prove the code safe by thinking through all
possible cases. When that's not practical (and the analyzer code base and the
complexity of the Dart language make it difficult), we should make sure we
choose safe defaults for tricky cases we didn't think of.

Powered by Google App Engine
This is Rietveld 408576698