Commit Graph

595 Commits

Author SHA1 Message Date
Siva Annamalai c30918f11e 1. Remove unused dart debugger API entrypoints which are not used anymore
as this API has been deprecated and dartium was the last user.

2. Some unit tests are using some of these API entrypoints, so moved them
   over to a test file which will be linked into run_vm_tests

Change-Id: I3343b23d082400da3c803cf81ea80dfaa5e426cf
Reviewed-on: https://dart-review.googlesource.com/7942
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2017-09-26 01:00:01 +00:00
Beeravolu Siva Chandra Reddy 004a515217 Populate library imports and exports when loading library from kernel.
Change-Id: If6cc94aa186948caa8798212d6161da650ff2d8e
Reviewed-on: https://dart-review.googlesource.com/4381
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2017-09-12 10:44:49 +00:00
Vyacheslav Egorov 8a179fb953 [VM, Compiler] Move compiler to a separate folder.
New folder structure (nested under vm/):

- compiler/
-   jit/         - JIT specific code
-   aot/         - AOT specific code
-   backend/     - all middle-end and back-end code (IL, flow graph)
-   assembler/   - assemblers and disassemblers
-   frontend/    - front ends (AST -> IL, Kernel -> IL)

compiler/README.md would be the documentation root for the compiler
pipeline

Bug: https://github.com/dart-lang/sdk/issues/30575
Change-Id: I2dfd9688793bff737f7632ddc77fca766875ce36
Reviewed-on: https://dart-review.googlesource.com/2940
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2017-09-04 15:15:18 +00:00
Ryan Macnak 86f602d020 Initial idle GC logic.
Use the speed of previous scavenges to estimate the time required for the next scavenge. When we receive an initial notification, perform a scavenge if we have allocated enough and we estimate we can complete the scavenge before the deadline.

Expand the time recorded for a scavenge to include safepointing and iterating roots.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/3001423002 .
2017-09-01 09:38:08 -07:00
Ryan Macnak 14b5782544 Remove GC prologue and epilogue callbacks.
These should have been removed along with weak reference set support in 4992bc72a0 since they serve no other purpose.

Review-Url: https://codereview.chromium.org/3001343002 .
2017-08-22 11:19:54 -07:00
Beeravolu Siva Chandra Reddy eeaeb6fbf6 Adjust the column number where a StackOverflow error is reported.
Before this change, the column number of the StackOverflow error was
reported at the opening '(' of the function parameter list:

  ReturnType function(...) { ... }
                     ^

This change moves it to the opening '{':

  ReturnType function(...) { ... }
                           ^

In case of single statement functions with '=>', the location of the '='
is reported as the column number of the StackOverflow error.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/3002833003 .
2017-08-21 11:09:11 +02:00
Alexander Markov 5b694c1b1c [vm] Remove Dart_MakeExternalString and --support-externalizable-strings
This CL removes unused Dart API Dart_MakeExternalString, VM option
--support-externalizable-strings and underlying support for
externalizable strings from Dart VM.

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

Issue: https://github.com/dart-lang/sdk/issues/30474
Review-Url: https://codereview.chromium.org/2997173002 .
2017-08-17 17:49:35 -07:00
Beeravolu Siva Chandra Reddy 2ea5140093 Fix couple of vm/cc/DartAPI_* tests for the dartk configuration.
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2994883002 .
2017-08-14 17:54:50 +02:00
Siva Annamalai 73d30074b1 - Convert all isolate flags to a bit field.
- Add a new isolate specific flag to cause the isolate to run in kernel mode.

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2995723002 .
2017-08-11 12:38:25 -07:00
Beeravolu Siva Chandra Reddy abf9eae3f7 Add a prefix convention for tests in [dart|debugger]_api_impl_tests.cc.
R=asiva@google.com

