The NNBD migration required making subtle changes to some dart:io
semantics in order to provide a better API. This change backports these
semantic changes to the unmigrated SDK so any issues can be discovered
now instead of blocking the future SDK unfork.
The Process class will now throw a StateError if the process is detached
upon accessing the stdin, stdout, stderr, and exitCode getters.
The Socket class will now throw a SocketException if the socket has been
destroyed or upgraded to a secure socket upon setting or getting socket
options.
Change-Id: I956fd07e713e51ebd479ebbfe4790d8d2fdf0744
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133989
Commit-Queue: Jonas Termansen <sortie@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
This is a follow-up to 62835950d which was using the condition
`type.IsNullable()` for determining whether to generate TTS stubs.
It turns out `type.IsNullable()` is false for legacy types (for whatever
reason, because legacy types are nulable).
Instead we'll change the condition to `type.IsLegacy()`.
Issue https://github.com/flutter/flutter/issues/49893
Change-Id: I4c8a728382c7b7c65ddb6bff41778b384634d83d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134164
Reviewed-by: Teagan Strickland <sstrickl@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Change-Id: I57899b239fb942650460377ec0a6cecbb48c6926
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133995
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Victor Agnez Lima <victoragnez@google.com>
This is a Dart-tailored implementation of the "row-displacement
dispatch table" technique for closed-world instance calls:
All interface targets in the program are grouped into selectors such
that all targets that could potentially be called from the same call
site have the same selector (currently just grouped by name).
Each selector is assigned a selector offset such that offset + classid
is unique for all selector/classid combinations where the class
implements the selector.
At every instance call site that has an interface target (i.e. where
the static type of the receiver is not dynamic), the selector offset +
receiver classid is computed and used as index into a global table of
entry points.
If the receiver can be null (as determined by the front-end TFA and the
VM type propagation), a null check is inserted before the call.
An arguments descriptor is provided (only) for selectors that need it
(those which have type parameters or optional/named parameters).
The dispatch table calls don't need the monomorphic entry code, so for
functions that are only called via dispatch table calls (i.e. never
called dynamically), the monomorphic entry code is left out.
Some future improvements to the table dispatch implementation are
mentioned in https://github.com/dart-lang/sdk/issues/40188
The table dispatch flag is disabled by default in this commit. A
separate commit enables the flag.
Change-Id: Ic2911742b4a2c9a8d3bc7df60605454cbe4c0714
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126648
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Also avoid executing the tagging instruction in the Smi case for
some LoadTaggedClassIdMayBeSmi implementations.
Change-Id: I067b06ce404ffbba1981539ed3bfef72c4215e8f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133584
Reviewed-by: Martin Kustermann <kustermann@google.com>
The constructor was wrapping the onData handler to hide the type-mismatch. This
copies the same logic to the onData handler.
In non-nnbd code this code was not exercised. The migration of dart:async
made this code reachable on our tests. That's because Stream.first used to
do:
var subscription;
this.listen(() => ... cancel subscription here, ...)
it now avoids making subscription nullable by registering the onData handler
later:
var subscrition = stream.listen(null, ...);
subscription.onData(() => ... cancel subscription here);
This change fixes the following 6 html tests under nnbd:
html/history_test/history/history
html/transferables_test
html/transition_event_test
html/websocket_test
html/worker_test/functional/functional
html/xhr_test
Change-Id: I095ea8d545e65b047504af0367586884bba84d72
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134120
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
These are bugs found while looking at the collection package.
Change-Id: I5527c873cbe015e723f59f743952b5dc493c5c97
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134108
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
This reverts commit b2b7337ad4.
Reason for revert: flutter build broke!!
Original change's description:
> [dart:io] Stop forcing lower case on HttpHeaders
>
> This is a breaking change. Request: https://github.com/dart-lang/sdk/issues/33501
>
> HttpHeaders use lowercase by default for all headers, since it is supposed to be case insensitive. Some servers incorrectly treat case as significant, however, and expect headers with capitalization or in uppercase. The current implementation forces headers to be lower cases when adding values. Users cannot even manually modify the headers.
>
> This change removes this restriction here so that users can modify the headers to whatever form they want. The new behavior is backwards compatible except if class was implemented. All headers inside http.dart are written as lower cases, adding values to HttpHeaders is still receiving lower cases input.
>
> The other cl (https://dart-review.googlesource.com/c/http_multi_server/+/121411) migrates multi_headers.dart to be compatible with this change.
>
> Bug: https://github.com/dart-lang/sdk/issues/33501
> Change-Id: I6f7f2ef907b229773c283140c07f2de4cd500981
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119100
> Commit-Queue: Zichang Guo <zichangguo@google.com>
> Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
TBR=whesse@google.com,sortie@google.com,lrn@google.com,zichangguo@google.com
Change-Id: I4d4299393ad6549b250053df8823e726855e2baf
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/33501
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134102
Reviewed-by: Zichang Guo <zichangguo@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
This fixes debug assertions in AOT.
Change-Id: Ib688164498ad98d2b7bb4ce574cf6859922df3a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133999
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
This makes the script properly produce an error message when
it detects a mismatch on windows (there `diff` is not available.)
Change-Id: Ibefe8c69023b42e8710e744f88257ff967d34bd2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134094
Reviewed-by: Vijay Menon <vsm@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Revert the changes made to DevCompilerTarget that allowed for optionally
excluding libraries when building the null safe SDK.
Fixes: #39698
Change-Id: I0ae3160e17ca60b7a078a905ea12c8538d2aa045
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134081
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Specifically, we replace types of covariant parameters with `Object?`
or `Object` and use subtype check. Then we check types of covariant
formal parameters and corresponding overridden formal parameters.
It looks that NNBD related changes that are coming now require
such more precise following to the specification rules.
Change-Id: Idfa4e3a118050a1be79acce8c708b3aac07b5051
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134043
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
The non-nnbd code doesn't have this extra `if`. It appears
that this conditional was added during the migration but
it is accidentally hiding the update to the _state.
This change restores the algorithm to how it was before
the migration and fixes lib_2/convert/base64_test/none
Change-Id: I72dd2e870056bb55158bbd053d8a3c8825a1d144
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134090
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
We now test bounds for mutual subtyping rather than structural equality
up to renaming of bound type variables and equating all top types.
Change-Id: I7dd23a3211a1631e463ea90c3173f3deae46ca23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134042
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
The fix for empty_catch should not remove the catch clause if doing so
would leave the try statement invalid. It could remove the whole try
statement in such a case, but it isn't clear that that's a good solution
in general. This at least patches the issue until we can decide whether
additional work should be done.
Change-Id: I7c5190faba9fd5632c04708007bc65bb18d3db6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134087
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This is a breaking change. Request: https://github.com/dart-lang/sdk/issues/33501
HttpHeaders use lowercase by default for all headers, since it is supposed to be case insensitive. Some servers incorrectly treat case as significant, however, and expect headers with capitalization or in uppercase. The current implementation forces headers to be lower cases when adding values. Users cannot even manually modify the headers.
This change removes this restriction here so that users can modify the headers to whatever form they want. The new behavior is backwards compatible except if class was implemented. All headers inside http.dart are written as lower cases, adding values to HttpHeaders is still receiving lower cases input.
The other cl (https://dart-review.googlesource.com/c/http_multi_server/+/121411) migrates multi_headers.dart to be compatible with this change.
Bug: https://github.com/dart-lang/sdk/issues/33501
Change-Id: I6f7f2ef907b229773c283140c07f2de4cd500981
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119100
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
If generated code refers to a constant object (which are old and canonical), a pointer
to it will be embedded in the instruction stream on ia32.
If we now reload and morph this constant object and allocate the
morph'ed copy in new space, the become operation will make RX writable
and the slot in the instruction stream gets updated to point to a new
space object and the code gets added to the remembered set.
The next scavenge operation will scan the remembered set as roots, see
the poitner to a new object, move the object and updates the pointer in
the instruction stream.
=> We hit a SEGV trying to write the RX memory
We can avoid this problem by ensuring to morph old+canonical instances
always into old space on ia32.
Change-Id: Id63eb6ee1735bbb661dbeceb1e8d0c6ac92225ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133228
Auto-Submit: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
We were printing groups of builder names, not configurations
Change-Id: Ia9a6791fbd25939f71a1aa227bc288197c838bd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133991
Reviewed-by: Martin Kustermann <kustermann@google.com>
This was never supported by the grammar but unfortunately allowed by
both the analyzer and the CFE.
Change-Id: Id669c934fe08eda41973d6d2cef8340da2e7d72c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133591
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
When loading from dill a library with export errors in it, the errors
would be reported when setting up that scope. There it would be reported
without a location.
Then - if not recompiling it and fixing it - it would be reported again
because of problemsAsJson (with a location).
It would thus be reported twice, one better than the other.
This CL updates the scope building for dill builders to have the option
to supress such errors and then use that option in the incremental
compiler where we use problemsAsJson to reissue problems.
Change-Id: I03430bf8b9996b6e8b7571b8e4e33f3f89f832a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133235
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
By allowing a transformation to tell if it change dthe structure of a
class we can make sure to update the class hierarchy accordingly,
making sure it's up to date for the next computeDelta call in the
incremental compiler.
Change-Id: Iefed3bb1ecbd17b142266ce4a9e1e477f9d2fc87
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133222
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>