The method ObservatoryApplication._switchVM calls newVM.onDisconnect
and requires the resulting future to be completed with a String. In
normal operation, this is satisfied and we just need to change a few
static types to enforce it. But when FakeVM was in use, the future
was completed with `this`. Since ObservatoryApplication._switchVM is
the only call site that cares what the future is completed with, it
makes sense to just change all the types to Future<String> and modify
FakeVM accordingly.
Change-Id: Id94d27ac6a42f31ab19ccc9ad8dd270ecf4042b4
Reviewed-on: https://dart-review.googlesource.com/57400
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
When the constant transformation is enabled on annotations, we need to fix handling
of @ExternalName annotations in the kernel_loader to ensure that we are setting
is_external = false on native methods.
The original revision is in patchset 1.
# Test Plan
The only regression was on benchmarks, Golem results are pending.
Change-Id: Ib80bb9f532299056e770a3b378cc5ad9ee451f57
Reviewed-on: https://dart-review.googlesource.com/56960
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
GrowableArrayMarker was a class that implemented int and was used to
enable implementation of default List factory constructor in pure Dart:
factory List([int length = GROWABLE_ARRAY_MARKER]) {
return identical(length, GROWABLE_ARRAY_MARKER) ? new _GrowableList<E>(0)
: new _List<E>(length);
}
Its existence complicated all kinds of things in the VM and it is finally
time to remove it.
Instead we build List factory body directly in IL.
This CL also provides inlining rule for `new List(n)` case.
Change-Id: I870751658a4ac17fce649c9ac70395ff88a5436c
Reviewed-on: https://dart-review.googlesource.com/57262
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
* Use 3-arg variant of open() to fix compilation on GCC and also to ensure
that created file is readable/writable by all users.
* Avoid changing protection on code pages emitted into VM isolate heap: this
allows to profile stubs.
Change-Id: I2b621596405ad78f54a63cfebde7a1af9fa15911
Reviewed-on: https://dart-review.googlesource.com/57263
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
- Forward only kImportTag requests to DFE. This restores the current handling of a kScriptTag request when loading the kernel isolate in the simulators.
- Mark dynamic_load_test as failing in the reload stress tests (reload fails to preserve library identity).
Change-Id: Ibe6f0a3505b99736a38d566abf3b2151505d7a7e
Reviewed-on: https://dart-review.googlesource.com/56706
Reviewed-by: Siva Annamalai <asiva@google.com>
Add a clause indicating that FunctionCallTreeNode (in
lib/src/sample_profile/sample_profile.dart) implements
M.FunctionCallTreeNode. This allows the two types for `root`
inherited by FunctionCallTree to be consistent with each other: the
type inherited from CallTree<FunctionCallTreeNode> is
FunctionCallTreeNode whereas the type inherited from
M.FunctionCallTree is M.FunctionCallTreeNode.
Change-Id: I0b48c57f84681a7d40afadfb59c72501cfe38577
Reviewed-on: https://dart-review.googlesource.com/57002
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Kernel mixin transformation desugars mixin applications into normal
classes. Mixed-in type is pulled into interfaces list.
However, dart:mirrors needs to know the original mixed-in type of
a mixin application.
This change solves this problem by propagating a 'isTransformedMixinApplication'
attribute of a class through kernel AST, kernel binary and VM objects
into dart:mirrors implementation.
Fixes: https://github.com/dart-lang/sdk/issues/33240
Change-Id: I98ca69294e1ad445402a5ca91d90c30447aabcb2
Reviewed-on: https://dart-review.googlesource.com/56721
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
This splits create_archive.py into two steps. One that creates the .tar
and one that creates the .cc for the .tar. This way on Fuchsia, the
second step will take the prebuilt instead of building it.
Change-Id: I7f407f9e70db3135884eeeb61aa5aec3091f1fcc
Reviewed-on: https://dart-review.googlesource.com/56291
Reviewed-by: Ryan Macnak <rmacnak@google.com>
The VM version's parser did not allow a leading BOM, and it failed to parse a top-level integer.
Added test to check this.
Fixes#33251
Bug: http://dartbug.com/33251
Change-Id: I51e429082f0e9baac81e20f73b0885922b40b0b8
Reviewed-on: https://dart-review.googlesource.com/56860
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Florian Loitsch <floitsch@google.com>
Change-Id: Iec5347b5f091b9fd6ff3c24047b011527f8b08ee
Reviewed-on: https://dart-review.googlesource.com/56802
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
This reverts commit 3e50ea32b5.
Reason for revert: Severe performance regressions on many aot-v2 benchmarks.
Original change's description:
> [vm] Support definition of entry-points via @pragma('vm.extern') annotations.
>
> The `@pragma` annotations are evaluated by the constants transformation and
> visible to TFA and the precompiler, which match on the "options" field of the
> annotation to determine whether to mark the class/procedure as a root.
>
> This required enabling the transformation of annotation constants by default.
>
> # Test Plan
>
> The "vmservice_io.main" entry-point is removed from `main.cc` and annotated with
> `@pragma`. All precompiler tests will crash if "vmservice_io.main" is not
> available at runtime.
>
> Debug/release precompiler bots are visible in "cl-linux" button.
>
> Change-Id: I03c5d6ba7918672ed9905fcaee8dabe675a93a5d
> Reviewed-on: https://dart-review.googlesource.com/56660
> Commit-Queue: Samir Jindel <sjindel@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
TBR=vegorov@google.com,alexmarkov@google.com,sjindel@google.com
Change-Id: I779c17d003659129a4b3fcf284423104948f60e2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/56820
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
The `@pragma` annotations are evaluated by the constants transformation and
visible to TFA and the precompiler, which match on the "options" field of the
annotation to determine whether to mark the class/procedure as a root.
This required enabling the transformation of annotation constants by default.
# Test Plan
The "vmservice_io.main" entry-point is removed from `main.cc` and annotated with
`@pragma`. All precompiler tests will crash if "vmservice_io.main" is not
available at runtime.
Debug/release precompiler bots are visible in "cl-linux" button.
Change-Id: I03c5d6ba7918672ed9905fcaee8dabe675a93a5d
Reviewed-on: https://dart-review.googlesource.com/56660
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
zx_port_wait and zx_port_queue no longer take an unused count parameter.
Change-Id: I62f03871282d076638c51527603473252821d316
Reviewed-on: https://dart-review.googlesource.com/56705
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Adam Barth <abarth@google.com>
Since the downcast is explicit (using "as") the type will be checked
even in unchecked mode, so technically there is a slight risk of
breakage. But since the callback is so near the creation of the
ButtonElement, I'm not concerned. Also, I'm not concerned about the
performance penalty of the explicit downcast because the cost is only
paid once per user click.
Change-Id: I64fbb442985f6ba6f745f665b36a3321498025e4
Reviewed-on: https://dart-review.googlesource.com/56704
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This allows code to access a VM object's target without having to
downcast it to a more specific type.
Change-Id: I42f329e205c2da0137be2440f0d3088a7137bc55
Reviewed-on: https://dart-review.googlesource.com/56703
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
For brevity we explicitly downcast the parameter type (using "as")
rather than implicitly downcasting it (by assigning to a fresh
variable). Since this is test code, I'm not concerned about the
performance penalty of the explicit downcast.
Change-Id: I2bf1556ec11db124978c6631df8fcdd5adbc298d
Reviewed-on: https://dart-review.googlesource.com/56701
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
In some cases we need to specify a type because the inferred type
would be too specific. For example, in the code:
final content = [new SampleBufferControlElement(...)];
...
content.addAll([new BRElement(), ...]);
Strong mode would infer a type of `List<SampleBufferControlElement>`
for `content`, making it impossible to add other kinds of HTML
elements to the list later. So we have to specify explicitly that the
list element type is meant to be `HTMLElement`.
In other cases we need to specify a type because the inferred type is
too general. For example, in the code:
Future<List<String>> complete(...) {
var result = [];
...add values of type String to `result`...
return new Future.value(result);
}
Strong mode would infer a type of `List<dynamic>` for `result`, making
it impossible to enclose in a `Future<List<String>>`. So we have to
specify explicitly that the list element type is meant to be `String`.
Change-Id: I1b1c884529de2775898dfff800d250cd10629811
Reviewed-on: https://dart-review.googlesource.com/56700
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
The types now correspond in the two classes, so we avoid invalid
override errors.
Change-Id: Iceeb324e6adf7573ae39d7250184f7eb58656498
Reviewed-on: https://dart-review.googlesource.com/56021
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This CL makes the following changes, which should be safe since they
don't affect Dart 1.0 semantics:
- Explicitly declare the types of certain variables as `dynamic` to
avoid strong mode inferring a type that leads to errors.
- Explicitly cast certain expressions to `dynamic` to allow access to
members that are dynamically known to be present.
- Add `covariant` annotation to method parameters that are a subtype
of the corresponding parameter in the base class.
Change-Id: Ibefe4d9591f70ea954373ca4d521bc54179cca9b
Reviewed-on: https://dart-review.googlesource.com/55900
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This CL addresses a code pattern where a method expects its parameter
to have a certain type, but that method is torn off and passed as a
callback to another method expecting its parameter type to be more
general. For example:
void f(int i) { ... }
void g(void callback(Object o)) { ... }
void h() {
g(f); // Error: () -> int is not a subtype of () -> Object
}
This is a strong mode error because the type system cannot guarantee
that the value pased to f will be an int. The solution is to broaden
the type of the callback parameter so that it matches the type
expected for the callback. In most cases, we insert an implicit
downcast (by reassigning the parameter to a local variable with the
expected type), which in Dart 2.0 semantics will result in a runtime
check (similar to what happens in Dart 1.0 checked mode).
Since the downcasts are implicit, the Dart 1.0 semantics are
unchanged, so this should be a safe change.
Change-Id: I9583ea194343b89b39305c9796cfad299a47943f
Reviewed-on: https://dart-review.googlesource.com/55907
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
At a minimium, the image portion of the snapshot is sensitive to word size.
Change-Id: I1056a726c7b773f3ef65608f3244aaa01a366ec4
Reviewed-on: https://dart-review.googlesource.com/56023
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This reverts commit ad4cfa0260.
Reason for revert: Assertion failures on DBC
Original change's description:
> [mirrors] Add IsolateMirror.loadUri.
>
> This allows a programmer to dynamically load code into an isolate. The closest existing API is Isolate.spawnUri, but communication with the dynamically loaded code in that case is limited to asynchronous message passing of JSON-like objects.
>
> Change-Id: Icb23e9dacfb0035622c119f11d4e0f892ba2ccd1
> Reviewed-on: https://dart-review.googlesource.com/45363
> Reviewed-by: Zach Anderson <zra@google.com>
TBR=rmacnak@google.com,zra@google.com,asiva@google.com,kmillikin@google.com
Change-Id: I80669188b9f40b3b527e8e268ade0d0d514a8753
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/56640
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This allows a programmer to dynamically load code into an isolate. The closest existing API is Isolate.spawnUri, but communication with the dynamically loaded code in that case is limited to asynchronous message passing of JSON-like objects.
Change-Id: Icb23e9dacfb0035622c119f11d4e0f892ba2ccd1
Reviewed-on: https://dart-review.googlesource.com/45363
Reviewed-by: Zach Anderson <zra@google.com>
Previously we would only mark immediate superinterfaces
as implemented which is not enough.
Bug: b/80154489
Change-Id: I0751d4326b1ac8930b7fdfb35e0c3fdd5d0b71dd
Reviewed-on: https://dart-review.googlesource.com/56485
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Summary:
When evaluating constants for direct inspection (and not for injection into the
FG), we store many intermediate values in ZoneHandles. This leaks memory, since
the only need for ZoneHandles is preserving constants which are referenced by
the FG.
Test Plan:
Existing coverage is sufficient since no functionality is changed.
Change-Id: I33951eab762a4ad626f07ebf11118247c5a9ad3e
Reviewed-on: https://dart-review.googlesource.com/56345
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
# Summary
As part of commit 772c9bb5f, we changed the representation of partially
instantiated closures to facilitate partial instantiation of local functions.
The compile-time constant evaluator was not updated -- this revision implements
that update.
Fixes task 33211.
# Test Plan
Updated `partial_tearoff_instantiation_test.dart` to test the case which caused
incorrect behavior in task 33211.
Change-Id: I7bbd4fb83a5aea86ffc85c1d9952f1202f098d6b
Reviewed-on: https://dart-review.googlesource.com/56346
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
Without active class, kernel reader is not able to finalize types
and fails to parse type literals.
Fixes https://github.com/dart-lang/sdk/issues/33173
Change-Id: Iefe7f33a371f3d4f892f21f8ea0060d70887186c
Reviewed-on: https://dart-review.googlesource.com/56242
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Since commit 775eeece we use a kernel2kernel constant evaluator for
AOT compilations. We can now start to ensure we never hit the constant
evaluator in the VM anymore.
Issue https://github.com/dart-lang/sdk/issues/33185
Change-Id: If0e3b5c89fba64a7f93af606e7146e52c45b38df
Reviewed-on: https://dart-review.googlesource.com/56340
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>