Review-Url: https://codereview.chromium.org/3001513002 .
2017-08-11 10:38:11 +02:00
Alexander Markov ed74405635 [vm] Revise Dart_IntegerToHexCString to avoid dependency on Bigint, v.2
Reapply 3d4838fc70 with the following
modifications:
* define PRIX64 to fix compilation errors on Windows;
* add and use short form format specifiers PX and PX64 to make it
  uniform with other format specifiers.

Original review: https://codereview.chromium.org/2987183002

Description of the original CL:

Until this change, implementation of Dart_IntegerToHexCString()
always created Bigint objects and used Bigint::ToHexCString() to do
the work.

In --limit-ints-to-64-bits mode (with Dart integers limited to 64
bits) Bigints are banned and should not be used.
This CL revises Dart_IntegerToHexCString implementation to avoid
creating Bigint objects for Smi and Mint arguments, so it would
work in --limit-ints-to-64-bits mode.

Also, this CL adds test case to lock down the behavior of
Dart_IntegerToHexCString.

R=zra@google.com

Issue: https://github.com/dart-lang/sdk/issues/30103
Review-Url: https://codereview.chromium.org/2985423002 .
2017-08-01 10:49:51 -07:00
Alexander Markov 62bbd4895d [vm] Several unit tests are corrected for limited ints
This CL corrects several unit tests to work in --limit-ints-to-64-bits
mode: without built-in Bigints and with wrap-around 64-bit Dart
integers.

R=zra@google.com

Issue: https://github.com/dart-lang/sdk/issues/30103
Review-Url: https://codereview.chromium.org/2992093002 .
2017-08-01 09:29:11 -07:00
Alexander Markov caffcd8702 Revert "[vm] Revise Dart_IntegerToHexCString to avoid dependency on Bigint"
This reverts commit 3d4838fc70 as it fails
to compile on Windows.

Review-Url: https://codereview.chromium.org/2992733003 .
2017-08-01 09:08:12 -07:00
Alexander Markov 3d4838fc70 [vm] Revise Dart_IntegerToHexCString to avoid dependency on Bigint
Until this change, implementation of Dart_IntegerToHexCString()
always created Bigint objects and used Bigint::ToHexCString() to do
the work.

In --limit-ints-to-64-bits mode (with Dart integers limited to 64
bits) Bigints are banned and should not be used.
This CL revises Dart_IntegerToHexCString implementation to avoid
creating Bigint objects for Smi and Mint arguments, so it would
work in --limit-ints-to-64-bits mode.

Also, this CL adds test case to lock down the behavior of
Dart_IntegerToHexCString.

R=asiva@google.com

Issue: https://github.com/dart-lang/sdk/issues/30103
Review-Url: https://codereview.chromium.org/2987183002 .
2017-08-01 09:00:39 -07:00
Siva Annamalai 33c50e9374 1. Correctly set root_library based on the application script URI instead of looking for the library that has the 'main' method.
2. Adjust the Dart front end to not require a 'main' method when the in memory filesystem is used, this allows execution of VM unit tests which all do not necessarily have a 'main' method (integrated CL from siggi)

3. Change kernel reader to not look for a 'main' methos when Dart_LoadKernel is called.

4. Change Dart_LoadScript to also support loading of dart programs when Dart front end is used

R=aam@google.com, sigmund@google.com

Review-Url: https://codereview.chromium.org/2948273002 .
2017-07-19 18:09:19 -07:00
Alexander Markov bc937b3b6b Reapply CL "Option to truncate integers to 64 bits, part 2"
This is the 2nd attempt to land the CL
abed3c2a70

Original review: https://codereview.chromium.org/2982823002
No extra changes were made. Large literals in the Dart core library
which caused failures during the previous attempt to land this CL have
been fixed separately.

Description of the CL:

In --limit-ints-to-64-bits mode:
* Integer constructors return Integer::null if integer is out of range.
* Error is reported for integer literals which are out of range.
* Dart API is revised to return errors if integers are out of range.

Bigint::IsDisabled() method is introduced to be able to enable/disable
Bigints independently of --limit-ints-to-64-bits mode in future.

