This is a reland of a528b19d2c
Updating the hash of the empty type argument vector in write-protected memory caused a crash in precomp mode.
The fix is to correctly initialize the hash so it does not need an update.
Original change's description:
> [VM/runtime] Fix computation of the hash of recursive types.
>
> When computing the hash of a type, only include the hashes of the type arguments corresponding to the type parameters of the type's class and not of the whole type argument vector, otherwise, the variable location of TypeRefs in the base class type arguments may result in different hashes.
>
> Add a regression test (this test was not failing in all configurations, since the issue becomes visible depending on the order in which types are loaded and finalized).
>
> This fixes issue https://github.com/dart-lang/sdk/issues/42954
>
> Small improvement: pick hash value 1 for a vector of dynamic types, so it can be cached and not recomputed repeatedly, which was the case with value 0.
>
> Change-Id: I3468952cbf61944a82cf8e00efbf4952bd831fbe
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157563
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Commit-Queue: Régis Crelier <regis@google.com>
Change-Id: I538b4538c69472e09b7bd745c6bd41023e1f154f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157781
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Add a test where a class that has no generative constructors
declares an instance variable which is final and has no initializing
expression. With https://github.com/dart-lang/language/pull/1130 this
is an error, and that error is expected by the test. Also test that
it is not an error to have an uninitialized final variable which is
abstract or external.
Change-Id: I6c4a46393f46587448612bd91fb99fa65f89704c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157490
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Generally, methods that take a *TextBuffer pointer do not care how the
internal buffer is allocated, and so they could be used for either if
both were subclasses of a base class that contained the printing
methods. This CL makes that base class, and now TextBuffer and
ZoneTextBuffer now share the exact same set of methods for printing to
the internal buffer.
Since the base class is in platform, this does mean dropping the
overload of AddString for Dart String objects that was part of
ZoneTextBuffer. Instead, this CL just adds an intermediate call to
ToCString() for the small number of callers that used the overload,
keeping the printing interface the same for both.
In addition, one use of TextBuffer that then re-allocated the buffer
contents into the zone manually has been replaced with a ZoneTextBuffer
instead.
Change-Id: I438a085e7e20d55d93987fd7f36afd636f95955f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157741
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Adds errors for class members that have a @JS annotation but the
enclosing class does not.
Change-Id: Id693af71678510047a723863846d89aa29cebe26
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157004
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
native_test is set up so that it validates only one error per static
error. This CL allows multiple errors to be reported and validates
that all are reported.
Change-Id: I97e9abbfbd8273c0c436e44d08f5768eea3f7785
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157663
Reviewed-by: Stephen Adams <sra@google.com>
Currently we are gathering classes for all supertypes, but we only need
to gather classes for applied mixins and super classes.
Change-Id: Ie55a6587b0bc9cacf5061a52d2d9a9ec5fdbf2eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156761
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
This is based on the wrapped version that also includes a bit integer.
Right now the methods use the old abstract value domain but will use the integer bits in later CLs.
Also added and updated a flag so that now there is one for a wrapped domain and another for a powerset domain..
Change-Id: Iab6b93584a9a644dfef92f689c4be8c42ce8076a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157620
Commit-Queue: Christian Altamirano <coam@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Concrete cids are 16-bit unsigned values, but Slot::cid_ was erroneously
declared as a signed value - which causes issues in program with large
amount of classes once it flows into variables of larger signed types
(classid_t or intptr_t).
Fixes b/162922506
Fixed: 162922506
Change-Id: Id116273aa34dbf6886c352427cf4565fc5dc2293
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157487
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
dart:core contains a class Type and it can also contain objects which
are instances of this class. Previously we would try to put size
information for both under dart:core/Type bucket which caused issues.
To prevent the clash we now wrap snapshot node types in '<...>' before using
them as path components, so that the first case would remain dart:core/Type
but size of Type instances would be written into dart:core/<Type> bucket.
Fixes https://github.com/dart-lang/sdk/issues/42969
Fixed: 42969
Cq-Include-Trybots: luci.dart.try:pkg-linux-release-try,pkg-win-release-try,pkg-mac-release-try
Change-Id: Ie6c3400e90511507ff37b7ca037bd385dea1b11c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157493
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Kenzie Schmoll <kenzieschmoll@google.com>
Declared variables cannot be configured using analysis_options.yaml,
so I put them into AnalysisContextCollectionImpl for now.
R=brianwilkerson@google.com
Change-Id: I2aaa3cfa94ad4a386f0be7d47acc979a89b69b05
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157660
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This reverts commit a528b19d2c.
Reason for revert: Failures in precompiled mode.
Original change's description:
> [VM/runtime] Fix computation of the hash of recursive types.
>
> When computing the hash of a type, only include the hashes of the type arguments corresponding to the type parameters of the type's class and not of the whole type argument vector, otherwise, the variable location of TypeRefs in the base class type arguments may result in different hashes.
>
> Add a regression test (this test was not failing in all configurations, since the issue becomes visible depending on the order in which types are loaded and finalized).
>
> This fixes issue https://github.com/dart-lang/sdk/issues/42954
>
> Small improvement: pick hash value 1 for a vector of dynamic types, so it can be cached and not recomputed repeatedly, which was the case with value 0.
>
> Change-Id: I3468952cbf61944a82cf8e00efbf4952bd831fbe
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157563
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Commit-Queue: Régis Crelier <regis@google.com>
TBR=rmacnak@google.com,alexmarkov@google.com,asiva@google.com,regis@google.com
Change-Id: I904e7043fa175d03bb9af56a9346b097b883c7a0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157700
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
This CL covers two cases: when an abstract field appears in a concrete
class (which we report as CONCRETE_CLASS_WITH_ABSTRACT_MEMBER, just as
we do for abstract methods), and when a concrete class implements a
class with an abstract field, but fails to supply the necessary
concrete implementation(s) (which we report as
NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_*, just as we do for
abstract methods).
Change-Id: I94bdbafc4ed7b058d9b33b3774e79cb55393380b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157600
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
When computing the hash of a type, only include the hashes of the type arguments corresponding to the type parameters of the type's class and not of the whole type argument vector, otherwise, the variable location of TypeRefs in the base class type arguments may result in different hashes.
Add a regression test (this test was not failing in all configurations, since the issue becomes visible depending on the order in which types are loaded and finalized).
This fixes issue https://github.com/dart-lang/sdk/issues/42954
Small improvement: pick hash value 1 for a vector of dynamic types, so it can be cached and not recomputed repeatedly, which was the case with value 0.
Change-Id: I3468952cbf61944a82cf8e00efbf4952bd831fbe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157563
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
Before null safety
try {
...
} catch (e) {
...
}
was translated to a try-catch block with 'dynamic' catch type.
VM has a special, more efficient handling of such catch-all try blocks.
Those try blocks were detected by comparing catch type with 'dynamic'.
With null safety front-end started to translate those try blocks
using non-nullable Object as a catch type. As a result, this disabled
all optimizations for catch-all try blocks in the VM.
This change extends detection of catch-all try blocks to handle both
dynamic and Object as catch types.
Improves ParserCombinators benchmark with null safety 12x in JIT mode,
15x in AOT mode. This benchmark is now on par with legacy (pre-NNBD)
version.
Change-Id: I128aa1599d8a6f979fc2e8535d0f5c934bf3a5ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157565
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This is in preparation for working on external and abstract fields,
which will require introducing some NNBD-only tests to this file.
Change-Id: I2e1a77634aef0493d5e44edf88373deaa9acb6c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157580
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This reverts commit 17faf89d02.
The fix is in eventhandler_fuchsia.cc. Rather than changing the
condition on line 401, I've just weakened the assert.
Change-Id: Ia6b1f35e479e4b2fdf1adc77e9513551221a7696
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157564
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
Updates to the latest unpublished version which has been migrated to
null safety.
Change-Id: If999af780b7788da7b78673cb541bfdb3c1e25cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157401
Reviewed-by: Kevin Moore <kevmoo@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
This is in preparation for working on external and abstract fields,
which will require introducing some NNBD-only tests to this file.
Change-Id: Ida714ce7e3136acfaf05d12fe287ec9e1de1258c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157472
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Abstract final fields don't need to be initialized (in fact they can't
be initialized), so we shouldn't report "uninitialized field" errors
for them.
This CL also adds some basic tests of the functionality of abstract
final fields, making sure they don't introduce setters, and that the
getters they introduce are properly resolved and that their types are
properly respected by inheritance checks.
Change-Id: I885f23ce7ca554ba8f48e932ba9d76e128ac0bbd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157520
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
These tests weren't being referenced in the test's main() function, so
they weren't being run. Fortunately they pass :)
Change-Id: Ie04039e36bbcaea8d13973efb7fee19112407648
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157467
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Abstract fields whose type is non-nullable don't need to be
initialized (in fact they can't be initialized), so we shouldn't
report "uninitialized field" errors for them.
This CL also adds some basic tests of the functionality of abstract
fields, making sure that the getters and setters they introduce are
properly resolved and that their types are properly respected by
inheritance checks.
Change-Id: I1fe7b6f40456d03533b85403ec6f428656820706
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157466
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This cl implements deferred loading of class types. The bulk of the
logic is hidden behind a flag.
Change-Id: I7d5139eff72c7d29226a7e46c427c82fc5bda728
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154580
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
I wanted to get your feedback on one change like this before updating
other places where we're excluding the nullability from the display
string. Is it reasonable to always display the nullability? (For
example, could this lead to displaying nullability in legacy code?) Is
there any risk of displaying stars (`int*`)?
Change-Id: I5ac78a4b8559c2fbba6b69b1665f36061432726e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157471
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>