Commit Graph

207 Commits

Author SHA1 Message Date
Liam Appelbe 223eaa6fbb Report noSuchMethod forwarders as synthetic in the mirror api
Fixes http://dartbug.com/34982

Bug: http://dartbug.com/34982
Change-Id: I0302586c5f0e58dd66e238bd32088ebe1c150c0e
Reviewed-on: https://dart-review.googlesource.com/c/93124
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2019-02-14 18:42:19 +00:00
Régis Crelier cb8c0ab8f5 [vm] Remove MixinAppType VM class and VM code supporting type resolution.
In Dart2, mixin application classes are generated by kernel and type resolution
is performed by kernel. In Dart1, using the VM parser, these tasks were done
during class and type finalization.

Change-Id: I927b1446d906ffd76ed9591c96e0d974df09f3bf
Reviewed-on: https://dart-review.googlesource.com/c/87025
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-12-13 20:18:36 +00:00
Ryan Macnak 787a43ec78 [vm] Fix some missing private name mangling in the kernel reader.
Bug: https://github.com/dart-lang/sdk/issues/32345
Bug: https://github.com/dart-lang/sdk/issues/33326
Bug: https://github.com/dart-lang/sdk/issues/33345
Change-Id: I89fb8f0332ef6f9f40de59c219af2a7c23e5943f
Reviewed-on: https://dart-review.googlesource.com/58400
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-06-05 20:14:46 +00:00
Ryan Macnak c30af41b96 Reapply "[mirrors] Add IsolateMirror.loadUri."
- 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>
2018-05-29 22:01:01 +00:00
Alexander Markov 1ca17b6d03 [vm/kernel] Recognize desugared mixin applications in dart:mirrors
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>
2018-05-29 18:12:26 +00:00
Ryan Macnak de545b4079 Revert "[mirrors] Add IsolateMirror.loadUri."
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>
2018-05-24 20:03:40 +00:00
Ryan Macnak ad4cfa0260 [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>
2018-05-24 17:07:15 +00:00
Ryan Macnak 1ecad6e743 [vm] Remove ObjectMirror.getField/setField optimization from mirrors.
This optimization depends on an always-present Dart compiler, which is broken by the architecture of the CFE.

Change-Id: I2e3dfd514d6a4c19a09638719f09371bfb158106
Reviewed-on: https://dart-review.googlesource.com/54706
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-05-11 19:43:50 +00:00
Ryan Macnak 1e28b8987d [vm] Reify even more generics in the mirrors implementation to appease Dart 2.
Bug: https://github.com/dart-lang/sdk/issues/33091
Bug: https://github.com/dart-lang/sdk/issues/33098
Change-Id: Ibecce1274b9bda47e387d109a29a5af4d53adb7f
Reviewed-on: https://dart-review.googlesource.com/54704
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2018-05-11 19:18:49 +00:00
Ryan Macnak 2f458c4c48 [vm] Reify more generics in the mirrors implementation to appease Dart 2.
Bug: https://github.com/dart-lang/sdk/issues/32889
Change-Id: Ic115a2db257eb1a70a82e727890fef8695ec8bc2
Reviewed-on: https://dart-review.googlesource.com/53693
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-05-04 00:34:54 +00:00
Lasse Reichstein Holst Nielsen b3c12d4e3a Dart 2 Libraries Wave 3
Add `typeArguments` to Invocation.
Add constructors to Invocation, making it less necessary for users to create their own implementations.
Add tests.
Add Symbol.unaryMinus and Symbol.empty constants.

Change-Id: I70cb3265f9413617cf57fce1297e393a29eeb26a
Reviewed-on: https://dart-review.googlesource.com/40741
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-03-08 16:36:07 +00:00
Lasse R.H. Nielsen 3a769b9dbe Add missing methods to make classes Dart 2 valid.
Change-Id: I9a2e07de692127069d8098e3a0ea45846a3f45ae
Reviewed-on: https://dart-review.googlesource.com/43672
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2018-03-02 14:01:49 +00:00
Vyacheslav Egorov 0179aa14b3 [VM] Cleanup typing issues in mirrors_impl.dart
Bug: https://github.com/dart-lang/sdk/issues/31052
Change-Id: Ib209aed8d3e2871d8c5676b1c89a2ec2487649af
Reviewed-on: https://dart-review.googlesource.com/12447
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2017-10-16 10:30:26 +00:00
Peter von der Ahé e8aef37eac Clean up patches so they can be compiled by Fasta.
Change-Id: Ie436375c78496366accf0ba82938e54cbe30b143
Reviewed-on: https://dart-review.googlesource.com/3001
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2017-10-05 14:05:50 +00:00
Peter von der Ahé 327d8d1b0d Fix various warnings found in runtime patches.
Change-Id: I2dd82849df1bfe32c99577f6604e6a4501759697
Reviewed-on: https://dart-review.googlesource.com/7709
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2017-09-22 13:12:48 +00:00
Regis Crelier 5f5a698100 Keep types in signatures of function types properly instantiated as the function
type itself gets instantiated.
Until now, the signature was kept unchanged and the instantiation was reflected
by the type arguments of the function type only. This delayed instantiation
would complicate the implementation of generic functions.
This cl actually removes type arguments for (non-typedef) function types. The
function type is now fully represented by the signature. When the function type
is instantiated, a new signature is allocated (instead of a new type argument
vector) to hold instantiated result type and formal parameter types.
The same applies in the case of typedef function types, however, the type
arguments of the typedef are kept as before. This allows for better printing
of typedef function types and for finalization of recursive type involving
typedefs as type arguments.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2793033005 .
2017-04-06 12:28:52 -07:00
Jacob Richman a129931cda The formatter struggles a bit with these files.
BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2765523003 .
2017-03-21 18:00:52 -07:00
Peter von der Ahé ae7319727a Fix more lint style issues in runtime patches.
R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2708663002 .
2017-02-20 14:17:14 +01:00
Peter von der Ahé 00bed94e0c Fix various nits in VM patch files.
R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2705593002 .
2017-02-17 16:28:57 +01:00
Florian Loitsch 2547caab25 Reapply "reflectType() dynamic type arguments support (#26012)"
This was a pull request: 8a8033a417

MirrorsUsed doesn't transitively include reflective information. However, it must still be able to create TypeMirrors for types that are used as return- or parameter types.

Initially, the patch checked that TypeMirrors had the correct number of arguments for generic types. This is now disabled.

A better approach would be to know if a class has full reflective information, or not. But this would require much bigger changes to the system.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2615943004 .
2017-01-10 15:53:21 +01:00
Asger Feldthaus 6bae3151e2 Revert "reflectType() dynamic type arguments support (#26012)"
This reverts commit 8a8033a417.

There are a bunch of dart2js mirror tests that fail.

Issue https://github.com/dart-lang/sdk/pull/26012

BUG=

Review-Url: https://codereview.chromium.org/2617163002 .
2017-01-06 19:12:27 +01:00
Anatoly Pulyaevskiy 8a8033a417 reflectType() dynamic type arguments support (#26012)
* Basic implementation of reflecting generic types using dynamic list of type arguments

* Removed redundant expectation in test

* Added basic support for dynamic type arguments in reflectType of js_mirrors

* Fixes according to code review comments: major cleanup, added more test cases and updated docs

* Updated JS mirrors reflectType() to match behavior of VM implementation

* Terminate exception messages with a dot; Improved error handling for empty argument list and type checks;

* Use NumTypeParameters when checking provided argument list size

* Check if type arguments are malbounded; added test cases for typedefs and mixins

* Uncommented a test case

* Updated lib.status to mark some tests as failing in dart2js due to limitations in JS mirrors

* Fixed mixin test mock definition; updated configuration for tests requiring checked mode

* Handle nested generic types in type argument parsing (JS)
2017-01-06 06:05:14 -08:00
Kevin Millikin 9ab1f22b41 Make some VM libraries patch cleanly using the analyzer.
Modify the following VM dart: library patches: collection, convert,
developer, _internal, isolate, math, mirrors, profiler, vmservice_io,
_vmservice, _builtin, nativewrappers, and io.

The modifications are mostly because:

    - Patches should not be able to introduce new public members to a
      library's API.  In cases where the VM's patches introduce public
      members, the patches are rewritten to introduce private members
      instead.

    - Patches should not be able to replace arbitrary members, only
      ones declared external.  In cases where the VM's patches replace
      arbitrary members, those members are declared external in the
      SDK sources and dart2js's patch files are rewritten to use the
      original SDK implementation.

BUG=
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2564383002 .
2016-12-15 11:30:20 +01:00
Vyacheslav Egorov eb8c24e133 Reland "Merge more Kernel infrastructure from kernel_sdk SDK fork."
R=zra@google.com
BUG=

Review URL: https://codereview.chromium.org/2451623006 .
2016-10-27 10:09:22 +02:00
Vyacheslav Egorov 12968edb9c Revert "Reland "Merge more Kernel infrastructure from kernel_sdk SDK fork.""
This reverts commit 4e7a31262e.

Windows bots are broken now.

R=zra@google.com
BUG=

Review URL: https://codereview.chromium.org/2451893004 .
2016-10-26 17:07:18 +02:00
Vyacheslav Egorov 4e7a31262e Reland "Merge more Kernel infrastructure from kernel_sdk SDK fork."
This relands commit 2fed1c3905 with fixes to ensure that analyzer summaries are correctly created and XARM build does not try to use target binaries on the host.

R=zra@google.com
BUG=

Review URL: https://codereview.chromium.org/2453773002 .
2016-10-26 16:48:28 +02:00
Vyacheslav Egorov cf7ff42e60 Revert "Merge more Kernel infrastructure from kernel_sdk SDK fork."
This reverts commit 2fed1c3905.

SDK builds are failing

TBR=zra@google.com

Review URL: https://codereview.chromium.org/2455593002 .
2016-10-26 13:06:27 +02:00
Vyacheslav Egorov 2fed1c3905 Merge more Kernel infrastructure from kernel_sdk SDK fork.
- bring patched SDK generation scripts and VM patch tweaks that allow VM patch files to be parsed by analyzer front-end;
  Patched SDK is an SDK with all VM patches spliced into it. Kernel compiler is based on the analyzer front-end which does
  not have any patch files support/model so for it to produce Kernel files that match VM we need to generate a such patched SDKs.

- bring test script modifications that allow to test Kernel pipeline

BUG=
R=asiva@google.com, kmillikin@google.com, whesse@google.com, zra@google.com

Review URL: https://codereview.chromium.org/2434123003 .
2016-10-26 13:02:54 +02:00
Siva Annamalai 964a659470 - reset 'dirty' flag to false after the libraries mirrors is computed, this ensures that we compute the libraries only when new library modules are loaded and the 'dirty' flag is set to true.
- Use passed in 'zone' argument in the native string functions

- Use passed in 'thread' argument in the library mirror creation functions

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1935703002 .
2016-04-29 15:15:19 -07:00
Regis Crelier 7f57ebcfa1 Remove signature classes from the VM.
They were used as the class of closure instances and as the type class of
function types.
All closure instances now have class _Closure and function types are represented
by a new class FunctionType extending AbstractType.
Fix issue 24567 and add regression test.

R=asiva@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org/1584223006 .
2016-01-19 16:32:59 -08:00
Jacob Richman 27686cf808 Missed adding the isExternal property to all VM MethodMirror subclasses.
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1407333007 .
2015-11-06 10:51:45 -08:00
Jacob Richman 688b69fb65 Support isExternal method on MethodMirror in the Dart VM. Not really intended for public consumption. switch to using isExternal and using anonymous.
BUG=
R=alanknight@google.com, asiva@google.com

Review URL: https://codereview.chromium.org/1421133003 .
2015-10-29 19:17:08 -07:00
Ryan Macnak b6c979f20b Hoist InstanceMirror.delegate to ObjectMirror.
BUG=http://dartbug.com/14827
R=gbracha@google.com

Review URL: https://codereview.chromium.org//1273983002 .
2015-08-05 17:09:59 -07:00
Ryan Macnak bc90a5e1f0 Fix getField optimization when the selector is an operator.
BUG=http://dartbug.com/23880
R=asiva@google.com

Review URL: https://codereview.chromium.org//1247733005 .
2015-07-22 13:39:07 -07:00
Ryan Macnak 6545e8539e Fix isAssignableTo in VM mirrors to use subtype (<:) rather than moreSpecificThan (<<).
BUG=http://dartbug.com/22852
R=gbracha@google.com

Review URL: https://codereview.chromium.org//1156583005
2015-06-04 12:25:59 -07:00
Ryan Macnak eca0d72abe Provide a logical view of VM-internal maps in Observatory.
BUG=http://dartbug.com/20551
BUG=http://dartbug.com/21185
R=koda@google.com

Review URL: https://codereview.chromium.org//1150103005
2015-06-02 11:38:39 -07:00
rmacnak@google.com a6e42c48b5 Deal with deferred loading in the VM mirrors.
- Invalidate MirrorSystem.libraries when a load completes.
- Recheck if a deferred import's target has been loaded before failing.
- Allow loading libraries from a LibraryDepedencyMirror.
- Propogate compile-time error when attempting to reflect a deferred type.

BUG=http://dartbug.com/22592
R=asiva@google.com, gbracha@google.com

Review URL: https://codereview.chromium.org//1095903002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45444 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-28 23:47:45 +00:00
rmacnak@google.com 327b85d956 Move symbol demangling to dart:_internal to remove dart:core dependency on dart:mirrors.
BUG=
R=srdjan@google.com

Review URL: https://codereview.chromium.org//1107613002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45405 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-24 17:49:58 +00:00
rmacnak@google.com e2c41789ee Mirrors memory usage tweaks.
- Don't build and cache vestigial members/constructors maps.
- Avoid creating multiple LibraryMirrors for the same library.
- Store infrequently used method flags as a bitfield.
- Don't cache MethodMirror source.

mirrors_reader_test final heap size: 10.8 -> 8.9 MB (-17.5%)
mirrors_reader_test time: 1.55 -> 1.33 seconds (-14.2%)

R=asiva@google.com

Review URL: https://codereview.chromium.org//1080393006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45352 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-22 17:51:49 +00:00
rmacnak@google.com 369c119539 Remove dead ClassMirror._methods. Remove FunctionTypeMirror.members|constructors that should have been removed along with ClassMirror.members|constructors.
R=regis@google.com

Review URL: https://codereview.chromium.org//1070563007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44986 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-08 22:17:23 +00:00
rmacnak@google.com b3f4ce9bd8 Deal with type arguments of generic local functions in VM mirrors.
BUG=http://dartbug.com/14913
R=regis@google.com

Review URL: https://codereview.chromium.org//1072443005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44983 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-08 21:40:51 +00:00
rmacnak@google.com 8b6a6a1e4f Add ClassMirror.isEnum.
BUG=http://dartbug.com/21718
R=asiva@google.com, gbracha@google.com

Review URL: https://codereview.chromium.org//938513002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44035 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-26 01:13:50 +00:00
rmacnak@google.com 4abf50c04d Add LibraryDependencyMirror.isDeferred.
R=asiva@google.com, gbracha@google.com

Review URL: https://codereview.chromium.org//921163004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43829 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-17 23:49:40 +00:00
rmacnak@google.com 511c997316 Implement DeclarationMirror.location for all but ParameterMirrors.
- Mark NativeFieldWrapper classes as synthetic.
- Mark ClassID fields as synthetic.

BUG=http://dartbug.com/22378
R=gbracha@google.com, hausner@google.com

Review URL: https://codereview.chromium.org//922023002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43784 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-13 23:32:20 +00:00
regis@google.com 30dce6a5d1 Fix issue 21474 in mirrors.
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//690413002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41453 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-31 23:16:11 +00:00
rmacnak@google.com 3a40319ed2 Remove hard limit from mirrors accessor caches.
Avoids treadmilling the cache when the working set is larger than the cache size, such as the observe loop of a very large Angular app.

BUG=http://dartbug.com/20196
R=iposva@google.com

Review URL: https://codereview.chromium.org//420713008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39057 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-08 22:20:36 +00:00
rmacnak@google.com 9c2b650c15 Increase the size of the getter/setter closure caches.
TBR=asiva@google.com
BUG=http://dartbug.com/20196

Review URL: https://codereview.chromium.org//416283002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38568 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-25 00:55:52 +00:00
rmacnak@google.com 81d0f25293 Reapply "Implement an LRU cache in dart:_internal and use it for the getter/setter caches in the VM's mirrors." Reapply "Use mirror-free LRU test for dart2js"
BUG=http://dartbug.com/18445
R=asiva@google.com

Review URL: https://codereview.chromium.org//383903005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38167 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-11 18:59:06 +00:00
rmacnak@google.com f346a00c0f Revert r37059 and dependent r37589. This effectively reduced the size of the getter and setter caches, exposing http://dartbug.com/18284 in a C1 application.
Revert "Implement an LRU cache in dart:_internal and use it for the getter/setter caches in the VM's mirrors."
Revert "Use mirror-free LRU test for dart2js"

BUG=http://dartbug.com/19909
BUG=http://dartbug.com/18284
BUG=http://dartbug.com/18445
R=asiva@google.com

Review URL: https://codereview.chromium.org//375043003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38076 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-09 00:18:15 +00:00
rmacnak@google.com 7f84fb2b7f Implement an LRU cache in dart:_internal and use it for the getter/setter caches in the VM's mirrors.
BUG=http://dartbug.com/18445
R=iposva@google.com

Review URL: https://codereview.chromium.org//268783006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37059 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-06 00:45:01 +00:00