Deprecated constructor Integer::NewFromUint64 is replaced with
Integer::New in certain cases.

R=regis@google.com

Issue: https://github.com/dart-lang/sdk/issues/30103
Review-Url: https://codereview.chromium.org/2980223002 .
2017-07-17 12:20:17 -07:00
Alexander Markov 776aef9ff0 Revert "Option to truncate integers to 64 bits, part 2"
This reverts commit abed3c2a70.

TBR

Review-Url: https://codereview.chromium.org/2977143002 .
2017-07-14 14:40:58 -07:00
Alexander Markov abed3c2a70 Option to truncate integers to 64 bits, part 2
In --limit-ints-to-64-bits mode:
* Integer constructors return Integer::null if integer is out of range.
* Error is reported for integer literals which are out of range.
* Dart API is revised to return errors if integers are out of range.

Bigint::IsDisabled() method is introduced to be able to enable/disable
Bigints independently of --limit-ints-to-64-bits mode in future.

Deprecated constructor Integer::NewFromUint64 is replaced with
Integer::New in certain cases.

R=zra@google.com

Issue: https://github.com/dart-lang/sdk/issues/30103
Review-Url: https://codereview.chromium.org/2982823002 .
2017-07-14 13:24:53 -07:00
Alexander Markov 32e226be02 Cleanup unused Dart API Dart_IdentityHash
There are a few problems with this function:
* It returns uint64_t instead of int64_t, which is different from
core Dart library function identityHashCode()
* Dart_IdentityHash truncates negative Mint and Bigint values to 0,
while negative Smi values are converted to uint64_t.

The Dart_IdentityHash function is not used, so we decided to remove it
instead of fixing these problems.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2980043002 .
2017-07-13 13:56:05 -07:00
Alexander Markov 1c343d35ac Fix bug in Dart API Dart_IntegerToUint64: crash on negative Mints
R=zra@google.com

Review-Url: https://codereview.chromium.org/2982753002 .
2017-07-13 12:19:25 -07:00
Zachary Anderson 6cd8a79078 VM: Re-format to use at most one newline between functions
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2974233002 .
2017-07-13 08:08:37 -07:00
Erik Corry 4b9bba55b4 Stoppp using trippple consonants
R=ahe@google.com
BUG=

Review-Url: https://codereview.chromium.org/2833073002 .
2017-04-21 17:50:13 +02:00
Vyacheslav Egorov 9fd4823e9d VM: Fix simdbc and darkp builds.
- When generating app-aot snapshot we are currently running Kernel isolate
in the precompiler mode, which means we can't have field guards enabled.

- DBC does not support field guards so flags must be correctly initialized.

BUG=
TBR=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2720893004 .
2017-02-28 22:20:44 +01:00
Ben Konyi f2fd150ea0 Added new type of unit test, RAW_UNIT_TEST_CASE, which is used for tests that can be flaky if run while the VM is alive. Tests created using the RAW_UNIT_TEST_CASE macro will run after the VM has shutdown to avoid having any worker threads contaminating the test results.
BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2666133002 .
2017-01-31 15:16:38 -08:00
Vyacheslav Egorov 9bae50bf47 VM: [Kernel] Revert changes to the native ports that introduced peers.
The problem with these changes was that closed ports still continue to receive
messages and as a result we start using dead peer objects.

Fixing that would require more intrusive changes into message handler implementation - so instead we are reverting the changes and restoring manual PORT -> PEER mapping.

BUG=
R=erikcorry@google.com

Review-Url: https://codereview.chromium.org/2666063002 .
2017-01-31 10:30:15 +01:00
John McCutchan d6c8478c5a Fix Mac IA32 build breakage
BUG=
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2664993002 .
2017-01-30 14:09:58 -08:00
Vyacheslav Egorov 43a0500e37 VM: [Kernel] Fix bootstraping when Kernel isolate is used.
We must bootstrap from Kernel instead of Source when running with --dfe

BUG=
R=asiva@google.com, kustermann@google.com

Review-Url: https://codereview.chromium.org/2651633002 .
2017-01-30 20:52:59 +01:00
Ryan Macnak b46af1e75f Refactor snapshots pieces to include a section for loading instructions into the heap of a regular isolate.
Progress toward allowing each isolate to load a different snapshot.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2622053002 .
2017-01-23 10:25:02 -08:00
Ryan Macnak 26a364f998 Support spawnUri in app snapshots.
- Don't mark core_isolate_snapshot_buffer as a const pointer.
 - Update app snapshots without code to not rewrite the VM isolate snapshot, as already done by app snapshots with code.

Fixes #28368

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2637193002 .
2017-01-17 15:59:41 -08:00
Ryan Macnak 12a3699301 Revert "Support spawnUri in app snapshots."
Failures on IA32.

This reverts commit c6ecfe1746.

Review-Url: https://codereview.chromium.org/2631893002 .
2017-01-13 15:52:36 -08:00
Ryan Macnak c6ecfe1746 Support spawnUri in app snapshots.
Don't mark core_isolate_snapshot_buffer as a const pointer.

Fixes #28368

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2623423007 .
2017-01-13 15:18:27 -08:00
Ryan Macnak f89056f6cd Revert "Support spawnUri in app snapshots."
This reverts commit 593d4504b0.
This reverts commit 113aa64b98.
This reverts commit 422afa2ead.

Review-Url: https://codereview.chromium.org/2633543003 .
2017-01-13 11:02:44 -08:00
Ryan Macnak 593d4504b0 Support spawnUri in app snapshots.
Fixes #28368

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2628283002 .
2017-01-13 10:37:51 -08:00
Regis Crelier dc0605012f Move Null type to the Bottom in the VM (fixes #28025).
Fix wrong comments.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2608373002 .
2017-01-05 10:05:31 -08:00
John McCutchan f125cc7d0b Improve the casing of Stackmap and Stacktrace.
- [x] Stackmap -> StackMap
- [x] Stacktrace -> StackTrace

This makes us consistent with the Dart language (StackTrace) and
corrects the casing of StackMap.

BUG=
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2572563004 .
2016-12-12 14:51:30 -08:00
Zachary Anderson a1bcf051d8 clang-format runtime/vm
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2481873005 .
2016-11-08 13:54:47 -08:00
Jacob Richman 72503ff98d Extend ignore_patch_signature_mismatch used by dartium to ignore type parameters with different bounds
BUG=https://github.com/dart-lang/sdk/issues/27568
R=asiva@google.com

Review URL: https://codereview.chromium.org/2405193004 .
2016-10-12 17:25:55 -07:00
John McCutchan 632c76942c Add Dart_GetStickyError
- [x] Add Dart_GetStickyError.
- [x] Change Dart_SetStickyError to allow for null and also not set the pause on exit bit.

BUG=
R=turnidge@google.com

Review URL: https://codereview.chromium.org/2350633003 .
2016-09-19 13:31:09 -07:00
Matthias Hausner 3e0d13bc28 Make compile-time errors catchable
If an error happens during the compilation of a function body, an Error is thrown which can be intercepted, and ensures that finally blocks are executed before the isolate is terminated.

The language spec is vague about compilation errors. A doc describing the intentions behind this CL is at
https://docs.google.com/document/d/1_MWOgwJadLCQSBps0zD6Rj5dG4iP1UBuiDvTMH-WMzI/edit#

Example:
     1	void bad() {
     2	    return 5
     3	}
     4
     5	void main(args) {
     6	    bad();
     7	}

Before this CL:
$ dart ~/tmp/e.dart
'file:///Users/hausner/tmp/e.dart': error: line 2 pos 11: semicolon expected
  return 5
          ^
$

After this change:
$ dart ~/tmp/e.dart
Unhandled exception:
'file:///Users/hausner/tmp/e.dart': error: line 2 pos 11: semicolon expected
  return 5
          ^

#0      main (file:///Users/hausner/tmp/e.dart:6:3)
#1      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:259)
#2      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:148)
$

Notice that the stack trace points to the call site of bad(), not the text location of the syntax error. That's not a bug. The location of the syntax error is given in the error message.

BUG= https://github.com/dart-lang/sdk/issues/23684
R=asiva@google.com, lrn@google.com

Review URL: https://codereview.chromium.org/2044753002 .
2016-09-16 10:10:38 -07:00
Matthias Hausner e1e4a950ad Remove legacy patch class syntax in VM
This should now work since the last remaining uses of legacy
patch syntax in Dartium are gone.

This reverts commit 04b8a627d6.

BUG=

Review URL: https://codereview.chromium.org/2292213002 .
2016-08-30 10:54:52 -07:00
Ryan Macnak e46b3cd994 Treat background finalization as another GC task so it won't run in parallel with the marker.
Prevents a race between the marker and finalizer when the handle is freed (fixes #27029).

Disallow creating weak handles for immediate objects. We don't distinguish these from free handles, so their callbacks are never run.

Don't report freed handles over the vm service.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2281193002 .
2016-08-29 16:47:56 -07:00
Matthias Hausner 04b8a627d6 Backing out change that removed legacy patch syntax
Dartium test html/async_spawnuri_test is failing when legacy
patch class syntax parsing is removed.

Once dartium is fixed, this change can be re-applied.

TBR=terry

Review URL: https://codereview.chromium.org/2274663004 .
2016-08-24 16:48:50 -07:00
Matthias Hausner cf6a6e6e63 Remove legacy patch class syntax in VM
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/2247073002 .
2016-08-15 15:23:49 -07:00
Matthias Hausner 1a6d1eca32 Implement @patch annotation for patch class members
Allow members of patch classes to be annotated with @patch. The VM
ignores the annotation. I simply replaces the original method
if the name matches, or reports an error if field names match.

Adding a bit is_patched to members to do more checking remains a
TODO. There are currently no unused bits available, and I don’t want
to increase the size of Function objects for this.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/2230383003 .
2016-08-10 12:54:57 -07:00
John McCutchan 800b1352ce Add an API for setting the sticky error
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/2223913002 .
2016-08-08 12:14:33 -07:00
Todd Turnidge 1166f83bf6 Only reload libraries when they may have been modified.
We now check all of the scripts which make up a library.  If any
script is modified, then we consider that library to be modified.  We
also consider any library which imports a modified library to be
modified.  To propagate this info efficiently, we build and discard
the imported-by graph when beginning a reload.

The embedder must provide a FileModifiedCallback in order to support
the detection of modified scripts.

In order to detect changes to package: libraries, we have modified the
embedder interface to provide the resolved url when possible, so that
we don't need to re-resolve package uris when checking for reload.
This change is incompatible and all embedders will need to be updated.

We now support a "force" flag when reloading sources.  This causes all
libraries to be reloaded regardless of whether the underlying scripts
have been updated.

Closes #26919

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2186423002 .
2016-07-29 11:23:18 -07:00
Todd Turnidge f7242f2137 Reimplement devfs in dart. Implementation now writes to disk.
BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2120473004 .
2016-07-01 14:57:32 -07:00
Ryan Macnak 1006be18da Remove bogus deletion of a weak handle that has already been finalized.
BUG=http://dartbug.com/26769
R=asiva@google.com

Review URL: https://codereview.chromium.org/2113063002 .
2016-06-30 14:38:56 -07:00
Ryan Macnak a86111854a Allow null in Dart_SetRootLibrary.
R=fschneider@google.com

Review URL: https://codereview.chromium.org/2093813002 .
2016-06-23 17:22:30 -07:00
Ryan Macnak 103e316f6a Reapply "Background finalization."
- Fix double-finalization by marking handles that are in a finalization queue.
 - Remember external size in words instead of bytes.
 - Add SlowFinalizer test.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2084193003 .
2016-06-22 16:26:49 -07:00